aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorxinef1 <w.szyszko2@gmail.com>2017-04-24 05:46:06 +0200
committerfunjoker <funjoker109@gmail.com>2020-04-28 12:56:03 +0200
commit16cf95654f35f6bb563e82608476d8f53837bd06 (patch)
tree549b44c3ebed03b2d2b5ad5d002ef6f9bd4af9a6 /src/server/game/Globals/ObjectMgr.cpp
parent9ef39fa5d2f76459e3e529a0877655b0f69b98d6 (diff)
Various quest system fixes (seasonal quests, timed quests and more) (#18940)
- Unify quest status checking function, use dedicated function instead of direct map checks - Fixed seasonal quest chains and ability to complete the same quests rewarded in past - Update area dependent auras on quest status change (they often requires specific quest status) - Send all not stored quest rewards by mail - When casting quest reward spell, check if it is not self casted, if so - use player to cast this spell - Perform full db save on quest reward to prevent data desynchronization - Don't allow to fail completed timed quests, except for quests which are completed right from the start - Don't allow to share pooled quests, if they are not available in the current pool (eg sharing easy dalaran weeklies, stored at alt character) - Remove seasonal quest if rewarded quest is removed - Don't complete whole quest on AreaExplore event, check if there are no more requirements that should be fulfilled - Quests with flag QUEST_SPECIAL_FLAGS_PLAYER_KILL can be only credited in quest zone Closes #18913 Closes #11187 Closes #15279 (cherry picked from commit cbbb74524623ea22fc5375697d6ec2ec16a1755f)
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 57922dd84eb..f519c69948f 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -4626,6 +4626,27 @@ void ObjectMgr::LoadQuests()
_exclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->_exclusiveGroup, qinfo->GetQuestId()));
if (qinfo->_limitTime)
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED);
+
+ // Special flag to determine if quest is completed from the start, used to determine if we can fail timed quest if it is completed
+ if (!qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO | QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
+ {
+ bool addFlag = true;
+ if (qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
+ {
+ for (QuestObjective const& obj : qinfo->GetObjectives())
+ {
+ if (obj.Type == QUEST_OBJECTIVE_ITEM)
+ if (static_cast<uint32>(obj.ObjectID) != qinfo->GetSrcItemId() || static_cast<uint32>(obj.Amount) > qinfo->GetSrcItemCount())
+ {
+ addFlag = false;
+ break;
+ }
+ }
+ }
+
+ if (addFlag)
+ qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_COMPLETED_AT_START);
+ }
}
// check QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE