mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Quests: Update phaseshift when taking or abandoning quests (#29901)
This commit is contained in:
@@ -14992,6 +14992,10 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
|
||||
SendQuestUpdate(quest_id);
|
||||
|
||||
bool updateVisibility = false;
|
||||
if (quest->HasFlag(QUEST_FLAGS_UPDATE_PHASESHIFT))
|
||||
updateVisibility = PhasingHandler::OnConditionChange(this, false);
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
|
||||
{
|
||||
// prepare Quest Tracker datas
|
||||
@@ -15005,6 +15009,9 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
if (updateVisibility)
|
||||
UpdateObjectVisibility();
|
||||
|
||||
sScriptMgr->OnQuestStatusChange(this, quest_id);
|
||||
sScriptMgr->OnQuestStatusChange(this, quest, oldStatus, questStatusData.Status);
|
||||
}
|
||||
@@ -16104,8 +16111,19 @@ void Player::RemoveActiveQuest(uint32 questId, bool update /*= true*/)
|
||||
m_QuestStatusSave[questId] = QUEST_DELETE_SAVE_TYPE;
|
||||
}
|
||||
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
bool updateVisibility = false;
|
||||
|
||||
if (update)
|
||||
{
|
||||
SendQuestUpdate(questId);
|
||||
|
||||
if (quest && quest->HasFlag(QUEST_FLAGS_UPDATE_PHASESHIFT))
|
||||
updateVisibility = PhasingHandler::OnConditionChange(this, false);
|
||||
}
|
||||
|
||||
if (updateVisibility)
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
|
||||
@@ -16121,11 +16139,14 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
|
||||
SetQuestCompletedBit(questBit, false);
|
||||
|
||||
// Remove seasonal quest also
|
||||
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questId);
|
||||
ASSERT(qInfo);
|
||||
if (qInfo->IsSeasonal())
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
bool updateVisibility = false;
|
||||
|
||||
ASSERT(quest);
|
||||
|
||||
if (quest->IsSeasonal())
|
||||
{
|
||||
uint16 eventId = qInfo->GetEventIdForQuest();
|
||||
uint16 eventId = quest->GetEventIdForQuest();
|
||||
if (m_seasonalquests.find(eventId) != m_seasonalquests.end())
|
||||
{
|
||||
m_seasonalquests[eventId].erase(questId);
|
||||
@@ -16134,7 +16155,15 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
|
||||
}
|
||||
|
||||
if (update)
|
||||
{
|
||||
SendQuestUpdate(questId);
|
||||
|
||||
if (quest && quest->HasFlag(QUEST_FLAGS_UPDATE_PHASESHIFT))
|
||||
updateVisibility = PhasingHandler::OnConditionChange(this, false);
|
||||
}
|
||||
|
||||
if (updateVisibility)
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
void Player::SendQuestUpdate(uint32 questId, bool updateInteractions /*= true*/, bool updateGameObjectQuestGiverStatus /*= false*/)
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPackets::Quest::QuestGiverStatusQuery& packet)
|
||||
{
|
||||
|
||||
Object* questGiver = ObjectAccessor::GetObjectByTypeMask(*_player, packet.QuestGiverGUID, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
if (!questGiver)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user