Class PlayerView

java.lang.Object
privbot.mechanics.PlayerView

public final class PlayerView extends Object
One player reduced to what a PvP fight needs. Immutable.

What it proves: only that ctx.pvp.snapshot(..) read these values from a live player on one tick.

Unreadable looks like: every boxed accessor is null when its read failed, and a null is never a negative answer. overhead() and skull() tell "nothing shown" apart from "unknown": they are NONE ("NONE") when the read worked and no icon shows, and null only when it could not be read. wornItemIds() is an empty list when the appearance was read and nothing is worn, and null when the appearance could not be read.

Thread rule: pure value type, safe on any thread.

  • Field Details

  • Constructor Details

    • PlayerView

      public PlayerView(String name, int index, Integer combatLevel, String overhead, String skull, Integer healthRatio, Integer healthScale, Integer animation, Integer graphic, List<Integer> wornItemIds, net.runelite.api.coords.WorldPoint tile, Boolean targetsUs, Integer interactingIndex)
      Parameters:
      name - the display name (tags removed), or null when unreadable
      index - the player's index in the client's player array (Player.getId())
      combatLevel - the combat level, or null when unreadable
      overhead - the overhead prayer icon's name, NONE, or null when unreadable
      skull - the skull icon's name, NONE, or null when unreadable
      healthRatio - the HP bar fill, or null when unreadable
      healthScale - the HP bar scale, or null when unreadable
      animation - the current animation id (server ids), or null when unreadable
      graphic - the current spot graphic id, or null when unreadable
      wornItemIds - the worn item ids (copied), empty when none are worn, null when unreadable
      tile - the player's tile
      targetsUs - whether it interacts with the local player, or null when unreadable
      interactingIndex - the player index it interacts with, -1 for an NPC or nothing, or null when unreadable
    • PlayerView

      public PlayerView(String name, int index, Integer combatLevel, String overhead, String skull, Integer healthRatio, Integer healthScale, Integer animation, Integer graphic, List<Integer> wornItemIds, net.runelite.api.coords.WorldPoint tile, Boolean targetsUs, Integer interactingIndex, Integer weaponId)
      As above; weaponId is the worn weapon's item ID, -1 for an empty slot, or null if unreadable.
    • PlayerView

      public PlayerView(String name, int index, Integer combatLevel, String overhead, String skull, Integer healthRatio, Integer healthScale, Integer animation, Integer graphic, List<Integer> wornItemIds, net.runelite.api.coords.WorldPoint tile, Boolean targetsUs, Integer interactingIndex, Integer weaponId, String weaponName)
      As above, with the name resolved from the item definition, or null when unavailable.
  • Method Details

    • name

      public String name()
      Returns:
      the display name with tags removed, or null when unreadable
    • index

      public int index()
      Returns:
      the index in the client's player array (Player.getId())
    • combatLevel

      public Integer combatLevel()
      Returns:
      the combat level, or null when unreadable
    • overhead

      public String overhead()
      Returns:
      the overhead prayer icon's HeadIcon name ("MAGIC", "DEFLECT_MAGE", ...), NONE when none shows, or null when unreadable
    • skull

      public String skull()
      Returns:
      the skull icon's SkullIcon name ("SKULL", ...), NONE, or null when unreadable
    • healthRatio

      public Integer healthRatio()
      Returns:
      the HP bar fill, or null when unreadable
    • healthScale

      public Integer healthScale()
      Returns:
      the HP bar scale, or null when unreadable
    • animation

      public Integer animation()
      Returns:
      the current animation id in this server's ids, or null when unreadable
    • graphic

      public Integer graphic()
      Returns:
      the current spot graphic id, or null when unreadable
    • wornItemIds

      public List<Integer> wornItemIds()
      Returns:
      the worn item ids (unmodifiable), empty when nothing is worn, null when unreadable
    • weaponId

      public Integer weaponId()
      Returns:
      weapon item id, -1 when the slot is empty, or null when it cannot be read
    • weaponName

      public String weaponName()
      Returns:
      weapon name, or null when empty or the weapon or definition cannot be read
    • tile

      public net.runelite.api.coords.WorldPoint tile()
      Returns:
      the player's tile (the server tile on supported clients when it can be read)
    • targetsUs

      public Boolean targetsUs()
      Returns:
      whether this player interacts with the local player, or null when unreadable
    • interactingIndex

      public Integer interactingIndex()
      Returns:
      the player index it interacts with, -1 for an NPC or nothing, or null when unreadable
    • toString

      public String toString()
      Overrides:
      toString in class Object