Scripts: improved script for Slipstream Landing Zone and used a own copy of it for the Wind Tunnels in the Lost City of the Tol'Vir

* added a missing scriptname to a eject all passenger spell
This commit is contained in:
Ovahlord
2018-07-23 17:17:55 +02:00
parent b6fa50b11c
commit b3d0adcccb
3 changed files with 137 additions and 6 deletions

View File

@@ -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');

View File

@@ -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);
}

View File

@@ -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