Class Actor<T extends dev.twilite.game.internal.memory.RSActor>

java.lang.Object
dev.twilite.game.wrapper.Actor<T>
All Implemented Interfaces:
Interactable, InteractableUnit, Unit
Direct Known Subclasses:
Npc, Player

public abstract class Actor<T extends dev.twilite.game.internal.memory.RSActor> extends Object implements InteractableUnit
Base wrapper for actor units such as players and NPCs.
  • Method Details

    • name

      public abstract String name()
      Returns the standardized display name. Standardized text is tag-stripped, trimmed, and lowercased.
    • index

      public int index()
      Returns the actor index in the client actor table. This is a unique identifier for an actor.

      Jagex references this value as the server creation cycle, it will not be constant throughout updates

    • stance

      public int stance()
      Returns the current stance animation id, or -1 when absent.
    • animation

      public int animation()
      Returns the current animation id, or -1 when absent.
    • animating

      public boolean animating()
      Returns whether this Actor is currently animating (animation not -1)
    • orientation

      public int orientation()
      Returns the actor orientation.
    • moving

      public boolean moving()
      Returns whether this actor has queued movement waypoints.
    • effects

      public IntStream effects()
      Returns active spot animation/effect ids on this actor.
    • hitmarks

      public List<Hitmark> hitmarks()
      Returns active hitmarks on this actor.
    • headbars

      public IntStream headbars()
      Returns active headbar ids on this actor.
    • headMessage

      public String headMessage()
      Returns the head message text on this actor.
    • dying

      public boolean dying()
      Returns whether this actor is dying.
    • healthPercent

      public int healthPercent()
      Returns the current health percent from known health headbars, or -1 when unavailable.
    • healthRendered

      public boolean healthRendered()
      Returns whether any known health headbar id is currently rendered by the client for this actor.
    • headbarPercent

      public int headbarPercent(int id)
      Returns the current fill percent for an active headbar id, or -1 when absent.
    • headbarRendered

      public boolean headbarRendered(int id)
      Returns whether the headbar id is currently rendered by the client for this actor.
    • facingUnit

      public boolean facingUnit()
      Returns whether this actor is facing another unit. Also known as `target` or `interacting`.
    • facingUnit

      public boolean facingUnit(Unit other)
      Returns whether this actor is facing the specified unit. Also known as `target` or `interacting`.
    • faceUnit

      public Optional<? extends Unit> faceUnit()
      Resolves the unit this actor is currently facing. This can be a Player, Npc or WorldEntity. Also known as `target` or `interacting`.
    • world

      public World world()
      Description copied from interface: Unit
      Returns the world this unit belongs to.
      Specified by:
      world in interface Unit
    • coord

      public Coord coord()
      Description copied from interface: Unit
      Returns this unit's world coordinate.
      Specified by:
      coord in interface Unit
    • fine

      public Coord.Fine fine()
      Description copied from interface: Unit
      Returns this unit's fine coordinate, representing its model location.
      Specified by:
      fine in interface Unit
    • map

      public Coord.Map map()
      Description copied from interface: Unit
      Returns this unit's map coordinate relative to the loaded world area.
      Specified by:
      map in interface Unit
    • area

      public Rect area()
      Description copied from interface: Unit
      Returns the area this unit occupies.
      Specified by:
      area in interface Unit
    • equals

      public boolean equals(Object other)
      Compares actors by wrapper type and client actor index.

      A player and NPC with the same client index are not equal because they are different actor tables. Two wrappers of the same actor type with the same index are considered equal snapshots of the same in-game actor.

      Overrides:
      equals in class Object