From 2a1d23e520547c802172e1cae31320607709dd98 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Mon, 27 May 2024 20:24:10 -0300 Subject: [PATCH] =?UTF-8?q?fix(Scripts/Hyjal):=20Implement=20Eternal=20Sil?= =?UTF-8?q?ence=20spell=20when=20going=20into=20t=E2=80=A6=20(#18960)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix(Scripts/Hyjal): Implement Eternal Silence spell when going into the Well of Eternity --- .../updates/pending_db_world/rev_1716843579555488300.sql | 4 ++++ src/server/game/Entities/Player/Player.cpp | 3 +++ src/server/game/Instances/InstanceScript.h | 3 +++ .../Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h | 6 +++++- .../CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp | 9 +++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1716843579555488300.sql diff --git a/data/sql/updates/pending_db_world/rev_1716843579555488300.sql b/data/sql/updates/pending_db_world/rev_1716843579555488300.sql new file mode 100644 index 000000000..228970e8f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1716843579555488300.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = -42201 AND `spell_effect` = 42205; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(-42201, 42205, 0, 'Eternal Silence trigger Residue of Eternity on removal'); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ee661c9a9..f763ba93b 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2176,6 +2176,9 @@ void Player::SetInWater(bool apply) RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER); getHostileRefMgr().updateThreatTables(); + + if (InstanceScript* instance = GetInstanceScript()) + instance->OnPlayerInWaterStateUpdate(this, apply); } bool Player::IsInAreaTriggerRadius(AreaTrigger const* trigger, float delta) const diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 6fd2c9402..d65bb0349 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -186,6 +186,9 @@ public: virtual void OnPlayerAreaUpdate(Player* /*player*/, uint32 /*oldArea*/, uint32 /*newArea*/) {} + //Called when a player enters/leaves water bodies. + virtual void OnPlayerInWaterStateUpdate(Player* /*player*/, bool /*inWater*/) {} + //Handle open / close objects //use HandleGameObject(ObjectGuid::Empty, boolen, GO); in OnObjectCreate in instance scripts //use HandleGameObject(GUID, boolen, nullptr); in any other script diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h index b0c127f49..7825555cb 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h @@ -144,7 +144,11 @@ enum HyjalMisc START_WAVE_HORDE_RETREAT = 39, START_WAVE_NIGHT_ELF = 42, - CONTEXT_GROUP_WAVES = 1 + CONTEXT_GROUP_WAVES = 1, + + AREA_NORDRASSIL = 3710, + + SPELL_ETERNAL_SILENCE = 42201 }; enum HyjalPaths diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index fd5d50672..675dc3050 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -19,6 +19,7 @@ #include "InstanceMapScript.h" #include "InstanceScript.h" #include "Opcodes.h" +#include "Player.h" #include "WorldPacket.h" #include "hyjal.h" @@ -530,6 +531,14 @@ public: _scheduler.Update(diff); } + void OnPlayerInWaterStateUpdate(Player* player, bool inWater) override + { + if (inWater && player->GetAreaId() == AREA_NORDRASSIL) + { + player->CastSpell(player, SPELL_ETERNAL_SILENCE, true); + } + } + protected: int32 trash; uint8 _currentWave;