From 2c9b67f00be95bd816dbaa9db43838a67e187753 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 30 Jul 2025 18:35:39 +0200 Subject: Core/Quests: Fixed QuestScript::OnQuestStatusChange incorrectly triggering with QUEST_STATUS_INCOMPLETE when removing items from quest objectives on rewarding quest Closes #31181 --- src/server/scripts/Commands/cs_quest.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 26b29e6fe79..00fb5c4bce8 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -117,25 +117,20 @@ public: if (oldStatus != QUEST_STATUS_NONE) { + player->RemoveActiveQuest(quest->GetQuestId(), false); + // remove all quest entries for 'entry' from quest log - for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) + if (oldStatus != QUEST_STATUS_REWARDED) { - uint32 logQuest = player->GetQuestSlotQuestId(slot); - if (logQuest == quest->GetQuestId()) - { - player->SetQuestSlot(slot, 0); + // we ignore unequippable quest items in this case, its' still be equipped + player->TakeQuestSourceItem(quest->GetQuestId(), false); - // we ignore unequippable quest items in this case, its' still be equipped - player->TakeQuestSourceItem(logQuest, false); - - if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP)) - { - player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest(); - player->UpdatePvPState(); - } + if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP)) + { + player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest(); + player->UpdatePvPState(); } } - player->RemoveActiveQuest(quest->GetQuestId(), false); player->RemoveRewardedQuest(quest->GetQuestId()); player->DespawnPersonalSummonsForQuest(quest->GetQuestId()); -- cgit v1.2.3