From: Kimmo R. <ki...@us...> - 2013-05-29 17:06:12
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/quests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1486/src/games/stendhal/server/maps/quests Modified Files: RestockFlowerShop.java Log Message: Removed write to a static field. Fixed initialization when only some maps are loaded Index: RestockFlowerShop.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/quests/RestockFlowerShop.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** RestockFlowerShop.java 28 May 2013 00:04:33 -0000 1.26 --- RestockFlowerShop.java 29 May 2013 17:06:08 -0000 1.27 *************** *** 73,77 **** */ public class RestockFlowerShop extends AbstractQuest { - public static final String QUEST_SLOT = "restock_flowershop"; --- 73,76 ---- *************** *** 81,89 **** public static List<Integer> requestedQuantities = Arrays.asList(); ! private int MAX_FLOWERS = flowerTypes.size() * 10; ! ! private static String requestedFlowers; ! private static int REQ_WATER = 15; // Time player must wait to repeat quest (3 days) --- 80,86 ---- public static List<Integer> requestedQuantities = Arrays.asList(); ! private final int MAX_FLOWERS = flowerTypes.size() * 10; ! private static final int REQ_WATER = 15; // Time player must wait to repeat quest (3 days) *************** *** 92,108 **** // Quest NPC private final SpeakerNPC npc = npcs.get("Seremela"); - private String npcName = npc.getName(); @Override public List<String> getHistory(final Player player) { final List<String> res = new ArrayList<String>(); - String questState = player.getQuest(QUEST_SLOT); if (!player.hasQuest(QUEST_SLOT)) { return res; } if (player.isQuestInState(QUEST_SLOT, 0, "rejected")) { res.add("Flowers make me sneeze."); ! } ! else if (!player.isQuestInState(QUEST_SLOT, 0, "done")) { res.add("I have offered to help " + npcName + " restock the flower shop."); --- 89,104 ---- // Quest NPC private final SpeakerNPC npc = npcs.get("Seremela"); @Override public List<String> getHistory(final Player player) { final List<String> res = new ArrayList<String>(); if (!player.hasQuest(QUEST_SLOT)) { return res; } + String npcName = npc.getName(); if (player.isQuestInState(QUEST_SLOT, 0, "rejected")) { res.add("Flowers make me sneeze."); ! } else if (!player.isQuestInState(QUEST_SLOT, 0, "done")) { ! String questState = player.getQuest(QUEST_SLOT); res.add("I have offered to help " + npcName + " restock the flower shop."); *************** *** 111,120 **** // Check to avoid ArrayIndexOutOfBoundsException ! if (questState.split(";").length > 0) { ! requestedFlowers = "I still need to bring the following flowers: " + Grammar.enumerateCollection(remaining.toStringList()) + "."; res.add(requestedFlowers); } ! } ! else { if (isRepeatable(player)) { res.add("It has been a while since I helped " + npcName + ". Perhaps she could use my help again."); --- 107,115 ---- // Check to avoid ArrayIndexOutOfBoundsException ! if (remaining.size() > 0) { ! String requestedFlowers = "I still need to bring the following flowers: " + Grammar.enumerateCollection(remaining.toStringList()) + "."; res.add(requestedFlowers); } ! } else { if (isRepeatable(player)) { res.add("It has been a while since I helped " + npcName + ". Perhaps she could use my help again."); |