Class TargetSpec
java.lang.Object
privbot.mechanics.TargetSpec
Which NPCs count as a target: by name, by id, minus an ignore list, optionally inside an area. Immutable; each
builder call returns a new spec.
What it proves: matches(privbot.mechanics.NpcView) is true when the NPC's id is listed or its name matches, it is not ignored
by name, and (if an area is set) its tile is inside the area. A name entry starting with = is an exact
match; any other entry matches when either string contains the other. With contains(false) every entry is
an exact match. Comparison is case-insensitive and trims spaces. With no names and no ids nothing matches, except
for any(), which matches every NPC (still minus the ignore list, and only inside the area if one is set).
Unreadable looks like: a null name never matches by name, and a null tile fails an area check. It never matches by guess.
Thread rule: pure, safe on any thread.
-
Method Summary
Modifier and TypeMethodDescriptionalsoIds(int... ids) Also matches these NPC ids, whatever their name (adds ids to a spec built withnamed(java.lang.String...)).static TargetSpecany()A spec matching every NPC; narrow it withignore(java.lang.String...)orwithin(net.runelite.api.coords.WorldArea).contains(boolean contains) true(default): plain entries match by containment;false: every entry is an exact match.static TargetSpecids(int... ids) A spec matching these NPC ids, whatever their name.Never matches an NPC whose name matches one of these (same rules as names).booleanstatic TargetSpecA spec matching these names.within(net.runelite.api.coords.WorldArea area) Only matches NPCs whose tile is insidearea.
-
Method Details
-
any
A spec matching every NPC; narrow it withignore(java.lang.String...)orwithin(net.runelite.api.coords.WorldArea). -
named
A spec matching these names. A plain entry matches by containment in BOTH directions (the name-matching rule):"spectre"matches "Aberrant spectre", and"aberrant spectre"also matches an NPC named just "Spectre". Prefix an entry with=for an exact match, or callcontains(false)to make every entry exact. -
ids
A spec matching these NPC ids, whatever their name. -
alsoIds
Also matches these NPC ids, whatever their name (adds ids to a spec built withnamed(java.lang.String...)). -
ignore
Never matches an NPC whose name matches one of these (same rules as names). -
within
Only matches NPCs whose tile is insidearea. -
contains
true(default): plain entries match by containment;false: every entry is an exact match. -
matches
-