aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorMeji <alvaro.megias@outlook.com>2024-08-15 15:43:17 +0200
committerOvahlord <dreadkiller@gmx.de>2024-08-17 14:05:40 +0200
commitbd2212322b848710255028c0439a5984d7657293 (patch)
tree3fb86fe0710c00351a0797495493318ac9d0d31d /src/server/game/Spells/SpellEffects.cpp
parent6c9824f147306dace674a4b48458836ff3bc9342 (diff)
Core/SAI: Implemented new action SMART_ACTION_COMPLETE_QUEST (#30048)
(cherry picked from commit 3429871a07c1c1ebe2bd94cb771ef187cb46fd46)
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 4b2c9d6f2a2..b1623f71790 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3663,11 +3663,17 @@ void Spell::EffectQuestComplete()
if (!quest)
return;
- uint16 logSlot = player->FindQuestSlot(questId);
- if (logSlot < MAX_QUEST_LOG_SIZE)
- player->AreaExploredOrEventHappens(questId);
- else if (quest->HasFlag(QUEST_FLAGS_TRACKING_EVENT)) // Check if the quest is used as a serverside flag.
- player->SetRewardedQuest(questId); // If so, set status to rewarded without broadcasting it to client.
+ QuestStatus questStatus = player->GetQuestStatus(questId);
+ if (questStatus == QUEST_STATUS_REWARDED)
+ return;
+
+ if (quest->HasFlag(QUEST_FLAGS_COMPLETION_EVENT) || quest->HasFlag(QUEST_FLAGS_COMPLETION_AREA_TRIGGER))
+ {
+ if (questStatus == QUEST_STATUS_INCOMPLETE)
+ player->AreaExploredOrEventHappens(questId);
+ }
+ else if (quest->HasFlag(QUEST_FLAGS_TRACKING_EVENT)) // Check if the quest is used as a serverside flag
+ player->CompleteQuest(questId);
}
}