diff --git a/data/sql/updates/pending_db_world/rev_1743726578196339200.sql b/data/sql/updates/pending_db_world/rev_1743726578196339200.sql new file mode 100644 index 000000000..e1408d057 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1743726578196339200.sql @@ -0,0 +1,3 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id` = 46268; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (46268, 'spell_muru_blackhole'); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 043a34d6d..bf99426f3 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -611,6 +611,10 @@ public: [[nodiscard]] virtual float GetStationaryZ() const { return GetPositionZ(); } [[nodiscard]] virtual float GetStationaryO() const { return GetOrientation(); } + [[nodiscard]] float GetMapWaterOrGroundLevel(Position pos, float* ground = nullptr) const + { + return GetMapWaterOrGroundLevel(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), ground); + }; [[nodiscard]] float GetMapWaterOrGroundLevel(float x, float y, float z, float* ground = nullptr) const; [[nodiscard]] float GetMapHeight(float x, float y, float z, bool vmap = true, float distanceToSearch = 50.0f) const; // DEFAULT_HEIGHT_SEARCH in map.h diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index dd94fd5f8..662eae2ee 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -352,6 +352,29 @@ class spell_entropius_negative_energy_periodic : public AuraScript } }; +class spell_muru_blackhole : public SpellScript +{ + PrepareSpellScript(spell_muru_blackhole); + + void ChangeSummonPos(SpellEffIndex /*effIndex*/) + { + if (!GetCaster()) + return; + + WorldLocation summonPos = *GetExplTargetDest(); + float destZ = summonPos.GetPositionZ() - GetCaster()->GetMapWaterOrGroundLevel(GetCaster()->GetPosition()); + Position offset = { 0.0f, 0.0f, -destZ, 0.0f}; + summonPos.RelocateOffset(offset); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_muru_blackhole::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + } +}; + void AddSC_boss_muru() { RegisterSunwellPlateauCreatureAI(boss_muru); @@ -363,4 +386,5 @@ void AddSC_boss_muru() RegisterSpellScript(spell_entropius_void_zone_visual_aura); RegisterSpellScript(spell_entropius_black_hole_effect); RegisterSpellScript(spell_entropius_negative_energy_periodic); + RegisterSpellScript(spell_muru_blackhole); }