From: Hendrik B. <nh...@us...> - 2013-09-28 07:31:00
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/npc/condition In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20211/src/games/stendhal/server/entity/npc/condition Modified Files: QuestSmallerThanCondition.java Log Message: QuestSmallerThanCondition may optionally accept an empty quest slot Index: QuestSmallerThanCondition.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/npc/condition/QuestSmallerThanCondition.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** QuestSmallerThanCondition.java 25 Apr 2013 20:47:09 -0000 1.9 --- QuestSmallerThanCondition.java 28 Sep 2013 07:30:56 -0000 1.10 *************** *** 32,35 **** --- 32,36 ---- private final int index; private final int state; + private boolean acceptEmpty; /** *************** *** 37,41 **** * * @param questname name of quest-slot ! * @param state state */ public QuestSmallerThanCondition(final String questname, final int state) { --- 38,42 ---- * * @param questname name of quest-slot ! * @param state constant value to compare to */ public QuestSmallerThanCondition(final String questname, final int state) { *************** *** 43,49 **** this.index = -1; this.state = state; } - /** * Creates a new QuestSmallerThanCondition. --- 44,50 ---- this.index = -1; this.state = state; + this.acceptEmpty = false; } /** * Creates a new QuestSmallerThanCondition. *************** *** 51,55 **** * @param questname name of quest-slot * @param index index of sub state ! * @param state state */ public QuestSmallerThanCondition(final String questname, final int index, final int state) { --- 52,56 ---- * @param questname name of quest-slot * @param index index of sub state ! * @param state constant value to compare to */ public QuestSmallerThanCondition(final String questname, final int index, final int state) { *************** *** 59,66 **** } @Override public boolean fire(final Player player, final Sentence sentence, final Entity entity) { if (!player.hasQuest(questname)) { ! return false; } --- 60,83 ---- } + /** + * Creates a new QuestSmallerThanCondition. + * + * @param questname name of quest-slot + * @param index index of sub state + * @param state constant value to compare to + * @param acceptEmpty accept an empty quest state + */ + public QuestSmallerThanCondition(final String questname, final int index, final int state, boolean acceptEmpty) { + this.questname = questname; + this.index = index; + this.state = state; + this.acceptEmpty = acceptEmpty; + } + + @Override public boolean fire(final Player player, final Sentence sentence, final Entity entity) { if (!player.hasQuest(questname)) { ! return acceptEmpty; } *************** *** 70,74 **** questStateInt = Integer.parseInt(questState); } catch (NumberFormatException e) { ! return false; } --- 87,91 ---- questStateInt = Integer.parseInt(questState); } catch (NumberFormatException e) { ! return acceptEmpty; } |