Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
- index 39b5dce..bdda79f 100755
- --- a/src/server/game/Scripting/ScriptLoader.cpp
- +++ b/src/server/game/Scripting/ScriptLoader.cpp
- @@ -485,6 +485,7 @@ void AddSC_instance_halls_of_reflection(); // Halls of Reflection
- void AddSC_halls_of_reflection();
- void AddSC_boss_falric();
- void AddSC_boss_marwyn();
- +void AddSC_boss_lich_king_hr();
- void AddSC_boss_lord_marrowgar(); // Icecrown Citadel
- void AddSC_boss_lady_deathwhisper();
- void AddSC_boss_deathbringer_saurfang();
- @@ -1208,6 +1209,7 @@ void AddNorthrendScripts()
- AddSC_halls_of_reflection();
- AddSC_boss_falric();
- AddSC_boss_marwyn();
- + AddSC_boss_lich_king_hr();
- AddSC_boss_lord_marrowgar(); // Icecrown Citadel
- AddSC_boss_lady_deathwhisper();
- AddSC_boss_deathbringer_saurfang();
- diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
- index 22d0f37..c2977d5 100644
- --- a/src/server/scripts/Northrend/CMakeLists.txt
- +++ b/src/server/scripts/Northrend/CMakeLists.txt
- @@ -54,6 +54,7 @@ set(scripts_STAT_SRCS
- Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
- Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
- Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
- + Northrend/FrozenHalls/HallsOfReflection/boss_the_lich_king_hor.cpp
- Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
- Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
- Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
- diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
- index 4df13d3..67a69ee 100644
- --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
- +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
- @@ -1,49 +1,50 @@
- /*
- - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
- *
- - * This program is free software; you can redistribute it and/or modify it
- - * under the terms of the GNU General Public License as published by the
- - * Free Software Foundation; either version 2 of the License, or (at your
- - * option) any later version.
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2 of the License, or
- + * (at your option) any later version.
- *
- - * This program is distributed in the hope that it will be useful, but WITHOUT
- - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- - * more details.
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- *
- - * You should have received a copy of the GNU General Public License along
- - * with this program. If not, see <http://www.gnu.org/licenses/>.
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- + /* ScriptData
- + SDName: boss_falric
- + SD%Complete: 0%
- + SDComment: new script for tc implementation.
- + SDCategory: Halls of Reflection
- + EndScriptData */
- +
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "halls_of_reflection.h"
- -enum Yells
- +enum
- {
- - SAY_AGGRO = -1668050,
- - SAY_SLAY_1 = -1668051,
- - SAY_SLAY_2 = -1668052,
- - SAY_DEATH = -1668053,
- - SAY_IMPENDING_DESPAIR = -1668054,
- - SAY_DEFILING_HORROR = -1668055,
- -};
- + SAY_FALRIC_AGGRO = -1668050,
- + SAY_FALRIC_DEATH = -1668053,
- + SAY_FALRIC_SLAY01 = -1668051,
- + SAY_FALRIC_SLAY02 = -1668052,
- + SAY_FALRIC_SP01 = -1668054,
- + SAY_FALRIC_SP02 = -1668055,
- -enum Spells
- -{
- - SPELL_QUIVERING_STRIKE = 72422,
- - SPELL_IMPENDING_DESPAIR = 72426,
- - SPELL_DEFILING_HORROR = 72435,
- - SPELL_HOPELESSNESS = 72395,
- - H_SPELL_HOPELESSNESS = 72390, // TODO: not in dbc. Add in DB.
- -};
- + SPELL_HOPELESSNESS = 72395,
- + SPELL_IMPENDING_DESPAIR = 72426,
- + SPELL_DEFILING_HORROR_N = 72435,
- + SPELL_DEFILING_HORROR_H = 72452,
- + SPELL_QUIVERING_STRIKE_N = 72422,
- + SPELL_QUIVERING_STRIKE_H = 72453,
- -enum Events
- -{
- - EVENT_NONE,
- - EVENT_QUIVERING_STRIKE,
- - EVENT_IMPENDING_DESPAIR,
- - EVENT_DEFILING_HORROR,
- + SPELL_BERSERK = 47008
- };
- class boss_falric : public CreatureScript
- @@ -51,94 +52,216 @@ class boss_falric : public CreatureScript
- public:
- boss_falric() : CreatureScript("boss_falric") { }
- - CreatureAI* GetAI(Creature* creature) const
- + struct boss_falricAI : public ScriptedAI
- {
- - return new boss_falricAI(creature);
- - }
- + boss_falricAI(Creature *pCreature) : ScriptedAI(pCreature)
- + {
- + m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- + Regular = pCreature->GetMap()->IsRegularDifficulty();
- + Reset();
- + }
- - struct boss_falricAI : public boss_horAI
- - {
- - boss_falricAI(Creature* creature) : boss_horAI(creature) {}
- + InstanceScript* m_pInstance;
- + bool Regular;
- + bool m_bIsCall;
- + //FUNCTIONS
- + uint32 m_uiBerserkTimer;
- + uint32 m_uiGrowlTimer;
- + uint32 m_uiHorrorTimer;
- + uint32 m_uiStrikeTimer;
- + uint32 m_uiSummonTimer;
- + uint32 m_uiLocNo;
- + uint64 m_uiSummonGUID[16];
- + uint32 m_uiCheckSummon;
- - uint8 uiHopelessnessCount;
- + uint8 SummonCount;
- +
- + uint64 pSummon;
- void Reset()
- {
- - boss_horAI::Reset();
- + m_uiBerserkTimer = 180000;
- + SummonCount = 0;
- + m_bIsCall = false;
- + m_uiGrowlTimer = 20000;
- + m_uiHorrorTimer = urand(14000,20000);
- + m_uiStrikeTimer = 2000;
- + m_uiSummonTimer = 11000;
- + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + me->SetVisible(false);
- + }
- - uiHopelessnessCount = 0;
- + void EnterCombat(Unit* victim)
- + {
- + //me->RemoveFlag(MOVEFLAG_WALK, NULL);
- + DoScriptText(SAY_FALRIC_AGGRO, me);
- + DoCast(me, SPELL_HOPELESSNESS);
- + }
- - if (instance)
- - instance->SetData(DATA_FALRIC_EVENT, NOT_STARTED);
- + void KilledUnit(Unit* victim)
- + {
- + switch(urand(0,1))
- + {
- + case 0: DoScriptText(SAY_FALRIC_SLAY01, me); break;
- + case 1: DoScriptText(SAY_FALRIC_SLAY02, me); break;
- + }
- }
- - void EnterCombat(Unit* /*who*/)
- + void JustDied(Unit* pKiller)
- {
- - DoScriptText(SAY_AGGRO, me);
- - if (instance)
- - instance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS);
- + if(!m_pInstance) return;
- + m_pInstance->SetData(TYPE_MARWYN, SPECIAL);
- + DoScriptText(SAY_FALRIC_DEATH, me);
- + }
- +
- + void AttackStart(Unit* who)
- + {
- + if(!m_pInstance) return;
- +
- + if(m_pInstance->GetData(TYPE_FALRIC) != IN_PROGRESS)
- + return;
- - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 23000);
- - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 9000);
- - events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000, 45000)); // TODO adjust timer.
- + ScriptedAI::AttackStart(who);
- }
- - void JustDied(Unit* /*killer*/)
- + void Summon()
- {
- - DoScriptText(SAY_DEATH, me);
- + m_uiLocNo = 0;
- - if (instance)
- - instance->SetData(DATA_FALRIC_EVENT, DONE);
- + for(uint8 i = 0; i < 14; i++)
- + {
- + switch(urand(0,3))
- + {
- + case 0:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_1; break;
- + case 2: pSummon = NPC_DARK_3; break;
- + case 3: pSummon = NPC_DARK_6; break;
- + }
- + break;
- + case 1:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_2; break;
- + case 2: pSummon = NPC_DARK_3; break;
- + case 3: pSummon = NPC_DARK_4; break;
- + }
- + break;
- + case 2:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_2; break;
- + case 2: pSummon = NPC_DARK_5; break;
- + case 3: pSummon = NPC_DARK_6; break;
- + }
- + break;
- + case 3:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_1; break;
- + case 2: pSummon = NPC_DARK_5; break;
- + case 3: pSummon = NPC_DARK_4; break;
- + }
- + break;
- + }
- +
- + m_uiCheckSummon = 0;
- +
- + if(Creature* Summon = me->SummonCreature(pSummon, SpawnLoc[m_uiLocNo].x, SpawnLoc[m_uiLocNo].y, SpawnLoc[m_uiLocNo].z, SpawnLoc[m_uiLocNo].o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
- + {
- + m_uiSummonGUID[i] = Summon->GetGUID();
- + Summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + Summon->setFaction(974);
- + Summon->SetReactState(REACT_PASSIVE);
- + }
- + m_uiLocNo++;
- + }
- }
- - void KilledUnit(Unit* /*victim*/)
- + void CallFallSoldier()
- {
- - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
- + for(uint8 i = 0; i < 4; i++)
- + {
- + if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID[m_uiCheckSummon]))
- + {
- + Summon->setFaction(14);
- + Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + Summon->SetReactState(REACT_AGGRESSIVE);
- + Summon->SetInCombatWithZone();
- + }
- + m_uiCheckSummon++;
- + }
- }
- - void UpdateAI(const uint32 diff)
- + void UpdateAI(const uint32 uiDiff)
- {
- - // Return since we have no target
- - if (!UpdateVictim())
- - return;
- + if(!m_pInstance) return;
- - events.Update(diff);
- + if (m_pInstance->GetData(TYPE_FALRIC) == SPECIAL)
- + {
- + if(!m_bIsCall)
- + {
- + m_bIsCall = true;
- + Summon();
- + }
- - if (me->HasUnitState(UNIT_STATE_CASTING))
- + if (m_uiSummonTimer < uiDiff)
- + {
- + ++SummonCount;
- + if(SummonCount > 4)
- + {
- + m_pInstance->SetData(TYPE_FALRIC, IN_PROGRESS);
- + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + me->SetInCombatWithZone();
- + }
- + else CallFallSoldier();
- + m_uiSummonTimer = 60000;
- + } else m_uiSummonTimer -= uiDiff;
- + }
- +
- + if (!UpdateVictim())
- return;
- - switch (events.ExecuteEvent())
- + if(m_uiStrikeTimer < uiDiff)
- {
- - case EVENT_QUIVERING_STRIKE:
- - DoCast(SPELL_QUIVERING_STRIKE);
- - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 10000);
- - break;
- - case EVENT_IMPENDING_DESPAIR:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - {
- - DoScriptText(SAY_IMPENDING_DESPAIR, me);
- - DoCast(target, SPELL_IMPENDING_DESPAIR);
- - }
- - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 13000);
- - break;
- - case EVENT_DEFILING_HORROR:
- - DoCast(SPELL_DEFILING_HORROR);
- - events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000, 45000)); // TODO adjust timer.
- - break;
- + DoCast(me->getVictim(), Regular ? SPELL_QUIVERING_STRIKE_N : SPELL_QUIVERING_STRIKE_H);
- + m_uiStrikeTimer = (urand(7000, 14000));
- }
- + else m_uiStrikeTimer -= uiDiff;
- - if ((uiHopelessnessCount < 1 && HealthBelowPct(66))
- - || (uiHopelessnessCount < 2 && HealthBelowPct(33))
- - || (uiHopelessnessCount < 3 && HealthBelowPct(10)))
- + if(m_uiHorrorTimer < uiDiff)
- {
- - uiHopelessnessCount++;
- - DoCast(DUNGEON_MODE(SPELL_HOPELESSNESS, H_SPELL_HOPELESSNESS));
- + DoScriptText(SAY_FALRIC_SP01, me);
- + if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_IMPENDING_DESPAIR);
- + m_uiHorrorTimer = (urand(15000, 25000));
- }
- + else m_uiHorrorTimer -= uiDiff;
- - DoMeleeAttackIfReady();
- + if(m_uiGrowlTimer < uiDiff)
- + {
- + DoScriptText(SAY_FALRIC_SP02, me);
- + DoCast(me->getVictim(), Regular ? SPELL_DEFILING_HORROR_N : SPELL_DEFILING_HORROR_H);
- + m_uiGrowlTimer = (urand(25000, 30000));
- + }
- + else m_uiGrowlTimer -= uiDiff;
- +
- + if (m_uiBerserkTimer < uiDiff)
- + {
- + DoCast(me, SPELL_BERSERK);
- + m_uiBerserkTimer = 180000;
- + } else m_uiBerserkTimer -= uiDiff;
- +
- + DoMeleeAttackIfReady();
- +
- + return;
- }
- };
- -
- + CreatureAI* GetAI(Creature* pCreature) const
- + {
- + return new boss_falricAI(pCreature);
- + }
- };
- void AddSC_boss_falric()
- diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
- index 8334a19..56af661 100644
- --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
- +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
- @@ -1,49 +1,52 @@
- /*
- - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
- *
- - * This program is free software; you can redistribute it and/or modify it
- - * under the terms of the GNU General Public License as published by the
- - * Free Software Foundation; either version 2 of the License, or (at your
- - * option) any later version.
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2 of the License, or
- + * (at your option) any later version.
- *
- - * This program is distributed in the hope that it will be useful, but WITHOUT
- - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- - * more details.
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- *
- - * You should have received a copy of the GNU General Public License along
- - * with this program. If not, see <http://www.gnu.org/licenses/>.
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- + /* ScriptData
- + SDName: boss_Marwyn
- + SD%Complete: 0%
- + SDComment: new script for tc implementation.
- + SDCategory: Halls of Reflection
- + EndScriptData */
- +
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "halls_of_reflection.h"
- -enum Yells
- +enum
- {
- - SAY_AGGRO = -1668060,
- - SAY_SLAY_1 = -1668061,
- - SAY_SLAY_2 = -1668062,
- - SAY_DEATH = -1668063,
- - SAY_CORRUPTED_FLESH_1 = -1668064,
- - SAY_CORRUPTED_FLESH_2 = -1668065,
- -};
- + SAY_MARWYN_INTRO = -1594506,
- + SAY_MARWYN_AGGRO = -1668060,
- + SAY_MARWYN_DEATH = -1668063,
- + SAY_MARWYN_SLAY01 = -1668061,
- + SAY_MARWYN_SLAY02 = -1668062,
- + SAY_MARWYN_SP01 = -1668064,
- + SAY_MARWYN_SP02 = -1668065,
- -enum Spells
- -{
- - SPELL_OBLITERATE = 72360,
- - SPELL_WELL_OF_CORRUPTION = 72362,
- - SPELL_CORRUPTED_FLESH = 72363,
- - SPELL_SHARED_SUFFERING = 72368,
- -};
- + SPELL_OBLITERATE_N = 72360,
- + SPELL_OBLITERATE_H = 72434,
- + SPELL_SHARED_SUFFERING_N = 72368,
- + SPELL_SHARED_SUFFERING_H = 72369,
- + SPELL_WELL_OF_CORRUPTION = 72362,
- + SPELL_CORRUPTED_FLESH_N = 72363,
- + SPELL_CORRUPTED_FLESH_H = 72436,
- -enum Events
- -{
- - EVENT_NONE,
- - EVENT_OBLITERATE,
- - EVENT_WELL_OF_CORRUPTION,
- - EVENT_CORRUPTED_FLESH,
- - EVENT_SHARED_SUFFERING,
- + SPELL_BERSERK = 47008,
- };
- class boss_marwyn : public CreatureScript
- @@ -51,84 +54,238 @@ class boss_marwyn : public CreatureScript
- public:
- boss_marwyn() : CreatureScript("boss_marwyn") { }
- - CreatureAI* GetAI(Creature* creature) const
- + struct boss_marwynAI : public ScriptedAI
- {
- - return new boss_marwynAI(creature);
- - }
- + boss_marwynAI(Creature *pCreature) : ScriptedAI(pCreature)
- + {
- + m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- + Regular = pCreature->GetMap()->IsRegularDifficulty();
- + Reset();
- + }
- - struct boss_marwynAI : public boss_horAI
- - {
- - boss_marwynAI(Creature* creature) : boss_horAI(creature) {}
- + InstanceScript* m_pInstance;
- + bool Regular;
- + bool m_bIsCall;
- +
- + //FUNCTIONS
- + uint32 m_uiBerserkTimer;
- + uint32 m_uiSharedSufferingTimer;
- + uint32 m_uiWellTimer;
- + uint32 m_uiTouchTimer;
- + uint32 m_uiFleshTimer;
- + uint32 m_uiObliterateTimer;
- + uint32 m_uiSummonTimer;
- +
- + uint32 m_uiLocNo;
- + uint64 m_uiSummonGUID[16];
- + uint32 m_uiCheckSummon;
- +
- + uint8 SummonCount;
- +
- + uint64 pSummon;
- - void Reset()
- + void Reset()
- + {
- + m_uiBerserkTimer = 180000;
- + m_uiSharedSufferingTimer = 4000;
- + m_uiWellTimer = 12000;
- + m_uiTouchTimer = 8000;
- + m_uiFleshTimer = 21000;
- + m_uiObliterateTimer = 5000;
- + SummonCount = 0;
- + m_bIsCall = false;
- + m_uiSummonTimer = 15000;
- + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + me->SetVisible(false);
- + }
- +
- + void Summon()
- {
- - boss_horAI::Reset();
- + m_uiLocNo = 14;
- +
- + for(uint8 i = 0; i < 14; i++)
- + {
- + switch(urand(0,3))
- + {
- + case 0:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_1; break;
- + case 2: pSummon = NPC_DARK_3; break;
- + case 3: pSummon = NPC_DARK_6; break;
- + }
- + break;
- + case 1:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_2; break;
- + case 2: pSummon = NPC_DARK_3; break;
- + case 3: pSummon = NPC_DARK_4; break;
- + }
- + break;
- + case 2:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_2; break;
- + case 2: pSummon = NPC_DARK_5; break;
- + case 3: pSummon = NPC_DARK_6; break;
- + }
- + break;
- + case 3:
- + switch(urand(1, 3))
- + {
- + case 1: pSummon = NPC_DARK_1; break;
- + case 2: pSummon = NPC_DARK_5; break;
- + case 3: pSummon = NPC_DARK_4; break;
- + }
- + break;
- + }
- - if (instance)
- - instance->SetData(DATA_MARWYN_EVENT, NOT_STARTED);
- + m_uiCheckSummon = 0;
- +
- + if(Creature* Summon = me->SummonCreature(pSummon, SpawnLoc[m_uiLocNo].x, SpawnLoc[m_uiLocNo].y, SpawnLoc[m_uiLocNo].z, SpawnLoc[m_uiLocNo].o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
- + {
- + m_uiSummonGUID[i] = Summon->GetGUID();
- + Summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + Summon->SetReactState(REACT_PASSIVE);
- + Summon->setFaction(974);
- + }
- + m_uiLocNo++;
- + }
- }
- - void EnterCombat(Unit* /*who*/)
- + void CallFallSoldier()
- {
- - DoScriptText(SAY_AGGRO, me);
- - if (instance)
- - instance->SetData(DATA_MARWYN_EVENT, IN_PROGRESS);
- -
- - events.ScheduleEvent(EVENT_OBLITERATE, 30000); // TODO Check timer
- - events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000);
- - events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000);
- - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); // TODO Check timer
- + for(uint8 i = 0; i < 4; i++)
- + {
- + if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID[m_uiCheckSummon]))
- + {
- + Summon->setFaction(14);
- + Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + Summon->SetReactState(REACT_AGGRESSIVE);
- + Summon->SetInCombatWithZone();
- + }
- + m_uiCheckSummon++;
- + }
- }
- - void JustDied(Unit* /*killer*/)
- + void JustDied(Unit* pKiller)
- {
- - DoScriptText(SAY_DEATH, me);
- + if(m_pInstance)
- + {
- + m_pInstance->SetData(TYPE_MARWYN, DONE);
- + m_pInstance->SetData(TYPE_PHASE, 3);
- + }
- - if (instance)
- - instance->SetData(DATA_MARWYN_EVENT, DONE);
- + DoScriptText(SAY_MARWYN_DEATH, me);
- }
- - void KilledUnit(Unit* /*victim*/)
- + void KilledUnit(Unit* victim)
- {
- - DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
- + switch(urand(0,1))
- + {
- + case 0: DoScriptText(SAY_MARWYN_SLAY01, me); break;
- + case 1: DoScriptText(SAY_MARWYN_SLAY02, me); break;
- + }
- }
- - void UpdateAI(const uint32 diff)
- + void EnterCombat(Unit* victim)
- {
- - // Return since we have no target
- - if (!UpdateVictim())
- - return;
- + if (!m_pInstance) return;
- + //me->RemoveFlag(MOVEFLAG_WALK, MOVEMENTFLAG_WALK_MODE);
- + DoScriptText(SAY_MARWYN_AGGRO, me);
- + }
- - events.Update(diff);
- + void AttackStart(Unit* who)
- + {
- + if (!m_pInstance) return;
- - if (me->HasUnitState(UNIT_STATE_CASTING))
- - return;
- + if (m_pInstance->GetData(TYPE_MARWYN) != IN_PROGRESS)
- + return;
- +
- + ScriptedAI::AttackStart(who);
- + }
- - switch (events.ExecuteEvent())
- + void UpdateAI(const uint32 uiDiff)
- + {
- + if(!m_pInstance) return;
- +
- + if (m_pInstance->GetData(TYPE_FALRIC) == SPECIAL)
- + {
- + if(!m_bIsCall)
- + {
- + m_bIsCall = true;
- + Summon();
- + }
- + }
- +
- + if(m_pInstance->GetData(TYPE_MARWYN) == SPECIAL)
- {
- - case EVENT_OBLITERATE:
- - DoCast(SPELL_OBLITERATE);
- - events.ScheduleEvent(EVENT_OBLITERATE, 30000);
- - break;
- - case EVENT_WELL_OF_CORRUPTION:
- - DoCast(SPELL_WELL_OF_CORRUPTION);
- - events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000);
- - break;
- - case EVENT_CORRUPTED_FLESH:
- - DoScriptText(RAND(SAY_CORRUPTED_FLESH_1, SAY_CORRUPTED_FLESH_2), me);
- - DoCast(SPELL_CORRUPTED_FLESH);
- - events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000);
- - break;
- - case EVENT_SHARED_SUFFERING:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_SHARED_SUFFERING);
- - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000);
- - break;
- + if(m_uiSummonTimer < uiDiff)
- + {
- + ++SummonCount;
- + if(SummonCount == 1)
- + DoScriptText(SAY_MARWYN_INTRO, me);
- +
- + if(SummonCount > 4)
- + {
- + m_pInstance->SetData(TYPE_MARWYN, IN_PROGRESS);
- + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- + me->SetInCombatWithZone();
- + }
- + else CallFallSoldier();
- + m_uiSummonTimer = 60000;
- + } else m_uiSummonTimer -= uiDiff;
- }
- + if(!UpdateVictim())
- + return;
- +
- + if(m_uiObliterateTimer < uiDiff)
- + {
- + DoCast(me->getVictim(), Regular ? SPELL_OBLITERATE_N : SPELL_OBLITERATE_H);
- + m_uiObliterateTimer = urand(8000, 12000);
- + } else m_uiObliterateTimer -= uiDiff;
- +
- + if (m_uiWellTimer < uiDiff)
- + {
- + DoScriptText(SAY_MARWYN_SP02, me);
- + if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_WELL_OF_CORRUPTION);
- + m_uiWellTimer= urand(25000, 30000);
- + } else m_uiWellTimer -= uiDiff;
- +
- + if (m_uiSharedSufferingTimer < uiDiff)
- + {
- + if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, Regular ? SPELL_SHARED_SUFFERING_N : SPELL_SHARED_SUFFERING_H);
- + m_uiSharedSufferingTimer = urand(15000, 20000);
- + } else m_uiSharedSufferingTimer -= uiDiff;
- +
- + if (m_uiFleshTimer < uiDiff)
- + {
- + DoScriptText(SAY_MARWYN_SP01, me);
- + if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, Regular ? SPELL_CORRUPTED_FLESH_N : SPELL_CORRUPTED_FLESH_H);
- + m_uiFleshTimer = urand(10000, 16000);
- + } else m_uiFleshTimer -= uiDiff;
- +
- + if(m_uiBerserkTimer < uiDiff)
- + {
- + DoCast(me, SPELL_BERSERK);
- + m_uiBerserkTimer = 180000;
- + } else m_uiBerserkTimer -= uiDiff;
- +
- DoMeleeAttackIfReady();
- +
- + return;
- }
- };
- + CreatureAI* GetAI(Creature* pCreature) const
- + {
- + return new boss_marwynAI(pCreature);
- + }
- };
- 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 26ec9e5..04861f7 100644
- --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
- +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
- @@ -1,555 +1,1401 @@
- /*
- - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
- *
- - * This program is free software; you can redistribute it and/or modify it
- - * under the terms of the GNU General Public License as published by the
- - * Free Software Foundation; either version 2 of the License, or (at your
- - * option) any later version.
- - *
- - * This program is distributed in the hope that it will be useful, but WITHOUT
- - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- - * more details.
- - *
- - * You should have received a copy of the GNU General Public License along
- - * with this program. If not, see <http://www.gnu.org/licenses/>.
- - */
- -
- +* This program is free software; you can redistribute it and/or modify
- +* it under the terms of the GNU General Public License as published by
- +* the Free Software Foundation; either version 2 of the License, or
- +* (at your option) any later version.
- +*
- +* This program is distributed in the hope that it will be useful,
- +* but WITHOUT ANY WARRANTY; without even the implied warranty of
- +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- +* GNU General Public License for more details.
- +*
- +* You should have received a copy of the GNU General Public License
- +* along with this program; if not, write to the Free Software
- +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- +*/
- +
- +#include "ScriptedEscortAI.h"
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "ScriptedGossip.h"
- #include "halls_of_reflection.h"
- -enum Yells
- +enum
- {
- - SAY_JAINA_INTRO_1 = -1668001,
- - SAY_JAINA_INTRO_2 = -1668002,
- - SAY_JAINA_INTRO_3 = -1668003,
- - SAY_JAINA_INTRO_4 = -1668004,
- - SAY_UTHER_INTRO_A2_1 = -1668005,
- - SAY_JAINA_INTRO_5 = -1668006,
- - SAY_UTHER_INTRO_A2_2 = -1668007,
- - SAY_JAINA_INTRO_6 = -1668008,
- - SAY_UTHER_INTRO_A2_3 = -1668009,
- - SAY_JAINA_INTRO_7 = -1668010,
- - SAY_UTHER_INTRO_A2_4 = -1668011,
- - SAY_JAINA_INTRO_8 = -1668012,
- - SAY_UTHER_INTRO_A2_5 = -1668013,
- - SAY_JAINA_INTRO_9 = -1668014,
- - SAY_UTHER_INTRO_A2_6 = -1668015,
- - SAY_UTHER_INTRO_A2_7 = -1668016,
- - SAY_JAINA_INTRO_10 = -1668017,
- - SAY_UTHER_INTRO_A2_8 = -1668018,
- - SAY_JAINA_INTRO_11 = -1668019,
- - SAY_UTHER_INTRO_A2_9 = -1668020,
- -
- - SAY_SYLVANAS_INTRO_1 = -1668021,
- - SAY_SYLVANAS_INTRO_2 = -1668022,
- - SAY_SYLVANAS_INTRO_3 = -1668023,
- - SAY_UTHER_INTRO_H2_1 = -1668024,
- - SAY_SYLVANAS_INTRO_4 = -1668025,
- - SAY_UTHER_INTRO_H2_2 = -1668026,
- - SAY_SYLVANAS_INTRO_5 = -1668027,
- - SAY_UTHER_INTRO_H2_3 = -1668028,
- - SAY_SYLVANAS_INTRO_6 = -1668029,
- - SAY_UTHER_INTRO_H2_4 = -1668030,
- - SAY_SYLVANAS_INTRO_7 = -1668031,
- - SAY_UTHER_INTRO_H2_5 = -1668032,
- - SAY_UTHER_INTRO_H2_6 = -1668033,
- - SAY_SYLVANAS_INTRO_8 = -1668034,
- - SAY_UTHER_INTRO_H2_7 = -1668035,
- -
- - SAY_LK_INTRO_1 = -1668036,
- - SAY_LK_INTRO_2 = -1668037,
- - SAY_LK_INTRO_3 = -1668038,
- - SAY_FALRIC_INTRO_1 = -1668039,
- - SAY_MARWYN_INTRO_1 = -1668040,
- - SAY_FALRIC_INTRO_2 = -1668041,
- -
- - SAY_JAINA_INTRO_END = -1668042,
- - SAY_SYLVANAS_INTRO_END = -1668043,
- + //Intro
- + SAY_JAINA_INTRO_01 = -1668001,
- + SAY_JAINA_INTRO_02 = -1668002,
- + SAY_JAINA_INTRO_03 = -1668003,
- + SAY_JAINA_INTRO_04 = -1668004,
- +
- + SAY_SYLVANA_INTRO_01 = -1668021,
- + SAY_SYLVANA_INTRO_02 = -1668022,
- + SAY_SYLVANA_INTRO_03 = -1668023,
- +
- + //Dialog with Uter
- + SAY_UTHER_A_01 = -1668005,
- + SAY_JAINA_02 = -1668006,
- + SAY_UTHER_A_03 = -1668007,
- + SAY_JAINA_04 = -1668008,
- + SAY_UTHER_A_05 = -1668009,
- + SAY_JAINA_06 = -1668010,
- + SAY_UTHER_A_07 = -1668011,
- + SAY_JAINA_08 = -1668012,
- + SAY_UTHER_A_09 = -1668013,
- + SAY_JAINA_10 = -1668014,
- + SAY_UTHER_A_11 = -1668015,
- + SAY_JAINA_12 = -1668017,
- + SAY_UTHER_A_13 = -1668016,
- + SAY_UTHER_A_14 = -1668018,
- + SAY_JAINA_15 = -1668019,
- +
- + SAY_UTHER_H_01 = -1668024,
- + SAY_SYLVANA_02 = -1668025,
- + SAY_UTHER_H_03 = -1668026,
- + SAY_SYLVANA_04 = -1668027,
- + SAY_UTHER_H_05 = -1668028,
- + SAY_SYLVANA_06 = -1668029,
- + SAY_UTHER_H_07 = -1668030,
- + SAY_SYLVANA_08 = -1668031,
- + SAY_UTHER_H_09 = -1668032,
- + SAY_UTHER_H_11 = -1668033,
- + SAY_SYLVANA_12 = -1668034,
- +
- + //Lich King dialog
- + SAY_UTHER_A_16 = -1668020,
- + SAY_JAINA_20 = -1668042,
- +
- +
- + SAY_UTHER_H_16 = -1668035,
- + SAY_SYLVANA_20 = -1668043,
- +
- + SAY_LICH_KING_17 = -1668036,
- + SAY_LICH_KING_18 = -1668037,
- + SAY_LICH_KING_19 = -1668038,
- + SAY_LICH_KING_A_21 = -1594473,
- + SAY_LICH_KING_H_21 = -1594474,
- +
- + SAY_FALRIC_INTRO = -1668039,
- + SAY_MARWYN_INTRO = -1668040,
- + SAY_FALRIC_INTRO2 = -1668041,
- +
- + /*INTRO - Pre Escape*/
- + SAY_LICH_KING_AGGRO_A = -1594477,
- + SAY_LICH_KING_AGGRO_H = -1594478,
- + SAY_JAINA_AGGRO = -1594479,
- + SAY_SYLVANA_AGGRO = -1594480,
- +
- + /*ESCAPE*/
- + SAY_JAINA_WALL_01 = -1594487,
- + SAY_SYLVANA_WALL_01 = -1594488,
- + SAY_JAINA_WALL_02 = -1594489,
- + SAY_SYLVANA_WALL_02 = -1594490,
- + SAY_LICH_KING_WALL_02 = -1594491,
- + SAY_LICH_KING_WALL_03 = -1594492,
- + SAY_LICH_KING_WALL_04 = -1594493,
- + SAY_JAINA_WALL_03 = -1594494,
- + SAY_JAINA_WALL_04 = -1594495,
- + SAY_SYLVANA_WALL_03 = -1594496,
- + SAY_SYLVANA_WALL_04 = -1594497,
- + SAY_JAINA_ESCAPE_01 = -1594498,
- + SAY_JAINA_ESCAPE_02 = -1594499,
- + SAY_SYLVANA_ESCAPE_01 = -1594500,
- + SAY_SYLVANA_ESCAPE_02 = -1594501,
- + SAY_JAINA_TRAP = -1594502,
- + SAY_SYLVANA_TRAP = -1594503,
- + SAY_MATHEAS_JAINA = -1594505,
- + SAY_LICH_KING_END_01 = -1594506,
- + SAY_LICH_KING_END_02 = -1594507,
- + SAY_LICH_KING_END_03 = -1594508,
- +
- + /*SPELLS AND VISUAL EFFECTS*/
- + SPELL_TAKE_FROSTMOURNE = 72729,
- + SPELL_FROSTMOURNE_DESPAWN = 72726,
- + SPELL_FROSTMOURNE_SOUNDS = 70667,
- + SPELL_CAST_VISUAL = 65633, //Jaina And Sylavana cast this when summon uther.
- + SPELL_BOSS_SPAWN_AURA = 72712, //Falric and Marwyn
- + SPELL_UTHER_DESPAWN = 70693,
- + SPELL_WINTER = 69780,
- + SPELL_FURY_OF_FROSTMOURNE = 70063,
- + SPELL_SOUL_REAPER = 73797,
- + SPELL_RAISE_DEAD = 69818,
- + SPELL_ICE_PRISON = 71321,
- + SPELL_ICE_PRISON_VISUAL = 69708,
- + SPELL_DARK_ARROW = 70194,
- + SPELL_ICE_BARRIER = 69787,
- + SPELL_DESTROY_ICE_WALL_01 = 69784, //Jaina
- + SPELL_DESTROY_ICE_WALL_02 = 70224,
- + SPELL_DESTROY_ICE_WALL_03 = 70225, //Sylvana
- + SPELL_SUMMON_ICE_WALL = 69784,
- + SPELL_SYLVANA_JUMP = 68339,
- + SPELL_SYLVANA_STEP = 69087,
- + SPELL_SILENCE = 69413,
- + SPELL_LICH_KING_CAST = 57561,
- + SPELL_FROSTMOURNE_VISUAL = 73220,
- + SPELL_SHIELD_DISRUPTION = 58291,
- +
- + FACTION = 2076,
- };
- -enum Events
- +class npc_jaina_and_sylvana_HRintro : public CreatureScript
- {
- - EVENT_NONE,
- -
- - EVENT_START_INTRO,
- - EVENT_SKIP_INTRO,
- -
- - EVENT_INTRO_A2_1,
- - EVENT_INTRO_A2_2,
- - EVENT_INTRO_A2_3,
- - EVENT_INTRO_A2_4,
- - EVENT_INTRO_A2_5,
- - EVENT_INTRO_A2_6,
- - EVENT_INTRO_A2_7,
- - EVENT_INTRO_A2_8,
- - EVENT_INTRO_A2_9,
- - EVENT_INTRO_A2_10,
- - EVENT_INTRO_A2_11,
- - EVENT_INTRO_A2_12,
- - EVENT_INTRO_A2_13,
- - EVENT_INTRO_A2_14,
- - EVENT_INTRO_A2_15,
- - EVENT_INTRO_A2_16,
- - EVENT_INTRO_A2_17,
- - EVENT_INTRO_A2_18,
- - EVENT_INTRO_A2_19,
- -
- - EVENT_INTRO_H2_1,
- - EVENT_INTRO_H2_2,
- - EVENT_INTRO_H2_3,
- - EVENT_INTRO_H2_4,
- - EVENT_INTRO_H2_5,
- - EVENT_INTRO_H2_6,
- - EVENT_INTRO_H2_7,
- - EVENT_INTRO_H2_8,
- - EVENT_INTRO_H2_9,
- - EVENT_INTRO_H2_10,
- - EVENT_INTRO_H2_11,
- - EVENT_INTRO_H2_12,
- - EVENT_INTRO_H2_13,
- - EVENT_INTRO_H2_14,
- - EVENT_INTRO_H2_15,
- -
- - EVENT_INTRO_LK_1,
- - EVENT_INTRO_LK_2,
- - EVENT_INTRO_LK_3,
- - EVENT_INTRO_LK_4,
- - EVENT_INTRO_LK_5,
- - EVENT_INTRO_LK_6,
- - EVENT_INTRO_LK_7,
- - EVENT_INTRO_LK_8,
- - EVENT_INTRO_LK_9,
- -
- - EVENT_INTRO_END,
- -};
- +public:
- + npc_jaina_and_sylvana_HRintro() : CreatureScript("npc_jaina_and_sylvana_HRintro") { }
- -enum eEnum
- -{
- - ACTION_START_INTRO,
- - ACTION_SKIP_INTRO,
- + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
- + {
- + InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- - QUEST_DELIVRANCE_FROM_THE_PIT_A2 = 24710,
- - QUEST_DELIVRANCE_FROM_THE_PIT_H2 = 24712,
- - QUEST_WRATH_OF_THE_LICH_KING_A2 = 24500,
- - QUEST_WRATH_OF_THE_LICH_KING_H2 = 24802,
- -};
- + if (!m_pInstance)
- + return false;
- -const Position HallsofReflectionLocs[]=
- -{
- - {5283.234863f, 1990.946777f, 707.695679f, 0.929097f}, // 2 Loralen Follows
- - {5408.031250f, 2102.918213f, 707.695251f, 0.792756f}, // 9 Sylvanas Follows
- - {5401.866699f, 2110.837402f, 707.695251f, 0.800610f}, // 10 Loralen follows
- -};
- + switch (uiAction)
- + {
- + case GOSSIP_ACTION_INFO_DEF+1:
- + pPlayer->CLOSE_GOSSIP_MENU();
- + m_pInstance->SetData(TYPE_EVENT, 1);
- + break;
- + }
- -const Position SpawnPos = {5262.540527f, 1949.693726f, 707.695007f, 0.808736f}; // Jaina/Sylvanas Beginning Position
- -const Position MoveThronePos = {5306.952148f, 1998.499023f, 709.341431f, 1.277278f}; // Jaina/Sylvanas walks to throne
- -const Position UtherSpawnPos = {5308.310059f, 2003.857178f, 709.341431f, 4.650315f};
- -const Position LichKingSpawnPos = {5362.917480f, 2062.307129f, 707.695374f, 3.945812f};
- -const Position LichKingMoveThronePos = {5312.080566f, 2009.172119f, 709.341431f, 3.973301f}; // Lich King walks to throne
- -const Position LichKingMoveAwayPos = {5400.069824f, 2102.7131689f, 707.69525f, 0.843803f}; // Lich King walks away
- + if(pPlayer->GetTeam() == ALLIANCE)
- + m_pInstance->SetData(DATA_LIDER, 1);
- + else
- + m_pInstance->SetData(DATA_LIDER, 2);
- -class npc_jaina_or_sylvanas_hor : public CreatureScript
- -{
- -private:
- - bool m_isSylvana;
- + m_pInstance->SetData64(DATA_ESCAPE_LIDER,pCreature->GetGUID());
- -public:
- - npc_jaina_or_sylvanas_hor(bool isSylvana, const char* name) : CreatureScript(name), m_isSylvana(isSylvana) { }
- + return true;
- + }
- - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- + bool OnGossipHello(Player* pPlayer, Creature* pCreature)
- {
- - player->PlayerTalkClass->ClearMenus();
- - switch (action)
- + InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- +
- + if(pCreature->isQuestGiver())
- + pPlayer->PrepareQuestMenu( pCreature->GetGUID());
- +
- + switch(pCreature->GetEntry())
- {
- - case GOSSIP_ACTION_INFO_DEF+1:
- - player->CLOSE_GOSSIP_MENU();
- - if (creature->AI())
- - creature->AI()->DoAction(ACTION_START_INTRO);
- - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + case NPC_JAINA:
- + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "???? ??????, ?? ?????? ? ????????? ??????!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- break;
- - case GOSSIP_ACTION_INFO_DEF+2:
- - player->CLOSE_GOSSIP_MENU();
- - if (creature->AI())
- - creature->AI()->DoAction(ACTION_SKIP_INTRO);
- - creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + case NPC_SYLVANA:
- + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "???? ????????, ?? ?????? ? ????????? ??????!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- break;
- }
- + pPlayer->PlayerTalkClass->SendGossipMenu(907,pCreature->GetGUID());
- return true;
- }
- - bool OnGossipHello(Player* player, Creature* creature)
- + struct npc_jaina_and_sylvana_HRintroAI : public ScriptedAI
- {
- - if (creature->isQuestGiver())
- - player->PrepareQuestMenu(creature->GetGUID());
- + npc_jaina_and_sylvana_HRintroAI(Creature *pCreature) : ScriptedAI(pCreature)
- + {
- + m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- + Reset();
- + }
- - QuestStatus status = player->GetQuestStatus(m_isSylvana ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2);
- - if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
- - player->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- + InstanceScript* m_pInstance;
- - // once last quest is completed, she offers this shortcut of the starting event
- - status = player->GetQuestStatus(m_isSylvana ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2);
- - if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
- - player->ADD_GOSSIP_ITEM( 0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- + uint32 StepTimer;
- + uint32 Step;
- + uint64 m_uiFrostmourneGUID;
- + uint64 m_uiMainGateGUID;
- + uint64 m_uiFalricGUID;
- + uint64 m_uiMarwynGUID;
- + Creature* pUther;
- + Creature* pLichKing;
- + bool Small;
- - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- - return true;
- - }
- + void Reset()
- + {
- + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + Small = false;
- + }
- +
- + void StartEvent()
- + {
- + if(!m_pInstance)
- + return
- + sLog->outDebug(LOG_FILTER_TSCR, "EventMGR: creature %u received signal %u ",me->GetEntry(),m_pInstance->GetData(TYPE_EVENT));
- + m_pInstance->SetData(TYPE_PHASE, 1);
- + m_pInstance->SetData(TYPE_EVENT, 0);
- + Step = 1;
- + StepTimer = 100;
- + }
- +
- + void JumpNextStep(uint32 Time)
- + {
- + StepTimer = Time;
- + Step++;
- + }
- - CreatureAI* GetAI(Creature* creature) const
- + void Event()
- + {
- + switch(Step)
- + {
- + case 1:
- + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + JumpNextStep(2000);
- + break;
- + case 2:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_INTRO_01, me);
- + JumpNextStep(5000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_INTRO_01, me);
- + JumpNextStep(8000);
- + }
- + break;
- + case 3:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_INTRO_02, me);
- + JumpNextStep(5000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + JumpNextStep(500);
- + break;
- + case 4:
- + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
- + me->GetMotionMaster()->MovePoint(0, 5307.031f, 1997.920f, 709.341f);
- + JumpNextStep(10000);
- + break;
- + case 5:
- + if(Creature* pTarget = me->SummonCreature(NPC_ALTAR_TARGET,5309.374f,2006.788f,711.615f,1.37f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000))
- + {
- + me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID());
- + pTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- + }
- + JumpNextStep(1000);
- + break;
- + case 6:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_INTRO_03, me);
- + JumpNextStep(5000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_INTRO_03, me);
- + //DoScriptText(SAY_SYLVANA_INTRO_02, me);
- + JumpNextStep(6000);
- + }
- + break;
- + case 7:
- + DoCast(me, SPELL_CAST_VISUAL);
- + if(me->GetEntry() == NPC_JAINA)
- + DoScriptText(SAY_JAINA_INTRO_04, me);
- + if(me->GetEntry() == NPC_SYLVANA)
- + DoScriptText(SAY_SYLVANA_INTRO_03, me);
- + JumpNextStep(3000);
- + break;
- + case 8:
- + DoCast(me, SPELL_FROSTMOURNE_SOUNDS);
- + m_uiFrostmourneGUID = m_pInstance->GetData64(GO_FROSTMOURNE);
- + if(GameObject* pFrostmourne = m_pInstance->instance->GetGameObject(m_uiFrostmourneGUID))
- + {
- + pFrostmourne->SetGoState(GO_STATE_ACTIVE);
- + }
- + if(me->GetEntry() == NPC_JAINA)
- + JumpNextStep(12000);
- + if(me->GetEntry() == NPC_SYLVANA)
- + JumpNextStep(8000);
- + break;
- + case 9:
- + if(Creature* Uther = me->SummonCreature(NPC_UTHER,5308.228f,2003.641f,709.341f,4.17f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000))
- + {
- + pUther = Uther;
- + Uther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID());
- + me->SetUInt64Value(UNIT_FIELD_TARGET, Uther->GetGUID());
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_UTHER_A_01, Uther);
- + JumpNextStep(3000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_UTHER_H_01, Uther);
- + JumpNextStep(10000);
- + }
- + }
- + break;
- + case 10:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_02, me);
- + JumpNextStep(5000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_02, me);
- + JumpNextStep(3000);
- + }
- + break;
- + case 11:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_03, pUther);
- + JumpNextStep(7000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA && pUther)
- + {
- + DoScriptText(SAY_UTHER_H_03, pUther);
- + JumpNextStep(6000);
- + }
- + if(Small)
- + Step = 24;
- + break;
- + case 12:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_04, me);
- + JumpNextStep(2000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_04, me);
- + JumpNextStep(5000);
- + }
- + break;
- + case 13:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_05, pUther);
- + JumpNextStep(10000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA && pUther)
- + {
- + DoScriptText(SAY_UTHER_H_05, pUther);
- + JumpNextStep(19000);
- + }
- + break;
- + case 14:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_06, me);
- + JumpNextStep(6000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_06, me);
- + JumpNextStep(2000);
- + }
- + break;
- + case 15:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_07, pUther);
- + JumpNextStep(12000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA && pUther)
- + {
- + DoScriptText(SAY_UTHER_H_07, pUther);
- + JumpNextStep(20000);
- + }
- + break;
- + case 16:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_08, me);
- + JumpNextStep(6000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_08, me);
- + JumpNextStep(3000);
- + }
- + break;
- + case 17:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_09, pUther);
- + JumpNextStep(12000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA && pUther)
- + {
- + DoScriptText(SAY_UTHER_H_09, pUther);
- + JumpNextStep(11000);
- + }
- + break;
- + case 18:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_10, me);
- + JumpNextStep(11000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + JumpNextStep(100);
- + }
- + break;
- + case 19:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_11, pUther);
- + JumpNextStep(24000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA && pUther)
- + {
- + DoScriptText(SAY_UTHER_H_11, pUther);
- + JumpNextStep(9000);
- + }
- + break;
- + case 20:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_12, me);
- + JumpNextStep(2000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + DoScriptText(SAY_SYLVANA_12, me);
- + JumpNextStep(2100);
- + }
- + break;
- + case 21:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_13, pUther);
- + JumpNextStep(5000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + JumpNextStep(100);
- + }
- + break;
- + case 22:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + {
- + DoScriptText(SAY_UTHER_A_14, pUther);
- + JumpNextStep(12000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + JumpNextStep(100);
- + }
- + break;
- + case 23:
- + if(me->GetEntry() == NPC_JAINA)
- + {
- + DoScriptText(SAY_JAINA_15, me);
- + JumpNextStep(2000);
- + }
- + if(me->GetEntry() == NPC_SYLVANA)
- + {
- + JumpNextStep(100);
- + }
- + break;
- + case 24:
- + if(me->GetEntry() == NPC_JAINA && pUther)
- + DoScriptText(SAY_UTHER_A_16, pUther);
- + if(me->GetEntry() == NPC_SYLVANA && pUther)
- + DoScriptText(SAY_UTHER_H_16, pUther);
- + m_uiMainGateGUID = m_pInstance->GetData64(GO_IMPENETRABLE_DOOR);
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
- + {
- + pGate->SetGoState(GO_STATE_ACTIVE);
- + }
- + if(Creature* LichKing = me->SummonCreature(NPC_LICH_KING,5362.469f,2062.342f,707.695f,3.97f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000))
- + {
- + pLichKing = LichKing;
- + LichKing->setActive(true);
- + }
- + JumpNextStep(1000);
- + break;
- + case 25:
- + if(pUther)
- + pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER);
- + if(pLichKing)
- + {
- + pLichKing->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + pLichKing->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
- + pLichKing->GetMotionMaster()->MovePoint(0, 5314.881f, 2012.496f, 709.341f);
- + }
- + JumpNextStep(3000);
- + break;
- + case 26:
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
- + pGate->SetGoState(GO_STATE_READY);
- + JumpNextStep(7000);
- + break;
- + case 27:
- + if(pUther)
- + pUther->CastSpell(pUther, SPELL_UTHER_DESPAWN, false);
- + JumpNextStep(500);
- + break;
- + case 28:
- + if(pLichKing)
- + DoScriptText(SAY_LICH_KING_17, pLichKing);
- + JumpNextStep(10000);
- + break;
- + case 29:
- + if(pLichKing)
- + DoScriptText(SAY_LICH_KING_18, pLichKing);
- + JumpNextStep(5000);
- + break;
- + case 30:
- + if(pLichKing)
- + pLichKing->CastSpell(pLichKing, SPELL_TAKE_FROSTMOURNE, false);
- + if(GameObject* pFrostmourne = m_pInstance->instance->GetGameObject(m_uiFrostmourneGUID))
- + pFrostmourne->SetGoState(GO_STATE_READY);
- + JumpNextStep(1500);
- + break;
- + case 31:
- + if(GameObject* pFrostmourne = m_pInstance->instance->GetGameObject(m_uiFrostmourneGUID))
- + pFrostmourne->SetPhaseMask(0, true);
- + if(pLichKing)
- + pLichKing->CastSpell(pLichKing, SPELL_FROSTMOURNE_VISUAL, false);
- + me->RemoveAurasDueToSpell(SPELL_FROSTMOURNE_SOUNDS);
- + JumpNextStep(5000);
- + break;
- + case 32:
- + if(pLichKing)
- + DoScriptText(SAY_LICH_KING_19, pLichKing);
- + JumpNextStep(9000);
- + break;
- + case 33:
- + m_uiFalricGUID = m_pInstance->GetData64(NPC_FALRIC);
- + m_uiMarwynGUID = m_pInstance->GetData64(NPC_MARWYN);
- + if(Creature* Falric = m_pInstance->instance->GetCreature(m_uiFalricGUID))
- + {
- + Falric->RemoveAllAuras();
- + Falric->SetVisible(true);
- + Falric->CastSpell(Falric, SPELL_BOSS_SPAWN_AURA, false);
- + Falric->GetMotionMaster()->MovePoint(0, 5283.309f, 2031.173f, 709.319f);
- + }
- + if(Creature* Marwyn = m_pInstance->instance->GetCreature(m_uiMarwynGUID))
- + {
- + Marwyn->RemoveAllAuras();
- + Marwyn->SetVisible(true);
- + Marwyn->CastSpell(Marwyn, SPELL_BOSS_SPAWN_AURA, false);
- + Marwyn->GetMotionMaster()->MovePoint(0, 5335.585f, 1981.439f, 709.319f);
- + }
- + if(pLichKing)
- + pLichKing->GetMotionMaster()->MovePoint(0, 5402.286f, 2104.496f, 707.695f);
- + JumpNextStep(600);
- + break;
- + case 34:
- + if(Creature* Falric = ((Creature*)Unit::GetUnit(*me, m_uiFalricGUID)))
- + DoScriptText(SAY_FALRIC_INTRO, Falric);
- + if(Creature* Marwyn = ((Creature*)Unit::GetUnit(*me, m_uiMarwynGUID)))
- + DoScriptText(SAY_MARWYN_INTRO, Marwyn);
- + JumpNextStep(3000);
- + break;
- + case 35:
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
- + pGate->SetGoState(GO_STATE_ACTIVE);
- + if(Creature* Falric = ((Creature*)Unit::GetUnit(*me, m_uiFalricGUID)))
- + DoScriptText(SAY_FALRIC_INTRO2, Falric);
- + m_pInstance->SetData(TYPE_FALRIC, SPECIAL);
- + JumpNextStep(4000);
- + break;
- + case 36:
- + if(me->GetEntry() == NPC_JAINA)
- + DoScriptText(SAY_JAINA_20, me);
- + if(me->GetEntry() == NPC_SYLVANA)
- + DoScriptText(SAY_SYLVANA_20, me);
- + me->GetMotionMaster()->MovePoint(0, 5443.880f, 2147.095f, 707.695f);
- + JumpNextStep(4000);
- + break;
- + case 37:
- + if(pLichKing)
- + {
- + pLichKing->GetMotionMaster()->MovementExpired(false);
- + pLichKing->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
- + pLichKing->GetMotionMaster()->MovePoint(0, 5443.880f, 2147.095f, 707.695f);
- + }
- + if(me->GetEntry() == NPC_JAINA && pLichKing)
- + DoScriptText(SAY_LICH_KING_A_21, pLichKing);
- + if(me->GetEntry() == NPC_SYLVANA && pLichKing)
- + DoScriptText(SAY_LICH_KING_H_21, pLichKing);
- + JumpNextStep(8000);
- + break;
- + case 38:
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
- + pGate->SetGoState(GO_STATE_READY);
- + JumpNextStep(5000);
- + break;
- + case 39:
- + me->SetVisible(false);
- + if(pLichKing)
- + pLichKing->SetVisible(false);
- + m_pInstance->SetData(TYPE_PHASE, 2);
- + JumpNextStep(1000);
- + break;
- + }
- + }
- +
- + void UpdateAI(const uint32 diff)
- + {
- + if(!m_pInstance)
- + return;
- +
- + if(m_pInstance->GetData(TYPE_EVENT) == 1
- + && m_pInstance->GetData64(DATA_ESCAPE_LIDER) == me->GetGUID())
- + StartEvent();
- +
- + if(m_pInstance->GetData(TYPE_EVENT) == 2
- + && m_pInstance->GetData64(DATA_ESCAPE_LIDER) == me->GetGUID())
- + {
- + Small = true;
- + StartEvent();
- + }
- +
- + if(StepTimer < diff && m_pInstance->GetData(TYPE_PHASE) == 1)
- + Event();
- + else StepTimer -= diff;
- +
- + return;
- + }
- + };
- +
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_jaina_or_sylvanas_horAI(creature);
- + return new npc_jaina_and_sylvana_HRintroAI(pCreature);
- }
- - // AI of Part1: handle the intro till start of gauntlet event.
- - struct npc_jaina_or_sylvanas_horAI : public ScriptedAI
- +};
- +
- +class npc_jaina_and_sylvana_HRextro : public CreatureScript
- +{
- +public:
- + npc_jaina_and_sylvana_HRextro() : CreatureScript("npc_jaina_and_sylvana_HRextro") { }
- +
- + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
- {
- - npc_jaina_or_sylvanas_horAI(Creature* creature) : ScriptedAI(creature)
- + InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- + switch (uiAction)
- {
- - instance = me->GetInstanceScript();
- + case GOSSIP_ACTION_INFO_DEF+1:
- + pPlayer->CLOSE_GOSSIP_MENU();
- + ((npc_jaina_and_sylvana_HRextroAI*)pCreature->AI())->Start(false,true);
- + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + pCreature->SetUInt64Value(UNIT_FIELD_TARGET, 0);
- + pCreature->setActive(true);
- +
- + if(m_pInstance)
- + {
- + m_pInstance->SetData64(DATA_ESCAPE_LIDER, pCreature->GetGUID());
- + m_pInstance->SetData(TYPE_LICH_KING, IN_PROGRESS);
- + m_pInstance->SetData(TYPE_PHASE, 5);
- + }
- + return true;
- + default:
- + return false;
- }
- + }
- - InstanceScript* instance;
- - uint64 uiUther;
- - uint64 uiLichKing;
- + bool OnGossipHello(Player* pPlayer, Creature* pCreature)
- + {
- + InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- - EventMap events;
- + if(!m_pInstance)
- + return false;
- - void Reset()
- - {
- - events.Reset();
- + if(m_pInstance->GetData(TYPE_LICH_KING) == DONE)
- + return false;
- - uiUther = 0;
- - uiLichKing = 0;
- + if(pCreature->isQuestGiver())
- + pPlayer->PrepareQuestMenu( pCreature->GetGUID());
- - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- - me->SetStandState(UNIT_STAND_STATE_STAND);
- - me->SetVisible(true);
- + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "????????!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- +
- + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
- +
- + return true;
- + }
- +
- + struct npc_jaina_and_sylvana_HRextroAI : public npc_escortAI
- + {
- + npc_jaina_and_sylvana_HRextroAI(Creature *pCreature) : npc_escortAI(pCreature)
- + {
- + m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- + Reset();
- }
- - void DoAction(const int32 actionId)
- + InstanceScript* m_pInstance;
- +
- + uint32 CastTimer;
- + uint32 StepTimer;
- + uint32 Step;
- + int32 HoldTimer;
- + uint32 Count;
- + bool Fight;
- + bool Event;
- + bool PreFight;
- + bool WallCast;
- + uint64 m_uiLichKingGUID;
- + uint64 m_uiLiderGUID;
- + uint64 m_uiIceWallGUID;
- + uint64 m_uipWallTargetGUID;
- + Creature* pLichKing;
- + uint32 m_chestID;
- +
- + void Reset()
- {
- - switch (actionId)
- + if(!m_pInstance)
- + return;
- +
- + if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
- + return;
- +
- + Step = 0;
- + StepTimer = 500;
- + Fight = true;
- + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + m_uipWallTargetGUID = 0;
- +
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- {
- - case ACTION_START_INTRO:
- - events.ScheduleEvent(EVENT_START_INTRO, 0);
- - break;
- - case ACTION_SKIP_INTRO:
- - events.ScheduleEvent(EVENT_SKIP_INTRO, 0);
- - break;
- + me->CastSpell(me, SPELL_ICE_BARRIER, false);
- + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2HL);
- }
- + if(m_pInstance->GetData(TYPE_LICH_KING) == DONE)
- + me->SetVisible(false);
- +
- }
- - void UpdateAI(const uint32 diff)
- + void AttackStart(Unit* who)
- {
- - events.Update(diff);
- - switch (events.ExecuteEvent())
- + if(!who)
- + return;
- +
- + if(me->GetEntry() != NPC_SYLVANA_OUTRO)
- + return;
- +
- + if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS || Fight != true)
- + return;
- +
- + npc_escortAI::AttackStart(who);
- +
- + }
- +
- + void JustDied(Unit* pKiller)
- + {
- + if(!m_pInstance)
- + return;
- + m_pInstance->SetData(TYPE_LICH_KING, FAIL);
- + }
- +
- + void WaypointReached(uint32 i)
- + {
- + switch(i)
- {
- - case EVENT_START_INTRO:
- - me->GetMotionMaster()->MovePoint(0, MoveThronePos);
- - // Begining of intro is differents between fActions as the speech sequence and timers are differents.
- - if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- - events.ScheduleEvent(EVENT_INTRO_A2_1, 0);
- - else
- - events.ScheduleEvent(EVENT_INTRO_H2_1, 0);
- + case 3:
- + m_pInstance->SetData(TYPE_ICE_WALL_01, IN_PROGRESS);
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_1)))
- + {
- + pGate->SetGoState(GO_STATE_READY);
- + m_uiIceWallGUID = pGate->GetGUID();
- + }
- break;
- -
- - // A2 Intro Events
- - case EVENT_INTRO_A2_1:
- - DoScriptText(SAY_JAINA_INTRO_3, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_2, 5000);
- + case 4:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_WALL_01, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_WALL_01, me);
- + CastTimer = 1000;
- + HoldTimer = 30000;
- + SetEscortPaused(true);
- + if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
- + {
- + m_uipWallTargetGUID = pWallTarget->GetGUID();
- + pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
- + }
- + WallCast = true;
- break;
- - case EVENT_INTRO_A2_2:
- - DoScriptText(SAY_JAINA_INTRO_4, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_3, 10000);
- + case 6:
- + m_pInstance->SetData(TYPE_ICE_WALL_02, IN_PROGRESS);
- + if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
- + {
- + if(pWallTarget->isAlive())
- + {
- + pWallTarget->DespawnOrUnsummon();
- + m_uipWallTargetGUID = 0;
- + }
- + }
- + break;
- + case 8:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_WALL_02, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_WALL_02, me);
- + CastTimer = 1000;
- + HoldTimer = 30000;
- + SetEscortPaused(true);
- + if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
- + {
- + m_uipWallTargetGUID = pWallTarget->GetGUID();
- + pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
- + }
- + WallCast = true;
- + break;
- + case 9:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_ESCAPE_01, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_ESCAPE_01, me);
- break;
- - case EVENT_INTRO_A2_3:
- - // TODO: she's doing some kind of spell casting emote
- - instance->HandleGameObject(instance->GetData64(DATA_FROSTMOURNE), true);
- - events.ScheduleEvent(EVENT_INTRO_A2_4, 10000);
- + case 11:
- + m_pInstance->SetData(TYPE_ICE_WALL_03, IN_PROGRESS);
- + if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
- + {
- + if(pWallTarget->isAlive())
- + {
- + pWallTarget->DespawnOrUnsummon();
- + m_uipWallTargetGUID = 0;
- + }
- + }
- break;
- - case EVENT_INTRO_A2_4:
- - // spawn UTHER during speach 2
- - if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
- + case 12:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_WALL_03, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_WALL_03, me);
- + CastTimer = 1000;
- + HoldTimer = 30000;
- + SetEscortPaused(true);
- + if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
- {
- - pUther->GetMotionMaster()->MoveIdle();
- - pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
- - uiUther = pUther->GetGUID();
- + m_uipWallTargetGUID = pWallTarget->GetGUID();
- + pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
- }
- - events.ScheduleEvent(EVENT_INTRO_A2_5, 2000);
- - break;
- - case EVENT_INTRO_A2_5:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_1, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_6, 3000);
- - break;
- - case EVENT_INTRO_A2_6:
- - DoScriptText(SAY_JAINA_INTRO_5, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_7, 6000);
- - break;
- - case EVENT_INTRO_A2_7:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_2, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_8, 6500);
- - break;
- - case EVENT_INTRO_A2_8:
- - DoScriptText(SAY_JAINA_INTRO_6, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_9, 2000);
- - break;
- - case EVENT_INTRO_A2_9:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_3, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_10, 9000);
- - break;
- - case EVENT_INTRO_A2_10:
- - DoScriptText(SAY_JAINA_INTRO_7, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_11, 5000);
- - break;
- - case EVENT_INTRO_A2_11:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_4, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_12, 11000);
- - break;
- - case EVENT_INTRO_A2_12:
- - DoScriptText(SAY_JAINA_INTRO_8, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_13, 4000);
- - break;
- - case EVENT_INTRO_A2_13:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_5, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_14, 12500);
- - break;
- - case EVENT_INTRO_A2_14:
- - DoScriptText(SAY_JAINA_INTRO_9, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_15, 10000);
- - break;
- - case EVENT_INTRO_A2_15:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_6, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_16, 22000);
- - break;
- - case EVENT_INTRO_A2_16:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_A2_7, pUther);
- - events.ScheduleEvent(EVENT_INTRO_A2_17, 4000);
- - break;
- - case EVENT_INTRO_A2_17:
- - DoScriptText(SAY_JAINA_INTRO_10, me);
- - events.ScheduleEvent(EVENT_INTRO_A2_18, 2000);
- - break;
- - case EVENT_INTRO_A2_18:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- + WallCast = true;
- + break;
- + case 13:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_ESCAPE_02, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_ESCAPE_02, me);
- + break;
- + case 15:
- + m_pInstance->SetData(TYPE_ICE_WALL_04, IN_PROGRESS);
- + if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
- {
- - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
- - DoScriptText(SAY_UTHER_INTRO_A2_8, pUther);
- + if(pWallTarget->isAlive())
- + {
- + pWallTarget->DespawnOrUnsummon();
- + m_uipWallTargetGUID = 0;
- + }
- }
- - events.ScheduleEvent(EVENT_INTRO_A2_19, 11000);
- break;
- - case EVENT_INTRO_A2_19:
- - DoScriptText(SAY_JAINA_INTRO_11, me);
- - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000);
- + case 16:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_WALL_04, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_WALL_04, me);
- + CastTimer = 1000;
- + HoldTimer = 30000;
- + SetEscortPaused(true);
- + if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
- + {
- + m_uipWallTargetGUID = pWallTarget->GetGUID();
- + pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
- + }
- + WallCast = true;
- break;
- -
- - // H2 Intro Events
- - case EVENT_INTRO_H2_1:
- - DoScriptText(SAY_SYLVANAS_INTRO_1, me);
- - events.ScheduleEvent(EVENT_INTRO_H2_2, 8000);
- + case 19:
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_JAINA_TRAP, me);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_TRAP, me);
- break;
- - case EVENT_INTRO_H2_2:
- - DoScriptText(SAY_SYLVANAS_INTRO_2, me);
- - events.ScheduleEvent(EVENT_INTRO_H2_3, 6000);
- + case 20:
- + if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
- + {
- + if(pWallTarget->isAlive())
- + {
- + pWallTarget->DespawnOrUnsummon();
- + m_uipWallTargetGUID = 0;
- + }
- + }
- + SetEscortPaused(true);
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2HL);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H);
- break;
- - case EVENT_INTRO_H2_3:
- - DoScriptText(SAY_SYLVANAS_INTRO_3, me);
- - // TODO: she's doing some kind of spell casting emote
- - events.ScheduleEvent(EVENT_INTRO_H2_4, 6000);
- + }
- + }
- +
- + void MoveInLineOfSight(Unit* who)
- + {
- + if(!who || !m_pInstance)
- + return;
- +
- + if(who->GetTypeId() != TYPEID_PLAYER)
- + return;
- +
- + Player* pPlayer = (Player *)who;
- +
- + if(pPlayer->GetTeam() == ALLIANCE && me->GetEntry() == NPC_SYLVANA_OUTRO)
- + return;
- +
- + if(pPlayer->GetTeam() == HORDE && me->GetEntry() == NPC_JAINA_OUTRO)
- + return;
- +
- + if(me->IsWithinDistInMap(who, 50.0f)
- + && m_pInstance->GetData(TYPE_FROST_GENERAL) == DONE
- + && m_pInstance->GetData(TYPE_PHASE) == 3)
- + {
- + pPlayer = (Player *)who;
- + Event = true;
- + me->setFaction(FACTION);
- + m_pInstance->SetData(TYPE_PHASE, 4);
- + }
- + }
- +
- + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
- + {
- + if(!m_pInstance)
- + return;
- +
- + if(m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
- + {
- + uiDamage = 0;
- + return;
- + }
- +
- + if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS && WallCast == true)
- + {
- + HoldTimer = HoldTimer + 100;
- + return;
- + }
- + }
- +
- + void JumpNextStep(uint32 Time)
- + {
- + StepTimer = Time;
- + Step++;
- + }
- +
- + void Intro()
- + {
- + switch(Step)
- + {
- + case 0:
- + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
- + m_uiLichKingGUID = m_pInstance->GetData64(BOSS_LICH_KING);
- + pLichKing = m_pInstance->instance->GetCreature(m_uiLichKingGUID);
- + JumpNextStep(100);
- break;
- - case EVENT_INTRO_H2_4:
- - // spawn UTHER during speach 2
- - if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
- + case 1:
- + if(pLichKing)
- {
- - pUther->GetMotionMaster()->MoveIdle();
- - pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
- - uiUther = pUther->GetGUID();
- + pLichKing->SetPhaseMask(65535, true);
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- + DoScriptText(SAY_LICH_KING_AGGRO_A, pLichKing);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_LICH_KING_AGGRO_H, pLichKing);
- + pLichKing->AI()->AttackStart(me);
- + me->AI()->AttackStart(pLichKing);
- }
- - events.ScheduleEvent(EVENT_INTRO_H2_5, 2000);
- - break;
- - case EVENT_INTRO_H2_5:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_H2_1, pUther);
- - events.ScheduleEvent(EVENT_INTRO_H2_6, 11000);
- - break;
- - case EVENT_INTRO_H2_6:
- - DoScriptText(SAY_SYLVANAS_INTRO_4, me);
- - events.ScheduleEvent(EVENT_INTRO_H2_7, 3000);
- - break;
- - case EVENT_INTRO_H2_7:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_H2_2, pUther);
- - events.ScheduleEvent(EVENT_INTRO_H2_8, 6000);
- - break;
- - case EVENT_INTRO_H2_8:
- - DoScriptText(SAY_SYLVANAS_INTRO_5, me);
- - events.ScheduleEvent(EVENT_INTRO_H2_9, 5000);
- - break;
- - case EVENT_INTRO_H2_9:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_H2_3, pUther);
- - events.ScheduleEvent(EVENT_INTRO_H2_10, 19000);
- - break;
- - case EVENT_INTRO_H2_10:
- - DoScriptText(SAY_SYLVANAS_INTRO_6, me);
- - events.ScheduleEvent(EVENT_INTRO_H2_11, 1500);
- - break;
- - case EVENT_INTRO_H2_11:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_H2_4, pUther);
- - events.ScheduleEvent(EVENT_INTRO_H2_12, 19500);
- - break;
- - case EVENT_INTRO_H2_12:
- - DoScriptText(SAY_SYLVANAS_INTRO_7, me);
- - events.ScheduleEvent(EVENT_INTRO_H2_13, 2000);
- - break;
- - case EVENT_INTRO_H2_13:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- + JumpNextStep(3000);
- + break;
- + case 2:
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- {
- - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
- - DoScriptText(SAY_UTHER_INTRO_H2_5, pUther);
- + Fight = false;
- + if(pLichKing)
- + me->GetMotionMaster()->MovePoint(0, (me->GetPositionX()-5)+rand()%10, (me->GetPositionY()-5)+rand()%10, me->GetPositionZ());
- + JumpNextStep(3000);
- }
- - events.ScheduleEvent(EVENT_INTRO_H2_14, 12000);
- + else
- + JumpNextStep(100);
- break;
- - case EVENT_INTRO_H2_14:
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - DoScriptText(SAY_UTHER_INTRO_H2_6, pUther);
- - events.ScheduleEvent(EVENT_INTRO_H2_15, 8000);
- + case 3:
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + Fight = true;
- + JumpNextStep(100);
- break;
- - case EVENT_INTRO_H2_15:
- - DoScriptText(SAY_SYLVANAS_INTRO_8, me);
- - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000);
- + case 4:
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + {
- + if(pLichKing)
- + me->CastSpell(pLichKing, SPELL_SYLVANA_STEP, false);
- + JumpNextStep(3000);
- + }
- + else
- + JumpNextStep(100);
- break;
- -
- - // Remaining Intro Events common for both faction
- - case EVENT_INTRO_LK_1:
- - // Spawn LK in front of door, and make him move to the sword.
- - if (Creature* pLichKing = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
- + case 5:
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- {
- - pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos);
- - pLichKing->SetReactState(REACT_PASSIVE);
- - uiLichKing = pLichKing->GetGUID();
- + Fight = false;
- + if(pLichKing)
- + me->GetMotionMaster()->MovePoint(0, (me->GetPositionX()-5)+rand()%10, (me->GetPositionY()-5)+rand()%10, me->GetPositionZ());
- + JumpNextStep(3000);
- }
- + else
- + JumpNextStep(12000);
- + break;
- + case 6:
- + Fight = true;
- +
- + if(pLichKing)
- + {
- + me->CastSpell(pLichKing, me->GetEntry() == NPC_JAINA_OUTRO ? SPELL_ICE_PRISON_VISUAL : SPELL_DARK_ARROW,true);
- + pLichKing->AttackStop();
- + }
- + JumpNextStep(2500);
- + break;
- + case 7:
- + if(pLichKing && !pLichKing->HasAura(SPELL_ICE_PRISON))
- + pLichKing->CastSpell(pLichKing,me->GetEntry() == NPC_JAINA_OUTRO ? SPELL_ICE_PRISON : SPELL_DARK_ARROW,true);
- +
- + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND);
- + me->AttackStop();
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- + if(me->GetEntry() == NPC_JAINA_OUTRO)
- {
- - if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- - DoScriptText(SAY_UTHER_INTRO_A2_9, pUther);
- - else
- - DoScriptText(SAY_UTHER_INTRO_H2_7, pUther);
- + me->RemoveAurasDueToSpell(SPELL_ICE_BARRIER);
- + DoScriptText(SAY_JAINA_AGGRO, me);
- }
- - events.ScheduleEvent(EVENT_INTRO_LK_2, 11000);
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + DoScriptText(SAY_SYLVANA_AGGRO, me);
- +
- + JumpNextStep(3000);
- + break;
- + case 8:
- + me->GetMotionMaster()->MovePoint(0, 5577.187f, 2236.003f, 733.012f);
- + if(pLichKing)
- + me->SetUInt64Value(UNIT_FIELD_TARGET, pLichKing->GetGUID());
- + JumpNextStep(10000);
- break;
- + case 9:
- + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + Count = 1;
- + JumpNextStep(100);
- + break;
- + }
- + }
- - case EVENT_INTRO_LK_2:
- - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
- - DoScriptText(SAY_LK_INTRO_1, pLichKing);
- - events.ScheduleEvent(EVENT_INTRO_LK_3, 2000);
- - break;
- + void Outro()
- + {
- + switch(Step)
- + {
- + case 10:
- + me->CastSpell(me, SPELL_SHIELD_DISRUPTION,false);
- + me->RemoveAurasDueToSpell(SPELL_SILENCE);
- + JumpNextStep(6000);
- + break;
- + case 11:
- + if(GameObject* pCave = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_CAVE)))
- + pCave->SetGoState(GO_STATE_READY);
- + me->CastSpell(me, SPELL_SHIELD_DISRUPTION,false);
- + me->GetMotionMaster()->MovePoint(0, 5258.911328f,1652.112f,784.295166f);
- + JumpNextStep(10000);
- + break;
- + case 12:
- + m_pInstance->SetData(TYPE_LICH_KING, DONE);
- + JumpNextStep(10000);
- + break;
- + case 13:
- + JumpNextStep(20000);
- + break;
- + case 14:
- + me->GetMotionMaster()->MovePoint(0, 5240.66f, 1646.93f, 784.302f);
- + JumpNextStep(5000);
- + break;
- + case 15:
- + me->SetOrientation(0.68f);
- + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- + QuestCompleate();
- + JumpNextStep(5000);
- + break;
- + }
- + }
- - case EVENT_INTRO_LK_3:
- - // The Lich King banishes Uther to the abyss.
- - if (Creature* pUther = me->GetCreature(*me, uiUther))
- - {
- - pUther->DisappearAndDie();
- - uiUther = 0;
- - }
- + void QuestCompleate()
- + {
- + if(m_pInstance)
- + {
- + Map::PlayerList const &PlayerList = m_pInstance->instance->GetPlayers();
- + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
- + {
- + i->getSource()->KilledMonsterCredit(36955, 0);
- + i->getSource()->KilledMonsterCredit(37554, 0);
- + }
- + }
- + }
- - // He steps forward and removes the runeblade from the heap of skulls.
- + void UpdateEscortAI(const uint32 diff)
- + {
- + if(!m_pInstance || !Event)
- + return;
- - events.ScheduleEvent(EVENT_INTRO_LK_4, 4000);
- - break;
- + DoMeleeAttackIfReady();
- - case EVENT_INTRO_LK_4:
- - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
- - DoScriptText(SAY_LK_INTRO_2, pLichKing);
- - events.ScheduleEvent(EVENT_INTRO_LK_5, 10000);
- - break;
- + if(m_pInstance->GetData(TYPE_PHASE) == 4)
- + {
- + if(StepTimer < diff)
- + Intro();
- + else
- + StepTimer -= diff;
- + }
- - case EVENT_INTRO_LK_5:
- - // summon Falric and Marwyn. then go back to the door
- - if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
- - pFalric->SetVisible(true);
- - if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
- - pMarwyn->SetVisible(true);
- + if(m_pInstance->GetData(TYPE_LICH_KING) == SPECIAL
- + && m_pInstance->GetData(TYPE_PHASE) != 6) //End Cinematic
- + {
- + m_pInstance->SetData(TYPE_PHASE, 6);
- + Step = 10;
- + }
- - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
- - {
- - pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
- - DoScriptText(SAY_LK_INTRO_3, pLichKing);
- - }
- + if (m_pInstance->GetData(TYPE_PHASE) == 6)
- + {
- + if(StepTimer < diff)
- + Outro();
- + else
- + StepTimer -= diff;
- + return;
- + }
- - events.ScheduleEvent(EVENT_INTRO_LK_6, 8000);
- - break;
- + if(WallCast == true && CastTimer < diff)
- + {
- + if(me->GetEntry() == NPC_SYLVANA_OUTRO)
- + {
- + if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
- + me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_03, false);
- + CastTimer = 1000;
- + }
- + }
- + else
- + CastTimer -= diff;
- - case EVENT_INTRO_LK_6:
- - if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
- - DoScriptText(SAY_FALRIC_INTRO_1, pFalric);
- + if (WallCast == true && HoldTimer < 10000 && ( m_pInstance->GetData(DATA_SUMMONS) == 0 || !me->isInCombat()))
- + {
- + WallCast = false;
- + me->InterruptNonMeleeSpells(false);
- + SetEscortPaused(false);
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiIceWallGUID))
- + pGate->SetGoState(GO_STATE_ACTIVE);
- + ++Count;
- + switch(Count)
- + {
- + case 2:
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_2)))
- + {
- + pGate->SetGoState(GO_STATE_READY);
- + if(pLichKing && pLichKing->isAlive())
- + DoScriptText(SAY_LICH_KING_WALL_02, pLichKing);
- + m_uiIceWallGUID = pGate->GetGUID();
- + }
- + break;
- + case 3:
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_3)))
- + {
- + pGate->SetGoState(GO_STATE_READY);
- + if(pLichKing && pLichKing->isAlive())
- + DoScriptText(SAY_LICH_KING_WALL_03, pLichKing);
- + m_uiIceWallGUID = pGate->GetGUID();
- + }
- + break;
- + case 4:
- + if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_4)))
- + {
- + pGate->SetGoState(GO_STATE_READY);
- + if(pLichKing && pLichKing->isAlive())
- + DoScriptText(SAY_LICH_KING_WALL_04, pLichKing);
- + m_uiIceWallGUID = pGate->GetGUID();
- + }
- + break;
- + case 5:
- + if(pLichKing && pLichKing->isAlive())
- + {
- + pLichKing->RemoveAurasDueToSpell(SPELL_WINTER);
- + pLichKing->SetSpeed(MOVE_WALK, 2.5f, true);
- + Step = 0;
- + }
- + break;
- + }
- + }
- + else
- + {
- + HoldTimer -= diff;
- + if (HoldTimer <= 0)
- + HoldTimer = 0;
- + }
- - events.ScheduleEvent(EVENT_INTRO_LK_7, 2000);
- - break;
- + return;
- + }
- + };
- - case EVENT_INTRO_LK_7:
- - if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
- - DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn);
- + CreatureAI* GetAI(Creature* pCreature) const
- + {
- + return new npc_jaina_and_sylvana_HRextroAI(pCreature);
- + }
- +};
- - events.ScheduleEvent(EVENT_INTRO_LK_8, 2000);
- - break;
- +class npc_lich_king_hr : public CreatureScript
- +{
- +public:
- + npc_lich_king_hr() : CreatureScript("npc_lich_king_hr") { }
- - case EVENT_INTRO_LK_8:
- - if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
- - DoScriptText(SAY_FALRIC_INTRO_2, pFalric);
- + struct npc_lich_king_hrAI : public ScriptedAI
- + {
- + npc_lich_king_hrAI(Creature *pCreature) : ScriptedAI(pCreature)
- + {
- + Reset();
- + }
- - events.ScheduleEvent(EVENT_INTRO_LK_9, 5000);
- - break;
- + void Reset()
- + {
- + }
- - case EVENT_INTRO_LK_9:
- - if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- - DoScriptText(SAY_JAINA_INTRO_END, me);
- - else
- - DoScriptText(SAY_SYLVANAS_INTRO_END, me);
- + void JustDied(Unit* pKiller)
- + {
- + }
- - me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
- - // TODO: Loralen/Koreln shall run also
- - events.ScheduleEvent(EVENT_INTRO_END, 10000);
- - break;
- + void AttackStart(Unit* who)
- + {
- + return;
- + }
- - case EVENT_INTRO_END:
- - if (instance)
- - instance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave
- + void UpdateAI(const uint32 diff)
- + {
- + }
- + };
- - // Loralen or Koreln disappearAndDie()
- - me->DisappearAndDie();
- - break;
- + CreatureAI* GetAI(Creature* pCreature) const
- + {
- + return new npc_lich_king_hrAI(pCreature);
- + }
- +};
- - case EVENT_SKIP_INTRO:
- - // TODO: implement
- +enum GENERAL_EVENT
- +{
- + SAY_AGGRO = -1594519,
- + SAY_DEATH = -1594520,
- - if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
- - pFalric->SetVisible(true);
- - if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
- - pMarwyn->SetVisible(true);
- + SPELL_SHIELD_THROWN = 69222,
- + SPELL_SPIKE = 59446 // this is not right spell!
- +};
- - me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
- - // TODO: Loralen/Koreln shall run also
- +class npc_frostworn_general : public CreatureScript
- +{
- +public:
- + npc_frostworn_general() : CreatureScript("npc_frostworn_general") { }
- - events.ScheduleEvent(EVENT_INTRO_END, 15000);
- - break;
- + struct npc_frostworn_generalAI : public ScriptedAI
- + {
- + npc_frostworn_generalAI(Creature *pCreature) : ScriptedAI(pCreature)
- + {
- + m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
- + Reset();
- + }
- +
- + InstanceScript* m_pInstance;
- +
- + uint32 m_uiShieldTimer;
- + uint32 m_uiSpikeTimer;
- +
- + void Reset()
- + {
- + if (!m_pInstance)
- + return;
- + m_uiShieldTimer = 5000;
- + m_uiSpikeTimer = 14000;
- + m_pInstance->SetData(TYPE_FROST_GENERAL, NOT_STARTED);
- + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- + }
- +
- + void JustDied(Unit* pKiller)
- + {
- + if (!m_pInstance)
- + return;
- + DoScriptText(SAY_DEATH, me);
- + m_pInstance->SetData(TYPE_FROST_GENERAL, DONE);
- +
- + me->SummonCreature(BOSS_LICH_KING, 5564.25f, 2274.69f, 733.01f, 3.93f, TEMPSUMMON_DEAD_DESPAWN);
- +
- + if(m_pInstance->GetData(DATA_TEAM_IN_INSTANCE)==ALLIANCE)
- + me->SummonCreature(NPC_JAINA_OUTRO, 5556.27f, 2266.28f, 733.01f, 0.8f, TEMPSUMMON_DEAD_DESPAWN);
- + else
- + me->SummonCreature(NPC_SYLVANA_OUTRO, 5556.27f, 2266.28f, 733.01f, 0.8f, TEMPSUMMON_DEAD_DESPAWN);
- + }
- +
- + void MoveInLineOfSight(Unit* pWho)
- + {
- + if (!m_pInstance)
- + return;
- +
- + if (me->getVictim())
- + return;
- +
- + if (pWho->GetTypeId() != TYPEID_PLAYER
- + || m_pInstance->GetData(TYPE_MARWYN) != DONE
- + || !me->IsWithinDistInMap(pWho, 20.0f)
- + ) return;
- +
- + if (Player* pPlayer = (Player*)pWho)
- + if (pPlayer->isGameMaster())
- + return;
- +
- + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- +
- + AttackStart(pWho);
- + }
- +
- + void EnterCombat(Unit* victim)
- + {
- + if (!m_pInstance)
- + return;
- + DoScriptText(SAY_AGGRO, me);
- + m_pInstance->SetData(TYPE_FROST_GENERAL, IN_PROGRESS);
- + }
- +
- + void UpdateAI(const uint32 uiDiff)
- + {
- + if(!UpdateVictim())
- + return;
- +
- + if(m_uiShieldTimer < uiDiff)
- + {
- + if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
- + DoCast(pTarget,SPELL_SHIELD_THROWN);
- + m_uiShieldTimer = urand(8000, 12000);
- }
- + else
- + m_uiShieldTimer -= uiDiff;
- +
- + if (m_uiSpikeTimer < uiDiff)
- + {
- + if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
- + DoCast(pTarget, SPELL_SPIKE);
- + m_uiSpikeTimer = urand(15000, 20000);
- + }
- + else
- + m_uiSpikeTimer -= uiDiff;
- +
- + DoMeleeAttackIfReady();
- }
- };
- -
- + CreatureAI* GetAI(Creature* pCreature) const
- + {
- + return new npc_frostworn_generalAI(pCreature);
- + }
- };
- enum TrashSpells
- @@ -628,14 +1474,14 @@ class npc_ghostly_priest : public CreatureScript
- public:
- npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { }
- - CreatureAI* GetAI(Creature* creature) const
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_ghostly_priestAI(creature);
- + return new npc_ghostly_priestAI(pCreature);
- }
- struct npc_ghostly_priestAI: public ScriptedAI
- {
- - npc_ghostly_priestAI(Creature* creature) : ScriptedAI(creature)
- + npc_ghostly_priestAI(Creature *c) : ScriptedAI(c)
- {
- }
- @@ -666,28 +1512,28 @@ public:
- while (uint32 eventId = events.ExecuteEvent())
- {
- - switch (eventId)
- + switch(eventId)
- {
- case EVENT_SHADOW_WORD_PAIN:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_SHADOW_WORD_PAIN);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_SHADOW_WORD_PAIN);
- events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000);
- return;
- case EVENT_CIRCLE_OF_DESTRUCTION:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_CIRCLE_OF_DESTRUCTION);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_CIRCLE_OF_DESTRUCTION);
- events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000);
- return;
- case EVENT_COWER_IN_FEAR:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_COWER_IN_FEAR);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_COWER_IN_FEAR);
- events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000);
- return;
- case EVENT_DARK_MENDING:
- // find an ally with missing HP
- - if (Unit* target = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000, 50000)))
- + if (Unit *pTarget = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000, 50000)))
- {
- - DoCast(target, SPELL_DARK_MENDING);
- + DoCast(pTarget, SPELL_DARK_MENDING);
- events.ScheduleEvent(EVENT_DARK_MENDING, 20000);
- }
- else
- @@ -710,14 +1556,14 @@ class npc_phantom_mage : public CreatureScript
- public:
- npc_phantom_mage() : CreatureScript("npc_phantom_mage") { }
- - CreatureAI* GetAI(Creature* creature) const
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_phantom_mageAI(creature);
- + return new npc_phantom_mageAI(pCreature);
- }
- struct npc_phantom_mageAI: public ScriptedAI
- {
- - npc_phantom_mageAI(Creature* creature) : ScriptedAI(creature)
- + npc_phantom_mageAI(Creature *c) : ScriptedAI(c)
- {
- }
- @@ -749,11 +1595,11 @@ public:
- while (uint32 eventId = events.ExecuteEvent())
- {
- - switch (eventId)
- + switch(eventId)
- {
- case EVENT_FIREBALL:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_FIREBALL);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_FIREBALL);
- events.ScheduleEvent(EVENT_FIREBALL, 15000);
- return;
- case EVENT_FLAMESTRIKE:
- @@ -761,13 +1607,13 @@ public:
- events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000);
- return;
- case EVENT_FROSTBOLT:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_FROSTBOLT);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_FROSTBOLT);
- events.ScheduleEvent(EVENT_FROSTBOLT, 15000);
- return;
- case EVENT_CHAINS_OF_ICE:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_CHAINS_OF_ICE);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_CHAINS_OF_ICE);
- events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000);
- return;
- case EVENT_HALLUCINATION:
- @@ -787,9 +1633,9 @@ class npc_phantom_hallucination : public CreatureScript
- public:
- npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { }
- - CreatureAI* GetAI(Creature* creature) const
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_phantom_hallucinationAI(creature);
- + return new npc_phantom_hallucinationAI(pCreature);
- }
- struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI
- @@ -811,14 +1657,14 @@ class npc_shadowy_mercenary : public CreatureScript
- public:
- npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { }
- - CreatureAI* GetAI(Creature* creature) const
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_shadowy_mercenaryAI(creature);
- + return new npc_shadowy_mercenaryAI(pCreature);
- }
- struct npc_shadowy_mercenaryAI: public ScriptedAI
- {
- - npc_shadowy_mercenaryAI(Creature* creature) : ScriptedAI(creature)
- + npc_shadowy_mercenaryAI(Creature *c) : ScriptedAI(c)
- {
- }
- @@ -849,7 +1695,7 @@ public:
- while (uint32 eventId = events.ExecuteEvent())
- {
- - switch (eventId)
- + switch(eventId)
- {
- case EVENT_SHADOW_STEP:
- DoCast(SPELL_SHADOW_STEP);
- @@ -860,8 +1706,8 @@ public:
- events.ScheduleEvent(EVENT_DEADLY_POISON, 10000);
- return;
- case EVENT_ENVENOMED_DAGGER_THROW:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_ENVENOMED_DAGGER_THROW);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_ENVENOMED_DAGGER_THROW);
- events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000);
- return;
- case EVENT_KIDNEY_SHOT:
- @@ -882,14 +1728,14 @@ class npc_spectral_footman : public CreatureScript
- public:
- npc_spectral_footman() : CreatureScript("npc_spectral_footman") { }
- - CreatureAI* GetAI(Creature* creature) const
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_spectral_footmanAI(creature);
- + return new npc_spectral_footmanAI(pCreature);
- }
- struct npc_spectral_footmanAI: public ScriptedAI
- {
- - npc_spectral_footmanAI(Creature* creature) : ScriptedAI(creature)
- + npc_spectral_footmanAI(Creature *c) : ScriptedAI(c)
- {
- }
- @@ -919,7 +1765,7 @@ public:
- while (uint32 eventId = events.ExecuteEvent())
- {
- - switch (eventId)
- + switch(eventId)
- {
- case EVENT_SPECTRAL_STRIKE:
- DoCast(me->getVictim(), SPELL_SPECTRAL_STRIKE);
- @@ -947,14 +1793,14 @@ class npc_tortured_rifleman : public CreatureScript
- public:
- npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { }
- - CreatureAI* GetAI(Creature* creature) const
- + CreatureAI* GetAI(Creature* pCreature) const
- {
- - return new npc_tortured_riflemanAI(creature);
- + return new npc_tortured_riflemanAI(pCreature);
- }
- struct npc_tortured_riflemanAI : public ScriptedAI
- {
- - npc_tortured_riflemanAI(Creature* creature) : ScriptedAI(creature)
- + npc_tortured_riflemanAI(Creature *c) : ScriptedAI(c)
- {
- }
- @@ -985,16 +1831,16 @@ public:
- while (uint32 eventId = events.ExecuteEvent())
- {
- - switch (eventId)
- + switch(eventId)
- {
- case EVENT_SHOOT:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_SHOOT);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_SHOOT);
- events.ScheduleEvent(EVENT_SHOOT, 2000);
- return;
- case EVENT_CURSED_ARROW:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_CURSED_ARROW);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_CURSED_ARROW);
- events.ScheduleEvent(EVENT_CURSED_ARROW, 10000);
- return;
- case EVENT_FROST_TRAP:
- @@ -1002,8 +1848,8 @@ public:
- events.ScheduleEvent(EVENT_FROST_TRAP, 30000);
- return;
- case EVENT_ICE_SHOT:
- - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- - DoCast(target, SPELL_ICE_SHOT);
- + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
- + DoCast(pTarget, SPELL_ICE_SHOT);
- events.ScheduleEvent(EVENT_ICE_SHOT, 15000);
- return;
- }
- @@ -1017,8 +1863,10 @@ public:
- void AddSC_halls_of_reflection()
- {
- - new npc_jaina_or_sylvanas_hor(true, "npc_sylvanas_hor_part1");
- - new npc_jaina_or_sylvanas_hor(false, "npc_jaina_hor_part1");
- + new npc_jaina_and_sylvana_HRintro();
- + new npc_jaina_and_sylvana_HRextro();
- + new npc_lich_king_hr();
- + new npc_frostworn_general();
- new npc_ghostly_priest();
- new npc_phantom_mage();
- new npc_phantom_hallucination();
- 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 1557fd1..4bd27b6 100644
- --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
- +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
- @@ -1,18 +1,20 @@
- /*
- - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
- *
- - * This program is free software; you can redistribute it and/or modify it
- - * under the terms of the GNU General Public License as published by the
- - * Free Software Foundation; either version 2 of the License, or (at your
- - * option) any later version.
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2 of the License, or
- + * (at your option) any later version.
- *
- - * This program is distributed in the hope that it will be useful, but WITHOUT
- - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- - * more details.
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- *
- - * You should have received a copy of the GNU General Public License along
- - * with this program. If not, see <http://www.gnu.org/licenses/>.
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- #ifndef DEF_HALLS_OF_REFLECTION_H
- @@ -20,138 +22,118 @@
- enum Data
- {
- - DATA_FALRIC_EVENT,
- - DATA_MARWYN_EVENT,
- - DATA_LICHKING_EVENT,
- - DATA_WAVE_COUNT,
- - DATA_TEAM_IN_INSTANCE,
- + TYPE_PHASE = 0,
- + TYPE_EVENT = 1,
- + TYPE_FALRIC = 2,
- + TYPE_MARWYN = 3,
- + TYPE_FROST_GENERAL = 4,
- + TYPE_LICH_KING = 5,
- + TYPE_ICE_WALL_01 = 6,
- + TYPE_ICE_WALL_02 = 7,
- + TYPE_ICE_WALL_03 = 8,
- + TYPE_ICE_WALL_04 = 9,
- + TYPE_HALLS = 10,
- + MAX_ENCOUNTERS,
- +
- + DATA_ESCAPE_LIDER = 101,
- + DATA_LIDER = 102,
- + DATA_SUMMONS = 103,
- + DATA_TEAM_IN_INSTANCE = 104,
- +
- + /*UNITS*/
- + NPC_DARK_1 = 38177, //Shadowy Mercenary
- + NPC_DARK_2 = 38176, //Tortured Rifleman
- + NPC_DARK_3 = 38173, //Spectral Footman
- + NPC_DARK_4 = 38172, //Phantom Mage
- + NPC_DARK_5 = 38567, //Phantom Hallucination
- + NPC_DARK_6 = 38175, //Ghostly Priest
- + NPC_JAINA = 37221,
- + NPC_SYLVANA = 37223,
- + NPC_JAINA_OUTRO = 36955,
- + NPC_SYLVANA_OUTRO = 37554,
- + NPC_ALTAR_TARGET = 37704,
- + NPC_UTHER = 37225,
- + NPC_LICH_KING = 36954,
- + BOSS_LICH_KING = 37226,
- + NPC_ICE_WALL = 37014,
- + NPC_FALRIC = 38112,
- + NPC_MARWYN = 38113,
- + NPC_GHOSTLY_ROGUE = 38177,
- + NPC_GHOSTLY_PRIEST = 38175,
- + NPC_GHOSTLY_MAGE = 38172,
- + NPC_GHOSTLY_FOOTMAN = 38173,
- + NPC_GHOSTLY_RIFLEMAN = 38176,
- + NPC_GLUK = 38567,
- +
- + NPC_RAGING_GNOUL = 36940,
- + NPC_RISEN_WITCH_DOCTOR = 36941,
- + NPC_ABON = 37069,
- +
- + NPC_FROST_GENERAL = 36723,
- +
- + GO_ICECROWN_DOOR = 201976, //72802
- + GO_ICECROWN_DOOR_2 = 197342,
- + GO_ICECROWN_DOOR_3 = 197343,
- + GO_IMPENETRABLE_DOOR = 197341, //72801
- + GO_FROSTMOURNE_ALTAR = 202236, //3551
- + GO_FROSTMOURNE = 202302, //364
- +
- + GO_ICE_WALL_1 = 201385,
- + GO_ICE_WALL_2 = 201885,
- + GO_ICE_WALL_3 = 202396,
- + GO_ICE_WALL_4 = 500001,
- + GO_CAVE = 201596,
- + GO_PORTAL = 202079,
- +
- + GO_CAPTAIN_CHEST_1 = 202212, //3145
- + GO_CAPTAIN_CHEST_2 = 201710, //30357
- + GO_CAPTAIN_CHEST_3 = 202337, //3246
- + GO_CAPTAIN_CHEST_4 = 202336, //3333
- };
- -enum Data64
- +struct Locations
- {
- - DATA_FALRIC,
- - DATA_MARWYN,
- - DATA_LICHKING,
- - DATA_FROSTMOURNE,
- + float x, y, z, o;
- + uint32 id;
- };
- -enum Creatures
- +static Locations SpawnLoc[]=
- {
- - NPC_FALRIC = 38112,
- - NPC_MARWYN = 38113,
- - NPC_LICH_KING_EVENT = 37226,
- - NPC_LICH_KING_BOSS = 36954,
- -
- - NPC_UTHER = 37225,
- - NPC_JAINA_PART1 = 37221,
- - NPC_JAINA_PART2 = 36955,
- - NPC_SYLVANAS_PART1 = 37223,
- - NPC_SYLVANAS_PART2 = 37554,
- -
- - NPC_WAVE_MERCENARY = 38177,
- - NPC_WAVE_FOOTMAN = 38173,
- - NPC_WAVE_RIFLEMAN = 38176,
- - NPC_WAVE_PRIEST = 38175,
- - NPC_WAVE_MAGE = 38172,
- -};
- -
- -enum GameObjects
- -{
- - GO_FROSTMOURNE = 202302,
- - GO_FROSTMOURNE_ALTAR = 202236,
- - GO_FRONT_DOOR = 201976,
- - GO_ARTHAS_DOOR = 197341,
- -};
- -
- -enum HorWorldStates
- -{
- - WORLD_STATE_HOR = 4884,
- - WORLD_STATE_HOR_WAVE_COUNT = 4882,
- -};
- -
- -// Common actions from Instance Script to Boss Script
- -enum Actions
- -{
- - ACTION_ENTER_COMBAT,
- -};
- -
- -// Base class for FALRIC and MARWYN
- -// handled the summonList and the notification events to/from the InstanceScript
- -struct boss_horAI : ScriptedAI
- -{
- - boss_horAI(Creature* creature) : ScriptedAI(creature), summons(creature)
- - {
- - instance = me->GetInstanceScript();
- - }
- -
- - InstanceScript* instance;
- - EventMap events;
- - SummonList summons;
- -
- - void Reset()
- - {
- - events.Reset();
- - me->SetVisible(false);
- - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
- - me->SetReactState(REACT_PASSIVE);
- - }
- -
- - void DamageTaken(Unit* /*who*/, uint32 &uiDamage)
- - {
- - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
- - uiDamage = 0;
- - }
- -
- - void DoAction(const int32 actionID)
- - {
- - switch (actionID)
- - {
- - case ACTION_ENTER_COMBAT: // called by InstanceScript when boss shall enter in combat.
- - // Just in case. Should have been done by InstanceScript
- - me->SetVisible(true);
- -
- - // Reset flags
- - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
- - me->SetReactState(REACT_AGGRESSIVE);
- -
- - if (Unit* unit = me->SelectNearestTarget())
- - AttackStart(unit);
- -
- - DoZoneInCombat();
- - break;
- - }
- - }
- -
- - void JustSummoned(Creature* summoned)
- - {
- - summons.Summon(summoned);
- -
- - if (Unit* target = summoned->SelectNearestTarget())
- - {
- - if (summoned->AI())
- - summoned->AI()->AttackStart(target);
- - else
- - {
- - summoned->GetMotionMaster()->MoveChase(target);
- - summoned->Attack(target, true);
- - }
- - }
- -
- - if (summoned->AI())
- - summoned->AI()->DoZoneInCombat();
- - }
- -
- - void SummonedCreatureDespawn(Creature* summoned)
- - {
- - summons.Despawn(summoned);
- - if (summons.empty())
- - {
- - if (summoned->isAlive())
- - instance->SetData(DATA_WAVE_COUNT, NOT_STARTED);
- - else
- - instance->SetData(DATA_WAVE_COUNT, SPECIAL);
- - }
- - }
- + //Wing 01
- + {5277.409f, 1993.161f, 707.694f, 0.05f}, //27
- + {5301.876f, 2041.699f, 707.694f, 4.71f}, //1
- + {5339.830f, 2020.887f, 707.694f, 3.14f}, //13
- + {5311.041f, 2042.935f, 707.694f, 4.71f}, //3
- + {5314.750f, 2039.969f, 707.694f, 4.71f}, //4
- + {5342.823f, 2003.801f, 707.694f, 3.14f}, //10
- + {5311.579f, 1972.823f, 707.694f, 1.62f}, //16
- +
- + //Wing 02
- + {5272.491f, 2005.673f, 707.694f, 0.05f}, //23
- + {5302.669f, 1973.050f, 707.694f, 1.62f}, //18
- + {5346.187f, 2008.058f, 707.694f, 3.14f}, //9
- + {5319.752f, 2041.321f, 707.694f, 4.71f}, //5
- + {5344.882f, 1998.714f, 707.694f, 3.14f}, //11
- + {5340.552f, 1994.735f, 707.694f, 3.14f}, //12
- + {5306.441f, 2040.358f, 707.694f, 4.71f}, //2
- +
- + //Wing 03
- + {5273.297f, 2014.009f, 707.694f, 0.05f}, //25
- + {5316.062f, 1970.777f, 707.694f, 1.62f}, //15
- + {5322.498f, 2037.415f, 707.694f, 4.71f}, //6
- + {5307.087f, 1970.065f, 707.694f, 1.62f}, //17
- + {5342.460f, 2012.391f, 707.694f, 3.14f}, //8
- + {5297.601f, 1971.420f, 707.694f, 1.62f}, //19
- + {5295.668f, 1975.853f, 707.694f, 1.62f}, //20
- +
- + //Wing 04
- + {5273.661f, 1996.767f, 707.694f, 0.05f}, //21
- + {5275.228f, 2001.275f, 707.694f, 0.05f}, //22
- + {5344.153f, 2017.753f, 707.694f, 3.14f}, //7
- + {5275.310f, 2009.686f, 707.694f, 0.05f}, //24
- + {5319.835f, 1975.177f, 707.694f, 1.62f}, //14
- + {5277.445f, 2017.197f, 707.694f, 0.05f}, //26
- + {5298.198f, 2037.762f, 707.694f, 4.71f} //0
- };
- #endif
- diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
- index e360489..62b1975 100644
- --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
- +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
- @@ -1,429 +1,384 @@
- /*
- - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
- + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
- *
- - * This program is free software; you can redistribute it and/or modify it
- - * under the terms of the GNU General Public License as published by the
- - * Free Software Foundation; either version 2 of the License, or (at your
- - * option) any later version.
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2 of the License, or
- + * (at your option) any later version.
- *
- - * This program is distributed in the hope that it will be useful, but WITHOUT
- - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- - * more details.
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- *
- - * You should have received a copy of the GNU General Public License along
- - * with this program. If not, see <http://www.gnu.org/licenses/>.
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- +/* ScriptData
- +SDName: instance_halls_of_reflection
- +SD%Complete: 70%
- +SDComment:
- +SDErrors:
- +SDCategory: instance script
- +SDAuthor: /dev/rsa, modified by MaxXx2021 aka Mioka
- +EndScriptData */
- +
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "InstanceScript.h"
- #include "halls_of_reflection.h"
- -
- -#define MAX_ENCOUNTER 3
- -
- -/* Halls of Reflection encounters:
- -0- Falric
- -1- Marwyn
- -2- The Lich King
- -*/
- -
- -enum eEnum
- -{
- - ENCOUNTER_WAVE_MERCENARY = 6,
- - ENCOUNTER_WAVE_FOOTMAN = 10,
- - ENCOUNTER_WAVE_RIFLEMAN = 6,
- - ENCOUNTER_WAVE_PRIEST = 6,
- - ENCOUNTER_WAVE_MAGE = 6,
- -};
- -
- -enum Events
- -{
- - EVENT_NONE,
- - EVENT_NEXT_WAVE,
- - EVENT_START_LICH_KING,
- -};
- -
- -static Position PriestSpawnPos[ENCOUNTER_WAVE_PRIEST] =
- -{
- - {5277.74f, 2016.88f, 707.778f, 5.96903f},
- - {5295.88f, 2040.34f, 707.778f, 5.07891f},
- - {5320.37f, 1980.13f, 707.778f, 2.00713f},
- - {5280.51f, 1997.84f, 707.778f, 0.296706f},
- - {5302.45f, 2042.22f, 707.778f, 4.90438f},
- - {5306.57f, 1977.47f, 707.778f, 1.50098f},
- -};
- -
- -static Position MageSpawnPos[ENCOUNTER_WAVE_MAGE] =
- -{
- - {5312.75f, 2037.12f, 707.778f, 4.59022f},
- - {5309.58f, 2042.67f, 707.778f, 4.69494f},
- - {5275.08f, 2008.72f, 707.778f, 6.21337f},
- - {5279.65f, 2004.66f, 707.778f, 0.069813f},
- - {5275.48f, 2001.14f, 707.778f, 0.174533f},
- - {5316.7f, 2041.55f, 707.778f, 4.50295f},
- -};
- -
- -static Position MercenarySpawnPos[ENCOUNTER_WAVE_MERCENARY] =
- -{
- - {5302.25f, 1972.41f, 707.778f, 1.37881f},
- - {5311.03f, 1972.23f, 707.778f, 1.64061f},
- - {5277.36f, 1993.23f, 707.778f, 0.401426f},
- - {5318.7f, 2036.11f, 707.778f, 4.2237f},
- - {5335.72f, 1996.86f, 707.778f, 2.74017f},
- - {5299.43f, 1979.01f, 707.778f, 1.23918f},
- -};
- -
- -static Position FootmenSpawnPos[ENCOUNTER_WAVE_FOOTMAN] =
- -{
- - {5306.06f, 2037, 707.778f, 4.81711f},
- - {5344.15f, 2007.17f, 707.778f, 3.15905f},
- - {5337.83f, 2010.06f, 707.778f, 3.22886f},
- - {5343.29f, 1999.38f, 707.778f, 2.9147f},
- - {5340.84f, 1992.46f, 707.778f, 2.75762f},
- - {5325.07f, 1977.6f, 707.778f, 2.07694f},
- - {5336.6f, 2017.28f, 707.778f, 3.47321f},
- - {5313.82f, 1978.15f, 707.778f, 1.74533f},
- - {5280.63f, 2012.16f, 707.778f, 6.05629f},
- - {5322.96f, 2040.29f, 707.778f, 4.34587f},
- -};
- -
- -static Position RiflemanSpawnPos[ENCOUNTER_WAVE_RIFLEMAN] =
- -{
- - {5343.47f, 2015.95f, 707.778f, 3.49066f},
- - {5337.86f, 2003.4f, 707.778f, 2.98451f},
- - {5319.16f, 1974, 707.778f, 1.91986f},
- - {5299.25f, 2036, 707.778f, 5.02655f},
- - {5295.64f, 1973.76f, 707.778f, 1.18682f},
- - {5282.9f, 2019.6f, 707.778f, 5.88176f},
- -};
- +#include "World.h"
- class instance_halls_of_reflection : public InstanceMapScript
- {
- public:
- instance_halls_of_reflection() : InstanceMapScript("instance_halls_of_reflection", 668) { }
- - InstanceScript* GetInstanceScript(InstanceMap* map) const
- - {
- - return new instance_halls_of_reflection_InstanceMapScript(map);
- - }
- -
- struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript
- {
- - instance_halls_of_reflection_InstanceMapScript(Map* map) : InstanceScript(map) {};
- -
- - uint64 uiFalric;
- - uint64 uiMarwyn;
- - uint64 uiLichKingEvent;
- - uint64 uiJainaPart1;
- - uint64 uiSylvanasPart1;
- + instance_halls_of_reflection_InstanceMapScript(Map* pMap) : InstanceScript(pMap)
- + {
- + Difficulty = pMap->GetDifficulty();
- + Initialize();
- + }
- - uint64 uiFrostmourne;
- - uint64 uiFrostmourneAltar;
- - uint64 uiArthasDoor;
- - uint64 uiFrontDoor;
- + uint32 m_auiEncounter[MAX_ENCOUNTERS+1];
- + uint32 m_auiLider;
- + std::string strSaveData;
- +
- + uint8 Difficulty;
- + uint8 m_uiSummons;
- +
- + uint64 m_uiFalricGUID;
- + uint64 m_uiMarwynGUID;
- + uint64 m_uiLichKingGUID;
- + uint64 m_uiLiderGUID;
- +
- + uint64 m_uiMainGateGUID;
- + uint64 m_uiExitGateGUID;
- + uint64 m_uiDoor2GUID;
- + uint64 m_uiDoor3GUID;
- +
- + uint64 m_uiFrostGeneralGUID;
- + uint64 m_uiCaptainsChestHordeGUID;
- + uint64 m_uiCaptainsChestAllianceGUID;
- + uint64 m_uiFrostmourneGUID;
- + uint64 m_uiFrostmourneAltarGUID;
- + uint64 m_uiPortalGUID;
- + uint64 m_uiIceWall1GUID;
- + uint64 m_uiIceWall2GUID;
- + uint64 m_uiIceWall3GUID;
- + uint64 m_uiIceWall4GUID;
- + uint64 m_uiGoCaveGUID;
- + uint32 m_uiTeamInInstance;
- - uint32 uiEncounter[MAX_ENCOUNTER];
- - uint32 uiTeamInInstance;
- - uint32 uiWaveCount;
- - bool bIntroDone;
- + void Initialize()
- + {
- + for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
- + m_auiEncounter[i] = NOT_STARTED;
- + m_uiMainGateGUID = 0;
- + m_uiFrostmourneGUID = 0;
- + m_uiFalricGUID = 0;
- + m_uiLiderGUID = 0;
- + m_uiLichKingGUID = 0;
- + m_uiExitGateGUID = 0;
- + m_uiSummons = 0;
- + m_uiIceWall1GUID = 0;
- + m_uiIceWall2GUID = 0;
- + m_uiIceWall3GUID = 0;
- + m_uiIceWall4GUID = 0;
- + m_uiGoCaveGUID = 0;
- + m_uiTeamInInstance = 0;
- + }
- - EventMap events;
- + void OpenDoor(uint64 guid)
- + {
- + if(!guid) return;
- + GameObject* go = instance->GetGameObject(guid);
- + if(go) go->SetGoState(GO_STATE_ACTIVE);
- + }
- - void Initialize()
- + void CloseDoor(uint64 guid)
- {
- - events.Reset();
- -
- - uiFalric = 0;
- - uiMarwyn = 0;
- - uiLichKingEvent = 0;
- - uiJainaPart1 = 0;
- - uiSylvanasPart1 = 0;
- -
- - uiFrostmourne = 0;
- - uiFrostmourneAltar = 0;
- - uiArthasDoor = 0;
- - uiFrontDoor = 0;
- - uiTeamInInstance = 0;
- - uiWaveCount = 0;
- - bIntroDone = false;
- -
- - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- - uiEncounter[i] = NOT_STARTED;
- + if(!guid) return;
- + GameObject* go = instance->GetGameObject(guid);
- + if(go) go->SetGoState(GO_STATE_READY);
- }
- void OnCreatureCreate(Creature* creature)
- {
- Map::PlayerList const &players = instance->GetPlayers();
- if (!players.isEmpty())
- - if (Player* player = players.begin()->getSource())
- - uiTeamInInstance = player->GetTeam();
- + if (Player* pPlayer = players.begin()->getSource())
- + m_uiTeamInInstance = pPlayer->GetTeam();
- - switch (creature->GetEntry())
- + switch(creature->GetEntry())
- {
- - case NPC_FALRIC:
- - uiFalric = creature->GetGUID();
- - break;
- - case NPC_MARWYN:
- - uiMarwyn = creature->GetGUID();
- - break;
- - case NPC_LICH_KING_EVENT:
- - uiLichKingEvent = creature->GetGUID();
- - break;
- - case NPC_JAINA_PART1:
- - uiJainaPart1 = creature->GetGUID();
- - break;
- - case NPC_SYLVANAS_PART1:
- - uiSylvanasPart1 = creature->GetGUID();
- - break;
- + case NPC_FALRIC:
- + m_uiFalricGUID = creature->GetGUID();
- + break;
- + case NPC_MARWYN:
- + m_uiMarwynGUID = creature->GetGUID();
- + break;
- + case BOSS_LICH_KING:
- + m_uiLichKingGUID = creature->GetGUID();
- + break;
- + case NPC_FROST_GENERAL:
- + m_uiFrostGeneralGUID = creature->GetGUID();
- + break;
- }
- }
- + void OnPlayerEnter(Player *pPlayer)
- + {
- +
- + enum PhaseControl
- + {
- + HORDE_CONTROL_PHASE_SHIFT_1 = 55773,
- + HORDE_CONTROL_PHASE_SHIFT_2 = 60028,
- + ALLIANCE_CONTROL_PHASE_SHIFT_1 = 55774,
- + ALLIANCE_CONTROL_PHASE_SHIFT_2 = 60027,
- + };
- +
- + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) return;
- +
- + switch (pPlayer->GetTeam())
- + {
- + case ALLIANCE:
- + if (pPlayer && pPlayer->IsInWorld() && pPlayer->HasAura(HORDE_CONTROL_PHASE_SHIFT_1))
- + pPlayer->RemoveAurasDueToSpell(HORDE_CONTROL_PHASE_SHIFT_1);
- + pPlayer->CastSpell(pPlayer, HORDE_CONTROL_PHASE_SHIFT_2, false);
- + break;
- + case HORDE:
- + if (pPlayer && pPlayer->IsInWorld() && pPlayer->HasAura(ALLIANCE_CONTROL_PHASE_SHIFT_1))
- + pPlayer->RemoveAurasDueToSpell(ALLIANCE_CONTROL_PHASE_SHIFT_1);
- + pPlayer->CastSpell(pPlayer, ALLIANCE_CONTROL_PHASE_SHIFT_2, false);
- + break;
- + };
- +
- + };
- +
- void OnGameObjectCreate(GameObject* go)
- {
- - // TODO: init state depending on encounters
- - switch (go->GetEntry())
- + switch(go->GetEntry())
- {
- - case GO_FROSTMOURNE:
- - uiFrostmourne = go->GetGUID();
- - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
- - HandleGameObject(0, false, go);
- + case GO_IMPENETRABLE_DOOR: m_uiMainGateGUID = go->GetGUID(); break;
- + case GO_FROSTMOURNE: m_uiFrostmourneGUID = go->GetGUID(); break;
- + case GO_ICECROWN_DOOR: m_uiExitGateGUID = go->GetGUID(); break;
- + case GO_ICECROWN_DOOR_2: m_uiDoor2GUID = go->GetGUID(); break;
- + case GO_ICECROWN_DOOR_3: m_uiDoor3GUID = go->GetGUID(); break;
- + case GO_PORTAL: m_uiPortalGUID = go->GetGUID(); break;
- + case GO_CAPTAIN_CHEST_1:
- + if (Difficulty == RAID_DIFFICULTY_10MAN_NORMAL)
- + m_uiCaptainsChestHordeGUID = go->GetGUID();
- + break;
- + case GO_CAPTAIN_CHEST_3:
- + if (Difficulty == RAID_DIFFICULTY_25MAN_NORMAL)
- + m_uiCaptainsChestHordeGUID = go->GetGUID();
- + break;
- + case GO_CAPTAIN_CHEST_2:
- + if (Difficulty == RAID_DIFFICULTY_10MAN_NORMAL)
- + m_uiCaptainsChestAllianceGUID = go->GetGUID();
- + break;
- + case GO_CAPTAIN_CHEST_4:
- + if (Difficulty == RAID_DIFFICULTY_25MAN_NORMAL)
- + m_uiCaptainsChestAllianceGUID = go->GetGUID();
- + break;
- + case GO_ICE_WALL_1:
- + m_uiIceWall1GUID = go->GetGUID();
- + go->SetGoState(GO_STATE_READY);
- break;
- - case GO_FROSTMOURNE_ALTAR:
- - uiFrostmourneAltar = go->GetGUID();
- - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
- - HandleGameObject(0, true, go);
- + case GO_ICE_WALL_2:
- + m_uiIceWall2GUID = go->GetGUID();
- + go->SetGoState(GO_STATE_READY);
- break;
- - case GO_FRONT_DOOR:
- - uiFrontDoor = go->GetGUID();
- - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
- - HandleGameObject(0, true, go);
- + case GO_ICE_WALL_3:
- + m_uiIceWall3GUID = go->GetGUID();
- + go->SetGoState(GO_STATE_READY);
- break;
- - case GO_ARTHAS_DOOR:
- - uiArthasDoor = go->GetGUID();
- - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
- -
- - if (uiEncounter[1] == DONE)
- - HandleGameObject(0, true, go);
- - else
- - HandleGameObject(0, false, go);
- + case GO_ICE_WALL_4:
- + m_uiIceWall4GUID = go->GetGUID();
- + go->SetGoState(GO_STATE_READY);
- + break;
- + case GO_CAVE:
- + m_uiGoCaveGUID = go->GetGUID();
- + go->SetGoState(GO_STATE_ACTIVE);
- break;
- }
- }
- - void SetData(uint32 type, uint32 data)
- + void SetData(uint32 uiType, uint32 uiData)
- {
- - if (type == DATA_WAVE_COUNT && data == SPECIAL)
- - {
- - bIntroDone = true;
- - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
- - return;
- - }
- -
- - if (uiWaveCount && data == NOT_STARTED)
- - DoWipe();
- -
- - switch (type)
- + switch(uiType)
- {
- - case DATA_FALRIC_EVENT:
- - uiEncounter[0] = data;
- - if (data == DONE)
- - events.ScheduleEvent(EVENT_NEXT_WAVE, 60000);
- + case TYPE_PHASE: m_auiEncounter[uiType] = uiData; break;
- + case TYPE_EVENT: m_auiEncounter[uiType] = uiData;
- + uiData = NOT_STARTED;
- + break;
- + case TYPE_FALRIC: m_auiEncounter[uiType] = uiData;
- + if(uiData == SPECIAL)
- + CloseDoor(m_uiExitGateGUID);
- + break;
- + case TYPE_MARWYN: m_auiEncounter[uiType] = uiData;
- + if(uiData == DONE)
- + {
- + OpenDoor(m_uiMainGateGUID);
- + OpenDoor(m_uiExitGateGUID);
- + }
- + break;
- + case TYPE_FROST_GENERAL: m_auiEncounter[uiType] = uiData;
- + if(uiData == DONE)
- + OpenDoor(m_uiDoor2GUID);
- + break;
- + case TYPE_LICH_KING: m_auiEncounter[uiType] = uiData;
- + if(uiData == IN_PROGRESS)
- + OpenDoor(m_uiDoor3GUID);
- + if(uiData == DONE)
- + {
- + if (m_auiLider == 1)
- + {
- + if (GameObject* pChest = instance->GetGameObject(m_uiCaptainsChestAllianceGUID))
- + if (pChest && !pChest->isSpawned()) {
- + pChest->SetRespawnTime(DAY);
- + };
- + } else
- + if (GameObject* pChest = instance->GetGameObject(m_uiCaptainsChestHordeGUID))
- + if (pChest && !pChest->isSpawned()) {
- + pChest->SetRespawnTime(DAY);
- + };
- + if (GameObject* pPortal = instance->GetGameObject(m_uiPortalGUID))
- + if (pPortal && !pPortal->isSpawned()) {
- + pPortal->SetRespawnTime(DAY);
- + };
- + }
- break;
- - case DATA_MARWYN_EVENT:
- - uiEncounter[1] = data;
- - if (data == DONE)
- - HandleGameObject(uiArthasDoor, true);
- + case TYPE_ICE_WALL_01: m_auiEncounter[uiType] = uiData; break;
- + case TYPE_ICE_WALL_02: m_auiEncounter[uiType] = uiData; break;
- + case TYPE_ICE_WALL_03: m_auiEncounter[uiType] = uiData; break;
- + case TYPE_ICE_WALL_04: m_auiEncounter[uiType] = uiData; break;
- + case TYPE_HALLS: m_auiEncounter[uiType] = uiData; break;
- + case DATA_LIDER: m_auiLider = uiData;
- + uiData = NOT_STARTED;
- break;
- - case DATA_LICHKING_EVENT:
- - uiEncounter[2] = data;
- + case DATA_SUMMONS: if (uiData == 3) m_uiSummons = 0;
- + else if (uiData == 1) ++m_uiSummons;
- + else if (uiData == 0) --m_uiSummons;
- + uiData = NOT_STARTED;
- break;
- }
- - if (data == DONE)
- + if (uiData == DONE)
- + {
- + OUT_SAVE_INST_DATA;
- +
- + std::ostringstream saveStream;
- +
- + for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
- + saveStream << m_auiEncounter[i] << " ";
- +
- + strSaveData = saveStream.str();
- +
- SaveToDB();
- + OUT_SAVE_INST_DATA_COMPLETE;
- + }
- + }
- +
- + const char* Save()
- + {
- + return strSaveData.c_str();
- }
- - uint32 GetData(uint32 type)
- + uint32 GetData(uint32 uiType)
- {
- - switch (type)
- + switch(uiType)
- {
- - case DATA_FALRIC_EVENT: return uiEncounter[0];
- - case DATA_MARWYN_EVENT: return uiEncounter[1];
- - case DATA_LICHKING_EVENT: return uiEncounter[2];
- - case DATA_WAVE_COUNT: return uiWaveCount;
- - case DATA_TEAM_IN_INSTANCE: return uiTeamInInstance;
- + case TYPE_PHASE: return m_auiEncounter[uiType];
- + case TYPE_EVENT: return m_auiEncounter[uiType];
- + case TYPE_FALRIC: return m_auiEncounter[uiType];
- + case TYPE_MARWYN: return m_auiEncounter[uiType];
- + case TYPE_LICH_KING: return m_auiEncounter[uiType];
- + case TYPE_FROST_GENERAL: return m_auiEncounter[uiType];
- + case TYPE_ICE_WALL_01: return m_auiEncounter[uiType];
- + case TYPE_ICE_WALL_02: return m_auiEncounter[uiType];
- + case TYPE_ICE_WALL_03: return m_auiEncounter[uiType];
- + case TYPE_ICE_WALL_04: return m_auiEncounter[uiType];
- + case TYPE_HALLS: return m_auiEncounter[uiType];
- + case DATA_LIDER: return m_auiLider;
- + case DATA_SUMMONS: return m_uiSummons;
- + case DATA_TEAM_IN_INSTANCE: return m_uiTeamInInstance;
- + default: return 0;
- }
- -
- return 0;
- }
- - uint64 GetData64(uint32 identifier)
- + void SetData64(uint32 uiData, uint64 uiGuid)
- {
- - switch (identifier)
- + switch(uiData)
- {
- - case DATA_FALRIC: return uiFalric;
- - case DATA_MARWYN: return uiMarwyn;
- - case DATA_LICHKING: return uiLichKingEvent;
- - case DATA_FROSTMOURNE: return uiFrostmourne;
- + case DATA_ESCAPE_LIDER:
- + m_uiLiderGUID = uiGuid;
- + break;
- }
- -
- - return 0;
- }
- - std::string GetSaveData()
- + uint64 GetData64(uint32 uiData)
- {
- - OUT_SAVE_INST_DATA;
- -
- - std::ostringstream saveStream;
- - saveStream << "H R 1 " << uiEncounter[0] << ' ' << uiEncounter[1] << ' ' << uiEncounter[2];
- -
- - OUT_SAVE_INST_DATA_COMPLETE;
- - return saveStream.str();
- + switch(uiData)
- + {
- + case GO_IMPENETRABLE_DOOR: return m_uiMainGateGUID;
- + case GO_FROSTMOURNE: return m_uiFrostmourneGUID;
- + case NPC_FALRIC: return m_uiFalricGUID;
- + case NPC_MARWYN: return m_uiMarwynGUID;
- + case BOSS_LICH_KING: return m_uiLichKingGUID;
- + case DATA_ESCAPE_LIDER: return m_uiLiderGUID;
- + case NPC_FROST_GENERAL: return m_uiFrostGeneralGUID;
- + case GO_ICECROWN_DOOR: return m_uiExitGateGUID;
- + case GO_ICECROWN_DOOR_2: return m_uiDoor2GUID;
- + case GO_ICECROWN_DOOR_3: return m_uiDoor3GUID;
- + case GO_ICE_WALL_1: return m_uiIceWall1GUID;
- + case GO_ICE_WALL_2: return m_uiIceWall2GUID;
- + case GO_ICE_WALL_3: return m_uiIceWall3GUID;
- + case GO_ICE_WALL_4: return m_uiIceWall4GUID;
- + case GO_CAVE: return m_uiGoCaveGUID;
- + }
- + return 0;
- }
- - void Load(const char* in)
- + void Load(const char* chrIn)
- {
- - if (!in)
- + if (!chrIn)
- {
- OUT_LOAD_INST_DATA_FAIL;
- return;
- }
- - OUT_LOAD_INST_DATA(in);
- -
- - char dataHead1, dataHead2;
- - uint16 version;
- - uint16 data0, data1, data2;
- + OUT_LOAD_INST_DATA(chrIn);
- - std::istringstream loadStream(in);
- - loadStream >> dataHead1 >> dataHead2 >> version >> data0 >> data1 >> data2;
- + std::istringstream loadStream(chrIn);
- - if (dataHead1 == 'H' && dataHead2 == 'R')
- + for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
- {
- - uiEncounter[0] = data0;
- - uiEncounter[1] = data1;
- - uiEncounter[2] = data2;
- -
- - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- - if (uiEncounter[i] == IN_PROGRESS)
- - uiEncounter[i] = NOT_STARTED;
- -
- - } else OUT_LOAD_INST_DATA_FAIL;
- -
- - if (uiEncounter[0] == DONE || uiEncounter[1] == DONE)
- - bIntroDone = true;
- + loadStream >> m_auiEncounter[i];
- - OUT_LOAD_INST_DATA_COMPLETE;
- - }
- -
- - void AddWave()
- - {
- - DoUpdateWorldState(WORLD_STATE_HOR, 1);
- - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
- -
- - switch (uiWaveCount)
- - {
- - case 1:
- - case 2:
- - case 3:
- - case 4:
- - if (Creature* pFalric = instance->GetCreature(uiFalric))
- - SpawnWave(pFalric);
- - break;
- - case 5:
- - if (GetData(DATA_FALRIC_EVENT) == DONE)
- - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
- - else if (Creature* pFalric = instance->GetCreature(uiFalric))
- - if (pFalric->AI())
- - pFalric->AI()->DoAction(ACTION_ENTER_COMBAT);
- - break;
- - case 6:
- - case 7:
- - case 8:
- - case 9:
- - if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
- - SpawnWave(pMarwyn);
- - break;
- - case 10:
- - if (GetData(DATA_MARWYN_EVENT) != DONE) // wave should not have been started if DONE. Check anyway to avoid bug exploit!
- - if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
- - if (pMarwyn->AI())
- - pMarwyn->AI()->DoAction(ACTION_ENTER_COMBAT);
- - break;
- + if (m_auiEncounter[i] == IN_PROGRESS)
- + m_auiEncounter[i] = NOT_STARTED;
- }
- - }
- -
- - // Wipe has been detected. Perform cleanup and reset.
- - void DoWipe()
- - {
- - uiWaveCount = 0;
- - events.Reset();
- - DoUpdateWorldState(WORLD_STATE_HOR, 1);
- - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
- - HandleGameObject(uiFrontDoor, true);
- -
- - // TODO
- - // in case of wipe, the event is normally restarted by jumping into the center of the room.
- - // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted.
- - if (Creature* pJaina = instance->GetCreature(uiJainaPart1))
- - pJaina->Respawn();
- - if (Creature* pSylvanas = instance->GetCreature(uiSylvanasPart1))
- - pSylvanas->Respawn();
- -
- - if (Creature* pFalric = instance->GetCreature(uiFalric))
- - pFalric->SetVisible(false);
- - if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
- - pMarwyn->SetVisible(false);
- - }
- -
- - // spawn a wave on behalf of the summoner.
- - void SpawnWave(Creature* summoner)
- - {
- - uint32 index;
- -
- - summoner->SetVisible(true);
- -
- - // TODO: do composition at random. # of spawn also depends on uiWaveCount
- - // As of now, it is just one of each.
- - index = urand(0, ENCOUNTER_WAVE_MERCENARY-1);
- - summoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
- -
- - index = urand(0, ENCOUNTER_WAVE_FOOTMAN-1);
- - summoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
- -
- - index = urand(0, ENCOUNTER_WAVE_RIFLEMAN-1);
- - summoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
- -
- - index = urand(0, ENCOUNTER_WAVE_PRIEST-1);
- - summoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
- - index = urand(0, ENCOUNTER_WAVE_MAGE-1);
- - summoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
- + OUT_LOAD_INST_DATA_COMPLETE;
- }
- - void Update(uint32 diff)
- - {
- - if (!instance->HavePlayers())
- - return;
- -
- - events.Update(diff);
- -
- - switch (events.ExecuteEvent())
- - {
- - case EVENT_NEXT_WAVE:
- - uiWaveCount++;
- - AddWave();
- - break;
- - case EVENT_START_LICH_KING:
- - // TODO
- - break;
- - }
- - }
- };
- + InstanceScript* GetInstanceScript (InstanceMap* pMap) const
- + {
- + return new instance_halls_of_reflection_InstanceMapScript(pMap);
- + }
- };
- +
- void AddSC_instance_halls_of_reflection()
- {
- new instance_halls_of_reflection();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement