diff --git a/sql/updates/world/2013_10_08_00_world_conditions.sql b/sql/updates/world/2013_10_08_00_world_conditions.sql new file mode 100644 index 0000000000000..c167921b58ce4 --- /dev/null +++ b/sql/updates/world/2013_10_08_00_world_conditions.sql @@ -0,0 +1,9 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (69708,70194,69784,70224,70225,69768,69767); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 3, 69708, 0, 0, 31, 0, 3, 36954, 0, 0, 0, 0, '', 'Spell Ice Prison only hits Lich King'), +(13, 3, 70194, 0, 0, 31, 0, 3, 36954, 0, 0, 0, 0, '', 'Spell Dark Binding only hits Lich King'), +(13, 1, 69784, 0, 0, 31, 0, 3, 37014, 0, 0, 0, 0, '', 'Spell Destroy Wall only hits Ice Wall Target'), +(13, 1, 70224, 0, 0, 31, 0, 3, 37014, 0, 0, 0, 0, '', 'Spell Destroy Wall only hits Ice Wall Target'), +(13, 1, 70225, 0, 0, 31, 0, 3, 37014, 0, 0, 0, 0, '', 'Spell Destroy Wall only hits Ice Wall Target'), +(13, 1, 69768, 0, 0, 31, 0, 3, 37014, 0, 0, 0, 0, '', 'Spell Summon Ice Wall only hits Ice Wall Target'), +(13, 5, 69767, 0, 0, 31, 0, 3, 37014, 0, 0, 0, 0, '', 'Spell Summon Ice Wall only hits Ice Wall Target'); diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 987807c2080c7..04145b8784edb 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -181,7 +181,7 @@ enum Events EVENT_ESCAPE_13, EVENT_ESCAPE_14, EVENT_ESCAPE_15, - EVENT_ESCAPE_16, + //EVENT_ESCAPE_16, EVENT_ESCAPE_17, EVENT_ESCAPE_18, EVENT_ESCAPE_19, @@ -226,7 +226,7 @@ enum Spells SPELL_SOUL_REAPER = 69409, // Lich King Soul Reaper SPELL_FURY_OF_FROSTMOURNE = 70063, // Lich King Fury of FrostMourne SPELL_JAINA_DESTROY_ICE_WALL = 69784, // Jaina - SPELL_SYLVANAS_DESTROY_ICE_WALL = 70225, // Sylvanas + SPELL_SYLVANAS_DESTROY_ICE_WALL = 70224, // Sylvanas SPELL_SYLVANAS_JUMP = 68339, // Sylvanas Jump SPELL_RAISE_DEAD = 69818, SPELL_HARVEST_SOUL = 70070, @@ -234,16 +234,16 @@ enum Spells SPELL_SUMMON_LUMBERING_ABOMINATION = 69835, SPELL_SUMMON_ICE_WALL = 69768, // Visual effect and icewall summoning - //Raging gnoul + // Raging Ghoul SPELL_EMERGE_VISUAL = 50142, SPELL_GHOUL_JUMP = 70150, - //Witch Doctor + // Witch Doctor SPELL_COURSE_OF_DOOM = 70144, SPELL_SHADOW_BOLT_VOLLEY = 70145, SPELL_SHADOW_BOLT = 70080, - //Lumbering Abomination + // Lumbering Abomination SPELL_ABON_STRIKE = 40505, SPELL_VOMIT_SPRAY = 70176, }; @@ -344,6 +344,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript void UpdateAI(uint32 diff) OVERRIDE { _events.Update(diff); + switch (_events.ExecuteEvent()) { case EVENT_WALK_INTRO1: @@ -398,7 +399,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_5, 2000); break; case EVENT_INTRO_A2_5: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_1); _events.ScheduleEvent(EVENT_INTRO_A2_6, 3000); break; @@ -407,7 +408,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_7, 7000); break; case EVENT_INTRO_A2_7: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_2); _events.ScheduleEvent(EVENT_INTRO_A2_8, 7000); break; @@ -416,7 +417,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_9, 1200); break; case EVENT_INTRO_A2_9: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_3); _events.ScheduleEvent(EVENT_INTRO_A2_10, 11000); break; @@ -425,7 +426,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_11, 6000); break; case EVENT_INTRO_A2_11: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_4); _events.ScheduleEvent(EVENT_INTRO_A2_12, 12000); break; @@ -434,7 +435,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_13, 6000); break; case EVENT_INTRO_A2_13: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_5); _events.ScheduleEvent(EVENT_INTRO_A2_14, 13000); break; @@ -443,12 +444,12 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_15, 12000); break; case EVENT_INTRO_A2_15: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_6); _events.ScheduleEvent(EVENT_INTRO_A2_16, 25000); break; case EVENT_INTRO_A2_16: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_A2_7); _events.ScheduleEvent(EVENT_INTRO_A2_17, 6000); break; @@ -457,7 +458,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_A2_18, 5000); break; case EVENT_INTRO_A2_18: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) { uther->HandleEmoteCommand(EMOTE_ONESHOT_NO); uther->AI()->Talk(SAY_UTHER_INTRO_A2_8); @@ -494,7 +495,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_H2_5, 2000); break; case EVENT_INTRO_H2_5: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_H2_1); _events.ScheduleEvent(EVENT_INTRO_H2_6, 11000); break; @@ -503,7 +504,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_H2_7, 3000); break; case EVENT_INTRO_H2_7: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_H2_2); _events.ScheduleEvent(EVENT_INTRO_H2_8, 6000); break; @@ -512,7 +513,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_H2_9, 5000); break; case EVENT_INTRO_H2_9: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_H2_3); _events.ScheduleEvent(EVENT_INTRO_H2_10, 19000); break; @@ -521,7 +522,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_H2_11, 1500); break; case EVENT_INTRO_H2_11: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_H2_4); _events.ScheduleEvent(EVENT_INTRO_H2_12, 19500); break; @@ -530,7 +531,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_H2_13, 2000); break; case EVENT_INTRO_H2_13: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) { uther->HandleEmoteCommand(EMOTE_ONESHOT_NO); uther->AI()->Talk(SAY_UTHER_INTRO_H2_5); @@ -538,7 +539,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); break; case EVENT_INTRO_H2_14: - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) uther->AI()->Talk(SAY_UTHER_INTRO_H2_6); _events.ScheduleEvent(EVENT_INTRO_H2_15, 8000); break; @@ -557,7 +558,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_OPEN_FROSTWORN_DOOR, 0); _events.ScheduleEvent(EVENT_CLOSE_FROSTWORN_DOOR, 4000); } - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) { uther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) @@ -568,13 +569,13 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_LK_2, 10000); break; case EVENT_INTRO_LK_2: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->AI()->Talk(SAY_LK_INTRO_1); _events.ScheduleEvent(EVENT_INTRO_LK_3, 1000); break; case EVENT_INTRO_LK_3: // The Lich King banishes Uther to the abyss. - if (Creature* uther = me->GetCreature(*me, _utherGUID)) + if (Creature* uther = ObjectAccessor::GetCreature(*me, _utherGUID)) { uther->CastSpell(uther, SPELL_UTHER_DESPAWN, true); uther->DespawnOrUnsummon(5000); @@ -584,7 +585,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript break; case EVENT_INTRO_LK_4: // He steps forward and removes the runeblade from the heap of skulls. - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (GameObject* frostmourne = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_FROSTMOURNE))) frostmourne->SetPhaseMask(2, true); @@ -594,7 +595,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_LK_5, 8000); break; case EVENT_INTRO_LK_5: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->AI()->Talk(SAY_LK_INTRO_2); _events.ScheduleEvent(EVENT_INTRO_LK_6, 10000); break; @@ -610,7 +611,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true); marwyn->SetVisible(true); } - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->AI()->Talk(SAY_LK_INTRO_3); lichking->SetWalk(true); @@ -653,7 +654,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_LK_11, 5000); break; case EVENT_INTRO_LK_11: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) lichking->AI()->Talk(SAY_LK_JAINA_INTRO_END); @@ -666,7 +667,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript if (_instance) _instance->SetData(DATA_INTRO_EVENT, DONE); // Loralen or Koreln disappearAndDie() - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->DespawnOrUnsummon(5000); _lichkingGUID = 0; @@ -702,7 +703,7 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_jaina_or_sylvanas_horAI(creature); + return GetHallsOfReflectionAI(creature); } }; @@ -716,9 +717,8 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript { npc_jaina_or_sylvanas_escape_horAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _lichkingGUID(0), _walltargetGUID(0), - _icewallGUID(0), _icewall(0), _isattackingwall(0) + _icewallGUID(0), _icewall(0) { - _instance = me->GetInstanceScript(); } InstanceScript* _instance; @@ -726,33 +726,29 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript uint64 _walltargetGUID; // dummy uint64 _icewallGUID; // object uint32 _icewall; // icewall number - uint32 _isattackingwall; //sylvannas attacking icewall EventMap _events; - void Reset() OVERRIDE { _events.Reset(); - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->DespawnOrUnsummon(1); _lichkingGUID = 0; _walltargetGUID = 0; _icewallGUID = 0; _icewall = 0; - _isattackingwall = false; _events.ScheduleEvent(EVENT_ESCAPE, 0); } void JustDied(Unit* /*Killer*/) OVERRIDE { - if (_instance) _instance->SetData(DATA_ESCAPE_EVENT, FAIL); } - void DoAction(int32 actionID) OVERRIDE + void DoAction(int32 actionId) OVERRIDE { - switch (actionID) + switch (actionId) { case ACTION_START_ESCAPING: // called by InstanceScript when we need to start the escaping event _events.ScheduleEvent(EVENT_ESCAPE_1, 1000); @@ -760,10 +756,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript case ACTION_WALL_BROKEN: _icewall++; if (_icewall != 4) - _events.ScheduleEvent(EVENT_ESCAPE_17,3000); + _events.ScheduleEvent(EVENT_ESCAPE_17, 3000); else - _events.ScheduleEvent(EVENT_ESCAPE_23,3000); - _isattackingwall = false; + _events.ScheduleEvent(EVENT_ESCAPE_23, 3000); break; } } @@ -781,6 +776,19 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript } } + void DestroyIceWall() + { + if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + me->RemoveAurasDueToSpell(SPELL_JAINA_DESTROY_ICE_WALL); + else + me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL); + + _instance->HandleGameObject(_icewallGUID, true); + + if (Creature* wallTarget = ObjectAccessor::GetCreature(*me, _walltargetGUID)) + wallTarget->DespawnOrUnsummon(); + } + void UpdateAI(uint32 diff) OVERRIDE { _events.Update(diff); @@ -792,21 +800,21 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript case EVENT_ESCAPE: if (Creature* lichking = me->SummonCreature(NPC_LICH_KING_PART2, LichKingSpawnPos2, TEMPSUMMON_MANUAL_DESPAWN)) { - me->Attack(lichking,true); - lichking->Attack(me,true); + me->Attack(lichking, true); + lichking->Attack(me, true); me->SetReactState(REACT_PASSIVE); lichking->SetReactState(REACT_PASSIVE); _lichkingGUID = lichking->GetGUID(); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->DoCast(me, SPELL_JAINA_ICEBARRIER); + DoCast(me, SPELL_JAINA_ICEBARRIER); else - me->AI()->DoCast(me, SPELL_SYLVANAS_CLOAKOFDARKNESS); + DoCast(me, SPELL_SYLVANAS_CLOAKOFDARKNESS); } me->SetHealth(252000); break; case EVENT_ESCAPE_1: _instance->SetData(DATA_ESCAPE_EVENT, IN_PROGRESS); - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) lichking->AI()->Talk(SAY_LK_ESCAPE_1); @@ -817,30 +825,27 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_2: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->DoCast(me,SPELL_CAST_VISUAL,true); + DoCast(me, SPELL_CAST_VISUAL, true); else - me->AI()->DoCast(me,SPELL_SYLVANAS_JUMP,true); + DoCast(me, SPELL_SYLVANAS_JUMP, true); _events.ScheduleEvent(EVENT_ESCAPE_3, 1000); break; case EVENT_ESCAPE_3: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) - { - if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - lichking->AI()->DoCast(lichking, SPELL_JAINA_ICEPRISON, true); - else - lichking->AI()->DoCast(lichking, SPELL_SYLVANAS_DARKBINDING, true); - } + if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + DoCastAOE(SPELL_JAINA_ICEPRISON, true); + else + DoCastAOE(SPELL_SYLVANAS_DARKBINDING, true); _events.ScheduleEvent(EVENT_ESCAPE_4, 2000); break; case EVENT_ESCAPE_4: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->Talk(SAY_JAINA_ESCAPE_1); + Talk(SAY_JAINA_ESCAPE_1); else - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_1); + Talk(SAY_SYLVANAS_ESCAPE_1); _events.ScheduleEvent(EVENT_ESCAPE_5, 2000); break; case EVENT_ESCAPE_5: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->CombatStop(); me->GetMotionMaster()->MovePoint(0, JainaShadowThroneDoor); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) @@ -853,7 +858,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP|UNIT_NPC_FLAG_QUESTGIVER); break; case EVENT_ESCAPE_7: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) lichking->RemoveAurasDueToSpell(SPELL_JAINA_ICEPRISON); @@ -863,13 +868,13 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript _events.ScheduleEvent(EVENT_ESCAPE_8, 1000); break; case EVENT_ESCAPE_8: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->HandleEmoteCommand(TEXT_EMOTE_ROAR); me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]); _events.ScheduleEvent(EVENT_ESCAPE_9, 3000); break; case EVENT_ESCAPE_9: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[0]); _events.ScheduleEvent(EVENT_ESCAPE_10, 1000); break; @@ -879,39 +884,39 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_11: me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[2]); - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->GetMotionMaster()->MovePoint(0, LichKingFirstSummon); _events.ScheduleEvent(EVENT_ESCAPE_12, 6000); break; case EVENT_ESCAPE_12: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->AI()->Talk(SAY_LK_ESCAPE_3); lichking->AI()->DoCast(me, SPELL_RAISE_DEAD); - lichking->Attack(me,true); + lichking->Attack(me, true); } _events.ScheduleEvent(EVENT_ESCAPE_13, 4000); break; case EVENT_ESCAPE_13: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->AI()->DoCast(lichking, SPELL_REMORSELESS_WINTER, true); lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR); lichking->GetMotionMaster()->MoveIdle(); lichking->GetMotionMaster()->MoveChase(me); } - if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL,IceWalls[0].GetPositionX(), IceWalls[0].GetPositionY(), IceWalls[0].GetPositionZ(), IceWalls[0].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 720000)) + if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[0], TEMPSUMMON_MANUAL_DESPAWN, 720000)) { _walltargetGUID = walltarget->GetGUID(); walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL); walltarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->Attack(walltarget,false); + me->Attack(walltarget, false); } me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[3]); _events.ScheduleEvent(EVENT_ESCAPE_14, 8000); break; case EVENT_ESCAPE_14: - if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID)) + if (Creature* walltarget = ObjectAccessor::GetCreature(*me, _walltargetGUID)) { if (GameObject* icewall = walltarget->FindNearestGameObject(GO_ICE_WALL, 50.00f)) { @@ -919,61 +924,42 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript icewall->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); _instance->HandleGameObject(0, false, icewall); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->Talk(SAY_JAINA_ESCAPE_2); + Talk(SAY_JAINA_ESCAPE_2); else - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_2); + Talk(SAY_SYLVANAS_ESCAPE_2); } } _events.ScheduleEvent(EVENT_ESCAPE_15, 1000); break; case EVENT_ESCAPE_15: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->GetMotionMaster()->MoveIdle(); lichking->GetMotionMaster()->MoveChase(me); lichking->SetReactState(REACT_PASSIVE); } if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, false); + DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, true); else - { - _isattackingwall = true; - me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false); - _events.ScheduleEvent(EVENT_ESCAPE_16, 1000); - } - break; - case EVENT_ESCAPE_16: - if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE) - { - me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false); - if (_isattackingwall) - _events.ScheduleEvent(EVENT_ESCAPE_16, 1000); - } + DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, true); break; case EVENT_ESCAPE_17:// ICEWALL BROKEN me->GetMotionMaster()->MoveIdle(); - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->StopMoving(); lichking->AI()->Talk(SAY_LK_ESCAPE_3); lichking->AI()->DoCast(me, SPELL_RAISE_DEAD); } - if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID)) - walltarget->DespawnOrUnsummon(0); - if (GameObject* icewall = ObjectAccessor::GetGameObject(*me, _icewallGUID)) - { - _instance->HandleGameObject(0 ,true, icewall); - if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->RemoveAurasDueToSpell(SPELL_JAINA_DESTROY_ICE_WALL); - else - me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL); - } + + DestroyIceWall(); + if (_icewall && _icewall < 4) me->GetMotionMaster()->MovePoint(0, NpcJainaOrSylvanasEscapeRoute[_icewall + 3]); _events.ScheduleEvent(EVENT_ESCAPE_18, 2000); break; case EVENT_ESCAPE_18: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->GetMotionMaster()->MoveIdle(); lichking->GetMotionMaster()->MoveChase(me); @@ -981,29 +967,29 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript _events.ScheduleEvent(EVENT_ESCAPE_19, 6000); break; case EVENT_ESCAPE_19: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_icewall && _icewall < 4) lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR); lichking->GetMotionMaster()->MoveIdle(); lichking->GetMotionMaster()->MoveChase(me); lichking->SetReactState(REACT_PASSIVE); - lichking->Attack(me,true); + lichking->Attack(me, true); } if (_icewall < 4) { - if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[_icewall].GetPositionX(), IceWalls[_icewall].GetPositionY(), IceWalls[_icewall].GetPositionZ(), IceWalls[_icewall].GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 720000)) + if (Creature* walltarget = me->SummonCreature(NPC_ICE_WALL, IceWalls[_icewall], TEMPSUMMON_MANUAL_DESPAWN, 720000)) { _walltargetGUID = walltarget->GetGUID(); walltarget->AI()->DoCast(walltarget, SPELL_SUMMON_ICE_WALL); walltarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->Attack(walltarget,false); + me->Attack(walltarget, false); } } _events.ScheduleEvent(EVENT_ESCAPE_20, 3000); break; case EVENT_ESCAPE_20: - if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID)) + if (Creature* walltarget = ObjectAccessor::GetCreature(*me, _walltargetGUID)) { if (GameObject* icewall = walltarget->FindNearestGameObject(GO_ICE_WALL, 50.00f)) { @@ -1013,24 +999,24 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) { if (_icewall == 1) - me->AI()->Talk(SAY_JAINA_ESCAPE_3); + Talk(SAY_JAINA_ESCAPE_3); else if (_icewall == 2) - me->AI()->Talk(SAY_JAINA_ESCAPE_4); + Talk(SAY_JAINA_ESCAPE_4); else if (_icewall == 3) - me->AI()->Talk(SAY_JAINA_ESCAPE_5); + Talk(SAY_JAINA_ESCAPE_5); } else if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE) { if (_icewall == 1) - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_3); + Talk(SAY_SYLVANAS_ESCAPE_3); else if (_icewall == 2) - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_4); + Talk(SAY_SYLVANAS_ESCAPE_4); else if (_icewall == 3) - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_5); + Talk(SAY_SYLVANAS_ESCAPE_5); } } } - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_icewall && _icewall < 3) lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR); @@ -1044,53 +1030,37 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_21: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, false); + DoCast(me, SPELL_JAINA_DESTROY_ICE_WALL, true); else - { - me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false); - _isattackingwall = true; - _events.ScheduleEvent(EVENT_ESCAPE_22, 1000); - } - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, true); + + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_icewall == 1) lichking->AI()->DoCast(lichking, SPELL_SUMMON_LUMBERING_ABOMINATION); else if (_icewall > 1 && _icewall < 4) + { lichking->AI()->DoCast(lichking, SPELL_SUMMON_RISE_WITCH_DOCTOR); + _events.ScheduleEvent(EVENT_ESCAPE_22, 1000); + } } break; case EVENT_ESCAPE_22: - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { if (_icewall >= 2 && _icewall < 4) lichking->AI()->DoCast(lichking, SPELL_SUMMON_LUMBERING_ABOMINATION); } - if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE) - { - me->AI()->DoCast(me, SPELL_SYLVANAS_DESTROY_ICE_WALL, false); - if (_isattackingwall) - _events.ScheduleEvent(EVENT_ESCAPE_22, 1000); - } break; + case EVENT_ESCAPE_23: // FINAL PART + DestroyIceWall(); - case EVENT_ESCAPE_23:// FINAL PART - if (Creature* walltarget = me->GetCreature(*me, _walltargetGUID)) - walltarget->DespawnOrUnsummon(0); - if (GameObject* icewall = ObjectAccessor::GetGameObject(*me, _icewallGUID)) - { - _instance->HandleGameObject(0 ,true, icewall); - if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - { - me->RemoveAurasDueToSpell(SPELL_JAINA_DESTROY_ICE_WALL); - me->AI()->Talk(SAY_JAINA_ESCAPE_6); - } - else - { - me->RemoveAurasDueToSpell(SPELL_SYLVANAS_DESTROY_ICE_WALL); - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_6); - } - } - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + Talk(SAY_JAINA_ESCAPE_6); + else + Talk(SAY_SYLVANAS_ESCAPE_6); + + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) { lichking->GetMotionMaster()->MovePoint(0, LichKingFinalPos); lichking->AI()->Talk(SAY_LK_ESCAPE_11); @@ -1100,21 +1070,21 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_24: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->Talk(SAY_JAINA_ESCAPE_8); + Talk(SAY_JAINA_ESCAPE_8); else - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_8); + Talk(SAY_SYLVANAS_ESCAPE_8); _events.ScheduleEvent(EVENT_ESCAPE_25, 5000); break; case EVENT_ESCAPE_25: - if (GameObject* cave = _instance->instance->GetGameObject(_instance->GetData64(DATA_CAVE_IN))) - cave->SetGoState(GO_STATE_READY); + if (GameObject* cave = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_CAVE_IN))) + cave->SetGoState(GO_STATE_READY); _events.ScheduleEvent(EVENT_ESCAPE_26, 4000); break; case EVENT_ESCAPE_26: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->AI()->Talk(SAY_JAINA_ESCAPE_10); + Talk(SAY_JAINA_ESCAPE_10); else - me->AI()->Talk(SAY_SYLVANAS_ESCAPE_9); + Talk(SAY_SYLVANAS_ESCAPE_9); _events.ScheduleEvent(EVENT_ESCAPE_27, 4000); break; case EVENT_ESCAPE_27: @@ -1123,7 +1093,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript else me->SummonGameObject(GO_CAPTAIN_CHEST_3, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); me->SummonGameObject(GO_PORTAL, FinalPortalPos.GetPositionX(), FinalPortalPos.GetPositionY(), FinalPortalPos.GetPositionZ(), FinalPortalPos.GetOrientation(), 0, 0, 0, 0, 720000); - if (Creature* lichking = me->GetCreature(*me, _lichkingGUID)) + if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->DespawnOrUnsummon(1); break; } @@ -1133,7 +1103,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_jaina_or_sylvanas_escape_horAI(creature); + return GetHallsOfReflectionAI(creature); } }; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index 3223ecf66a558..d8d4f2d5524d6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -175,4 +175,10 @@ struct boss_horAI : ScriptedAI } }; +template +AI* GetHallsOfReflectionAI(Creature* creature) +{ + return GetInstanceAI(creature, HoRScriptName); +} + #endif