Scripts/Quest: Fix some movement stuff for Quest "Death Comes From On High"

This commit is contained in:
Vincent-Michael
2014-08-28 20:16:16 +02:00
parent 51418b76ae
commit eccb0ed3da
3 changed files with 215 additions and 1 deletions

View File

@@ -26,6 +26,7 @@
#include "Player.h"
#include "SpellInfo.h"
#include "CreatureTextMgr.h"
#include "MoveSplineInit.h"
/*######
##Quest 12848
@@ -322,6 +323,117 @@ public:
};
/*######
## npc_eye_of_acherus
######*/
enum EyeOfAcherus
{
SPELL_EYE_VISUAL = 51892,
SPELL_EYE_FLIGHT_BOOST = 51923,
SPELL_EYE_FLIGHT = 51890,
EVENT_MOVE_START = 1,
TALK_MOVE_START = 0,
TALK_CONTROL = 1,
POINT_EYE_FALL = 1,
POINT_EYE_MOVE_END = 3
};
Position const EyeOFAcherusFallPoint = { 2361.21f, -5660.45f, 496.7444f, 0.0f };
class npc_eye_of_acherus : public CreatureScript
{
public:
npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { }
struct npc_eye_of_acherusAI : public ScriptedAI
{
npc_eye_of_acherusAI(Creature* creature) : ScriptedAI(creature)
{
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
owner->SendAutoRepeatCancel(me);
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->MovePoint(POINT_EYE_FALL, EyeOFAcherusFallPoint, false);
Movement::MoveSplineInit init(me);
init.MoveTo(EyeOFAcherusFallPoint.GetPositionX(), EyeOFAcherusFallPoint.GetPositionY(), EyeOFAcherusFallPoint.GetPositionZ(), false);
init.SetFall();
init.Launch();
}
void OnCharmed(bool /*apply*/) override { }
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_MOVE_START:
{
DoCast(me, SPELL_EYE_FLIGHT_BOOST);
me->SetControlled(false, UNIT_STATE_ROOT);
if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
{
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true);
Talk(TALK_MOVE_START, owner);
}
me->GetMotionMaster()->MovePath(me->GetEntry() * 100, false);
break;
}
default:
break;
}
}
}
void MovementInform(uint32 movementType, uint32 pointId) override
{
if (movementType == WAYPOINT_MOTION_TYPE && pointId == POINT_EYE_MOVE_END - 1)
{
me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE);
me->RemoveAllAuras();
if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
{
owner->RemoveAura(SPELL_EYE_FLIGHT_BOOST);
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true);
TalkToMap(TALK_CONTROL, owner);
}
me->SetDisableGravity(false);
DoCast(me, SPELL_EYE_FLIGHT);
}
if (movementType == POINT_MOTION_TYPE && pointId == POINT_EYE_FALL)
{
me->SetDisableGravity(true);
me->SetControlled(true, UNIT_STATE_ROOT);
_events.ScheduleEvent(EVENT_MOVE_START, 5000);
}
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_eye_of_acherusAI(creature);
}
};
/*######
## npc_death_knight_initiate
######*/
@@ -1079,6 +1191,7 @@ void AddSC_the_scarlet_enclave_c1()
new npc_unworthy_initiate();
new npc_unworthy_initiate_anchor();
new go_acherus_soul_prison();
new npc_eye_of_acherus();
new npc_death_knight_initiate();
new npc_salanar_the_horseman();
new npc_dark_rider_of_acherus();

View File

@@ -2026,7 +2026,6 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa
}
};
enum DeathComesFromOnHigh
{
SPELL_FORGE_CREDIT = 51974,
@@ -2097,6 +2096,37 @@ class spell_q12641_death_comes_from_on_high : public SpellScriptLoader
}
};
// 52694 - Recall Eye of Acherus
class spell_q12641_recall_eye_of_acherus : public SpellScriptLoader
{
public:
spell_q12641_recall_eye_of_acherus() : SpellScriptLoader("spell_q12641_recall_eye_of_acherus") { }
class spell_q12641_recall_eye_of_acherus_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q12641_recall_eye_of_acherus_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Player* player = GetCaster()->GetCharmerOrOwner()->ToPlayer())
{
player->StopCastingCharm();
player->StopCastingBindSight();
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q12641_recall_eye_of_acherus_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_q12641_recall_eye_of_acherus_SpellScript();
}
};
// 51769 - Emblazon Runeblade
class spell_q12619_emblazon_runeblade : public SpellScriptLoader
{
@@ -2364,6 +2394,7 @@ void AddSC_quest_spell_scripts()
new spell_q12308_escape_from_silverbrook_summon_worgen();
new spell_q12308_escape_from_silverbrook();
new spell_q12641_death_comes_from_on_high();
new spell_q12641_recall_eye_of_acherus();
new spell_q12619_emblazon_runeblade();
new spell_q12619_emblazon_runeblade_effect();
new spell_q12919_gymers_grab();