Interface Actor

    • Method Detail

      • getCombatLevel

        int getCombatLevel()
        Gets the combat level of the actor.
        Returns:
        the combat level
      • getName

        @Nullable
        String getName()
        Gets the name of the actor.
        Returns:
        the name
      • isInteracting

        boolean isInteracting()
        Gets if the actor is interacting with another actor. getInteracting() will return the interacting actor, unless they are outside of the visibility range.
        Returns:
      • getInteracting

        Actor getInteracting()
        Gets the actor being interacted with.

        Examples of interaction include:

        • A monster focusing an Actor to attack
        • Targetting a player to trade
        • Following a player
        Returns:
        the actor, null if no interaction is occurring
      • getHealthRatio

        int getHealthRatio()
        Gets the health of the actor in getHealthScale() units. The server does not transmit actors' real health, only this value between zero and getHealthScale(). Some actors may be missing this info, in which case -1 is returned.
      • getHealthScale

        int getHealthScale()
        Gets the maximum value getHealthRatio() can return For actors with the default size health bar this is 30, but for bosses with a larger health bar this can be a larger number. Some actors may be missing this info, in which case -1 is returned.
      • getWorldLocation

        WorldPoint getWorldLocation()
        Gets the server-side location of the actor.

        This value is typically ahead of where the client renders and is not affected by things such as animations.

        Returns:
        the server location
      • getLocalLocation

        LocalPoint getLocalLocation()
        Gets the client-side location of the actor.
        Returns:
        the client location
      • getOrientation

        int getOrientation()
        Gets the target orientation of the actor.
        Returns:
        the orientation
        See Also:
        Angle
      • getCurrentOrientation

        int getCurrentOrientation()
        Gets the current orientation of the actor.
        Returns:
        the orientation
        See Also:
        Angle
      • getAnimation

        int getAnimation()
        Gets the current animation the actor is performing.
        Returns:
        the animation ID
        See Also:
        AnimationID
      • getPoseAnimation

        int getPoseAnimation()
        Gets the secondary animation the actor is performing. Usually an idle animation, or one of the walking ones.
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setPoseAnimation

        void setPoseAnimation​(int animation)
        Set the idle pose animation.
        Parameters:
        animation -
        See Also:
        AnimationID
      • getPoseAnimationFrame

        int getPoseAnimationFrame()
        Get the frame of the idle animation the actor is performing
        Returns:
      • setPoseAnimationFrame

        void setPoseAnimationFrame​(int frame)
        Set the frame of the idle animation the actor is performing
        Parameters:
        frame -
      • getIdlePoseAnimation

        int getIdlePoseAnimation()
        The idle pose animation. If the actor is not walking or otherwise animating, this will be used for their pose animation.
        Returns:
        the animation ID
        See Also:
        AnimationID
      • getIdleRotateLeft

        int getIdleRotateLeft()
        Animation used for rotating left if the actor is also not walking
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setIdleRotateLeft

        void setIdleRotateLeft​(int animationID)
      • getIdleRotateRight

        int getIdleRotateRight()
        Animation used for rotating right if the actor is also not walking
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setIdleRotateRight

        void setIdleRotateRight​(int animationID)
      • getWalkAnimation

        int getWalkAnimation()
        Animation used for walking
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setWalkAnimation

        void setWalkAnimation​(int animationID)
      • getWalkRotateLeft

        int getWalkRotateLeft()
        Animation used for rotating left while walking
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setWalkRotateLeft

        void setWalkRotateLeft​(int animationID)
      • getWalkRotateRight

        int getWalkRotateRight()
        Animation used for rotating right while walking
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setWalkRotateRight

        void setWalkRotateRight​(int animationID)
      • getWalkRotate180

        int getWalkRotate180()
        Animation used for an about-face while walking
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setWalkRotate180

        void setWalkRotate180​(int animationID)
      • getRunAnimation

        int getRunAnimation()
        Animation used for running
        Returns:
        the animation ID
        See Also:
        AnimationID
      • setRunAnimation

        void setRunAnimation​(int animationID)
      • setAnimation

        @VisibleForDevtools
        void setAnimation​(int animation)
        Sets an animation for the actor to perform.
        Parameters:
        animation - the animation ID
        See Also:
        AnimationID
      • getAnimationFrame

        int getAnimationFrame()
        Get the frame of the animation the actor is performing
        Returns:
        the frame
      • setActionFrame

        @Deprecated
        void setActionFrame​(int frame)
        Deprecated.
        use setAnimationFrame
        Sets the frame of the animation the actor is performing.
        Parameters:
        frame - the animation frame
      • setAnimationFrame

        void setAnimationFrame​(int frame)
        Sets the frame of the animation the actor is performing.
        Parameters:
        frame - the animation frame
      • hasSpotAnim

        boolean hasSpotAnim​(int spotAnimId)
        Check if the actor has a spotanim
        Parameters:
        spotAnimId - the spot anim id
        Returns:
        See Also:
        GraphicID
      • createSpotAnim

        void createSpotAnim​(int id,
                            int spotAnimId,
                            int height,
                            int delay)
        Create an actor spotanim
        Parameters:
        id - key for the getSpotAnims() table
        spotAnimId - spotanim id GraphicID
        height - height offspot for spot anim
        delay - initial delay, in client ticks, before spotanim is active
      • removeSpotAnim

        void removeSpotAnim​(int id)
        Remove an actor spotanim
        Parameters:
        id - key for the getSpotAnims() table
      • clearSpotAnims

        void clearSpotAnims()
        Remove all actor spotanims
      • getGraphic

        @Deprecated
        int getGraphic()
        Deprecated.
        Get the graphic/spotanim that is currently on the actor. Actors can have multiple spotanims, this gets only one of them. Use hasSpotAnim(int) instead.
        Returns:
        the spotanim of the actor
        See Also:
        GraphicID
      • setSpotAnimFrame

        @Deprecated
        void setSpotAnimFrame​(int spotAnimFrame)
        Set the frame of the currently playing spotanim
        Parameters:
        spotAnimFrame -
      • getCanvasTilePoly

        Polygon getCanvasTilePoly()
        Gets the canvas area of the current tiles the actor is standing on.
        Returns:
        the current tile canvas area
      • getCanvasTextLocation

        @Nullable
        Point getCanvasTextLocation​(Graphics2D graphics,
                                    String text,
                                    int zOffset)
        Gets the point at which text should be drawn, relative to the current location with the given z-axis offset.
        Parameters:
        graphics - engine graphics
        text - the text to draw
        zOffset - the z-axis offset
        Returns:
        the text drawing location
      • getCanvasImageLocation

        Point getCanvasImageLocation​(BufferedImage image,
                                     int zOffset)
        Gets the point at which an image should be drawn, relative to the current location with the given z-axis offset.
        Parameters:
        image - the image to draw
        zOffset - the z-axis offset
        Returns:
        the image drawing location
      • getCanvasSpriteLocation

        Point getCanvasSpriteLocation​(SpritePixels sprite,
                                      int zOffset)
        Gets the point at which a sprite should be drawn, relative to the current location with the given z-axis offset.
        Parameters:
        sprite - the sprite to draw
        zOffset - the z-axis offset
        Returns:
        the sprite drawing location
      • getMinimapLocation

        Point getMinimapLocation()
        Gets a point on the canvas of where this actors mini-map indicator should appear.
        Returns:
        mini-map location on canvas
      • getLogicalHeight

        int getLogicalHeight()
        Gets the logical height of the actors model.

        This z-axis offset is roughly where the health bar of the actor is drawn.

        Returns:
        the logical height
      • getConvexHull

        Shape getConvexHull()
        Gets the convex hull of the actors model.
        Returns:
        the convex hull
        See Also:
        Jarvis
      • getWorldArea

        WorldArea getWorldArea()
        Gets the world area that the actor occupies.
        Returns:
        the world area
      • getOverheadText

        String getOverheadText()
        Gets the overhead text that is displayed above the actor
        Returns:
        the overhead text
      • setOverheadText

        void setOverheadText​(String overheadText)
        Sets the overhead text that is displayed above the actor
        Parameters:
        overheadText - the overhead text
      • getOverheadCycle

        int getOverheadCycle()
        Get the number of cycles/client ticks remaining before the overhead text is timed out
        Returns:
      • setOverheadCycle

        void setOverheadCycle​(int cycles)
        Set the number of cycles/client ticks before the overhead text is timed out
        Parameters:
        cycles -
      • isDead

        boolean isDead()
        Returns true if this actor has died
        Returns:
      • setDead

        void setDead​(boolean dead)
        Sets the dead status of this actor
        Parameters:
        dead -
        See Also:
        isDead()