Class Avatar

java.lang.Object
dev.twilite.game.facade.Avatar

public class Avatar extends Object
Convenience facade for reading state from the local player.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Returns whether the local player is currently animating.
    static int
    Returns the local player's current animation id, or -1 when unavailable.
    static Rect
    Returns the local player's occupied area, or a one-tile null area when unavailable.
    static Coord
    Returns the local player's coordinate, or (-1, -1, 0) when unavailable.
    static int
    Returns Chebyshev distance from the local player to a coordinate, or Integer.MAX_VALUE when unavailable.
    static int
    Returns Chebyshev distance from the local player to a rectangle, or Integer.MAX_VALUE when unavailable.
    static int
    Returns Chebyshev distance from the local player to a unit, or Integer.MAX_VALUE when unavailable.
    static IntStream
    Returns active effect ids on the local player.
    static Optional<? extends Unit>
    Returns the unit currently faced by the local player, when available.
    static boolean
    Returns whether the local player is facing any unit.
    static boolean
    Returns whether the local player is facing the supplied unit.
    static int
    Returns the rendered percent for a local-player headbar, or -1 when unavailable.
    static boolean
    Returns whether a local-player headbar is currently rendered.
    static IntStream
    Returns active headbar ids on the local player.
    static String
    Returns the local player's overhead chat message, or an empty string when unavailable.
    static int
    Returns the local player's rendered health percent, or -1 when unavailable.
    static boolean
    Returns whether the local player's health bar is currently rendered.
    static List<Hitmark>
    Returns active hitmarks on the local player.
    static int
    Returns the local player's player index, or -1 when unavailable.
    static int
    kit(KitType type)
    Returns the equipped appearance kit id for a body part, or -1 when unavailable.
    static boolean
    Returns whether the local player has line of sight to a coordinate.
    static boolean
    Returns whether the local player has line of sight to a rectangle.
    static boolean
    Returns whether the local player has line of sight to a unit.
    static boolean
    Returns whether the local player has line of walk to a coordinate.
    static boolean
    Returns whether the local player has line of walk to a rectangle.
    static boolean
    Returns whether the local player has line of walk to a unit.
    static int
    Returns Manhattan distance from the local player to a coordinate, or Integer.MAX_VALUE when unavailable.
    static int
    Returns Manhattan distance from the local player to a rectangle, or Integer.MAX_VALUE when unavailable.
    static int
    Returns Manhattan distance from the local player to a unit, or Integer.MAX_VALUE when unavailable.
    static boolean
    Returns whether the local player is currently moving.
    static String
    Returns the local player's display name, or an empty string when unavailable.
    static int
    Returns the local player's orientation, or -1 when unavailable.
    static int
    Returns the local player's overhead prayer icon id, or -1 when unavailable.
    static int
    Returns the local player's skull icon id, or -1 when unavailable.
    static int
    Returns the local player's stance id, or -1 when unavailable.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Avatar

      public Avatar()
  • Method Details

    • kit

      public static int kit(KitType type)
      Returns the equipped appearance kit id for a body part, or -1 when unavailable.
    • skull

      public static int skull()
      Returns the local player's skull icon id, or -1 when unavailable.
    • prayer

      public static int prayer()
      Returns the local player's overhead prayer icon id, or -1 when unavailable.
    • coord

      public static Coord coord()
      Returns the local player's coordinate, or (-1, -1, 0) when unavailable.
    • area

      public static Rect area()
      Returns the local player's occupied area, or a one-tile null area when unavailable.
    • animation

      public static int animation()
      Returns the local player's current animation id, or -1 when unavailable.
    • animating

      public static boolean animating()
      Returns whether the local player is currently animating.
    • moving

      public static boolean moving()
      Returns whether the local player is currently moving.
    • orientation

      public static int orientation()
      Returns the local player's orientation, or -1 when unavailable.
    • index

      public static int index()
      Returns the local player's player index, or -1 when unavailable.
    • stance

      public static int stance()
      Returns the local player's stance id, or -1 when unavailable.
    • name

      public static String name()
      Returns the local player's display name, or an empty string when unavailable.
    • effects

      public static IntStream effects()
      Returns active effect ids on the local player.
    • headMessage

      public static String headMessage()
      Returns the local player's overhead chat message, or an empty string when unavailable.
    • hitmarks

      public static List<Hitmark> hitmarks()
      Returns active hitmarks on the local player.
    • headbars

      public static IntStream headbars()
      Returns active headbar ids on the local player.
    • headbarPercent

      public static int headbarPercent(int id)
      Returns the rendered percent for a local-player headbar, or -1 when unavailable.
    • headbarRendered

      public static boolean headbarRendered(int id)
      Returns whether a local-player headbar is currently rendered.
    • healthPercent

      public static int healthPercent()
      Returns the local player's rendered health percent, or -1 when unavailable.
    • healthRendered

      public static boolean healthRendered()
      Returns whether the local player's health bar is currently rendered.
    • facingUnit

      public static boolean facingUnit()
      Returns whether the local player is facing any unit.
    • facingUnit

      public static boolean facingUnit(Unit other)
      Returns whether the local player is facing the supplied unit.
    • faceUnit

      public static Optional<? extends Unit> faceUnit()
      Returns the unit currently faced by the local player, when available.
    • distanceTo

      public static int distanceTo(Coord coord)
      Returns Chebyshev distance from the local player to a coordinate, or Integer.MAX_VALUE when unavailable.
    • distanceTo

      public static int distanceTo(Unit unit)
      Returns Chebyshev distance from the local player to a unit, or Integer.MAX_VALUE when unavailable.
    • distanceTo

      public static int distanceTo(Rect rect)
      Returns Chebyshev distance from the local player to a rectangle, or Integer.MAX_VALUE when unavailable.
    • manhattanDistanceTo

      public static int manhattanDistanceTo(Coord coord)
      Returns Manhattan distance from the local player to a coordinate, or Integer.MAX_VALUE when unavailable.
    • manhattanDistanceTo

      public static int manhattanDistanceTo(Unit unit)
      Returns Manhattan distance from the local player to a unit, or Integer.MAX_VALUE when unavailable.
    • manhattanDistanceTo

      public static int manhattanDistanceTo(Rect rect)
      Returns Manhattan distance from the local player to a rectangle, or Integer.MAX_VALUE when unavailable.
    • lineOfSightTo

      public static boolean lineOfSightTo(Coord coord)
      Returns whether the local player has line of sight to a coordinate.
    • lineOfSightTo

      public static boolean lineOfSightTo(Unit unit)
      Returns whether the local player has line of sight to a unit.
    • lineOfSightTo

      public static boolean lineOfSightTo(Rect rect)
      Returns whether the local player has line of sight to a rectangle.
    • lineOfWalkTo

      public static boolean lineOfWalkTo(Coord coord)
      Returns whether the local player has line of walk to a coordinate.
    • lineOfWalkTo

      public static boolean lineOfWalkTo(Unit unit)
      Returns whether the local player has line of walk to a unit.
    • lineOfWalkTo

      public static boolean lineOfWalkTo(Rect rect)
      Returns whether the local player has line of walk to a rectangle.