Class TagAllTracker
java.lang.Object
privbot.mechanics.TagAllTracker
Spreads a first hit across every NPC in a group before finishing any, the tag-all-then-kill pattern.
What it proves: isTagged(int) is true only for an index the caller marked and has not since pruned. It does
not see attacks; the caller marks an NPC after its own attack went out.
Unreadable looks like: nextTarget returns null when the list is null or empty. An NPC with no tile is
treated as infinitely far away, so it is picked only when nothing else is left.
Thread rule: mutable, single-owner. Call from the thread that handles the game tick.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisTagged(int index) voidmarkTagged(int index) nextTarget(List<NpcView> npcs, net.runelite.api.coords.WorldPoint player) The NPC to attack next: nearest untagged, else nearest overall, elsenull.voidForgets tags for NPCs that are no longer present.voidreset()intHow many indices are currently tagged (diagnostics).
-
Constructor Details
-
TagAllTracker
public TagAllTracker()
-
-
Method Details
-
nextTarget
The NPC to attack next: nearest untagged, else nearest overall, elsenull. Nearest is Chebyshev distance fromplayer, ties to the lower index. The caller filters out dead or unwanted NPCs first.- Returns:
- the chosen view from
npcs(mark its index withmarkTagged(int)once your attack went out), or null
-
markTagged
public void markTagged(int index) -
isTagged
public boolean isTagged(int index) -
pruneTo
Forgets tags for NPCs that are no longer present. The server reuses NPC indices as things die and spawn, so without this a fresh NPC inheriting a dead one's index would look already tagged and be skipped. Call once per tick with every live index. A null set is ignored. -
taggedCount
public int taggedCount()How many indices are currently tagged (diagnostics). -
reset
public void reset()
-