Class SellerBehaviour
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.SellerBehaviour
- Direct Known Subclasses:
HealerBehaviour
,QuestCompletedSellerBehaviour
,SeedSellerBehaviour
Represents the behaviour of a NPC who is able to sell items to a player.
-
Field Summary
Modifier and TypeFieldDescriptionstatic double
the factor extra that player killers pay for items.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
ConstructorDescriptionCreates a new SellerBehaviour with an empty pricelist.SellerBehaviour(Map<String,Integer> priceList)
Creates a new SellerBehaviour with a pricelist. -
Method Summary
Modifier and TypeMethodDescriptiongetAskedItem(String askedItem)
getAskedItem(String askedItem, Player player)
boolean
transactAgreedDeal(ItemParserResult res, EventRaiser seller, Player player)
Transacts the sale that has been agreed on earlier via setChosenItem() and setAmount().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
-
Field Details
-
BAD_BOY_BUYING_PENALTY
public static final double BAD_BOY_BUYING_PENALTYthe 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
Creates a new SellerBehaviour with a pricelist.- Parameters:
priceList
- list of item names and their prices
-
-
Method Details
-
transactAgreedDeal
Transacts the sale that has been agreed on earlier via setChosenItem() and setAmount().- Specified by:
transactAgreedDeal
in classTransactionBehaviour
- Parameters:
seller
- The NPC who sellsplayer
- The player who buysres
- 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
-
getAskedItem
-
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.
-