Package games.stendhal.client.entity
Class RPEntity
java.lang.Object
games.stendhal.client.entity.Entity
games.stendhal.client.entity.ActiveEntity
games.stendhal.client.entity.RPEntity
- All Implemented Interfaces:
IEntity
,RPObjectChangeListener
This class is a link between client graphical objects and server attributes
objects.
You need to extend this object in order to add new elements to the game.
You need to extend this object in order to add new elements to the game.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
The value of an outfit that isn't set.static games.stendhal.client.entity.Property
Admin Level property.static games.stendhal.client.entity.Property
Attacking property.static games.stendhal.client.entity.Property
Confused propertystatic games.stendhal.client.entity.Property
Eating propertystatic games.stendhal.client.entity.Property
ghostmode property.static games.stendhal.client.entity.Property
group membership.static games.stendhal.client.entity.Property
Healerstatic games.stendhal.client.entity.Property
Heavy propertystatic games.stendhal.client.entity.Property
Property for showing and hiding the HP bar.static games.stendhal.client.entity.Property
Hp and max HP property.static games.stendhal.client.entity.Property
Merchantstatic games.stendhal.client.entity.Property
Outfit property.static games.stendhal.client.entity.Property
Poisoned propertystatic games.stendhal.client.entity.Property
Shock propertystatic games.stendhal.client.entity.Property
Indicator text property.static games.stendhal.client.entity.Property
Title Type property.static games.stendhal.client.entity.Property
Zombie propertyFields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
addTextIndicator(String text, NotificationType type)
Create/add a text indicator message.boolean
Check if a shadow should be drawn under the entity.int
Get the admin level.int
getAtk()
int
int
getAtkXP()
Get the attack target of an entity.int
int
int
getDef()
int
int
getDefXP()
Get the outfit code.float
Get the ratio of HP to base HP.int
getMana()
int
Get the old outfit code.int
Deprecated.int
getRatk()
int
int
int
Get the resistance this has on other entities (0-100).The result of previous attack against this entity.Retrieves the name that should be used to override shadow.Get the damage type of the current strike.Get the weapon used in the current attack.Get the list of text indicator elements.getTitle()
Get the nicely formatted entity title.Get title type.int
getXP()
boolean
Check if the entity has a certain status.boolean
Check if the entity can pass through static collisions.void
initialize(RPObject object)
Initialize this entity for an object.boolean
isAttackedBy(IEntity attacker)
Check if a specific entity is attacking this RPEntity.boolean
isAttacking(IEntity defender)
Check if the entity is attacking a specified entity.boolean
Check if the entity is a target of an attack.boolean
Check if the entity is choking.boolean
Check if the entity is confused or poisoned.boolean
Check if the entity is defending against an attack right now.boolean
Check if the currently performed attack is ranged.boolean
isEating()
Check if the entity is eating.boolean
Determine if in full ghostmode.void
onAttackPerformed(Nature type, boolean ranged, String weapon)
When this entity performs an attack.void
Called when this entity blocks the attack by attacker.void
onChangedAdded(RPObject object, RPObject changes)
The object added/changed attribute(s).void
onChangedRemoved(RPObject object, RPObject changes)
The object removed attribute(s).void
Called when this entity is damaged by attacker with damage amount.void
onHealed(int amount)
Called when the entity gets healed.void
onMissed()
Called when an attacker misses this entity.protected void
onPosition(double x, double y)
When the entity's position changed.void
onPrivateListen(String texttype, String text)
Called when entity listen to text from talker.void
onReachAchievement(String achievementTitle, String achievementDescription, String achievementCategory)
Called when the entity reaches an achievement.void
Called when entity says something.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
release()
Release this entity.boolean
Check if the entity view should show the HP indicator.boolean
Check if the entity view should show the title.void
update(int delta)
Update cycle.Methods inherited from class games.stendhal.client.entity.ActiveEntity
getDirection, isFlying, processPositioning, 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, isUser, onAdded, onRemoved, onSlotAdded, onSlotChangedAdded, onSlotChangedRemoved, onSlotRemoved, removeChangeListener, removeContentChangeListener, toString
-
Field Details
-
PROP_ADMIN_LEVEL
public static final games.stendhal.client.entity.Property PROP_ADMIN_LEVELAdmin Level property. -
PROP_GHOSTMODE
public static final games.stendhal.client.entity.Property PROP_GHOSTMODEghostmode property. -
PROP_GROUP_MEMBERSHIP
public static final games.stendhal.client.entity.Property PROP_GROUP_MEMBERSHIPgroup membership. -
PROP_TEXT_INDICATORS
public static final games.stendhal.client.entity.Property PROP_TEXT_INDICATORSIndicator text property. Fired if they are added or removed. -
PROP_OUTFIT
public static final games.stendhal.client.entity.Property PROP_OUTFITOutfit property. -
PROP_TITLE_TYPE
public static final games.stendhal.client.entity.Property PROP_TITLE_TYPETitle Type property. -
PROP_HP_RATIO
public static final games.stendhal.client.entity.Property PROP_HP_RATIOHp and max HP property. -
PROP_HP_DISPLAY
public static final games.stendhal.client.entity.Property PROP_HP_DISPLAYProperty for showing and hiding the HP bar. -
PROP_HEALER
public static final games.stendhal.client.entity.Property PROP_HEALERHealer -
PROP_MERCHANT
public static final games.stendhal.client.entity.Property PROP_MERCHANTMerchant -
PROP_CONFUSED
public static final games.stendhal.client.entity.Property PROP_CONFUSEDConfused property -
PROP_EATING
public static final games.stendhal.client.entity.Property PROP_EATINGEating property -
PROP_POISONED
public static final games.stendhal.client.entity.Property PROP_POISONEDPoisoned property -
PROP_SHOCK
public static final games.stendhal.client.entity.Property PROP_SHOCKShock property -
PROP_ZOMBIE
public static final games.stendhal.client.entity.Property PROP_ZOMBIEZombie property -
PROP_HEAVY
public static final games.stendhal.client.entity.Property PROP_HEAVYHeavy property -
PROP_ATTACK
public static final games.stendhal.client.entity.Property PROP_ATTACKAttacking property. (for attack events) -
OUTFIT_UNSET
public static final int OUTFIT_UNSETThe value of an outfit that isn't set.- See Also:
- Constant Field Values
-
-
Method Details
-
addTextIndicator
Create/add a text indicator message.- Parameters:
text
- The text message.type
- The indicator type.
-
getAdminLevel
public int getAdminLevel()Get the admin level.- Returns:
- The admin level.
-
getAtk
public int getAtk()- Returns:
- Returns the atk.
-
getAtkItem
public int getAtkItem()- Returns:
- Returns the atk of items
-
getAtkXP
public int getAtkXP()- Returns:
- the attack xp
-
getBaseHP
public int getBaseHP()- Returns:
- Returns the base_hp.
-
getBaseMana
public int getBaseMana()- Returns:
- Returns the base mana value
-
getDef
public int getDef()- Returns:
- Returns the def.
-
getDefItem
public int getDefItem()- Returns:
- Returns the def of items
-
getDefXP
public int getDefXP()- Returns:
- the defence xp
-
getRatk
public int getRatk()- Returns:
- Returns the ratk.
-
getRatkItem
public int getRatkItem()- Returns:
- Returns the ratk of items
-
getRatkXP
public int getRatkXP()- Returns:
- the ranged xp
-
getHpRatio
public float getHpRatio()Get the ratio of HP to base HP.- Returns:
- The HP ratio (0.0 - 1.0).
-
getTextIndicators
Get the list of text indicator elements.- Returns:
- An iterator of text indicators.
-
getMana
public int getMana()- Returns:
- Returns the total mana of a player
-
getExtOutfit
Get the outfit code.- Returns:
- The outfit code.
-
getOldOutfitCode
public int getOldOutfitCode()Get the old outfit code.- Returns:
- The outfit code.
-
getOutfit
Deprecated.UsegetOldOutfitCode()
.Get the outfit code.- Returns:
- The outfit code.
-
getResolution
The result of previous attack against this entity.- Returns:
- attack result
-
getAttackTarget
Get the attack target of an entity.- Returns:
- the target, or
null
if there is none
-
getTitle
Get the nicely formatted entity title. This searches the follow attribute order: title, name (w/o underscore), class (w/o underscore), type (w/o underscore). -
getTitleType
Get title type.- Returns:
- The title type, or
null
if the entity has no special title type
-
getXP
public int getXP()- Returns:
- Returns the XP.
-
getAttackers
- Returns:
- Returns the entities attacking this entity
-
isAttacking
Check if the entity is attacking a specified entity. This is meant to be called from the EDT when drawing entities.- Parameters:
defender
- the potential target- Returns:
true
if defender is attacked by this entity, otherwisefalse
-
isBeingAttacked
public boolean isBeingAttacked()Check if the entity is a target of an attack.- Returns:
true
if the entity is being attacked, otherwisefalse
-
isAttackedBy
Check if a specific entity is attacking this RPEntity.- Parameters:
attacker
- potential attacker- Returns:
true
if attacker is attacking this RPEntity, otherwisefalse
-
getShownDamageType
Get the damage type of the current strike.- Returns:
- type of damage, or
null
if the entity is not striking
-
getShownWeapon
Get the weapon used in the current attack.- Returns:
- weapon, or
null
if not specified
-
isDoingRangedAttack
public boolean isDoingRangedAttack()Check if the currently performed attack is ranged.- Returns:
true
if the attack is ranged,false
otherwise
-
isDefending
public boolean isDefending()Check if the entity is defending against an attack right now. The entity is defending if the last attack happened within 1.2s.- Returns:
true
if the entity is defending against an attack,false
otherwise
-
isEating
public boolean isEating()Check if the entity is eating.- Returns:
true
if the entity is eating, otherwisefalse
-
isGhostMode
public boolean isGhostMode()Determine if in full ghostmode.- Returns:
true
is in full ghostmode.
-
ignoresCollision
public boolean ignoresCollision()Check if the entity can pass through static collisions.- Returns:
true
if the entity can pass through walls, otherwisefalse
-
isConfused
public boolean isConfused()Check if the entity is confused or poisoned.- Returns:
true
if the entity is confused or poisoned, otherwisefalse
-
hasStatus
Check if the entity has a certain status.- Parameters:
status
- status id- Returns:
true
if the entity has the status, otherwisefalse
.
-
isChoking
public boolean isChoking()Check if the entity is choking.- Returns:
true
if the entity is choking, otherwisefalse
-
onAttackPerformed
When this entity performs an attack.- Parameters:
type
- attack natureranged
-true
if it's a ranged attack, otherwisefalse
weapon
- Weapon used in the attack, ornull
if not specified
-
onBlocked
public void onBlocked()Called when this entity blocks the attack by attacker. -
onDamaged
Called when this entity is damaged by attacker with damage amount.- Parameters:
attacker
- attacking entitydamage
- amount of damage
-
onHealed
public void onHealed(int amount)Called when the entity gets healed.- Parameters:
amount
- amount healed
-
onMissed
public void onMissed()Called when an attacker misses this entity. -
onPrivateListen
Called when entity listen to text from talker.- Parameters:
texttype
- type of talk (normal private talk, administrator message)text
- message contents
-
onReachAchievement
public void onReachAchievement(String achievementTitle, String achievementDescription, String achievementCategory)Called when the entity reaches an achievement.- Parameters:
achievementTitle
- title of the achievementachievementDescription
- description of the achievementachievementCategory
- achievement category
-
onTalk
Called when entity says something.- Parameters:
text
- message contents
-
getResistance
public int getResistance()Get the resistance this has on other entities (0-100).- Specified by:
getResistance
in interfaceIEntity
- Overrides:
getResistance
in classEntity
- Returns:
- The resistance, or 0 if in ghostmode.
-
initialize
Initialize this entity for an object.- Specified by:
initialize
in interfaceIEntity
- Overrides:
initialize
in classActiveEntity
- Parameters:
object
- The object.- See Also:
release()
-
release
public void release()Release this entity. This should clean anything that isn't automatically released (such as unregister callbacks, cancel external operations, etc).- Specified by:
release
in interfaceIEntity
- Overrides:
release
in classEntity
- See Also:
initialize(RPObject)
-
update
public void update(int delta)Update cycle.- Specified by:
update
in interfaceIEntity
- Overrides:
update
in classActiveEntity
- Parameters:
delta
- The time (in ms) since last call.
-
onChangedAdded
The object added/changed attribute(s).- Specified by:
onChangedAdded
in interfaceRPObjectChangeListener
- Overrides:
onChangedAdded
in classEntity
- Parameters:
object
- The base object.changes
- The changes.
-
onChangedRemoved
The object removed attribute(s).- Specified by:
onChangedRemoved
in interfaceRPObjectChangeListener
- Overrides:
onChangedRemoved
in classEntity
- Parameters:
object
- The base object.changes
- The changes.
-
showTitle
public boolean showTitle()Check if the entity view should show the title.- Returns:
true
, if the title should be displayed,false
if it should be hidden
-
showHPBar
public boolean showHPBar()Check if the entity view should show the HP indicator.- Returns:
true
, if the HP bar should be displayed,false
if it should be hidden
-
castsShadow
public boolean castsShadow()Check if a shadow should be drawn under the entity.- Returns:
true
if a shadow should be drawn,false
if not.
-
getShadowStyle
Retrieves the name that should be used to override shadow.- Returns:
- String path to shadow file to use or
null
.
-
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
-
getOldOutfitCode()
.