diff options
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 530fe970011..15a4728a362 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -25177,40 +25177,22 @@ bool Player::IsSpellFitByClassAndRace(uint32 spell_id) const bool Player::HasQuestForGO(int32 GOId) const { - for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) + for (QuestObjectiveStatusMap::value_type const& objectiveItr : Trinity::Containers::MapEqualRange(m_questObjectiveStatus, { QUEST_OBJECTIVE_GAMEOBJECT, GOId })) { - uint32 questid = GetQuestSlotQuestId(i); - if (questid == 0) - continue; - - QuestStatusMap::const_iterator qs_itr = m_QuestStatus.find(questid); - if (qs_itr == m_QuestStatus.end()) + Quest const* qInfo = ASSERT_NOTNULL(sObjectMgr->GetQuestTemplate(objectiveItr.second.QuestStatusItr->first)); + QuestObjective const& objective = *objectiveItr.second.Objective; + if (!IsQuestObjectiveCompletable(objectiveItr.second.QuestStatusItr->second.Slot, qInfo, objective)) continue; - QuestStatusData const& qs = qs_itr->second; - - if (qs.Status == QUEST_STATUS_INCOMPLETE) - { - Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid); - if (!qInfo) - continue; - - if (GetGroup() && GetGroup()->isRaidGroup() && !qInfo->IsAllowedInRaid(GetMap()->GetDifficultyID())) + // hide quest if player is in raid-group and quest is no raid quest + if (GetGroup() && GetGroup()->isRaidGroup() && !qInfo->IsAllowedInRaid(GetMap()->GetDifficultyID())) + if (!InBattleground()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later continue; - for (QuestObjective const& obj : qInfo->GetObjectives()) - { - if (obj.Type != QUEST_OBJECTIVE_GAMEOBJECT) //skip non GO case - continue; - - if (!IsQuestObjectiveCompletable(i, qInfo, obj)) - continue; - - if (GOId == obj.ObjectID && GetQuestSlotObjectiveData(i, obj) < obj.Amount) - return true; - } - } + if (!IsQuestObjectiveComplete(objectiveItr.second.QuestStatusItr->second.Slot, qInfo, objective)) + return true; } + return false; } |