diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java index 20f2fc7da9..38667121f3 100644 --- a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java @@ -336,7 +336,7 @@ public class AdminShowQuests implements IAdminCommandHandler { qs = QuestManager.getInstance().getQuest(Integer.parseInt(val[0])).newQuestState(target); qs.setState(State.STARTED); - qs.set("cond", "1"); + qs.setCond(1); target.sendPacket(new QuestList(target)); target.sendPacket(new ExShowQuestMark(qs.getQuest().getId(), qs.getCond())); val[0] = qs.getQuest().getName(); diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/quests/Q00350_EnhanceYourWeapon/Q00350_EnhanceYourWeapon.java b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/quests/Q00350_EnhanceYourWeapon/Q00350_EnhanceYourWeapon.java index 9124973068..40e43f120b 100644 --- a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/quests/Q00350_EnhanceYourWeapon/Q00350_EnhanceYourWeapon.java +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/quests/Q00350_EnhanceYourWeapon/Q00350_EnhanceYourWeapon.java @@ -219,10 +219,6 @@ public class Q00350_EnhanceYourWeapon extends Quest String htmltext = getNoQuestMsg(player); final QuestState qs = getQuestState(player, true); if (qs.getState() == State.CREATED) - { - qs.set("cond", "0"); - } - if (qs.getInt("cond") == 0) { htmltext = npc.getId() + "-01.htm"; } diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/quest/QuestState.java index 4264d72834..4dd252076a 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/quest/QuestState.java @@ -40,6 +40,12 @@ public class QuestState { protected static final Logger LOGGER = Logger.getLogger(QuestState.class.getName()); + // Constants + private static final String COND_VAR = "cond"; + private static final String RESTART_VAR = "restartTime"; + private static final String MEMO_VAR = "memoState"; + private static final String MEMO_EX_VAR = "memoStateEx"; + /** The name of the quest of this QuestState */ private final String _questName; @@ -49,6 +55,9 @@ public class QuestState /** The current state of the quest */ private byte _state; + /** The current condition of the quest */ + private int _cond = 0; + /** Used for simulating Quest onTalk */ private boolean _simulated = false; @@ -156,10 +165,12 @@ public class QuestState { return; } + if (_state == state) { return; } + final boolean newQuest = isCreated(); _state = state; if (saveInDb) @@ -179,10 +190,10 @@ public class QuestState /** * Add parameter used in quests. - * @param var String pointing out the name of the variable for quest + * @param variable String pointing out the name of the variable for quest * @param value String pointing out the value of the variable for quest */ - public void setInternal(String var, String value) + public void setInternal(String variable, String value) { if (_simulated) { @@ -196,20 +207,32 @@ public class QuestState if (value == null) { - _vars.put(var, ""); + _vars.put(variable, ""); return; } - _vars.put(var, value); + if (COND_VAR.equals(variable)) + { + try + { + _cond = Integer.parseInt(value); + } + catch (Exception ignored) + { + } + } + + _vars.put(variable, value); } - public void set(String var, int value) + public void set(String variable, int value) { if (_simulated) { return; } - set(var, Integer.toString(value)); + + set(variable, Integer.toString(value)); } /** @@ -223,10 +246,10 @@ public class QuestState * The key is known as existing if the preceding value of the key (given as result of function put()) is not null.
* If the key doesn't exist, the couple is added/created in the database *