|
@@ -129,6 +129,15 @@ public final class QuestState
|
|
return _state;
|
|
return _state;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Return true if quest just created, false otherwise
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public boolean isCreated()
|
|
|
|
+ {
|
|
|
|
+ return (getState() == State.CREATED);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Return true if quest completed, false otherwise
|
|
* Return true if quest completed, false otherwise
|
|
* @return boolean
|
|
* @return boolean
|
|
@@ -163,12 +172,15 @@ public final class QuestState
|
|
// set new state if it is not already in that state
|
|
// set new state if it is not already in that state
|
|
if (_state != state)
|
|
if (_state != state)
|
|
{
|
|
{
|
|
|
|
+ final boolean newQuest = isCreated();
|
|
_state = state;
|
|
_state = state;
|
|
-
|
|
|
|
- Quest.updateQuestInDb(this);
|
|
|
|
- QuestList ql = new QuestList();
|
|
|
|
-
|
|
|
|
- getPlayer().sendPacket(ql);
|
|
|
|
|
|
+
|
|
|
|
+ if (newQuest)
|
|
|
|
+ Quest.createQuestInDb(this);
|
|
|
|
+ else
|
|
|
|
+ Quest.updateQuestInDb(this);
|
|
|
|
+
|
|
|
|
+ getPlayer().sendPacket(new QuestList());
|
|
}
|
|
}
|
|
return state;
|
|
return state;
|
|
}
|
|
}
|
|
@@ -1064,7 +1076,7 @@ public final class QuestState
|
|
// remove this quest from the notifyDeath list of this character if its on this list
|
|
// remove this quest from the notifyDeath list of this character if its on this list
|
|
_player.removeNotifyQuestOfDeath(this);
|
|
_player.removeNotifyQuestOfDeath(this);
|
|
|
|
|
|
- if (isCompleted())
|
|
|
|
|
|
+ if (isCompleted() || isCreated())
|
|
return this;
|
|
return this;
|
|
|
|
|
|
// Say quest is completed
|
|
// Say quest is completed
|