diff options
Diffstat (limited to 'src')
10 files changed, 1428 insertions, 127 deletions
diff --git a/src/game/ScriptLoader.cpp b/src/game/ScriptLoader.cpp index 0e900c5ab56..8e2eed1e2b5 100644 --- a/src/game/ScriptLoader.cpp +++ b/src/game/ScriptLoader.cpp @@ -231,6 +231,13 @@ void AddSC_boss_chrono_lord_deja(); void AddSC_boss_temporus(); void AddSC_dark_portal(); void AddSC_instance_dark_portal(); +void AddSC_boss_epoch(); //CoT Culling Of Stratholme +void AddSC_boss_infinite_corruptor(); +void AddSC_boss_salramm(); +void AddSC_boss_mal_ganis(); +void AddSC_boss_meathook(); +void AddSC_culling_of_stratholme(); +void AddSC_instance_culling_of_stratholme(); void AddSC_boss_celebras_the_cursed(); //Maraudon void AddSC_boss_landslide(); void AddSC_boss_noxxion(); @@ -704,6 +711,13 @@ void AddScripts() AddSC_boss_temporus(); AddSC_dark_portal(); AddSC_instance_dark_portal(); + AddSC_boss_epoch(); //CoT Culling Of Stratholme + AddSC_boss_infinite_corruptor(); + AddSC_boss_salramm(); + AddSC_boss_mal_ganis(); + AddSC_boss_meathook(); + AddSC_culling_of_stratholme(); + AddSC_instance_culling_of_stratholme(); AddSC_boss_celebras_the_cursed(); //Maraudon AddSC_boss_landslide(); AddSC_boss_noxxion(); diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 87179533ebf..c5e917923f3 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -221,6 +221,7 @@ SET(scripts_STAT_SRCS kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp kalimdor/caverns_of_time/culling_of_stratholme/boss_infinite.cpp + kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.h kalimdor/caverns_of_time/dark_portal/dark_portal.h kalimdor/caverns_of_time/dark_portal/instance_dark_portal.cpp diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp index 7cde29ee855..d95d8d696d2 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_epoch.cpp @@ -30,30 +30,24 @@ Script Data End */ enum Spells { - SPELL_CURSE_OF_EXERTION = 52772, - SPELL_TIME_WARP = 52766, //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec. - SPELL_TIME_STOP = 58848, //Stops time in a 50 yard sphere for 2 sec. - SPELL_WOUNDING_STRIKE = 52771, //Used only on the tank - H_SPELL_WOUNDING_STRIKE = 58830 + SPELL_CURSE_OF_EXERTION = 52772, + SPELL_TIME_WARP = 52766, //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec. + SPELL_TIME_STOP = 58848, //Stops time in a 50 yard sphere for 2 sec. + SPELL_WOUNDING_STRIKE = 52771, //Used only on the tank + H_SPELL_WOUNDING_STRIKE = 58830 }; -//not in db enum Yells { - SAY_INTRO = -1595000, //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own." - SAY_AGGRO = -1595001, //"We'll see about that, young prince." - SAY_TIME_WARP_1 = -1595002, //"Tick tock, tick tock..." - SAY_TIME_WARP_2 = -1595003, //"Not quick enough!" - SAY_TIME_WARP_3 = -1595004, //"Let's get this over with. " - SAY_SLAY_1 = -1595005, //"There is no future for you." - SAY_SLAY_2 = -1595006, //"This is the hour of our greatest triumph!" - SAY_SLAY_3 = -1595007, //"You were destined to fail. " - SAY_DEATH = -1595008 //"*gurgles*" -}; -enum CombatPhases -{ - INTRO, - COMBAT + SAY_INTRO = -1595000, //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own." + SAY_AGGRO = -1595001, //"We'll see about that, young prince." + SAY_TIME_WARP_1 = -1595002, //"Tick tock, tick tock..." + SAY_TIME_WARP_2 = -1595003, //"Not quick enough!" + SAY_TIME_WARP_3 = -1595004, //"Let's get this over with. " + SAY_SLAY_1 = -1595005, //"There is no future for you." + SAY_SLAY_2 = -1595006, //"This is the hour of our greatest triumph!" + SAY_SLAY_3 = -1595007, //"You were destined to fail. " + SAY_DEATH = -1595008 //"*gurgles*" }; struct boss_epochAI : public ScriptedAI @@ -71,8 +65,6 @@ struct boss_epochAI : public ScriptedAI uint32 uiTimeStopTimer; uint32 uiCurseOfExertionTimer; - CombatPhases Phase; - ScriptedInstance* pInstance; void Reset() @@ -98,11 +90,6 @@ struct boss_epochAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (Phase == INTRO) - { - return; - } - //Return since we have no target if (!UpdateVictim()) return; diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_infinite.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_infinite.cpp index 6691b8fd2b0..aa6e66a853a 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_infinite.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_infinite.cpp @@ -21,13 +21,21 @@ enum Spells { - SPELL_CORRUPTING_BLIGHT = 60588, - SPELL_VOID_STRIKE = 60590 + SPELL_CORRUPTING_BLIGHT = 60588, + SPELL_VOID_STRIKE = 60590 }; -struct boss_infiniteAI : public ScriptedAI +enum Yells { - boss_infiniteAI(Creature *c) : ScriptedAI(c) + SAY_AGGRO = -1595045, + SAY_FAIL = -1595046, + SAY_DEATH = -1595047 +}; + + +struct boss_infinite_corruptorAI : public ScriptedAI +{ + boss_infinite_corruptorAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); } @@ -64,17 +72,17 @@ struct boss_infiniteAI : public ScriptedAI } }; -CreatureAI* GetAI_boss_infinite(Creature* pCreature) +CreatureAI* GetAI_boss_infinite_corruptor(Creature* pCreature) { - return new boss_infiniteAI (pCreature); + return new boss_infinite_corruptorAI(pCreature); } -void AddSC_infinite_epoch() +void AddSC_boss_infinite_corruptor() { Script *newscript; newscript = new Script; - newscript->Name = "boss_infinite"; - newscript->GetAI = &GetAI_boss_infinite; + newscript->Name = "boss_infinite_corruptor"; + newscript->GetAI = &GetAI_boss_infinite_corruptor; newscript->RegisterSelf(); } diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp index 0c4f7dbdaca..054669f7fea 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp @@ -32,35 +32,34 @@ update creature_template set scriptname = 'boss_mal_ganis' where entry = ''; enum Spells { - SPELL_CARRION_SWARM = 52720, //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec. - H_SPELL_CARRION_SWARM = 58852, - SPELL_MIND_BLAST = 52722, //Inflicts 4163 to 4837 Shadow damage to an enemy. - H_SPELL_MIND_BLAST = 58850, - SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. - H_SPELL_SLEEP = 58849, - SPELL_VAMPIRIC_TOUCH = 52723 //Heals the caster for half the damage dealt by a melee attack. + SPELL_CARRION_SWARM = 52720, //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec. + H_SPELL_CARRION_SWARM = 58852, + SPELL_MIND_BLAST = 52722, //Inflicts 4163 to 4837 Shadow damage to an enemy. + H_SPELL_MIND_BLAST = 58850, + SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target. + H_SPELL_SLEEP = 58849, + SPELL_VAMPIRIC_TOUCH = 52723 //Heals the caster for half the damage dealt by a melee attack. }; -//not in db enum Yells { - SAY_INTRO_1 = -1595009, - SAY_INTRO_2 = -1595010, - SAY_OUTRO = -1595011, - SAY_AGGRO = -1595012, - SAY_KILL_1 = -1595013, - SAY_KILL_2 = -1595014, - SAY_KILL_3 = -1595015, - SAY_SLAY_1 = -1595016, - SAY_SLAY_2 = -1595017, - SAY_SLAY_3 = -1595018, - SAY_SLAY_4 = -1595019, - SAY_SLEEP_1 = -1595020, - SAY_SLEEP_2 = -1595021, - SAY_30HEALTH = -1595022, - SAY_15HEALTH = -1595023, - SAY_ESCAPE_SPEECH_1 = -1595024, - SAY_ESCAPE_SPEECH_2 = -1595025 + SAY_INTRO_1 = -1595009, + SAY_INTRO_2 = -1595010, + SAY_AGGRO = -1595011, + SAY_KILL_1 = -1595012, + SAY_KILL_2 = -1595013, + SAY_KILL_3 = -1595014, + SAY_SLAY_1 = -1595015, + SAY_SLAY_2 = -1595016, + SAY_SLAY_3 = -1595017, + SAY_SLAY_4 = -1595018, + SAY_SLEEP_1 = -1595019, + SAY_SLEEP_2 = -1595020, + SAY_30HEALTH = -1595021, + SAY_15HEALTH = -1595022, + SAY_ESCAPE_SPEECH_1 = -1595023, + SAY_ESCAPE_SPEECH_2 = -1595024, + SAY_OUTRO = -1595025, }; enum CombatPhases @@ -82,6 +81,7 @@ struct boss_mal_ganisAI : public ScriptedAI uint32 uiSleepTimer; uint8 uiOutroStep; + uint32 uiOutroTimer; bool bYelled; bool bYelled2; @@ -101,6 +101,7 @@ struct boss_mal_ganisAI : public ScriptedAI uiMindBlastTimer = 11000; uiVampiricTouchTimer = urand(10000,15000); uiSleepTimer = urand(15000,20000); + uiOutroTimer = 1000; if (pInstance) pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); @@ -116,6 +117,12 @@ struct boss_mal_ganisAI : public ScriptedAI pInstance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS); } + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= m_creature->GetHealth() && done_by != m_creature) + damage = m_creature->GetHealth()-1; + } + void UpdateAI(const uint32 diff) { switch(Phase) @@ -164,16 +171,18 @@ struct boss_mal_ganisAI : public ScriptedAI { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, DUNGEON_MODE(SPELL_MIND_BLAST, H_SPELL_MIND_BLAST)); + uiMindBlastTimer = 6000; } else uiMindBlastTimer -= diff; if (uiVampiricTouchTimer < diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_VAMPIRIC_TOUCH); + DoCast(m_creature, SPELL_VAMPIRIC_TOUCH); + uiVampiricTouchTimer = 32000; } else uiVampiricTouchTimer -= diff; if (uiSleepTimer < diff) { + DoScriptText(RAND(SAY_SLEEP_1,SAY_SLEEP_2), m_creature); if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, DUNGEON_MODE(SPELL_SLEEP, H_SPELL_SLEEP)); uiSleepTimer = urand(15000,20000); @@ -181,13 +190,57 @@ struct boss_mal_ganisAI : public ScriptedAI DoMeleeAttackIfReady(); break; + case OUTRO: + if (uiOutroTimer < diff) + { + switch(uiOutroStep) + { + case 1: + DoScriptText(SAY_ESCAPE_SPEECH_1, m_creature); + me->GetMotionMaster()->MoveTargetedHome(); + ++uiOutroStep; + uiOutroTimer = 8000; + break; + case 2: + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, pArthas->GetGUID()); + m_creature->HandleEmoteCommand(29); + DoScriptText(SAY_ESCAPE_SPEECH_2, m_creature); + ++uiOutroStep; + uiOutroTimer = 9000; + break; + case 3: + DoScriptText(SAY_OUTRO, m_creature); + ++uiOutroStep; + uiOutroTimer = 16000; + break; + case 4: + m_creature->HandleEmoteCommand(33); + ++uiOutroStep; + uiOutroTimer = 500; + break; + case 5: + m_creature->SetVisibility(VISIBILITY_OFF); + m_creature->Kill(m_creature); + break; + + } + } else uiOutroTimer -= diff; + break; } } + void JustDied(Unit* killer) { if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, DONE); + { + pInstance->SetData(DATA_MAL_GANIS_EVENT, DONE); + + // give achievement credit to players. criteria use spell 58630 which doesn't exist. + if (pInstance) + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + } } + void KilledUnit(Unit *victim) { if (victim == m_creature) diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp index 597a4159fa8..e9cae41409a 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp @@ -29,21 +29,21 @@ Script Data End */ enum Spells { - SPELL_CONSTRICTING_CHAINS = 52696, //Encases the targets in chains, dealing 1800 Physical damage every 1 sec. and stunning the target for 5 sec. - H_SPELL_CONSTRICTING_CHAINS = 58823, - SPELL_DISEASE_EXPULSION = 52666, //Meathook belches out a cloud of disease, dealing 1710 to 1890 Nature damage and interrupting the spell casting of nearby enemy targets for 4 sec. - H_SPELL_DISEASE_EXPULSION = 58824, - SPELL_FRENZY = 58841 //Increases the caster's Physical damage by 10% for 30 sec. + SPELL_CONSTRICTING_CHAINS = 52696, //Encases the targets in chains, dealing 1800 Physical damage every 1 sec. and stunning the target for 5 sec. + H_SPELL_CONSTRICTING_CHAINS = 58823, + SPELL_DISEASE_EXPULSION = 52666, //Meathook belches out a cloud of disease, dealing 1710 to 1890 Nature damage and interrupting the spell casting of nearby enemy targets for 4 sec. + H_SPELL_DISEASE_EXPULSION = 58824, + SPELL_FRENZY = 58841 //Increases the caster's Physical damage by 10% for 30 sec. }; -//not in db + enum Yells { - SAY_AGGRO = -1595026, - SAY_SLAY_1 = -1595027, - SAY_SLAY_2 = -1595028, - SAY_SLAY_3 = -1595029, - SAY_SPAWN = -1595030, - SAY_DEATH = -1595031 + SAY_AGGRO = -1595026, + SAY_SLAY_1 = -1595027, + SAY_SLAY_2 = -1595028, + SAY_SLAY_3 = -1595029, + SAY_SPAWN = -1595030, + SAY_DEATH = -1595031 }; struct boss_meathookAI : public ScriptedAI diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp index ae8a9f0fe52..c1841771559 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_salramm.cpp @@ -41,22 +41,21 @@ enum Spells SPELL_SUMMON_GHOULS = 52451 }; -//not in db enum Yells { - SAY_AGGRO = -1595032, - SAY_SPAWN = -1595033, - SAY_SLAY_1 = -1595034, - SAY_SLAY_2 = -1595035, - SAY_SLAY_3 = -1595036, - SAY_DEATH = -1595037, - SAY_EXPLODE_GHOUL_1 = -1595038, - SAY_EXPLODE_GHOUL_2 = -1595039, - SAY_STEAL_FLESH_1 = -1595040, - SAY_STEAL_FLESH_2 = -1595041, - SAY_STEAL_FLESH_3 = -1595042, - SAY_SUMMON_GHOULS_1 = -1595043, - SAY_SUMMON_GHOULS_2 = -1595044 + SAY_AGGRO = -1595032, + SAY_SPAWN = -1595033, + SAY_SLAY_1 = -1595034, + SAY_SLAY_2 = -1595035, + SAY_SLAY_3 = -1595036, + SAY_DEATH = -1595037, + SAY_EXPLODE_GHOUL_1 = -1595038, + SAY_EXPLODE_GHOUL_2 = -1595039, + SAY_STEAL_FLESH_1 = -1595040, + SAY_STEAL_FLESH_2 = -1595041, + SAY_STEAL_FLESH_3 = -1595042, + SAY_SUMMON_GHOULS_1 = -1595043, + SAY_SUMMON_GHOULS_2 = -1595044 }; struct boss_salrammAI : public ScriptedAI @@ -64,23 +63,25 @@ struct boss_salrammAI : public ScriptedAI boss_salrammAI(Creature *c) : ScriptedAI(c) { pInstance = c->GetInstanceData(); + if (pInstance) + DoScriptText(SAY_SPAWN,m_creature); } - uint32 Curse_flesh_Timer; - uint32 Explode_ghoul_Timer; - uint32 Shadow_bolt_Timer; - uint32 Steal_flesh_Timer; - uint32 Summon_ghouls_Timer; + uint32 uiCurseFleshTimer; + uint32 uiExplodeGhoulTimer; + uint32 uiShadowBoltTimer; + uint32 uiStealFleshTimer; + uint32 uiSummonGhoulsTimer; ScriptedInstance* pInstance; void Reset() { - Curse_flesh_Timer = 30000; //30s DBM - Explode_ghoul_Timer = urand(25000,28000); //approx 6 sec after summon ghouls - Shadow_bolt_Timer = urand(8000,12000); // approx 10s - Steal_flesh_Timer = 12345; - Summon_ghouls_Timer = urand(19000,24000); //on a video approx 24s after aggro + uiCurseFleshTimer = 30000; //30s DBM + uiExplodeGhoulTimer = urand(25000,28000); //approx 6 sec after summon ghouls + uiShadowBoltTimer = urand(8000,12000); // approx 10s + uiStealFleshTimer = 12345; + uiSummonGhoulsTimer = urand(19000,24000); //on a video approx 24s after aggro if (pInstance) pInstance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); @@ -94,8 +95,6 @@ struct boss_salrammAI : public ScriptedAI pInstance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS); } - void AttackStart(Unit* who) {} - void MoveInLineOfSight(Unit* who) {} void UpdateAI(const uint32 diff) { //Return since we have no target @@ -103,37 +102,37 @@ struct boss_salrammAI : public ScriptedAI return; //Curse of twisted flesh timer - if (Curse_flesh_Timer <= diff) + if (uiCurseFleshTimer <= diff) { DoCast(m_creature->getVictim(), SPELL_CURSE_OF_TWISTED_FLESH); - Curse_flesh_Timer = 37000; - } else Curse_flesh_Timer -= diff; + uiCurseFleshTimer = 37000; + } else uiCurseFleshTimer -= diff; //Shadow bolt timer - if (Shadow_bolt_Timer <= diff) + if (uiShadowBoltTimer <= diff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, DUNGEON_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); - Shadow_bolt_Timer = urand(8000,12000); - } else Shadow_bolt_Timer -= diff; + uiShadowBoltTimer = urand(8000,12000); + } else uiShadowBoltTimer -= diff; //Steal Flesh timer - if (Steal_flesh_Timer <= diff) + if (uiStealFleshTimer <= diff) { DoScriptText(RAND(SAY_STEAL_FLESH_1,SAY_STEAL_FLESH_2,SAY_STEAL_FLESH_3), m_creature); if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(random_pTarget, SPELL_STEAL_FLESH); - Steal_flesh_Timer = 10000; - } else Steal_flesh_Timer -= diff; + uiStealFleshTimer = 10000; + } else uiStealFleshTimer -= diff; //Summon ghouls timer - if (Summon_ghouls_Timer <= diff) + if (uiSummonGhoulsTimer <= diff) { DoScriptText(RAND(SAY_SUMMON_GHOULS_1,SAY_SUMMON_GHOULS_2), m_creature); if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(random_pTarget, SPELL_SUMMON_GHOULS); - Summon_ghouls_Timer = 10000; - } else Summon_ghouls_Timer -= diff; + uiSummonGhoulsTimer = 10000; + } else uiSummonGhoulsTimer -= diff; DoMeleeAttackIfReady(); } diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp new file mode 100644 index 00000000000..63c7f0b0f83 --- /dev/null +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.cpp @@ -0,0 +1,1210 @@ +/* +* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> +* +* 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 "ScriptedPch.h" +#include "culling_of_stratholme.h" +#include "ScriptedEscortAI.h" + +enum Says +{ + //First Act - Uther and Jaina Dialog + SAY_PHASE101 = -1595070, //Arthas + SAY_PHASE102 = -1595071, //Uther + SAY_PHASE103 = -1595072, //Arthas + SAY_PHASE104 = -1595073, //Arthas + SAY_PHASE105 = -1595074, //Uther + SAY_PHASE106 = -1595075, //Arthas + SAY_PHASE107 = -1595076, //Uther + SAY_PHASE108 = -1595077, //Arthas + SAY_PHASE109 = -1595078, //Arthas + SAY_PHASE110 = -1595079, //Uther + SAY_PHASE111 = -1595080, //Arthas + SAY_PHASE112 = -1595081, //Uther + SAY_PHASE113 = -1595082, //Jaina + SAY_PHASE114 = -1595083, //Arthas + SAY_PHASE115 = -1595084, //Uther + SAY_PHASE116 = -1595085, //Arthas + SAY_PHASE117 = -1595086, //Jaina + SAY_PHASE118 = -1595087, //Arthas + //Second Act - City Streets + SAY_PHASE201 = -1595088, //Arthas + SAY_PHASE202 = -1595089, //Cityman + SAY_PHASE203 = -1595090, //Arthas + SAY_PHASE204 = -1595091, //Crazyman + SAY_PHASE205 = -1595092, //Arthas + SAY_PHASE206 = -1595009, //Malganis + SAY_PHASE207 = -1595010, //Malganis + SAY_PHASE208 = -1595093, //Arthas + SAY_PHASE209 = -1595094, //Arthas + SAY_PHASE210 = -1595095, //Arthas + //Third Act - Town Hall + SAY_PHASE301 = -1595096, //Arthas + SAY_PHASE302 = -1595097, //Drakonian + SAY_PHASE303 = -1595098, //Arthas + SAY_PHASE304 = -1595099, //Arthas + SAY_PHASE305 = -1595100, //Drakonian + SAY_PHASE306 = -1595101, //Arthas + SAY_PHASE307 = -1595102, //Arthas + SAY_PHASE308 = -1595103, //Arthas + SAY_PHASE309 = -1595104, //Arthas + SAY_PHASE310 = -1595105, //Arthas + SAY_PHASE311 = -1595106, //Arthas + SAY_PHASE312 = -1595107, //Arthas + SAY_PHASE313 = -1595108, //Arthas + SAY_PHASE314 = -1595000, //Epoch + SAY_PHASE315 = -1595109, //Arthas + //Fourth Act - Fire Corridor + SAY_PHASE401 = -1595110, //Arthas + SAY_PHASE402 = -1595111, //Arthas + SAY_PHASE403 = -1595112, //Arthas + SAY_PHASE404 = -1595113, //Arthas + SAY_PHASE405 = -1595114, //Arthas + SAY_PHASE406 = -1595115, //Arthas + SAY_PHASE407 = -1595116, //Arthas + //Fifth Act - Mal'Ganis Fight + SAY_PHASE501 = -1595117, //Arthas + SAY_PHASE502 = -1595118, //Arthas + SAY_PHASE503 = -1595119, //Arthas + SAY_PHASE504 = -1595120, //Arthas +}; + +enum NPCs +{ + NPC_INFINITE_ADVERSARY = 27742, + NPC_INFINITE_HUNTER = 27743, + NPC_INFINITE_AGENT = 27744, + NPC_TIME_RIFT = 28409, + NPC_ZOMBIE = 27737, + NPC_GHOUL = 28249, + NPC_NECROMANCER = 28200, + NPC_STALKER = 28199, + NPC_FIEND = 27734, + NPC_GOLEM = 28201, + NPC_EGHOUL = 27729, + NPC_CONSTRUCT = 27736, + + NPC_INVIS_TARGET = 20562, + + NPC_KNIGHT_ESCORT = 27745, + NPC_PRIEST_ESCORT = 27747, + NPC_CITY_MAN = 28167, + NPC_CITY_MAN2 = 28169, + NPC_CITY_MAN3 = 31126, + NPC_CITY_MAN4 = 31127, +}; + +enum Spells +{ + SPELL_FEAR = 39176, + SPELL_ARTHAS_AURA = 52442, + SPELL_EXORCISM_N = 52445, + SPELL_EXORCISM_H = 58822, + SPELL_HOLY_LIGHT = 52444, +}; + +enum GossipMenuArthas +{ + GOSSIP_MENU_ARTHAS_1 = 100001, + GOSSIP_MENU_ARTHAS_2 = 100002, + GOSSIP_MENU_ARTHAS_3 = 100003, + GOSSIP_MENU_ARTHAS_4 = 100004, + GOSSIP_MENU_ARTHAS_5 = 100005 +}; + +enum +{ + ENCOUNTER_WAVES_NUMBER = 8, + ENCOUNTER_WAVES_MAX_SPAWNS = 5, + ENCOUNTER_DRACONIAN_NUMBER = 4, + ENCOUNTER_CHRONO_SPAWNS = 19 +}; + +// Locations for necromancers and add to spawn +float WavesLocations[ENCOUNTER_WAVES_NUMBER][ENCOUNTER_WAVES_MAX_SPAWNS][5]= +{ + { + {NPC_ZOMBIE, 2164.698975, 1255.392944, 135.040878, 0.490202}, + {NPC_ZOMBIE, 2183.501465, 1263.079102, 134.859055, 3.169981}, + {NPC_GHOUL, 2177.512939, 1247.313843, 135.846695, 1.696574}, + {NPC_GHOUL, 2171.991943, 1246.615845, 135.745026, 1.696574}, + {0, 0, 0, 0, 0} + }, + { + {NPC_GHOUL, 2254.434326, 1163.427612, 138.055038, 2.077358}, + {NPC_GHOUL, 2254.703613, 1158.867798, 138.212234, 2.345532}, + {NPC_GHOUL, 2257.615723, 1162.310913, 138.091202, 2.077358}, + {NPC_NECROMANCER, 2258.258057, 1157.250732, 138.272873, 2.387766}, + {0, 0, 0, 0, 0} + }, + { + {NPC_STALKER, 2348.120117, 1202.302490, 130.491104, 4.698538}, + {NPC_GHOUL, 2352.863525, 1207.819092, 130.424271, 4.949865}, + {NPC_GHOUL, 2343.593750, 1207.915039, 130.781311, 4.321547}, + {NPC_NECROMANCER, 2348.257324, 1212.202515, 130.670135, 4.450352}, + {0, 0, 0, 0, 0} + }, + { + {NPC_STALKER, 2139.825195, 1356.277100, 132.199615, 5.820131}, + {NPC_GHOUL, 2137.073486, 1362.464844, 132.271637, 5.820131}, + {NPC_GHOUL, 2134.075684, 1354.148071, 131.885864, 5.820131}, + {NPC_NECROMANCER, 2133.302246, 1358.907837, 132.037689, 5.820131}, + {0, 0, 0, 0, 0} + }, + { + {NPC_NECROMANCER, 2264.013428, 1174.055908, 138.093094, 2.860481}, + {NPC_GHOUL, 2264.207764, 1170.892700, 138.034973, 2.860481}, + {NPC_GHOUL, 2266.948975, 1176.898926, 137.976929, 2.860481}, + {NPC_STALKER, 2269.215576, 1170.109253, 137.742691, 2.860481}, + {NPC_FIEND, 2273.106689, 1176.101074, 137.880508, 2.860481} + }, + { + {NPC_GOLEM, 2349.701660, 1188.436646, 130.428864, 3.908642}, + {NPC_GHOUL, 2349.909180, 1194.582642, 130.417816, 3.577001}, + {NPC_EGHOUL, 2354.662598, 1185.692017, 130.552032, 3.577001}, + {NPC_EGHOUL, 2354.716797, 1191.614380, 130.539810, 3.577001}, + {0, 0, 0, 0, 0} + }, + { + {NPC_CONSTRUCT, 2145.212891, 1355.288086, 132.288773, 6.004838}, + {NPC_NECROMANCER, 2137.078613, 1357.612671, 132.173340, 6.004838}, + {NPC_EGHOUL, 2139.402100, 1352.541626, 132.127518, 5.812850}, + {NPC_EGHOUL, 2142.408447, 1360.760620, 132.321564, 5.812850}, + {0, 0, 0, 0, 0} + }, + { + {NPC_GHOUL, 2172.686279, 1259.618164, 134.391754, 1.865499}, + {NPC_FIEND, 2177.649170, 1256.061157, 135.096512, 1.849572}, + {NPC_CONSTRUCT, 2170.782959, 1253.594849, 134.973022, 1.849572}, + {NPC_NECROMANCER, 2175.595703, 1249.041992, 135.603531, 1.849572}, + {0, 0, 0, 0, 0} + } +}; + +// Locations for rifts to spawn and draconians to go +float RiftAndSpawnsLocations[ENCOUNTER_CHRONO_SPAWNS][5]= +{ + {NPC_TIME_RIFT, 2431.790039, 1190.670044, 148.076004, 0.187923}, + {NPC_INFINITE_ADVERSARY, 2433.857910, 1185.612061, 148.075974, 4.566168}, + {NPC_INFINITE_ADVERSARY, 2437.577881, 1188.241089, 148.075974, 0.196999}, + {NPC_INFINITE_AGENT, 2437.165527, 1192.294922, 148.075974, 0.169247}, + {NPC_INFINITE_HUNTER, 2434.989990, 1197.679565, 148.075974, 0.715971}, + {NPC_TIME_RIFT, 2403.954834, 1178.815430, 148.075943, 4.966126}, + {NPC_INFINITE_AGENT, 2403.676758, 1171.495850, 148.075607, 4.902797}, + {NPC_INFINITE_HUNTER, 2407.691162, 1172.162720, 148.075607, 4.963010}, + {NPC_TIME_RIFT, 2414.217041, 1133.446167, 148.076050, 1.706972}, + {NPC_INFINITE_ADVERSARY, 2416.024658, 1139.456177, 148.076431, 1.752129}, + {NPC_INFINITE_HUNTER, 2410.866699, 1139.680542, 148.076431, 1.752129}, + {NPC_TIME_RIFT, 2433.081543, 1099.869751, 148.076157, 1.809509}, + {NPC_INFINITE_ADVERSARY, 2426.947998, 1107.471680, 148.076019, 1.877580}, + {NPC_INFINITE_HUNTER, 2432.944580, 1108.896362, 148.208160, 2.199241}, + {NPC_TIME_RIFT, 2444.077637, 1114.366089, 148.076157, 3.049565}, + {NPC_INFINITE_ADVERSARY, 2438.190674, 1118.368164, 148.076172, 3.139232}, + {NPC_INFINITE_AGENT, 2435.861328, 1113.402954, 148.169327, 2.390271}, + {NPC_TIME_RIFT, 2463.131592, 1115.391724, 152.473129, 3.409651}, + {NPC_EPOCH, 2451.809326, 1112.901245, 149.220459, 3.363617} +}; + +struct npc_arthasAI : public npc_escortAI +{ + npc_arthasAI(Creature *pCreature) : npc_escortAI(pCreature) + { + pInstance = pCreature->GetInstanceData(); + Reset(); + } + + ScriptedInstance* pInstance; + + bool bStepping; + uint32 uiStep; + uint32 uiPhaseTimer; + uint32 uiGossipStep; + uint32 uiPlayerFaction; + uint32 uiBossEvent; + uint32 uiWave; + + uint64 uiUtherGUID; + uint64 uiJainaGUID; + uint64 uiCitymenGUID[2]; + uint64 uiWaveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; + uint64 uiInfiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; + uint64 uiStalkerGUID; + + uint64 uiBossGUID; //uiMeathookGUID || uiSalrammGUID + uint64 uiEpochGUID; + uint64 uiMalganisGUID; + uint64 uiInfiniteGUID; + + uint32 uiExorcismTimer; + + void Reset() + { + uiUtherGUID = 0; + uiJainaGUID = 0; + + for (uint8 i = 0; i < 2; ++i) + uiCitymenGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + uiWaveGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) + uiInfiniteDraconianGUID[i] = 0; + + uiStalkerGUID = 0; + uiBossGUID = 0; + uiEpochGUID = 0; + uiMalganisGUID = 0; + uiInfiniteGUID = 0; + + if (pInstance) { + pInstance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED); + switch(pInstance->GetData(DATA_ARTHAS_EVENT)) + { + case NOT_STARTED: + bStepping = true; + uiStep = 0; + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + uiBossEvent = DATA_MEATHOOK_EVENT; + uiGossipStep = 0; + break; + } + uiPhaseTimer = 1000; + uiExorcismTimer = 7300; + uiWave = 0; + } + } + + void EnterCombat(Unit* who) + { + DoCast(m_creature, SPELL_ARTHAS_AURA); + } + + void JustDied(Unit *killer) + { + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, FAIL); + } + + void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector) + { + m_creature->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_DESPAWN,11000); + + for (uint32 i = timeRiftID+1; i < ENCOUNTER_CHRONO_SPAWNS; ++i) + { + if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_TIME_RIFT) break; + if (Creature* pTemp = m_creature->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + guidVector[i-timeRiftID-1] = pTemp->GetGUID(); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pTemp->SetReactState(REACT_PASSIVE); + pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]); + if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) + uiEpochGUID = pTemp->GetGUID(); + } + } + } + + void SpawnWaveGroup(uint32 waveID, uint64* guidVector) + { + for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + { + if ((uint32)WavesLocations[waveID][i][0] == 0) break; + if (Creature* pTemp = m_creature->SummonCreature((uint32)WavesLocations[waveID][i][0],WavesLocations[waveID][i][1],WavesLocations[waveID][i][2],WavesLocations[waveID][i][3],WavesLocations[waveID][i][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + guidVector[i] = pTemp->GetGUID(); + } + } + } + + void SetHoldState(bool bOnHold) + { + SetEscortPaused(bOnHold); + } + + void JumpToNextStep(uint32 uiTimer) + { + uiPhaseTimer = uiTimer; + ++uiStep; + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + case 1: + case 3: + case 9: + case 10: + case 11: + case 22: + case 23: + case 26: + case 55: + case 56: + SetHoldState(true); + bStepping = true; + break; + case 7: + if (Unit* pCityman0 = m_creature->SummonCreature(NPC_CITY_MAN,2091.977f,1275.021f,140.757f,0.558f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) + uiCitymenGUID[0] = pCityman0->GetGUID(); + if (Unit* pCityman1 = m_creature->SummonCreature(NPC_CITY_MAN2,2093.514f,1275.842f,140.408f,3.801f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) + uiCitymenGUID[1] = pCityman1->GetGUID(); + break; + case 8: + uiGossipStep = 1; + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + case 12: + SetRun(true); + DoScriptText(SAY_PHASE210, m_creature); + if (Unit* pDisguised0 = m_creature->SummonCreature(NPC_CITY_MAN3,2398.14f,1207.81f,134.04f,5.155249f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[0] = pDisguised0->GetGUID(); + if (Unit* pDisguised1 = m_creature->SummonCreature(NPC_CITY_MAN4,2403.22f,1205.54f,134.04f,3.311264f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[1] = pDisguised1->GetGUID(); + + if (Unit* pDisguised2 = m_creature->SummonCreature(NPC_CITY_MAN,2400.82f,1201.69f,134.01f,1.534082f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID(); + pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[0]); + pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + } + } + } + break; + case 20: + uiGossipStep = 2; + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetRun(false); + SetHoldState(true); + break; + case 21: + DoScriptText(SAY_PHASE301, m_creature); + break; + case 25: + SetRun(false); + SpawnTimeRift(0,&uiInfiniteDraconianGUID[0]); + DoScriptText(SAY_PHASE307,m_creature); + break; + case 29: + SetRun(false); + SpawnTimeRift(5,&uiInfiniteDraconianGUID[0]); + SpawnTimeRift(8,&uiInfiniteDraconianGUID[2]); + DoScriptText(SAY_PHASE309,m_creature); + SetHoldState(true); + bStepping = true; + break; + case 31: + SetRun(false); + SpawnTimeRift(11,&uiInfiniteDraconianGUID[0]); + SpawnTimeRift(14,&uiInfiniteDraconianGUID[2]); + DoScriptText(SAY_PHASE311,m_creature); + SetHoldState(true); + bStepping = true; + break; + case 32: + DoScriptText(SAY_PHASE401,m_creature); + break; + case 34: + DoScriptText(SAY_PHASE402,m_creature); + break; + case 35: + DoScriptText(SAY_PHASE403,m_creature); + break; + case 36: + if (pInstance) + { + GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE)); + pGate->SetGoState(GO_STATE_ACTIVE); + } + break; + case 45: + SetRun(true); + SetDespawnAtFar(false); + uiGossipStep = 4; + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + case 47: + SetRun(false); + DoScriptText(SAY_PHASE405,m_creature); + break; + case 48: + SetRun(true); + DoScriptText(SAY_PHASE406,m_creature); + break; + case 53: + DoScriptText(SAY_PHASE407,m_creature); + break; + case 54: + uiGossipStep = 5; + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + } + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + DoMeleeAttackIfReady(); + + if(bStepping) + { + if (uiPhaseTimer <= diff) + { + switch(uiStep) + { + //After reset + case 0: + if (Unit* pJaina = GetClosestCreatureWithEntry(m_creature, NPC_JAINA, 50.0f)) + uiJainaGUID = pJaina->GetGUID(); + else if (Unit* pJaina = m_creature->SummonCreature(NPC_JAINA,1895.48f,1292.66f,143.706f,0.023475f,TEMPSUMMON_DEAD_DESPAWN,180000)) + uiJainaGUID = pJaina->GetGUID(); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 0 + case 1: + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + if(Unit* pUther = m_creature->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiUtherGUID = pUther->GetGUID(); + pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); + pUther->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiUtherGUID); + } + JumpToNextStep(17000); + break; + case 2: + DoScriptText(SAY_PHASE101, m_creature); + JumpToNextStep(2000); + break; + case 3: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + { + DoScriptText(SAY_PHASE102, pUther); + } + JumpToNextStep(8000); + break; + case 4: + SetEscortPaused(false); + bStepping = false; + SetRun(false); + DoScriptText(SAY_PHASE103, m_creature); + JumpToNextStep(0); + break; + //After waypoint 1 + case 5: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + pJaina->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + DoScriptText(SAY_PHASE104, m_creature); + JumpToNextStep(10000); + break; + case 6: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE105, pUther); + JumpToNextStep(1000); + break; + case 7: + DoScriptText(SAY_PHASE106, m_creature); + JumpToNextStep(4000); + break; + case 8: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE107, pUther); + JumpToNextStep(6000); + break; + case 9: + DoScriptText(SAY_PHASE108, m_creature); + JumpToNextStep(4000); + break; + case 10: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE109, pUther); + JumpToNextStep(8000); + break; + case 11: + DoScriptText(SAY_PHASE110, m_creature); + JumpToNextStep(4000); + break; + case 12: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE111, pUther); + JumpToNextStep(4000); + break; + case 13: + DoScriptText(SAY_PHASE112, m_creature); + JumpToNextStep(11000); + break; + case 14: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + DoScriptText(SAY_PHASE113, pJaina); + JumpToNextStep(3000); + break; + case 15: + DoScriptText(SAY_PHASE114, m_creature); + JumpToNextStep(9000); + break; + case 16: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE115, pUther); + JumpToNextStep(4000); + break; + case 17: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + { + pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + pUther->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); + } + JumpToNextStep(1000); + break; + case 18: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + { + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + pJaina->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); + } + JumpToNextStep(1000); + break; + case 19: + DoScriptText(SAY_PHASE116, m_creature); + JumpToNextStep(1000); + break; + case 20: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + DoScriptText(SAY_PHASE117, pJaina); + JumpToNextStep(3000); + break; + case 21: + SetEscortPaused(false); + bStepping = false; + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After waypoint 3 + case 22: + DoScriptText(SAY_PHASE118, m_creature); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + JumpToNextStep(10000); + break; + case 23: + SetEscortPaused(false); + bStepping = false; + SetRun(true); + + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + pJaina->DisappearAndDie(); + + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + pUther->DisappearAndDie(); + + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After Gossip 1 (waypoint 8) + case 24: + if (Unit* pStalker = m_creature->SummonCreature(NPC_INVIS_TARGET,2026.469f,1287.088f,143.596f,1.37f,TEMPSUMMON_TIMED_DESPAWN,14000)) + { + uiStalkerGUID = pStalker->GetGUID(); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + JumpToNextStep(1000); + break; + case 25: + DoScriptText(SAY_PHASE201, m_creature); + JumpToNextStep(12000); + break; + case 26: + SetEscortPaused(false); + bStepping = false; + SetRun(false); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After waypoint 9 + case 27: + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[0]); + if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) + { + pCityman->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + pCityman->GetMotionMaster()->MovePoint(0, 2088.625f,1279.191f,140.743f); + } + JumpToNextStep(2000); + break; + case 28: + if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) + DoScriptText(SAY_PHASE202, pCityman); + JumpToNextStep(4000); + break; + case 29: + SetEscortPaused(false); + bStepping = false; + DoScriptText(SAY_PHASE203, m_creature); + JumpToNextStep(0); + break; + //After waypoint 10 + case 30: + m_creature->HandleEmoteCommand(37); + JumpToNextStep(1000); + break; + case 31: + SetEscortPaused(false); + bStepping = false; + if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) + { + DoScriptText(SAY_PHASE204, pCityman1); + pCityman1->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0])) + pCityman0->Kill(pCityman0); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[1]); + } + JumpToNextStep(0); + break; + //After waypoint 11 + case 32: + m_creature->HandleEmoteCommand(37); + JumpToNextStep(1000); + break; + case 33: + if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) + pCityman1->Kill(pCityman1); + JumpToNextStep(1000); + break; + case 34: + if (Unit* pStalker = m_creature->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) + { + uiStalkerGUID = pStalker->GetGUID(); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + DoScriptText(SAY_PHASE205, m_creature); + JumpToNextStep(3000); + break; + case 35: + if (Unit* pStalkerM = m_creature->SummonCreature(NPC_INVIS_TARGET,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + uiStalkerGUID = pStalkerM->GetGUID(); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + JumpToNextStep(1000); + break; + case 36: + if (Creature* pMalganis = m_creature->SummonCreature(NPC_MAL_GANIS,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + if (Creature* pStalkerM = Unit::GetCreature(*me, uiStalkerGUID)) + pMalganis->CastSpell(pStalkerM,63793,false); + + uiMalganisGUID = pMalganis->GetGUID(); + DoScriptText(SAY_PHASE206, pMalganis); + pMalganis->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + pMalganis->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(11000); + break; + case 37: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + { + if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) + pZombie->UpdateEntry(NPC_ZOMBIE, 0); + else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) + pZombie->UpdateEntry(NPC_ZOMBIE, 0); + else //There's no one else to transform + uiStep++; + } + else + uiStep++; + uiPhaseTimer = 500; + break; + case 38: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + DoScriptText(SAY_PHASE207, pMalganis); + JumpToNextStep(17000); + break; + case 39: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + pMalganis->SetVisibility(VISIBILITY_OFF); + DoScriptText(SAY_PHASE208, m_creature); + JumpToNextStep(7000); + break; + case 40: + if (Unit* pStalker = m_creature->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) + { + uiStalkerGUID = pStalker->GetGUID(); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + DoScriptText(SAY_PHASE209, m_creature); + + uiBossEvent = DATA_MEATHOOK_EVENT; + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, IN_PROGRESS); + + m_creature->SetReactState(REACT_DEFENSIVE); + SetDespawnAtFar(false); + JumpToNextStep(5000); + break; + case 41: //Summon wave group + case 43: + case 45: + case 47: + case 51: + case 53: + case 55: + case 57: + if (pInstance->GetData(uiBossEvent) != DONE) + { + SpawnWaveGroup(uiWave, uiWaveGUID); + uiWave++; + } + JumpToNextStep(500); + break; + case 42: //Wait group to die + case 44: + case 46: + case 48: + case 52: + case 54: + case 56: + case 58: + if (pInstance->GetData(uiBossEvent) != DONE) + { + uint32 mobCounter = 0; + uint32 deadCounter = 0; + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + { + if (uiWaveGUID[i] == 0) + break; + ++mobCounter; + Unit* pTemp = Unit::GetCreature(*me, uiWaveGUID[i]); + if (!pTemp || pTemp->isDead()) + ++deadCounter; + } + + if (mobCounter <= deadCounter) //If group is dead + JumpToNextStep(1000); + else + uiPhaseTimer = 1000; + } + else + JumpToNextStep(500); + break; + case 49: //Summon Boss + case 59: + if (pInstance->GetData(uiBossEvent) != DONE) + { + uint32 uiBossID = 0; + if (uiBossEvent == DATA_MEATHOOK_EVENT) + uiBossID = NPC_MEATHOOK; + else if (uiBossEvent == DATA_SALRAMM_EVENT) + uiBossID = NPC_SALRAMM; + + if (Unit* pBoss = m_creature->SummonCreature(uiBossID,2232.19f,1331.933f,126.662f,3.15f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + uiBossGUID = pBoss->GetGUID(); + pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + pBoss->GetMotionMaster()->MovePoint(0, 2194.110f,1332.00f,130.00f); + } + } + JumpToNextStep(30000); + break; + case 50: //Wait Boss death + case 60: + if (pInstance) + { + if (pInstance->GetData(uiBossEvent) == DONE) + { + JumpToNextStep(1000); + if (uiBossEvent == DATA_MEATHOOK_EVENT) + uiBossEvent = DATA_SALRAMM_EVENT; + else if (uiBossEvent == DATA_SALRAMM_EVENT) + { + SetHoldState(false); + bStepping = false; + uiBossEvent = DATA_EPOCH_EVENT; + } + } + else if (pInstance->GetData(uiBossEvent) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After Gossip 2 (waypoint 22) + case 61: + m_creature->SetReactState(REACT_AGGRESSIVE); + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) + pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) + pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->GetGUID()); + JumpToNextStep(1000); + break; + case 62: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + DoScriptText(SAY_PHASE302, pDisguised0); + JumpToNextStep(7000); + break; + case 63: + DoScriptText(SAY_PHASE303, m_creature); + SetHoldState(false); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 23 + case 64: + m_creature->HandleEmoteCommand(54); + JumpToNextStep(1000); + break; + case 65: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + pDisguised0->HandleEmoteCommand(11); + JumpToNextStep(1000); + break; + case 66: + DoScriptText(SAY_PHASE304,m_creature); + JumpToNextStep(2000); + break; + case 67: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + DoScriptText(SAY_PHASE305,pDisguised0); + JumpToNextStep(1000); + break; + case 68: + if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) + { + pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); + //Make them unattackable + pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised2->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(2000); + break; + case 69: + if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) + { + pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); + //Make them unattackable + pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised1->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(2000); + break; + case 70: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + { + pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); + //Make them unattackable + pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised0->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(2000); + break; + case 71: + //After waypoint 26,29,31 + case 73: + case 75: + case 77: + //Make cratures attackable + for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) + { + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pTemp->SetReactState(REACT_AGGRESSIVE); + } + JumpToNextStep(5000); + break; + case 72: + case 74: + case 76: + if (m_creature->isInCombat()) + uiPhaseTimer = 1000; + else + { + if (uiStep == 72) DoScriptText(SAY_PHASE308,m_creature); + if (uiStep == 74) DoScriptText(SAY_PHASE308,m_creature); + if (uiStep == 76) DoScriptText(SAY_PHASE310,m_creature); + SetHoldState(false); + bStepping = false; + SetRun(true); + JumpToNextStep(2000); + } + break; + case 78: + if (m_creature->isInCombat()) + uiPhaseTimer = 1000; + else + { + DoScriptText(SAY_PHASE312,m_creature); + JumpToNextStep(5000); + } + break; + case 79: + DoScriptText(SAY_PHASE313,m_creature); + JumpToNextStep(1000); + break; + case 80: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + { + SpawnTimeRift(17,&uiEpochGUID); + if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) + DoScriptText(SAY_PHASE314,pEpoch); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiEpochGUID); + } + JumpToNextStep(18000); + break; + case 81: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + DoScriptText(SAY_PHASE315, m_creature); + JumpToNextStep(6000); + break; + case 82: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + { + if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) + { + //Make Epoch attackable + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pEpoch->SetReactState(REACT_AGGRESSIVE); + } + + } + JumpToNextStep(1000); + break; + case 83: + if (pInstance) + { + if (pInstance->GetData(DATA_EPOCH_EVENT) == DONE) + { + uiGossipStep = 3; + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + bStepping = false; + uiBossEvent = DATA_MAL_GANIS_EVENT; + JumpToNextStep(15000); + } + else if (pInstance->GetData(DATA_EPOCH_EVENT) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After Gossip 4 + case 84: + DoScriptText(SAY_PHASE404,m_creature); + SetHoldState(false); + bStepping = false; + break; + //After Gossip 5 + case 85: + DoScriptText(SAY_PHASE501, m_creature); + if(Creature* pMalganis = m_creature->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + uiMalganisGUID = pMalganis->GetGUID(); + pMalganis->SetReactState(REACT_PASSIVE); + } + if (pInstance) + { + GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAL_GANIS_GATE_1)); + pGate->SetGoState(GO_STATE_ACTIVE); + } + SetHoldState(false); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 55 + case 86: + DoScriptText(SAY_PHASE502, m_creature); + JumpToNextStep(6000); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + break; + case 87: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + { + pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_UNK_9 | UNIT_FLAG_UNK_15); + pMalganis->SetReactState(REACT_AGGRESSIVE); + } + JumpToNextStep(1000); + break; + case 88: + if (pInstance) + { + if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == DONE) + { + SetHoldState(false); + JumpToNextStep(1000); + } + else if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After waypoint 56 + case 89: + SetRun(true); + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + DoScriptText(SAY_PHASE503, m_creature); + JumpToNextStep(7000); + break; + case 90: + if (pInstance) + { + pInstance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D + m_creature->SetUInt64Value(UNIT_FIELD_TARGET, pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind + } + DoScriptText(SAY_PHASE504, m_creature); + bStepping = false; + break; + } + } else uiPhaseTimer -= diff; + } + + //Battling skills + if (!m_creature->getVictim()) + return; + + if (uiExorcismTimer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target, DUNGEON_MODE(SPELL_EXORCISM_N, SPELL_EXORCISM_H)); + uiExorcismTimer = 7300; + } else uiExorcismTimer -= diff; + + if (HealthBelowPct(40)) + DoCast(m_creature, SPELL_HOLY_LIGHT); + } +}; + +CreatureAI* GetAI_npc_arthas(Creature* pCreature) +{ + return new npc_arthasAI(pCreature); +} + +#define GOSSIP_ITEM_ARTHAS_0 "I'm ready to start Culling of Stratholme." +#define GOSSIP_ITEM_ARTHAS_1 "Yes, my Prince. We're ready." +#define GOSSIP_ITEM_ARTHAS_2 "We're only doing what is best for Loarderon your Highness." +#define GOSSIP_ITEM_ARTHAS_3 "I'm ready." +#define GOSSIP_ITEM_ARTHAS_4 "For Lordaeron!" +#define GOSSIP_ITEM_ARTHAS_5 "I'm ready to battle the dreadlord, sire." + +bool GossipHello_npc_arthas(Player* pPlayer, Creature* pCreature) +{ + npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); + + if (pAI && pAI->bStepping == false) + { + switch (pAI->uiGossipStep) + { + case 0: //This one is a workaround since the very beggining of the script is wrong. + if (pPlayer->GetQuestStatus(13149) != QUEST_STATUS_COMPLETE) + return false; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + break; + case 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_1, pCreature->GetGUID()); + break; + case 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_2, pCreature->GetGUID()); + break; + case 3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, pCreature->GetGUID()); + break; + case 4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_4, pCreature->GetGUID()); + break; + case 5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_5, pCreature->GetGUID()); + break; + default: + return false; + } + } + return true; +} + + +bool GossipSelect_npc_arthas(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 action ) +{ + npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); + + if (!pAI) + return false; + + switch (action) + { + case GOSSIP_ACTION_INFO_DEF: + pAI->Start(true,true,pPlayer->GetGUID(),0,false,false); + pAI->SetDespawnAtEnd(false); + pAI->bStepping = false; + pAI->uiStep = 1; + break; + case GOSSIP_ACTION_INFO_DEF+1: + pAI->bStepping = true; + pAI->uiStep = 24; + break; + case GOSSIP_ACTION_INFO_DEF+2: + pAI->SetHoldState(false); + pAI->bStepping = false; + pAI->uiStep = 61; + break; + case GOSSIP_ACTION_INFO_DEF+3: + pAI->SetHoldState(false); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pAI->bStepping = true; + pAI->uiStep = 84; + break; + case GOSSIP_ACTION_INFO_DEF+5: + pAI->bStepping = true; + pAI->uiStep = 85; + break; + } + pPlayer->CLOSE_GOSSIP_MENU(); + pAI->SetDespawnAtFar(true); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return true; +} + +void AddSC_culling_of_stratholme() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_arthas"; + newscript->GetAI = &GetAI_npc_arthas; + newscript->pGossipHello = &GossipHello_npc_arthas; + newscript->pGossipSelect = &GossipSelect_npc_arthas; + newscript->RegisterSelf(); +} diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.h b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.h index c25a3b02e49..ed3230b7526 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.h +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/culling_of_stratholme.h @@ -25,7 +25,8 @@ enum Data DATA_SALRAMM_EVENT, DATA_EPOCH_EVENT, DATA_MAL_GANIS_EVENT, - DATA_INFINITE_EVENT + DATA_INFINITE_EVENT, + DATA_ARTHAS_EVENT }; enum Data64 @@ -38,17 +39,20 @@ enum Data64 DATA_SHKAF_GATE, DATA_MAL_GANIS_GATE_1, DATA_MAL_GANIS_GATE_2, + DATA_EXIT_GATE, DATA_MAL_GANIS_CHEST }; enum Creatures { - NPC_MEATHOOK = 26529, - NPC_SALRAMM = 26530, - NPC_EPOCH = 26532, - NPC_MAL_GANIS = 26533, - NPC_INFINITE = 32273, - NPC_ARTHAS = 26499 + NPC_MEATHOOK = 26529, + NPC_SALRAMM = 26530, + NPC_EPOCH = 26532, + NPC_MAL_GANIS = 26533, + NPC_INFINITE = 32273, + NPC_ARTHAS = 26499, + NPC_JAINA = 26497, + NPC_UTHER = 26528 }; enum GameObjects @@ -56,6 +60,8 @@ enum GameObjects GO_SHKAF_GATE = 188686, GO_MALGANIS_GATE_1 = 187711, GO_MALGANIS_GATE_2 = 187723, - GO_MALGANIS_CHEST = 190663 + GO_EXIT_GATE = 191788, + GO_MALGANIS_CHEST_N = 190663, + GO_MALGANIS_CHEST_H = 193597 }; #endif diff --git a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp index 685af07cf2f..85561e30579 100644 --- a/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp +++ b/src/scripts/kalimdor/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp @@ -42,9 +42,10 @@ struct instance_culling_of_stratholme : public ScriptedInstance uint64 uiShkafGate; uint64 uiMalGanisGate1; uint64 uiMalGanisGate2; + uint64 uiExitGate; uint64 uiMalGanisChest; - uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; bool IsEncounterInProgress() const @@ -90,8 +91,16 @@ struct instance_culling_of_stratholme : public ScriptedInstance case GO_MALGANIS_GATE_2: uiMalGanisGate2 = pGo->GetGUID(); break; - case GO_MALGANIS_CHEST: + case GO_EXIT_GATE: + uiExitGate = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(uiExitGate,true); + break; + case GO_MALGANIS_CHEST_N: + case GO_MALGANIS_CHEST_H: uiMalGanisChest = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); break; } } @@ -111,9 +120,21 @@ struct instance_culling_of_stratholme : public ScriptedInstance break; case DATA_MAL_GANIS_EVENT: m_auiEncounter[3] = data; - GameObject *pGate; - if (data == IN_PROGRESS && (pGate = instance->GetGameObject(uiMalGanisGate2))) - pGate->SetGoState(GO_STATE_READY); + + switch(m_auiEncounter[3]) + { + case NOT_STARTED: + HandleGameObject(uiMalGanisGate2,true); + break; + case IN_PROGRESS: + HandleGameObject(uiMalGanisGate2,false); + break; + case DONE: + HandleGameObject(uiExitGate, true); + if (GameObject *pGo = instance->GetGameObject(uiMalGanisChest)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + break; + } break; case DATA_INFINITE_EVENT: m_auiEncounter[4] = data; @@ -146,8 +167,10 @@ struct instance_culling_of_stratholme : public ScriptedInstance case DATA_EPOCH: return uiEpoch; case DATA_MAL_GANIS: return uiMalGanis; case DATA_INFINITE: return uiInfinite; + case DATA_SHKAF_GATE: return uiShkafGate; case DATA_MAL_GANIS_GATE_1: return uiMalGanisGate1; case DATA_MAL_GANIS_GATE_2: return uiMalGanisGate2; + case DATA_EXIT_GATE: return uiExitGate; case DATA_MAL_GANIS_CHEST: return uiMalGanisChest; } return 0; |