Class Player
java.lang.Object
- 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, HIT_CHANCE_MULTIPLIER, level, lv_cap, ratk, statusAttackers, statusList, totalDamageReceivedFields inherited from class games.stendhal.server.entity.CombatEntity
enemiesThatGiveFightXP, RPCLASS_NAMEFields inherited from class games.stendhal.server.entity.GuidedEntity
baseSpeed, pathnotifierFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadds a buddy to the player's buddy listvoidaddClientDirection(Direction direction) Add an active client direction.booleanAdd a player ignore entry.voidaddKarma(double karmaToAdd) Give the player some karma (good or bad).voidaddReachedAchievement(String identifier) Adds the identifier of an achievement to the reached achievementsvoidapplyClientDirection(boolean stopOnNone) Apply the most recent active client direction.booleanchecks if the achievements of this player object are already loadedprotected intcalculateRiskForCanHit(int roll, int defenderDEF, int attackerATK) This handicap increases chance that a player can hit an enemy to make the game feel more fair.voidcancels a trade or trade offer.voidcancelTradeInternally(String partnerName) cancels a trade and moves the items back.booleanReturn true if player can push entity.intstatic PlayercreateZeroLevelPlayer(String characterName, RPObject template) intdamageDone(RPEntity defender, double attackingWeaponsValue, Nature damageType) This is overridden to reduce damage done by players to creatures to make up for the increased hit chance.voidaccepts the trade if both offers are locked.describe()Describes the entity (if a players looks at it).static voidprotected voiddropItemsOn(Corpse corpse) booleanReturns true if two objects are exactly equalvoidForces player to stop moving, bypassing auto-walkstatic voidintReturns the admin level of this user.intgetAge()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 brokenintgetAllKillCount(String name) Retrieves number of creatures kill by this player alone and/or with help from others.Return a list of all animals associated to this player.Get the away message.intgets the capped atk level, which prevent players from training their atk way beyond what is reasonable for their levelintgets the capped def level, which prevent players from training their def way beyond what is reasonable for their levelintGets the capped ratk level, which prevent players from training their ratk way beyond what is reasonable for their level.gets the PlayerChatBucketgets the client versionintgetCommerceTransactionAmount(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.doublegetKarma()Get the current amount of karma.getKeyedSlot(String name, String key) Get a keyed string value on a named slot.gets the languagelonggets the timestmap this client sent the last actionlongReturns 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.longReturns the time the player last did an PVP action.intgetMagicSkillXp(Nature nature) Get the current value for the skill of a magic natureintgetMaxSlotSize(String slot) returns the maximum size of a slotintGets the how often this player has looted the given itemintgetNumberOfRepetitions(String questname, int index) Gets the number of repetitions in a substate of quest slotgetPet()intGets the amount of an item bought by player.intGets the amount a player has harvested of an itemintGets the amount a player as mined of an itemintintGets the amount a player as produced of an itemintgetQuantityOfSoldItems(String item) Gets the amount of an item sold by player.intgetQuantityOfSownItems(String item) Retrieve the amount of items sown 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 slotintgetRequiredItemQuantity(String questname, int index) Gets the recorded item quantity stored in a substate of quest slotgets the player sentence displayed on the web siteintgetSharedKill(String name) Retrieves number of creatures killed by this player with help from others.intgetSharedKillCount(String name) Retrieves number of creatures killed by this player with help from others.getSheep()Get the player's sheep.Get a named skills value.intgetSoloKill(String name) Retrieves number of creatures killed alone by this player.intgetSoloKillCount(String name) Retrieves number of creatures killed alone by this player.protected doublegetSusceptibility(Nature type) Get a multiplier for a given damage type when this entity is damaged.protected Stringgets the partner of a player to player tradeintgets the state of player to player tradesgets the current UseListenerprotected voidhandleLeaveZone(int nx, int ny) protected voidprotected voidhandleSimpleCollision(int nx, int ny) Collision handling instructions for players.booleanbooleanhasFeature(String name) Checks if player has a feature.inthashCode()booleanChecks if the player has ever killed a creature, with or without the help of any other player.booleanhasKilledShared(String name) Checks if the player has ever 'shared killed' a creature, i.e.booleanhasKilledSolo(String name) Checks if the player has ever 'solo killed' a creature, i.e.booleanhasPet()booleanChecks whether the player has made any progress in the given quest or not.booleanhasReachedAchievement(String identifier) Checks if a player has reached the achievement with the given identifierbooleanhasSheep()booleanhas the player a use listener?booleanhasVisitedZone(StendhalRPZone zone) Checks if the player has visited the given zone.booleanhasVisitedZone(String zoneName) Checks if the player has visited the given zone.voidincBoughtForItem(String name, int quantity) Increases the amount of successful buyings for the given itemvoidincCommerceTransaction(String npcName, int price, boolean soldToNPC) Stores information about amount of money used & gained in NPC transactions.voidincHarvestedForItem(String name, int quantity) Increases the amount of successful harvestings for the given itemvoidincLootForItem(String item, int count) Increases the count of loots for the given itemvoidincMinedForItem(String name, int quantity) Increases the amount of successful minings for the given itemvoidincObtainedForItem(String name, int quantity) Increases the count of obtains from the well for the given itemvoidincProducedForItem(String item, int count) Increases the count of producings for the given itemvoidincreaseMagicSkillXp(Nature nature, int amount) Increase the skill points for a magic nature by a given amountvoidincrements the number of successful trades by 1voidincSharedKillCount(String name) Increments number of counted shared kills by 1.voidincSoldForItem(String name, int quantity) Increases the count of sales for the given itemvoidincSoloKillCount(String name) Increments number of counted solo kills by 1.voidincSownForItem(String name, int quantity) Increses the quanity an item was sown by player.voidbooleanisBadBoy()booleanbooleanisClientNewerThan(String version) checks if the client is newer than the requested versionbooleanchecks whether this client is flagged as disconnectedbooleanisGhost()Checks whether an entity is a ghost (non physically interactive).booleanDetermine if the entity is invisible to creatures.booleanisNew()Is this a new player?booleanisObstacle(Entity entity) Determine if this is an obstacle for another entity.booleanisQuestCompleted(String name) Checks whether the player has completed the given quest or not.booleanisQuestInState(String name, int index, String... states) Is the named quest in one of the listed states?booleanisQuestInState(String name, String... states) Is the named quest in one of the listed states?booleanChecks whether a player has teleclick enabled.booleanDetermine if zone changes are currently allowed via normal means (non-portal teleportation doesn't count).voidlockPortal(int ID) Removes the portal from the list of unlocked portals.voidlocks the item offer.voidlogic()Perform cycle logic.voidnotifyOffline(String who) Notifies this player that the given player has logged out.voidnotifyOnline(String who) Notifies this player that the given player has logged in.voidofferTrade(Player partner) offers the other player to start a trading sessionvoidonAdded(StendhalRPZone zone) Called when this object is added to a zone.voidThis method is called when this entity has been killed (hp == 0).voidCalled when player push entity.voidonRemoved(StendhalRPZone zone) Called when this object is being removed from a zone.booleanInvoked when the object is used.booleanChecks if entity is wearnig a temporary outfit.voidregisterOutfitExpireTime(int expire) sets the time a outfit wears offvoidvoidrememberAttacker(Entity attacker) booleanremoveBuddy(String name) removes a buddy to the player's buddy listvoidremoveClientDirection(Direction direction) Remove an active client direction.booleanremoveIgnore(String name) Remove a player ignore entry.voidvoidremoveQuest(String name) voidremoveSheep(Sheep sheep) voidremoves a use event listenervoidRequest stopping the player, unless the player started moving the same turn.booleanTries to give the player his original outfit back after he has put on a temporary outfit.protected voidrewardKillers(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.voidsendPrivateText(NotificationType type, String text) Sends a message that only this entity can read.voidsendPrivateText(NotificationType type, String sender, String text) Sends a message that only this entity can read.voidsendPrivateText(String text) Sends a message that only this player can read.voidsendPrivateText(String sender, String text) Sends a message that only this entity can read.voidsetAdminLevel(int adminlevel) Set the player's admin level.voidsetAge(int age) Sets the number of minutes that this player has been logged in on the server.protected voidsetAtkInternal(int atk, boolean notify) voidsetAwayMessage(String message) Set the away message.voidsetBuddyOnlineStatus(String buddyName, boolean isOnline) Sets the online status for a buddy in the players' buddy listvoidsetClientVersion(String version) sets the client versionprotected voidsetDefInternal(int def, boolean notify) voidsetFeature(String name, boolean enabled) Enable/disable a client feature.voidsetFeature(String name, String value) Sets/removes a client feature.voidsetGhost(boolean ghost) Set whether this player is a ghost (invisible/non-interactive).voidsetGrumpyMessage(String message) Set the grumpy message.voidsetInvisible(boolean invisible) Set whether this player is invisible to creatures.booleansetKeyedSlot(String name, String key, String value) Set a keyed string value on a named slot.voidsetLanguage(String language) sets the languagevoidsetLastClientActionTimestamp(long lastClientActionTimestamp) sets the timestamp at which this client sent the last action.voidsetLastPrivateChatter(String lastPrivateChatterName) Sets the name of the last player who privately talked to this player using the /tell command.voidsetLevel(int level) voidsetOriginalOutfit(Outfit outfit) Sets the player's original outfit.voidsetOriginalOutfit(Outfit outfit, Map<String, Integer> colors) Sets the player's original outfit.voidsetOriginalOutfit(String outfit) Sets the player's original outfit.voidsetOriginalOutfit(String outfit, String colors) Sets the player's original outfit.voidsetPerpetualOutfitColor(String layer, int color) Sets a layer color for both the player's original & temporary outfits.voidsetPerpetualOutfitColor(String layer, String color) Sets a layer color for both the player's original & temporary outfits.voidsetPerpetualOutfitLayer(String layer, int index) Sets a layer for both the player's original & temporary outfits without changing temporary expiration.voidSet the player's pet.voidAllows to store the player's current status in a quest in a string.voidAllows to store the player's current status in a quest in a string.protected voidsetRatkInternal(int ratk, boolean notify) Set the entity's ranged attack level.voidsetSentence(String sentence) sets the player sentencevoidsetSharedKill(String name) Stores that the player has killed 'name' with help of others.voidsetSharedKillCount(String name, int count) Changes shared kills count to specified value.voidSet the player's sheep.booleanSet a named skills value.voidsetSoloKill(String name) Stores that the player has killed 'name' solo.voidsetSoloKillCount(String name, int count) Changes solo kills count to specified value.voidsetTeleclickEnabled(boolean teleclick) Set whether this player has teleclick enabled.voidsetTemporaryOutfit(Outfit outfit, int expireAge) Use this method to add a new temporary outfit or override an old one.voidsetTemporaryOutfit(Outfit outfit, int expireAge, boolean clearColors) Use this method to add a new temporary outfit or override an old one.voidsetTemporaryOutfit(String outfit, int expireAge) Use this method to add a new temporary outfit or override an old one.voidsetTemporaryOutfit(String outfit, int expireAge, boolean clearColors) Use this method to add a new temporary outfit or override an old one.voidsetUseListener(String actionDisplayName, UseListener listener) adds a use listener causing the client to add an use action with the specified nameprotected voidstartTrade(Player partner) starts a trade with this partnervoidstop()Stop and clear any active directions.voidUpdates the last pvp action time with the current time.booleanteleport(StendhalRPZone zone, int x, int y, Direction dir, Player teleporter) Teleports this player to the given destination.booleanTeleports player to given destination using zoneid string.toString()This method returns a String that represent the objectvoidunlockPortal(int ID) Adds a portal ID to a list of "unlocked" portals for player.voidunlocks a trade item offer for example because of some modifications on the trade slot.voidunsetFeature(String name) Unset a client featurevoidupdate()Process changes that to the object attributes.doubleuseKarma(double scale) Use some of the player's karma.doubleuseKarma(double negLimit, double posLimit) Use some of the player's karma.doubleuseKarma(double negLimit, double posLimit, double granularity) Use some of the player's karma.Methods inherited from class games.stendhal.server.entity.DressedEntity
clearColors, getColorableLayers, getOriginalOutfit, getOutfit, getOutfitColor, getOutfitColors, isNaked, put, restoreOriginalOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfit, setOutfitColor, setOutfitColor, setOutfitColor, setOutfitColors, setOutfitWithDetail, storeOriginalOutfit, unsetOutfitColorMethods 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, dropWithItemdata, dropWithItemdata, entityAsOnlinePlayer, entityAsPet, equip, equipOrPutOnGround, equipToInventoryOnly, getAllEquipped, getAllEquippedWithItemdata, getAllStatusAttackers, 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, 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, isEquippedWithItemdata, isEquippedWithItemdata, makeCorpse, maybeDropDroppables, onDamaged, onDead, onRejectedAttackStart, rewardKillerAnimals, setAtk, setAtkXP, setBaseHP, setBaseMana, setBlood, setDeathSound, setDef, setDefXP, setHP, setLVCap, setMana, setName, setRatk, setRatkXP, setRatkXPInternal, setShadowStyle, setTarget, setTitle, setXP, stopAttack, stopAttacking, subXP, updateItemAtkDef, updateLevelMethods inherited from class games.stendhal.server.entity.CombatEntity
getsAtkXpFrom, getsDefXpFrom, recentlyDamagedByMethods 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, usesRandomPathMethods 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, stoppedMethods 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, squaredDistanceMethods 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, writeToJsonMethods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlotsMethods 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, toAttributeStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:EntityDetermine if this is an obstacle for another entity.- Overrides:
isObstaclein classEntity- Parameters:
entity- The entity to check against.- Returns:
trueif 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:
stopin classGuidedEntity
-
forceStop
public void forceStop()Forces player to stop moving, bypassing auto-walk -
getAwayMessage
Get the away message.- Returns:
- The away message, or
nullif unset.
-
setAwayMessage
Set the away message.- Parameters:
message- An away message, ornull.
-
getGrumpyMessage
Get the grumpy message.- Returns:
- The grumpy message, or
nullif 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. -
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), or0for infinite.reply- The reply.- Returns:
trueif value changed,falseif 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
nullif not ignoring.
-
removeIgnore
Remove a player ignore entry.- Parameters:
name- The player name.- Returns:
trueif value changed,falseif 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
nullif 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:
trueif value changed,falseif 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
nullif 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:
trueif value changed,falseif there was a problem.
-
hasFeature
Checks if player has a feature.- Parameters:
name- The feature mnemonic.- Returns:
trueif the feature value is notnull.
-
getFeature
Get a client feature value.- Parameters:
name- The feature mnemonic.- Returns:
- The feature value, or
nullis 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, ornullto disable.
-
unsetFeature
Unset a client feature- Parameters:
name- The feature mnemonic
-
isInvisibleToCreatures
public boolean isInvisibleToCreatures()Determine if the entity is invisible to creatures.- Overrides:
isInvisibleToCreaturesin classRPEntity- Returns:
trueif invisible.
-
setInvisible
public void setInvisible(boolean invisible) Set whether this player is invisible to creatures.- Parameters:
invisible-trueif 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:
sendPrivateTextin classRPEntity- Parameters:
text- the message.
-
sendPrivateText
Sends a message that only this entity can read.- Overrides:
sendPrivateTextin classRPEntity- Parameters:
type- NotificationTypetext- The message.headless- Iftrue, does not draw a chat balloon on canvas.
-
sendPrivateText
Sends a message that only this entity can read.- Overrides:
sendPrivateTextin classRPEntity- Parameters:
sender- Name of entity sending message.text- Message contents.
-
sendPrivateText
Sends a message that only this entity can read.- Overrides:
sendPrivateTextin classRPEntity- Parameters:
type- NotificationType.sender- Name of entity sending message.text- Message contents.
-
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:
rememberAttackerin classRPEntity
-
onDead
Description copied from class:RPEntityThis method is called when this entity has been killed (hp == 0). -
dropItemsOn
- Specified by:
dropItemsOnin 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- Quest name.states- Valid states.- Returns:
trueif the quest is in one of theses states,falseotherwise.
-
isQuestInState
Is the named quest in one of the listed states?- Parameters:
name- Quest name.index- Quest index.states- Valid states.- Returns:
trueif the quest is in one of theses states,falseotherwise.
-
hasKilled
Checks if the player has ever killed a creature, with or without the help of any other player.- Parameters:
name- Name of creature to check.- Returns:
trueif 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- Name of creature to check.- Returns:
trueif this player has ever killed this creature without help.
-
setSoloKill
Stores that the player has killed 'name' solo. Overwrites shared kills of 'name'.- Parameters:
name- Name of the victim.
-
setSoloKillCount
Changes solo kills count to specified value.- Parameters:
name- Name of victim.count- Value to set.
-
incSoloKillCount
Increments number of counted solo kills by 1.- Parameters:
name- Name of victim.
-
getSoloKill
Retrieves number of creatures killed alone by this player.- Parameters:
name- Name of victim.- Returns:
- Number of solo kills.
-
getSoloKillCount
Retrieves number of creatures killed alone by this player.- Parameters:
name- Name of victim.- Returns:
- Number of solo kills.
-
getAllKillCount
Retrieves number of creatures kill by this player alone and/or with help from others.- Parameters:
name- Name of victim.- Returns:
- Total number of kills.
-
describe
Description copied from class:EntityDescribes 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:
trueif teleporting was successful.
-
teleport
Teleports player to given destination using zoneid string.- Parameters:
zoneid-Stringname/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:
trueif 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
-
setOriginalOutfit
Sets the player's original outfit. Useful for updating original outfit information while wearing a temporary outfit.- Parameters:
outfit- The new outfit.colors- New outfit colors.
-
setOriginalOutfit
Sets the player's original outfit. Useful for updating original outfit information while wearing a temporary outfit.- Parameters:
outfit- The new outfit.
-
setOriginalOutfit
Sets the player's original outfit. Useful for updating original outfit information while wearing a temporary outfit.- Parameters:
outfit- The new outfit string representation.colors- New outfit colors string representation.
-
setOriginalOutfit
Sets the player's original outfit. Useful for updating original outfit information while wearing a temporary outfit.- Parameters:
outfit- The new outfit string representation.
-
setTemporaryOutfit
Use this method to add a new temporary outfit or override an old one.- Parameters:
outfit- The temporary outfit to be worn.expireAge- Player age when outfit will expire.clearColors- Should layer color information be forgotten? (default: true)
-
setTemporaryOutfit
Use this method to add a new temporary outfit or override an old one.- Parameters:
outfit- The temporary outfit to be worn.expireAge- Player age when outfit will expire.
-
setTemporaryOutfit
Use this method to add a new temporary outfit or override an old one.- Parameters:
outfit- Temporary outfit string representation.expireAge- Player age when outfit will expire.clearColors- Should layer color information be forgotten? (default: true);
-
setTemporaryOutfit
Use this method to add a new temporary outfit or override an old one. Layer color information is removed.- Parameters:
outfit- Temporary outfit string representation.expireAge- Player age when outfit will expire.
-
setPerpetualOutfitLayer
Sets a layer for both the player's original & temporary outfits without changing temporary expiration.- Parameters:
layer- Layer name.index- Index to set layer to.
-
setPerpetualOutfitColor
Sets a layer color for both the player's original & temporary outfits.- Parameters:
layer- Layer name.color- New color.
-
setPerpetualOutfitColor
Sets a layer color for both the player's original & temporary outfits.- Parameters:
layer- Layer name.color- New color.
-
outfitIsTemporary
public boolean outfitIsTemporary()Checks if entity is wearnig a temporary outfit.- Returns:
- True if the entiry has stored an original outfit.
-
registerOutfitExpireTime
public void registerOutfitExpireTime(int expire) sets the time a outfit wears off- Parameters:
expire- expire age
-
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:
isZoneChangeAllowedin classActiveEntity- Returns:
trueif the entity can change zones.
-
logic
public void logic()Perform cycle logic.- Specified by:
logicin classDressedEntity
-
isGhost
public boolean isGhost()Checks whether an entity is a ghost (non physically interactive).- Overrides:
isGhostin classActiveEntity- Returns:
trueif in ghost mode.
-
setGhost
public void setGhost(boolean ghost) Set whether this player is a ghost (invisible/non-interactive).- Parameters:
ghost-trueif a ghost.
-
isTeleclickEnabled
public boolean isTeleclickEnabled()Checks whether a player has teleclick enabled.- Returns:
trueif teleclick is enabled.
-
setTeleclickEnabled
public void setTeleclickEnabled(boolean teleclick) Set whether this player has teleclick enabled.- Parameters:
teleclick-trueif 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:RPObjectReturns true if two objects are exactly equal -
toString
Description copied from class:RPObjectThis 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-trueif looking only for matching name instead of both name and type.- Returns:
- the found pet
-
handleObjectCollision
protected void handleObjectCollision()- Overrides:
handleObjectCollisionin 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:RPEntityGives XP to every player who has helped killing this RPEntity.- Overrides:
rewardKillersin 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:RPEntityGet the type of the damage this entity inflicts- Overrides:
getDamageTypein classRPEntity- Returns:
- type of damage
-
getSusceptibility
Description copied from class:RPEntityGet a multiplier for a given damage type when this entity is damaged.- Overrides:
getSusceptibilityin 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:
setDefInternalin classRPEntity
-
setAtkInternal
protected void setAtkInternal(int atk, boolean notify) - Overrides:
setAtkInternalin classRPEntity
-
setRatkInternal
protected void setRatkInternal(int ratk, boolean notify) Description copied from class:RPEntitySet the entity's ranged attack level.- Overrides:
setRatkInternalin 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:
zoneName- String name of the zone to check for.- Returns:
trueif player visited the zone.
-
hasVisitedZone
Checks if the player has visited the given zone.- Parameters:
zone- The zone to check for.- Returns:
trueif 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
nullif 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
-
getQuantityOfSownItems
Retrieve the amount of items sown by player.- Parameters:
item- Item Name.- Returns:
- Integer sown quanity.
-
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-
-
incSownForItem
Increses the quanity an item was sown by player.- Parameters:
item- Item name.count- Increment amount.
-
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-truemeans player is selling to NPC,falseplayer 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:
handleLeaveZonein 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:
getLanguagein 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:
onUsedin interfaceUseListener- Parameters:
user- the RPEntity who uses the object- Returns:
- true if successful
-
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:
getCappedAtkin 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:
getCappedDefin 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:
getCappedRatkin classRPEntity- Returns:
- capped ratk
-
handleSimpleCollision
protected void handleSimpleCollision(int nx, int ny) Collision handling instructions for players.- Overrides:
handleSimpleCollisionin 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
-
calculateRiskForCanHit
protected int calculateRiskForCanHit(int roll, int defenderDEF, int attackerATK) This handicap increases chance that a player can hit an enemy to make the game feel more fair. Hit chance is based on raw atk stat, which is much higher for creatues. In order to avoid drastic changes to the game's balance, we also need to reduce the amount of damage done by players. See: Player.damageDone.- Overrides:
calculateRiskForCanHitin classRPEntity
-
damageDone
This is overridden to reduce damage done by players to creatures to make up for the increased hit chance.- Overrides:
damageDonein classRPEntity- Parameters:
defender- The defender.attackingWeaponsValue- ATK-value of all attacking weapons/spellsdamageType- nature of damage- Returns:
- The number of hitpoints that the target should lose. 0 if the attack was completely blocked by the defender.
-