Class Offer

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

public class Offer extends Entity implements Dateable
Represents an Offer for sale in the Market
Author:
madmetzger
  • Field Details

    • OFFER_ITEM_SLOT_NAME

      public static final String OFFER_ITEM_SLOT_NAME
      The name of the slot where the item for sale is stored
      See Also:
      Constant Field Values
    • OFFER_RPCLASS_NAME

      public static final String OFFER_RPCLASS_NAME
      The RPClass name of an Offer
      See Also:
      Constant Field Values
  • Constructor Details

    • Offer

      public Offer(Item item, Integer price, Player offerer)
      Create a new Offer.
      Parameters:
      item - offered item
      price - price of the item
      offerer - player making the offer
    • Offer

      public Offer(RPObject object)
      Creates an Offer from a RPObject
      Parameters:
      object -
  • Method Details

    • generateRPClass

      public static void generateRPClass()
    • getItem

      public final Item getItem()
      Returns:
      the Item for sale
    • hasItem

      public boolean hasItem()
      checks if an item is attached to this offer.
      Returns:
      true, if this offer has an item
    • getItemName

      public String getItemName()
      gets the name of the item
      Returns:
      name of item or "null", if there is no item in this offer
    • getPrice

      public final Integer getPrice()
      Returns:
      the price to pay for this offer when accepting it
    • getOfferer

      public final String getOfferer()
      Returns:
      the name of the offering player
    • getTimestamp

      public long getTimestamp()
      Get the creation or renewal time of the offer.
      Specified by:
      getTimestamp in interface Dateable
      Returns:
      Timestamp in milliseconds
    • updateTimestamp

      public void updateTimestamp()
      Update the timestamp of the offer to the current moment.
    • shouldReward

      public boolean shouldReward(Player player)
      Check whether accepting this offer should be rewarder in trade score.
      Parameters:
      player - The player accepting the offer
      Returns:
      True iff the accepting the offer should be rewarded