Class LocalPlayerEntity

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activateRun()
      Activates run if it is deactivated.
      int currentRunEnergy()
      Returns the amount of run energy remaining for the player as an integer between 0 and 100.
      void deactivateRun()
      Deactivates run if it is enabled.
      int getBoostedLevel​(net.runelite.api.Skill skill)
      Retrieves the boosted level of a specified skill.
      int getExperience​(net.runelite.api.Skill skill)
      Retrieves the total experience of the specified skill for the current client.
      double getHealthPercentage()
      Calculates the player's current health as a percentage of their real (base) health.
      int getHealthRemaining()
      Returns the players current health remaining as an integer.
      int getLevel​(net.runelite.api.Skill skill)
      Retrieves the base level of the specified skill.
      int getMaxHealth()
      Returns the players maximum health as an integer.
      int getSpecialAttackEnergy()
      Gets the amount of special attack energy remaining as a percent (0-100).
      int getTotalExperience()
      Calculates the total experience across all skills for the current client.
      boolean isIdle()
      Checks if the player is currently idle based on their pose animation.
      boolean isInArea​(GameArea area)
      Checks if the player is within the game area.
      boolean isInArea​(net.runelite.api.coords.WorldPoint worldPoint)
      Checks if the player is within 5 tiles of a given WorldPoint.
      boolean isInArea​(net.runelite.api.coords.WorldPoint worldPoint, int radius)
      Checks if the player is within a specified distance of a given WorldPoint.
      boolean isInArea​(net.runelite.api.coords.WorldPoint worldPoint, int xRadius, int yRadius)
      Checks if the player is within a specified area around a given WorldPoint.
      boolean isMoving()
      Checks if the player is currently moving based on their pose animation.
      boolean isRunEnabled()
      Returns true when a players run is enabled and false otherwise.
      boolean isSpecDisabled()
      Returns true when the spec is disabled and false otherwise
      boolean isSpecEnabled()
      Returns true when the spec is enabled and false otherwise
      boolean logout()  
      void onVarbitChanged​(net.runelite.api.events.VarbitChanged event)
      The poisoned status of the player, with negative values indicating the duration of poison or venom protection and positive values representing the amount of poison or venom damage the player will be taking.
      net.runelite.api.Player raw()
      Returns the wrapped (raw) RuneLite API object for this interactable game entity.
      void toggleRun()
      Toggles the players run energy.
      void toggleSpecialAttack​(int energyRequired)
      Sets the special attack state if current special attack energy is greater than or equal to the required special attack energy
      void toggleSpecialAttack​(int energyRequired, int delay)
      Sets the special attack state if the current special attack energy is greater than or equal to the required special attack energy using reflection instead of mouse events.
      int totalSkillLevel()
      Calculates the total skill level of the player by summing up the real levels of all their skills.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocalPlayerEntity

        public LocalPlayerEntity​(Context ctx)
    • Method Detail

      • onVarbitChanged

        @Subscribe
        public void onVarbitChanged​(net.runelite.api.events.VarbitChanged event)
        The poisoned status of the player, with negative values indicating the duration of poison or venom protection and positive values representing the amount of poison or venom damage the player will be taking.
        Parameters:
        event - The varbit changed event from RuneLite - (-inf, -38): Venom immune for a duration of (abs(val) - 38) * 30 game ticks (18 seconds per poison tick), after which point the value will have increased to -38 and be representing poison immunity rather than venom immunity - [-38, 0): Poison immune for a duration of abs(val) * 30 game ticks (18 seconds per poison tick) - 0: Not poisoned or immune to poison - [1, 100]: Poisoned for an amount of ceil(val / 5.0f) - [1000000, inf): Venomed for an amount of min(20, (val - 999997) * 2), that is, an amount starting at 6 damage, increasing by 2 each time the value increases by one, and capped at 20
      • raw

        public net.runelite.api.Player raw()
        Description copied from interface: Interactable
        Returns the wrapped (raw) RuneLite API object for this interactable game entity. This is useful to provide easy access to familiar and underlying RuneLite game data. For example: an EquipmentEntity will expose the RuneLite Widget object for the interactable piece of equipment.
        Specified by:
        raw in interface Interactable<net.runelite.api.Player>
        Overrides:
        raw in class AbstractEntity<net.runelite.api.Player>
        Returns:
        T wrapped RuneLite API object.
      • isMoving

        public boolean isMoving()
        Checks if the player is currently moving based on their pose animation. A player is considered moving if their pose animation is different from their idle pose animation.
        Returns:
        true if the player is moving, false if they are idle.
      • isIdle

        public boolean isIdle()
        Checks if the player is currently idle based on their pose animation. A player is considered idle if their pose animation is the same as their idle pose animation.
        Returns:
        true if the player is idle, false if they are moving.
      • getSpecialAttackEnergy

        public int getSpecialAttackEnergy()
        Gets the amount of special attack energy remaining as a percent (0-100).
        Returns:
        int the amount of special attack energy the player has remaining.
      • getHealthPercentage

        public double getHealthPercentage()
        Calculates the player's current health as a percentage of their real (base) health. If the player has 40 hp total and has 36 hp remaining this will return ~85.0 showing that roughly 85% of the players health is remaining.
        Returns:
        the health percentage as a double. For example: 150.0 if boosted, 80.0 if drained, or 100.0 if unchanged.
      • getHealthRemaining

        public int getHealthRemaining()
        Returns the players current health remaining as an integer.
        Returns:
        the remaining amount of hitpoints the player currently has.
      • getMaxHealth

        public int getMaxHealth()
        Returns the players maximum health as an integer.
        Returns:
        The total amount of hitpoints the player has.
      • isSpecEnabled

        public boolean isSpecEnabled()
        Returns true when the spec is enabled and false otherwise
        Returns:
        True if spec is enabled and false otherwise
      • isSpecDisabled

        public boolean isSpecDisabled()
        Returns true when the spec is disabled and false otherwise
        Returns:
        True if speci is disabled and false otherwise
      • toggleSpecialAttack

        public void toggleSpecialAttack​(int energyRequired)
        Sets the special attack state if current special attack energy is greater than or equal to the required special attack energy
        Parameters:
        energyRequired - int, 100 = 100%
      • toggleSpecialAttack

        public void toggleSpecialAttack​(int energyRequired,
                                        int delay)
        Sets the special attack state if the current special attack energy is greater than or equal to the required special attack energy using reflection instead of mouse events.
        Parameters:
        energyRequired - int, 100 = 100%
        delay - int a set delay before the spec button is pressed. This can't happen instantaneously because the server needs to process the weapon equip before it can toggle on spec. Otherwise, the game would see you toggle on spec for nothing, then spec weapon gets equipped with spec disabled.
      • toggleRun

        public void toggleRun()
        Toggles the players run energy. If it is on it will turn it off and vice versa. Use {activateRun} and {deactivateRun} if a specific state is required.
      • activateRun

        public void activateRun()
        Activates run if it is deactivated.
      • deactivateRun

        public void deactivateRun()
        Deactivates run if it is enabled.
      • isRunEnabled

        public boolean isRunEnabled()
        Returns true when a players run is enabled and false otherwise.
        Returns:
        boolean
      • currentRunEnergy

        public int currentRunEnergy()
        Returns the amount of run energy remaining for the player as an integer between 0 and 100.
        Returns:
        int
      • logout

        public boolean logout()
      • totalSkillLevel

        public int totalSkillLevel()
        Calculates the total skill level of the player by summing up the real levels of all their skills.

        This method iterates over all available skills and retrieves their real levels from the game client. It then calculates the total by summing up these levels.

        Returns:
        The total skill level of the player as an integer.
      • getLevel

        public int getLevel​(net.runelite.api.Skill skill)
        Retrieves the base level of the specified skill.

        This method executes a client-side operation to obtain the real (unboosted) level of the given skill. The skill must be a valid Skill object.

        Parameters:
        skill - The Skill for which the base level is being queried. Represents one of the player's in-game skills.
        Returns:
        The base level of the specified skill as an integer. If the skill is invalid or cannot be retrieved, the method may return 0 or throw an exception depending on the implementation details.
      • getBoostedLevel

        public int getBoostedLevel​(net.runelite.api.Skill skill)
        Retrieves the boosted level of a specified skill.

        This method executes on the client thread to safely fetch the current boosted level of the provided skill from the client.

        Parameters:
        skill - The @Skill object representing the skill for which the boosted level is needed. Must not be null.
        Returns:
        The boosted level of the specified skill as an integer.
      • getExperience

        public int getExperience​(net.runelite.api.Skill skill)
        Retrieves the total experience of the specified skill for the current client.

        This method executes a thread-safe operation to fetch the experience points associated with the given Skill object by running on the client thread.

        Parameters:
        skill - the skill whose experience is to be retrieved. This parameter must not be null.
        Returns:
        the total experience points of the specified skill.
      • getTotalExperience

        public int getTotalExperience()
        Calculates the total experience across all skills for the current client.

        This method iterates through all the skill categories, retrieves their individual experience values, and then sums them up to return the total accumulated experience.

        Returns:
        the total experience points of all skills combined for the client.
      • isInArea

        public boolean isInArea​(net.runelite.api.coords.WorldPoint worldPoint)
        Checks if the player is within 5 tiles of a given WorldPoint.
        Parameters:
        worldPoint - The WorldPoint to check proximity to.
        Returns:
        true if the player is within the specified distance, false otherwise.
      • isInArea

        public boolean isInArea​(GameArea area)
        Checks if the player is within the game area.
        Parameters:
        area - The GameArea to check.
        Returns:
        True if the player is within the game area and false otherwise.
      • isInArea

        public boolean isInArea​(net.runelite.api.coords.WorldPoint worldPoint,
                                int radius)
        Checks if the player is within a specified distance of a given WorldPoint.
        Parameters:
        worldPoint - The WorldPoint to check proximity to.
        radius - The radius (in tiles) around the worldPoint to check.
        Returns:
        true if the player is within the specified distance, false otherwise.
      • isInArea

        public boolean isInArea​(net.runelite.api.coords.WorldPoint worldPoint,
                                int xRadius,
                                int yRadius)
        Checks if the player is within a specified area around a given WorldPoint.
        Parameters:
        worldPoint - The WorldPoint to check proximity to.
        xRadius - The horizontal radius (in tiles) around the worldPoint.
        yRadius - The vertical radius (in tiles) around the worldPoint.
        Returns:
        true if the player is within the specified area, false otherwise.