Class SellerBehaviour

Direct Known Subclasses:
HealerBehaviour, QuestCompletedSellerBehaviour, SeedSellerBehaviour

public class SellerBehaviour extends MerchantBehaviour
Represents the behaviour of a NPC who is able to sell items to a player.
  • Field Details

    • BAD_BOY_BUYING_PENALTY

      public static final double BAD_BOY_BUYING_PENALTY
      the factor extra that player killers pay for items. should be > 1 always
      See Also:
      Constant Field Values
  • Constructor Details

    • SellerBehaviour

      public SellerBehaviour()
      Creates a new SellerBehaviour with an empty pricelist.
    • SellerBehaviour

      public SellerBehaviour(Map<String,​Integer> priceList)
      Creates a new SellerBehaviour with a pricelist.
      Parameters:
      priceList - list of item names and their prices
  • Method Details

    • transactAgreedDeal

      public boolean transactAgreedDeal(ItemParserResult res, EventRaiser seller, Player player)
      Transacts the sale that has been agreed on earlier via setChosenItem() and setAmount().
      Specified by:
      transactAgreedDeal in class TransactionBehaviour
      Parameters:
      seller - The NPC who sells
      player - The player who buys
      res - result of the Behaviour parsing
      Returns:
      true iff the transaction was successful, that is when the player was able to equip the item(s).
    • getAskedItem

      public Item getAskedItem(String askedItem, Player player)
    • getAskedItem

      public Item getAskedItem(String askedItem)
    • updatePlayerTransactions

      protected void updatePlayerTransactions(Player player, String merchant, ItemParserResult res)
      Updates stored information about Player-NPC commerce transactions.
      Parameters:
      player - Player to be updated.
      merchant - Name of merchant involved in transaction.
      res - Information about the transaction.