From 3247c7e4d5a7c29ffdfba7f9acaeea8bf3fc505c Mon Sep 17 00:00:00 2001 From: Rocco Silipo <108557877+Rorschach91@users.noreply.github.com> Date: Mon, 31 Aug 2026 23:22:50 +0200 Subject: [PATCH] fix(Scripts/Ulduar): Salvaged Chopper should change Grab Pyrite with Eject Passenger when a player/Pyrite is on the passenger seat. (#27415) --- .../rev_1788207748399939900.sql | 5 +++ .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 44 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1788207748399939900.sql diff --git a/data/sql/updates/pending_db_world/rev_1788207748399939900.sql b/data/sql/updates/pending_db_world/rev_1788207748399939900.sql new file mode 100644 index 0000000000..d36a3062e6 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1788207748399939900.sql @@ -0,0 +1,5 @@ +-- +-- Ulduar: Salvaged Chopper - swap "Grab Pyrite" (67372) for "Eject Passenger" (67393) +-- while the rear seat is occupied. +-- 34045 (25-man) inherits ScriptName from its difficulty_entry_1 parent 33062. +UPDATE `creature_template` SET `ScriptName`='npc_salvaged_chopper' WHERE `entry`=33062; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index d00a79155c..a7c863c724 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1207,6 +1207,49 @@ struct boss_flame_leviathan_safety_container : public NullCreatureAI } }; +enum SalvagedChopper +{ + SPELL_GRAB_PYRITE = 67372, + SPELL_EJECT_PASSENGER = 67393, + + // The chopper's only other seat, carrying either a player or a grabbed pyrite crate. + SEAT_CHOPPER_PASSENGER = 1, +}; + +struct npc_salvaged_chopper : public VehicleAI +{ + npc_salvaged_chopper(Creature* creature) : VehicleAI(creature) { } + + // While the rear seat is taken, the "Grab Pyrite" button becomes "Eject Passenger". + void PassengerBoarded(Unit* /*who*/, int8 seatId, bool apply) override + { + if (seatId != SEAT_CHOPPER_PASSENGER) + return; + + if (apply) + SwapActionButton(SPELL_GRAB_PYRITE, SPELL_EJECT_PASSENGER); + else + SwapActionButton(SPELL_EJECT_PASSENGER, SPELL_GRAB_PYRITE); + } + +private: + void SwapActionButton(uint32 from, uint32 to) + { + bool swapped = false; + for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i) + if (me->m_spells[i] == from) + { + me->m_spells[i] = to; + swapped = true; + } + + // Resend the vehicle action bar, otherwise the driver keeps seeing the old button. + if (swapped) + if (Player* driver = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + driver->VehicleSpellInitialize(); + } +}; + class go_ulduar_tower : public GameObjectScript { public: @@ -1838,6 +1881,7 @@ void AddSC_boss_flame_leviathan() // Helpers RegisterUlduarCreatureAI(npc_storm_beacon_spawn); RegisterUlduarCreatureAI(boss_flame_leviathan_safety_container); + RegisterUlduarCreatureAI(npc_salvaged_chopper); // GOs new go_ulduar_tower();