Core/Scripts: Fix Skadi dismount issue

Closes #23005

(cherry picked from commit fe3bf57aba)
This commit is contained in:
sirikfoll
2019-05-02 15:46:46 -03:00
committed by Shauren
parent 46170fdf01
commit 03e03f3fc6
2 changed files with 33 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_skadi_ride_vehicle';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(61791,'spell_skadi_ride_vehicle');

View File

@@ -27,6 +27,7 @@
#include "SpellScript.h"
#include "TemporarySummon.h"
#include "utgarde_pinnacle.h"
#include "Vehicle.h"
enum Spells
{
@@ -262,9 +263,8 @@ public:
Talk(SAY_DRAKE_BREATH);
break;
case ACTION_GAUNTLET_END:
me->ExitVehicle();
Talk(SAY_DRAKE_DEATH);
DoCast(me, SPELL_SKADI_TELEPORT, true);
DoCastSelf(SPELL_SKADI_TELEPORT);
summons.DespawnEntry(NPC_WORLD_TRIGGER);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToPC(false);
@@ -350,7 +350,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
if (Creature* skadi = _instance->GetCreature(DATA_SKADI_THE_RUTHLESS))
skadi->AI()->DoAction(ACTION_GAUNTLET_END);
skadi->ExitVehicle();
me->DespawnOrUnsummon(Seconds(6));
}
@@ -358,7 +358,11 @@ public:
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
{
if (!apply)
{
if (Creature * skadi = _instance->GetCreature(DATA_SKADI_THE_RUTHLESS))
skadi->AI()->DoAction(ACTION_GAUNTLET_END);
return;
}
Movement::MoveSplineInit init(who);
init.DisableTransportPathTransformations();
@@ -843,6 +847,28 @@ class spell_skadi_poisoned_spear : public SpellScriptLoader
}
};
// 61791 - Ride Vehicle
class spell_skadi_ride_vehicle : public AuraScript
{
PrepareAuraScript(spell_skadi_ride_vehicle);
void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
GetTarget()->GetVehicleKit()->RemovePassenger(caster);
caster->SetControlled(false, UNIT_STATE_ROOT);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_skadi_ride_vehicle::OnRemoveVehicle, EFFECT_0, SPELL_AURA_CONTROL_VEHICLE, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_summon_gauntlet_mobs_periodic : public SpellScriptLoader
{
public:
@@ -962,6 +988,7 @@ void AddSC_boss_skadi()
new spell_skadi_reset_check();
new spell_skadi_launch_harpoon();
new spell_skadi_poisoned_spear();
RegisterAuraScript(spell_skadi_ride_vehicle);
new spell_summon_gauntlet_mobs_periodic();
new achievement_girl_love_to_skadi();
new at_skadi_gaunlet();