Class Person

Object
Person

public class Person extends Object
Scripting entity called Person.
Author:
maartenl
See Also:
  • Constructor Details

    • Person

      public Person(Person person)
      Constructor
      Parameters:
      person - the original object to redirect calls to.
  • Method Details

    • getSex

      public String getSex()
    • getName

      public String getName()
    • getRoom

      public Room getRoom()
    • setRoom

      public void setRoom(Room room)
    • getGuild

      public String getGuild()
      Returns the guildname (not the full title!) of the guild. For example the guild Benefactors of Karchan will yield guildname "deputy".
      Returns:
      The guildname.
    • getMoney

      public Integer getMoney()
      Returns:
      See Also:
    • transferMoney

      public boolean transferMoney(Integer newamount, Person target)
      Transfers money from one person (this one) to another.
      Parameters:
      newamount - the amount of copper (base currency to move)
      target - the target that is to receive said money
      Returns:
      boolean, false if the money amount is illegal, or the person simply does not have that much money.
    • personal

      public void personal(String string)
    • sendMessage

      public void sendMessage(Person toperson, String message)
      Parameters:
      toperson - the person to send the message to. (Anyone else can listen).
      message -
      See Also:
      • invalid reference
        mmud.database.entities.game.Room#sendMessageExcl(mmud.database.entities.characters.Person, mmud.database.entities.characters.Person, java.lang.String)
    • sendMessage

      public void sendMessage(String message)
      Parameters:
      message -
      See Also:
      • invalid reference
        mmud.database.entities.game.Room#sendMessage(java.lang.String)
    • sendMessageExcl

      public void sendMessageExcl(String message)
      Sends a message in the room, but not to myself.
      Parameters:
      message -
      See Also:
      • invalid reference
        mmud.database.entities.game.Room#sendMessageExcl(mmud.database.entities.characters.Person, java.lang.String)
    • sendMessageExcl

      public void sendMessageExcl(Person toperson, String message)
      Sends a message in the room, but not to myself and the target toperson.
      Parameters:
      toperson - the other guy
      message - the message
    • wears

      public Item wears(String position)

      Returns the item that is being worn at that position. Returns null if nothing is being worn at that position.

      For example:

                     wears("ON_HEAD") can return item "crown". The ON_HEAD is straight from Wearing.ON_HEAD.

      Parameters:
      position - a String
      Returns:
      an Item or null if nothing is worn.
      See Also:
    • wields

      public Item wields(String position)

      Returns the item that is being wielded at that position. Returns null if nothing is being wielded at that position.

      For example:

                     wields("WIELD_LEFT") can return item "strong, iron pick". The WIELD_LEFT is straight from Wielding.WIELD_LEFT.

      Parameters:
      position - a String
      Returns:
      an Item or null if nothing is being wielded.
      See Also:
    • getAttribute

      public String getAttribute(String name)
    • setAttribute

      public void setAttribute(String name, String value)
    • isAttribute

      public boolean isAttribute(String name)
    • removeAttribute

      public boolean removeAttribute(String name)
    • addItem

      public Item addItem(Item item)
      Adds a new item to the inventory of this person. With new it is understood that the item was created with a call to Items.createItem(int), and is not yet allocated to a room, person or container.
      Parameters:
      item - the new item to add.
      Returns:
      the exact same item, or null if unable to comply.
    • findItems

      public Item[] findItems(List<String> parsed)
      Returns items in the inventory of this character, based on description provided.
      Parameters:
      parsed - the parsed description of the item, for example {"light-green", "leather", "pants"}.
      Returns:
      list of found items, empty if not found.
    • removeItem

      public void removeItem(Item item)
      Actually destroys an item from the inventory of this person.
      Parameters:
      item - the new item to destroy.
    • inventory

      public Item[] inventory()