Class Player

All Implemented Interfaces:
UseListener, Killer, Cloneable, Iterable<String>, Serializable

public class Player extends DressedEntity implements UseListener
  • Constructor Details

    • Player

      public Player(RPObject object)
  • Method Details

    • generateRPClass

      public static void generateRPClass()
    • createZeroLevelPlayer

      public static Player createZeroLevelPlayer(String characterName, RPObject template)
    • destroy

      public static void destroy(Player player)
    • addClientDirection

      public void addClientDirection(Direction direction)
      Add an active client direction.
      Parameters:
      direction - direction
    • removeClientDirection

      public void removeClientDirection(Direction direction)
      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 if true.
    • isObstacle

      public boolean isObstacle(Entity entity)
      Description copied from class: Entity
      Determine if this is an obstacle for another entity.
      Overrides:
      isObstacle in class Entity
      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 class GuidedEntity
    • forceStop

      public void forceStop()
      Forces player to stop moving, bypassing auto-walk
    • getAwayMessage

      public String getAwayMessage()
      Get the away message.
      Returns:
      The away message, or null if unset.
    • setAwayMessage

      public void setAwayMessage(String message)
      Set the away message.
      Parameters:
      message - An away message, or null.
    • getGrumpyMessage

      public String getGrumpyMessage()
      Get the grumpy message.
      Returns:
      The grumpy message, or null if unset.
    • setGrumpyMessage

      public void setGrumpyMessage(String message)
      Set the grumpy message.
      Parameters:
      message - A grumpy message, or null.
    • addKarma

      public void addKarma(double karmaToAdd)
      Give the player some karma (good or bad).
      Overrides:
      addKarma in class RPEntity
      Parameters:
      karmaToAdd - An amount of karma to add/subtract.
    • getKarma

      public double getKarma()
      Get the current amount of karma.
      Overrides:
      getKarma in class RPEntity
      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.
      Overrides:
      useKarma in class RPEntity
      Parameters:
      scale - A positive number.
      Returns:
      A number between -scale and scale.
    • 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 is 0.01 (%1 unit).
      Overrides:
      useKarma in class RPEntity
      Parameters:
      negLimit - The lowest negative value returned.
      posLimit - The highest positive value returned.
      Returns:
      A number within negLimit <= 0 <= posLimit.
    • 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.
      Overrides:
      useKarma in class RPEntity
      Parameters:
      negLimit - The lowest negative value returned.
      posLimit - The highest positive value returned.
      granularity - The amount that any extracted karma is a multiple of.
      Returns:
      A number within negLimit <= 0 <= posLimit.
    • incrementTradescore

      public void incrementTradescore()
      increments the number of successful trades by 1
    • getTradescore

      public int getTradescore()
    • getUnlockedPortals

      public List<Integer> 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.
      Overrides:
      update in class RPEntity
    • addIgnore

      public boolean addIgnore(String name, int duration, String reply)
      Add a player ignore entry.
      Parameters:
      name - The player name.
      duration - The ignore duration (in minutes), or 0 for infinite.
      reply - The reply.
      Returns:
      true if value changed, false if there was a problem.
    • getIgnore

      public String getIgnore(String name)
      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

      public boolean removeIgnore(String name)
      Remove a player ignore entry.
      Parameters:
      name - The player name.
      Returns:
      true if value changed, false if there was a problem.
    • getIgnores

      public Set<String> getIgnores()
      Returns:
      all buddy names for this player
    • getSkill

      public String getSkill(String key)
      Get a named skills value.
      Parameters:
      key - The skill key.
      Returns:
      The skill value, or null if not set.
    • getMagicSkillXp

      public int getMagicSkillXp(Nature nature)
      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

      public void increaseMagicSkillXp(Nature nature, int amount)
      Increase the skill points for a magic nature by a given amount
      Parameters:
      nature -
      amount -
    • setSkill

      public boolean setSkill(String key, String value)
      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

      public String getKeyedSlot(String name, String key)
      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

      public boolean setKeyedSlot(String name, String key, String value)
      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 if null).
      Returns:
      true if value changed, false if there was a problem.
    • hasFeature

      public boolean hasFeature(String name)
      Checks if player has a feature.
      Parameters:
      name - The feature mnemonic.
      Returns:
      true if the feature value is not null.
    • getFeature

      public String getFeature(String name)
      Get a client feature value.
      Parameters:
      name - The feature mnemonic.
      Returns:
      The feature value, or null is not-enabled.
    • setFeature

      public void setFeature(String name, boolean enabled)
      Enable/disable a client feature.
      Parameters:
      name - The feature mnemonic.
      enabled - Flag indicating if enabled.
    • setFeature

      public void setFeature(String name, String value)
      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, or null to disable.
    • unsetFeature

      public void unsetFeature(String name)
      Unset a client feature
      Parameters:
      name - The feature mnemonic
    • isInvisibleToCreatures

      public boolean isInvisibleToCreatures()
      Determine if the entity is invisible to creatures.
      Overrides:
      isInvisibleToCreatures in class RPEntity
      Returns:
      true if invisible.
    • setInvisible

      public void setInvisible(boolean invisible)
      Set whether this player is invisible to creatures.
      Parameters:
      invisible - true if invisible.
    • sendPrivateText

      public void sendPrivateText(String text)
      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 class RPEntity
      Parameters:
      text - the message.
    • sendPrivateText

      public void sendPrivateText(NotificationType type, String text)
      Sends a message that only this entity can read.
      Overrides:
      sendPrivateText in class RPEntity
      Parameters:
      type - NotificationType
      text - The message.
      headless - If true, does not draw a chat balloon on canvas.
    • setLastPrivateChatter

      public void setLastPrivateChatter(String lastPrivateChatterName)
      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

      public String 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

      public void rememberAttacker(Entity attacker)
      Overrides:
      rememberAttacker in class RPEntity
    • onDead

      public void onDead(Killer killer, boolean remove)
      Description copied from class: RPEntity
      This method is called when this entity has been killed (hp == 0).
      Overrides:
      onDead in class RPEntity
      Parameters:
      killer - The entity who caused the death, i.e. who did the last hit.
      remove - true iff this entity should be removed from the world. For almost everything remove is true, but not for the players, who are instead moved to afterlife ("reborn").
    • dropItemsOn

      protected void dropItemsOn(Corpse corpse)
      Specified by:
      dropItemsOn in class DressedEntity
    • removeSheep

      public void removeSheep(Sheep sheep)
    • removePet

      public void removePet(Pet pet)
    • hasSheep

      public boolean hasSheep()
    • hasPet

      public boolean hasPet()
    • setPet

      public void setPet(Pet pet)
      Set the player's pet. This will also set the pet's owner.
      Parameters:
      pet - The pet.
    • setSheep

      public void setSheep(Sheep sheep)
      Set the player's sheep. This will also set the sheep's owner.
      Parameters:
      sheep - The sheep.
    • getSheep

      public Sheep getSheep()
      Get the player's sheep.
      Returns:
      The sheep.
    • getPet

      public Pet 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

      public void notifyOnline(String who)
      Notifies this player that the given player has logged in.
      Parameters:
      who - The name of the player who has logged in.
    • notifyOffline

      public void notifyOffline(String who)
      Notifies this player that the given player has logged out.
      Parameters:
      who - The name of the player who has logged out.
    • setBuddyOnlineStatus

      public void setBuddyOnlineStatus(String buddyName, boolean isOnline)
      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

      public Set<String> getBuddies()
      Returns:
      all buddy names for this player
    • countBuddies

      public int countBuddies()
    • isQuestCompleted

      public boolean isQuestCompleted(String name)
      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

      public boolean hasQuest(String name)
      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

      public String getQuest(String name)
      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

      public String getQuest(String name, int index)
      Gets the player's current status in the given quest.
      Parameters:
      name - The quest's name
      index - the index of the sub state to change (separated by ";")
      Returns:
      the player's status in the quest
    • setQuest

      public void setQuest(String name, String status)
      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 name
      status - the player's status in the quest. Set it to null to completely reset the player's status for the quest.
    • setQuest

      public void setQuest(String name, int index, String status)
      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 name
      index - 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

      public List<String> getQuests()
    • removeQuest

      public void removeQuest(String name)
    • isQuestInState

      public boolean isQuestInState(String name, String... states)
      Is the named quest in one of the listed states?
      Parameters:
      name - quest
      states - valid states
      Returns:
      true, if the quest is in one of theses states, false otherwise
    • isQuestInState

      public boolean isQuestInState(String name, int index, String... states)
      Is the named quest in one of the listed states?
      Parameters:
      name - quest
      index - quest index
      states - valid states
      Returns:
      true, if the quest is in one of theses states, false otherwise
    • hasKilled

      public boolean hasKilled(String name)
      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

      public boolean hasKilledSolo(String name)
      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.
    • hasKilledShared

      public boolean hasKilledShared(String name)
      Checks if the player has ever 'shared killed' a creature, i.e. with the help of any other player.
      Parameters:
      name - of the creature to check.
      Returns:
      true iff this player has ever killed this creature in a team.
    • setSoloKill

      public void setSoloKill(String name)
      Stores that the player has killed 'name' solo. Overwrites shared kills of 'name'
      Parameters:
      name - of the victim
    • setSharedKill

      public void setSharedKill(String name)
      Stores that the player has killed 'name' with help of others. Does not overwrite solo kills of 'name'
      Parameters:
      name - of victim
    • setSoloKillCount

      public void setSoloKillCount(String name, int count)
      Changes solo kills count to specified value.
      Parameters:
      name - name of killed entity
      count - value to set
    • setSharedKillCount

      public void setSharedKillCount(String name, int count)
      Changes shared kills count to specified value.
      Parameters:
      name - name of killed entity
      count - value to set
    • getSoloKill

      public int getSoloKill(String name)
      Returns how much the player has killed 'name' solo.
      Parameters:
      name - of the victim
      Returns:
      number of solo kills
    • getSharedKill

      public int getSharedKill(String name)
      Returns how much the player has killed 'name' with help of others.
      Parameters:
      name - of victim
      Returns:
      number of shared kills
    • describe

      public String describe()
      Description copied from class: Entity
      Describes the entity (if a players looks at it).
      Overrides:
      describe in class RPEntity
      Returns:
      description from the players point of view
    • teleport

      public boolean teleport(StendhalRPZone zone, int x, int y, Direction dir, Player teleporter)
      Teleports this player to the given destination.
      Parameters:
      zone - The zone where this player should be teleported to.
      x - The destination's x coordinate
      y - The destination's y coordinate
      dir - The direction in which the player should look after teleporting, or null if the direction shouldn't change
      teleporter - 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

      public boolean teleport(String zoneid, int x, int y, Direction dir, Player teleporter)
      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

      public void onPush(RPEntity entity)
      Called when player push entity. The entity displacement is handled by the action itself.
      Parameters:
      entity -
    • canPush

      public boolean canPush(RPEntity entity)
      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 class ActiveEntity
      Returns:
      true if the entity can change zones.
    • logic

      public void logic()
      Perform cycle logic.
      Specified by:
      logic in class DressedEntity
    • isGhost

      public boolean isGhost()
      Checks whether an entity is a ghost (non physically interactive).
      Overrides:
      isGhost in class ActiveEntity
      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

      public void onAdded(StendhalRPZone zone)
      Called when this object is added to a zone.
      Overrides:
      onAdded in class RPEntity
      Parameters:
      zone - The zone this was added to.
    • onRemoved

      public void onRemoved(StendhalRPZone zone)
      Called when this object is being removed from a zone.
      Overrides:
      onRemoved in class RPEntity
      Parameters:
      zone - The zone this will be removed from.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class RPObject
    • equals

      public boolean equals(Object obj)
      Description copied from class: RPObject
      Returns true if two objects are exactly equal
      Overrides:
      equals in class RPObject
      Parameters:
      obj - the object to compare with this one.
      Returns:
      true if they are equal, or false otherwise.
    • toString

      public String toString()
      Description copied from class: RPObject
      This method returns a String that represent the object
      Overrides:
      toString in class RPObject
      Returns:
      a string representing the object.
    • setSentence

      public void setSentence(String sentence)
      sets the player sentence
      Parameters:
      sentence - sentence to store
    • getSentence

      public String 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

      public void setClientVersion(String version)
      sets the client version
      Parameters:
      version -
    • isClientNewerThan

      public boolean isClientNewerThan(String version)
      checks if the client is newer than the requested version
      Parameters:
      version - requested version
      Returns:
      check the client is newer
    • getAllEquippedWorkingRingOfLife

      public List<RingOfLife> getAllEquippedWorkingRingOfLife()
      gets a list of all rings of life that are not broken
      Returns:
      list of rings of life
    • getAnimals

      public List<DomesticAnimal> getAnimals()
      Return a list of all animals associated to this player.
      Returns:
      List of DomesticalAnmial
    • searchAnimal

      public DomesticAnimal searchAnimal(String name, boolean exactly)
      Search for an animal with the given name or type.
      Parameters:
      name - the name or type of the pet to search
      exactly - true if looking only for matching name instead of both name and type.
      Returns:
      the found pet
    • applyDefXP

      protected void applyDefXP(RPEntity entity)
      Overrides:
      applyDefXP in class RPEntity
    • handleObjectCollision

      protected void handleObjectCollision()
      Overrides:
      handleObjectCollision in class GuidedEntity
    • 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 class RPEntity
      Parameters:
      oldXP - The XP that this RPEntity had before being killed.
    • getPetOwner

      public PetOwner getPetOwner()
    • isBoundTo

      public boolean isBoundTo(Item item)
    • getChatBucket

      public PlayerChatBucket getChatBucket()
      gets the PlayerChatBucket
      Returns:
      PlayerChatBucket
    • getDamageType

      public Nature getDamageType()
      Description copied from class: RPEntity
      Get the type of the damage this entity inflicts
      Overrides:
      getDamageType in class RPEntity
      Returns:
      type of damage
    • getSusceptibility

      protected double getSusceptibility(Nature type)
      Description copied from class: RPEntity
      Get a multiplier for a given damage type when this entity is damaged.
      Overrides:
      getSusceptibility in class RPEntity
      Parameters:
      type - Type of the damage
      Returns:
      damage multiplier
    • addBuddy

      public boolean addBuddy(String name, boolean online)
      adds a buddy to the player's buddy list
      Parameters:
      name - the name of the buddy
      online - if the player is online
      Returns:
      true if the buddy has been added
    • removeBuddy

      public boolean removeBuddy(String name)
      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)
      Overrides:
      setLevel in class RPEntity
    • setDefInternal

      protected void setDefInternal(int def, boolean notify)
      Overrides:
      setDefInternal in class RPEntity
    • setAtkInternal

      protected void setAtkInternal(int atk, boolean notify)
      Overrides:
      setAtkInternal in class RPEntity
    • setRatkInternal

      protected void setRatkInternal(int ratk, boolean notify)
      Description copied from class: RPEntity
      Set the entity's ranged attack level.
      Overrides:
      setRatkInternal in class RPEntity
      Parameters:
      ratk - Integer value representing new ranged attack level
      notify - Update stat in real-time
    • addReachedAchievement

      public void addReachedAchievement(String identifier)
      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

      public boolean hasReachedAchievement(String identifier)
      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

      public boolean hasVisitedZone(StendhalRPZone zone)
      Checks if the player has visited the given zone
      Parameters:
      zone - the zone to check for
      Returns:
      true if player visited the zone
    • offerTrade

      public void offerTrade(Player partner)
      offers the other player to start a trading session
      Parameters:
      partner - to offer the trade to
    • getTradeState

      public TradeState getTradeState()
      gets the state of player to player trades
      Returns:
      TradeState
    • getTradePartner

      protected String getTradePartner()
      gets the partner of a player to player trade
      Returns:
      name of partner or null if no trade is ongoing
    • startTrade

      protected void startTrade(Player partner)
      starts a trade with this partner
      Parameters:
      partner - partner to trade with
    • cancelTradeInternally

      public void cancelTradeInternally(String partnerName)
      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

      public int getNumberOfLootsForItem(String item)
      Gets the how often this player has looted the given item
      Parameters:
      item - the item name
      Returns:
      the number of loots from corpses
    • getQuantityOfProducedItems

      public int getQuantityOfProducedItems(String item)
      Gets the amount a player as produced of an item
      Parameters:
      item - the item name
      Returns:
      the produced amount
    • getQuantityOfMinedItems

      public int getQuantityOfMinedItems(String item)
      Gets the amount a player as mined of an item
      Parameters:
      item - the item name
      Returns:
      the mined amount
    • getQuantityOfHarvestedItems

      public int getQuantityOfHarvestedItems(String item)
      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

      public int getQuantityOfBoughtItems(String item)
      Gets the amount of an item bought by player.
      Parameters:
      item - Item name.
      Returns:
      Number bought of the item.
    • getQuantityOfSoldItems

      public int getQuantityOfSoldItems(String item)
      Gets the amount of an item sold by player.
      Parameters:
      item - Item name.
      Returns:
      Number sold of the item.
    • incLootForItem

      public void incLootForItem(String item, int count)
      Increases the count of loots for the given item
      Parameters:
      item - the item name
      count -
    • incProducedForItem

      public void incProducedForItem(String item, int count)
      Increases the count of producings for the given item
      Parameters:
      item - the item name
      count -
    • incObtainedForItem

      public void incObtainedForItem(String name, int quantity)
      Increases the count of obtains from the well for the given item
      Parameters:
      name - the item name
      quantity -
    • incSoldForItem

      public void incSoldForItem(String name, int quantity)
      Increases the count of sales for the given item
      Parameters:
      name - the item name
      quantity -
    • incMinedForItem

      public void incMinedForItem(String name, int quantity)
      Increases the amount of successful minings for the given item
      Parameters:
      name - the item name
      quantity -
    • incHarvestedForItem

      public void incHarvestedForItem(String name, int quantity)
      Increases the amount of successful harvestings for the given item
      Parameters:
      name - the item name
      quantity -
    • incBoughtForItem

      public void incBoughtForItem(String name, int quantity)
      Increases the amount of successful buyings for the given item
      Parameters:
      name - the item name
      quantity -
    • incCommerceTransaction

      public void incCommerceTransaction(String npcName, int price, boolean soldToNPC)
      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

      public int getCommerceTransactionAmount(String npcName, boolean soldToNPC)
    • getRequiredItemName

      public String getRequiredItemName(String questname, int index)
      Gets the recorded item stored in a substate of quest slot
      Parameters:
      questname - The quest's name
      index - the index of the sub state to get (separated by ";")
      Returns:
      the name of the required item (no formatting)
    • getRequiredItemQuantity

      public int getRequiredItemQuantity(String questname, int index)
      Gets the recorded item quantity stored in a substate of quest slot
      Parameters:
      questname - The quest's name
      index - 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 class ActiveEntity
    • getNumberOfRepetitions

      public int getNumberOfRepetitions(String questname, int index)
      Gets the number of repetitions in a substate of quest slot
      Parameters:
      questname - The quest's name
      index - 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

      public String getLanguage()
      gets the language
      Overrides:
      getLanguage in class RPEntity
      Returns:
      language
    • setLanguage

      public void setLanguage(String language)
      sets the language
      Parameters:
      language - language
    • setUseListener

      public void setUseListener(String actionDisplayName, UseListener listener)
      adds a use listener causing the client to add an use action with the specified name
      Parameters:
      actionDisplayName - name of useaction visible in the client
      listener - use event listener
    • getUseListener

      public UseListener 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

      public boolean onUsed(RPEntity user)
      Invoked when the object is used.
      Specified by:
      onUsed in interface UseListener
      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

      public String 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 class RPEntity
      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 class RPEntity
      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 class RPEntity
      Returns:
      capped ratk
    • handleSimpleCollision

      protected void handleSimpleCollision(int nx, int ny)
      Collision handling instructions for players.
      Overrides:
      handleSimpleCollision in class ActiveEntity
      Parameters:
      nx - New horizontal position
      ny - New vertical position
    • getMaxSlotSize

      public int getMaxSlotSize(String slot)
      returns the maximum size of a slot
      Parameters:
      slot - name of slot
      Returns:
      size, or -1 if no maximum is known