Class Player
java.lang.Object
com.botwithus.bot.api.entities.Player
- All Implemented Interfaces:
EntityContext
Rich wrapper around a snapshot
Player
record. Players don't have a per-id type definition the way NPCs do —
what would be on NpcType (name, options, ...) is per-instance and
lives in the snapshot or arrives as packets — so this wrapper is thinner
than Npc.
Name collision note: the snapshot type com.botwithus.bot.api.snapshot.Player
shares the simple name Player with this wrapper, so the snapshot
type is fully qualified at the field declaration below and reflected
mechanically on the constructor parameter and raw() accessor
(Java has no import aliasing, and the enclosing class shadows any
import of the snapshot type).
-
Method Summary
Modifier and TypeMethodDescriptionintintintChebyshev distance to the local player tile, orMAX_VALUEif the local player isn't loaded.intvoidinteract(int optionIndex) Queue an action against this player by 1-based option index.booleanisMoving()Which way this player is facing (wire v21): its rendered facing, interpolated while it turns.intplane()Plane / height level (0-3).raw()intintFirst active spot anim (graphic) id playing on this player, or-1if none.intstanceId()inttileX()Absolute world tile X.inttileY()Absolute world tile Y.toString()Methods inherited from interface EntityContext
distanceTo, distanceTo
-
Method Details
-
raw
-
serverIndex
public int serverIndex() -
combatLevel
public int combatLevel() -
followingIndex
public int followingIndex() -
animationId
public int animationId() -
stanceId
public int stanceId() -
isMoving
public boolean isMoving() -
spotAnimId
public int spotAnimId()First active spot anim (graphic) id playing on this player, or-1if none. Only the first concurrent spot anim is surfaced — subscribe toSpotAnimEventfor every newly-started one. -
orientation
Which way this player is facing (wire v21): its rendered facing, interpolated while it turns. UseOrientation.compass()orOrientation.degrees()to read it, andOrientation.isSameFacingAs(Orientation)to compare two, neverequals; the client can read an angle back one unit short. Unknown when the producer could not read one. -
tileX
public int tileX()Description copied from interface:EntityContextAbsolute world tile X.- Specified by:
tileXin interfaceEntityContext
-
tileY
public int tileY()Description copied from interface:EntityContextAbsolute world tile Y.- Specified by:
tileYin interfaceEntityContext
-
plane
public int plane()Description copied from interface:EntityContextPlane / height level (0-3).- Specified by:
planein interfaceEntityContext
-
distanceToPlayer
public int distanceToPlayer()Chebyshev distance to the local player tile, orMAX_VALUEif the local player isn't loaded. -
interact
public void interact(int optionIndex) Queue an action against this player by 1-based option index.- Throws:
IllegalArgumentException- foroptionIndexoutside [1, 10]
-
toString
-