Class BuyerBehaviour
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.MerchantBehaviour
games.stendhal.server.entity.npc.behaviour.impl.BuyerBehaviour
- Direct Known Subclasses:
QuestCompletedBuyerBehaviour
Represents the behaviour of a NPC who is able to buy items from a player.
-
Field Summary
Fields inherited from class games.stendhal.server.entity.npc.behaviour.impl.MerchantBehaviour
priceCalculator
Fields inherited from class games.stendhal.common.grammar.ItemParser
itemNames
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
payPlayer(ItemParserResult res, Player player)
Gives the money for the deal to the player.boolean
transactAgreedDeal(ItemParserResult res, EventRaiser seller, Player player)
Transacts the deal that is described in BehaviourResult.protected void
updatePlayerTransactions(Player player, String merchant, ItemParserResult res)
Updates stored information about Player-NPC commerce transactions.Methods inherited from class games.stendhal.server.entity.npc.behaviour.impl.MerchantBehaviour
dealtItems, getCharge, getUnitPrice, hasItem
Methods inherited from class games.stendhal.server.entity.npc.behaviour.impl.Behaviour
getRejectedTransactionAction, getTransactionCondition
Methods inherited from class games.stendhal.common.grammar.ItemParser
getErrormessage, getItemNames, parse
-
Constructor Details
-
BuyerBehaviour
-
-
Method Details
-
payPlayer
Gives the money for the deal to the player. If the player can't carry the money, puts it on the ground.- Parameters:
res
-player
- The player who sells
-
transactAgreedDeal
Transacts the deal that is described in BehaviourResult.- Specified by:
transactAgreedDeal
in classTransactionBehaviour
- Parameters:
seller
- The NPC who buysplayer
- The player who sellsres
- result of the Behaviour parsing- Returns:
- true iff the transaction was successful, that is when the player has the item(s).
-
updatePlayerTransactions
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.
-