From: Martin F. <mar...@us...> - 2011-01-07 01:23:12
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/wofol/bar In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1406/src/games/stendhal/server/maps/wofol/bar Modified Files: KoboldBarmaidNPC.java Log Message: introduce BehaviourResult to split Behaviour definition and parse result Index: KoboldBarmaidNPC.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/wofol/bar/KoboldBarmaidNPC.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** KoboldBarmaidNPC.java 27 Nov 2010 21:25:46 -0000 1.13 --- KoboldBarmaidNPC.java 7 Jan 2011 01:22:33 -0000 1.14 *************** *** 22,25 **** --- 22,26 ---- import games.stendhal.server.entity.npc.SpeakerNPC; import games.stendhal.server.entity.npc.behaviour.adder.SellerAdder; + import games.stendhal.server.entity.npc.behaviour.impl.BehaviourResult; import games.stendhal.server.entity.npc.behaviour.impl.SellerBehaviour; import games.stendhal.server.entity.player.Player; *************** *** 83,88 **** */ @Override ! public boolean transactAgreedDeal(final EventRaiser seller, final Player player) { final Item item = getAskedItem(chosenItemName); String requiredContainer = ""; --- 84,91 ---- */ @Override ! public boolean transactAgreedDeal(BehaviourResult res, final EventRaiser seller, final Player player) { ! String chosenItemName = res.getChosenItemName(); final Item item = getAskedItem(chosenItemName); + int amount = res.getAmount(); String requiredContainer = ""; *************** *** 93,97 **** } ! int price = getCharge(player); if (player.isBadBoy()) { price = (int) (BAD_BOY_BUYING_PENALTY * price); --- 96,100 ---- } ! int price = getCharge(res, player); if (player.isBadBoy()) { price = (int) (BAD_BOY_BUYING_PENALTY * price); *************** *** 99,112 **** if ("slim bottle".equals(requiredContainer) || "eared bottle".equals(requiredContainer)) { ! if (!player.isEquipped(requiredContainer, getAmount()) || !player.isEquipped("money", price)) { seller.say("Wrauff! I can only sell you " ! + Grammar.plnoun(getAmount(), getChosenItemName()) ! + " if you meet the price of " + price + " and have " + getAmount() + " empty " ! + Grammar.plnoun(getAmount(), requiredContainer) + "."); return false; } } else if (!player.isEquipped("money", price)) { seller.say("Wruff! I can only sell you " ! + Grammar.plnoun(getAmount(), getChosenItemName()) + " if you have enough money."); return false; --- 102,115 ---- if ("slim bottle".equals(requiredContainer) || "eared bottle".equals(requiredContainer)) { ! if (!player.isEquipped(requiredContainer, amount) || !player.isEquipped("money", price)) { seller.say("Wrauff! I can only sell you " ! + Grammar.plnoun(amount, chosenItemName) ! + " if you meet the price of " + price + " and have " + amount + " empty " ! + Grammar.plnoun(amount, requiredContainer) + "."); return false; } } else if (!player.isEquipped("money", price)) { seller.say("Wruff! I can only sell you " ! + Grammar.plnoun(amount, chosenItemName) + " if you have enough money."); return false; *************** *** 118,124 **** */ if (item instanceof StackableItem) { ! ((StackableItem) item).setQuantity(getAmount()); } else { ! setAmount(1); } --- 121,127 ---- */ if (item instanceof StackableItem) { ! ((StackableItem) item).setQuantity(amount); } else { ! res.setAmount(1); } *************** *** 126,138 **** player.drop("money", price); if (!"".equals(requiredContainer)) { ! player.drop(requiredContainer, getAmount()); } seller.say("Wroff! Here " ! + Grammar.isare(getAmount()) + " your " ! + Grammar.plnoun(getAmount(), getChosenItemName()) + "!"); return true; } else { seller.say("Wruff.. You cannot carry any " ! + Grammar.plnoun(getAmount(), getChosenItemName()) + " in your bag now."); return false; --- 129,141 ---- player.drop("money", price); if (!"".equals(requiredContainer)) { ! player.drop(requiredContainer, amount); } seller.say("Wroff! Here " ! + Grammar.isare(amount) + " your " ! + Grammar.plnoun(amount, chosenItemName) + "!"); return true; } else { seller.say("Wruff.. You cannot carry any " ! + Grammar.plnoun(amount, chosenItemName) + " in your bag now."); return false; |