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
FieldsModifier and TypeFieldDescriptionstatic final doublethe factor extra that player killers pay for items.Fields inherited from class games.stendhal.server.entity.npc.behaviour.impl.MerchantBehaviour
priceCalculatorFields inherited from class games.stendhal.common.grammar.ItemParser
itemNames -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SellerBehaviour with an empty pricelist.SellerBehaviour(Map<String, Integer> priceList) Creates a new SellerBehaviour with a pricelist.SellerBehaviour(Map<String, Integer> priceList, Float priceFactor) Creates a new SellerBehaviour with price list & price factor. -
Method Summary
Modifier and TypeMethodDescriptiongetAskedItem(String askedItem) getAskedItem(String askedItem, Player player) booleantransactAgreedDeal(ItemParserResult res, EventRaiser seller, Player player) Transacts the sale that has been agreed on earlier via setChosenItem() and setAmount().protected voidupdatePlayerTransactions(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
addConditions, dealtItems, getCharge, getItemNames, getUnitPrice, hasItemMethods inherited from class games.stendhal.server.entity.npc.behaviour.impl.Behaviour
getRejectedTransactionAction, getTransactionConditionMethods inherited from class games.stendhal.common.grammar.ItemParser
getErrormessage, 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:
-
-
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
-
SellerBehaviour
Creates a new SellerBehaviour with price list & price factor.- Parameters:
priceList- List of item names and their prices.priceFactor- Skews prices of all items for this merchant.
-
-
Method Details
-
transactAgreedDeal
Transacts the sale that has been agreed on earlier via setChosenItem() and setAmount().- Specified by:
transactAgreedDealin 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.
-