Class DeathWatch
observe(java.lang.Integer, java.lang.Integer, net.runelite.api.coords.WorldPoint, int) call per game tick. Pure: the caller
reads hitpoints, animation and tile and feeds them in; nothing here touches a client. Not thread-safe: feed it
from one thread.
What it proves: DEAD when hitpoints read 0 or the animation is a death animation (default 836, the OSRS death
animation, or the set the constructor was given). Hitpoints reading 0 always catch a death, on every server. The
animation is only a faster cue, and its id differs per server: Elorin's player animations are the OSRS id + 19000
(19836), so pass new DeathWatch(Set.of(836, 19836)) to also catch the animation there. After a death, RESPAWNED is answered once, on the first tick where hitpoints are above 0
and either the tile differs from where the player died or hitpoints have been above 0 for 3 distinct ticks in a
row; after that the watch is ALIVE again. A death animation that is still showing keeps the watch DEAD.
Unreadable looks like: null hitpoints answer UNKNOWN, never ALIVE, and break the run of "hitpoints above 0" ticks. A null tile never counts as a change. Never subscribe to the animation event for the local player's death (a client does not see its own death through it on some servers); poll.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe OSRS death animation (836). -
Constructor Summary
ConstructorsConstructorDescriptionA watch with the default death animation {836}.DeathWatch(Set<Integer> deathAnimations) -
Method Summary
-
Field Details
-
DEFAULT_DEATH_ANIMATION
public static final int DEFAULT_DEATH_ANIMATIONThe OSRS death animation (836). Elorin's is 19836 (OSRS id + 19000); hitpoints 0 catch a death anyway.- See Also:
-
-
Constructor Details
-
DeathWatch
public DeathWatch()A watch with the default death animation {836}. -
DeathWatch
-
-
Method Details
-
observe
public DeathWatch.State observe(Integer hp, Integer animation, net.runelite.api.coords.WorldPoint tile, int tick) Feeds one tick.- Parameters:
hp- current hitpoints, or null when unreadableanimation- the local player's animation id, or null / -1 for nonetile- the local player's tile, or null when unreadabletick- the game tick number (any increasing number)- Returns:
- what this tick says
-
diedAtTick
public int diedAtTick()- Returns:
- the tick the latest death was first seen, or -1 when none has been seen
-
diedAt
public net.runelite.api.coords.WorldPoint diedAt()- Returns:
- the tile the latest death was first seen on, or null when none (or the tile was unreadable)
-
reset
public void reset()Forgets any death in progress (Stop, disconnect).
-