Scripts/Icecrown Citadel: Fixed possible exploits with Deathbringer Saurfang

This commit is contained in:
Shauren
2011-02-18 19:50:34 +01:00
parent 0f34df6e1a
commit aefbf30e4a
@@ -193,6 +193,7 @@ enum Actions
ACTION_CHARGE = -3781302, ACTION_CHARGE = -3781302,
ACTION_START_OUTRO = -3781303, ACTION_START_OUTRO = -3781303,
ACTION_DESPAWN = -3781304, ACTION_DESPAWN = -3781304,
ACTION_INTERRUPT_INTRO = -3781305,
ACTION_MARK_OF_THE_FALLEN_CHAMPION = -72293, ACTION_MARK_OF_THE_FALLEN_CHAMPION = -72293,
}; };
@@ -284,8 +285,15 @@ class boss_deathbringer_saurfang : public CreatureScript
me->setActive(true); me->setActive(true);
DoZoneInCombat(); DoZoneInCombat();
events.Reset();
events.SetPhase(PHASE_COMBAT); events.SetPhase(PHASE_COMBAT);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
if (!introDone)
{
DoCast(me, SPELL_GRIP_OF_AGONY);
if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SAURFANG_EVENT_NPC)))
creature->AI()->DoAction(ACTION_INTERRUPT_INTRO);
}
introDone = true; introDone = true;
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
@@ -510,6 +518,8 @@ class boss_deathbringer_saurfang : public CreatureScript
events.ScheduleEvent(EVENT_INTRO_HORDE_2, 5000, 0, PHASE_INTRO_H); events.ScheduleEvent(EVENT_INTRO_HORDE_2, 5000, 0, PHASE_INTRO_H);
break; break;
case ACTION_CONTINUE_INTRO: case ACTION_CONTINUE_INTRO:
if (introDone)
return;
events.ScheduleEvent(EVENT_INTRO_ALLIANCE_6, 6500+500, 0, PHASE_INTRO_A); events.ScheduleEvent(EVENT_INTRO_ALLIANCE_6, 6500+500, 0, PHASE_INTRO_A);
events.ScheduleEvent(EVENT_INTRO_FINISH, 8000, 0, PHASE_INTRO_A); events.ScheduleEvent(EVENT_INTRO_FINISH, 8000, 0, PHASE_INTRO_A);
@@ -564,7 +574,9 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
void DoAction(const int32 action) void DoAction(const int32 action)
{ {
if (action == ACTION_START_EVENT) switch (action)
{
case ACTION_START_EVENT:
{ {
// Prevent crashes // Prevent crashes
if (events.GetPhaseMask() & PHASE_INTRO_MASK) if (events.GetPhaseMask() & PHASE_INTRO_MASK)
@@ -587,8 +599,9 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
} }
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID)) if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID))
deathbringer->AI()->DoAction(PHASE_INTRO_H); deathbringer->AI()->DoAction(PHASE_INTRO_H);
break;
} }
else if (action == ACTION_START_OUTRO) case ACTION_START_OUTRO:
{ {
me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY);
Talk(SAY_OUTRO_HORDE_1); Talk(SAY_OUTRO_HORDE_1);
@@ -602,6 +615,15 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
me->SendMonsterMove(me->GetPositionX(), me->GetPositionY(), 539.2917f, SPLINEFLAG_FALLING, 0, 0.0f); me->SendMonsterMove(me->GetPositionX(), me->GetPositionY(), 539.2917f, SPLINEFLAG_FALLING, 0, 0.0f);
for (std::list<Creature*>::iterator itr = guardList.begin(); itr != guardList.end(); ++itr) for (std::list<Creature*>::iterator itr = guardList.begin(); itr != guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN); (*itr)->AI()->DoAction(ACTION_DESPAWN);
break;
}
case ACTION_INTERRUPT_INTRO:
events.Reset();
for (std::list<Creature*>::iterator itr = guardList.begin(); itr != guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
break;
default:
break;
} }
} }
@@ -619,8 +641,9 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
if (type != POINT_MOTION_TYPE) if (type != POINT_MOTION_TYPE)
return; return;
if (id == POINT_FIRST_STEP) switch (id)
{ {
case POINT_FIRST_STEP:
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
Talk(SAY_INTRO_HORDE_3); Talk(SAY_INTRO_HORDE_3);
events.ScheduleEvent(EVENT_INTRO_HORDE_5, 15500, 0, PHASE_INTRO_H); events.ScheduleEvent(EVENT_INTRO_HORDE_5, 15500, 0, PHASE_INTRO_H);
@@ -629,9 +652,8 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
events.ScheduleEvent(EVENT_INTRO_HORDE_8, 47000, 0, PHASE_INTRO_H); events.ScheduleEvent(EVENT_INTRO_HORDE_8, 47000, 0, PHASE_INTRO_H);
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID)) if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID))
deathbringer->AI()->DoAction(ACTION_CONTINUE_INTRO); deathbringer->AI()->DoAction(ACTION_CONTINUE_INTRO);
} break;
else if (id == POINT_CORPSE) case POINT_CORPSE:
{
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID)) if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID))
{ {
deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true); // for the packet logs. deathbringer->CastSpell(me, SPELL_RIDE_VEHICLE, true); // for the packet logs.
@@ -641,12 +663,14 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
} }
events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 1000); // move events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 1000); // move
events.ScheduleEvent(EVENT_OUTRO_HORDE_6, 4000); // say events.ScheduleEvent(EVENT_OUTRO_HORDE_6, 4000); // say
} break;
else if (id == POINT_FINAL) case POINT_FINAL:
{
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID)) if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID))
deathbringer->DespawnOrUnsummon(); deathbringer->DespawnOrUnsummon();
me->DespawnOrUnsummon(); me->DespawnOrUnsummon();
break;
default:
break;
} }
} }
@@ -761,7 +785,9 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
void DoAction(const int32 action) void DoAction(const int32 action)
{ {
if (action == ACTION_START_EVENT) switch (action)
{
case ACTION_START_EVENT:
{ {
// Prevent crashes // Prevent crashes
if (events.GetPhaseMask() & PHASE_INTRO_MASK) if (events.GetPhaseMask() & PHASE_INTRO_MASK)
@@ -784,8 +810,9 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
} }
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID)) if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, deathbringerSaurfangGUID))
deathbringer->AI()->DoAction(PHASE_INTRO_A); deathbringer->AI()->DoAction(PHASE_INTRO_A);
break;
} }
else if (action == ACTION_START_OUTRO) case ACTION_START_OUTRO:
{ {
me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY); me->RemoveAurasDueToSpell(SPELL_GRIP_OF_AGONY);
Talk(SAY_OUTRO_ALLIANCE_1); Talk(SAY_OUTRO_ALLIANCE_1);
@@ -795,6 +822,13 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
me->SendMonsterMove(me->GetPositionX(), me->GetPositionY(), 539.2917f, SPLINEFLAG_FALLING, 0, 0.0f); me->SendMonsterMove(me->GetPositionX(), me->GetPositionY(), 539.2917f, SPLINEFLAG_FALLING, 0, 0.0f);
for (std::list<Creature*>::iterator itr = guardList.begin(); itr != guardList.end(); ++itr) for (std::list<Creature*>::iterator itr = guardList.begin(); itr != guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN); (*itr)->AI()->DoAction(ACTION_DESPAWN);
break;
}
case ACTION_INTERRUPT_INTRO:
events.Reset();
for (std::list<Creature*>::iterator itr = guardList.begin(); itr != guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
break;
} }
} }
@@ -887,13 +921,13 @@ class npc_saurfang_event : public CreatureScript
{ {
npc_saurfang_eventAI(Creature* creature) : ScriptedAI(creature) npc_saurfang_eventAI(Creature* creature) : ScriptedAI(creature)
{ {
uiNPCindex = 0; npcIndex = 0;
} }
void SetData(uint32 type, uint32 data) void SetData(uint32 type, uint32 data)
{ {
ASSERT(!type && data && data < 6); ASSERT(!type && data && data < 6);
uiNPCindex = data; npcIndex = data;
} }
void SpellHit(Unit* /*caster*/, SpellEntry const* spell) void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
@@ -901,21 +935,20 @@ class npc_saurfang_event : public CreatureScript
if (spell->Id == SPELL_GRIP_OF_AGONY) if (spell->Id == SPELL_GRIP_OF_AGONY)
{ {
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[uiNPCindex]); me->GetMotionMaster()->MovePoint(POINT_CHOKE, chokePos[npcIndex]);
} }
} }
void DoAction(const int32 action) void DoAction(const int32 action)
{ {
if (action == ACTION_CHARGE && uiNPCindex) if (action == ACTION_CHARGE && npcIndex)
me->GetMotionMaster()->MoveCharge(chargePos[uiNPCindex].GetPositionX(), chargePos[uiNPCindex].GetPositionY(), chargePos[uiNPCindex].GetPositionZ(), 13.0f, POINT_CHARGE); me->GetMotionMaster()->MoveCharge(chargePos[npcIndex].GetPositionX(), chargePos[npcIndex].GetPositionY(), chargePos[npcIndex].GetPositionZ(), 13.0f, POINT_CHARGE);
else if (action == ACTION_DESPAWN) else if (action == ACTION_DESPAWN)
me->DespawnOrUnsummon(); me->DespawnOrUnsummon();
} }
private: private:
EventMap events; uint32 npcIndex;
uint32 uiNPCindex;
}; };
CreatureAI* GetAI(Creature* creature) const CreatureAI* GetAI(Creature* creature) const