From: Hendrik <nh...@us...> - 2008-08-14 19:51:01
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/quests/mithrilcloak In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv6409/src/games/stendhal/server/maps/quests/mithrilcloak Modified Files: GettingTools.java TwilightZone.java Log Message: moved TextHasNumberCondition out of GettingTools and TwilightZone into its own toplevel class Index: GettingTools.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/quests/mithrilcloak/GettingTools.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GettingTools.java 14 Aug 2008 16:37:56 -0000 1.6 --- GettingTools.java 14 Aug 2008 19:51:08 -0000 1.7 *************** *** 6,10 **** import games.stendhal.server.entity.item.Item; import games.stendhal.server.entity.npc.ChatAction; - import games.stendhal.server.entity.npc.ChatCondition; import games.stendhal.server.entity.npc.ConversationPhrases; import games.stendhal.server.entity.npc.ConversationStates; --- 6,9 ---- *************** *** 22,29 **** import games.stendhal.server.entity.npc.condition.QuestInStateCondition; import games.stendhal.server.entity.npc.condition.QuestStateStartsWithCondition; import games.stendhal.server.entity.npc.parser.ConvCtxForMatchingSource; import games.stendhal.server.entity.npc.parser.ConversationContext; import games.stendhal.server.entity.npc.parser.ConversationParser; - import games.stendhal.server.entity.npc.parser.Expression; import games.stendhal.server.entity.npc.parser.JokerExprMatcher; import games.stendhal.server.entity.npc.parser.Sentence; --- 21,28 ---- import games.stendhal.server.entity.npc.condition.QuestInStateCondition; import games.stendhal.server.entity.npc.condition.QuestStateStartsWithCondition; + import games.stendhal.server.entity.npc.condition.TextHasNumberCondition; import games.stendhal.server.entity.npc.parser.ConvCtxForMatchingSource; import games.stendhal.server.entity.npc.parser.ConversationContext; import games.stendhal.server.entity.npc.parser.ConversationParser; import games.stendhal.server.entity.npc.parser.JokerExprMatcher; import games.stendhal.server.entity.npc.parser.Sentence; *************** *** 179,198 **** // match for all numbers as trigger expression "NUM", new JokerExprMatcher(), ! new ChatCondition() { ! public boolean fire(final Player player, final Sentence sentence, final SpeakerNPC npc) { ! final Expression number = sentence.getNumeral(); ! ! if (number != null) { ! final int required = number.getAmount(); ! ! // don't let them buy less than 1 or more than, say, 5000 ! if ((required >= 1) && (required <= 5000)) { ! return true; ! } ! } ! ! return false; ! } ! }, ConversationStates.ATTENDING, null, new ChatAction() { public void fire(final Player player, final Sentence sentence, final SpeakerNPC npc) { --- 178,183 ---- // match for all numbers as trigger expression "NUM", new JokerExprMatcher(), ! new TextHasNumberCondition(1, 5000), ! ConversationStates.ATTENDING, null, new ChatAction() { public void fire(final Player player, final Sentence sentence, final SpeakerNPC npc) { Index: TwilightZone.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/maps/quests/mithrilcloak/TwilightZone.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TwilightZone.java 14 Aug 2008 16:37:56 -0000 1.5 --- TwilightZone.java 14 Aug 2008 19:51:08 -0000 1.6 *************** *** 4,8 **** import games.stendhal.server.core.engine.SingletonRepository; import games.stendhal.server.entity.npc.ChatAction; - import games.stendhal.server.entity.npc.ChatCondition; import games.stendhal.server.entity.npc.ConversationPhrases; import games.stendhal.server.entity.npc.ConversationStates; --- 4,7 ---- *************** *** 18,22 **** import games.stendhal.server.entity.npc.condition.PlayerHasItemWithHimCondition; import games.stendhal.server.entity.npc.condition.QuestInStateCondition; ! import games.stendhal.server.entity.npc.parser.Expression; import games.stendhal.server.entity.npc.parser.JokerExprMatcher; import games.stendhal.server.entity.npc.parser.Sentence; --- 17,21 ---- import games.stendhal.server.entity.npc.condition.PlayerHasItemWithHimCondition; import games.stendhal.server.entity.npc.condition.QuestInStateCondition; ! import games.stendhal.server.entity.npc.condition.TextHasNumberCondition; import games.stendhal.server.entity.npc.parser.JokerExprMatcher; import games.stendhal.server.entity.npc.parser.Sentence; *************** *** 62,81 **** // match for all numbers as trigger expression "NUM", new JokerExprMatcher(), ! new ChatCondition() { ! public boolean fire(final Player player, final Sentence sentence, final SpeakerNPC npc) { ! final Expression number = sentence.getNumeral(); ! ! if (number != null) { ! final int required = number.getAmount(); ! ! // don't let them buy less than 1 or more than, say, 5000 ! if ((required >= 1) && (required <= 5000)) { ! return true; ! } ! } ! ! return false; ! } ! }, ConversationStates.ATTENDING, null, new ChatAction() { public void fire(final Player player, final Sentence sentence, final SpeakerNPC npc) { --- 61,66 ---- // match for all numbers as trigger expression "NUM", new JokerExprMatcher(), ! new TextHasNumberCondition(1, 5000), ! ConversationStates.ATTENDING, null, new ChatAction() { public void fire(final Player player, final Sentence sentence, final SpeakerNPC npc) { |