Class ThreatSnapshot
java.lang.Object
privbot.mechanics.ThreatSnapshot
A detached copy of one tick of a fight: the local player, the NPCs, projectiles and graphics around them, and the
prayers that were checked. Immutable, so it can be kept, compared with the next tick's and passed to the pure
planners (
PrayerPlanner, ShotTracker, CueTimeline) on any thread.
It is produced by ctx.threats.snapshot(..), which reads everything in one client-thread batch. A
snapshot that exists proves the player's tile, the NPC, projectile and graphics lists were read. Hitpoints, prayer
points and individual prayers that could not be read are reported as null / unreadablePrayers() rather
than as 0 or off; a list that could not be read yields an unreadable Observed instead of a snapshot with
empty lists.
Pure data: no client calls, safe on any thread.
-
Constructor Summary
ConstructorsConstructorDescriptionThreatSnapshot(int tick, int cycle, net.runelite.api.coords.WorldPoint player, Integer hp, Integer maxHp, Integer prayerPoints, int currentTargetIndex, List<NpcView> npcs, List<ShotView> shots, List<GraphicView> graphics, Set<String> activePrayers, Set<String> unreadablePrayers) -
Method Summary
-
Constructor Details
-
ThreatSnapshot
public ThreatSnapshot(int tick, int cycle, net.runelite.api.coords.WorldPoint player, Integer hp, Integer maxHp, Integer prayerPoints, int currentTargetIndex, List<NpcView> npcs, List<ShotView> shots, List<GraphicView> graphics, Set<String> activePrayers, Set<String> unreadablePrayers) - Parameters:
tick- the client's tick countcycle- the client's game cycleplayer- the local player's world tilehp- current hitpoints, or null when they could not be readmaxHp- real hitpoints level, or null when it could not be readprayerPoints- current prayer points, or null when they could not be readcurrentTargetIndex- the index of the NPC the player is interacting with, or -1npcs- the NPCs kept by the queryshots- the projectiles still in flightgraphics- the graphics still drawnactivePrayers- the checked prayers that read activeunreadablePrayers- the checked prayers whose state could not be read
-
-
Method Details
-
tick
public int tick()- Returns:
- the client's tick count when read
-
cycle
public int cycle()- Returns:
- the client's game cycle when read
-
player
public net.runelite.api.coords.WorldPoint player()- Returns:
- the local player's world tile
-
hp
- Returns:
- current hitpoints, or null when they could not be read (null is not 0)
-
maxHp
- Returns:
- real hitpoints level, or null when it could not be read (null is not 0)
-
prayerPoints
- Returns:
- current prayer points, or null when they could not be read (null is not 0)
-
currentTargetIndex
public int currentTargetIndex()- Returns:
- the index of the NPC the player is interacting with, or -1 for none
-
npcs
-
shots
-
graphics
- Returns:
- the graphics still drawn (unmodifiable)
-
activePrayers
- Returns:
- the checked prayers that read active. A prayer the query named is in exactly one of this set,
unreadablePrayers(), or neither (it read as off); prayers the query did not name are never listed
-
unreadablePrayers
- Returns:
- the checked prayers whose state could not be read this tick. They are unknown, not off: do not treat
absence from
activePrayers()as "off" for a prayer listed here
-
find
- Parameters:
index- an NPC index- Returns:
- that NPC in this snapshot, or null when the snapshot has none with that index
-
toString
-