Class Player
- All Implemented Interfaces:
UseListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Fields inherited from class games.stendhal.server.entity.RPEntity
atk, ATTR_TITLE, damageReceived, def, level, lv_cap, ratk, statusAttackers, statusList, totalDamageReceived
Fields inherited from class games.stendhal.server.entity.GuidedEntity
baseSpeed, pathnotifier
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
adds a buddy to the player's buddy listvoid
addClientDirection(Direction direction)
Add an active client direction.boolean
Add a player ignore entry.void
addKarma(double karmaToAdd)
Give the player some karma (good or bad).void
addReachedAchievement(String identifier)
Adds the identifier of an achievement to the reached achievementsvoid
applyClientDirection(boolean stopOnNone)
Apply the most recent active client direction.protected void
applyDefXP(RPEntity entity)
boolean
checks if the achievements of this player object are already loadedvoid
cancels a trade or trade offer.void
cancelTradeInternally(String partnerName)
cancels a trade and moves the items back.boolean
Return true if player can push entity.int
static Player
createZeroLevelPlayer(String characterName, RPObject template)
void
accepts the trade if both offers are locked.describe()
Describes the entity (if a players looks at it).static void
protected void
dropItemsOn(Corpse corpse)
boolean
Returns true if two objects are exactly equalvoid
Forces player to stop moving, bypassing auto-walkstatic void
int
Returns the admin level of this user.int
getAge()
Gets the number of minutes that this player has been logged in on the server.gets a list of all rings of life that are not brokenReturn a list of all animals associated to this player.Get the away message.int
gets the capped atk level, which prevent players from training their atk way beyond what is reasonable for their levelint
gets the capped def level, which prevent players from training their def way beyond what is reasonable for their levelint
Gets the capped ratk level, which prevent players from training their ratk way beyond what is reasonable for their level.gets the PlayerChatBucketgets the client versionint
getCommerceTransactionAmount(String npcName, boolean soldToNPC)
Get the type of the damage this entity inflictsgetFeature(String name)
Get a client feature value.Get the grumpy message.Determine if a player is on the ignore list and return their reply message.double
getKarma()
Get the current amount of karma.getKeyedSlot(String name, String key)
Get a keyed string value on a named slot.gets the languagelong
gets the timestmap this client sent the last actionlong
Returns the time the player last did a player kill.Gets the name of the last player who privately talked to this player using the /tell command, or null if nobody has talked to this player since he logged in.long
Returns the time the player last did an PVP action.int
getMagicSkillXp(Nature nature)
Get the current value for the skill of a magic natureint
getMaxSlotSize(String slot)
returns the maximum size of a slotint
getNumberOfLootsForItem(String item)
Gets the how often this player has looted the given itemint
getNumberOfRepetitions(String questname, int index)
Gets the number of repetitions in a substate of quest slotgetPet()
int
getQuantityOfBoughtItems(String item)
Gets the amount of an item bought by player.int
Gets the amount a player has harvested of an itemint
getQuantityOfMinedItems(String item)
Gets the amount a player as mined of an itemint
int
getQuantityOfProducedItems(String item)
Gets the amount a player as produced of an itemint
getQuantityOfSoldItems(String item)
Gets the amount of an item sold by player.Gets the player's current status in the given quest.Gets the player's current status in the given quest.getRequiredItemName(String questname, int index)
Gets the recorded item stored in a substate of quest slotint
getRequiredItemQuantity(String questname, int index)
Gets the recorded item quantity stored in a substate of quest slotgets the player sentence displayed on the web siteint
getSharedKill(String name)
Returns how much the player has killed 'name' with help of others.getSheep()
Get the player's sheep.Get a named skills value.int
getSoloKill(String name)
Returns how much the player has killed 'name' solo.protected double
getSusceptibility(Nature type)
Get a multiplier for a given damage type when this entity is damaged.protected String
gets the partner of a player to player tradeint
gets the state of player to player tradesgets the current UseListenerprotected void
handleLeaveZone(int nx, int ny)
protected void
protected void
handleSimpleCollision(int nx, int ny)
Collision handling instructions for players.boolean
boolean
hasFeature(String name)
Checks if player has a feature.int
hashCode()
boolean
Checks if the player has ever killed a creature, with or without the help of any other player.boolean
hasKilledShared(String name)
Checks if the player has ever 'shared killed' a creature, i.e.boolean
hasKilledSolo(String name)
Checks if the player has ever 'solo killed' a creature, i.e.boolean
hasPet()
boolean
Checks whether the player has made any progress in the given quest or not.boolean
hasReachedAchievement(String identifier)
Checks if a player has reached the achievement with the given identifierboolean
hasSheep()
boolean
has the player a use listener?boolean
hasVisitedZone(StendhalRPZone zone)
Checks if the player has visited the given zonevoid
incBoughtForItem(String name, int quantity)
Increases the amount of successful buyings for the given itemvoid
incCommerceTransaction(String npcName, int price, boolean soldToNPC)
Stores information about amount of money used & gained in NPC transactions.void
incHarvestedForItem(String name, int quantity)
Increases the amount of successful harvestings for the given itemvoid
incLootForItem(String item, int count)
Increases the count of loots for the given itemvoid
incMinedForItem(String name, int quantity)
Increases the amount of successful minings for the given itemvoid
incObtainedForItem(String name, int quantity)
Increases the count of obtains from the well for the given itemvoid
incProducedForItem(String item, int count)
Increases the count of producings for the given itemvoid
increaseMagicSkillXp(Nature nature, int amount)
Increase the skill points for a magic nature by a given amountvoid
increments the number of successful trades by 1void
incSoldForItem(String name, int quantity)
Increases the count of sales for the given itemvoid
boolean
isBadBoy()
boolean
boolean
isClientNewerThan(String version)
checks if the client is newer than the requested versionboolean
checks whether this client is flagged as disconnectedboolean
isGhost()
Checks whether an entity is a ghost (non physically interactive).boolean
Determine if the entity is invisible to creatures.boolean
isNew()
Is this a new player?boolean
isObstacle(Entity entity)
Determine if this is an obstacle for another entity.boolean
isQuestCompleted(String name)
Checks whether the player has completed the given quest or not.boolean
isQuestInState(String name, int index, String... states)
Is the named quest in one of the listed states?boolean
isQuestInState(String name, String... states)
Is the named quest in one of the listed states?boolean
Checks whether a player has teleclick enabled.boolean
Determine if zone changes are currently allowed via normal means (non-portal teleportation doesn't count).void
lockPortal(int ID)
Removes the portal from the list of unlocked portals.void
locks the item offer.void
logic()
Perform cycle logic.void
notifyOffline(String who)
Notifies this player that the given player has logged out.void
notifyOnline(String who)
Notifies this player that the given player has logged in.void
offerTrade(Player partner)
offers the other player to start a trading sessionvoid
onAdded(StendhalRPZone zone)
Called when this object is added to a zone.void
This method is called when this entity has been killed (hp == 0).void
Called when player push entity.void
onRemoved(StendhalRPZone zone)
Called when this object is being removed from a zone.boolean
Invoked when the object is used.void
registerOutfitExpireTime(int expire)
sets the time a outfit wears offvoid
void
rememberAttacker(Entity attacker)
boolean
removeBuddy(String name)
removes a buddy to the player's buddy listvoid
removeClientDirection(Direction direction)
Remove an active client direction.boolean
removeIgnore(String name)
Remove a player ignore entry.void
void
removeQuest(String name)
void
removeSheep(Sheep sheep)
void
removes a use event listenervoid
Request stopping the player, unless the player started moving the same turn.boolean
Tries to give the player his original outfit back after he has put on a temporary outfit.protected void
rewardKillers(int oldXP)
Gives XP to every player who has helped killing this RPEntity.searchAnimal(String name, boolean exactly)
Search for an animal with the given name or type.void
sendPrivateText(NotificationType type, String text)
Sends a message that only this entity can read.void
sendPrivateText(String text)
Sends a message that only this player can read.void
setAdminLevel(int adminlevel)
Set the player's admin level.void
setAge(int age)
Sets the number of minutes that this player has been logged in on the server.protected void
setAtkInternal(int atk, boolean notify)
void
setAwayMessage(String message)
Set the away message.void
setBuddyOnlineStatus(String buddyName, boolean isOnline)
Sets the online status for a buddy in the players' buddy listvoid
setClientVersion(String version)
sets the client versionprotected void
setDefInternal(int def, boolean notify)
void
setFeature(String name, boolean enabled)
Enable/disable a client feature.void
setFeature(String name, String value)
Sets/removes a client feature.void
setGhost(boolean ghost)
Set whether this player is a ghost (invisible/non-interactive).void
setGrumpyMessage(String message)
Set the grumpy message.void
setInvisible(boolean invisible)
Set whether this player is invisible to creatures.boolean
setKeyedSlot(String name, String key, String value)
Set a keyed string value on a named slot.void
setLanguage(String language)
sets the languagevoid
setLastClientActionTimestamp(long lastClientActionTimestamp)
sets the timestamp at which this client sent the last action.void
setLastPrivateChatter(String lastPrivateChatterName)
Sets the name of the last player who privately talked to this player using the /tell command.void
setLevel(int level)
void
Set the player's pet.void
Allows to store the player's current status in a quest in a string.void
Allows to store the player's current status in a quest in a string.protected void
setRatkInternal(int ratk, boolean notify)
Set the entity's ranged attack level.void
setSentence(String sentence)
sets the player sentencevoid
setSharedKill(String name)
Stores that the player has killed 'name' with help of others.void
setSharedKillCount(String name, int count)
Changes shared kills count to specified value.void
Set the player's sheep.boolean
Set a named skills value.void
setSoloKill(String name)
Stores that the player has killed 'name' solo.void
setSoloKillCount(String name, int count)
Changes solo kills count to specified value.void
setTeleclickEnabled(boolean teleclick)
Set whether this player has teleclick enabled.void
setUseListener(String actionDisplayName, UseListener listener)
adds a use listener causing the client to add an use action with the specified nameprotected void
startTrade(Player partner)
starts a trade with this partnervoid
stop()
Stop and clear any active directions.void
Updates the last pvp action time with the current time.boolean
teleport(StendhalRPZone zone, int x, int y, Direction dir, Player teleporter)
Teleports this player to the given destination.boolean
Teleports player to given destination using zoneid string.toString()
This method returns a String that represent the objectvoid
unlockPortal(int ID)
Adds a portal ID to a list of "unlocked" portals for player.void
unlocks a trade item offer for example because of some modifications on the trade slot.void
unsetFeature(String name)
Unset a client featurevoid
update()
Process changes that to the object attributes.double
useKarma(double scale)
Use some of the player's karma.double
useKarma(double negLimit, double posLimit)
Use some of the player's karma.double
useKarma(double negLimit, double posLimit, double granularity)
Use some of the player's karma.Methods inherited from class games.stendhal.server.entity.DressedEntity
getOriginalOutfit, getOutfit, getOutfitColors, isNaked, put, restoreOriginalOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfitColor, setOutfitColor, setOutfitColor, setOutfitColors, setOutfitWithDetail, unsetOutfitColor
Methods inherited from class games.stendhal.server.entity.RPEntity
addAtkXP, addBaseMana, addDefXP, addMana, addRatkXP, addStatusAttacker, addXP, applyDistanceAttackModifiers, attack, canDoRangeAttack, canHit, damage, damageDone, delayedDamage, drop, drop, drop, dropDroppableItem, dropWithInfostring, dropWithInfostring, entityAsOnlinePlayer, entityAsPet, equip, equipOrPutOnGround, equipToInventoryOnly, getAllEquipped, getAllEquippedWithInfostring, getAmmunition, getArmor, getAtk, getAtkXP, getAttackingRPEntities, getAttackRate, getAttackSources, getAttackTarget, getBaseHP, getBaseMana, getBloodClass, getBoots, getCloak, getCorpseDeserver, getCorpseHeight, getCorpseName, getCorpseWidth, getDeathSound, getDef, getDefenseItems, getDefXP, getDescriptionName, getDroppables, getEquippedItemClass, getFirstEquipped, getHarmlessCorpseName, getHelmet, getHP, getItemAtk, getItemDef, getItemRatk, getLegs, getLevel, getLVCap, getMana, getMaxRangeForArcher, getMissileIfNotHoldingOtherWeapon, getName, getNumberOfEquipped, getRangedDamageType, getRangeWeapon, getRatk, getRatkXP, getRing, getsFightXpFrom, getShield, getSlotToEquip, getStatusList, getTitle, getTotalNumberOf, getWeapon, getWeapons, getXP, handleLifesteal, handlePortal, hasArmor, hasBoots, hasCloak, hasHelmet, hasLegs, hasLineOfSight, hasRing, hasShield, hasStatus, heal, heal, heal, incAtkXP, incDefXP, incRatkXP, initHP, isAttackable, isAttacked, isAttacking, isEquipped, isEquipped, isEquippedItemClass, isEquippedItemInSlot, isEquippedWithInfostring, isEquippedWithInfostring, makeCorpse, maybeDropDroppables, onDamaged, onDead, rewardKillerAnimals, setAtk, setAtkXP, setBaseHP, setBaseMana, setBlood, setDeathSound, setDef, setDefXP, setHP, setLVCap, setMana, setName, setRatk, setRatkXP, setRatkXPInternal, setShadowStyle, setTarget, setTitle, setXP, stopAttack, stopAttacking, subXP, updateItemAtkDef, updateLevel
Methods inherited from class games.stendhal.server.entity.GuidedEntity
addSuspend, addSuspend, applyMovement, atMovementRadius, clearPath, followPath, getBaseSpeed, getCollisionAction, getDirectionFromOrigin, getDistanceFromOrigin, getGuide, getPath, getPathPosition, hasPath, isPathLoop, onFinishedPath, onMoved, onNodeReached, onOutsideMovementRadius, removeSuspend, reroute, retracePath, setBaseSpeed, setCollisionAction, setPath, setPath, setPathAndPosition, setPathPosition, setRandomMovementRadius, setRandomMovementRadius, setRetracePath, setUsesRandomPath, updateModifiedAttributes, usesRandomPath
Methods inherited from class games.stendhal.server.entity.ActiveEntity
canMoveTo, canMoveTo, faceto, faceToward, getDirection, getDirectionToward, getDirectionToward, getResistance, getSpeed, getStepsTaken, ignoresCollision, isFacingToward, isMoveCompleted, move, setDirection, setIgnoresCollision, setSpeed, stopped
Methods inherited from class games.stendhal.server.entity.Entity
getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, nextTo, nextTo, notifyWorldAboutChanges, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance
Methods inherited from class marauroa.common.game.RPObject
addEvent, addLink, addLink, addMap, addSlot, addSlot, applyDifferences, clearEvents, clearVisible, clone, containsKey, events, eventsIterator, fill, get, getBaseContainer, getBoolean, getContainer, getContainerBaseOwner, getContainerOwner, getContainerSlot, getDifferences, getDouble, getFromSlots, getID, getInt, getLink, getLinkedObject, getMap, getSlot, has, hasLink, hasMap, hasSlot, hide, isContained, isEmpty, isHidden, isStorable, maps, put, put, put, put, readObject, remove, removeLink, removeMap, removeSlot, resetAddedAndDeleted, resetAddedAndDeletedMaps, resetAddedAndDeletedRPLink, resetAddedAndDeletedRPSlot, setAddedMaps, setAddedRPSlot, setContainer, setDeletedMaps, setDeletedRPSlot, setID, size, slots, slotsIterator, store, unhide, unstore, writeObject, writeObject, writeToJson
Methods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlots
Methods inherited from class marauroa.common.game.Attributes
add, applyDifferences, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, instanceOf, iterator, put, put, put, put, readFromMap, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, toAttributeString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Player
-
-
Method Details
-
generateRPClass
public static void generateRPClass() -
createZeroLevelPlayer
-
destroy
-
addClientDirection
Add an active client direction.- Parameters:
direction
- direction
-
removeClientDirection
Remove an active client direction.- Parameters:
direction
- direction
-
applyClientDirection
public void applyClientDirection(boolean stopOnNone)Apply the most recent active client direction.- Parameters:
stopOnNone
- Stop movement if no (valid) directions are active iftrue
.
-
isObstacle
Description copied from class:Entity
Determine if this is an obstacle for another entity.- Overrides:
isObstacle
in classEntity
- Parameters:
entity
- The entity to check against.- Returns:
true
if very high resistance.
-
requestStop
public void requestStop()Request stopping the player, unless the player started moving the same turn. Intended for client initiated stops, that should not prevent the player moving one tile with a quick key press. -
stop
public void stop()Stop and clear any active directions.- Overrides:
stop
in classGuidedEntity
-
forceStop
public void forceStop()Forces player to stop moving, bypassing auto-walk -
getAwayMessage
Get the away message.- Returns:
- The away message, or
null
if unset.
-
setAwayMessage
Set the away message.- Parameters:
message
- An away message, ornull
.
-
getGrumpyMessage
Get the grumpy message.- Returns:
- The grumpy message, or
null
if unset.
-
setGrumpyMessage
Set the grumpy message.- Parameters:
message
- A grumpy message, ornull
.
-
addKarma
public void addKarma(double karmaToAdd)Give the player some karma (good or bad). -
getKarma
public double getKarma()Get the current amount of karma.- Overrides:
getKarma
in classRPEntity
- Returns:
- The current amount of karma.
- See Also:
addKarma(double)
-
useKarma
public double useKarma(double scale)Use some of the player's karma. A positive value indicates good luck/energy. A negative value indicates bad luck/energy. A value of zero should cause no change on an action or outcome. -
useKarma
public double useKarma(double negLimit, double posLimit)Use some of the player's karma. A positive value indicates good luck/energy. A negative value indicates bad luck/energy. A value of zero should cause no change on an action or outcome. The granularity is0.01
(%1 unit). -
useKarma
public double useKarma(double negLimit, double posLimit, double granularity)Use some of the player's karma. A positive value indicates good luck/energy. A negative value indicates bad luck/energy. A value of zero should cause no change on an action or outcome. -
incrementTradescore
public void incrementTradescore()increments the number of successful trades by 1 -
getTradescore
public int getTradescore() -
getUnlockedPortals
- Returns:
- List of portals that have been unlocked for this player.
-
lockPortal
public void lockPortal(int ID)Removes the portal from the list of unlocked portals.- Parameters:
ID
- Portal's ID
-
unlockPortal
public void unlockPortal(int ID)Adds a portal ID to a list of "unlocked" portals for player.- Parameters:
ID
- Portal's ID
-
update
public void update()Process changes that to the object attributes. This may be called several times (unfortunately) due to the requirements of the class's constructor, sometimes before prereqs are initialised. -
addIgnore
Add a player ignore entry.- Parameters:
name
- The player name.duration
- The ignore duration (in minutes), or0
for infinite.reply
- The reply.- Returns:
true
if value changed,false
if there was a problem.
-
getIgnore
Determine if a player is on the ignore list and return their reply message.- Parameters:
name
- The player name.- Returns:
- The custom reply message (including an empty string), or
null
if not ignoring.
-
removeIgnore
Remove a player ignore entry.- Parameters:
name
- The player name.- Returns:
true
if value changed,false
if there was a problem.
-
getIgnores
- Returns:
- all buddy names for this player
-
getSkill
Get a named skills value.- Parameters:
key
- The skill key.- Returns:
- The skill value, or
null
if not set.
-
getMagicSkillXp
Get the current value for the skill of a magic nature- Parameters:
nature
- the nature to get the skill for- Returns:
- current skill value
-
increaseMagicSkillXp
Increase the skill points for a magic nature by a given amount- Parameters:
nature
-amount
-
-
setSkill
Set a named skills value.- Parameters:
key
- The skill key.value
- The skill value.- Returns:
true
if value changed,false
if there was a problem.
-
getKeyedSlot
Get a keyed string value on a named slot.- Parameters:
name
- The slot name.key
- The value key.- Returns:
- The keyed value of the slot, or
null
if not set.
-
setKeyedSlot
Set a keyed string value on a named slot.- Parameters:
name
- The slot name.key
- The value key.value
- The value to assign (or remove ifnull
).- Returns:
true
if value changed,false
if there was a problem.
-
hasFeature
Checks if player has a feature.- Parameters:
name
- The feature mnemonic.- Returns:
true
if the feature value is notnull
.
-
getFeature
Get a client feature value.- Parameters:
name
- The feature mnemonic.- Returns:
- The feature value, or
null
is not-enabled.
-
setFeature
Enable/disable a client feature.- Parameters:
name
- The feature mnemonic.enabled
- Flag indicating if enabled.
-
setFeature
Sets/removes a client feature.NOTE: The names and values MUST NOT contain
=
(equals), or:
(colon).- Parameters:
name
- The feature mnemonic.value
- The feature value, ornull
to disable.
-
unsetFeature
Unset a client feature- Parameters:
name
- The feature mnemonic
-
isInvisibleToCreatures
public boolean isInvisibleToCreatures()Determine if the entity is invisible to creatures.- Overrides:
isInvisibleToCreatures
in classRPEntity
- Returns:
true
if invisible.
-
setInvisible
public void setInvisible(boolean invisible)Set whether this player is invisible to creatures.- Parameters:
invisible
-true
if invisible.
-
sendPrivateText
Sends a message that only this player can read. Used for messages that should not appear as sent by another player. For messages from other players (or relevant NPC messages), use sendPrivateText(PRIVMSG, text)- Overrides:
sendPrivateText
in classRPEntity
- Parameters:
text
- the message.
-
sendPrivateText
Sends a message that only this entity can read.- Overrides:
sendPrivateText
in classRPEntity
- Parameters:
type
- NotificationTypetext
- The message.headless
- Iftrue
, does not draw a chat balloon on canvas.
-
setLastPrivateChatter
Sets the name of the last player who privately talked to this player using the /tell command. It needs to be stored non-persistently so that /answer can be used.- Parameters:
lastPrivateChatterName
-
-
getLastPrivateChatter
Gets the name of the last player who privately talked to this player using the /tell command, or null if nobody has talked to this player since he logged in.- Returns:
- name of last player
-
getAdminLevel
public int getAdminLevel()Returns the admin level of this user. See AdministrationAction.java for details.- Returns:
- adminlevel
-
setAdminLevel
public void setAdminLevel(int adminlevel)Set the player's admin level.- Parameters:
adminlevel
- The new admin level.
-
rememberAttacker
- Overrides:
rememberAttacker
in classRPEntity
-
onDead
Description copied from class:RPEntity
This method is called when this entity has been killed (hp == 0). -
dropItemsOn
- Specified by:
dropItemsOn
in classDressedEntity
-
removeSheep
-
removePet
-
hasSheep
public boolean hasSheep() -
hasPet
public boolean hasPet() -
setPet
Set the player's pet. This will also set the pet's owner.- Parameters:
pet
- The pet.
-
setSheep
Set the player's sheep. This will also set the sheep's owner.- Parameters:
sheep
- The sheep.
-
getSheep
Get the player's sheep.- Returns:
- The sheep.
-
getPet
-
getAge
public int getAge()Gets the number of minutes that this player has been logged in on the server.- Returns:
- age of player in minutes
-
isNew
public boolean isNew()Is this a new player?- Returns:
- true if it is a new player, false otherwise
-
setAge
public void setAge(int age)Sets the number of minutes that this player has been logged in on the server.- Parameters:
age
- minutes
-
storeLastPVPActionTime
public void storeLastPVPActionTime()Updates the last pvp action time with the current time. -
getLastPVPActionTime
public long getLastPVPActionTime()Returns the time the player last did an PVP action.- Returns:
- time in milliseconds
-
notifyOnline
Notifies this player that the given player has logged in.- Parameters:
who
- The name of the player who has logged in.
-
notifyOffline
Notifies this player that the given player has logged out.- Parameters:
who
- The name of the player who has logged out.
-
setBuddyOnlineStatus
Sets the online status for a buddy in the players' buddy list- Parameters:
buddyName
-isOnline
- buddy is online?
-
hasBuddies
public boolean hasBuddies()- Returns:
- true iff this player has buddies (considers only map attribute!)
-
getBuddies
- Returns:
- all buddy names for this player
-
countBuddies
public int countBuddies() -
isQuestCompleted
Checks whether the player has completed the given quest or not.- Parameters:
name
- The quest's name- Returns:
- true iff the quest has been completed by the player
-
hasQuest
Checks whether the player has made any progress in the given quest or not. For many quests, this is true right after the quest has been started.- Parameters:
name
- The quest's name- Returns:
- true if the player has made any progress in the quest
-
getQuest
Gets the player's current status in the given quest.- Parameters:
name
- The quest's name- Returns:
- the player's status in the quest
-
getQuest
Gets the player's current status in the given quest.- Parameters:
name
- The quest's nameindex
- the index of the sub state to change (separated by ";")- Returns:
- the player's status in the quest
-
setQuest
Allows to store the player's current status in a quest in a string. This string may, for instance, be "started", "done", a semicolon- separated list of items that need to be brought/NPCs that need to be met, or the number of items that still need to be brought. Note that the string "done" has a special meaning: see isQuestCompleted().- Parameters:
name
- The quest's namestatus
- the player's status in the quest. Set it to null to completely reset the player's status for the quest.
-
setQuest
Allows to store the player's current status in a quest in a string. This string may, for instance, be "started", "done", a semicolon- separated list of items that need to be brought/NPCs that need to be met, or the number of items that still need to be brought. Note that the string "done" has a special meaning: see isQuestComplete().- Parameters:
name
- The quest's nameindex
- the index of the sub state to change (separated by ";")status
- the player's status in the quest. Set it to null to completely reset the player's status for the quest.
-
getQuests
-
removeQuest
-
isQuestInState
Is the named quest in one of the listed states?- Parameters:
name
- queststates
- valid states- Returns:
- true, if the quest is in one of theses states, false otherwise
-
isQuestInState
Is the named quest in one of the listed states?- Parameters:
name
- questindex
- quest indexstates
- valid states- Returns:
- true, if the quest is in one of theses states, false otherwise
-
hasKilled
Checks if the player has ever killed a creature, with or without the help of any other player.- Parameters:
name
- of the creature to check.- Returns:
- true iff this player has ever killed this creature.
-
hasKilledSolo
Checks if the player has ever 'solo killed' a creature, i.e. without the help of any other player.- Parameters:
name
- of the creature to check.- Returns:
- true iff this player has ever killed this creature on his own.
-
setSoloKill
Stores that the player has killed 'name' solo. Overwrites shared kills of 'name'- Parameters:
name
- of the victim
-
setSoloKillCount
Changes solo kills count to specified value.- Parameters:
name
- name of killed entitycount
- value to set
-
getSoloKill
Returns how much the player has killed 'name' solo.- Parameters:
name
- of the victim- Returns:
- number of solo kills
-
describe
Description copied from class:Entity
Describes the entity (if a players looks at it). -
teleport
Teleports this player to the given destination.- Parameters:
zone
- The zone where this player should be teleported to.x
- The destination's x coordinatey
- The destination's y coordinatedir
- The direction in which the player should look after teleporting, or null if the direction shouldn't changeteleporter
- The player who initiated the teleporting, or null if no player is responsible. This is only to give feedback if something goes wrong. If no feedback is wanted, use null.- Returns:
true
if teleporting was successful.
-
teleport
Teleports player to given destination using zoneid string.- Parameters:
zoneid
-String
name/ID of zone.x
- Destination's horizontal coordinate.y
- Distination's vertical coordinate.dir
- The direction in which the player should look after teleporting, or null if the direction shouldn't change.teleporter
-- Returns:
true
if teleporting was successful.
-
onPush
Called when player push entity. The entity displacement is handled by the action itself.- Parameters:
entity
-
-
canPush
Return true if player can push entity.- Parameters:
entity
-- Returns:
- true iff pushing is possible
-
returnToOriginalOutfit
public boolean returnToOriginalOutfit()Tries to give the player his original outfit back after he has put on a temporary outfit. This will only be successful if the original outfit has been stored.- Returns:
- true iff returning was successful.
-
isZoneChangeAllowed
public boolean isZoneChangeAllowed()Determine if zone changes are currently allowed via normal means (non-portal teleportation doesn't count).- Overrides:
isZoneChangeAllowed
in classActiveEntity
- Returns:
true
if the entity can change zones.
-
logic
public void logic()Perform cycle logic.- Specified by:
logic
in classDressedEntity
-
isGhost
public boolean isGhost()Checks whether an entity is a ghost (non physically interactive).- Overrides:
isGhost
in classActiveEntity
- Returns:
true
if in ghost mode.
-
setGhost
public void setGhost(boolean ghost)Set whether this player is a ghost (invisible/non-interactive).- Parameters:
ghost
-true
if a ghost.
-
isTeleclickEnabled
public boolean isTeleclickEnabled()Checks whether a player has teleclick enabled.- Returns:
true
if teleclick is enabled.
-
setTeleclickEnabled
public void setTeleclickEnabled(boolean teleclick)Set whether this player has teleclick enabled.- Parameters:
teleclick
-true
if teleclick enabled.
-
onAdded
Called when this object is added to a zone. -
onRemoved
Called when this object is being removed from a zone. -
hashCode
public int hashCode() -
equals
Description copied from class:RPObject
Returns true if two objects are exactly equal -
toString
Description copied from class:RPObject
This method returns a String that represent the object -
setSentence
sets the player sentence- Parameters:
sentence
- sentence to store
-
getSentence
gets the player sentence displayed on the web site- Returns:
- player sentence
-
isDisconnected
public boolean isDisconnected()checks whether this client is flagged as disconnected- Returns:
- true, if the client is disconnected; false otherwise.
-
setClientVersion
sets the client version- Parameters:
version
-
-
isClientNewerThan
checks if the client is newer than the requested version- Parameters:
version
- requested version- Returns:
- check the client is newer
-
getAllEquippedWorkingRingOfLife
gets a list of all rings of life that are not broken- Returns:
- list of rings of life
-
getAnimals
Return a list of all animals associated to this player.- Returns:
- List of DomesticalAnmial
-
searchAnimal
Search for an animal with the given name or type.- Parameters:
name
- the name or type of the pet to searchexactly
-true
if looking only for matching name instead of both name and type.- Returns:
- the found pet
-
applyDefXP
- Overrides:
applyDefXP
in classRPEntity
-
handleObjectCollision
protected void handleObjectCollision()- Overrides:
handleObjectCollision
in classGuidedEntity
-
isBadBoy
public boolean isBadBoy() -
getLastPlayerKillTime
public long getLastPlayerKillTime()Returns the time the player last did a player kill.- Returns:
- time in milliseconds
-
rehabilitate
public void rehabilitate() -
rewardKillers
protected void rewardKillers(int oldXP)Description copied from class:RPEntity
Gives XP to every player who has helped killing this RPEntity.- Overrides:
rewardKillers
in classRPEntity
- Parameters:
oldXP
- The XP that this RPEntity had before being killed.
-
getPetOwner
-
isBoundTo
-
getChatBucket
gets the PlayerChatBucket- Returns:
- PlayerChatBucket
-
getDamageType
Description copied from class:RPEntity
Get the type of the damage this entity inflicts- Overrides:
getDamageType
in classRPEntity
- Returns:
- type of damage
-
getSusceptibility
Description copied from class:RPEntity
Get a multiplier for a given damage type when this entity is damaged.- Overrides:
getSusceptibility
in classRPEntity
- Parameters:
type
- Type of the damage- Returns:
- damage multiplier
-
addBuddy
adds a buddy to the player's buddy list- Parameters:
name
- the name of the buddyonline
- if the player is online- Returns:
- true if the buddy has been added
-
removeBuddy
removes a buddy to the player's buddy list- Parameters:
name
- the name of the buddy- Returns:
- true if a buddy was removed
-
setLevel
public void setLevel(int level) -
setDefInternal
protected void setDefInternal(int def, boolean notify)- Overrides:
setDefInternal
in classRPEntity
-
setAtkInternal
protected void setAtkInternal(int atk, boolean notify)- Overrides:
setAtkInternal
in classRPEntity
-
setRatkInternal
protected void setRatkInternal(int ratk, boolean notify)Description copied from class:RPEntity
Set the entity's ranged attack level.- Overrides:
setRatkInternal
in classRPEntity
- Parameters:
ratk
- Integer value representing new ranged attack levelnotify
- Update stat in real-time
-
addReachedAchievement
Adds the identifier of an achievement to the reached achievements- Parameters:
identifier
-
-
initReachedAchievements
public void initReachedAchievements() -
arePlayerAchievementsLoaded
public boolean arePlayerAchievementsLoaded()checks if the achievements of this player object are already loaded- Returns:
- true, if the achievement set is loaded, false otherwise
-
hasReachedAchievement
Checks if a player has reached the achievement with the given identifier- Parameters:
identifier
-- Returns:
- true if player had reached the achievement with the given identifier
-
hasVisitedZone
Checks if the player has visited the given zone- Parameters:
zone
- the zone to check for- Returns:
- true if player visited the zone
-
offerTrade
offers the other player to start a trading session- Parameters:
partner
- to offer the trade to
-
getTradeState
gets the state of player to player trades- Returns:
- TradeState
-
getTradePartner
gets the partner of a player to player trade- Returns:
- name of partner or
null
if no trade is ongoing
-
startTrade
starts a trade with this partner- Parameters:
partner
- partner to trade with
-
cancelTradeInternally
cancels a trade and moves the items back.- Parameters:
partnerName
- name of partner (to make sure the correct trade offer is canceled)
-
unlockTradeItemOffer
public void unlockTradeItemOffer()unlocks a trade item offer for example because of some modifications on the trade slot. -
lockTrade
public void lockTrade()locks the item offer. -
dealTrade
public void dealTrade()accepts the trade if both offers are locked. -
cancelTrade
public void cancelTrade()cancels a trade or trade offer. -
getNumberOfLootsForItem
Gets the how often this player has looted the given item- Parameters:
item
- the item name- Returns:
- the number of loots from corpses
-
getQuantityOfProducedItems
Gets the amount a player as produced of an item- Parameters:
item
- the item name- Returns:
- the produced amount
-
getQuantityOfMinedItems
Gets the amount a player as mined of an item- Parameters:
item
- the item name- Returns:
- the mined amount
-
getQuantityOfHarvestedItems
Gets the amount a player has harvested of an item- Parameters:
item
- the item name- Returns:
- the harvested amount
-
getQuantityOfObtainedItems
public int getQuantityOfObtainedItems()- Returns:
- the whole number of items a player has obtained from the well
-
getQuantityOfBoughtItems
Gets the amount of an item bought by player.- Parameters:
item
- Item name.- Returns:
- Number bought of the item.
-
getQuantityOfSoldItems
Gets the amount of an item sold by player.- Parameters:
item
- Item name.- Returns:
- Number sold of the item.
-
incLootForItem
Increases the count of loots for the given item- Parameters:
item
- the item namecount
-
-
incProducedForItem
Increases the count of producings for the given item- Parameters:
item
- the item namecount
-
-
incObtainedForItem
Increases the count of obtains from the well for the given item- Parameters:
name
- the item namequantity
-
-
incSoldForItem
Increases the count of sales for the given item- Parameters:
name
- the item namequantity
-
-
incMinedForItem
Increases the amount of successful minings for the given item- Parameters:
name
- the item namequantity
-
-
incHarvestedForItem
Increases the amount of successful harvestings for the given item- Parameters:
name
- the item namequantity
-
-
incBoughtForItem
Increases the amount of successful buyings for the given item- Parameters:
name
- the item namequantity
-
-
incCommerceTransaction
Stores information about amount of money used & gained in NPC transactions.- Parameters:
npcName
- Name of NPC with whom transactions is being done.price
- Amount of money exchanged.soldToNPC
-true
means player is selling to NPC,false
player is buying from.
-
getCommerceTransactionAmount
-
getRequiredItemName
Gets the recorded item stored in a substate of quest slot- Parameters:
questname
- The quest's nameindex
- the index of the sub state to get (separated by ";")- Returns:
- the name of the required item (no formatting)
-
getRequiredItemQuantity
Gets the recorded item quantity stored in a substate of quest slot- Parameters:
questname
- The quest's nameindex
- the index of the sub state to get (separated by ";")- Returns:
- required item quantity
-
handleLeaveZone
protected void handleLeaveZone(int nx, int ny)- Overrides:
handleLeaveZone
in classActiveEntity
-
getNumberOfRepetitions
Gets the number of repetitions in a substate of quest slot- Parameters:
questname
- The quest's nameindex
- the index of the sub state to get (separated by ";")- Returns:
- the integer value in the index of the quest slot, used to represent a number of repetitions
-
getLastClientActionTimestamp
public long getLastClientActionTimestamp()gets the timestmap this client sent the last action- Returns:
- action timestmap
-
setLastClientActionTimestamp
public void setLastClientActionTimestamp(long lastClientActionTimestamp)sets the timestamp at which this client sent the last action.- Parameters:
lastClientActionTimestamp
- action timestmap
-
getLanguage
gets the language- Overrides:
getLanguage
in classRPEntity
- Returns:
- language
-
setLanguage
sets the language- Parameters:
language
- language
-
setUseListener
adds a use listener causing the client to add an use action with the specified name- Parameters:
actionDisplayName
- name of useaction visible in the clientlistener
- use event listener
-
getUseListener
gets the current UseListener- Returns:
- UseListener
-
removeUseListener
public void removeUseListener()removes a use event listener -
hasUseListener
public boolean hasUseListener()has the player a use listener?- Returns:
- true if there is a use listener registered, false otherwise
-
onUsed
Invoked when the object is used.- Specified by:
onUsed
in interfaceUseListener
- Parameters:
user
- the RPEntity who uses the object- Returns:
- true if successful
-
registerOutfitExpireTime
public void registerOutfitExpireTime(int expire)sets the time a outfit wears off- Parameters:
expire
- expire age
-
getClientVersion
gets the client version- Returns:
- client version
-
getCappedAtk
public int getCappedAtk()gets the capped atk level, which prevent players from training their atk way beyond what is reasonable for their level- Overrides:
getCappedAtk
in classRPEntity
- Returns:
- capped atk
-
getCappedDef
public int getCappedDef()gets the capped def level, which prevent players from training their def way beyond what is reasonable for their level- Overrides:
getCappedDef
in classRPEntity
- Returns:
- capped atk
-
getCappedRatk
public int getCappedRatk()Gets the capped ratk level, which prevent players from training their ratk way beyond what is reasonable for their level. XXX: Should use getMaxRatkForLevel() method instead?- Overrides:
getCappedRatk
in classRPEntity
- Returns:
- capped ratk
-
handleSimpleCollision
protected void handleSimpleCollision(int nx, int ny)Collision handling instructions for players.- Overrides:
handleSimpleCollision
in classActiveEntity
- Parameters:
nx
- New horizontal positionny
- New vertical position
-
getMaxSlotSize
returns the maximum size of a slot- Parameters:
slot
- name of slot- Returns:
- size, or -1 if no maximum is known
-