Class RepairerBehaviour
java.lang.Object
games.stendhal.common.grammar.ItemParser
games.stendhal.server.entity.npc.behaviour.impl.Behaviour
games.stendhal.server.entity.npc.behaviour.impl.TransactionBehaviour
games.stendhal.server.entity.npc.behaviour.impl.RepairerBehaviour
Behaviour for NPCs repairing items
- Author:
- madmetzger
-
Field Summary
Fields inherited from class games.stendhal.common.grammar.ItemParser
itemNames -
Constructor Summary
ConstructorsConstructorDescriptionRepairerBehaviour(PriceCalculationStrategy calculator, Set<String> items) Create a new RepairerBehaviour with a given price calculation strategy -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDealWith(String chosen) Check if this NPC can repair this itemintCalculate the price for the given itema chat action that is executed in case transaction are not possiblea chat condition that checks whether transactions are possible at allbooleantransactAgreedDeal(ItemParserResult res, EventRaiser seller, Player player) Transacts the deal that is described in BehaviourResult.Methods inherited from class games.stendhal.common.grammar.ItemParser
getErrormessage, getItemNames, parse
-
Constructor Details
-
RepairerBehaviour
Create a new RepairerBehaviour with a given price calculation strategy- Parameters:
calculator- the price calculatoritems- the items that can be repaired
-
-
Method Details
-
transactAgreedDeal
Description copied from class:TransactionBehaviourTransacts the deal that is described in BehaviourResult.- Specified by:
transactAgreedDealin classTransactionBehaviour- Parameters:
res- result of the Behaviour parsingseller- The NPC who sells/buysplayer- The player who buys/sells- Returns:
- true if the transaction was successful.
-
getTransactionCondition
Description copied from class:Behavioura chat condition that checks whether transactions are possible at all- Overrides:
getTransactionConditionin classBehaviour- Returns:
- ChatCondition
-
getRejectedTransactionAction
Description copied from class:Behavioura chat action that is executed in case transaction are not possible- Overrides:
getRejectedTransactionActionin classBehaviour- Returns:
- ChatAction
-
getPrice
Calculate the price for the given item- Parameters:
item- the item to repairplayer- the player wanting to repair- Returns:
- the price for the player
-
canDealWith
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
-