Class RepairerBehaviour


public class RepairerBehaviour extends TransactionBehaviour
Behaviour for NPCs repairing items
Author:
madmetzger
  • Constructor Details

    • RepairerBehaviour

      public RepairerBehaviour(PriceCalculationStrategy calculator, Set<String> items)
      Create a new RepairerBehaviour with a given price calculation strategy
      Parameters:
      calculator - the price calculator
      items - the items that can be repaired
  • Method Details

    • transactAgreedDeal

      public boolean transactAgreedDeal(ItemParserResult res, EventRaiser seller, Player player)
      Description copied from class: TransactionBehaviour
      Transacts the deal that is described in BehaviourResult.
      Specified by:
      transactAgreedDeal in class TransactionBehaviour
      Parameters:
      res - result of the Behaviour parsing
      seller - The NPC who sells/buys
      player - The player who buys/sells
      Returns:
      true if the transaction was successful.
    • getTransactionCondition

      public ChatCondition getTransactionCondition()
      Description copied from class: Behaviour
      a chat condition that checks whether transactions are possible at all
      Overrides:
      getTransactionCondition in class Behaviour
      Returns:
      ChatCondition
    • getRejectedTransactionAction

      public ChatAction getRejectedTransactionAction()
      Description copied from class: Behaviour
      a chat action that is executed in case transaction are not possible
      Overrides:
      getRejectedTransactionAction in class Behaviour
      Returns:
      ChatAction
    • getPrice

      public int getPrice(String item, Player player)
      Calculate the price for the given item
      Parameters:
      item - the item to repair
      player - the player wanting to repair
      Returns:
      the price for the player
    • canDealWith

      public boolean canDealWith(String chosen)
      Check if this NPC can repair this item
      Parameters:
      chosen - the item to repair
      Returns:
      true iff this NPC is able to repair the item