Class LocalPlayerEntity
- java.lang.Object
-
- com.kraken.api.core.AbstractEntity<net.runelite.api.Player>
-
- com.kraken.api.query.player.PlayerEntity
-
- com.kraken.api.query.player.LocalPlayerEntity
-
- All Implemented Interfaces:
Interactable<net.runelite.api.Player>
public class LocalPlayerEntity extends PlayerEntity
-
-
Field Summary
-
Fields inherited from class com.kraken.api.core.AbstractEntity
ctx, raw
-
-
Constructor Summary
Constructors Constructor Description LocalPlayerEntity(Context ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateRun()Activates run if it is deactivated.intcurrentRunEnergy()Returns the amount of run energy remaining for the player as an integer between 0 and 100.voiddeactivateRun()Deactivates run if it is enabled.intgetBoostedLevel(net.runelite.api.Skill skill)Retrieves the boosted level of a specified skill.intgetExperience(net.runelite.api.Skill skill)Retrieves the total experience of the specified skill for the current client.doublegetHealthPercentage()Calculates the player's current health as a percentage of their real (base) health.intgetHealthRemaining()Returns the players current health remaining as an integer.intgetLevel(net.runelite.api.Skill skill)Retrieves the base level of the specified skill.intgetMaxHealth()Returns the players maximum health as an integer.intgetSpecialAttackEnergy()Gets the amount of special attack energy remaining as a percent (0-100).intgetTotalExperience()Calculates the total experience across all skills for the current client.booleanisIdle()Checks if the player is currently idle based on their pose animation.booleanisInArea(GameArea area)Checks if the player is within the game area.booleanisInArea(net.runelite.api.coords.WorldPoint worldPoint)Checks if the player is within 5 tiles of a givenWorldPoint.booleanisInArea(net.runelite.api.coords.WorldPoint worldPoint, int radius)Checks if the player is within a specified distance of a givenWorldPoint.booleanisInArea(net.runelite.api.coords.WorldPoint worldPoint, int xRadius, int yRadius)Checks if the player is within a specified area around a givenWorldPoint.booleanisMoving()Checks if the player is currently moving based on their pose animation.booleanisRunEnabled()Returns true when a players run is enabled and false otherwise.booleanisSpecDisabled()Returns true when the spec is disabled and false otherwisebooleanisSpecEnabled()Returns true when the spec is enabled and false otherwisebooleanlogout()voidonVarbitChanged(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.Playerraw()Returns the wrapped (raw) RuneLite API object for this interactable game entity.voidtoggleRun()Toggles the players run energy.voidtoggleSpecialAttack(int energyRequired)Sets the special attack state if current special attack energy is greater than or equal to the required special attack energyvoidtoggleSpecialAttack(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.inttotalSkillLevel()Calculates the total skill level of the player by summing up the real levels of all their skills.-
Methods inherited from class com.kraken.api.query.player.PlayerEntity
getId, getName, interact, isSkulled
-
Methods inherited from class com.kraken.api.core.AbstractEntity
equals, hashCode, isNull
-
-
-
-
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) * 30game ticks (18 seconds per poison tick), after which point the value will have increased to-38and be representing poison immunity rather than venom immunity - [-38, 0): Poison immune for a duration ofabs(val) * 30game ticks (18 seconds per poison tick) - 0: Not poisoned or immune to poison - [1, 100]: Poisoned for an amount ofceil(val / 5.0f)- [1000000, inf): Venomed for an amount ofmin(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:InteractableReturns 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: anEquipmentEntitywill expose the RuneLiteWidgetobject for the interactable piece of equipment.- Specified by:
rawin interfaceInteractable<net.runelite.api.Player>- Overrides:
rawin classAbstractEntity<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:
trueif the player is moving,falseif 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:
trueif the player is idle,falseif 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
Skillobject.- Parameters:
skill- TheSkillfor 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
Skillobject 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 givenWorldPoint.- Parameters:
worldPoint- TheWorldPointto check proximity to.- Returns:
trueif the player is within the specified distance,falseotherwise.
-
isInArea
public boolean isInArea(GameArea area)
Checks if the player is within the game area.- Parameters:
area- TheGameAreato 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 givenWorldPoint.- Parameters:
worldPoint- TheWorldPointto check proximity to.radius- The radius (in tiles) around theworldPointto check.- Returns:
trueif the player is within the specified distance,falseotherwise.
-
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 givenWorldPoint.- Parameters:
worldPoint- TheWorldPointto check proximity to.xRadius- The horizontal radius (in tiles) around theworldPoint.yRadius- The vertical radius (in tiles) around theworldPoint.- Returns:
trueif the player is within the specified area,falseotherwise.
-
-