Package games.stendhal.client.entity
Class User
java.lang.Object
games.stendhal.client.entity.Entity
games.stendhal.client.entity.ActiveEntity
games.stendhal.client.entity.RPEntity
games.stendhal.client.entity.Player
games.stendhal.client.entity.User
- All Implemented Interfaces:
IEntity
,RPObjectChangeListener
This class identifies the user of this client.
- Author:
- durkham, hendrik
-
Nested Class Summary
Nested classes/interfaces inherited from class games.stendhal.client.entity.RPEntity
RPEntity.Resolution
-
Field Summary
Fields inherited from class games.stendhal.client.entity.Player
PROP_AWAY, PROP_GRUMPY, PROP_PLAYER_KILLER
Fields inherited from class games.stendhal.client.entity.RPEntity
OUTFIT_UNSET, PROP_ADMIN_LEVEL, PROP_ATTACK, PROP_CONFUSED, PROP_EATING, PROP_GHOSTMODE, PROP_GROUP_MEMBERSHIP, PROP_HEALER, PROP_HEAVY, PROP_HP_DISPLAY, PROP_HP_RATIO, PROP_MERCHANT, PROP_OUTFIT, PROP_POISONED, PROP_SHOCK, PROP_TEXT_INDICATORS, PROP_TITLE_TYPE, PROP_ZOMBIE
Fields inherited from class games.stendhal.client.entity.ActiveEntity
PROP_DIRECTION, PROP_SPEED
Fields inherited from class games.stendhal.client.entity.Entity
clazz, inAdd, name, rpObject, title, type, x, y
Fields inherited from interface games.stendhal.client.entity.IEntity
PROP_ANIMATED, PROP_CLASS, PROP_NAME, PROP_POSITION, PROP_SIZE, PROP_STATE, PROP_TITLE, PROP_VISIBILITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
int
Returns the objectid for the named item.static User
get()
gets the User objectstatic String
gets the name of the player's characterint
getPetID()
gets the ID of a petstatic int
gets the level of the current userstatic String
gets the server release versionint
gets the ID of a sheepgets the zone namestatic boolean
is the specified charname a buddy of us?boolean
hasPet()
checks whether the user owns a petboolean
hasSheep()
checks whether the user owns a sheepstatic boolean
isAdmin()
is this user an admin with an adminlevel equal or above 600?static boolean
is the player in a group which shares the loot?static boolean
isIgnoring(String name)
is the named player ignored?static boolean
isNull()
is the user object not set, yet?static boolean
isPlayerInGroup(String otherPlayer)
checks if the specified player is in the same group as this playerboolean
isUser()
Is this object the user of this client?protected void
An away message was set/cleared.void
onChangedAdded(RPObject object, RPObject changes)
The object added/changed attribute(s).void
onChangedRemoved(RPObject base, RPObject diff)
The object removed attribute(s).void
onHealed(int amount)
Called when the entity gets healed.protected void
onPosition(double x, double y)
When the entity's position changed.protected void
playRandomSoundFromCategory(String groupName, String categoryName)
protected void
playRandomSoundFromGroup(String groupName, String categoryName, long waitTimeInMilliSec)
protected void
playSoundFromCategory(String groupName, String categoryName)
protected void
playSoundFromCategory(String groupName, String categoryName, int index)
void
predictMovement(Direction direction, boolean facing)
Start movement towards a direction.protected void
processPositioning(RPObject base, RPObject diff)
Process attribute changes that may affect positioning.void
Stop the user's movement.static void
updateGroupStatus(Collection<String> members, String lootmode)
updates the group informationMethods inherited from class games.stendhal.client.entity.Player
getAway, isAway, isBadBoy, isGrumpy, onTalk
Methods inherited from class games.stendhal.client.entity.RPEntity
addTextIndicator, castsShadow, getAdminLevel, getAtk, getAtkItem, getAtkXP, getAttackers, getAttackTarget, getBaseHP, getBaseMana, getDef, getDefItem, getDefXP, getExtOutfit, getHpRatio, getMana, getOldOutfitCode, getOutfit, getRatk, getRatkItem, getRatkXP, getResistance, getResolution, getShadowStyle, getShownDamageType, getShownWeapon, getTextIndicators, getTitle, getTitleType, getXP, hasStatus, ignoresCollision, initialize, isAttackedBy, isAttacking, isBeingAttacked, isChoking, isConfused, isDefending, isDoingRangedAttack, isEating, isGhostMode, onAttackPerformed, onBlocked, onDamaged, onMissed, onPrivateListen, onReachAchievement, release, showHPBar, showTitle, update
Methods inherited from class games.stendhal.client.entity.ActiveEntity
getDirection, isFlying, stopped
Methods inherited from class games.stendhal.client.entity.Entity
addChangeListener, addContentChangeListener, fireChange, getArea, getCursor, getEntityClass, getEntitySubclass, getHeight, getID, getName, getObjectID, getPath, getResistance, getRPObject, getSlot, getType, getVisibility, getWidth, getX, getY, isObstacle, isOnGround, onAdded, onRemoved, onSlotAdded, onSlotChangedAdded, onSlotChangedRemoved, onSlotRemoved, removeChangeListener, removeContentChangeListener, toString
-
Constructor Details
-
User
public User()creates a User object
-
-
Method Details
-
get
gets the User object- Returns:
- user object
-
isNull
public static boolean isNull()is the user object not set, yet?- Returns:
- true, if the the user object is unknown; false if it is known
-
getCharacterName
gets the name of the player's character- Returns:
- charname or
null
-
getPlayerLevel
public static int getPlayerLevel()gets the level of the current user- Returns:
- level
-
getServerRelease
gets the server release version- Returns:
- server release version or
null
-
hasBuddy
is the specified charname a buddy of us?- Parameters:
name
- charname to test- Returns:
- true, if it is a buddy, false if it is not a buddy or the user object is unknown.
-
isAdmin
public static boolean isAdmin()is this user an admin with an adminlevel equal or above 600?- Returns:
- true, if the user is an admin; false otherwise
-
isGroupSharingLoot
public static boolean isGroupSharingLoot()is the player in a group which shares the loot?- Returns:
- true if this player is a group and it uses shared looting
-
isIgnoring
is the named player ignored?- Parameters:
name
- name of player- Returns:
- true, if the player should be ignored; false otherwise
-
isPlayerInGroup
checks if the specified player is in the same group as this player- Parameters:
otherPlayer
- name of the other player- Returns:
- true if the other player is in the same group
-
updateGroupStatus
updates the group information- Parameters:
members
- memberslootmode
- lootmode
-
findItem
Returns the objectid for the named item.- Parameters:
slotName
- name of slot to searchitemName
- name of item- Returns:
- objectid or
-1
in case there is no such item
-
hasPet
public boolean hasPet()checks whether the user owns a pet- Returns:
- true, if the user owns a pet; false otherwise
-
getPetID
public int getPetID()gets the ID of a pet- Returns:
- ID of pet
-
hasSheep
public boolean hasSheep()checks whether the user owns a sheep- Returns:
- true, if the user owns a sheep; false otherwise
-
getSheepID
public int getSheepID()gets the ID of a sheep- Returns:
- ID of sheep
-
getZoneName
gets the zone name- Returns:
- zone name
-
isUser
public boolean isUser()Is this object the user of this client? -
onAway
Description copied from class:Player
An away message was set/cleared. -
onChangedAdded
The object added/changed attribute(s).- Specified by:
onChangedAdded
in interfaceRPObjectChangeListener
- Overrides:
onChangedAdded
in classPlayer
- Parameters:
object
- The base object.changes
- The changes.
-
onChangedRemoved
Description copied from class:Player
The object removed attribute(s).- Specified by:
onChangedRemoved
in interfaceRPObjectChangeListener
- Overrides:
onChangedRemoved
in classPlayer
- Parameters:
base
- The base object.diff
- The changes.
-
onHealed
public void onHealed(int amount)Description copied from class:RPEntity
Called when the entity gets healed. -
predictMovement
Start movement towards a direction. This is for the client side movement prediction to start moving before the server responds to the move action.- Parameters:
direction
- new directionfacing
-true
if the player should just turn
-
processPositioning
Description copied from class:ActiveEntity
Process attribute changes that may affect positioning. This is needed because different entities may want to process coordinate changes more gracefully.- Overrides:
processPositioning
in classActiveEntity
- Parameters:
base
- The previous values.diff
- The changes.
-
stopMovement
public void stopMovement()Stop the user's movement. -
addSounds
-
onPosition
protected void onPosition(double x, double y)Description copied from class:Entity
When the entity's position changed.- Overrides:
onPosition
in classEntity
- Parameters:
x
- The new X coordinate.y
- The new Y coordinate.
-
playRandomSoundFromCategory
-
playRandomSoundFromGroup
-
playSoundFromCategory
-
playSoundFromCategory
-