Class NpcView
What it proves: only that the caller read these values from a live NPC on one tick. tile() is the
south-west corner of the footprint on every server (the server's tile, not the drawn centre of a big NPC);
size() is its edge length in tiles.
Unreadable looks like: name(), tile() and overhead() are null when they
could not be read. observedTargetsUs() and observedTargetsOther() are null when interaction
data was unavailable; the legacy boolean accessors return false for that case. overhead() tells "not praying" apart from "unknown": it is NO_OVERHEAD
("NONE") when the read worked and no icon shows, and null only when it could not be read.
size() is 0 when the size could not be read; it is never reported as 1 by guess. A null name
never matches a TargetSpec; a null tile is never inside an area and is treated as infinitely far away.
Thread rule: pure value type, safe on any thread. Build it inside the same GameThread.ensure batch that
read the NPC.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringoverhead()when the overhead was read and the NPC shows none. -
Constructor Summary
ConstructorsConstructorDescriptionNpcView(int id, int index, String name, int animation, int graphic, int healthRatio, int healthScale, int size, net.runelite.api.coords.WorldPoint tile, boolean targetsUs, boolean targetsOther, boolean dead, String overhead) NpcView(int id, int index, String name, int animation, int graphic, int healthRatio, int healthScale, int size, net.runelite.api.coords.WorldPoint tile, Boolean targetsUs, Boolean targetsOther, boolean dead, String overhead) Nullable targeting observations: null means the client's interaction data was unreadable. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanbusy()True when the NPC is fighting someone else, so it is not ours to take.booleandead()booleanintgraphic()inthashCode()intintintid()intindex()name()overhead()A HeadIcon name (for example"MAGIC"),NO_OVERHEADwhen the read worked and the NPC shows no overhead, ornullwhen it could not be read (unknown, not "not praying").intsize()Edge length of the footprint in tiles, or0when it could not be read (unknown, not 1).booleanLegacy convenience: false also when unreadable; use observedTargetsOther for decisions.booleanLegacy convenience: false also when unreadable; use observedTargetsUs for decisions.net.runelite.api.coords.WorldPointtile()South-west corner of the footprint, ornullwhen it could not be read.toString()
-
Field Details
-
NO_OVERHEAD
overhead()when the overhead was read and the NPC shows none.- See Also:
-
-
Constructor Details
-
NpcView
-
NpcView
public NpcView(int id, int index, String name, int animation, int graphic, int healthRatio, int healthScale, int size, net.runelite.api.coords.WorldPoint tile, Boolean targetsUs, Boolean targetsOther, boolean dead, String overhead) Nullable targeting observations: null means the client's interaction data was unreadable.
-
-
Method Details
-
id
public int id() -
index
public int index() -
name
-
animation
public int animation() -
graphic
public int graphic() -
healthRatio
public int healthRatio() -
healthScale
public int healthScale() -
size
public int size()Edge length of the footprint in tiles, or0when it could not be read (unknown, not 1). -
tile
public net.runelite.api.coords.WorldPoint tile()South-west corner of the footprint, ornullwhen it could not be read. When the size is unknown and only the drawn centre could be read (a supported client whose server tile is unreadable), it is the south-west corner a 5x5 NPC centred there would have, so a 5x5 footprint from it covers the NPC. -
targetsUs
public boolean targetsUs()Legacy convenience: false also when unreadable; use observedTargetsUs for decisions. -
targetsOther
public boolean targetsOther()Legacy convenience: false also when unreadable; use observedTargetsOther for decisions. -
observedTargetsUs
-
observedTargetsOther
-
dead
public boolean dead() -
overhead
A HeadIcon name (for example"MAGIC"),NO_OVERHEADwhen the read worked and the NPC shows no overhead, ornullwhen it could not be read (unknown, not "not praying"). -
busy
public boolean busy()True when the NPC is fighting someone else, so it is not ours to take. -
equals
-
hashCode
-
toString
-