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
ConstructorDescriptionRepairerBehaviour(PriceCalculationStrategy calculator, Set<String> items)
Create a new RepairerBehaviour with a given price calculation strategy -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDealWith(String chosen)
Check if this NPC can repair this itemint
Calculate 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 allboolean
transactAgreedDeal(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:TransactionBehaviour
Transacts the deal that is described in BehaviourResult.- Specified by:
transactAgreedDeal
in 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:Behaviour
a chat condition that checks whether transactions are possible at all- Overrides:
getTransactionCondition
in classBehaviour
- Returns:
- ChatCondition
-
getRejectedTransactionAction
Description copied from class:Behaviour
a chat action that is executed in case transaction are not possible- Overrides:
getRejectedTransactionAction
in 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
-