diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-05-01 15:41:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 15:41:32 +0200 |
commit | 57a5969c2672b36160fea1b7c38c424de562a57b (patch) | |
tree | ee52f8ddaa8d37297142e59029df461d3000ce31 /src/server/game/Globals/ObjectMgr.cpp | |
parent | fbd74eb5d8b5aa3a6874ee99044054e097b5ef21 (diff) | |
parent | 05ba662d5daaa3428cc01cdaa3794bf5a073ef17 (diff) |
Merge pull request #24500 from funjoker/cherry-picks
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 4ab04447914..f519c69948f 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -4529,8 +4529,6 @@ void ObjectMgr::LoadQuests() qinfo->GetQuestId(), qinfo->_nextQuestInChain, qinfo->_nextQuestInChain); qinfo->_nextQuestInChain = 0; } - else - qNextItr->second->PrevChainQuests.push_back(qinfo->GetQuestId()); } for (uint8 j = 0; j < QUEST_REWARD_CURRENCY_COUNT; ++j) @@ -4617,9 +4615,9 @@ void ObjectMgr::LoadQuests() if (qinfo->_nextQuestID) { - auto qNextItr = _questTemplates.find(qinfo->GetNextQuestId()); + auto qNextItr = _questTemplates.find(qinfo->_nextQuestID); if (qNextItr == _questTemplates.end()) - TC_LOG_ERROR("sql.sql", "Quest %d has NextQuestId %u, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); + TC_LOG_ERROR("sql.sql", "Quest %d has NextQuestId %u, but no such quest", qinfo->GetQuestId(), qinfo->_nextQuestID); else qNextItr->second->DependentPreviousQuests.push_back(qinfo->GetQuestId()); } @@ -4628,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 |