mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Quest: do not set a quest to failed if it's rewarded or has no status at all (not taken).
This commit is contained in:
@@ -150,14 +150,10 @@ void npc_escortAI::JustDied(Unit* /*killer*/)
|
||||
{
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
if (Player* member = groupRef->GetSource())
|
||||
if (member->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
|
||||
member->FailQuest(m_pQuestForEscort->GetQuestId());
|
||||
member->FailQuest(m_pQuestForEscort->GetQuestId());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(m_pQuestForEscort->GetQuestId());
|
||||
}
|
||||
player->FailQuest(m_pQuestForEscort->GetQuestId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,19 +147,11 @@ void FollowerAI::JustDied(Unit* /*killer*/)
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
{
|
||||
if (Player* member = groupRef->GetSource())
|
||||
{
|
||||
if (member->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
|
||||
member->FailQuest(m_pQuestForFollow->GetQuestId());
|
||||
}
|
||||
}
|
||||
member->FailQuest(m_pQuestForFollow->GetQuestId());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(m_pQuestForFollow->GetQuestId());
|
||||
}
|
||||
player->FailQuest(m_pQuestForFollow->GetQuestId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ void SmartAI::EndPath(bool fail)
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->HasCorpse())
|
||||
player->GroupEventHappens(mEscortQuestID, me);
|
||||
|
||||
if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
if (fail)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
|
||||
if (Group* group = player->GetGroup())
|
||||
@@ -232,7 +232,7 @@ void SmartAI::EndPath(bool fail)
|
||||
|
||||
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->HasCorpse())
|
||||
groupGuy->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
if (fail && groupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
else if (fail)
|
||||
groupGuy->FailQuest(mEscortQuestID);
|
||||
}
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void SmartAI::EndPath(bool fail)
|
||||
Player* player = (*iter)->ToPlayer();
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->HasCorpse())
|
||||
player->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
else if (fail)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15304,13 +15304,16 @@ void Player::SetRewardedQuest(uint32 quest_id)
|
||||
|
||||
void Player::FailQuest(uint32 questId)
|
||||
{
|
||||
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
{
|
||||
// Already complete quests shouldn't turn failed.
|
||||
if (GetQuestStatus(questId) == QUEST_STATUS_COMPLETE && !quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED))
|
||||
return;
|
||||
|
||||
// You can't fail a quest if you don't have it, or if it's already rewarded.
|
||||
if (GetQuestStatus(questId) == QUEST_STATUS_NONE || GetQuestStatus(questId) == QUEST_STATUS_REWARDED)
|
||||
return;
|
||||
|
||||
SetQuestStatus(questId, QUEST_STATUS_FAILED);
|
||||
|
||||
uint16 log_slot = FindQuestSlot(questId);
|
||||
|
||||
Reference in New Issue
Block a user