Class User

java.lang.Object
privbot.hooks.User

public final class User extends Object
Local-player state queries via Client and the game client.
  • Method Details

    • getUsername

      public String getUsername()
      Returns:
      the local player's name, or "" when there is no player or no name (see ctx.player.name())
    • getLocation

      public net.runelite.api.coords.WorldPoint getLocation()
      Returns:
      the player's drawn tile from the adapter, or null when unreadable (see ctx.player.tile() and serverTile())
    • isMoving

      public boolean isMoving()
      Returns:
      whether the pose animation differs from the idle pose; false also when unreadable (see ctx.player.isMoving())
    • getAnimation

      public int getAnimation()
      Returns:
      the current animation id, -1 for none and also when unreadable (see ctx.player.animation())
    • isAnimating

      public boolean isAnimating()
      Returns:
      whether getAnimation() is not -1
    • isIdle

      public boolean isIdle()
      Returns:
      neither animating nor moving (both read false when unreadable, so this reads true then)
    • isInCombat

      public boolean isInCombat()
      Returns:
      the adapter's in-combat read; false when unreadable
    • getOpponentName

      public String getOpponentName()
      Returns:
      the adapter's current opponent name, or ""
    • getHitpoints

      public int getHitpoints()
      Returns:
      current (boosted) hitpoints; 0 when unreadable (see ctx.player.hitpoints())
    • getMaxHitpoints

      public int getMaxHitpoints()
      Returns:
      base hitpoints level; 0 when unreadable
    • getHitpointsPercent

      public double getHitpointsPercent()
      Returns:
      current / base hitpoints as a percentage; 100 when the base level cannot be read
    • getRunEnergy

      public int getRunEnergy()
      Returns:
      run energy 0..100; 0 when unreadable (see ctx.game.observedRunEnergy())
    • isRunEnabled

      public boolean isRunEnabled()
      Returns:
      whether OSRS varp 173 reads 1; false when unreadable (see ctx.game.observedRunEnabled())
    • boosted

      public int boosted(net.runelite.api.Skill skill)
      Parameters:
      skill - the skill
      Returns:
      the current level; 0 when unreadable (see ctx.skills.observedBoosted)
    • realLevel

      public int realLevel(net.runelite.api.Skill skill)
      Parameters:
      skill - the skill
      Returns:
      the base level; 0 when unreadable (see ctx.skills.observedReal)
    • getExperience

      public int getExperience(net.runelite.api.Skill skill)
      Parameters:
      skill - the skill
      Returns:
      experience; 0 when unreadable (see ctx.skills.xp)
    • getSpecialAttack

      public int getSpecialAttack()
      Returns:
      special attack energy 0..100 from the adapter; 0 when unreadable (see ctx.combat.observedSpecialAttackPercent())
    • getLocalPlayer

      public net.runelite.api.Player getLocalPlayer()
      Returns the local Player through the game client. Plugins should prefer this over client.getLocalPlayer() so the adapter can route requests through its profile-aware accessors.
    • overheadProtection

      public User.Overhead overheadProtection()
      The overhead prayer icon the server draws on the local player, with "could not read it" kept apart from "nothing drawn" — getLocalPlayer().getOverheadIcon() answers null for both. On Impact, Elorin and SpawnPK the server's own icon id is translated to a HeadIcon (on Elorin curses included: Deflect Magic is HeadIcon.DEFLECT_MAGE); other servers read the RuneLite player. Never null.