aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-04-08 21:03:27 +0200
committerShauren <shauren.trinity@gmail.com>2024-04-08 21:03:27 +0200
commitabab4841567c4f40c6acc6dc13544284c8a36dda (patch)
tree81e90b0a7f2c46780db46c07411c23446007844d
parente370e471833be841504ffe3d62d69fc481f8c360 (diff)
Scripts/Forbidden Reach: Fix questgiver for initial quest not being there if you decline first quest popup
Closes #29793
-rw-r--r--sql/updates/world/master/2024_04_08_01_world.sql3
-rw-r--r--src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp78
2 files changed, 42 insertions, 39 deletions
diff --git a/sql/updates/world/master/2024_04_08_01_world.sql b/sql/updates/world/master/2024_04_08_01_world.sql
index 9e73192fc3a..1ebb717d631 100644
--- a/sql/updates/world/master/2024_04_08_01_world.sql
+++ b/sql/updates/world/master/2024_04_08_01_world.sql
@@ -21,3 +21,6 @@ INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry
-- Quest Awaken, Dracthyr is not an auto accept quest
UPDATE `quest_template_addon` SET `SpecialFlags`=0 WHERE `ID`=64864;
+
+-- Allow the aura when not on quest or when quest is in log
+UPDATE `spell_area` SET `quest_start_status`=11 WHERE `spell` IN (369731,370112);
diff --git a/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp b/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp
index 4c756e8afa9..8b96b49c92a 100644
--- a/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp
+++ b/src/server/scripts/DragonIsles/zone_the_forbidden_reach.cpp
@@ -17,12 +17,11 @@
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
-#include "ScriptMgr.h"
#include "Containers.h"
#include "Player.h"
-#include "Spell.h"
+#include "ScriptMgr.h"
+#include "SpellInfo.h"
#include "SpellScript.h"
-#include "Log.h"
enum DracthyrLoginSpells
{
@@ -51,31 +50,29 @@ struct DracthyrLoginRoom
Position SummonPosition;
};
-std::array<DracthyrLoginRoom, 4> LoginRoomData =
-{
+static constexpr std::array<DracthyrLoginRoom, 4> LoginRoomData =
+{{
{
- {
- SPELL_DRACTHYR_MOVIE_ROOM_01,
- { 5725.32f, -3024.26f, 251.047f, 0.01745329238474369f },
- { 5739.97216796875f, -3023.970458984375f, 251.172332763671875f, 3.193952560424804687f }
- },
- {
- SPELL_DRACTHYR_MOVIE_ROOM_02,
- { 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f },
- { 5754.3046875f, -3056.34716796875f, 251.1725006103515625f, 3.926990747451782226f }
- },
- {
- SPELL_DRACTHYR_MOVIE_ROOM_03,
- { 5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f },
- { 5787.44970703125f, -3069.335205078125f, 251.168121337890625f, 4.729842185974121093f }
- },
- {
- SPELL_DRACTHYR_MOVIE_ROOM_04,
- { 5829.32f, -3064.49f, 251.047f, 2.364955902099609375f },
- { 5818.533203125f, -3054.5625f, 251.3630828857421875f, 5.480333805084228515f }
- }
+ SPELL_DRACTHYR_MOVIE_ROOM_01,
+ { 5725.32f, -3024.26f, 251.047f, 0.01745329238474369f },
+ { 5739.97216796875f, -3023.970458984375f, 251.172332763671875f, 3.193952560424804687f }
+ },
+ {
+ SPELL_DRACTHYR_MOVIE_ROOM_02,
+ { 5743.03f, -3067.28f, 251.047f, 0.798488140106201171f },
+ { 5754.3046875f, -3056.34716796875f, 251.1725006103515625f, 3.926990747451782226f }
+ },
+ {
+ SPELL_DRACTHYR_MOVIE_ROOM_03,
+ { 5787.1597f, -3083.3906f, 251.04698f, 1.570796370506286621f },
+ { 5787.44970703125f, -3069.335205078125f, 251.168121337890625f, 4.729842185974121093f }
+ },
+ {
+ SPELL_DRACTHYR_MOVIE_ROOM_04,
+ { 5829.32f, -3064.49f, 251.047f, 2.364955902099609375f },
+ { 5818.533203125f, -3054.5625f, 251.3630828857421875f, 5.480333805084228515f }
}
-};
+}};
// 369728 - Dracthyr Login
// 369744 - Awaken, Dracthyr OnquestAbandon
@@ -96,6 +93,11 @@ class spell_dracthyr_login : public SpellScript
GetHitDest()->Relocate(room.PlayerPosition);
GetCaster()->CastSpell(GetHitUnit(), room.MovieSpellId, true);
+
+ // relocate questgiver to new random room
+ if (GetSpellInfo()->Id == SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON)
+ if (Player* player = GetCaster()->ToPlayer())
+ player->UpdateAreaDependentAuras(player->GetAreaId());
}
void Register() override
@@ -125,21 +127,14 @@ public:
// 370111 - Summon Kodethi
class spell_dracthyr_summon_dervishian : public SpellScript
{
- void SetDest(SpellDestination& dest)
+ void SetDest(SpellDestination& dest) const
{
- float currentDist = 1000.0f;
- DracthyrLoginRoom const* currentRoom = nullptr;
-
- for (DracthyrLoginRoom const& room : LoginRoomData)
+ auto currentRoom = std::ranges::min_element(LoginRoomData, [caster = GetCaster()](DracthyrLoginRoom const& left, DracthyrLoginRoom const& right)
{
- float dist = GetCaster()->GetDistance(room.PlayerPosition);
- if (dist < currentDist)
- {
- currentDist = dist;
- currentRoom = &room;
- }
- }
- if (!currentRoom)
+ return caster->GetDistance(left.PlayerPosition) < caster->GetDistance(right.PlayerPosition);
+ });
+
+ if (currentRoom == LoginRoomData.end())
return;
dest.Relocate(currentRoom->SummonPosition);
@@ -160,7 +155,12 @@ public:
void OnQuestStatusChange(Player* player, Quest const* /*quest*/, QuestStatus /*oldStatus*/, QuestStatus newStatus) override
{
if (newStatus == QUEST_STATUS_NONE)
+ {
player->CastSpell(player, SPELL_AWAKEN_DRACTYHR_QUEST_ABANDON, false);
+ // remove summon aura to relocate questgiver to new random room
+ player->RemoveAura(SPELL_MAINTAIN_DERVISHIAN);
+ player->RemoveAura(SPELL_MAINTAIN_KODETHI);
+ }
}
};