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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intThe value of an outfit that isn't set.static games.stendhal.client.entity.PropertyAdmin Level property.static games.stendhal.client.entity.PropertyAttacking property.static games.stendhal.client.entity.PropertyConfused propertystatic games.stendhal.client.entity.PropertyEating propertystatic games.stendhal.client.entity.Propertyghostmode property.static games.stendhal.client.entity.Propertygroup membership.static games.stendhal.client.entity.PropertyHealerstatic games.stendhal.client.entity.PropertyHeavy propertystatic games.stendhal.client.entity.PropertyProperty for showing and hiding the HP bar.static games.stendhal.client.entity.PropertyHp and max HP property.static games.stendhal.client.entity.PropertyMerchantstatic games.stendhal.client.entity.PropertyOutfit property.static games.stendhal.client.entity.PropertyPoisoned propertystatic games.stendhal.client.entity.PropertyShock propertystatic games.stendhal.client.entity.PropertyIndicator text property.static games.stendhal.client.entity.PropertyTitle Type property.static games.stendhal.client.entity.PropertyZombie propertyFields inherited from class games.stendhal.client.entity.ActiveEntity
PROP_DIRECTION, PROP_SPEEDFields inherited from class games.stendhal.client.entity.Entity
clazz, inAdd, name, rpObject, title, type, x, yFields 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 voidprotected voidaddTextIndicator(String text, NotificationType type)Create/add a text indicator message.booleanCheck if a shadow should be drawn under the entity.intGet the admin level.intgetAtk()intintgetAtkXP()Get the attack target of an entity.intintintgetDef()intintgetDefXP()Get the outfit code.floatGet the ratio of HP to base HP.intgetMana()intGet the old outfit code.intDeprecated.intgetRatk()intintintGet 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.intgetXP()booleanCheck if the entity has a certain status.booleanCheck if the entity can pass through static collisions.voidinitialize(RPObject object)Initialize this entity for an object.booleanisAttackedBy(IEntity attacker)Check if a specific entity is attacking this RPEntity.booleanisAttacking(IEntity defender)Check if the entity is attacking a specified entity.booleanCheck if the entity is a target of an attack.booleanCheck if the entity is choking.booleanCheck if the entity is confused or poisoned.booleanCheck if the entity is defending against an attack right now.booleanCheck if the currently performed attack is ranged.booleanisEating()Check if the entity is eating.booleanDetermine if in full ghostmode.voidonAttackPerformed(Nature type, boolean ranged, String weapon)When this entity performs an attack.voidCalled when this entity blocks the attack by attacker.voidonChangedAdded(RPObject object, RPObject changes)The object added/changed attribute(s).voidonChangedRemoved(RPObject object, RPObject changes)The object removed attribute(s).voidCalled when this entity is damaged by attacker with damage amount.voidonHealed(int amount)Called when the entity gets healed.voidonMissed()Called when an attacker misses this entity.protected voidonPosition(double x, double y)When the entity's position changed.voidonPrivateListen(String texttype, String text)Called when entity listen to text from talker.voidonReachAchievement(String achievementTitle, String achievementDescription, String achievementCategory)Called when the entity reaches an achievement.voidCalled when entity says something.protected voidplayRandomSoundFromCategory(String groupName, String categoryName)protected voidplayRandomSoundFromGroup(String groupName, String categoryName, long waitTimeInMilliSec)protected voidplaySoundFromCategory(String groupName, String categoryName)protected voidplaySoundFromCategory(String groupName, String categoryName, int index)voidrelease()Release this entity.booleanCheck if the entity view should show the HP indicator.booleanCheck if the entity view should show the title.voidupdate(int delta)Update cycle.Methods inherited from class games.stendhal.client.entity.ActiveEntity
getDirection, isFlying, processPositioning, stoppedMethods 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
nullif 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
nullif 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:
trueif defender is attacked by this entity, otherwisefalse
-
isBeingAttacked
public boolean isBeingAttacked()Check if the entity is a target of an attack.- Returns:
trueif the entity is being attacked, otherwisefalse
-
isAttackedBy
Check if a specific entity is attacking this RPEntity.- Parameters:
attacker- potential attacker- Returns:
trueif attacker is attacking this RPEntity, otherwisefalse
-
getShownDamageType
Get the damage type of the current strike.- Returns:
- type of damage, or
nullif the entity is not striking
-
getShownWeapon
Get the weapon used in the current attack.- Returns:
- weapon, or
nullif not specified
-
isDoingRangedAttack
public boolean isDoingRangedAttack()Check if the currently performed attack is ranged.- Returns:
trueif the attack is ranged,falseotherwise
-
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:
trueif the entity is defending against an attack,falseotherwise
-
isEating
public boolean isEating()Check if the entity is eating.- Returns:
trueif the entity is eating, otherwisefalse
-
isGhostMode
public boolean isGhostMode()Determine if in full ghostmode.- Returns:
trueis in full ghostmode.
-
ignoresCollision
public boolean ignoresCollision()Check if the entity can pass through static collisions.- Returns:
trueif the entity can pass through walls, otherwisefalse
-
isConfused
public boolean isConfused()Check if the entity is confused or poisoned.- Returns:
trueif the entity is confused or poisoned, otherwisefalse
-
hasStatus
Check if the entity has a certain status.- Parameters:
status- status id- Returns:
trueif the entity has the status, otherwisefalse.
-
isChoking
public boolean isChoking()Check if the entity is choking.- Returns:
trueif the entity is choking, otherwisefalse
-
onAttackPerformed
When this entity performs an attack.- Parameters:
type- attack natureranged-trueif it's a ranged attack, otherwisefalseweapon- Weapon used in the attack, ornullif 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:
getResistancein interfaceIEntity- Overrides:
getResistancein classEntity- Returns:
- The resistance, or 0 if in ghostmode.
-
initialize
Initialize this entity for an object.- Specified by:
initializein interfaceIEntity- Overrides:
initializein 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:
releasein interfaceIEntity- Overrides:
releasein classEntity- See Also:
initialize(RPObject)
-
update
public void update(int delta)Update cycle.- Specified by:
updatein interfaceIEntity- Overrides:
updatein classActiveEntity- Parameters:
delta- The time (in ms) since last call.
-
onChangedAdded
The object added/changed attribute(s).- Specified by:
onChangedAddedin interfaceRPObjectChangeListener- Overrides:
onChangedAddedin classEntity- Parameters:
object- The base object.changes- The changes.
-
onChangedRemoved
The object removed attribute(s).- Specified by:
onChangedRemovedin interfaceRPObjectChangeListener- Overrides:
onChangedRemovedin 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,falseif 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,falseif it should be hidden
-
castsShadow
public boolean castsShadow()Check if a shadow should be drawn under the entity.- Returns:
trueif a shadow should be drawn,falseif 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:EntityWhen the entity's position changed.- Overrides:
onPositionin classEntity- Parameters:
x- The new X coordinate.y- The new Y coordinate.
-
playRandomSoundFromCategory
-
playRandomSoundFromGroup
-
playSoundFromCategory
-
playSoundFromCategory
-
getOldOutfitCode().