aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells
diff options
context:
space:
mode:
authorMeji <alvaro.megias@outlook.com>2024-08-15 15:43:17 +0200
committerGitHub <noreply@github.com>2024-08-15 15:43:17 +0200
commit3429871a07c1c1ebe2bd94cb771ef187cb46fd46 (patch)
tree86525da8a409240074c81d8e5b97100cbb0bd5ca /src/server/game/Spells
parent585cbd939442827bd4f1120cc7de1d62d03b7565 (diff)
Core/SAI: Implemented new action SMART_ACTION_COMPLETE_QUEST (#30048)11.0.0.56008
Diffstat (limited to 'src/server/game/Spells')
-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 54d36d7f24e..c74646f42c0 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3690,11 +3690,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);
}
}