From cbbb74524623ea22fc5375697d6ec2ec16a1755f Mon Sep 17 00:00:00 2001 From: xinef1 Date: Mon, 24 Apr 2017 05:46:06 +0200 Subject: 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 --- src/server/game/Globals/ObjectMgr.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/server/game/Globals/ObjectMgr.cpp') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1ad73db9c15..2882cef344c 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -4612,6 +4612,26 @@ void ObjectMgr::LoadQuests() qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED); if (qinfo->_requiredPlayerKills) qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL); + + // 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 (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) + { + if (qinfo->RequiredItemId[j] != 0 && (qinfo->RequiredItemId[j] != qinfo->GetSrcItemId() || qinfo->RequiredItemCount[j] > 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 -- cgit v1.2.3