diff --git a/sql/updates/world/custom/custom_2018_07_23_02_world.sql b/sql/updates/world/custom/custom_2018_07_23_02_world.sql new file mode 100644 index 00000000000..b64f29ca4de --- /dev/null +++ b/sql/updates/world/custom/custom_2018_07_23_02_world.sql @@ -0,0 +1,13 @@ +-- Creature Wind Tunnel Landing Zone 48097 +SET @ENTRY := 48097; +UPDATE `creature_template` SET `AIName`="", `ScriptName`= 'npc_lct_wind_tunnel_landing_zone' WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; + +-- Creature Wind Tunnel 48092 +SET @ENTRY := 48092; +UPDATE `creature_template` SET `AIName`="", `ScriptName`= 'npc_lct_wind_tunnel' WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; + +DELETE FROM `spell_script_names` WHERE `spell_id`= 79737; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(79737, 'spell_gen_eject_all_passengers'); diff --git a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.cpp b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.cpp index 4446ad93832..c84f27b2795 100644 --- a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.cpp +++ b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.cpp @@ -17,6 +17,7 @@ #include "lost_city_of_the_tolvir.h" #include "ScriptedCreature.h" +#include "SpellAuraEffects.h" enum Texts { @@ -26,12 +27,17 @@ enum Texts enum Events { - EVENT_SMOKE_BOMB = 1 + EVENT_SMOKE_BOMB = 1, + EVENT_EJECT_ALL_PASSENGERS, + EVENT_SLIPSTREAM, }; enum Spells { - SPELL_SMOKE_BOMB = 84768 + SPELL_SMOKE_BOMB = 84768, + SPELL_GENERIC_EJECT_ALL_PASSENGERS = 79737, + SPELL_RIDE_VEHICLE = 93970, + SPELL_SLIPSTREAM = 85016 }; class npc_lct_augh : public CreatureScript @@ -109,7 +115,91 @@ class npc_lct_augh : public CreatureScript } }; +struct npc_lct_wind_tunnel_landing_zone : public ScriptedAI +{ + npc_lct_wind_tunnel_landing_zone(Creature* creature) : ScriptedAI(creature) + { + me->SetDisableGravity(true); + me->SetExtraUnitMovementFlags(MOVEMENTFLAG2_NO_STRAFE | MOVEMENTFLAG2_NO_JUMPING); + } + + void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override + { + if (!who) + return; + + if (apply) + { + who->SetDisableGravity(true, true); + _events.ScheduleEvent(EVENT_EJECT_ALL_PASSENGERS, 1s + 500ms); + } + else + who->SetDisableGravity(false, true); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_EJECT_ALL_PASSENGERS: + DoCast(me, SPELL_GENERIC_EJECT_ALL_PASSENGERS); + break; + default: + break; + } + } + } + +private: + EventMap _events; +}; + +struct npc_lct_wind_tunnel : public ScriptedAI +{ + npc_lct_wind_tunnel(Creature* creature) : ScriptedAI(creature) { } + + void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override + { + if (!who) + return; + + if (apply) + { + who->SetDisableGravity(true, true); + _events.ScheduleEvent(EVENT_SLIPSTREAM, 500ms); + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SLIPSTREAM: + if (Aura* aura = me->GetAura(SPELL_RIDE_VEHICLE)) + if (Unit* target = aura->GetCaster()) + DoCast(target, SPELL_SLIPSTREAM, true); + break; + default: + break; + } + } + } + +private: + EventMap _events; +}; + void AddSC_lost_city_of_the_tolvir() { new npc_lct_augh(); + RegisterCreatureAI(npc_lct_wind_tunnel_landing_zone); + RegisterCreatureAI(npc_lct_wind_tunnel); } diff --git a/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp b/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp index ecf3fc20bad..778c9834213 100644 --- a/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp +++ b/src/server/scripts/Kalimdor/VortexPinnacle/vortex_pinnacle.cpp @@ -105,6 +105,9 @@ enum Events // Skyfall Star EVENT_FLY_RANDOM, + + // Slipstream Landing Zone + EVENT_EJECT_ALL_PASSENGERS }; enum Points @@ -248,14 +251,39 @@ public: me->SetExtraUnitMovementFlags(MOVEMENTFLAG2_NO_STRAFE | MOVEMENTFLAG2_NO_JUMPING); } - void PassengerBoarded(Unit* /*who*/, int8 /*seatId*/, bool apply) override + void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override { - if (!apply) + if (!who) return; - if (me->HasAura(SPELL_SLIPSTREAM_LAST_CONTROL_VEHICLE_AURA)) - DoCast(me, SPELL_GENERIC_EJECT_ALL_PASSENGERS); + if (apply) + { + who->SetDisableGravity(true, true); + _events.ScheduleEvent(EVENT_EJECT_ALL_PASSENGERS, 1s + 500ms); + } + else + who->SetDisableGravity(false, true); } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_EJECT_ALL_PASSENGERS: + DoCast(me, SPELL_GENERIC_EJECT_ALL_PASSENGERS); + break; + default: + break; + } + } + } + + private: + EventMap _events; }; CreatureAI* GetAI(Creature* creature) const override