ActorEx
What NPCs and players have in common: name, animation, movement and death.
Abstract classRLPlugins API
public abstract class ActorEx<T extends Actor> implements EntityYou get one as an NpcEx from an NpcQuery, or as a PlayerEx from PlayerEx.getLocal(). T is the RuneLite type behind it.
Example
PlayerEx me = PlayerEx.getLocal();
if (me.isIdle() && !me.hasQueuedMovement()) {
// Not animating and not walking: ready for the next action.
}Members
Constructors
- newActorEx(T)
Creates a ActorEx.
Methods
- booleancanAttack()
Check if an actor can be attacked.
- booleanequals(Object)
Whether this and the other object are the same thing.
- ActorEx<?>
- String[]getActions()
The right-click actions.
- TgetActor()
The RuneLite
Actorbehind it. - intgetAnimation()
The animation playing now.
- PointgetCanvasImageLocation(BufferedImage, int)
Projects an image using the actor's native overlay anchor.
- PointgetCanvasTextLocation(Graphics2D, String, int)
Projects a centered actor label using the actor's logical height.
- PolygongetCanvasTilePoly()
Projects this actor's actual footprint, including the native NPC model size.
- intgetCombatLevel()
Its combat level.
- ShapegetConvexHull()
Gets the actor's model outline for an overlay, without substituting its clickbox.
- intgetGraphic()
The id of the graphic that plays on it.
- int[]getGraphicIds()
The ids of all graphics that play on it.
- HeadIcongetHeadIcon()
The overhead prayer icon it shows.
- intgetHealthRatio()
How full its health bar is. -1 when no health bar shows.
- intgetHealthScale()
The full length of its health bar. -1 when no health bar shows.
- intgetIdlePoseAnimation()
The animation it uses when it stands still.
- ActorEx<?>getInCombatWith()
Find the actor currently in combat with the target actor.
- intgetIndex()
Its index in the client. For a player this is the player id.
- ActorEx<?>getInteracting()
The NPC or player it is busy with, or
null. - LocalPointgetLocalPoint()
Where it is inside the loaded area, in local units.
- intgetLogicalHeight()
Its height in game units.
- intgetModelHeight()
Current rendered model height, distinct from the actor's logical height.
- StringgetName()
The name, without color tags.
- OrientationgetOrientation()
The direction it faces.
- intgetOrientationUnits()
Native facing angle, in 0..2047 client units, for projectile prediction.
- StringgetOverheadText()
The text shown above its head.
- intgetPathLength()
Queued step count for this actor, read from the injected movement queue.
- intgetPoseAnimation()
The animation of how it stands or moves right now.
- ShapegetShape()
Its outline on screen.
- TilegetTile()
The tile it is on.
- WorldAreagetWorldArea()
The tiles it covers.
- WorldPointgetWorldPoint()
The tile it is on, as a world position.
- WorldViewgetWorldView()
The world view it is in: the main world, or a boat.
- intgetWorldViewId()
Which world view the actor is in.
- booleanhasGraphic(int...)
Whether one of these graphics plays on it.
- inthashCode()
A number Java uses when this is put in a set or a map.
- booleanhasQueuedMovement()
Whether the actor still has steps queued to walk.
- booleanhealthBarVisible()
Whether its health bar shows.
- voidinteract(String...)
Clicks one of its actions.
- voidinteract(int)
Clicks one of its actions.
- booleanisDead()
Whether the actor is dead.
- booleanisIdle()
Whether the actor stands in its idle pose with no animation.
- booleanisInteracting()
Whether it is busy with an NPC or a player.
ActorEx(T)
public ActorEx(T actor)Creates a ActorEx.
Parameters
actor- Actor.
canAttack()
public boolean canAttack()Check if an actor can be attacked.
Returns
True if can be attacked.
equals(Object)
public boolean equals(Object obj)Whether this and the other object are the same thing.
Parameters
obj- Obj.
fromActor(Actor)static
public static ActorEx<?> fromActor(Actor actor)Wraps a RuneLite Actor as an NpcEx or a PlayerEx.
Parameters
actor- Actor.
getActions()
public abstract String[] getActions()The right-click actions.
getActor()
public T getActor()The RuneLite Actor behind it.
getAnimation()
public int getAnimation()The animation playing now.
Returns
The animation ID, or -1 when none plays.
getCanvasImageLocation(BufferedImage, int)
public Point getCanvasImageLocation(BufferedImage image, int heightOffset)Projects an image using the actor's native overlay anchor.
Parameters
image- Image.
heightOffset- Height offset.
getCanvasTextLocation(Graphics2D, String, int)
public Point getCanvasTextLocation(Graphics2D graphics, String text, int heightOffset)Projects a centered actor label using the actor's logical height.
Parameters
graphics- Graphics used to measure the label.
text- Label text.
heightOffset- Additional height above the actor.
Returns
Canvas text position, or null when unavailable.
getCanvasTilePoly()
public Polygon getCanvasTilePoly()Projects this actor's actual footprint, including the native NPC model size.
getCombatLevel()
public int getCombatLevel()Its combat level.
getConvexHull()
public Shape getConvexHull()Gets the actor's model outline for an overlay, without substituting its clickbox.
Returns
Projected model outline, or null when unavailable.
getGraphic()
public int getGraphic()The id of the graphic that plays on it.
getGraphicIds()
public int[] getGraphicIds()The ids of all graphics that play on it.
getHeadIcon()
public HeadIcon getHeadIcon()The overhead prayer icon it shows.
getHealthRatio()
public int getHealthRatio()How full its health bar is. -1 when no health bar shows.
getHealthScale()
public int getHealthScale()The full length of its health bar. -1 when no health bar shows.
getIdlePoseAnimation()
public int getIdlePoseAnimation()The animation it uses when it stands still.
getInCombatWith()
public ActorEx<?> getInCombatWith()Find the actor currently in combat with the target actor.
Returns
The actor, or null if none found.
getIndex()
public int getIndex()Its index in the client. For a player this is the player id.
getInteracting()
public ActorEx<?> getInteracting()The NPC or player it is busy with, or null.
getLocalPoint()
public abstract LocalPoint getLocalPoint()Where it is inside the loaded area, in local units.
getLogicalHeight()
public int getLogicalHeight()Its height in game units.
Returns
The actor's native logical height for overhead projections.
getModelHeight()
public int getModelHeight()Current rendered model height, distinct from the actor's logical height.
getName()
public String getName()The name, without color tags.
Returns
The name. It can be null for an NPC the game has not loaded yet.
getOrientation()
public Orientation getOrientation()The direction it faces.
getOrientationUnits()
public int getOrientationUnits()Native facing angle, in 0..2047 client units, for projectile prediction.
getOverheadText()
public String getOverheadText()The text shown above its head.
getPathLength()
public int getPathLength()Queued step count for this actor, read from the injected movement queue.
Returns
Number of steps still queued; zero when the queue is empty.
getPoseAnimation()
public int getPoseAnimation()The animation of how it stands or moves right now.
getShape()
public Shape getShape()Its outline on screen.
getTile()
public abstract Tile getTile()The tile it is on.
getWorldArea()
public abstract WorldArea getWorldArea()The tiles it covers.
getWorldPoint()
public abstract WorldPoint getWorldPoint()The tile it is on, as a world position.
getWorldView()
public WorldView getWorldView()The world view it is in: the main world, or a boat.
getWorldViewId()
public int getWorldViewId()Which world view the actor is in.
Boats and other moving areas have their own world view. Compare two IDs to tell whether actors are on the same one.
Returns
The world view ID, or -1 when there is none.
hasGraphic(int...)
public boolean hasGraphic(int... graphicIds)Whether one of these graphics plays on it.
Parameters
graphicIds- Graphic ids.
hashCode()
public int hashCode()A number Java uses when this is put in a set or a map.
hasQueuedMovement()
public boolean hasQueuedMovement()Whether the actor still has steps queued to walk.
Returns
true while steps are queued.
- This only reads the walk queue. Forced movement, such as an agility shortcut, can move an actor with an empty queue.
healthBarVisible()
public boolean healthBarVisible()Whether its health bar shows.
interact(String...)
public abstract void interact(String... actions)Clicks one of its actions.
Parameters
actions- Actions.
interact(int)
public abstract void interact(int action)Clicks one of its actions.
Parameters
action- Action.
isDead()
public boolean isDead()Whether the actor is dead.
Returns
true once it has died.
isIdle()
public boolean isIdle()Whether the actor stands in its idle pose with no animation.
Returns
true when it is idle.
isInteracting()
public boolean isInteracting()Whether it is busy with an NPC or a player.
Also allowed
Every class has these, as in plain Java.
distanceTo, getId, getInteractionPoint, isInteractable, toString