From c4bcab782b03c4db933446d962bb7f255f75d71f Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Tue, 13 Nov 2018 19:06:29 +0100 Subject: [PATCH] Scripts/LCT: fixed getting stuck in the Wind Tunnel when multiple players enter it at the same time --- .../lost_city_of_the_tolvir.cpp | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) 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 c84f27b2795..61190974048 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 @@ -28,8 +28,7 @@ enum Texts enum Events { EVENT_SMOKE_BOMB = 1, - EVENT_EJECT_ALL_PASSENGERS, - EVENT_SLIPSTREAM, + EVENT_EJECT_ALL_PASSENGERS }; enum Spells @@ -158,6 +157,22 @@ private: EventMap _events; }; +class SlipstreamEvent : public BasicEvent +{ + public: + SlipstreamEvent(Unit* owner, ObjectGuid windtunnelGuid) : _owner(owner), _windTunnelGUID(windtunnelGuid) { } + + bool Execute(uint64 /*time*/, uint32 /*diff*/) override + { + if (Creature* windtunnel = ObjectAccessor::GetCreature(*_owner, _windTunnelGUID)) + windtunnel->CastSpell(_owner, SPELL_SLIPSTREAM); + return true; + } + private: + Unit* _owner; + ObjectGuid _windTunnelGUID; +}; + struct npc_lct_wind_tunnel : public ScriptedAI { npc_lct_wind_tunnel(Creature* creature) : ScriptedAI(creature) { } @@ -170,26 +185,7 @@ struct npc_lct_wind_tunnel : public ScriptedAI 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; - } + who->m_Events.AddEvent(new SlipstreamEvent(who, me->GetGUID()), who->m_Events.CalculateTime(500)); } }