mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Quest: fix RewardNextQuest being used to condition previous quests in chain
This commit is contained in:
@@ -14667,7 +14667,7 @@ bool Player::CanSeeStartQuest(Quest const* quest)
|
||||
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) && SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) &&
|
||||
SatisfyQuestSkill(quest, false) && SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
|
||||
SatisfyQuestDependentQuests(quest, false) && SatisfyQuestNextChain(quest, false) &&
|
||||
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
|
||||
SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
|
||||
SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
|
||||
{
|
||||
return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel();
|
||||
@@ -14683,7 +14683,7 @@ bool Player::CanTakeQuest(Quest const* quest, bool msg)
|
||||
&& SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
|
||||
&& SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
|
||||
&& SatisfyQuestDependentQuests(quest, msg) && SatisfyQuestTimed(quest, msg)
|
||||
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
|
||||
&& SatisfyQuestNextChain(quest, msg)
|
||||
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
|
||||
&& SatisfyQuestMonth(quest, msg) && SatisfyQuestSeasonal(quest, msg)
|
||||
&& SatisfyQuestConditions(quest, msg);
|
||||
@@ -15736,38 +15736,6 @@ bool Player::SatisfyQuestNextChain(Quest const* qInfo, bool msg) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg)
|
||||
{
|
||||
// No previous quest in chain
|
||||
if (qInfo->PrevChainQuests.empty())
|
||||
return true;
|
||||
|
||||
for (uint32 prevQuestId : qInfo->PrevChainQuests)
|
||||
{
|
||||
auto itr = m_QuestStatus.find(prevQuestId);
|
||||
|
||||
// If any of the previous quests in chain active, return false
|
||||
if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE)
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
TC_LOG_DEBUG("misc", "Player::SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (QuestID: %u) because player '%s' (%s) already did or started next quest in chain.",
|
||||
qInfo->GetQuestId(), GetName().c_str(), GetGUID().ToString().c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// check for all quests further down the chain
|
||||
// only necessary if there are quest chains with more than one quest that can be skipped
|
||||
//if (!SatisfyQuestPrevChain(prevId, msg))
|
||||
// return false;
|
||||
}
|
||||
|
||||
// No previous quest in chain active
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) const
|
||||
{
|
||||
if (!qInfo->IsDaily() && !qInfo->IsDFQuest())
|
||||
|
||||
@@ -1377,7 +1377,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
bool SatisfyQuestTimed(Quest const* qInfo, bool msg) const;
|
||||
bool SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) const;
|
||||
bool SatisfyQuestNextChain(Quest const* qInfo, bool msg) const;
|
||||
bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg);
|
||||
bool SatisfyQuestDay(Quest const* qInfo, bool msg) const;
|
||||
bool SatisfyQuestWeek(Quest const* qInfo, bool msg) const;
|
||||
bool SatisfyQuestMonth(Quest const* qInfo, bool msg) const;
|
||||
|
||||
@@ -4847,8 +4847,6 @@ void ObjectMgr::LoadQuests()
|
||||
qinfo->GetQuestId(), qinfo->_rewardNextQuest, qinfo->_rewardNextQuest);
|
||||
qinfo->_rewardNextQuest = 0;
|
||||
}
|
||||
else
|
||||
qNextItr->second->PrevChainQuests.push_back(qinfo->GetQuestId());
|
||||
}
|
||||
|
||||
for (uint8 j = 0; j < QUEST_REWARD_CURRENCY_COUNT; ++j)
|
||||
@@ -4980,9 +4978,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 %u has NextQuestId %u, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
|
||||
TC_LOG_ERROR("sql.sql", "Quest %u has NextQuestId %u, but no such quest", qinfo->GetQuestId(), qinfo->_nextQuestId);
|
||||
else
|
||||
qNextItr->second->DependentPreviousQuests.push_back(qinfo->GetQuestId());
|
||||
}
|
||||
|
||||
@@ -368,7 +368,6 @@ class TC_GAME_API Quest
|
||||
void BuildQuestRewards(WorldPackets::Quest::QuestRewards& rewards, Player* player) const;
|
||||
|
||||
std::vector<uint32> DependentPreviousQuests;
|
||||
std::vector<uint32> PrevChainQuests;
|
||||
|
||||
// cached data
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user