From ba09ad2bbdcaf6efe570c1895a2591c4e1155c27 Mon Sep 17 00:00:00 2001 From: EricksOliveira Date: Fri, 9 Oct 2026 18:13:58 +0000 Subject: [PATCH] fix(Scripts/Ulduar): keep XT-002 toy pile adds out of the scrap heaps (#27757) Co-authored-by: Claude Opus 5 Co-authored-by: sogladev <46423958+sogladev@users.noreply.github.com> --- .../rev_1790091933170825700.sql | 6 ++++ .../Northrend/Ulduar/Ulduar/boss_xt002.cpp | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1790091933170825700.sql diff --git a/data/sql/updates/pending_db_world/rev_1790091933170825700.sql b/data/sql/updates/pending_db_world/rev_1790091933170825700.sql new file mode 100644 index 0000000000..edbfcdd7e8 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1790091933170825700.sql @@ -0,0 +1,6 @@ +-- XT-002 Deconstructor: keep toy pile adds out of the scrap heaps +DELETE FROM `spell_script_names` WHERE `spell_id` IN (62828, 62831, 62835) AND `ScriptName` = 'spell_xt002_recharge_robot'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(62828, 'spell_xt002_recharge_robot'), +(62831, 'spell_xt002_recharge_robot'), +(62835, 'spell_xt002_recharge_robot'); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 9f8a045ad8..f66053bcdb 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -896,6 +896,34 @@ private: uint32 _lastSummonTime{}; }; +// 62828, 62831, 62835 - Recharge Robot +// The core rolls a random point around the pile and takes its height from below, so a point that +// lands on a scrap heap keeps the floor under it. Ask from above the heaps instead. +class spell_xt002_recharge_robot : public SpellScript +{ + PrepareSpellScript(spell_xt002_recharge_robot); + + static constexpr float SearchAboveHeaps = 15.0f; // taller than any scrap heap in the room + + void SetDest(SpellDestination& dest) + { + Unit* caster = GetCaster(); + + float const z = caster->GetMapHeight(dest._position.GetPositionX(), dest._position.GetPositionY(), + caster->GetPositionZ() + SearchAboveHeaps); + if (z <= INVALID_HEIGHT) + return; + + dest._position.m_positionZ = z; + } + + void Register() override + { + OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_xt002_recharge_robot::SetDest, EFFECT_0, + TARGET_DEST_DEST_RANDOM); + } +}; + // 62775 - Tympanic Tantrum class spell_xt002_tympanic_tantrum : public SpellScript { @@ -1091,6 +1119,7 @@ void AddSC_boss_xt002() RegisterSpellScript(spell_xt002_gravity_bomb_damage); RegisterSpellScript(spell_xt002_heart_overload_periodic); RegisterUlduarCreatureAI(npc_xt_toy_pile); + RegisterSpellScript(spell_xt002_recharge_robot); RegisterSpellScript(spell_xt002_tympanic_tantrum); RegisterSpellScript(spell_xt002_321_boombot_aura); RegisterSpellScript(spell_xt002_exposed_heart);