Class PrivPlayer
java.lang.Object
privbot.wrappers.PrivPlayer
Other-player wrapper. Attack and Trade route through the proven per-server paths
(
ctx.combat and Trade.request(privbot.wrappers.PrivPlayer)); other options use
the game client with the server-correct player identifier (raw getId() on Impact,
compacted list index elsewhere).
RuneLite does not expose a player menu composition, so hasAction(String) /
interact(String) use a best-effort synonym table for common OSRS menu slots (0–7).
Use interactSlot(int) when you know the exact option index.
-
Method Summary
Modifier and TypeMethodDescriptiondoubledistanceTo(net.runelite.api.coords.WorldPoint p) Tile-step distance top.booleanexists()True if thisPlayerinstance is still inClient.getPlayers().intThe client's combat-level field, or -1 without a player.intgetId()The client's player id, or -1.intgetIndex()Live player-list index used as the identifier in Impact player actions.getName()The player's name as the client reports it (tags not stripped), or empty when unknown.net.runelite.api.PlayerThe wrapped client player (may be null).net.runelite.api.coords.WorldPointThe player's current world tile, or null when unknown.booleanbooleanDispatches a player option, marshalled throughGameThread.ensure(java.util.function.Supplier<T>, T).booleaninteractSlot(int menuSlot)
-
Method Details
-
getPlayer
public net.runelite.api.Player getPlayer()The wrapped client player (may be null). Raw reads on it are not marshalled. -
getName
The player's name as the client reports it (tags not stripped), or empty when unknown. -
getId
public int getId()The client's player id, or -1. On Impact and Elorin this is the player's slot in the client's own player array, which is what player menu actions send. -
getIndex
public int getIndex()Live player-list index used as the identifier in Impact player actions.Note: this is the position in the null-compacted
client.getPlayers()list, which differs from the player's slot in the client's own player array in a busy world. Player menu actions on Impact and Elorin usegetId()instead. -1 when the player is not in the list. -
getCombatLevel
public int getCombatLevel()The client's combat-level field, or -1 without a player. Caution: on Impact the mapped field has held the server player id rather than the displayed level (trade requests rely on it), so do not treat it as a level there. -
getWorldLocation
public net.runelite.api.coords.WorldPoint getWorldLocation()The player's current world tile, or null when unknown. -
distanceTo
public double distanceTo(net.runelite.api.coords.WorldPoint p) Tile-step distance top.Integer.MAX_VALUEon different planes,Double.MAX_VALUEwhen either location is unknown. -
exists
public boolean exists()True if thisPlayerinstance is still inClient.getPlayers(). -
hasAction
Best-effort: whetherinteract(String)can mapactionto a menu slot viaKNOWN_SYNONYMS. Not read from the client (no API for other players' menus). -
interact
Dispatches a player option, marshalled throughGameThread.ensure(java.util.function.Supplier<T>, T).Attackand (on Impact, Elorin and SpawnPK)Trade/Followuse the per-server paths; other labels map to a menu slot through a synonym table (seehasAction(String)).- Returns:
- true when the action was dispatched, not proof it happened; false when the label has no mapping, the player cannot be identified, or the call was dropped
-
interactSlot
public boolean interactSlot(int menuSlot) - Parameters:
menuSlot- 0-based player menu option index (0 = first option, matches the first player option).
-