diff options
| author | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
|---|---|---|
| committer | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
| commit | 590199d8e17405a0717eaf2e2d39f0d671b6f844 (patch) | |
| tree | 36755767c89c4639c7cb0e2f31d8a99f53bb8cf5 /src/server/scripts/Northrend | |
| parent | 8a69e50d6aff8ea75100a1fb660deecf03b3ea07 (diff) | |
* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project
* Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker.
--HG--
branch : trunk
rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp
rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
Diffstat (limited to 'src/server/scripts/Northrend')
126 files changed, 21373 insertions, 20877 deletions
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 76ffba26391..7ea4afbcb4b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -95,10 +95,10 @@ public: { boss_anub_arakAI(Creature *c) : ScriptedAI(c), lSummons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; bool bChanneling; bool bGuardianSummoned; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index bd83605cb80..223c75d1a27 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -53,12 +53,12 @@ public: { boss_hadronoxAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); fMaxDistance = 50.0f; bFirstTime = true; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiAcidTimer; uint32 uiLeechTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 183721ba62c..0e1b103aa55 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -101,10 +101,10 @@ public: { boss_krik_thirAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiMindFlayTimer; uint32 uiCurseFatigueTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index a845d609b61..bc0d56cceae 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -31,9 +31,9 @@ class instance_azjol_nerub : public InstanceMapScript public: instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub") { } - struct instance_azjol_nerub_ScriptedInstance : public ScriptedInstance + struct instance_azjol_nerub_InstanceScript : public InstanceScript { - instance_azjol_nerub_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_azjol_nerub_InstanceScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 uiKrikthir; uint64 uiHadronox; @@ -204,9 +204,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_azjol_nerub_ScriptedInstance(map); + return new instance_azjol_nerub_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp index 1bf1fcdfdf0..cdceaeb1f81 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp @@ -50,11 +50,11 @@ public: { boss_amanitarAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bFirstTime = true; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiRootTimer; uint32 uiBashTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp index c9259da2298..3845ad53c2f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp @@ -64,7 +64,7 @@ public: { boss_elder_nadoxAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiPlagueTimer; @@ -76,7 +76,7 @@ public: bool bGuardSpawned; - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() { @@ -197,10 +197,10 @@ public: { mob_ahnkahar_nerubianAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 uiSprintTimer; void Reset() diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp index 4d7cb87a8d4..f3d14a1cbe6 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp @@ -69,10 +69,10 @@ public: { boss_volazjAI(Creature* pCreature) : ScriptedAI(pCreature),Summons(me) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 uiMindFlayTimer; uint32 uiShadowBoltVolleyTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index 06f28d7d5f3..df6801fcac4 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -72,12 +72,12 @@ public: { boss_jedoga_shadowseekerAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bFirstTime = true; bPreDone = false; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiOpFerTimer; uint32 uiCycloneTimer; @@ -339,10 +339,10 @@ public: { mob_jedoga_initiandAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 bCheckTimer; @@ -504,14 +504,14 @@ public: { npc_jedogas_aufseher_triggerAI(Creature* c) : Scripted_NoMovementAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bRemoved = false; bRemoved2 = false; bCasted = false; bCasted2 = false; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool bRemoved; bool bRemoved2; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index 63e99dac63f..12e8791848a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -81,7 +81,7 @@ public: { boss_taldaramAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -98,7 +98,7 @@ public: CombatPhase Phase; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -339,11 +339,11 @@ public: { mob_taldaram_flamesphereAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiDespawnTimer; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -387,7 +387,7 @@ public: bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { - ScriptedInstance *pInstance = pGO->GetInstanceData(); + InstanceScript *pInstance = pGO->GetInstanceScript(); Creature *pPrinceTaldaram = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_PRINCE_TALDARAM) : 0); if (pPrinceTaldaram && pPrinceTaldaram->isAlive()) diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp index cb7bc940bf2..b505b7236ba 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp @@ -38,9 +38,9 @@ class instance_ahnkahet : public InstanceMapScript public: instance_ahnkahet() : InstanceMapScript("instance_ahnkahet") { } - struct instance_ahnkahet_ScriptedInstance : public ScriptedInstance + struct instance_ahnkahet_InstanceScript : public InstanceScript { - instance_ahnkahet_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_ahnkahet_InstanceScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 Elder_Nadox; uint64 Prince_Taldaram; @@ -302,9 +302,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_ahnkahet_ScriptedInstance(map); + return new instance_ahnkahet_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index adc3449862b..7113194ea33 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -56,456 +56,461 @@ enum eSpells SPELL_WAKING_NIGHTMARE_H = 67677 }; -struct boss_eadricAI : public ScriptedAI +class boss_eadric : public CreatureScript { - boss_eadricAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_eadric() : CreatureScript("boss_eadric") { } + struct boss_eadricAI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - pCreature->SetReactState(REACT_PASSIVE); - pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - } + boss_eadricAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + pCreature->SetReactState(REACT_PASSIVE); + pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - uint32 uiVenganceTimer; - uint32 uiRadianceTimer; - uint32 uiHammerJusticeTimer; - uint32 uiResetTimer; + uint32 uiVenganceTimer; + uint32 uiRadianceTimer; + uint32 uiHammerJusticeTimer; + uint32 uiResetTimer; - bool bDone; + bool bDone; - void Reset() - { - uiVenganceTimer = 10000; - uiRadianceTimer = 16000; - uiHammerJusticeTimer = 25000; - uiResetTimer = 5000; + void Reset() + { + uiVenganceTimer = 10000; + uiRadianceTimer = 16000; + uiHammerJusticeTimer = 25000; + uiResetTimer = 5000; - bDone = false; - } + bDone = false; + } - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - damage = 0; - EnterEvadeMode(); - me->setFaction(35); - bDone = true; + if (damage >= me->GetHealth()) + { + damage = 0; + EnterEvadeMode(); + me->setFaction(35); + bDone = true; + } } - } - void MovementInform(uint32 MovementType, uint32 /*Data*/) - { - if (MovementType != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 MovementType, uint32 /*Data*/) + { + if (MovementType != POINT_MOTION_TYPE) + return; - if (pInstance) - pInstance->SetData(BOSS_ARGENT_CHALLENGE_E, DONE); + if (pInstance) + pInstance->SetData(BOSS_ARGENT_CHALLENGE_E, DONE); - me->DisappearAndDie(); - } + me->DisappearAndDie(); + } - void UpdateAI(const uint32 uiDiff) - { - if (bDone && uiResetTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); - bDone = false; - } else uiResetTimer -= uiDiff; - - if (!UpdateVictim()) - return; + if (bDone && uiResetTimer <= uiDiff) + { + me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); + bDone = false; + } else uiResetTimer -= uiDiff; - if (uiHammerJusticeTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(true); + if (!UpdateVictim()) + return; - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + if (uiHammerJusticeTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) + me->InterruptNonMeleeSpells(true); + + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) { - DoCast(pTarget, SPELL_HAMMER_JUSTICE); - DoCast(pTarget, SPELL_HAMMER_RIGHTEOUS); + if (pTarget && pTarget->isAlive()) + { + DoCast(pTarget, SPELL_HAMMER_JUSTICE); + DoCast(pTarget, SPELL_HAMMER_RIGHTEOUS); + } } - } - uiHammerJusticeTimer = 25000; - } else uiHammerJusticeTimer -= uiDiff; + uiHammerJusticeTimer = 25000; + } else uiHammerJusticeTimer -= uiDiff; - if (uiVenganceTimer <= uiDiff) - { - DoCast(me,SPELL_VENGEANCE); + if (uiVenganceTimer <= uiDiff) + { + DoCast(me,SPELL_VENGEANCE); - uiVenganceTimer = 10000; - } else uiVenganceTimer -= uiDiff; + uiVenganceTimer = 10000; + } else uiVenganceTimer -= uiDiff; - if (uiRadianceTimer <= uiDiff) - { - DoCastAOE(SPELL_RADIANCE); + if (uiRadianceTimer <= uiDiff) + { + DoCastAOE(SPELL_RADIANCE); - uiRadianceTimer = 16000; - } else uiRadianceTimer -= uiDiff; + uiRadianceTimer = 16000; + } else uiRadianceTimer -= uiDiff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_eadricAI(pCreature); } }; -CreatureAI* GetAI_boss_eadric(Creature* pCreature) +class boss_paletress : public CreatureScript { - return new boss_eadricAI(pCreature); -} +public: + boss_paletress() : CreatureScript("boss_paletress") { } -struct boss_paletressAI : public ScriptedAI -{ - boss_paletressAI(Creature* pCreature) : ScriptedAI(pCreature) + struct boss_paletressAI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - - MemoryGUID = 0; - pCreature->SetReactState(REACT_PASSIVE); - pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pCreature->RestoreFaction(); - } + boss_paletressAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - ScriptedInstance* pInstance; + MemoryGUID = 0; + pCreature->SetReactState(REACT_PASSIVE); + pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pCreature->RestoreFaction(); + } - Creature* pMemory; - uint64 MemoryGUID; + InstanceScript* pInstance; - bool bHealth; - bool bDone; + Creature* pMemory; + uint64 MemoryGUID; - uint32 uiHolyFireTimer; - uint32 uiHolySmiteTimer; - uint32 uiRenewTimer; - uint32 uiResetTimer; + bool bHealth; + bool bDone; - void Reset() - { - me->RemoveAllAuras(); + uint32 uiHolyFireTimer; + uint32 uiHolySmiteTimer; + uint32 uiRenewTimer; + uint32 uiResetTimer; - uiHolyFireTimer = urand(9000,12000); - uiHolySmiteTimer = urand(5000,7000); - uiRenewTimer = urand(2000,5000); + void Reset() + { + me->RemoveAllAuras(); - uiResetTimer = 7000; + uiHolyFireTimer = urand(9000,12000); + uiHolySmiteTimer = urand(5000,7000); + uiRenewTimer = urand(2000,5000); - bHealth = false; - bDone = false; + uiResetTimer = 7000; - if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) - if (pMemory->isAlive()) - pMemory->RemoveFromWorld(); - } + bHealth = false; + bDone = false; - void SetData(uint32 uiId, uint32 /*uiValue*/) - { - if (uiId == 1) - me->RemoveAura(SPELL_SHIELD); - } + if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) + if (pMemory->isAlive()) + pMemory->RemoveFromWorld(); + } - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + void SetData(uint32 uiId, uint32 /*uiValue*/) { - damage = 0; - EnterEvadeMode(); - me->setFaction(35); - bDone = true; + if (uiId == 1) + me->RemoveAura(SPELL_SHIELD); } - } - void MovementInform(uint32 MovementType, uint32 Point) - { - if (MovementType != POINT_MOTION_TYPE || Point != 0) - return; - - if (pInstance) - pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE); - - me->DisappearAndDie(); - } + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (damage >= me->GetHealth()) + { + damage = 0; + EnterEvadeMode(); + me->setFaction(35); + bDone = true; + } + } - void UpdateAI(const uint32 uiDiff) - { - if (bDone && uiResetTimer <= uiDiff) + void MovementInform(uint32 MovementType, uint32 Point) { - me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); - bDone = false; - } else uiResetTimer -= uiDiff; + if (MovementType != POINT_MOTION_TYPE || Point != 0) + return; + + if (pInstance) + pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE); - if (!UpdateVictim()) - return; + me->DisappearAndDie(); + } - if (uiHolyFireTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + if (bDone && uiResetTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_HOLY_FIRE); - } - if (me->HasAura(SPELL_SHIELD)) - uiHolyFireTimer = 13000; - else - uiHolyFireTimer = urand(9000,12000); - } else uiHolyFireTimer -= uiDiff; + me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); + bDone = false; + } else uiResetTimer -= uiDiff; - if (uiHolySmiteTimer <= uiDiff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + if (!UpdateVictim()) + return; + + if (uiHolyFireTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_SMITE); - } - if (me->HasAura(SPELL_SHIELD)) - uiHolySmiteTimer = 9000; - else - uiHolySmiteTimer = urand(5000,7000); - } else uiHolySmiteTimer -= uiDiff; + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_HOLY_FIRE); + } + if (me->HasAura(SPELL_SHIELD)) + uiHolyFireTimer = 13000; + else + uiHolyFireTimer = urand(9000,12000); + } else uiHolyFireTimer -= uiDiff; - if (me->HasAura(SPELL_SHIELD)) - if (uiRenewTimer <= uiDiff) + if (uiHolySmiteTimer <= uiDiff) { - me->InterruptNonMeleeSpells(true); - uint8 uiTarget = urand(0,1); - switch(uiTarget) + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) { - case 0: - DoCast(me,SPELL_RENEW); - break; - case 1: - if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) - if (pMemory->isAlive()) - DoCast(pMemory, SPELL_RENEW); - break; + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_SMITE); } - uiRenewTimer = urand(15000,17000); - } else uiRenewTimer -= uiDiff; + if (me->HasAura(SPELL_SHIELD)) + uiHolySmiteTimer = 9000; + else + uiHolySmiteTimer = urand(5000,7000); + } else uiHolySmiteTimer -= uiDiff; + if (me->HasAura(SPELL_SHIELD)) + if (uiRenewTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(true); + uint8 uiTarget = urand(0,1); + switch(uiTarget) + { + case 0: + DoCast(me,SPELL_RENEW); + break; + case 1: + if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) + if (pMemory->isAlive()) + DoCast(pMemory, SPELL_RENEW); + break; + } + uiRenewTimer = urand(15000,17000); + } else uiRenewTimer -= uiDiff; + + + if (!bHealth && me->GetHealth()*100 / me->GetMaxHealth() <= 25) + { + me->InterruptNonMeleeSpells(true); + DoCastAOE(SPELL_HOLY_NOVA,false); + DoCast(me, SPELL_SHIELD); + DoCastAOE(SPELL_SUMMON_MEMORY,false); + DoCastAOE(SPELL_CONFESS,false); - if (!bHealth && me->GetHealth()*100 / me->GetMaxHealth() <= 25) - { - me->InterruptNonMeleeSpells(true); - DoCastAOE(SPELL_HOLY_NOVA,false); - DoCast(me, SPELL_SHIELD); - DoCastAOE(SPELL_SUMMON_MEMORY,false); - DoCastAOE(SPELL_CONFESS,false); + bHealth = true; + } - bHealth = true; + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustSummoned(Creature* pSummon) + { + MemoryGUID = pSummon->GetGUID(); + } + }; - void JustSummoned(Creature* pSummon) + CreatureAI* GetAI(Creature* pCreature) const { - MemoryGUID = pSummon->GetGUID(); + return new boss_paletressAI(pCreature); } }; -CreatureAI* GetAI_boss_paletress(Creature* pCreature) -{ - return new boss_paletressAI(pCreature); -} - -struct npc_memoryAI : public ScriptedAI +class npc_memory : public CreatureScript { - npc_memoryAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 uiOldWoundsTimer; - uint32 uiShadowPastTimer; - uint32 uiWakingNightmare; +public: + npc_memory() : CreatureScript("npc_memory") { } - void Reset() + struct npc_memoryAI : public ScriptedAI { - uiOldWoundsTimer = 12000; - uiShadowPastTimer = 5000; - uiWakingNightmare = 7000; - } + npc_memoryAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 uiOldWoundsTimer; + uint32 uiShadowPastTimer; + uint32 uiWakingNightmare; - if (uiOldWoundsTimer <= uiDiff) + void Reset() { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, SPELL_OLD_WOUNDS); - } uiOldWoundsTimer = 12000; - }else uiOldWoundsTimer -= uiDiff; - - if (uiWakingNightmare <= uiDiff) - { - DoCast(me, SPELL_WAKING_NIGHTMARE); + uiShadowPastTimer = 5000; uiWakingNightmare = 7000; - }else uiWakingNightmare -= uiDiff; + } - if (uiShadowPastTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + if (!UpdateVictim()) + return; + + if (uiOldWoundsTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_SHADOWS_PAST); - } - uiShadowPastTimer = 5000; - }else uiShadowPastTimer -= uiDiff; + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, SPELL_OLD_WOUNDS); + } + uiOldWoundsTimer = 12000; + }else uiOldWoundsTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + if (uiWakingNightmare <= uiDiff) + { + DoCast(me, SPELL_WAKING_NIGHTMARE); + uiWakingNightmare = 7000; + }else uiWakingNightmare -= uiDiff; - void JustDied(Unit* /*pKiller*/) - { - if (me->isSummon()) + if (uiShadowPastTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_SHADOWS_PAST); + } + uiShadowPastTimer = 5000; + }else uiShadowPastTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + if (me->isSummon()) { - if (pSummoner && pSummoner->isAlive()) - CAST_CRE(pSummoner)->AI()->SetData(1,0); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + if (pSummoner && pSummoner->isAlive()) + CAST_CRE(pSummoner)->AI()->SetData(1,0); + } } } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_memoryAI(pCreature); } }; -CreatureAI* GetAI_npc_memory(Creature* pCreature) +class npc_argent_soldier : public CreatureScript { - return new npc_memoryAI(pCreature); -} +public: + npc_argent_soldier() : CreatureScript("npc_argent_soldier") { } -// THIS AI NEEDS MORE IMPROVEMENTS -struct npc_argent_soldierAI : public npc_escortAI -{ - npc_argent_soldierAI(Creature* pCreature) : npc_escortAI(pCreature) + // THIS AI NEEDS MORE IMPROVEMENTS + struct npc_argent_soldierAI : public npc_escortAI { - pInstance = pCreature->GetInstanceData(); - me->SetReactState(REACT_DEFENSIVE); - SetDespawnAtEnd(false); - uiWaypoint = 0; - } + npc_argent_soldierAI(Creature* pCreature) : npc_escortAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + me->SetReactState(REACT_DEFENSIVE); + SetDespawnAtEnd(false); + uiWaypoint = 0; + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - uint8 uiWaypoint; + uint8 uiWaypoint; - void WaypointReached(uint32 uiPoint) - { - if (uiPoint == 0) + void WaypointReached(uint32 uiPoint) { - switch(uiWaypoint) + if (uiPoint == 0) { - case 0: - me->SetOrientation(5.81); - break; - case 1: - me->SetOrientation(4.60); - break; - case 2: - me->SetOrientation(2.79); - break; - } - - me->SendMovementFlagUpdate(); - } - } - - void SetData(uint32 uiType, uint32 /*uiData*/) - { - switch(me->GetEntry()) - { - case NPC_ARGENT_LIGHWIELDER: - switch(uiType) - { - case 0: - AddWaypoint(0,712.14,628.42,411.88); - break; - case 1: - AddWaypoint(0,742.44,650.29,411.79); - break; - case 2: - AddWaypoint(0,783.33,615.29,411.84); - break; - } - break; - case NPC_ARGENT_MONK: - switch(uiType) - { - case 0: - AddWaypoint(0,713.12,632.97,411.90); - break; - case 1: - AddWaypoint(0,746.73,650.24,411.56); - break; - case 2: - AddWaypoint(0,781.32,610.54,411.82); - break; - } - break; - case NPC_PRIESTESS: - switch(uiType) + switch(uiWaypoint) { case 0: - AddWaypoint(0,715.06,637.07,411.91); + me->SetOrientation(5.81); break; case 1: - AddWaypoint(0,750.72,650.20,411.77); + me->SetOrientation(4.60); break; case 2: - AddWaypoint(0,779.77,607.03,411.81); + me->SetOrientation(2.79); break; } - break; + + me->SendMovementFlagUpdate(); + } } - Start(false,true,0); - uiWaypoint = uiType; - } + void SetData(uint32 uiType, uint32 /*uiData*/) + { + switch(me->GetEntry()) + { + case NPC_ARGENT_LIGHWIELDER: + switch(uiType) + { + case 0: + AddWaypoint(0,712.14,628.42,411.88); + break; + case 1: + AddWaypoint(0,742.44,650.29,411.79); + break; + case 2: + AddWaypoint(0,783.33,615.29,411.84); + break; + } + break; + case NPC_ARGENT_MONK: + switch(uiType) + { + case 0: + AddWaypoint(0,713.12,632.97,411.90); + break; + case 1: + AddWaypoint(0,746.73,650.24,411.56); + break; + case 2: + AddWaypoint(0,781.32,610.54,411.82); + break; + } + break; + case NPC_PRIESTESS: + switch(uiType) + { + case 0: + AddWaypoint(0,715.06,637.07,411.91); + break; + case 1: + AddWaypoint(0,750.72,650.20,411.77); + break; + case 2: + AddWaypoint(0,779.77,607.03,411.81); + break; + } + break; + } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + Start(false,true,0); + uiWaypoint = uiType; + } - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); - DoMeleeAttackIfReady(); - } + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED,pInstance->GetData(DATA_ARGENT_SOLDIER_DEFEATED) + 1); + } + }; - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED,pInstance->GetData(DATA_ARGENT_SOLDIER_DEFEATED) + 1); + return new npc_argent_soldierAI(pCreature); } }; -CreatureAI* GetAI_npc_argent_soldier(Creature* pCreature) -{ - return new npc_argent_soldierAI(pCreature); -} - void AddSC_boss_argent_challenge() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "boss_eadric"; - NewScript->GetAI = &GetAI_boss_eadric; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_paletress"; - NewScript->GetAI = &GetAI_boss_paletress; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_memory"; - NewScript->GetAI = &GetAI_npc_memory; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_argent_soldier"; - NewScript->GetAI = &GetAI_npc_argent_soldier; - NewScript->RegisterSelf(); + new boss_paletress(); + new npc_memory(); + new npc_argent_soldier(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 14b44079719..ee06c38ed9e 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -71,302 +71,306 @@ enum ePhases PHASE_GHOST = 3 }; -struct boss_black_knightAI : public ScriptedAI +class boss_black_knight : public CreatureScript { - boss_black_knightAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_black_knight() : CreatureScript("boss_black_knight") { } + + struct boss_black_knightAI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - } + boss_black_knightAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - std::list<uint64> SummonList; + std::list<uint64> SummonList; - bool bEventInProgress; - bool bEvent; - bool bSummonArmy; - bool bDeathArmyDone; + bool bEventInProgress; + bool bEvent; + bool bSummonArmy; + bool bDeathArmyDone; - uint8 uiPhase; + uint8 uiPhase; - uint32 uiPlagueStrikeTimer; - uint32 uiIcyTouchTimer; - uint32 uiDeathRespiteTimer; - uint32 uiObliterateTimer; - uint32 uiDesecration; - uint32 uiResurrectTimer; - uint32 uiDeathArmyCheckTimer; - uint32 uiGhoulExplodeTimer; - uint32 uiDeathBiteTimer; - uint32 uiMarkedDeathTimer; + uint32 uiPlagueStrikeTimer; + uint32 uiIcyTouchTimer; + uint32 uiDeathRespiteTimer; + uint32 uiObliterateTimer; + uint32 uiDesecration; + uint32 uiResurrectTimer; + uint32 uiDeathArmyCheckTimer; + uint32 uiGhoulExplodeTimer; + uint32 uiDeathBiteTimer; + uint32 uiMarkedDeathTimer; - void Reset() - { - RemoveSummons(); - me->SetDisplayId(me->GetNativeDisplayId()); - me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - - bEventInProgress = false; - bEvent = false; - bSummonArmy = false; - bDeathArmyDone = false; - - uiPhase = PHASE_UNDEAD; - - uiIcyTouchTimer = urand(5000,9000); - uiPlagueStrikeTimer = urand(10000,13000); - uiDeathRespiteTimer = urand(15000,16000); - uiObliterateTimer = urand(17000,19000); - uiDesecration = urand(15000,16000); - uiDeathArmyCheckTimer = 7000; - uiResurrectTimer = 4000; - uiGhoulExplodeTimer = 8000; - uiDeathBiteTimer = urand (2000,4000); - uiMarkedDeathTimer = urand (5000,7000); - } + void Reset() + { + RemoveSummons(); + me->SetDisplayId(me->GetNativeDisplayId()); + me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + + bEventInProgress = false; + bEvent = false; + bSummonArmy = false; + bDeathArmyDone = false; + + uiPhase = PHASE_UNDEAD; + + uiIcyTouchTimer = urand(5000,9000); + uiPlagueStrikeTimer = urand(10000,13000); + uiDeathRespiteTimer = urand(15000,16000); + uiObliterateTimer = urand(17000,19000); + uiDesecration = urand(15000,16000); + uiDeathArmyCheckTimer = 7000; + uiResurrectTimer = 4000; + uiGhoulExplodeTimer = 8000; + uiDeathBiteTimer = urand (2000,4000); + uiMarkedDeathTimer = urand (5000,7000); + } - void RemoveSummons() - { - if (SummonList.empty()) - return; + void RemoveSummons() + { + if (SummonList.empty()) + return; + + for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + { + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (pTemp) + pTemp->DisappearAndDie(); + } + SummonList.clear(); + } - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + void JustSummoned(Creature* pSummon) { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - if (pTemp) - pTemp->DisappearAndDie(); + SummonList.push_back(pSummon->GetGUID()); + pSummon->AI()->AttackStart(me->getVictim()); } - SummonList.clear(); - } - void JustSummoned(Creature* pSummon) - { - SummonList.push_back(pSummon->GetGUID()); - pSummon->AI()->AttackStart(me->getVictim()); - } + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (bEventInProgress) + if (uiResurrectTimer <= uiDiff) + { + me->SetHealth(me->GetMaxHealth()); + DoCast(me,SPELL_BLACK_KNIGHT_RES,true); + uiPhase++; + uiResurrectTimer = 4000; + bEventInProgress = false; + me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + } else uiResurrectTimer -= uiDiff; - if (bEventInProgress) - if (uiResurrectTimer <= uiDiff) - { - me->SetHealth(me->GetMaxHealth()); - DoCast(me,SPELL_BLACK_KNIGHT_RES,true); - uiPhase++; - uiResurrectTimer = 4000; - bEventInProgress = false; - me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - } else uiResurrectTimer -= uiDiff; - - switch(uiPhase) - { - case PHASE_UNDEAD: - case PHASE_SKELETON: + switch(uiPhase) { - if (uiIcyTouchTimer <= uiDiff) - { - DoCastVictim(SPELL_ICY_TOUCH); - uiIcyTouchTimer = urand(5000,7000); - } else uiIcyTouchTimer -= uiDiff; - if (uiPlagueStrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_ICY_TOUCH); - uiPlagueStrikeTimer = urand(12000,15000); - } else uiPlagueStrikeTimer -= uiDiff; - if (uiObliterateTimer <= uiDiff) - { - DoCastVictim(SPELL_OBLITERATE); - uiObliterateTimer = urand(17000,19000); - } else uiObliterateTimer -= uiDiff; - switch(uiPhase) + case PHASE_UNDEAD: + case PHASE_SKELETON: { - case PHASE_UNDEAD: + if (uiIcyTouchTimer <= uiDiff) { - if (uiDeathRespiteTimer <= uiDiff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_DEATH_RESPITE); - } - uiDeathRespiteTimer = urand(15000,16000); - } else uiDeathRespiteTimer -= uiDiff; - break; - } - case PHASE_SKELETON: + DoCastVictim(SPELL_ICY_TOUCH); + uiIcyTouchTimer = urand(5000,7000); + } else uiIcyTouchTimer -= uiDiff; + if (uiPlagueStrikeTimer <= uiDiff) + { + DoCastVictim(SPELL_ICY_TOUCH); + uiPlagueStrikeTimer = urand(12000,15000); + } else uiPlagueStrikeTimer -= uiDiff; + if (uiObliterateTimer <= uiDiff) { - if (!bSummonArmy) + DoCastVictim(SPELL_OBLITERATE); + uiObliterateTimer = urand(17000,19000); + } else uiObliterateTimer -= uiDiff; + switch(uiPhase) + { + case PHASE_UNDEAD: { - bSummonArmy = true; - me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - DoCast(me, SPELL_ARMY_DEAD); - } - if (!bDeathArmyDone) - if (uiDeathArmyCheckTimer <= uiDiff) + if (uiDeathRespiteTimer <= uiDiff) { - me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - uiDeathArmyCheckTimer = 0; - bDeathArmyDone = true; - } else uiDeathArmyCheckTimer -= uiDiff; - if (uiDesecration <= uiDiff) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_DEATH_RESPITE); + } + uiDeathRespiteTimer = urand(15000,16000); + } else uiDeathRespiteTimer -= uiDiff; + break; + } + case PHASE_SKELETON: { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!bSummonArmy) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_DESECRATION); + bSummonArmy = true; + me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + DoCast(me, SPELL_ARMY_DEAD); } - uiDesecration = urand(15000,16000); - } else uiDesecration -= uiDiff; - if (uiGhoulExplodeTimer <= uiDiff) - { - DoCast(me, SPELL_GHOUL_EXPLODE); - uiGhoulExplodeTimer = 8000; - } else uiGhoulExplodeTimer -= uiDiff; + if (!bDeathArmyDone) + if (uiDeathArmyCheckTimer <= uiDiff) + { + me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + uiDeathArmyCheckTimer = 0; + bDeathArmyDone = true; + } else uiDeathArmyCheckTimer -= uiDiff; + if (uiDesecration <= uiDiff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_DESECRATION); + } + uiDesecration = urand(15000,16000); + } else uiDesecration -= uiDiff; + if (uiGhoulExplodeTimer <= uiDiff) + { + DoCast(me, SPELL_GHOUL_EXPLODE); + uiGhoulExplodeTimer = 8000; + } else uiGhoulExplodeTimer -= uiDiff; + break; + } break; } break; } - break; - } - case PHASE_GHOST: - { - if (uiDeathBiteTimer <= uiDiff) + case PHASE_GHOST: { - DoCastAOE(SPELL_DEATH_BITE); - uiDeathBiteTimer = urand (2000, 4000); - } else uiDeathBiteTimer -= uiDiff; - if (uiMarkedDeathTimer <= uiDiff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiDeathBiteTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_MARKED_DEATH); - } - uiMarkedDeathTimer = urand (5000, 7000); - } else uiMarkedDeathTimer -= uiDiff; - break; + DoCastAOE(SPELL_DEATH_BITE); + uiDeathBiteTimer = urand (2000, 4000); + } else uiDeathBiteTimer -= uiDiff; + if (uiMarkedDeathTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_MARKED_DEATH); + } + uiMarkedDeathTimer = urand (5000, 7000); + } else uiMarkedDeathTimer -= uiDiff; + break; + } } - } - if (!me->hasUnitState(UNIT_STAT_ROOT) && !me->GetHealth()*100 / me->GetMaxHealth() <= 0) - DoMeleeAttackIfReady(); - } + if (!me->hasUnitState(UNIT_STAT_ROOT) && !me->GetHealth()*100 / me->GetMaxHealth() <= 0) + DoMeleeAttackIfReady(); + } - void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) - { - if (uiDamage > me->GetHealth() && uiPhase <= PHASE_SKELETON) + void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) { - uiDamage = 0; - me->SetHealth(0); - me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - RemoveSummons(); - switch(uiPhase) + if (uiDamage > me->GetHealth() && uiPhase <= PHASE_SKELETON) { - case PHASE_UNDEAD: - me->SetDisplayId(MODEL_SKELETON); - break; - case PHASE_SKELETON: - me->SetDisplayId(MODEL_GHOST); - break; + uiDamage = 0; + me->SetHealth(0); + me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + RemoveSummons(); + switch(uiPhase) + { + case PHASE_UNDEAD: + me->SetDisplayId(MODEL_SKELETON); + break; + case PHASE_SKELETON: + me->SetDisplayId(MODEL_GHOST); + break; + } + bEventInProgress = true; } - bEventInProgress = true; } - } - void JustDied(Unit* /*pKiller*/) + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_BLACK_KNIGHT,DONE); + } + }; + + CreatureAI* GetAI(Creature *pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_BLACK_KNIGHT,DONE); + return new boss_black_knightAI (pCreature); } }; -CreatureAI* GetAI_boss_black_knight(Creature *pCreature) -{ - return new boss_black_knightAI (pCreature); -} - -struct npc_risen_ghoulAI : public ScriptedAI +class npc_risen_ghoul : public CreatureScript { - npc_risen_ghoulAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_risen_ghoul() : CreatureScript("npc_risen_ghoul") { } - uint32 uiAttackTimer; - - void Reset() + struct npc_risen_ghoulAI : public ScriptedAI { - uiAttackTimer = 3500; - } + npc_risen_ghoulAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 uiAttackTimer; - if (uiAttackTimer <= uiDiff) + void Reset() { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, (SPELL_LEAP)); - } uiAttackTimer = 3500; - } else uiAttackTimer -= uiDiff; + } - DoMeleeAttackIfReady(); + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (uiAttackTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, (SPELL_LEAP)); + } + uiAttackTimer = 3500; + } else uiAttackTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_risen_ghoulAI(pCreature); } }; -CreatureAI* GetAI_npc_risen_ghoul(Creature* pCreature) +class npc_black_knight_skeletal_gryphon : public CreatureScript { - return new npc_risen_ghoulAI(pCreature); -} +public: + npc_black_knight_skeletal_gryphon() : CreatureScript("npc_black_knight_skeletal_gryphon") { } -struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI -{ - npc_black_knight_skeletal_gryphonAI(Creature* pCreature) : npc_escortAI(pCreature) + struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI { - Start(false,true,0,NULL); - } + npc_black_knight_skeletal_gryphonAI(Creature* pCreature) : npc_escortAI(pCreature) + { + Start(false,true,0,NULL); + } - void WaypointReached(uint32 /*i*/) - { + void WaypointReached(uint32 /*i*/) + { - } + } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; - } + if (!UpdateVictim()) + return; + } -}; + }; -CreatureAI* GetAI_npc_black_knight_skeletal_gryphon(Creature* pCreature) -{ - return new npc_black_knight_skeletal_gryphonAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_black_knight_skeletal_gryphonAI(pCreature); + } +}; void AddSC_boss_black_knight() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "boss_black_knight"; - NewScript->GetAI = &GetAI_boss_black_knight; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_risen_ghoul"; - NewScript->GetAI = &GetAI_npc_risen_ghoul; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_black_knight_skeletal_gryphon"; - NewScript->GetAI = &GetAI_npc_black_knight_skeletal_gryphon; - NewScript->RegisterSelf(); + new npc_risen_ghoul(); + new npc_black_knight_skeletal_gryphon(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 53b71a5760e..9569a68476f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -118,7 +118,7 @@ void AggroAllPlayers(Creature* pTemp) bool GrandChampionsOutVehicle(Creature* me) { - ScriptedInstance* pInstance = me->GetInstanceData(); + InstanceScript* pInstance = me->GetInstanceScript(); if (!pInstance) return false; @@ -143,129 +143,107 @@ bool GrandChampionsOutVehicle(Creature* me) * Script Complete: 25%. * */ -struct generic_vehicleAI_toc5AI : public npc_escortAI +class generic_vehicleAI_toc5 : public CreatureScript { - generic_vehicleAI_toc5AI(Creature* pCreature) : npc_escortAI(pCreature) - { - SetDespawnAtEnd(false); - uiWaypointPath = 0; - - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiChargeTimer; - uint32 uiShieldBreakerTimer; - uint32 uiBuffTimer; - - uint32 uiWaypointPath; +public: + generic_vehicleAI_toc5() : CreatureScript("generic_vehicleAI_toc5") { } - void Reset() + struct generic_vehicleAI_toc5AI : public npc_escortAI { - uiChargeTimer = 5000; - uiShieldBreakerTimer = 8000; - uiBuffTimer = urand(30000,60000); - } - - void SetData(uint32 uiType, uint32 /*uiData*/) - { - switch(uiType) - { - case 1: - AddWaypoint(0,747.36,634.07,411.572); - AddWaypoint(1,780.43,607.15,411.82); - AddWaypoint(2,785.99,599.41,411.92); - AddWaypoint(3,778.44,601.64,411.79); - uiWaypointPath = 1; - break; - case 2: - AddWaypoint(0,747.35,634.07,411.57); - AddWaypoint(1,768.72,581.01,411.92); - AddWaypoint(2,763.55,590.52,411.71); - uiWaypointPath = 2; - break; - case 3: - AddWaypoint(0,747.35,634.07,411.57); - AddWaypoint(1,784.02,645.33,412.39); - AddWaypoint(2,775.67,641.91,411.91); - uiWaypointPath = 3; - break; - } - - if (uiType <= 3) - Start(false,true,0,NULL); - } - - void WaypointReached(uint32 i) - { - switch(i) + generic_vehicleAI_toc5AI(Creature* pCreature) : npc_escortAI(pCreature) { - case 2: - if (pInstance && uiWaypointPath == 3 || uiWaypointPath == 2) - pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); - break; - case 3: - if (pInstance) - pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); - break; + SetDespawnAtEnd(false); + uiWaypointPath = 0; + + pInstance = pCreature->GetInstanceScript(); } - } - void EnterCombat(Unit* /*pWho*/) - { - DoCastSpellShield(); - } + InstanceScript* pInstance; - void DoCastSpellShield() - { - for (uint8 i = 0; i < 3; ++i) - DoCast(me,SPELL_SHIELD,true); - } + uint32 uiChargeTimer; + uint32 uiShieldBreakerTimer; + uint32 uiBuffTimer; - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); + uint32 uiWaypointPath; - if (!UpdateVictim()) - return; + void Reset() + { + uiChargeTimer = 5000; + uiShieldBreakerTimer = 8000; + uiBuffTimer = urand(30000,60000); + } - if (uiBuffTimer <= uiDiff) + void SetData(uint32 uiType, uint32 /*uiData*/) { - if (!me->HasAura(SPELL_SHIELD)) - DoCastSpellShield(); + switch(uiType) + { + case 1: + AddWaypoint(0,747.36,634.07,411.572); + AddWaypoint(1,780.43,607.15,411.82); + AddWaypoint(2,785.99,599.41,411.92); + AddWaypoint(3,778.44,601.64,411.79); + uiWaypointPath = 1; + break; + case 2: + AddWaypoint(0,747.35,634.07,411.57); + AddWaypoint(1,768.72,581.01,411.92); + AddWaypoint(2,763.55,590.52,411.71); + uiWaypointPath = 2; + break; + case 3: + AddWaypoint(0,747.35,634.07,411.57); + AddWaypoint(1,784.02,645.33,412.39); + AddWaypoint(2,775.67,641.91,411.91); + uiWaypointPath = 3; + break; + } - uiBuffTimer = urand(30000,45000); - }else uiBuffTimer -= uiDiff; + if (uiType <= 3) + Start(false,true,0,NULL); + } - if (uiChargeTimer <= uiDiff) + void WaypointReached(uint32 i) { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + switch(i) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) - { - DoResetThreat(); - me->AddThreat(pPlayer,1.0f); - DoCast(pPlayer, SPELL_CHARGE); - break; - } - } + case 2: + if (pInstance && uiWaypointPath == 3 || uiWaypointPath == 2) + pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); + break; + case 3: + if (pInstance) + pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); + break; } - uiChargeTimer = 5000; - }else uiChargeTimer -= uiDiff; + } + + void EnterCombat(Unit* /*pWho*/) + { + DoCastSpellShield(); + } - //dosen't work at all - if (uiShieldBreakerTimer <= uiDiff) + void DoCastSpellShield() { - Vehicle *pVehicle = me->GetVehicleKit(); - if (!pVehicle) + for (uint8 i = 0; i < 3; ++i) + DoCast(me,SPELL_SHIELD,true); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) return; - if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0)) + if (uiBuffTimer <= uiDiff) + { + if (!me->HasAura(SPELL_SHIELD)) + DoCastSpellShield(); + + uiBuffTimer = urand(30000,45000); + }else uiBuffTimer -= uiDiff; + + if (uiChargeTimer <= uiDiff) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (me->GetMap()->IsDungeon() && !players.isEmpty()) @@ -273,723 +251,758 @@ struct generic_vehicleAI_toc5AI : public npc_escortAI for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,10.0f,30.0f,false)) + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) { - pPassenger->CastSpell(pPlayer,SPELL_SHIELD_BREAKER,true); + DoResetThreat(); + me->AddThreat(pPlayer,1.0f); + DoCast(pPlayer, SPELL_CHARGE); break; } } } - } - uiShieldBreakerTimer = 7000; - }else uiShieldBreakerTimer -= uiDiff; + uiChargeTimer = 5000; + }else uiChargeTimer -= uiDiff; + + //dosen't work at all + if (uiShieldBreakerTimer <= uiDiff) + { + Vehicle *pVehicle = me->GetVehicleKit(); + if (!pVehicle) + return; + + if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0)) + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (me->GetMap()->IsDungeon() && !players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pPlayer = itr->getSource(); + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,10.0f,30.0f,false)) + { + pPassenger->CastSpell(pPlayer,SPELL_SHIELD_BREAKER,true); + break; + } + } + } + } + uiShieldBreakerTimer = 7000; + }else uiShieldBreakerTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new generic_vehicleAI_toc5AI(pCreature); } }; -CreatureAI* GetAI_generic_vehicleAI_toc5(Creature* pCreature) +class boss_warrior_toc5 : public CreatureScript { - return new generic_vehicleAI_toc5AI(pCreature); -} +public: + boss_warrior_toc5() : CreatureScript("boss_warrior_toc5") { } -// Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior -struct boss_warrior_toc5AI : public ScriptedAI -{ - boss_warrior_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + // Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior + struct boss_warrior_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); + boss_warrior_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - bDone = false; - bHome = false; + bDone = false; + bHome = false; - uiPhase = 0; - uiPhaseTimer = 0; + uiPhase = 0; + uiPhaseTimer = 0; - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - uint8 uiPhase; - uint32 uiPhaseTimer; + uint8 uiPhase; + uint32 uiPhaseTimer; - uint32 uiBladeStormTimer; - uint32 uiInterceptTimer; - uint32 uiMortalStrikeTimer; - uint32 uiAttackTimer; + uint32 uiBladeStormTimer; + uint32 uiInterceptTimer; + uint32 uiMortalStrikeTimer; + uint32 uiAttackTimer; - bool bDone; - bool bHome; + bool bDone; + bool bHome; - void Reset() - { - uiBladeStormTimer = urand(15000,20000); - uiInterceptTimer = 7000; - uiMortalStrikeTimer = urand(8000,12000); - } + void Reset() + { + uiBladeStormTimer = urand(15000,20000); + uiInterceptTimer = 7000; + uiMortalStrikeTimer = urand(8000,12000); + } - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); - if (!bHome) - return; + if (!bHome) + return; - uiPhaseTimer = 15000; - uiPhase = 1; + uiPhaseTimer = 15000; + uiPhase = 1; - bHome = false; - } + bHome = false; + } - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) + void UpdateAI(const uint32 uiDiff) { - bDone = true; + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); - EnterEvadeMode(); - bHome = true; - } + EnterEvadeMode(); + bHome = true; + } - if (uiPhaseTimer <= uiDiff) - { - if (uiPhase == 1) + if (uiPhaseTimer <= uiDiff) { - AggroAllPlayers(me); - uiPhase = 0; - } - }else uiPhaseTimer -= uiDiff; + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; - if (uiInterceptTimer <= uiDiff) - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + if (uiInterceptTimer <= uiDiff) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (me->GetMap()->IsDungeon() && !players.isEmpty()) { - Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - DoResetThreat(); - me->AddThreat(pPlayer,5.0f); - DoCast(pPlayer,SPELL_INTERCEPT); - break; + Player* pPlayer = itr->getSource(); + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) + { + DoResetThreat(); + me->AddThreat(pPlayer,5.0f); + DoCast(pPlayer,SPELL_INTERCEPT); + break; + } } } - } - uiInterceptTimer = 7000; - } else uiInterceptTimer -= uiDiff; + uiInterceptTimer = 7000; + } else uiInterceptTimer -= uiDiff; - if (uiBladeStormTimer <= uiDiff) - { - DoCastVictim(SPELL_BLADESTORM); - uiBladeStormTimer = urand(15000,20000); - } else uiBladeStormTimer -= uiDiff; + if (uiBladeStormTimer <= uiDiff) + { + DoCastVictim(SPELL_BLADESTORM); + uiBladeStormTimer = urand(15000,20000); + } else uiBladeStormTimer -= uiDiff; - if (uiMortalStrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_MORTAL_STRIKE); - uiMortalStrikeTimer = urand(8000,12000); - } else uiMortalStrikeTimer -= uiDiff; + if (uiMortalStrikeTimer <= uiDiff) + { + DoCastVictim(SPELL_MORTAL_STRIKE); + uiMortalStrikeTimer = urand(8000,12000); + } else uiMortalStrikeTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*pKiller*/) + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new boss_warrior_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_warrior_toc5(Creature* pCreature) +class boss_mage_toc5 : public CreatureScript { - return new boss_warrior_toc5AI(pCreature); -} +public: + boss_mage_toc5() : CreatureScript("boss_mage_toc5") { } -// Ambrose Boltspark && Eressea Dawnsinger || Mage -struct boss_mage_toc5AI : public ScriptedAI -{ - boss_mage_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + // Ambrose Boltspark && Eressea Dawnsinger || Mage + struct boss_mage_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); + boss_mage_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - bDone = false; - bHome = false; + bDone = false; + bHome = false; - uiPhase = 0; - uiPhaseTimer = 0; + uiPhase = 0; + uiPhaseTimer = 0; - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - uint8 uiPhase; - uint32 uiPhaseTimer; + uint8 uiPhase; + uint32 uiPhaseTimer; - uint32 uiFireBallTimer; - uint32 uiBlastWaveTimer; - uint32 uiHasteTimer; - uint32 uiPolymorphTimer; + uint32 uiFireBallTimer; + uint32 uiBlastWaveTimer; + uint32 uiHasteTimer; + uint32 uiPolymorphTimer; - bool bDone; - bool bHome; + bool bDone; + bool bHome; - void Reset() - { - uiFireBallTimer = 5000; - uiPolymorphTimer = 8000; - uiBlastWaveTimer = 12000; - uiHasteTimer = 22000; - } + void Reset() + { + uiFireBallTimer = 5000; + uiPolymorphTimer = 8000; + uiBlastWaveTimer = 12000; + uiHasteTimer = 22000; + } - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); - if (!bHome) - return; + if (!bHome) + return; - uiPhaseTimer = 15000; - uiPhase = 1; + uiPhaseTimer = 15000; + uiPhase = 1; - bHome = false; - } + bHome = false; + } - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) + void UpdateAI(const uint32 uiDiff) { - bDone = true; + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); - EnterEvadeMode(); - bHome = true; - } + EnterEvadeMode(); + bHome = true; + } - if (uiPhaseTimer <= uiDiff) - { - if (uiPhase == 1) + if (uiPhaseTimer <= uiDiff) { - AggroAllPlayers(me); - uiPhase = 0; - } - }else uiPhaseTimer -= uiDiff; + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; - if (uiFireBallTimer <= uiDiff) - { - if (me->getVictim()) - DoCastVictim(SPELL_FIREBALL); - uiFireBallTimer = 5000; - } else uiFireBallTimer -= uiDiff; + if (uiFireBallTimer <= uiDiff) + { + if (me->getVictim()) + DoCastVictim(SPELL_FIREBALL); + uiFireBallTimer = 5000; + } else uiFireBallTimer -= uiDiff; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; - if (uiFireBallTimer <= uiDiff) - { - DoCastVictim(SPELL_FIREBALL); - uiFireBallTimer = 5000; - } else uiFireBallTimer -= uiDiff; + if (uiFireBallTimer <= uiDiff) + { + DoCastVictim(SPELL_FIREBALL); + uiFireBallTimer = 5000; + } else uiFireBallTimer -= uiDiff; - if (uiPolymorphTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_POLYMORPH); - uiPolymorphTimer = 8000; - } else uiPolymorphTimer -= uiDiff; + if (uiPolymorphTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_POLYMORPH); + uiPolymorphTimer = 8000; + } else uiPolymorphTimer -= uiDiff; - if (uiBlastWaveTimer <= uiDiff) - { - DoCastAOE(SPELL_BLAST_WAVE,false); - uiBlastWaveTimer = 13000; - } else uiBlastWaveTimer -= uiDiff; + if (uiBlastWaveTimer <= uiDiff) + { + DoCastAOE(SPELL_BLAST_WAVE,false); + uiBlastWaveTimer = 13000; + } else uiBlastWaveTimer -= uiDiff; - if (uiHasteTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(true); + if (uiHasteTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(true); - DoCast(me,SPELL_HASTE); - uiHasteTimer = 22000; - } else uiHasteTimer -= uiDiff; + DoCast(me,SPELL_HASTE); + uiHasteTimer = 22000; + } else uiHasteTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new boss_mage_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_mage_toc5(Creature* pCreature) +class boss_shaman_toc5 : public CreatureScript { - return new boss_mage_toc5AI(pCreature); -} +public: + boss_shaman_toc5() : CreatureScript("boss_shaman_toc5") { } -// Colosos && Runok Wildmane || Shaman -struct boss_shaman_toc5AI : public ScriptedAI -{ - boss_shaman_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + // Colosos && Runok Wildmane || Shaman + struct boss_shaman_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; + boss_shaman_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - uiPhase = 0; - uiPhaseTimer = 0; + bDone = false; + bHome = false; - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } + uiPhase = 0; + uiPhaseTimer = 0; - ScriptedInstance* pInstance; + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - uint8 uiPhase; - uint32 uiPhaseTimer; + InstanceScript* pInstance; - uint32 uiChainLightningTimer; - uint32 uiEartShieldTimer; - uint32 uiHealingWaveTimer; - uint32 uiHexMendingTimer; + uint8 uiPhase; + uint32 uiPhaseTimer; - bool bDone; - bool bHome; + uint32 uiChainLightningTimer; + uint32 uiEartShieldTimer; + uint32 uiHealingWaveTimer; + uint32 uiHexMendingTimer; - void Reset() - { - uiChainLightningTimer = 16000; - uiHealingWaveTimer = 12000; - uiEartShieldTimer = urand(30000,35000); - uiHexMendingTimer = urand(20000,25000); - } - - void EnterCombat(Unit* pWho) - { - DoCast(me,SPELL_EARTH_SHIELD); - DoCast(pWho,SPELL_HEX_OF_MENDING); - }; - - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); + bool bDone; + bool bHome; - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; + void Reset() + { + uiChainLightningTimer = 16000; + uiHealingWaveTimer = 12000; + uiEartShieldTimer = urand(30000,35000); + uiHexMendingTimer = urand(20000,25000); + } - bHome = false; - } + void EnterCombat(Unit* pWho) + { + DoCast(me,SPELL_EARTH_SHIELD); + DoCast(pWho,SPELL_HEX_OF_MENDING); + }; - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) + void JustReachedHome() { - bDone = true; + ScriptedAI::JustReachedHome(); - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); + if (!bHome) + return; - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + uiPhaseTimer = 15000; + uiPhase = 1; - EnterEvadeMode(); - bHome = true; + bHome = false; } - if (uiPhaseTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (uiPhase == 1) + if (!bDone && GrandChampionsOutVehicle(me)) { - AggroAllPlayers(me); - uiPhase = 0; + bDone = true; + + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); + + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + + EnterEvadeMode(); + bHome = true; } - }else uiPhaseTimer -= uiDiff; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; + if (uiPhaseTimer <= uiDiff) + { + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; - if (uiChainLightningTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget,SPELL_CHAIN_LIGHTNING); + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; - uiChainLightningTimer = 16000; - } else uiChainLightningTimer -= uiDiff; + if (uiChainLightningTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget,SPELL_CHAIN_LIGHTNING); - if (uiHealingWaveTimer <= uiDiff) - { - bool bChance = urand(0,1); + uiChainLightningTimer = 16000; + } else uiChainLightningTimer -= uiDiff; - if (!bChance) + if (uiHealingWaveTimer <= uiDiff) { - if (Unit* pFriend = DoSelectLowestHpFriendly(40)) - DoCast(pFriend,SPELL_HEALING_WAVE); - } else - DoCast(me,SPELL_HEALING_WAVE); + bool bChance = urand(0,1); - uiHealingWaveTimer = 12000; - } else uiHealingWaveTimer -= uiDiff; + if (!bChance) + { + if (Unit* pFriend = DoSelectLowestHpFriendly(40)) + DoCast(pFriend,SPELL_HEALING_WAVE); + } else + DoCast(me,SPELL_HEALING_WAVE); - if (uiEartShieldTimer <= uiDiff) - { - DoCast(me,SPELL_EARTH_SHIELD); + uiHealingWaveTimer = 12000; + } else uiHealingWaveTimer -= uiDiff; - uiEartShieldTimer = urand(30000,35000); - } else uiEartShieldTimer -= uiDiff; + if (uiEartShieldTimer <= uiDiff) + { + DoCast(me,SPELL_EARTH_SHIELD); - if (uiHexMendingTimer <= uiDiff) - { - DoCastVictim(SPELL_HEX_OF_MENDING,true); + uiEartShieldTimer = urand(30000,35000); + } else uiEartShieldTimer -= uiDiff; - uiHexMendingTimer = urand(20000,25000); - } else uiHexMendingTimer -= uiDiff; + if (uiHexMendingTimer <= uiDiff) + { + DoCastVictim(SPELL_HEX_OF_MENDING,true); - DoMeleeAttackIfReady(); - } + uiHexMendingTimer = urand(20000,25000); + } else uiHexMendingTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new boss_shaman_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_shaman_toc5(Creature* pCreature) -{ - return new boss_shaman_toc5AI(pCreature); -} -// Jaelyne Evensong && Zul'tore || Hunter -struct boss_hunter_toc5AI : public ScriptedAI +class boss_hunter_toc5 : public CreatureScript { - boss_hunter_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } +public: + boss_hunter_toc5() : CreatureScript("boss_hunter_toc5") { } - ScriptedInstance* pInstance; + // Jaelyne Evensong && Zul'tore || Hunter + struct boss_hunter_toc5AI : public ScriptedAI + { + boss_hunter_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - uint8 uiPhase; - uint32 uiPhaseTimer; + bDone = false; + bHome = false; - uint32 uiShootTimer; - uint32 uiMultiShotTimer; - uint32 uiLightningArrowsTimer; + uiPhase = 0; + uiPhaseTimer = 0; - uint64 uiTargetGUID; + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - bool bShoot; - bool bDone; - bool bHome; + InstanceScript* pInstance; - void Reset() - { - uiShootTimer = 12000; - uiMultiShotTimer = 0; - uiLightningArrowsTimer = 7000; + uint8 uiPhase; + uint32 uiPhaseTimer; - uiTargetGUID = 0; + uint32 uiShootTimer; + uint32 uiMultiShotTimer; + uint32 uiLightningArrowsTimer; - bShoot = false; - } + uint64 uiTargetGUID; - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); + bool bShoot; + bool bDone; + bool bHome; - if (!bHome) - return; + void Reset() + { + uiShootTimer = 12000; + uiMultiShotTimer = 0; + uiLightningArrowsTimer = 7000; - uiPhaseTimer = 15000; - uiPhase = 1; + uiTargetGUID = 0; - bHome = false; - } + bShoot = false; + } - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) + void JustReachedHome() { - bDone = true; + ScriptedAI::JustReachedHome(); - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); + if (!bHome) + return; - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + uiPhaseTimer = 15000; + uiPhase = 1; - EnterEvadeMode(); - bHome = true; + bHome = false; } - if (uiPhaseTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (uiPhase == 1) + if (!bDone && GrandChampionsOutVehicle(me)) { - AggroAllPlayers(me); - uiPhase = 0; - } - }else uiPhaseTimer -= uiDiff; + bDone = true; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); - if (uiLightningArrowsTimer <= uiDiff) - { - DoCastAOE(SPELL_LIGHTNING_ARROWS,false); - uiLightningArrowsTimer = 7000; - } else uiLightningArrowsTimer -= uiDiff; + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); - if (uiShootTimer <= uiDiff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_FARTHEST,0,30.0f)) - { - uiTargetGUID = pTarget->GetGUID(); - DoCast(pTarget, SPELL_SHOOT); + EnterEvadeMode(); + bHome = true; } - uiShootTimer = 12000; - uiMultiShotTimer = 3000; - bShoot = true; - } else uiShootTimer -= uiDiff; - if (bShoot && uiMultiShotTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(true); - Unit* pTarget = Unit::GetUnit(*me, uiTargetGUID); + if (uiPhaseTimer <= uiDiff) + { + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; + + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; - if (pTarget && me->IsInRange(pTarget,5.0f,30.0f,false)) + if (uiLightningArrowsTimer <= uiDiff) { - DoCast(pTarget,SPELL_MULTI_SHOT); - } else + DoCastAOE(SPELL_LIGHTNING_ARROWS,false); + uiLightningArrowsTimer = 7000; + } else uiLightningArrowsTimer -= uiDiff; + + if (uiShootTimer <= uiDiff) { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) + if (Unit* pTarget = SelectTarget(SELECT_TARGET_FARTHEST,0,30.0f)) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + uiTargetGUID = pTarget->GetGUID(); + DoCast(pTarget, SPELL_SHOOT); + } + uiShootTimer = 12000; + uiMultiShotTimer = 3000; + bShoot = true; + } else uiShootTimer -= uiDiff; + + if (bShoot && uiMultiShotTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(true); + Unit* pTarget = Unit::GetUnit(*me, uiTargetGUID); + + if (pTarget && me->IsInRange(pTarget,5.0f,30.0f,false)) + { + DoCast(pTarget,SPELL_MULTI_SHOT); + } else + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (me->GetMap()->IsDungeon() && !players.isEmpty()) { - Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,5.0f,30.0f,false)) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - DoCast(pTarget,SPELL_MULTI_SHOT); - break; + Player* pPlayer = itr->getSource(); + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,5.0f,30.0f,false)) + { + DoCast(pTarget,SPELL_MULTI_SHOT); + break; + } } } } - } - bShoot = false; - } else uiMultiShotTimer -= uiDiff; + bShoot = false; + } else uiMultiShotTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new boss_hunter_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_hunter_toc5(Creature* pCreature) -{ - return new boss_hunter_toc5AI(pCreature); -} -// Lana Stouthammer Evensong && Deathstalker Visceri || Rouge -struct boss_rouge_toc5AI : public ScriptedAI +class boss_rouge_toc5 : public CreatureScript { - boss_rouge_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_rouge_toc5() : CreatureScript("boss_rouge_toc5") { } + + // Lana Stouthammer Evensong && Deathstalker Visceri || Rouge + struct boss_rouge_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); + boss_rouge_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - bDone = false; - bHome = false; + bDone = false; + bHome = false; - uiPhase = 0; - uiPhaseTimer = 0; + uiPhase = 0; + uiPhaseTimer = 0; - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - uint8 uiPhase; - uint32 uiPhaseTimer; - uint32 uiEviscerateTimer; - uint32 uiFanKivesTimer; - uint32 uiPosionBottleTimer; + uint8 uiPhase; + uint32 uiPhaseTimer; + uint32 uiEviscerateTimer; + uint32 uiFanKivesTimer; + uint32 uiPosionBottleTimer; - bool bDone; - bool bHome; + bool bDone; + bool bHome; - void Reset() - { - uiEviscerateTimer = 8000; - uiFanKivesTimer = 14000; - uiPosionBottleTimer = 19000; - } + void Reset() + { + uiEviscerateTimer = 8000; + uiFanKivesTimer = 14000; + uiPosionBottleTimer = 19000; + } - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); - if (!bHome) - return; + if (!bHome) + return; - uiPhaseTimer = 15000; - uiPhase = 1; + uiPhaseTimer = 15000; + uiPhase = 1; - bHome = false; - } + bHome = false; + } - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) + void UpdateAI(const uint32 uiDiff) { - bDone = true; + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); - EnterEvadeMode(); - bHome = true; - } + EnterEvadeMode(); + bHome = true; + } - if (uiPhaseTimer <= uiDiff) - { - if (uiPhase == 1) + if (uiPhaseTimer <= uiDiff) { - AggroAllPlayers(me); - uiPhase = 0; - } - } else uiPhaseTimer -= uiDiff; + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + } else uiPhaseTimer -= uiDiff; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; - if (uiEviscerateTimer <= uiDiff) - { - DoCast(me->getVictim(),SPELL_EVISCERATE); - uiEviscerateTimer = 8000; - } else uiEviscerateTimer -= uiDiff; + if (uiEviscerateTimer <= uiDiff) + { + DoCast(me->getVictim(),SPELL_EVISCERATE); + uiEviscerateTimer = 8000; + } else uiEviscerateTimer -= uiDiff; - if (uiFanKivesTimer <= uiDiff) - { - DoCastAOE(SPELL_FAN_OF_KNIVES,false); - uiFanKivesTimer = 14000; - } else uiFanKivesTimer -= uiDiff; + if (uiFanKivesTimer <= uiDiff) + { + DoCastAOE(SPELL_FAN_OF_KNIVES,false); + uiFanKivesTimer = 14000; + } else uiFanKivesTimer -= uiDiff; - if (uiPosionBottleTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget,SPELL_POISON_BOTTLE); - uiPosionBottleTimer = 19000; - } else uiPosionBottleTimer -= uiDiff; + if (uiPosionBottleTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget,SPELL_POISON_BOTTLE); + uiPosionBottleTimer = 19000; + } else uiPosionBottleTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new boss_rouge_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_rouge_toc5(Creature* pCreature) -{ - return new boss_rouge_toc5AI(pCreature); -} - void AddSC_boss_grand_champions() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "generic_vehicleAI_toc5"; - NewScript->GetAI = &GetAI_generic_vehicleAI_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_warrior_toc5"; - NewScript->GetAI = &GetAI_boss_warrior_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_mage_toc5"; - NewScript->GetAI = &GetAI_boss_mage_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_shaman_toc5"; - NewScript->GetAI = &GetAI_boss_shaman_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_hunter_toc5"; - NewScript->GetAI = &GetAI_boss_hunter_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_rouge_toc5"; - NewScript->GetAI = &GetAI_boss_rouge_toc5; - NewScript->RegisterSelf(); + new generic_vehicleAI_toc5(); + new boss_warrior_toc5(); + new boss_mage_toc5(); + new boss_shaman_toc5(); + new boss_hunter_toc5(); + new boss_rouge_toc5(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 45cab67c0f4..b7cf807b77a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -26,314 +26,317 @@ EndScriptData */ #include "trial_of_the_champion.h" #define MAX_ENCOUNTER 4 - -struct instance_trial_of_the_champion : public ScriptedInstance +
class instance_trial_of_the_champion : public InstanceMapScript { - instance_trial_of_the_champion(Map* pMap) : ScriptedInstance(pMap) {Initialize();} +public: + instance_trial_of_the_champion() : InstanceMapScript("instance_trial_of_the_champion") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_trial_of_the_champion_InstanceMapScript(pMap); + } - uint8 uiMovementDone; - uint8 uiGrandChampionsDeaths; - uint8 uiArgentSoldierDeaths; + struct instance_trial_of_the_champion_InstanceMapScript : public InstanceScript + { + instance_trial_of_the_champion_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} - uint64 uiAnnouncerGUID; - uint64 uiMainGateGUID; - uint64 uiGrandChampionVehicle1GUID; - uint64 uiGrandChampionVehicle2GUID; - uint64 uiGrandChampionVehicle3GUID; - uint64 uiGrandChampion1GUID; - uint64 uiGrandChampion2GUID; - uint64 uiGrandChampion3GUID; - uint64 uiChampionLootGUID; - uint64 uiArgentChampionGUID; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::list<uint64> VehicleList; + uint8 uiMovementDone; + uint8 uiGrandChampionsDeaths; + uint8 uiArgentSoldierDeaths; - std::string str_data; + uint64 uiAnnouncerGUID; + uint64 uiMainGateGUID; + uint64 uiGrandChampionVehicle1GUID; + uint64 uiGrandChampionVehicle2GUID; + uint64 uiGrandChampionVehicle3GUID; + uint64 uiGrandChampion1GUID; + uint64 uiGrandChampion2GUID; + uint64 uiGrandChampion3GUID; + uint64 uiChampionLootGUID; + uint64 uiArgentChampionGUID; - bool bDone; + std::list<uint64> VehicleList; - void Initialize() - { - uiMovementDone = 0; - uiGrandChampionsDeaths = 0; - uiArgentSoldierDeaths = 0; - - uiAnnouncerGUID = 0; - uiMainGateGUID = 0; - uiGrandChampionVehicle1GUID = 0; - uiGrandChampionVehicle2GUID = 0; - uiGrandChampionVehicle3GUID = 0; - uiGrandChampion1GUID = 0; - uiGrandChampion2GUID = 0; - uiGrandChampion3GUID = 0; - uiChampionLootGUID = 0; - uiArgentChampionGUID = 0; - - bDone = false; - - VehicleList.clear(); - - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - } + std::string str_data; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + bool bDone; + + void Initialize() { - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + uiMovementDone = 0; + uiGrandChampionsDeaths = 0; + uiArgentSoldierDeaths = 0; + + uiAnnouncerGUID = 0; + uiMainGateGUID = 0; + uiGrandChampionVehicle1GUID = 0; + uiGrandChampionVehicle2GUID = 0; + uiGrandChampionVehicle3GUID = 0; + uiGrandChampion1GUID = 0; + uiGrandChampion2GUID = 0; + uiGrandChampion3GUID = 0; + uiChampionLootGUID = 0; + uiArgentChampionGUID = 0; + + bDone = false; + + VehicleList.clear(); + + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - return false; - } - - void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) - { - Map::PlayerList const &players = instance->GetPlayers(); - uint32 TeamInInstance = 0; - - if (!players.isEmpty()) + bool IsEncounterInProgress() const { - if (Player* pPlayer = players.begin()->getSource()) - TeamInInstance = pPlayer->GetTeam(); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + } + + return false; } - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) { - // Champions - case VEHICLE_MOKRA_SKILLCRUSHER_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT, ALLIANCE); - break; - case VEHICLE_ERESSEA_DAWNSINGER_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_AMBROSE_BOLTSPARK_MOUNT, ALLIANCE); - break; - case VEHICLE_RUNOK_WILDMANE_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_COLOSOS_MOUNT, ALLIANCE); - break; - case VEHICLE_ZUL_TORE_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_EVENSONG_MOUNT, ALLIANCE); - break; - case VEHICLE_DEATHSTALKER_VESCERI_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_LANA_STOUTHAMMER_MOUNT, ALLIANCE); - break; - // Coliseum Announcer || Just NPC_JAEREN must be spawned. - case NPC_JAEREN: - uiAnnouncerGUID = pCreature->GetGUID(); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_ARELAS,ALLIANCE); - break; - case VEHICLE_ARGENT_WARHORSE: - case VEHICLE_ARGENT_BATTLEWORG: - VehicleList.push_back(pCreature->GetGUID()); - break; - case NPC_EADRIC: - case NPC_PALETRESS: - uiArgentChampionGUID = pCreature->GetGUID(); - break; + Map::PlayerList const &players = instance->GetPlayers(); + uint32 TeamInInstance = 0; + + if (!players.isEmpty()) + { + if (Player* pPlayer = players.begin()->getSource()) + TeamInInstance = pPlayer->GetTeam(); + } + + switch(pCreature->GetEntry()) + { + // Champions + case VEHICLE_MOKRA_SKILLCRUSHER_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT, ALLIANCE); + break; + case VEHICLE_ERESSEA_DAWNSINGER_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_AMBROSE_BOLTSPARK_MOUNT, ALLIANCE); + break; + case VEHICLE_RUNOK_WILDMANE_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_COLOSOS_MOUNT, ALLIANCE); + break; + case VEHICLE_ZUL_TORE_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_EVENSONG_MOUNT, ALLIANCE); + break; + case VEHICLE_DEATHSTALKER_VESCERI_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_LANA_STOUTHAMMER_MOUNT, ALLIANCE); + break; + // Coliseum Announcer || Just NPC_JAEREN must be spawned. + case NPC_JAEREN: + uiAnnouncerGUID = pCreature->GetGUID(); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_ARELAS,ALLIANCE); + break; + case VEHICLE_ARGENT_WARHORSE: + case VEHICLE_ARGENT_BATTLEWORG: + VehicleList.push_back(pCreature->GetGUID()); + break; + case NPC_EADRIC: + case NPC_PALETRESS: + uiArgentChampionGUID = pCreature->GetGUID(); + break; + } } - } - void OnGameObjectCreate(GameObject* pGO, bool /*bAdd*/) - { - switch(pGO->GetEntry()) + void OnGameObjectCreate(GameObject* pGO, bool /*bAdd*/) { - case GO_MAIN_GATE: - uiMainGateGUID = pGO->GetGUID(); - break; - case GO_CHAMPIONS_LOOT: - case GO_CHAMPIONS_LOOT_H: - uiChampionLootGUID = pGO->GetGUID(); - break; + switch(pGO->GetEntry()) + { + case GO_MAIN_GATE: + uiMainGateGUID = pGO->GetGUID(); + break; + case GO_CHAMPIONS_LOOT: + case GO_CHAMPIONS_LOOT_H: + uiChampionLootGUID = pGO->GetGUID(); + break; + } } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + void SetData(uint32 uiType, uint32 uiData) { - case DATA_MOVEMENT_DONE: - uiMovementDone = uiData; - if (uiMovementDone == 3) - { - if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) - pAnnouncer->AI()->SetData(DATA_IN_POSITION,0); - } - break; - case BOSS_GRAND_CHAMPIONS: - m_auiEncounter[0] = uiData; - if (uiData == IN_PROGRESS) - { - for (std::list<uint64>::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) - if (Creature* pSummon = instance->GetCreature(*itr)) - pSummon->RemoveFromWorld(); - }else if (uiData == DONE) - { - ++uiGrandChampionsDeaths; - if (uiGrandChampionsDeaths == 3) + switch(uiType) + { + case DATA_MOVEMENT_DONE: + uiMovementDone = uiData; + if (uiMovementDone == 3) { if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + pAnnouncer->AI()->SetData(DATA_IN_POSITION,0); + } + break; + case BOSS_GRAND_CHAMPIONS: + m_auiEncounter[0] = uiData; + if (uiData == IN_PROGRESS) + { + for (std::list<uint64>::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) + if (Creature* pSummon = instance->GetCreature(*itr)) + pSummon->RemoveFromWorld(); + }else if (uiData == DONE) + { + ++uiGrandChampionsDeaths; + if (uiGrandChampionsDeaths == 3) { - pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); - pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + { + pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); + pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + } } } - } - break; - case DATA_ARGENT_SOLDIER_DEFEATED: - uiArgentSoldierDeaths = uiData; - if (uiArgentSoldierDeaths == 9) - { - if (Creature* pBoss = instance->GetCreature(uiArgentChampionGUID)) + break; + case DATA_ARGENT_SOLDIER_DEFEATED: + uiArgentSoldierDeaths = uiData; + if (uiArgentSoldierDeaths == 9) { - pBoss->GetMotionMaster()->MovePoint(0,746.88,618.74,411.06); - pBoss->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pBoss->SetReactState(REACT_AGGRESSIVE); + if (Creature* pBoss = instance->GetCreature(uiArgentChampionGUID)) + { + pBoss->GetMotionMaster()->MovePoint(0,746.88,618.74,411.06); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pBoss->SetReactState(REACT_AGGRESSIVE); + } } - } - break; - case BOSS_ARGENT_CHALLENGE_E: - m_auiEncounter[1] = uiData; - if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) - { - pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); - pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_EADRIC_LOOT_H : GO_EADRIC_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); - } - break; - case BOSS_ARGENT_CHALLENGE_P: - m_auiEncounter[2] = uiData; - if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) - { - pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); - pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_PALETRESS_LOOT_H : GO_PALETRESS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); - } - break; - } + break; + case BOSS_ARGENT_CHALLENGE_E: + m_auiEncounter[1] = uiData; + if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + { + pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); + pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_EADRIC_LOOT_H : GO_EADRIC_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + } + break; + case BOSS_ARGENT_CHALLENGE_P: + m_auiEncounter[2] = uiData; + if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + { + pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); + pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_PALETRESS_LOOT_H : GO_PALETRESS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + } + break; + } - if (uiData == DONE) - SaveToDB(); - } + if (uiData == DONE) + SaveToDB(); + } - uint32 GetData(uint32 uiData) - { - switch(uiData) + uint32 GetData(uint32 uiData) { - case BOSS_GRAND_CHAMPIONS: return m_auiEncounter[0]; - case BOSS_ARGENT_CHALLENGE_E: return m_auiEncounter[1]; - case BOSS_ARGENT_CHALLENGE_P: return m_auiEncounter[2]; - case BOSS_BLACK_KNIGHT: return m_auiEncounter[3]; - - case DATA_MOVEMENT_DONE: return uiMovementDone; - case DATA_ARGENT_SOLDIER_DEFEATED: return uiArgentSoldierDeaths; + switch(uiData) + { + case BOSS_GRAND_CHAMPIONS: return m_auiEncounter[0]; + case BOSS_ARGENT_CHALLENGE_E: return m_auiEncounter[1]; + case BOSS_ARGENT_CHALLENGE_P: return m_auiEncounter[2]; + case BOSS_BLACK_KNIGHT: return m_auiEncounter[3]; + + case DATA_MOVEMENT_DONE: return uiMovementDone; + case DATA_ARGENT_SOLDIER_DEFEATED: return uiArgentSoldierDeaths; + } + + return 0; } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint64 GetData64(uint32 uiData) { - case DATA_ANNOUNCER: return uiAnnouncerGUID; - case DATA_MAIN_GATE: return uiMainGateGUID; + switch(uiData) + { + case DATA_ANNOUNCER: return uiAnnouncerGUID; + case DATA_MAIN_GATE: return uiMainGateGUID; - case DATA_GRAND_CHAMPION_1: return uiGrandChampion1GUID; - case DATA_GRAND_CHAMPION_2: return uiGrandChampion2GUID; - case DATA_GRAND_CHAMPION_3: return uiGrandChampion3GUID; - } + case DATA_GRAND_CHAMPION_1: return uiGrandChampion1GUID; + case DATA_GRAND_CHAMPION_2: return uiGrandChampion2GUID; + case DATA_GRAND_CHAMPION_3: return uiGrandChampion3GUID; + } - return 0; - } + return 0; + } - void SetData64(uint32 uiType, uint64 uiData) - { - switch(uiType) + void SetData64(uint32 uiType, uint64 uiData) { - case DATA_GRAND_CHAMPION_1: - uiGrandChampion1GUID = uiData; - break; - case DATA_GRAND_CHAMPION_2: - uiGrandChampion2GUID = uiData; - break; - case DATA_GRAND_CHAMPION_3: - uiGrandChampion3GUID = uiData; - break; + switch(uiType) + { + case DATA_GRAND_CHAMPION_1: + uiGrandChampion1GUID = uiData; + break; + case DATA_GRAND_CHAMPION_2: + uiGrandChampion2GUID = uiData; + break; + case DATA_GRAND_CHAMPION_3: + uiGrandChampion3GUID = uiData; + break; + } } - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; + std::ostringstream saveStream; - saveStream << "T C " << m_auiEncounter[0] - << " " << m_auiEncounter[1] - << " " << m_auiEncounter[2] - << " " << m_auiEncounter[3] - << " " << uiGrandChampionsDeaths - << " " << uiMovementDone; + saveStream << "T C " << m_auiEncounter[0] + << " " << m_auiEncounter[1] + << " " << m_auiEncounter[2] + << " " << m_auiEncounter[3] + << " " << uiGrandChampionsDeaths + << " " << uiMovementDone; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; - if (dataHead1 == 'T' && dataHead2 == 'C') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + if (dataHead1 == 'T' && dataHead2 == 'C') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - uiGrandChampionsDeaths = data4; - uiMovementDone = data5; - } else OUT_LOAD_INST_DATA_FAIL; + uiGrandChampionsDeaths = data4; + uiMovementDone = data5; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_trial_of_the_champion(Map* pMap) -{ - return new instance_trial_of_the_champion(pMap); -} void AddSC_instance_trial_of_the_champion() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_trial_of_the_champion"; - newscript->GetInstanceData = &GetInstanceData_instance_trial_of_the_champion; - newscript->RegisterSelf(); + new instance_trial_of_the_champion(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 0ebe340a691..ec10c3991e2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -41,471 +41,470 @@ EndContentData */ const Position SpawnPosition = {746.261,657.401,411.681,4.65}; -struct npc_announcer_toc5AI : public ScriptedAI +class npc_announcer_toc5 : public CreatureScript { - npc_announcer_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_announcer_toc5() : CreatureScript("CreatureScript") { } + + struct npc_announcer_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); + npc_announcer_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); - uiSummonTimes = 0; - uiPosition = 0; - uiLesserChampions = 0; + uiSummonTimes = 0; + uiPosition = 0; + uiLesserChampions = 0; - uiFirstBoss = 0; - uiSecondBoss = 0; - uiThirdBoss = 0; + uiFirstBoss = 0; + uiSecondBoss = 0; + uiThirdBoss = 0; - uiArgentChampion = 0; + uiArgentChampion = 0; - uiPhase = 0; - uiTimer = 0; + uiPhase = 0; + uiTimer = 0; - uiVehicle1GUID = 0; - uiVehicle2GUID = 0; - uiVehicle3GUID = 0; + uiVehicle1GUID = 0; + uiVehicle2GUID = 0; + uiVehicle3GUID = 0; - Champion1List.clear(); - Champion2List.clear(); - Champion3List.clear(); + Champion1List.clear(); + Champion2List.clear(); + Champion3List.clear(); - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetGrandChampionsForEncounter(); - SetArgentChampion(); - } + SetGrandChampionsForEncounter(); + SetArgentChampion(); + } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - uint8 uiSummonTimes; - uint8 uiPosition; - uint8 uiLesserChampions; + uint8 uiSummonTimes; + uint8 uiPosition; + uint8 uiLesserChampions; - uint32 uiArgentChampion; + uint32 uiArgentChampion; - uint32 uiFirstBoss; - uint32 uiSecondBoss; - uint32 uiThirdBoss; + uint32 uiFirstBoss; + uint32 uiSecondBoss; + uint32 uiThirdBoss; - uint32 uiPhase; - uint32 uiTimer; + uint32 uiPhase; + uint32 uiTimer; - uint64 uiVehicle1GUID; - uint64 uiVehicle2GUID; - uint64 uiVehicle3GUID; + uint64 uiVehicle1GUID; + uint64 uiVehicle2GUID; + uint64 uiVehicle3GUID; - uint64 uiGrandChampionBoss1; + uint64 uiGrandChampionBoss1; - std::list<uint64> Champion1List; - std::list<uint64> Champion2List; - std::list<uint64> Champion3List; + std::list<uint64> Champion1List; + std::list<uint64> Champion2List; + std::list<uint64> Champion3List; - void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) - { - uiTimer = uiTimerStep; - if (bNextStep) - ++uiPhase; - else - uiPhase = uiPhaseStep; - } + void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) + { + uiTimer = uiTimerStep; + if (bNextStep) + ++uiPhase; + else + uiPhase = uiPhaseStep; + } - void SetData(uint32 uiType, uint32 /*uiData*/) - { - switch (uiType) + void SetData(uint32 uiType, uint32 /*uiData*/) { - case DATA_START: - DoSummonGrandChampion(uiFirstBoss); - NextStep(10000,false,1); - break; - case DATA_IN_POSITION: //movement done. - me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); - if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) - pInstance->HandleGameObject(pGO->GetGUID(),false); - NextStep(10000,false,3); - break; - case DATA_LESSER_CHAMPIONS_DEFEATED: + switch (uiType) { - ++uiLesserChampions; - std::list<uint64> TempList; - if (uiLesserChampions == 3 || uiLesserChampions == 6) + case DATA_START: + DoSummonGrandChampion(uiFirstBoss); + NextStep(10000,false,1); + break; + case DATA_IN_POSITION: //movement done. + me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); + if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) + pInstance->HandleGameObject(pGO->GetGUID(),false); + NextStep(10000,false,3); + break; + case DATA_LESSER_CHAMPIONS_DEFEATED: { - switch(uiLesserChampions) + ++uiLesserChampions; + std::list<uint64> TempList; + if (uiLesserChampions == 3 || uiLesserChampions == 6) { - case 3: - TempList = Champion2List; - break; - case 6: - TempList = Champion3List; - break; - } - - for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) - if (Creature* pSummon = Unit::GetCreature(*me, *itr)) - AggroAllPlayers(pSummon); - }else if (uiLesserChampions == 9) - StartGrandChampionsAttack(); + switch(uiLesserChampions) + { + case 3: + TempList = Champion2List; + break; + case 6: + TempList = Champion3List; + break; + } + + for (std::list<uint64>::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) + if (Creature* pSummon = Unit::GetCreature(*me, *itr)) + AggroAllPlayers(pSummon); + }else if (uiLesserChampions == 9) + StartGrandChampionsAttack(); - break; + break; + } } } - } - - void StartGrandChampionsAttack() - { - Creature* pGrandChampion1 = Unit::GetCreature(*me, uiVehicle1GUID); - Creature* pGrandChampion2 = Unit::GetCreature(*me, uiVehicle2GUID); - Creature* pGrandChampion3 = Unit::GetCreature(*me, uiVehicle3GUID); - if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) + void StartGrandChampionsAttack() { - AggroAllPlayers(pGrandChampion1); - AggroAllPlayers(pGrandChampion2); - AggroAllPlayers(pGrandChampion3); - } - } + Creature* pGrandChampion1 = Unit::GetCreature(*me, uiVehicle1GUID); + Creature* pGrandChampion2 = Unit::GetCreature(*me, uiVehicle2GUID); + Creature* pGrandChampion3 = Unit::GetCreature(*me, uiVehicle3GUID); - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE) - return; - - if (uiPointId == 1) - { - me->SetOrientation(ORIENTATION); - me->SendMovementFlagUpdate(); + if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) + { + AggroAllPlayers(pGrandChampion1); + AggroAllPlayers(pGrandChampion2); + AggroAllPlayers(pGrandChampion3); + } } - } - void DoSummonGrandChampion(uint32 uiBoss) - { - ++uiSummonTimes; - uint32 VEHICLE_TO_SUMMON1 = 0; - uint32 VEHICLE_TO_SUMMON2 = 0; - switch(uiBoss) + void MovementInform(uint32 uiType, uint32 uiPointId) { - case 0: - VEHICLE_TO_SUMMON1 = VEHICLE_MOKRA_SKILLCRUSHER_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_ORGRIMMAR_WOLF; - break; - case 1: - VEHICLE_TO_SUMMON1 = VEHICLE_ERESSEA_DAWNSINGER_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_SILVERMOON_HAWKSTRIDER; - break; - case 2: - VEHICLE_TO_SUMMON1 = VEHICLE_RUNOK_WILDMANE_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_THUNDER_BLUFF_KODO; - break; - case 3: - VEHICLE_TO_SUMMON1 = VEHICLE_ZUL_TORE_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_DARKSPEAR_RAPTOR; - break; - case 4: - VEHICLE_TO_SUMMON1 = VEHICLE_DEATHSTALKER_VESCERI_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_FORSAKE_WARHORSE; - break; - default: + if (uiType != POINT_MOTION_TYPE) return; + + if (uiPointId == 1) + { + me->SetOrientation(ORIENTATION); + me->SendMovementFlagUpdate(); + } } - if (Creature* pBoss = me->SummonCreature(VEHICLE_TO_SUMMON1,SpawnPosition)) + void DoSummonGrandChampion(uint32 uiBoss) { - switch(uiSummonTimes) + ++uiSummonTimes; + uint32 VEHICLE_TO_SUMMON1 = 0; + uint32 VEHICLE_TO_SUMMON2 = 0; + switch(uiBoss) { + case 0: + VEHICLE_TO_SUMMON1 = VEHICLE_MOKRA_SKILLCRUSHER_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_ORGRIMMAR_WOLF; + break; case 1: - { - uiVehicle1GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss1 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss1 = pUnit->GetGUID(); - if (pInstance) - { - pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1,uiVehicle1GUID); - pInstance->SetData64(DATA_GRAND_CHAMPION_1,uiGrandChampionBoss1); - } - pBoss->AI()->SetData(1,0); + VEHICLE_TO_SUMMON1 = VEHICLE_ERESSEA_DAWNSINGER_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_SILVERMOON_HAWKSTRIDER; break; - } case 2: - { - uiVehicle2GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss2 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss2 = pUnit->GetGUID(); - if (pInstance) - { - pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2,uiVehicle2GUID); - pInstance->SetData64(DATA_GRAND_CHAMPION_2,uiGrandChampionBoss2); - } - pBoss->AI()->SetData(2,0); + VEHICLE_TO_SUMMON1 = VEHICLE_RUNOK_WILDMANE_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_THUNDER_BLUFF_KODO; break; - } case 3: - { - uiVehicle3GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss3 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss3 = pUnit->GetGUID(); - if (pInstance) - { - pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3,uiVehicle3GUID); - pInstance->SetData64(DATA_GRAND_CHAMPION_3,uiGrandChampionBoss3); - } - pBoss->AI()->SetData(3,0); + VEHICLE_TO_SUMMON1 = VEHICLE_ZUL_TORE_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_DARKSPEAR_RAPTOR; + break; + case 4: + VEHICLE_TO_SUMMON1 = VEHICLE_DEATHSTALKER_VESCERI_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_FORSAKE_WARHORSE; break; - } default: return; } - for (uint8 i = 0; i < 3; ++i) + if (Creature* pBoss = me->SummonCreature(VEHICLE_TO_SUMMON1,SpawnPosition)) { - if (Creature* pAdd = me->SummonCreature(VEHICLE_TO_SUMMON2,SpawnPosition,TEMPSUMMON_CORPSE_DESPAWN)) + switch(uiSummonTimes) { - switch(uiSummonTimes) + case 1: { - case 1: - Champion1List.push_back(pAdd->GetGUID()); - break; - case 2: - Champion2List.push_back(pAdd->GetGUID()); - break; - case 3: - Champion3List.push_back(pAdd->GetGUID()); - break; + uiVehicle1GUID = pBoss->GetGUID(); + uint64 uiGrandChampionBoss1 = 0; + if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* pUnit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss1 = pUnit->GetGUID(); + if (pInstance) + { + pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1,uiVehicle1GUID); + pInstance->SetData64(DATA_GRAND_CHAMPION_1,uiGrandChampionBoss1); + } + pBoss->AI()->SetData(1,0); + break; } - - switch(i) + case 2: { - case 0: - pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI); - break; - case 1: - pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2); - break; - case 2: - pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2 + M_PI); - break; + uiVehicle2GUID = pBoss->GetGUID(); + uint64 uiGrandChampionBoss2 = 0; + if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* pUnit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss2 = pUnit->GetGUID(); + if (pInstance) + { + pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2,uiVehicle2GUID); + pInstance->SetData64(DATA_GRAND_CHAMPION_2,uiGrandChampionBoss2); + } + pBoss->AI()->SetData(2,0); + break; } + case 3: + { + uiVehicle3GUID = pBoss->GetGUID(); + uint64 uiGrandChampionBoss3 = 0; + if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* pUnit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss3 = pUnit->GetGUID(); + if (pInstance) + { + pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3,uiVehicle3GUID); + pInstance->SetData64(DATA_GRAND_CHAMPION_3,uiGrandChampionBoss3); + } + pBoss->AI()->SetData(3,0); + break; + } + default: + return; } + for (uint8 i = 0; i < 3; ++i) + { + if (Creature* pAdd = me->SummonCreature(VEHICLE_TO_SUMMON2,SpawnPosition,TEMPSUMMON_CORPSE_DESPAWN)) + { + switch(uiSummonTimes) + { + case 1: + Champion1List.push_back(pAdd->GetGUID()); + break; + case 2: + Champion2List.push_back(pAdd->GetGUID()); + break; + case 3: + Champion3List.push_back(pAdd->GetGUID()); + break; + } + + switch(i) + { + case 0: + pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI); + break; + case 1: + pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2); + break; + case 2: + pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2 + M_PI); + break; + } + } + + } } } - } - void DoStartArgentChampionEncounter() - { - me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); - - if (Creature* pBoss = me->SummonCreature(uiArgentChampion,SpawnPosition)) + void DoStartArgentChampionEncounter() { - for (uint8 i = 0; i < 3; ++i) + me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); + + if (Creature* pBoss = me->SummonCreature(uiArgentChampion,SpawnPosition)) { - if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_LIGHWIELDER,SpawnPosition)) - pTrash->AI()->SetData(i,0); - if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_MONK,SpawnPosition)) - pTrash->AI()->SetData(i,0); - if (Creature* pTrash = me->SummonCreature(NPC_PRIESTESS,SpawnPosition)) - pTrash->AI()->SetData(i,0); + for (uint8 i = 0; i < 3; ++i) + { + if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_LIGHWIELDER,SpawnPosition)) + pTrash->AI()->SetData(i,0); + if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_MONK,SpawnPosition)) + pTrash->AI()->SetData(i,0); + if (Creature* pTrash = me->SummonCreature(NPC_PRIESTESS,SpawnPosition)) + pTrash->AI()->SetData(i,0); + } } } - } - - void SetGrandChampionsForEncounter() - { - uiFirstBoss = urand(0,4); - while (uiSecondBoss == uiFirstBoss || uiThirdBoss == uiFirstBoss || uiThirdBoss == uiSecondBoss) + void SetGrandChampionsForEncounter() { - uiSecondBoss = urand(0,4); - uiThirdBoss = urand(0,4); - } - } + uiFirstBoss = urand(0,4); - void SetArgentChampion() - { - uint8 uiTempBoss = urand(0,1); - - switch(uiTempBoss) - { - case 0: - uiArgentChampion = NPC_EADRIC; - break; - case 1: - uiArgentChampion = NPC_PALETRESS; - break; - } - } + while (uiSecondBoss == uiFirstBoss || uiThirdBoss == uiFirstBoss || uiThirdBoss == uiSecondBoss) + { + uiSecondBoss = urand(0,4); + uiThirdBoss = urand(0,4); + } + } - void StartEncounter() - { - if (!pInstance) - return; + void SetArgentChampion() + { + uint8 uiTempBoss = urand(0,1); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + switch(uiTempBoss) + { + case 0: + uiArgentChampion = NPC_EADRIC; + break; + case 1: + uiArgentChampion = NPC_PALETRESS; + break; + } + } - if (pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) + void StartEncounter() { - if (pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED) + if (!pInstance) + return; + + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + if (pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) { - if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) - me->AI()->SetData(DATA_START,0); + if (pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED) + { + if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) + me->AI()->SetData(DATA_START,0); - if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE) - DoStartArgentChampionEncounter(); - } + if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE) + DoStartArgentChampionEncounter(); + } - if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || - pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) - me->SummonCreature(VEHICLE_BLACK_KNIGHT,769.834,651.915,447.035,0); + if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || + pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) + me->SummonCreature(VEHICLE_BLACK_KNIGHT,769.834,651.915,447.035,0); + } } - } - void AggroAllPlayers(Creature* pTemp) - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + void AggroAllPlayers(Creature* pTemp) + { + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - if (PlList.isEmpty()) - return; + if (PlList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) - { - if (Player* pPlayer = i->getSource()) + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { - if (pPlayer->isGameMaster()) - continue; - - if (pPlayer->isAlive()) + if (Player* pPlayer = i->getSource()) { - pTemp->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); - pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetReactState(REACT_AGGRESSIVE); - pTemp->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(pTemp); - pTemp->AddThreat(pPlayer, 0.0f); + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + { + pTemp->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); + pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetReactState(REACT_AGGRESSIVE); + pTemp->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(pTemp); + pTemp->AddThreat(pPlayer, 0.0f); + } } } } - } - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); - - if (uiTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - switch(uiPhase) + ScriptedAI::UpdateAI(uiDiff); + + if (uiTimer <= uiDiff) { - case 1: - DoSummonGrandChampion(uiSecondBoss); - NextStep(10000,true); - break; - case 2: - DoSummonGrandChampion(uiThirdBoss); - NextStep(0,false); - break; - case 3: - if (!Champion1List.empty()) - { - for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) - if (Creature* pSummon = Unit::GetCreature(*me, *itr)) - AggroAllPlayers(pSummon); + switch(uiPhase) + { + case 1: + DoSummonGrandChampion(uiSecondBoss); + NextStep(10000,true); + break; + case 2: + DoSummonGrandChampion(uiThirdBoss); NextStep(0,false); - } + break; + case 3: + if (!Champion1List.empty()) + { + for (std::list<uint64>::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) + if (Creature* pSummon = Unit::GetCreature(*me, *itr)) + AggroAllPlayers(pSummon); + NextStep(0,false); + } + break; + } + } else uiTimer -= uiDiff; + + if (!UpdateVictim()) + return; + } + + void JustSummoned(Creature* pSummon) + { + if (pInstance && pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) + { + pSummon->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pSummon->SetReactState(REACT_PASSIVE); + } + } + + void SummonedCreatureDespawn(Creature* pSummon) + { + switch(pSummon->GetEntry()) + { + case VEHICLE_DARNASSIA_NIGHTSABER: + case VEHICLE_EXODAR_ELEKK: + case VEHICLE_STORMWIND_STEED: + case VEHICLE_GNOMEREGAN_MECHANOSTRIDER: + case VEHICLE_IRONFORGE_RAM: + case VEHICLE_FORSAKE_WARHORSE: + case VEHICLE_THUNDER_BLUFF_KODO: + case VEHICLE_ORGRIMMAR_WOLF: + case VEHICLE_SILVERMOON_HAWKSTRIDER: + case VEHICLE_DARKSPEAR_RAPTOR: + me->AI()->SetData(DATA_LESSER_CHAMPIONS_DEFEATED,0); break; } - } else uiTimer -= uiDiff; + } + }; - if (!UpdateVictim()) - return; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_announcer_toc5AI(pCreature); } - void JustSummoned(Creature* pSummon) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pInstance && pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) - { - pSummon->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pSummon->SetReactState(REACT_PASSIVE); - } + InstanceScript* pInstance = pCreature->GetInstanceScript(); + + if (pInstance && + pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && + pInstance->GetData(BOSS_BLACK_KNIGHT) == DONE && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || + pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) + return false; + + if (pInstance && + pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED && + pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + else if (pInstance) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - void SummonedCreatureDespawn(Creature* pSummon) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - switch(pSummon->GetEntry()) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - case VEHICLE_DARNASSIA_NIGHTSABER: - case VEHICLE_EXODAR_ELEKK: - case VEHICLE_STORMWIND_STEED: - case VEHICLE_GNOMEREGAN_MECHANOSTRIDER: - case VEHICLE_IRONFORGE_RAM: - case VEHICLE_FORSAKE_WARHORSE: - case VEHICLE_THUNDER_BLUFF_KODO: - case VEHICLE_ORGRIMMAR_WOLF: - case VEHICLE_SILVERMOON_HAWKSTRIDER: - case VEHICLE_DARKSPEAR_RAPTOR: - me->AI()->SetData(DATA_LESSER_CHAMPIONS_DEFEATED,0); - break; + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_announcer_toc5::npc_announcer_toc5AI, pCreature->AI())->StartEncounter(); } - } -}; - -CreatureAI* GetAI_npc_announcer_toc5(Creature* pCreature) -{ - return new npc_announcer_toc5AI(pCreature); -} -bool GossipHello_npc_announcer_toc5(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - - if (pInstance && - pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && - pInstance->GetData(BOSS_BLACK_KNIGHT) == DONE && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || - pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) - return false; - - if (pInstance && - pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED && - pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - else if (pInstance) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_announcer_toc5(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_announcer_toc5AI, pCreature->AI())->StartEncounter(); + return true; } - - return true; -} +}; void AddSC_trial_of_the_champion() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "npc_announcer_toc5"; - NewScript->GetAI = &GetAI_npc_announcer_toc5; - NewScript->pGossipHello = &GossipHello_npc_announcer_toc5; - NewScript->pGossipSelect = &GossipSelect_npc_announcer_toc5; - NewScript->RegisterSelf(); + new npc_announcer_toc5(); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index c2234a4e4d0..4db4526d5bb 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -55,7 +55,7 @@ public: { boss_dredAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiBellowingRoarTimer; @@ -65,7 +65,7 @@ public: uint32 uiPiercingSlashTimer; uint32 uiRaptorCallTimer; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -167,10 +167,10 @@ public: { npc_drakkari_gutripperAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 GutRipTimer; @@ -221,10 +221,10 @@ public: { npc_drakkari_scytheclawAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiRendTimer; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 815c60d72cf..c6bca04f95b 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -72,7 +72,7 @@ public: { boss_novosAI(Creature *c) : Scripted_NoMovementAI(c), lSummons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiTimer; @@ -86,7 +86,7 @@ public: CombatPhase Phase; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -243,12 +243,12 @@ public: { mob_crystal_handlerAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiFlashOfDarknessTimer; - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() { @@ -300,10 +300,10 @@ public: { mob_novos_minionAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; void MovementInform(uint32 type, uint32 id) { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index be211cc3560..0da57724115 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -73,7 +73,7 @@ public: { boss_tharon_jaAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiPhaseTimer; @@ -86,7 +86,7 @@ public: CombatPhase Phase; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index fe32748c07b..4d003d3c2c4 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -63,7 +63,7 @@ public: { boss_trollgoreAI(Creature *c) : ScriptedAI(c), lSummons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiConsumeTimer; @@ -77,7 +77,7 @@ public: SummonList lSummons; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 3ac82b58b47..15ae879fa4b 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -47,9 +47,9 @@ class instance_drak_tharon : public InstanceMapScript public: instance_drak_tharon() : InstanceMapScript("instance_drak_tharon") { } - struct instance_drak_tharon_ScriptedInstance : public ScriptedInstance + struct instance_drak_tharon_InstanceScript : public InstanceScript { - instance_drak_tharon_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_drak_tharon_InstanceScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint8 uiDredAchievCounter; @@ -232,9 +232,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_drak_tharon_ScriptedInstance(map); + return new instance_drak_tharon_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 2555d8a6985..24812b58c6e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -71,10 +71,10 @@ public: { boss_bronjahmAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; CombatPhases phase; @@ -209,10 +209,10 @@ public: { mob_corrupted_soul_fragmentAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiCheckTimer; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index dd6d15dc901..11f4a454622 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -128,12 +128,12 @@ public: { boss_devourer_of_soulsAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } bool bThreeFaceAchievement; - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; // wailing soul event diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index d329f0d7858..c829554bc26 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -156,11 +156,11 @@ public: { npc_sylvanas_fosAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; Phase phase; @@ -281,11 +281,11 @@ public: { npc_jaina_fosAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; Phase phase; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index b1797806d89..5128799fd1f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -30,9 +30,9 @@ class instance_forge_of_souls : public InstanceMapScript public: instance_forge_of_souls() : InstanceMapScript("instance_forge_of_souls") { } - struct instance_forge_of_souls_ScriptedInstance : public ScriptedInstance + struct instance_forge_of_souls_InstanceScript : public InstanceScript { - instance_forge_of_souls_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {}; + instance_forge_of_souls_InstanceScript(Map* pMap) : InstanceScript(pMap) {}; uint64 uiBronjahm; uint64 uiDevourer; @@ -159,9 +159,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_forge_of_souls_ScriptedInstance(map); + return new instance_forge_of_souls_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index ddb6191c999..5ed714e897e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -44,100 +44,103 @@ enum Events EVENT_IMPENDING_DESPAIR, EVENT_DEFILING_HORROR, }; - -struct boss_falricAI : public boss_horAI +
class boss_falric : public CreatureScript { - boss_falricAI(Creature *pCreature) : boss_horAI(pCreature) {} - - uint8 uiHopelessnessCount; +public: + boss_falric() : CreatureScript("boss_falric") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - boss_horAI::Reset(); - - uiHopelessnessCount = 0; - - if (pInstance) - pInstance->SetData(DATA_FALRIC_EVENT, NOT_STARTED); + return new boss_falricAI(pCreature); } - void EnterCombat(Unit* who) + struct boss_falricAI : public boss_horAI { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS); + boss_falricAI(Creature *pCreature) : boss_horAI(pCreature) {} - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 23000); - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 9000); - events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000,45000)); // TODO adjust timer. - } + uint8 uiHopelessnessCount; - void JustDied(Unit* killer) - { - DoScriptText(SAY_DEATH, me); + void Reset() + { + boss_horAI::Reset(); - if (pInstance) - pInstance->SetData(DATA_FALRIC_EVENT, DONE); - } + uiHopelessnessCount = 0; - void KilledUnit(Unit *victim) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + if (pInstance) + pInstance->SetData(DATA_FALRIC_EVENT, NOT_STARTED); + } - void UpdateAI(const uint32 diff) - { - // Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* who) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS); + + events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 23000); + events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 9000); + events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000,45000)); // TODO adjust timer. + } - events.Update(diff); + void JustDied(Unit* killer) + { + DoScriptText(SAY_DEATH, me); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (pInstance) + pInstance->SetData(DATA_FALRIC_EVENT, DONE); + } - switch (events.ExecuteEvent()) + void KilledUnit(Unit *victim) { - case EVENT_QUIVERING_STRIKE: - DoCast(SPELL_QUIVERING_STRIKE); - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 10000); - break; - case EVENT_IMPENDING_DESPAIR: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - { - DoScriptText(SAY_IMPENDING_DESPAIR, me); - DoCast(pTarget, 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; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - if ((uiHopelessnessCount < 1 && HealthBelowPct(66)) - || (uiHopelessnessCount < 2 && HealthBelowPct(33)) - || (uiHopelessnessCount < 3 && HealthBelowPct(10))) + void UpdateAI(const uint32 diff) { - uiHopelessnessCount++; - DoCast(DUNGEON_MODE(SPELL_HOPELESSNESS,H_SPELL_HOPELESSNESS)); + // Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + switch (events.ExecuteEvent()) + { + case EVENT_QUIVERING_STRIKE: + DoCast(SPELL_QUIVERING_STRIKE); + events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 10000); + break; + case EVENT_IMPENDING_DESPAIR: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + { + DoScriptText(SAY_IMPENDING_DESPAIR, me); + DoCast(pTarget, 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; + } + + if ((uiHopelessnessCount < 1 && HealthBelowPct(66)) + || (uiHopelessnessCount < 2 && HealthBelowPct(33)) + || (uiHopelessnessCount < 3 && HealthBelowPct(10))) + { + uiHopelessnessCount++; + DoCast(DUNGEON_MODE(SPELL_HOPELESSNESS,H_SPELL_HOPELESSNESS)); + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_falric(Creature* pCreature) -{ - return new boss_falricAI(pCreature); -} void AddSC_boss_falric() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_falric"; - newscript->GetAI = &GetAI_boss_falric; - newscript->RegisterSelf(); + new 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 47af8fd19c0..cbdae031db8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -44,91 +44,94 @@ enum Events EVENT_CORRUPTED_FLESH, EVENT_SHARED_SUFFERING, }; - -struct boss_marwynAI : public boss_horAI +
class boss_marwyn : public CreatureScript { - boss_marwynAI(Creature *pCreature) : boss_horAI(pCreature) {} +public: + boss_marwyn() : CreatureScript("boss_marwyn") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - boss_horAI::Reset(); - - if (pInstance) - pInstance->SetData(DATA_MARWYN_EVENT, NOT_STARTED); + return new boss_marwynAI(pCreature); } - void EnterCombat(Unit* who) + struct boss_marwynAI : public boss_horAI { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->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 - } + boss_marwynAI(Creature *pCreature) : boss_horAI(pCreature) {} - void JustDied(Unit* killer) - { - DoScriptText(SAY_DEATH, me); + void Reset() + { + boss_horAI::Reset(); - if (pInstance) - pInstance->SetData(DATA_MARWYN_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_MARWYN_EVENT, NOT_STARTED); + } - void KilledUnit(Unit *victim) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void EnterCombat(Unit* who) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->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 + } - void UpdateAI(const uint32 diff) - { - // Return since we have no target - if (!UpdateVictim()) - return; + void JustDied(Unit* killer) + { + DoScriptText(SAY_DEATH, me); - events.Update(diff); + if (pInstance) + pInstance->SetData(DATA_MARWYN_EVENT, DONE); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void KilledUnit(Unit *victim) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - switch (events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - 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* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_SHARED_SUFFERING); - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); - break; + // Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + switch (events.ExecuteEvent()) + { + 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* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_SHARED_SUFFERING); + events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); + break; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_marwyn(Creature* pCreature) -{ - return new boss_marwynAI(pCreature); -} void AddSC_boss_marwyn() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_marwyn"; - newscript->GetAI = &GetAI_boss_marwyn; - newscript->RegisterSelf(); + new boss_marwyn(); } 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 65f326e924f..89c47a344ed 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -148,404 +148,401 @@ static Position UtherSpawnPos = {5308.310059, 2003.857178, 709.341431, static Position LichKingSpawnPos = {5362.917480, 2062.307129, 707.695374, 3.945812}; static Position LichKingMoveThronePos = {5312.080566, 2009.172119, 709.341431, 3.973301}; // Lich King walks to throne static Position LichKingMoveAwayPos = {5400.069824, 2102.7131689, 707.69525, 0.843803}; // Lich King walks away - -// AI of Part1: handle the intro till start of gauntlet event. -struct npc_jaina_or_sylvanas_horAI : public ScriptedAI +
class npc_jaina_or_sylvanas_hor : public CreatureScript { - npc_jaina_or_sylvanas_horAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint64 uiUther; - uint64 uiLichKing; - - EventMap events; - - void Reset() - { - events.Reset(); - - uiUther = 0; - uiLichKing = 0; +private: + bool m_isSylvana; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetVisibility(VISIBILITY_ON); - } +public: + npc_jaina_or_sylvanas_hor(bool isSylvana, const char* name) : CreatureScript(name), m_isSylvana(isSylvana) { } - void DoAction(const int32 actionId) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - switch(actionId) + switch (uiAction) { - case ACTION_START_INTRO: - events.ScheduleEvent(EVENT_START_INTRO, 0); - break; - case ACTION_SKIP_INTRO: - events.ScheduleEvent(EVENT_SKIP_INTRO, 0); + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pCreature->AI()) + pCreature->AI()->DoAction(ACTION_START_INTRO); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pCreature->AI()) + pCreature->AI()->DoAction(ACTION_SKIP_INTRO); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); break; } + + return true; } - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - events.Update(diff); - switch(events.ExecuteEvent()) - { - 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 (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - events.ScheduleEvent(EVENT_INTRO_A2_1, 0); - else - events.ScheduleEvent(EVENT_INTRO_H2_1, 0); - break; - - // A2 Intro Events - case EVENT_INTRO_A2_1: - DoScriptText(SAY_JAINA_INTRO_3, me); - events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); - break; - case EVENT_INTRO_A2_2: - DoScriptText(SAY_JAINA_INTRO_4, me); - events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); - break; - case EVENT_INTRO_A2_3: - // TODO: she's doing some kind of spell casting emote - pInstance->HandleGameObject(pInstance->GetData64(DATA_FROSTMOURNE), true); - events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); - break; - case EVENT_INTRO_A2_4: - // spawn UTHER during speach 2 - if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pUther->GetMotionMaster()->MoveIdle(); - pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas - uiUther = pUther->GetGUID(); - } - 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)) - { - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); - DoScriptText(SAY_UTHER_INTRO_A2_8, pUther); - } - 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); - break; - - // H2 Intro Events - case EVENT_INTRO_H2_1: - DoScriptText(SAY_SYLVANAS_INTRO_1, me); - events.ScheduleEvent(EVENT_INTRO_H2_2, 8000); - break; - case EVENT_INTRO_H2_2: - DoScriptText(SAY_SYLVANAS_INTRO_2, me); - events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); - 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); - break; - case EVENT_INTRO_H2_4: - // spawn UTHER during speach 2 - if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pUther->GetMotionMaster()->MoveIdle(); - pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas - uiUther = pUther->GetGUID(); - } - 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)) - { - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); - DoScriptText(SAY_UTHER_INTRO_H2_5, pUther); - } - events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); - 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); - break; - case EVENT_INTRO_H2_15: - DoScriptText(SAY_SYLVANAS_INTRO_8, me); - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); - 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)) - { - pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos); - pLichKing->SetReactState(REACT_PASSIVE); - uiLichKing = pLichKing->GetGUID(); - } + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (Creature* pUther = me->GetCreature(*me, uiUther)) - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - DoScriptText(SAY_UTHER_INTRO_A2_9, pUther); - else - DoScriptText(SAY_UTHER_INTRO_H2_7, pUther); + if (pPlayer->GetQuestStatus(m_isSylvana ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); - break; + // once last quest is completed, she offers this shortcut of the starting event + if (pPlayer->GetQuestStatus(m_isSylvana ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2) == QUEST_STATUS_COMPLETE) + pPlayer->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); - 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; - - case EVENT_INTRO_LK_3: - // The Lich King banishes Uther to the abyss. - if (Creature* pUther = me->GetCreature(*me, uiUther)) - { - pUther->DisappearAndDie(); - uiUther = 0; - } - - // He steps forward and removes the runeblade from the heap of skulls. - - events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); - break; - - 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; - - case EVENT_INTRO_LK_5: - // summon Falric and Marwyn. then go back to the door - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - pFalric->SetVisibility(VISIBILITY_ON); - if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - pMarwyn->SetVisibility(VISIBILITY_ON); - - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) - { - pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); - DoScriptText(SAY_LK_INTRO_3, pLichKing); - } - - events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); - break; - - case EVENT_INTRO_LK_6: - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - DoScriptText(SAY_FALRIC_INTRO_1, pFalric); - - events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); - break; - - case EVENT_INTRO_LK_7: - if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn); - - events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); - break; - - case EVENT_INTRO_LK_8: - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - DoScriptText(SAY_FALRIC_INTRO_2, pFalric); + pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); + return true; + } - events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); - break; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_jaina_or_sylvanas_horAI(pCreature); + } - case EVENT_INTRO_LK_9: - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - DoScriptText(SAY_JAINA_INTRO_END, me); - else - DoScriptText(SAY_SYLVANAS_INTRO_END, me); + // AI of Part1: handle the intro till start of gauntlet event. + struct npc_jaina_or_sylvanas_horAI : public ScriptedAI + { + npc_jaina_or_sylvanas_horAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = me->GetInstanceScript(); + } - me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); - // TODO: Loralen/Koreln shall run also - events.ScheduleEvent(EVENT_INTRO_END, 10000); - break; - - case EVENT_INTRO_END: - if (pInstance) - pInstance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave + InstanceScript* pInstance; + uint64 uiUther; + uint64 uiLichKing; - // Loralen or Koreln disappearAndDie() - me->DisappearAndDie(); - break; + EventMap events; - case EVENT_SKIP_INTRO: - // TODO: implement + void Reset() + { + events.Reset(); - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - pFalric->SetVisibility(VISIBILITY_ON); - if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - pMarwyn->SetVisibility(VISIBILITY_ON); + uiUther = 0; + uiLichKing = 0; - me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); - // TODO: Loralen/Koreln shall run also + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetVisibility(VISIBILITY_ON); + } - events.ScheduleEvent(EVENT_INTRO_END, 15000); - break; + void DoAction(const int32 actionId) + { + switch(actionId) + { + case ACTION_START_INTRO: + events.ScheduleEvent(EVENT_START_INTRO, 0); + break; + case ACTION_SKIP_INTRO: + events.ScheduleEvent(EVENT_SKIP_INTRO, 0); + break; + } } - } -}; -bool GossipHello_npc_sylvanas_hor(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + void UpdateAI(const uint32 diff) + { + events.Update(diff); + switch(events.ExecuteEvent()) + { + 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 (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + events.ScheduleEvent(EVENT_INTRO_A2_1, 0); + else + events.ScheduleEvent(EVENT_INTRO_H2_1, 0); + break; + + // A2 Intro Events + case EVENT_INTRO_A2_1: + DoScriptText(SAY_JAINA_INTRO_3, me); + events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); + break; + case EVENT_INTRO_A2_2: + DoScriptText(SAY_JAINA_INTRO_4, me); + events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); + break; + case EVENT_INTRO_A2_3: + // TODO: she's doing some kind of spell casting emote + pInstance->HandleGameObject(pInstance->GetData64(DATA_FROSTMOURNE), true); + events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); + break; + case EVENT_INTRO_A2_4: + // spawn UTHER during speach 2 + if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pUther->GetMotionMaster()->MoveIdle(); + pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas + uiUther = pUther->GetGUID(); + } + 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)) + { + pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); + DoScriptText(SAY_UTHER_INTRO_A2_8, pUther); + } + 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); + break; + + // H2 Intro Events + case EVENT_INTRO_H2_1: + DoScriptText(SAY_SYLVANAS_INTRO_1, me); + events.ScheduleEvent(EVENT_INTRO_H2_2, 8000); + break; + case EVENT_INTRO_H2_2: + DoScriptText(SAY_SYLVANAS_INTRO_2, me); + events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); + 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); + break; + case EVENT_INTRO_H2_4: + // spawn UTHER during speach 2 + if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pUther->GetMotionMaster()->MoveIdle(); + pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas + uiUther = pUther->GetGUID(); + } + 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)) + { + pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); + DoScriptText(SAY_UTHER_INTRO_H2_5, pUther); + } + events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); + 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); + break; + case EVENT_INTRO_H2_15: + DoScriptText(SAY_SYLVANAS_INTRO_8, me); + events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); + 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)) + { + pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos); + pLichKing->SetReactState(REACT_PASSIVE); + uiLichKing = pLichKing->GetGUID(); + } - if (pPlayer->GetQuestStatus(QUEST_DELIVRANCE_FROM_THE_PIT_H2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - // once last quest is completed, she offers this shortcut of the starting event - if (pPlayer->GetQuestStatus(QUEST_WRATH_OF_THE_LICH_KING_H2) == QUEST_STATUS_COMPLETE) - pPlayer->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); + if (Creature* pUther = me->GetCreature(*me, uiUther)) + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + DoScriptText(SAY_UTHER_INTRO_A2_9, pUther); + else + DoScriptText(SAY_UTHER_INTRO_H2_7, pUther); + + events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); + 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; + + case EVENT_INTRO_LK_3: + // The Lich King banishes Uther to the abyss. + if (Creature* pUther = me->GetCreature(*me, uiUther)) + { + pUther->DisappearAndDie(); + uiUther = 0; + } + + // He steps forward and removes the runeblade from the heap of skulls. + + events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); + break; + + 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; + + case EVENT_INTRO_LK_5: + // summon Falric and Marwyn. then go back to the door + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + pFalric->SetVisibility(VISIBILITY_ON); + if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + pMarwyn->SetVisibility(VISIBILITY_ON); + + if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) + { + pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); + DoScriptText(SAY_LK_INTRO_3, pLichKing); + } + + events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); + break; + + case EVENT_INTRO_LK_6: + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + DoScriptText(SAY_FALRIC_INTRO_1, pFalric); + + events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); + break; + + case EVENT_INTRO_LK_7: + if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn); + + events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); + break; + + case EVENT_INTRO_LK_8: + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + DoScriptText(SAY_FALRIC_INTRO_2, pFalric); + + events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); + break; + + case EVENT_INTRO_LK_9: + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + DoScriptText(SAY_JAINA_INTRO_END, me); + else + DoScriptText(SAY_SYLVANAS_INTRO_END, me); - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); + me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); + // TODO: Loralen/Koreln shall run also + events.ScheduleEvent(EVENT_INTRO_END, 10000); + break; + + case EVENT_INTRO_END: + if (pInstance) + pInstance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave - return true; -} + // Loralen or Koreln disappearAndDie() + me->DisappearAndDie(); + break; -bool GossipHello_npc_jaina_hor(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + case EVENT_SKIP_INTRO: + // TODO: implement - if (pPlayer->GetQuestStatus(QUEST_DELIVRANCE_FROM_THE_PIT_A2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - // once last quest of the series is completed, she offers this shortcut of the starting event - if (pPlayer->GetQuestStatus(QUEST_WRATH_OF_THE_LICH_KING_A2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "My Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + pFalric->SetVisibility(VISIBILITY_ON); + if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + pMarwyn->SetVisibility(VISIBILITY_ON); - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); - return true; -} + me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); + // TODO: Loralen/Koreln shall run also -bool GossipSelect_npc_jaina_or_sylvanas_hor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pCreature->AI()) - pCreature->AI()->DoAction(ACTION_START_INTRO); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pCreature->AI()) - pCreature->AI()->DoAction(ACTION_SKIP_INTRO); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - } + events.ScheduleEvent(EVENT_INTRO_END, 15000); + break; + } + } + }; - return true; -} +}; enum TrashSpells { @@ -617,407 +614,401 @@ enum TrashEvents EVENT_FROST_TRAP, EVENT_ICE_SHOT, }; - -struct npc_ghostly_priestAI: public ScriptedAI +
class npc_ghostly_priest : public CreatureScript { - npc_ghostly_priestAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new npc_ghostly_priestAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct npc_ghostly_priestAI: public ScriptedAI { - events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000); // TODO: adjust timers - events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); - events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); - events.ScheduleEvent(EVENT_DARK_MENDING, 20000); - } + npc_ghostly_priestAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000); // TODO: adjust timers + events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); + events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); + events.ScheduleEvent(EVENT_DARK_MENDING, 20000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_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 *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 *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 *pTarget = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000,50000))) - { - DoCast(pTarget, SPELL_DARK_MENDING); - events.ScheduleEvent(EVENT_DARK_MENDING, 20000); - } - else - { - // no friendly unit with missing hp. re-check in just 5 sec. - events.ScheduleEvent(EVENT_DARK_MENDING, 5000); - } - return; + switch(eventId) + { + case EVENT_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 *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 *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 *pTarget = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000,50000))) + { + DoCast(pTarget, SPELL_DARK_MENDING); + events.ScheduleEvent(EVENT_DARK_MENDING, 20000); + } + else + { + // no friendly unit with missing hp. re-check in just 5 sec. + events.ScheduleEvent(EVENT_DARK_MENDING, 5000); + } + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct npc_phantom_mageAI: public ScriptedAI +
class npc_phantom_mage : public CreatureScript { - npc_phantom_mageAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + npc_phantom_mage() : CreatureScript("npc_phantom_mage") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new npc_phantom_mageAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct npc_phantom_mageAI: public ScriptedAI { - events.ScheduleEvent(EVENT_FIREBALL, 3000); // TODO: adjust timers - events.ScheduleEvent(EVENT_FLAMESTRIKE, 6000); - events.ScheduleEvent(EVENT_FROSTBOLT, 9000); - events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); - events.ScheduleEvent(EVENT_HALLUCINATION, 40000); - } + npc_phantom_mageAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FIREBALL, 3000); // TODO: adjust timers + events.ScheduleEvent(EVENT_FLAMESTRIKE, 6000); + events.ScheduleEvent(EVENT_FROSTBOLT, 9000); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); + events.ScheduleEvent(EVENT_HALLUCINATION, 40000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FIREBALL: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_FIREBALL); - events.ScheduleEvent(EVENT_FIREBALL, 15000); - return; - case EVENT_FLAMESTRIKE: - DoCast(SPELL_FLAMESTRIKE); - events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000); - return; - case EVENT_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 *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_CHAINS_OF_ICE); - events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000); - return; - case EVENT_HALLUCINATION: - DoCast(SPELL_HALLUCINATION); - return; + switch(eventId) + { + case EVENT_FIREBALL: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_FIREBALL); + events.ScheduleEvent(EVENT_FIREBALL, 15000); + return; + case EVENT_FLAMESTRIKE: + DoCast(SPELL_FLAMESTRIKE); + events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000); + return; + case EVENT_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 *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_CHAINS_OF_ICE); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000); + return; + case EVENT_HALLUCINATION: + DoCast(SPELL_HALLUCINATION); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct npc_phantom_hallucinationAI: public npc_phantom_mageAI +
class npc_phantom_hallucination : public CreatureScript { - npc_phantom_hallucinationAI(Creature *c) : npc_phantom_mageAI(c) - { - } +public: + npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { } - void JustDied(Unit * /*pWho*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(SPELL_HALLUCINATION_2); + return new npc_phantom_hallucinationAI(pCreature); } -}; -struct npc_shadowy_mercenaryAI: public ScriptedAI -{ - npc_shadowy_mercenaryAI(Creature *c) : ScriptedAI(c) + struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI { - } + npc_phantom_hallucinationAI(Creature *c) : npc_phantom_mage::npc_phantom_mageAI(c) + { + } - EventMap events; + void JustDied(Unit * /*pWho*/) + { + DoCast(SPELL_HALLUCINATION_2); + } + }; - void Reset() - { - events.Reset(); - } +}; +
class npc_shadowy_mercenary : public CreatureScript +{ +public: + npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); // TODO: adjust timers - events.ScheduleEvent(EVENT_DEADLY_POISON, 5000); - events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); - events.ScheduleEvent(EVENT_KIDNEY_SHOT, 12000); + return new npc_shadowy_mercenaryAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_shadowy_mercenaryAI: public ScriptedAI { - if (!UpdateVictim()) - return; + npc_shadowy_mercenaryAI(Creature *c) : ScriptedAI(c) + { + } - events.Update(diff); + EventMap events; - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void Reset() + { + events.Reset(); + } - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) + events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); // TODO: adjust timers + events.ScheduleEvent(EVENT_DEADLY_POISON, 5000); + events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); + events.ScheduleEvent(EVENT_KIDNEY_SHOT, 12000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHADOW_STEP: - DoCast(SPELL_SHADOW_STEP); - events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); - return; - case EVENT_DEADLY_POISON: - DoCast(me->getVictim(), SPELL_DEADLY_POISON); - events.ScheduleEvent(EVENT_DEADLY_POISON, 10000); - return; - case EVENT_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: - DoCast(me->getVictim(), SPELL_KIDNEY_SHOT); - events.ScheduleEvent(EVENT_KIDNEY_SHOT, 10000); - return; + switch(eventId) + { + case EVENT_SHADOW_STEP: + DoCast(SPELL_SHADOW_STEP); + events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); + return; + case EVENT_DEADLY_POISON: + DoCast(me->getVictim(), SPELL_DEADLY_POISON); + events.ScheduleEvent(EVENT_DEADLY_POISON, 10000); + return; + case EVENT_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: + DoCast(me->getVictim(), SPELL_KIDNEY_SHOT); + events.ScheduleEvent(EVENT_KIDNEY_SHOT, 10000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct npc_spectral_footmanAI: public ScriptedAI +
class npc_spectral_footman : public CreatureScript { - npc_spectral_footmanAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + npc_spectral_footman() : CreatureScript("npc_spectral_footman") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new npc_spectral_footmanAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct npc_spectral_footmanAI: public ScriptedAI { - events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); // TODO: adjust timers - events.ScheduleEvent(EVENT_SHIELD_BASH, 10000); - events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); - } + npc_spectral_footmanAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); // TODO: adjust timers + events.ScheduleEvent(EVENT_SHIELD_BASH, 10000); + events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SPECTRAL_STRIKE: - DoCast(me->getVictim(), SPELL_SPECTRAL_STRIKE); - events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); - return; - case EVENT_SHIELD_BASH: - DoCast(me->getVictim(), SPELL_SHIELD_BASH); - events.ScheduleEvent(EVENT_SHIELD_BASH, 5000); - return; - case EVENT_TORTURED_ENRAGE: - DoCast(SPELL_TORTURED_ENRAGE); - events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); - return; + switch(eventId) + { + case EVENT_SPECTRAL_STRIKE: + DoCast(me->getVictim(), SPELL_SPECTRAL_STRIKE); + events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); + return; + case EVENT_SHIELD_BASH: + DoCast(me->getVictim(), SPELL_SHIELD_BASH); + events.ScheduleEvent(EVENT_SHIELD_BASH, 5000); + return; + case EVENT_TORTURED_ENRAGE: + DoCast(SPELL_TORTURED_ENRAGE); + events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct npc_tortured_riflemanAI : public ScriptedAI +
class npc_tortured_rifleman : public CreatureScript { - npc_tortured_riflemanAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } +public: + npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - events.ScheduleEvent(EVENT_SHOOT, 2000); // TODO: adjust timers - events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); - events.ScheduleEvent(EVENT_FROST_TRAP, 1000); - events.ScheduleEvent(EVENT_ICE_SHOT, 15000); + return new npc_tortured_riflemanAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_tortured_riflemanAI : public ScriptedAI { - if (!UpdateVictim()) - return; - - events.Update(diff); + npc_tortured_riflemanAI(Creature *c) : ScriptedAI(c) + { + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + EventMap events; - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_SHOOT: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_SHOOT); - events.ScheduleEvent(EVENT_SHOOT, 2000); - return; - case EVENT_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: - DoCast(SPELL_FROST_TRAP); - events.ScheduleEvent(EVENT_FROST_TRAP, 30000); - return; - case EVENT_ICE_SHOT: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_ICE_SHOT); - events.ScheduleEvent(EVENT_ICE_SHOT, 15000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHOOT, 2000); // TODO: adjust timers + events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); + events.ScheduleEvent(EVENT_FROST_TRAP, 1000); + events.ScheduleEvent(EVENT_ICE_SHOT, 15000); + } -CreatureAI* GetAI_npc_jaina_or_sylvanas_horAI(Creature* pCreature) -{ - return new npc_jaina_or_sylvanas_horAI(pCreature); -} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; -CreatureAI* GetAI_npc_ghostly_priestAI(Creature* pCreature) -{ - return new npc_ghostly_priestAI(pCreature); -} + events.Update(diff); -CreatureAI* GetAI_npc_phantom_mageAI(Creature* pCreature) -{ - return new npc_phantom_mageAI(pCreature); -} + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; -CreatureAI* GetAI_npc_phantom_hallucinationAI(Creature* pCreature) -{ - return new npc_phantom_hallucinationAI(pCreature); -} - -CreatureAI* GetAI_npc_shadowy_mercenaryAI(Creature* pCreature) -{ - return new npc_shadowy_mercenaryAI(pCreature); -} + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHOOT: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_SHOOT); + events.ScheduleEvent(EVENT_SHOOT, 2000); + return; + case EVENT_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: + DoCast(SPELL_FROST_TRAP); + events.ScheduleEvent(EVENT_FROST_TRAP, 30000); + return; + case EVENT_ICE_SHOT: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_ICE_SHOT); + events.ScheduleEvent(EVENT_ICE_SHOT, 15000); + return; + } + } -CreatureAI* GetAI_npc_spectral_footmanAI(Creature* pCreature) -{ - return new npc_spectral_footmanAI(pCreature); -} + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_npc_tortured_riflemanAI(Creature* pCreature) -{ - return new npc_tortured_riflemanAI(pCreature); -} +}; void AddSC_halls_of_reflection() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_sylvanas_hor_part1"; - newscript->GetAI = &GetAI_npc_jaina_or_sylvanas_horAI; - newscript->pGossipHello = &GossipHello_npc_sylvanas_hor; - newscript->pGossipSelect = &GossipSelect_npc_jaina_or_sylvanas_hor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_jaina_hor_part1"; - newscript->GetAI = &GetAI_npc_jaina_or_sylvanas_horAI; - newscript->pGossipHello = &GossipHello_npc_jaina_hor; - newscript->pGossipSelect = &GossipSelect_npc_jaina_or_sylvanas_hor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ghostly_priest"; - newscript->GetAI = &GetAI_npc_ghostly_priestAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_phantom_mage"; - newscript->GetAI = &GetAI_npc_phantom_mageAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_phantom_hallucination"; - newscript->GetAI = &GetAI_npc_phantom_hallucinationAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_shadowy_mercenary"; - newscript->GetAI = &GetAI_npc_shadowy_mercenaryAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_spectral_footman"; - newscript->GetAI = &GetAI_npc_spectral_footmanAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tortured_rifleman"; - newscript->GetAI = &GetAI_npc_tortured_riflemanAI; - newscript->RegisterSelf(); + new npc_jaina_or_sylvanas_hor(true, "npc_sylvanas_hor_part1"); + new npc_jaina_or_sylvanas_hor(false, "npc_jaina_hor_part1"); + new npc_ghostly_priest(); + new npc_phantom_mage(); + new npc_phantom_hallucination(); + new npc_shadowy_mercenary(); + new npc_spectral_footman(); + new npc_tortured_rifleman(); } 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 0e4dc94b826..29fc462b15b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -76,15 +76,15 @@ enum Actions }; // Base class for FALRIC and MARWYN -// handled the summonList and the notification events to/from the InstanceData +// handled the summonList and the notification events to/from the InstanceScript struct boss_horAI : ScriptedAI { boss_horAI(Creature *pCreature) : ScriptedAI(pCreature), summons(pCreature) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } - InstanceData* pInstance; + InstanceScript* pInstance; EventMap events; SummonList summons; @@ -106,8 +106,8 @@ struct boss_horAI : ScriptedAI { switch(actionID) { - case ACTION_ENTER_COMBAT: // called by InstanceData when boss shall enter in combat. - // Just in case. Should have been done by InstanceData + case ACTION_ENTER_COMBAT: // called by InstanceScript when boss shall enter in combat. + // Just in case. Should have been done by InstanceScript me->SetVisibility(VISIBILITY_ON); // Reset flags 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 8a6ffb82fc2..babfa9eaa51 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 @@ -95,338 +95,341 @@ static Position RiflemanSpawnPos[ENCOUNTER_WAVE_RIFLEMAN] = {5295.64,1973.76,707.778,1.18682}, {5282.9,2019.6,707.778,5.88176}, }; - -struct instance_halls_of_reflection : public ScriptedInstance +
class instance_halls_of_reflection : public InstanceMapScript { - instance_halls_of_reflection(Map* pMap) : ScriptedInstance(pMap) {}; - - uint64 uiFalric; - uint64 uiMarwyn; - uint64 uiLichKingEvent; - uint64 uiJainaPart1; - uint64 uiSylvanasPart1; - - uint64 uiFrostmourne; - uint64 uiFrostmourneAltar; - uint64 uiArthasDoor; - uint64 uiFrontDoor; - - uint32 uiEncounter[MAX_ENCOUNTER]; - uint32 uiTeamInInstance; - uint32 uiWaveCount; - bool bIntroDone; +public: + instance_halls_of_reflection() : InstanceMapScript("instance_halls_of_reflection") { } - EventMap events; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - 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; + return new instance_halls_of_reflection_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool add) + struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript { - if (!add) - return; + instance_halls_of_reflection_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}; - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* pPlayer = players.begin()->getSource()) - uiTeamInInstance = pPlayer->GetTeam(); + uint64 uiFalric; + uint64 uiMarwyn; + uint64 uiLichKingEvent; + uint64 uiJainaPart1; + uint64 uiSylvanasPart1; - switch(pCreature->GetEntry()) - { - case NPC_FALRIC: - uiFalric = pCreature->GetGUID(); - break; - case NPC_MARWYN: - uiMarwyn = pCreature->GetGUID(); - break; - case NPC_LICH_KING_EVENT: - uiLichKingEvent = pCreature->GetGUID(); - break; - case NPC_JAINA_PART1: - uiJainaPart1 = pCreature->GetGUID(); - break; - case NPC_SYLVANAS_PART1: - uiSylvanasPart1 = pCreature->GetGUID(); - break; - } - } + uint64 uiFrostmourne; + uint64 uiFrostmourneAltar; + uint64 uiArthasDoor; + uint64 uiFrontDoor; - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if (!add) - return; + uint32 uiEncounter[MAX_ENCOUNTER]; + uint32 uiTeamInInstance; + uint32 uiWaveCount; + bool bIntroDone; + + EventMap events; - // TODO: init state depending on encounters - switch(pGo->GetEntry()) + void Initialize() { - case GO_FROSTMOURNE: - uiFrostmourne = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - HandleGameObject(0, false, pGo); - break; - case GO_FROSTMOURNE_ALTAR: - uiFrostmourneAltar = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - HandleGameObject(0, true, pGo); - break; - case GO_FRONT_DOOR: - uiFrontDoor = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - HandleGameObject(0, true, pGo); - break; - case GO_ARTHAS_DOOR: - uiArthasDoor = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - - if (uiEncounter[1] == DONE) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; + 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; } - } - void SetData(uint32 type, uint32 data) - { - if (type == DATA_WAVE_COUNT && data == SPECIAL) + void OnCreatureCreate(Creature* pCreature, bool add) { - bIntroDone = true; - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); - return; + if (!add) + return; + + Map::PlayerList const &players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* pPlayer = players.begin()->getSource()) + uiTeamInInstance = pPlayer->GetTeam(); + + switch(pCreature->GetEntry()) + { + case NPC_FALRIC: + uiFalric = pCreature->GetGUID(); + break; + case NPC_MARWYN: + uiMarwyn = pCreature->GetGUID(); + break; + case NPC_LICH_KING_EVENT: + uiLichKingEvent = pCreature->GetGUID(); + break; + case NPC_JAINA_PART1: + uiJainaPart1 = pCreature->GetGUID(); + break; + case NPC_SYLVANAS_PART1: + uiSylvanasPart1 = pCreature->GetGUID(); + break; + } } - - if (uiWaveCount && data == NOT_STARTED) - DoWipe(); - - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool add) { - case DATA_FALRIC_EVENT: - uiEncounter[0] = data; - if (data == DONE) - events.ScheduleEvent(EVENT_NEXT_WAVE, 60000); - break; - case DATA_MARWYN_EVENT: - uiEncounter[1] = data; - if (data == DONE) - HandleGameObject(uiArthasDoor, true); - break; - case DATA_LICHKING_EVENT: - uiEncounter[2] = data; - break; + if (!add) + return; + + // TODO: init state depending on encounters + switch(pGo->GetEntry()) + { + case GO_FROSTMOURNE: + uiFrostmourne = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + HandleGameObject(0, false, pGo); + break; + case GO_FROSTMOURNE_ALTAR: + uiFrostmourneAltar = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + HandleGameObject(0, true, pGo); + break; + case GO_FRONT_DOOR: + uiFrontDoor = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + HandleGameObject(0, true, pGo); + break; + case GO_ARTHAS_DOOR: + uiArthasDoor = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + + if (uiEncounter[1] == DONE) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + } } - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + void SetData(uint32 type, uint32 data) { - 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; + if (type == DATA_WAVE_COUNT && data == SPECIAL) + { + bIntroDone = true; + events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + return; + } + + + if (uiWaveCount && data == NOT_STARTED) + DoWipe(); + + switch(type) + { + case DATA_FALRIC_EVENT: + uiEncounter[0] = data; + if (data == DONE) + events.ScheduleEvent(EVENT_NEXT_WAVE, 60000); + break; + case DATA_MARWYN_EVENT: + uiEncounter[1] = data; + if (data == DONE) + HandleGameObject(uiArthasDoor, true); + break; + case DATA_LICHKING_EVENT: + uiEncounter[2] = data; + break; + } + + if (data == DONE) + SaveToDB(); } - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) + uint32 GetData(uint32 type) { - case DATA_FALRIC: return uiFalric; - case DATA_MARWYN: return uiMarwyn; - case DATA_LICHKING: return uiLichKingEvent; - case DATA_FROSTMOURNE: return uiFrostmourne; + switch(type) + { + 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; + } + + return 0; } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_FALRIC: return uiFalric; + case DATA_MARWYN: return uiMarwyn; + case DATA_LICHKING: return uiLichKingEvent; + case DATA_FROSTMOURNE: return uiFrostmourne; + } + + return 0; + } - std::ostringstream saveStream; - saveStream << "H R 1 " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + std::ostringstream saveStream; + saveStream << "H R 1 " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - OUT_LOAD_INST_DATA(in); + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - char dataHead1, dataHead2; - uint16 version; - uint16 data0, data1, data2; + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> version >> data0 >> data1 >> data2; + char dataHead1, dataHead2; + uint16 version; + uint16 data0, data1, data2; - if (dataHead1 == 'H' && dataHead2 == 'R') - { - uiEncounter[0] = data0; - uiEncounter[1] = data1; - uiEncounter[2] = data2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> version >> data0 >> data1 >> data2; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (uiEncounter[i] == IN_PROGRESS) - uiEncounter[i] = NOT_STARTED; + if (dataHead1 == 'H' && dataHead2 == 'R') + { + uiEncounter[0] = data0; + uiEncounter[1] = data1; + uiEncounter[2] = data2; - } else OUT_LOAD_INST_DATA_FAIL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (uiEncounter[i] == IN_PROGRESS) + uiEncounter[i] = NOT_STARTED; - if (uiEncounter[0] == DONE || uiEncounter[1] == DONE) - bIntroDone = true; + } else OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } + if (uiEncounter[0] == DONE || uiEncounter[1] == DONE) + bIntroDone = true; - void AddWave() - { - DoUpdateWorldState(WORLD_STATE_HOR, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); + OUT_LOAD_INST_DATA_COMPLETE; + } - switch(uiWaveCount) + void AddWave() { - 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; + 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; + } } - } - // 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->SetVisibility(VISIBILITY_OFF); - if (Creature* pMarwyn = instance->GetCreature(uiMarwyn)) - pMarwyn->SetVisibility(VISIBILITY_OFF); - } - - // spawn a wave on behalf of the summoner. - void SpawnWave(Creature *pSummoner) - { - uint32 index; - - pSummoner->SetVisibility(VISIBILITY_ON); + // 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->SetVisibility(VISIBILITY_OFF); + if (Creature* pMarwyn = instance->GetCreature(uiMarwyn)) + pMarwyn->SetVisibility(VISIBILITY_OFF); + } - // 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); - pSummoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + // spawn a wave on behalf of the summoner. + void SpawnWave(Creature *pSummoner) + { + uint32 index; - index = urand(0,ENCOUNTER_WAVE_FOOTMAN-1); - pSummoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + pSummoner->SetVisibility(VISIBILITY_ON); - index = urand(0,ENCOUNTER_WAVE_RIFLEMAN-1); - pSummoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + // 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); + pSummoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - index = urand(0,ENCOUNTER_WAVE_PRIEST-1); - pSummoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + index = urand(0,ENCOUNTER_WAVE_FOOTMAN-1); + pSummoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - index = urand(0,ENCOUNTER_WAVE_MAGE-1); - pSummoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - } + index = urand(0,ENCOUNTER_WAVE_RIFLEMAN-1); + pSummoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - void Update(uint32 diff) - { - if (!instance->HavePlayers()) - return; + index = urand(0,ENCOUNTER_WAVE_PRIEST-1); + pSummoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - events.Update(diff); + index = urand(0,ENCOUNTER_WAVE_MAGE-1); + pSummoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + } - switch(uint32 eventId = events.ExecuteEvent()) + void Update(uint32 diff) { - case EVENT_NEXT_WAVE: - uiWaveCount++; - AddWave(); - break; - case EVENT_START_LICH_KING: - // TODO - break; + if (!instance->HavePlayers()) + return; + + events.Update(diff); + + switch(uint32 eventId = events.ExecuteEvent()) + { + case EVENT_NEXT_WAVE: + uiWaveCount++; + AddWave(); + break; + case EVENT_START_LICH_KING: + // TODO + break; + } } - } + }; + }; -InstanceData* GetInstanceData_instance_halls_of_reflection(Map* pMap) -{ - return new instance_halls_of_reflection(pMap); -} void AddSC_instance_halls_of_reflection() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_halls_of_reflection"; - newscript->GetInstanceData = &GetInstanceData_instance_halls_of_reflection; - newscript->RegisterSelf(); + new instance_halls_of_reflection(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index e854c767f63..3f9c5158038 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -61,150 +61,153 @@ enum eEnums EQUIP_ID_MACE = 49344, ACHIEV_DOESNT_GO_TO_ELEVEN = 4524, }; - -struct boss_garfrostAI : public ScriptedAI +
class boss_garfrost : public CreatureScript { - boss_garfrostAI(Creature *c) : ScriptedAI(c) +public: + boss_garfrost() : CreatureScript("boss_garfrost") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_garfrostAI (pCreature); } - bool phase2; - bool phase3; - bool bAchievement; - - ScriptedInstance* pInstance; - EventMap events; - - void Reset() + struct boss_garfrostAI : public ScriptedAI { - events.Reset(); + boss_garfrostAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - phase2 = false; - phase3 = false; - bAchievement = true; + bool phase2; + bool phase3; + bool bAchievement; - if (pInstance) - pInstance->SetData(DATA_GARFROST_EVENT, NOT_STARTED); - } + InstanceScript* pInstance; + EventMap events; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_PERMAFROST); + void Reset() + { + events.Reset(); - if (pInstance) - pInstance->SetData(DATA_GARFROST_EVENT, IN_PROGRESS); + phase2 = false; + phase3 = false; + bAchievement = true; - events.ScheduleEvent(EVENT_THROW_SARONITE, 45000); - } + if (pInstance) + pInstance->SetData(DATA_GARFROST_EVENT, NOT_STARTED); + } - void DamageTaken(Unit* /*pDoneBy*/, uint32& /*uiDamage*/) - { - if (HealthBelowPct(66) && !phase2) + void EnterCombat(Unit* /*who*/) { - phase2 = true; - DoCast(me, SPELL_THUNDERING_STOMP); - // TODO: should go to a forge - DoCast(me, SPELL_FORGE_BLADE); - // TODO: should equip when spell completes - SetEquipmentSlots(false, EQUIP_ID_SWORD, -1, -1); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - events.ScheduleEvent(EVENT_CHILLINGWAVE, 10000); + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_PERMAFROST); + + if (pInstance) + pInstance->SetData(DATA_GARFROST_EVENT, IN_PROGRESS); + + events.ScheduleEvent(EVENT_THROW_SARONITE, 45000); } - if (HealthBelowPct(33) && !phase3) + void DamageTaken(Unit* /*pDoneBy*/, uint32& /*uiDamage*/) { - phase3 = true; - DoCast(me, SPELL_THUNDERING_STOMP); - // TODO: should go to a forge - DoCast(me, SPELL_FORGE_MACE); - // TODO: should equip when spell completes - SetEquipmentSlots(false, EQUIP_ID_MACE, -1, -1); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - events.CancelEvent(EVENT_CHILLINGWAVE); // cast only in phase 2. - events.ScheduleEvent(EVENT_DEEPFREEZE, 10000); + if (HealthBelowPct(66) && !phase2) + { + phase2 = true; + DoCast(me, SPELL_THUNDERING_STOMP); + // TODO: should go to a forge + DoCast(me, SPELL_FORGE_BLADE); + // TODO: should equip when spell completes + SetEquipmentSlots(false, EQUIP_ID_SWORD, -1, -1); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + events.ScheduleEvent(EVENT_CHILLINGWAVE, 10000); + } + + if (HealthBelowPct(33) && !phase3) + { + phase3 = true; + DoCast(me, SPELL_THUNDERING_STOMP); + // TODO: should go to a forge + DoCast(me, SPELL_FORGE_MACE); + // TODO: should equip when spell completes + SetEquipmentSlots(false, EQUIP_ID_MACE, -1, -1); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + events.CancelEvent(EVENT_CHILLINGWAVE); // cast only in phase 2. + events.ScheduleEvent(EVENT_DEEPFREEZE, 10000); + } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (pInstance) + void JustDied(Unit* /*killer*/) { - if (Creature *pTyrannus = me->GetCreature(*me, pInstance->GetData64(DATA_TYRANNUS))) - DoScriptText(SAY_TYRANNUS_DEATH, pTyrannus); + DoScriptText(SAY_DEATH, me); + if (pInstance) + { + if (Creature *pTyrannus = me->GetCreature(*me, pInstance->GetData64(DATA_TYRANNUS))) + DoScriptText(SAY_TYRANNUS_DEATH, pTyrannus); - pInstance->SetData(DATA_GARFROST_EVENT, DONE); - if (IsHeroic() && bAchievement) - pInstance->DoCompleteAchievement(ACHIEV_DOESNT_GO_TO_ELEVEN); + pInstance->SetData(DATA_GARFROST_EVENT, DONE); + if (IsHeroic() && bAchievement) + pInstance->DoCompleteAchievement(ACHIEV_DOESNT_GO_TO_ELEVEN); + } } - } - void SpellHitTarget(Unit* pTarget, const SpellEntry *spell) - { - if (spell->Id == SPELL_PERMAFROST_TRIGGER && bAchievement) + void SpellHitTarget(Unit* pTarget, const SpellEntry *spell) { - if (Aura *pAura = pTarget->GetAura(SPELL_PERMAFROST_TRIGGER)) - if (pAura->GetStackAmount() > 10) - bAchievement = false; + if (spell->Id == SPELL_PERMAFROST_TRIGGER && bAchievement) + { + if (Aura *pAura = pTarget->GetAura(SPELL_PERMAFROST_TRIGGER)) + if (pAura->GetStackAmount() > 10) + bAchievement = false; + } } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_THROW_SARONITE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_THROW_SARONITE); - events.RescheduleEvent(EVENT_THROW_SARONITE, 35000); - return; - case EVENT_DEEPFREEZE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_DEEP_FREEZE); - events.RescheduleEvent(EVENT_DEEPFREEZE, 35000); - return; - case EVENT_CHILLINGWAVE: - DoCastAOE(SPELL_CHILLING_WAVE); - events.RescheduleEvent(EVENT_CHILLINGWAVE, 40000); - return; + switch(eventId) + { + case EVENT_THROW_SARONITE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_THROW_SARONITE); + events.RescheduleEvent(EVENT_THROW_SARONITE, 35000); + return; + case EVENT_DEEPFREEZE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_DEEP_FREEZE); + events.RescheduleEvent(EVENT_DEEPFREEZE, 35000); + return; + case EVENT_CHILLINGWAVE: + DoCastAOE(SPELL_CHILLING_WAVE); + events.RescheduleEvent(EVENT_CHILLINGWAVE, 40000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_garfrost(Creature* pCreature) -{ - return new boss_garfrostAI (pCreature); -} void AddSC_boss_garfrost() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_garfrost"; - newscript->GetAI = &GetAI_boss_garfrost; - newscript->RegisterSelf(); + new boss_garfrost(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 961451051a7..8a1e6b5de37 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -118,366 +118,372 @@ enum Misc // Krick is the Gnome. // Ick is the Mount // Common Events are handled/triggered by Ick that "drive" Krick through DoAction. - -struct boss_ickAI : public ScriptedAI +
class boss_ick : public CreatureScript { - boss_ickAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - EventMap events; +public: + boss_ick() : CreatureScript("boss_ick") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_KRICKANDICK_EVENT, NOT_STARTED); + return new boss_ickAI(pCreature); } - Creature* GetKrick() + struct boss_ickAI : public ScriptedAI { - return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_KRICK) : 0); - } + boss_ickAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_KRICKANDICK_EVENT, IN_PROGRESS); - - Creature* pKrick = GetKrick(); - if (!pKrick) - pKrick = me->SummonCreature(CREATURE_KRICK, *me, TEMPSUMMON_MANUAL_DESPAWN); - - if (pKrick) - DoScriptText(SAY_KRICK_AGGRO, pKrick); - - events.ScheduleEvent(EVENT_MIGHTY_KICK, 20000, GCD_1); - events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); - events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); - events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 35000); - events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); - } + InstanceScript* pInstance; - void EnterEvadeMode() - { - me->GetMotionMaster()->Clear(); - ScriptedAI::EnterEvadeMode(); - } + EventMap events; - void JustDied(Unit* /*pKiller*/) - { - if (Creature* pKrick = GetKrick()) + void Reset() { - if (pKrick->AI()) - pKrick->AI()->DoAction(ACTION_OUTRO); - } - - if (pInstance) - pInstance->SetData(DATA_KRICKANDICK_EVENT, DONE); - } + events.Reset(); - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - return; + if (pInstance) + pInstance->SetData(DATA_KRICKANDICK_EVENT, NOT_STARTED); + } - if (!me->getVictim() && me->getThreatManager().isThreatListEmpty()) + Creature* GetKrick() { - EnterEvadeMode(); - return; + return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_KRICK) : 0); } - events.Update(diff); + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_KRICKANDICK_EVENT, IN_PROGRESS); + + Creature* pKrick = GetKrick(); + if (!pKrick) + pKrick = me->SummonCreature(CREATURE_KRICK, *me, TEMPSUMMON_MANUAL_DESPAWN); + + if (pKrick) + DoScriptText(SAY_KRICK_AGGRO, pKrick); + + events.ScheduleEvent(EVENT_MIGHTY_KICK, 20000, GCD_1); + events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); + events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); + events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 35000); + events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); + events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterEvadeMode() + { + me->GetMotionMaster()->Clear(); + ScriptedAI::EnterEvadeMode(); + } - switch(events.ExecuteEvent()) + void JustDied(Unit* /*pKiller*/) { - case EVENT_PURSUE: - if (Creature* pKrick = GetKrick()) - DoScriptText(RAND(SAY_KRICK_CHASE_1,SAY_KRICK_CHASE_2,SAY_KRICK_CHASE_3), pKrick); + if (Creature* pKrick = GetKrick()) + { + if (pKrick->AI()) + pKrick->AI()->DoAction(ACTION_OUTRO); + } - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - me->Attack(pTarget,false); - DoScriptText(SAY_ICK_CHASE_1, me, pTarget); - DoCast(pTarget, SPELL_PURSUED); - } + if (pInstance) + pInstance->SetData(DATA_KRICKANDICK_EVENT, DONE); + } - DoCast(SPELL_CONFUSION); - events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat()) return; - case EVENT_MIGHTY_KICK: - DoCast(me->getVictim(), SPELL_MIGHTY_KICK); - events.ScheduleEvent(EVENT_MIGHTY_KICK, 25000, GCD_1); + if (!me->getVictim() && me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); return; + } - case EVENT_POISON_NOVA: - if (Creature* pKrick = GetKrick()) - DoScriptText(SAY_KRICK_POISON_NOVA, pKrick); - - DoScriptText(SAY_ICK_POISON_NOVA, me); - DoCastAOE(SPELL_POISON_NOVA); - events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); - return; + events.Update(diff); - case EVENT_TOXIC_WASTE: - DoCast(me->getVictim(), SPELL_TOXIC_WASTE); - events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); + if (me->hasUnitState(UNIT_STAT_CASTING)) return; - case EVENT_SHADOW_BOLT: - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); - return; + switch(events.ExecuteEvent()) + { + case EVENT_PURSUE: + if (Creature* pKrick = GetKrick()) + DoScriptText(RAND(SAY_KRICK_CHASE_1,SAY_KRICK_CHASE_2,SAY_KRICK_CHASE_3), pKrick); - case EVENT_EXPLOSIVE_BARRAGE: - if (Creature *pKrick = GetKrick()) - { - DoScriptText(SAY_KRICK_BARRAGE_1, pKrick); - DoScriptText(SAY_KRICK_BARRAGE_2, pKrick); - } + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + me->Attack(pTarget,false); + DoScriptText(SAY_ICK_CHASE_1, me, pTarget); + DoCast(pTarget, SPELL_PURSUED); + } - DoCastAOE(SPELL_EXPLOSIVE_BARRAGE); - me->GetMotionMaster()->MoveIdle(); - events.DelayEvents(20000, GCD_1); // 2 sec cast + 18 sec - events.ScheduleEvent(EVENT_END_EXPLOSIVE_BARRAGE, 20000); - return; + DoCast(SPELL_CONFUSION); + events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); + return; - case EVENT_END_EXPLOSIVE_BARRAGE: - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveChase(me->getVictim()); - events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 25000); - break; - } + case EVENT_MIGHTY_KICK: + DoCast(me->getVictim(), SPELL_MIGHTY_KICK); + events.ScheduleEvent(EVENT_MIGHTY_KICK, 25000, GCD_1); + return; - DoMeleeAttackIfReady(); - } -}; + case EVENT_POISON_NOVA: + if (Creature* pKrick = GetKrick()) + DoScriptText(SAY_KRICK_POISON_NOVA, pKrick); -struct boss_krickAI : public ScriptedAI -{ - boss_krickAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + DoScriptText(SAY_ICK_POISON_NOVA, me); + DoCastAOE(SPELL_POISON_NOVA); + events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); + return; - ScriptedInstance* pInstance; - EventMap events; + case EVENT_TOXIC_WASTE: + DoCast(me->getVictim(), SPELL_TOXIC_WASTE); + events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); + return; - KrickPhase phase; - uint64 uiNpcOutroDialog; - uint64 uiTyrannus; + case EVENT_SHADOW_BOLT: + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); + return; - void Reset() - { - uiNpcOutroDialog = 0; - uiTyrannus = 0; - phase = PHASE_COMBAT; + case EVENT_EXPLOSIVE_BARRAGE: + if (Creature *pKrick = GetKrick()) + { + DoScriptText(SAY_KRICK_BARRAGE_1, pKrick); + DoScriptText(SAY_KRICK_BARRAGE_2, pKrick); + } - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_OFF); - } + DoCastAOE(SPELL_EXPLOSIVE_BARRAGE); + me->GetMotionMaster()->MoveIdle(); + events.DelayEvents(20000, GCD_1); // 2 sec cast + 18 sec + events.ScheduleEvent(EVENT_END_EXPLOSIVE_BARRAGE, 20000); + return; - Creature* GetIck() - { - return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ICK) : 0); - } + case EVENT_END_EXPLOSIVE_BARRAGE: + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 25000); + break; + } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + DoMeleeAttackIfReady(); + } + }; - DoScriptText(RAND(SAY_KRICK_SLAY_1,SAY_KRICK_SLAY_2), me); - } +}; +
class boss_krick : public CreatureScript +{ +public: + boss_krick() : CreatureScript("boss_krick") { } - void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + CreatureAI* GetAI(Creature* pCreature) const { - // if killed whatever the reason, it breaks the outro - uiDamage = 0; + return new boss_krickAI(pCreature); } - void DoAction(const int32 actionId) + struct boss_krickAI : public ScriptedAI { - switch(actionId) + boss_krickAI(Creature *c) : ScriptedAI(c) { - case ACTION_OUTRO: - { - Position pos; - if (Creature* pIck = GetIck()) - { - // TODO: tele on Ick then run some distance. - pIck->GetNearPosition(pos, 5.0f, 3.14); - me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 0.0f); - } - me->SetVisibility(VISIBILITY_ON); + pInstance = c->GetInstanceScript(); + } - Creature* pJainaOrSylvanas = me->GetCreature(*me, pInstance->GetData64(DATA_JAINA_SYLVANAS_1)); - if (pJainaOrSylvanas) { - Position pos; - me->GetNearPosition(pos, 5.0f, 0); - pJainaOrSylvanas->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), - pos.GetAngle(me->GetPositionX(), me->GetPositionY())); - } - else { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - pJainaOrSylvanas = me->SummonCreature(NPC_SYLVANAS_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); - else - pJainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); - } + InstanceScript* pInstance; + EventMap events; - if (pJainaOrSylvanas) - { - pJainaOrSylvanas->SetOrientation(pJainaOrSylvanas->GetAngle(me->GetPositionX(), me->GetPositionY())); - me->SetOrientation(me->GetAngle(pJainaOrSylvanas->GetPositionX(), pJainaOrSylvanas->GetPositionY())); - uiNpcOutroDialog = pJainaOrSylvanas->GetGUID(); - } + KrickPhase phase; + uint64 uiNpcOutroDialog; + uint64 uiTyrannus; - phase = PHASE_OUTRO; - events.Reset(); - events.ScheduleEvent(EVENT_OUTRO_1, 1000); - break; - } + void Reset() + { + uiNpcOutroDialog = 0; + uiTyrannus = 0; + phase = PHASE_COMBAT; + + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_OFF); } - } - void UpdateAI(const uint32 diff) - { - if (phase == PHASE_OUTRO) + Creature* GetIck() { - if (!pInstance) + return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ICK) : 0); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) return; - events.Update(diff); - switch(events.ExecuteEvent()) + DoScriptText(RAND(SAY_KRICK_SLAY_1,SAY_KRICK_SLAY_2), me); + } + + void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + { + // if killed whatever the reason, it breaks the outro + uiDamage = 0; + } + + void DoAction(const int32 actionId) + { + switch(actionId) { - case EVENT_OUTRO_1: - { - DoScriptText(SAY_KRICK_OUTRO_1, me); - events.ScheduleEvent(EVENT_OUTRO_2, 14000); - break; - } - case EVENT_OUTRO_2: + case ACTION_OUTRO: { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) + Position pos; + if (Creature* pIck = GetIck()) { + // TODO: tele on Ick then run some distance. + pIck->GetNearPosition(pos, 5.0f, 3.14); + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 0.0f); + } + me->SetVisibility(VISIBILITY_ON); + + Creature* pJainaOrSylvanas = me->GetCreature(*me, pInstance->GetData64(DATA_JAINA_SYLVANAS_1)); + if (pJainaOrSylvanas) { + Position pos; + me->GetNearPosition(pos, 5.0f, 0); + pJainaOrSylvanas->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), + pos.GetAngle(me->GetPositionX(), me->GetPositionY())); + } + else { if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - DoScriptText(SAY_JAYNA_OUTRO_2, pNpcDialog); + pJainaOrSylvanas = me->SummonCreature(NPC_SYLVANAS_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); else - DoScriptText(SAY_SYLVANAS_OUTRO_2, pNpcDialog); + pJainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); } - events.ScheduleEvent(EVENT_OUTRO_3, 8500); - break; - } - case EVENT_OUTRO_3: - DoScriptText(SAY_KRICK_OUTRO_3, me); - events.ScheduleEvent(EVENT_OUTRO_4, 12000); - break; - case EVENT_OUTRO_4: - { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) + + if (pJainaOrSylvanas) { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - DoScriptText(SAY_JAYNA_OUTRO_4, pNpcDialog); - else - DoScriptText(SAY_SYLVANAS_OUTRO_4, pNpcDialog); + pJainaOrSylvanas->SetOrientation(pJainaOrSylvanas->GetAngle(me->GetPositionX(), me->GetPositionY())); + me->SetOrientation(me->GetAngle(pJainaOrSylvanas->GetPositionX(), pJainaOrSylvanas->GetPositionY())); + uiNpcOutroDialog = pJainaOrSylvanas->GetGUID(); } - events.ScheduleEvent(EVENT_OUTRO_5, 8000); + + phase = PHASE_OUTRO; + events.Reset(); + events.ScheduleEvent(EVENT_OUTRO_1, 1000); break; } - case EVENT_OUTRO_5: - DoScriptText(SAY_KRICK_OUTRO_5, me); - events.ScheduleEvent(EVENT_OUTRO_6, 4000); - break; - case EVENT_OUTRO_6: - // TODO spawn Tyrannus at some distance and MovePoint near-by (flying on rimefang) - // store uiTyrannus - // Adjust timer so tyrannus has time to come - uiTyrannus = (pInstance ? pInstance->GetData64(DATA_TYRANNUS) : 0); - events.ScheduleEvent(EVENT_OUTRO_7, 1); - break; - case EVENT_OUTRO_7: - if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) - DoScriptText(SAY_TYRANNUS_OUTRO_7, pTyrannus); - events.ScheduleEvent(EVENT_OUTRO_8, 7000); - break; - case EVENT_OUTRO_8: - DoScriptText(SAY_KRICK_OUTRO_8, me); - // TODO: Tyrannus starts killing Krick. - // there shall be some visual spell effect - events.ScheduleEvent(EVENT_OUTRO_9, 6000); - break; - case EVENT_OUTRO_9: - // tyrannus kills krick - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetHealth(0); + } + } - if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) - DoScriptText(SAY_TYRANNUS_OUTRO_9, pTyrannus); + void UpdateAI(const uint32 diff) + { + if (phase == PHASE_OUTRO) + { + if (!pInstance) + return; - events.ScheduleEvent(EVENT_OUTRO_10, 12000); - break; - case EVENT_OUTRO_10: + events.Update(diff); + switch(events.ExecuteEvent()) { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) + case EVENT_OUTRO_1: { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - DoScriptText(SAY_JAYNA_OUTRO_10, pNpcDialog); - else - DoScriptText(SAY_SYLVANAS_OUTRO_10, pNpcDialog); + DoScriptText(SAY_KRICK_OUTRO_1, me); + events.ScheduleEvent(EVENT_OUTRO_2, 14000); + break; } + case EVENT_OUTRO_2: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + DoScriptText(SAY_JAYNA_OUTRO_2, pNpcDialog); + else + DoScriptText(SAY_SYLVANAS_OUTRO_2, pNpcDialog); + } + events.ScheduleEvent(EVENT_OUTRO_3, 8500); + break; + } + case EVENT_OUTRO_3: + DoScriptText(SAY_KRICK_OUTRO_3, me); + events.ScheduleEvent(EVENT_OUTRO_4, 12000); + break; + case EVENT_OUTRO_4: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + DoScriptText(SAY_JAYNA_OUTRO_4, pNpcDialog); + else + DoScriptText(SAY_SYLVANAS_OUTRO_4, pNpcDialog); + } + events.ScheduleEvent(EVENT_OUTRO_5, 8000); + break; + } + case EVENT_OUTRO_5: + DoScriptText(SAY_KRICK_OUTRO_5, me); + events.ScheduleEvent(EVENT_OUTRO_6, 4000); + break; + case EVENT_OUTRO_6: + // TODO spawn Tyrannus at some distance and MovePoint near-by (flying on rimefang) + // store uiTyrannus + // Adjust timer so tyrannus has time to come + uiTyrannus = (pInstance ? pInstance->GetData64(DATA_TYRANNUS) : 0); + events.ScheduleEvent(EVENT_OUTRO_7, 1); + break; + case EVENT_OUTRO_7: + if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) + DoScriptText(SAY_TYRANNUS_OUTRO_7, pTyrannus); + events.ScheduleEvent(EVENT_OUTRO_8, 7000); + break; + case EVENT_OUTRO_8: + DoScriptText(SAY_KRICK_OUTRO_8, me); + // TODO: Tyrannus starts killing Krick. + // there shall be some visual spell effect + events.ScheduleEvent(EVENT_OUTRO_9, 6000); + break; + case EVENT_OUTRO_9: + // tyrannus kills krick + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetHealth(0); + + if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) + DoScriptText(SAY_TYRANNUS_OUTRO_9, pTyrannus); + + events.ScheduleEvent(EVENT_OUTRO_10, 12000); + break; + case EVENT_OUTRO_10: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + DoScriptText(SAY_JAYNA_OUTRO_10, pNpcDialog); + else + DoScriptText(SAY_SYLVANAS_OUTRO_10, pNpcDialog); + } + + // End of OUTRO. for now... + events.ScheduleEvent(EVENT_OUTRO_END, 8000); + break; + } + case EVENT_OUTRO_END: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + pNpcDialog->DisappearAndDie(); - // End of OUTRO. for now... - events.ScheduleEvent(EVENT_OUTRO_END, 8000); - break; - } - case EVENT_OUTRO_END: - { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) - pNpcDialog->DisappearAndDie(); - - me->DisappearAndDie(); - break; + me->DisappearAndDie(); + break; + } } + return; } - return; } - } + }; + }; -CreatureAI* GetAI_boss_ick(Creature* pCreature) -{ - return new boss_ickAI(pCreature); -} -CreatureAI* GetAI_boss_krick(Creature* pCreature) -{ - return new boss_krickAI(pCreature); -} void AddSC_boss_ick() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ick"; - newscript->GetAI = &GetAI_boss_ick; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_krick"; - newscript->GetAI = &GetAI_boss_krick; - newscript->RegisterSelf(); + new boss_ick(); + new boss_krick(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 6f45c3ef76f..f08535ccc59 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -84,191 +84,197 @@ enum Misc { SEAT_TYRANNUS = 0 }; - -struct boss_tyrannusAI : public ScriptedAI +
class boss_tyrannus : public CreatureScript { - boss_tyrannusAI(Creature *c) : ScriptedAI(c) +public: + boss_tyrannus() : CreatureScript("boss_tyrannus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_tyrannusAI(pCreature); } - ScriptedInstance* pInstance; - EventMap events; - - void Reset() + struct boss_tyrannusAI : public ScriptedAI { - events.Reset(); + boss_tyrannusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_TYRANNUS_EVENT, NOT_STARTED); - } + InstanceScript* pInstance; + EventMap events; - Creature* GetRimefang() - { - return me->GetCreature(*me, pInstance->GetData64(DATA_RIMEFANG)); - } + void Reset() + { + events.Reset(); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - me->ExitVehicle(); + if (pInstance) + pInstance->SetData(DATA_TYRANNUS_EVENT, NOT_STARTED); + } - // restore health if any damage done during intro - me->SetHealth(me->GetMaxHealth()); + Creature* GetRimefang() + { + return me->GetCreature(*me, pInstance->GetData64(DATA_RIMEFANG)); + } - if (pInstance) - pInstance->SetData(DATA_TYRANNUS_EVENT, IN_PROGRESS); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + me->ExitVehicle(); - events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); - events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 35000); - events.ScheduleEvent(EVENT_DARK_MIGHT, 40000); - } + // restore health if any damage done during intro + me->SetHealth(me->GetMaxHealth()); - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + if (pInstance) + pInstance->SetData(DATA_TYRANNUS_EVENT, IN_PROGRESS); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); + events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 35000); + events.ScheduleEvent(EVENT_DARK_MIGHT, 40000); + } - if (pInstance) + void KilledUnit(Unit * /*victim*/) { - pInstance->SetData(DATA_TYRANNUS_EVENT, DONE); - if (Creature* pRimefang = GetRimefang()) - pRimefang->ForcedDespawn(); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (pInstance) + { + pInstance->SetData(DATA_TYRANNUS_EVENT, DONE); + if (Creature* pRimefang = GetRimefang()) + pRimefang->ForcedDespawn(); + } + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FORCEFUL_SMASH: - DoCast(me->getVictim(), SPELL_FORCEFUL_SMASH); - events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); - return; - case EVENT_OVERLORDS_BRAND: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_OVERLORDS_BRAND); - events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 45000); - return; - case EVENT_DARK_MIGHT: - DoScriptText(SAY_DARK_MIGHT_1, me); - DoScriptText(SAY_DARK_MIGHT_2, me); - DoCast(me, SPELL_DARK_MIGHT); - events.ScheduleEvent(EVENT_DARK_MIGHT, 60000); - return; + switch(eventId) + { + case EVENT_FORCEFUL_SMASH: + DoCast(me->getVictim(), SPELL_FORCEFUL_SMASH); + events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); + return; + case EVENT_OVERLORDS_BRAND: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_OVERLORDS_BRAND); + events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 45000); + return; + case EVENT_DARK_MIGHT: + DoScriptText(SAY_DARK_MIGHT_1, me); + DoScriptText(SAY_DARK_MIGHT_2, me); + DoCast(me, SPELL_DARK_MIGHT); + events.ScheduleEvent(EVENT_DARK_MIGHT, 60000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct boss_rimefangAI : public ScriptedAI +
class boss_rimefang : public CreatureScript { - boss_rimefangAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - EventMap events; +public: + boss_rimefang() : CreatureScript("boss_rimefang") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - events.Reset(); + return new boss_rimefangAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_rimefangAI : public ScriptedAI { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 25000); - events.ScheduleEvent(EVENT_ICY_BLAST, 35000); - } + boss_rimefangAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; + EventMap events; - events.Update(diff); + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 25000); + events.ScheduleEvent(EVENT_ICY_BLAST, 35000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_MARK_OF_RIMEFANG: - DoScriptText(SAY_MARK_RIMEFANG_1, me); - DoScriptText(SAY_MARK_RIMEFANG_2, me); - - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_MARK_OF_RIMEFANG); - events.ScheduleEvent(EVENT_HOARFROST, 5000); - return; - case EVENT_HOARFROST: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_HOARFROST); - events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 20000); - return; - case EVENT_ICY_BLAST: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ICY_BLAST); - events.ScheduleEvent(EVENT_ICY_BLAST_2, 5000); - return; - case EVENT_ICY_BLAST_2: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget->getVictim(), SPELL_ICY_BLAST_2); - events.ScheduleEvent(EVENT_ICY_BLAST, 30000); - return; + switch(eventId) + { + case EVENT_MARK_OF_RIMEFANG: + DoScriptText(SAY_MARK_RIMEFANG_1, me); + DoScriptText(SAY_MARK_RIMEFANG_2, me); + + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_MARK_OF_RIMEFANG); + events.ScheduleEvent(EVENT_HOARFROST, 5000); + return; + case EVENT_HOARFROST: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_HOARFROST); + events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 20000); + return; + case EVENT_ICY_BLAST: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ICY_BLAST); + events.ScheduleEvent(EVENT_ICY_BLAST_2, 5000); + return; + case EVENT_ICY_BLAST_2: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget->getVictim(), SPELL_ICY_BLAST_2); + events.ScheduleEvent(EVENT_ICY_BLAST, 30000); + return; + } } } - } + }; + }; -CreatureAI* GetAI_boss_tyrannus(Creature* pCreature) -{ - return new boss_tyrannusAI(pCreature); -} -CreatureAI* GetAI_boss_rimefang(Creature* pCreature) -{ - return new boss_rimefangAI(pCreature); -} void AddSC_boss_tyrannus() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_tyrannus"; - newscript->GetAI = &GetAI_boss_tyrannus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="boss_rimefang"; - newscript->GetAI = &GetAI_boss_rimefang; - newscript->RegisterSelf(); + new boss_tyrannus(); + new boss_rimefang(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 595b5d01228..97c23020056 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -25,213 +25,216 @@ 1- Krick and Ick 2- Scourgelord Tyrannus */ - -struct instance_pit_of_saron : public ScriptedInstance +
class instance_pit_of_saron : public InstanceMapScript { - instance_pit_of_saron(Map* pMap) : ScriptedInstance(pMap) {}; - - uint64 uiKrick; - uint64 uiIck; - uint64 uiGarfrost; - uint64 uiTyrannus; - uint64 uiRimefang; +public: + instance_pit_of_saron() : InstanceMapScript("instance_pit_of_saron") { } - uint64 uiJainaOrSylvanas1; - uint64 uiJainaOrSylvanas2; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_pit_of_saron_InstanceMapScript(pMap); + } - uint32 uiTeamInInstance; - uint32 uiEncounter[MAX_ENCOUNTER]; + struct instance_pit_of_saron_InstanceMapScript : public InstanceScript + { + instance_pit_of_saron_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}; - void Initialize() - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - uiEncounter[i] = NOT_STARTED; + uint64 uiKrick; + uint64 uiIck; + uint64 uiGarfrost; + uint64 uiTyrannus; + uint64 uiRimefang; - uiGarfrost = 0; - uiKrick = 0; - uiIck = 0; - uiTyrannus = 0; - } + uint64 uiJainaOrSylvanas1; + uint64 uiJainaOrSylvanas2; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (uiEncounter[i] == IN_PROGRESS) - return true; + uint32 uiTeamInInstance; + uint32 uiEncounter[MAX_ENCOUNTER]; - return false; - } + void Initialize() + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + uiEncounter[i] = NOT_STARTED; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - Map::PlayerList const &players = instance->GetPlayers(); + uiGarfrost = 0; + uiKrick = 0; + uiIck = 0; + uiTyrannus = 0; + } - if (!players.isEmpty()) + bool IsEncounterInProgress() const { - if (Player* pPlayer = players.begin()->getSource()) - uiTeamInInstance = pPlayer->GetTeam(); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (uiEncounter[i] == IN_PROGRESS) + return true; + + return false; } - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case CREATURE_KRICK: - uiKrick = pCreature->GetGUID(); - break; - - case CREATURE_ICK: - uiIck = pCreature->GetGUID(); - break; - - case CREATURE_GARFROST: - uiGarfrost = pCreature->GetGUID(); - break; - - case CREATURE_TYRANNUS: - uiTyrannus = pCreature->GetGUID(); - break; - - case CREATURE_RIMEFANG: - uiRimefang = pCreature->GetGUID(); - break; - - case NPC_SYLVANAS_PART1: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_JAINA_PART1, ALLIANCE); - uiJainaOrSylvanas1 = pCreature->GetGUID(); - break; - case NPC_SYLVANAS_PART2: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_JAINA_PART2, ALLIANCE); - uiJainaOrSylvanas2 = pCreature->GetGUID(); - break; - case NPC_KILARA: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_ELANDRA, ALLIANCE); - break; - case NPC_KORALEN: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_KORLAEN, ALLIANCE); - break; - case NPC_CHAMPION_1_HORDE: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_CHAMPION_1_ALLIANCE, ALLIANCE); - break; - case NPC_CHAMPION_2_HORDE: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); - break; - case NPC_CHAMPION_3_HORDE: // No 3rd set for Alliance? - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); - break; + Map::PlayerList const &players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + if (Player* pPlayer = players.begin()->getSource()) + uiTeamInInstance = pPlayer->GetTeam(); + } + + switch(pCreature->GetEntry()) + { + case CREATURE_KRICK: + uiKrick = pCreature->GetGUID(); + break; + + case CREATURE_ICK: + uiIck = pCreature->GetGUID(); + break; + + case CREATURE_GARFROST: + uiGarfrost = pCreature->GetGUID(); + break; + + case CREATURE_TYRANNUS: + uiTyrannus = pCreature->GetGUID(); + break; + + case CREATURE_RIMEFANG: + uiRimefang = pCreature->GetGUID(); + break; + + case NPC_SYLVANAS_PART1: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_JAINA_PART1, ALLIANCE); + uiJainaOrSylvanas1 = pCreature->GetGUID(); + break; + case NPC_SYLVANAS_PART2: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_JAINA_PART2, ALLIANCE); + uiJainaOrSylvanas2 = pCreature->GetGUID(); + break; + case NPC_KILARA: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_ELANDRA, ALLIANCE); + break; + case NPC_KORALEN: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_KORLAEN, ALLIANCE); + break; + case NPC_CHAMPION_1_HORDE: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_CHAMPION_1_ALLIANCE, ALLIANCE); + break; + case NPC_CHAMPION_2_HORDE: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); + break; + case NPC_CHAMPION_3_HORDE: // No 3rd set for Alliance? + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); + break; + } } - } - uint64 GetData64(uint32 identifier) - { - switch(identifier) + uint64 GetData64(uint32 identifier) { - case DATA_GARFROST: return uiGarfrost; - case DATA_KRICK: return uiKrick; - case DATA_ICK: return uiIck; - case DATA_TYRANNUS: return uiTyrannus; - case DATA_RIMEFANG: return uiRimefang; - - case DATA_JAINA_SYLVANAS_1: return uiJainaOrSylvanas1; - case DATA_JAINA_SYLVANAS_2: return uiJainaOrSylvanas2; + switch(identifier) + { + case DATA_GARFROST: return uiGarfrost; + case DATA_KRICK: return uiKrick; + case DATA_ICK: return uiIck; + case DATA_TYRANNUS: return uiTyrannus; + case DATA_RIMEFANG: return uiRimefang; + + case DATA_JAINA_SYLVANAS_1: return uiJainaOrSylvanas1; + case DATA_JAINA_SYLVANAS_2: return uiJainaOrSylvanas2; + } + + return 0; } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case DATA_GARFROST_EVENT: - uiEncounter[0] = data; - break; - case DATA_TYRANNUS_EVENT: - uiEncounter[1] = data; - break; - case DATA_KRICKANDICK_EVENT: - uiEncounter[2] = data; - break; + switch(type) + { + case DATA_GARFROST_EVENT: + uiEncounter[0] = data; + break; + case DATA_TYRANNUS_EVENT: + uiEncounter[1] = data; + break; + case DATA_KRICKANDICK_EVENT: + uiEncounter[2] = data; + break; + } + + if (data == DONE) + SaveToDB(); } - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_GARFROST_EVENT: return uiEncounter[0]; - case DATA_TYRANNUS_EVENT: return uiEncounter[1]; - case DATA_KRICKANDICK_EVENT: return uiEncounter[2]; + switch(type) + { + case DATA_GARFROST_EVENT: return uiEncounter[0]; + case DATA_TYRANNUS_EVENT: return uiEncounter[1]; + case DATA_KRICKANDICK_EVENT: return uiEncounter[2]; + } + + return 0; } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::string str_data; + std::string str_data; - std::ostringstream saveStream; - saveStream << "P S " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; + std::ostringstream saveStream; + saveStream << "P S " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2; + char dataHead1, dataHead2; + uint16 data0, data1, data2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2; - if (dataHead1 == 'P' && dataHead2 == 'S') - { - uiEncounter[0] = data0; - uiEncounter[1] = data1; - uiEncounter[2] = data2; + if (dataHead1 == 'P' && dataHead2 == 'S') + { + 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; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (uiEncounter[i] == IN_PROGRESS) + uiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_pit_of_saron(Map* pMap) -{ - return new instance_pit_of_saron(pMap); -} void AddSC_instance_pit_of_saron() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_pit_of_saron"; - newscript->GetInstanceData = &GetInstanceData_instance_pit_of_saron; - newscript->RegisterSelf(); + new instance_pit_of_saron(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index b9b8504fcf0..28885a34abc 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -149,954 +149,987 @@ enum eEvents }; /****************************************AI****************************************/ -struct mob_ymirjar_wrathbringerAI : public ScriptedAI +
class mob_ymirjar_wrathbringer : public CreatureScript { - mob_ymirjar_wrathbringerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } +public: + mob_ymirjar_wrathbringer() : CreatureScript("mob_ymirjar_wrathbringer") { } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - events.ScheduleEvent(EVENT_BLIGHT, 7000); + return new mob_ymirjar_wrathbringerAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_ymirjar_wrathbringerAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + mob_ymirjar_wrathbringerAI(Creature *c) : ScriptedAI(c) { - switch(eventId) - { - case EVENT_BLIGHT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_BLIGHT); - events.RescheduleEvent(EVENT_BLIGHT, 8000); - return; - } } - DoMeleeAttackIfReady(); - } -}; - -struct mob_ymirjar_skyCallerAI: public ScriptedAI -{ - mob_ymirjar_skyCallerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; + EventMap events; - void Reset() - { - events.Reset(); - } + void Reset() + { + events.Reset(); + } - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FROSTBLADE, 1); - events.ScheduleEvent(EVENT_GLACIAL_STRIKE, 8000); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BLIGHT, 7000); + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_GLACIAL_STRIKE: - DoCast(me->getVictim(), SPELL_GLACIAL_STRIKE); - events.RescheduleEvent(EVENT_GLACIAL_STRIKE, 8000); - return; - case EVENT_FROSTBLADE: - DoCast(me, SPELL_FROSTBLADE); - events.CancelEvent(EVENT_FROSTBLADE); - return; + switch(eventId) + { + case EVENT_BLIGHT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_BLIGHT); + events.RescheduleEvent(EVENT_BLIGHT, 8000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_ymirjar_flamebearerAI: public ScriptedAI +
class mob_ymirjar_skycaller : public CreatureScript { - mob_ymirjar_flamebearerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_ymirjar_skycaller() : CreatureScript("mob_ymirjar_skycaller") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_ymirjar_skyCallerAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_ymirjar_skyCallerAI: public ScriptedAI { - events.ScheduleEvent(EVENT_FIREBALL, 4000); - events.ScheduleEvent(EVENT_HELLFIRE, 8000); - events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15000); - } + mob_ymirjar_skyCallerAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FROSTBLADE, 1); + events.ScheduleEvent(EVENT_GLACIAL_STRIKE, 8000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FIREBALL: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FIREBALL); - events.RescheduleEvent(EVENT_FIREBALL, 5000); - return; - case EVENT_HELLFIRE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_HELLFIRE); - events.RescheduleEvent(EVENT_HELLFIRE, 10000); - return; - case EVENT_TACTICAL_BLINK: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_TACTICAL_BLINK); - events.RescheduleEvent(EVENT_TACTICAL_BLINK, 12000); - return; + switch(eventId) + { + case EVENT_GLACIAL_STRIKE: + DoCast(me->getVictim(), SPELL_GLACIAL_STRIKE); + events.RescheduleEvent(EVENT_GLACIAL_STRIKE, 8000); + return; + case EVENT_FROSTBLADE: + DoCast(me, SPELL_FROSTBLADE); + events.CancelEvent(EVENT_FROSTBLADE); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_ymirjar_deathbringerAI: public ScriptedAI +
class mob_ymirjar_flamebearer : public CreatureScript { - mob_ymirjar_deathbringerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_ymirjar_flamebearer() : CreatureScript("mob_ymirjar_flamebearer") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_ymirjar_flamebearerAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_ymirjar_flamebearerAI: public ScriptedAI { - events.ScheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); - } + mob_ymirjar_flamebearerAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FIREBALL, 4000); + events.ScheduleEvent(EVENT_HELLFIRE, 8000); + events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_EMPOWERED_SHADOW_BOLT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_EMPOWERED_SHADOW_BOLT); - events.RescheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); - return; + switch(eventId) + { + case EVENT_FIREBALL: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FIREBALL); + events.RescheduleEvent(EVENT_FIREBALL, 5000); + return; + case EVENT_HELLFIRE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_HELLFIRE); + events.RescheduleEvent(EVENT_HELLFIRE, 10000); + return; + case EVENT_TACTICAL_BLINK: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_TACTICAL_BLINK); + events.RescheduleEvent(EVENT_TACTICAL_BLINK, 12000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_wrathbone_laborerAI: public ScriptedAI +
class mob_ymirjar_deathbringer : public CreatureScript { - mob_wrathbone_laborerAI(Creature *c) : ScriptedAI(c) - { - } +public: + mob_ymirjar_deathbringer() : CreatureScript("mob_ymirjar_deathbringer") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_ymirjar_deathbringerAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_ymirjar_deathbringerAI: public ScriptedAI { - events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); - events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - events.ScheduleEvent(EVENT_SHOVELLED, 5000); - } + mob_ymirjar_deathbringerAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_BLINDING_DIRT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_BLINDING_DIRT); - events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); - return; - case EVENT_PUNCTURE_WOUND: - DoCast(me->getVictim(), SPELL_PUNCTURE_WOUND); - events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - return; - case EVENT_SHOVELLED: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHOVELLED); - events.RescheduleEvent(EVENT_SHOVELLED, 7000); - return; + switch(eventId) + { + case EVENT_EMPOWERED_SHADOW_BOLT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_EMPOWERED_SHADOW_BOLT); + events.RescheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_wrathbone_coldwraithAI: public ScriptedAI +
class mob_wrathbone_laborer : public CreatureScript { - mob_wrathbone_coldwraithAI(Creature *c) : ScriptedAI(c) - { - } +public: + mob_wrathbone_laborer() : CreatureScript("mob_wrathbone_laborer") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_wrathbone_laborerAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_wrathbone_laborerAI: public ScriptedAI { - events.ScheduleEvent(EVENT_FREEZING_CIRCLE, 9000); - events.ScheduleEvent(EVENT_FROSTBOLT, 5000); - } + mob_wrathbone_laborerAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); + events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); + events.ScheduleEvent(EVENT_SHOVELLED, 5000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FREEZING_CIRCLE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FREEZING_CIRCLE); - events.RescheduleEvent(EVENT_FREEZING_CIRCLE, 9000); - return; - case EVENT_FROSTBOLT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FROSTBOLT); - events.RescheduleEvent(EVENT_FROSTBOLT, 5000); - return; + switch(eventId) + { + case EVENT_BLINDING_DIRT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_BLINDING_DIRT); + events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); + return; + case EVENT_PUNCTURE_WOUND: + DoCast(me->getVictim(), SPELL_PUNCTURE_WOUND); + events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); + return; + case EVENT_SHOVELLED: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHOVELLED); + events.RescheduleEvent(EVENT_SHOVELLED, 7000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_stonespine_gargoyleAI: public ScriptedAI +
class mob_wrathbone_coldwraith : public CreatureScript { - mob_stonespine_gargoyleAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_wrathbone_coldwraith() : CreatureScript("mob_wrathbone_coldwraith") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_wrathbone_coldwraithAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_wrathbone_coldwraithAI: public ScriptedAI { - events.ScheduleEvent(EVENT_GARGOYLE_STRIKE, 5000); - } + mob_wrathbone_coldwraithAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FREEZING_CIRCLE, 9000); + events.ScheduleEvent(EVENT_FROSTBOLT, 5000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_GARGOYLE_STRIKE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_GARGOYLE_STRIKE); - events.RescheduleEvent(EVENT_GARGOYLE_STRIKE, 6000); - return; - case EVENT_STONEFORM: - if (HealthBelowPct(10)) - DoCast(me, SPELL_STONEFORM); - return; + switch(eventId) + { + case EVENT_FREEZING_CIRCLE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FREEZING_CIRCLE); + events.RescheduleEvent(EVENT_FREEZING_CIRCLE, 9000); + return; + case EVENT_FROSTBOLT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FROSTBOLT); + events.RescheduleEvent(EVENT_FROSTBOLT, 5000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_plagueborn_horrorAI: public ScriptedAI +
class mob_stonespine_gargoyle : public CreatureScript { - mob_plagueborn_horrorAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_stonespine_gargoyle() : CreatureScript("mob_stonespine_gargoyle") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_stonespine_gargoyleAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_stonespine_gargoyleAI: public ScriptedAI { - events.ScheduleEvent(EVENT_BLIGHT_BOMB, 999999); - events.ScheduleEvent(EVENT_PUSTULANT_FLESH, 5000); - events.ScheduleEvent(EVENT_TOXIC_WASTE, 8000); - } + mob_stonespine_gargoyleAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_GARGOYLE_STRIKE, 5000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_BLIGHT_BOMB: - if (HealthBelowPct(15)) - DoCast(me, SPELL_BLIGHT_BOMB); - return; - case EVENT_PUSTULANT_FLESH: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_PUSTULANT_FLESH); - events.RescheduleEvent(EVENT_PUSTULANT_FLESH, 10000); - return; - case EVENT_TOXIC_WASTE: - DoCast(me, SPELL_TOXIC_WASTE); - events.RescheduleEvent(EVENT_TOXIC_WASTE, 8000); - return; + switch(eventId) + { + case EVENT_GARGOYLE_STRIKE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_GARGOYLE_STRIKE); + events.RescheduleEvent(EVENT_GARGOYLE_STRIKE, 6000); + return; + case EVENT_STONEFORM: + if (HealthBelowPct(10)) + DoCast(me, SPELL_STONEFORM); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_iceborn_protodrakeAI: public ScriptedAI +
class mob_plagueborn_horror : public CreatureScript { - mob_iceborn_protodrakeAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_plagueborn_horror() : CreatureScript("mob_plagueborn_horror") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_plagueborn_horrorAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_plagueborn_horrorAI: public ScriptedAI { - events.ScheduleEvent(EVENT_FROST_BREATH, 5000); - } + mob_plagueborn_horrorAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BLIGHT_BOMB, 999999); + events.ScheduleEvent(EVENT_PUSTULANT_FLESH, 5000); + events.ScheduleEvent(EVENT_TOXIC_WASTE, 8000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FROST_BREATH: - DoCast(me->getVictim(), SPELL_FROST_BREATH); - events.RescheduleEvent(EVENT_FROST_BREATH, 10000); - return; + switch(eventId) + { + case EVENT_BLIGHT_BOMB: + if (HealthBelowPct(15)) + DoCast(me, SPELL_BLIGHT_BOMB); + return; + case EVENT_PUSTULANT_FLESH: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_PUSTULANT_FLESH); + events.RescheduleEvent(EVENT_PUSTULANT_FLESH, 10000); + return; + case EVENT_TOXIC_WASTE: + DoCast(me, SPELL_TOXIC_WASTE); + events.RescheduleEvent(EVENT_TOXIC_WASTE, 8000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_hungering_ghoulAI: public ScriptedAI +
class mob_iceborn_protodrake : public CreatureScript { - mob_hungering_ghoulAI(Creature *c) : ScriptedAI(c) - { - } +public: + mob_iceborn_protodrake() : CreatureScript("mob_iceborn_protodrake") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_iceborn_protodrakeAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_iceborn_protodrakeAI: public ScriptedAI { - events.ScheduleEvent(EVENT_DEVOUR_FLESH, 4000); - } + mob_iceborn_protodrakeAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FROST_BREATH, 5000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_DEVOUR_FLESH: - DoCast(me->getVictim(), SPELL_DEVOUR_FLESH); - events.RescheduleEvent(EVENT_DEVOUR_FLESH, 8000); - return; + switch(eventId) + { + case EVENT_FROST_BREATH: + DoCast(me->getVictim(), SPELL_FROST_BREATH); + events.RescheduleEvent(EVENT_FROST_BREATH, 10000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_fallen_warriorAI: public ScriptedAI +
class mob_hungering_ghoul : public CreatureScript { - mob_fallen_warriorAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_hungering_ghoul() : CreatureScript("mob_hungering_ghoul") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_hungering_ghoulAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_hungering_ghoulAI: public ScriptedAI { - events.ScheduleEvent(EVENT_ARCING_SLICE, 8000); - events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); - events.ScheduleEvent(EVENT_SHIELD_BLOCK, 8000); - } + mob_hungering_ghoulAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_DEVOUR_FLESH, 4000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ARCING_SLICE: - DoCast(me->getVictim(), SPELL_ARCING_SLICE); - events.RescheduleEvent(EVENT_ARCING_SLICE, 10000); - return; - case EVENT_DEMORALIZING_SHOUT: - DoCast(me, SPELL_DEMORALIZING_SHOUT); - events.RescheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); - return; - case EVENT_SHIELD_BLOCK: - DoCast(me->getVictim(), SPELL_SHIELD_BLOCK); - events.RescheduleEvent(EVENT_SHIELD_BLOCK, 8000); - return; + switch(eventId) + { + case EVENT_DEVOUR_FLESH: + DoCast(me->getVictim(), SPELL_DEVOUR_FLESH); + events.RescheduleEvent(EVENT_DEVOUR_FLESH, 8000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_deathwhisper_torturerAI: public ScriptedAI +
class mob_fallen_warrior : public CreatureScript { - mob_deathwhisper_torturerAI(Creature *c) : ScriptedAI(c) - { - } +public: + mob_fallen_warrior() : CreatureScript("mob_fallen_warrior") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_fallen_warriorAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_fallen_warriorAI: public ScriptedAI { - events.ScheduleEvent(EVENT_BLACK_BRAND, 10000); - events.ScheduleEvent(EVENT_CURSE_OF_AGONY, 6000); - } + mob_fallen_warriorAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_ARCING_SLICE, 8000); + events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); + events.ScheduleEvent(EVENT_SHIELD_BLOCK, 8000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_BLACK_BRAND: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_BLACK_BRAND); - events.RescheduleEvent(EVENT_BLACK_BRAND, 10000); - return; - case EVENT_CURSE_OF_AGONY: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CURSE_OF_AGONY); - events.RescheduleEvent(EVENT_CURSE_OF_AGONY, 13000); - return; + switch(eventId) + { + case EVENT_ARCING_SLICE: + DoCast(me->getVictim(), SPELL_ARCING_SLICE); + events.RescheduleEvent(EVENT_ARCING_SLICE, 10000); + return; + case EVENT_DEMORALIZING_SHOUT: + DoCast(me, SPELL_DEMORALIZING_SHOUT); + events.RescheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); + return; + case EVENT_SHIELD_BLOCK: + DoCast(me->getVictim(), SPELL_SHIELD_BLOCK); + events.RescheduleEvent(EVENT_SHIELD_BLOCK, 8000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_deathwhisper_shadowcasterAI: public ScriptedAI +
class mob_deathwhisper_torturer : public CreatureScript { - mob_deathwhisper_shadowcasterAI(Creature *c) : ScriptedAI(c) - { - } +public: + mob_deathwhisper_torturer() : CreatureScript("mob_deathwhisper_torturer") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_deathwhisper_torturerAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_deathwhisper_torturerAI: public ScriptedAI { - events.ScheduleEvent(EVENT_SHADOW_BOLT, 3000); - } + mob_deathwhisper_torturerAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BLACK_BRAND, 10000); + events.ScheduleEvent(EVENT_CURSE_OF_AGONY, 6000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHADOW_BOLT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); - return; + switch(eventId) + { + case EVENT_BLACK_BRAND: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_BLACK_BRAND); + events.RescheduleEvent(EVENT_BLACK_BRAND, 10000); + return; + case EVENT_CURSE_OF_AGONY: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CURSE_OF_AGONY); + events.RescheduleEvent(EVENT_CURSE_OF_AGONY, 13000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_deathwhisper_necrolyteAI: public ScriptedAI +
class mob_deathwhisper_shadowcaster : public CreatureScript { - mob_deathwhisper_necrolyteAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; +public: + mob_deathwhisper_shadowcaster() : CreatureScript("mob_deathwhisper_shadowcaster") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_deathwhisper_shadowcasterAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_deathwhisper_shadowcasterAI: public ScriptedAI { - events.ScheduleEvent(EVENT_CONVERSION_BEAM, 12000); - events.ScheduleEvent(EVENT_SHADOW_BOLT_2, 4000); - } + mob_deathwhisper_shadowcasterAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_BOLT, 3000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_CONVERSION_BEAM: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CONVERSION_BEAM); - events.RescheduleEvent(EVENT_CONVERSION_BEAM, 12000); - return; - case EVENT_SHADOW_BOLT_2: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT_2); - events.RescheduleEvent(EVENT_SHADOW_BOLT_2, 5000); - return; + switch(eventId) + { + case EVENT_SHADOW_BOLT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT); + events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_wrathbone_sorcererAI: public ScriptedAI +
class mob_deathwhisper_necrolyte : public CreatureScript { - mob_wrathbone_sorcererAI(Creature *c) : ScriptedAI(c) - { - } +public: + mob_deathwhisper_necrolyte() : CreatureScript("mob_deathwhisper_necrolyte") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_deathwhisper_necrolyteAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_deathwhisper_necrolyteAI: public ScriptedAI { - events.ScheduleEvent(EVENT_SHADOW_BOLT_3, 3000); - } + mob_deathwhisper_necrolyteAI(Creature *c) : ScriptedAI(c) + { + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_CONVERSION_BEAM, 12000); + events.ScheduleEvent(EVENT_SHADOW_BOLT_2, 4000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHADOW_BOLT_3: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT_3); - events.RescheduleEvent(EVENT_SHADOW_BOLT_3, 5000); - return; + switch(eventId) + { + case EVENT_CONVERSION_BEAM: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CONVERSION_BEAM); + events.RescheduleEvent(EVENT_CONVERSION_BEAM, 12000); + return; + case EVENT_SHADOW_BOLT_2: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT_2); + events.RescheduleEvent(EVENT_SHADOW_BOLT_2, 5000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_geist_ambusherAI: public ScriptedAI +
class mob_wrathbone_sorcerer : public CreatureScript { - mob_geist_ambusherAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } +public: + mob_wrathbone_sorcerer() : CreatureScript("mob_wrathbone_sorcerer") { } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - //Only here so when I figure out how to make it cast on an NPC i can do that. - events.ScheduleEvent(EVENT_LEAPING_FACE_MAUL, 99999); + return new mob_wrathbone_sorcererAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_wrathbone_sorcererAI: public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + mob_wrathbone_sorcererAI(Creature *c) : ScriptedAI(c) + { + } - events.Update(diff); + EventMap events; - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void Reset() + { + events.Reset(); + } - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - //Should only be used on NPCs - case EVENT_LEAPING_FACE_MAUL: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_LEAPING_FACE_MAUL); - events.CancelEvent(EVENT_LEAPING_FACE_MAUL); - return; - } + events.ScheduleEvent(EVENT_SHADOW_BOLT_3, 3000); } - DoMeleeAttackIfReady(); - } -}; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; -CreatureAI* GetAI_mob_ymirjar_wrathbringerAI(Creature* pCreature) -{ - return new mob_ymirjar_wrathbringerAI(pCreature); -} + events.Update(diff); -CreatureAI* GetAI_mob_ymirjar_skyCallerAI(Creature* pCreature) -{ - return new mob_ymirjar_skyCallerAI(pCreature); -} + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; -CreatureAI* GetAI_mob_ymirjar_flamebearerAI(Creature* pCreature) -{ - return new mob_ymirjar_flamebearerAI(pCreature); -} + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHADOW_BOLT_3: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT_3); + events.RescheduleEvent(EVENT_SHADOW_BOLT_3, 5000); + return; + } + } -CreatureAI* GetAI_mob_ymirjar_deathbringerAI(Creature* pCreature) -{ - return new mob_ymirjar_deathbringerAI(pCreature); -} + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_mob_wrathbone_laborerAI(Creature* pCreature) +}; +
class mob_geist_ambusher : public CreatureScript { - return new mob_wrathbone_laborerAI(pCreature); -} +public: + mob_geist_ambusher() : CreatureScript("mob_geist_ambusher") { } -CreatureAI* GetAI_mob_wrathbone_coldwraithAI(Creature* pCreature) -{ - return new mob_wrathbone_coldwraithAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_geist_ambusherAI(pCreature); + } -CreatureAI* GetAI_mob_stonespine_gargoyleAI(Creature* pCreature) -{ - return new mob_stonespine_gargoyleAI(pCreature); -} + struct mob_geist_ambusherAI: public ScriptedAI + { + mob_geist_ambusherAI(Creature *c) : ScriptedAI(c) + { + } -CreatureAI* GetAI_mob_plagueborn_horrorAI(Creature* pCreature) -{ - return new mob_plagueborn_horrorAI(pCreature); -} + EventMap events; -CreatureAI* GetAI_mob_iceborn_protodrakeAI(Creature* pCreature) -{ - return new mob_iceborn_protodrakeAI(pCreature); -} + void Reset() + { + events.Reset(); + } -CreatureAI* GetAI_mob_hungering_ghoulAI(Creature* pCreature) -{ - return new mob_hungering_ghoulAI(pCreature); -} + void EnterCombat(Unit* /*who*/) + { + //Only here so when I figure out how to make it cast on an NPC i can do that. + events.ScheduleEvent(EVENT_LEAPING_FACE_MAUL, 99999); + } -CreatureAI* GetAI_mob_fallen_warriorAI(Creature* pCreature) -{ - return new mob_fallen_warriorAI(pCreature); -} + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; -CreatureAI* GetAI_mob_deathwhisper_torturerAI(Creature* pCreature) -{ - return new mob_deathwhisper_torturerAI(pCreature); -} + events.Update(diff); -CreatureAI* GetAI_mob_deathwhisper_shadowcasterAI(Creature* pCreature) -{ - return new mob_deathwhisper_shadowcasterAI(pCreature); -} + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; -CreatureAI* GetAI_mob_deathwhisper_necrolyteAI(Creature* pCreature) -{ - return new mob_deathwhisper_necrolyteAI(pCreature); -} + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + //Should only be used on NPCs + case EVENT_LEAPING_FACE_MAUL: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_LEAPING_FACE_MAUL); + events.CancelEvent(EVENT_LEAPING_FACE_MAUL); + return; + } + } -CreatureAI* GetAI_mob_wrathbone_sorcererAI(Creature* pCreature) -{ - return new mob_wrathbone_sorcererAI(pCreature); -} + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_mob_geist_ambusherAI(Creature* pCreature) -{ - return new mob_geist_ambusherAI(pCreature); -} +}; void AddSC_pit_of_saron() { - Script *newscript; - newscript = new Script; - newscript->Name="mob_ymirjar_wrathbringer"; - newscript->GetAI = &GetAI_mob_ymirjar_wrathbringerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ymirjar_skycaller"; - newscript->GetAI = &GetAI_mob_ymirjar_skyCallerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ymirjar_flamebearer"; - newscript->GetAI = &GetAI_mob_ymirjar_flamebearerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ymirjar_deathbringer"; - newscript->GetAI = &GetAI_mob_ymirjar_deathbringerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_wrathbone_laborer"; - newscript->GetAI = &GetAI_mob_wrathbone_laborerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_wrathbone_coldwraith"; - newscript->GetAI = &GetAI_mob_wrathbone_coldwraithAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_stonespine_gargoyle"; - newscript->GetAI = &GetAI_mob_stonespine_gargoyleAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_plagueborn_horror"; - newscript->GetAI = &GetAI_mob_plagueborn_horrorAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_iceborn_protodrake"; - newscript->GetAI = &GetAI_mob_iceborn_protodrakeAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_hungering_ghoul"; - newscript->GetAI = &GetAI_mob_hungering_ghoulAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_fallen_warrior"; - newscript->GetAI = &GetAI_mob_fallen_warriorAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_deathwhisper_torturer"; - newscript->GetAI = &GetAI_mob_deathwhisper_torturerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_deathwhisper_shadowcaster"; - newscript->GetAI = &GetAI_mob_deathwhisper_shadowcasterAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_deathwhisper_necrolyte"; - newscript->GetAI = &GetAI_mob_deathwhisper_necrolyteAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_wrathbone_sorcerer"; - newscript->GetAI = &GetAI_mob_wrathbone_sorcererAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_geist_ambusher"; - newscript->GetAI = &GetAI_mob_geist_ambusherAI; - newscript->RegisterSelf(); + new mob_ymirjar_wrathbringer(); + new mob_ymirjar_skycaller(); + new mob_ymirjar_flamebearer(); + new mob_ymirjar_deathbringer(); + new mob_wrathbone_laborer(); + new mob_wrathbone_coldwraith(); + new mob_stonespine_gargoyle(); + new mob_plagueborn_horror(); + new mob_iceborn_protodrake(); + new mob_hungering_ghoul(); + new mob_fallen_warrior(); + new mob_deathwhisper_torturer(); + new mob_deathwhisper_shadowcaster(); + new mob_deathwhisper_necrolyte(); + new mob_wrathbone_sorcerer(); + new mob_geist_ambusher(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 3bb998c7096..307479f2542 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -34,283 +34,291 @@ enum Spells SPELL_MOJO_WAVE = 55626, H_SPELL_MOJO_WAVE = 58993 }; - -struct boss_drakkari_colossusAI : public ScriptedAI +
class boss_drakkari_colossus : public CreatureScript { - boss_drakkari_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; +public: + boss_drakkari_colossus() : CreatureScript("boss_drakkari_colossus") { } - bool bHealth; - bool bHealth1; - - uint32 MightyBlowTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - me->SetReactState(REACT_PASSIVE); - MightyBlowTimer = 10*IN_MILLISECONDS; - bHealth = false; - bHealth1 = false; + return new boss_drakkari_colossusAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_drakkari_colossusAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); - } + boss_drakkari_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - void CreatureState(Creature* pWho, bool bRestore = false) - { - if (!pWho) - return; + InstanceScript* pInstance; - if (bRestore) - { - pWho->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - pWho->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pWho == me) - me->RemoveAura(SPELL_FREEZE_ANIM); - }else + bool bHealth; + bool bHealth1; + + uint32 MightyBlowTimer; + + void Reset() { - pWho->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pWho->addUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - if (pWho == me) - DoCast(me,SPELL_FREEZE_ANIM); + if (pInstance) + pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + me->SetReactState(REACT_PASSIVE); + MightyBlowTimer = 10*IN_MILLISECONDS; + bHealth = false; + bHealth1 = false; } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - if (!bHealth && HealthBelowPct(50) && !HealthBelowPct(5)) + void EnterCombat(Unit* /*who*/) { - CreatureState(me, false); - DoCast(me,SPELL_FREEZE_ANIM); - DoCast(me,SPELL_EMERGE); - bHealth = true; + if (pInstance) + pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); } - if (!bHealth1 && HealthBelowPct(5)) + void CreatureState(Creature* pWho, bool bRestore = false) { - DoCast(me,SPELL_EMERGE); - CreatureState(me, false); - bHealth1 = true; - me->RemoveAllAuras(); + if (!pWho) + return; + + if (bRestore) + { + pWho->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + pWho->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pWho == me) + me->RemoveAura(SPELL_FREEZE_ANIM); + }else + { + pWho->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pWho->addUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + if (pWho == me) + DoCast(me,SPELL_FREEZE_ANIM); + } } - if (MightyBlowTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MIGHTY_BLOW, true); - MightyBlowTimer = 10*IN_MILLISECONDS; - } else MightyBlowTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (!me->hasUnitState(UNIT_STAT_STUNNED)) - DoMeleeAttackIfReady(); - } + if (!bHealth && HealthBelowPct(50) && !HealthBelowPct(5)) + { + CreatureState(me, false); + DoCast(me,SPELL_FREEZE_ANIM); + DoCast(me,SPELL_EMERGE); + bHealth = true; + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); - } + if (!bHealth1 && HealthBelowPct(5)) + { + DoCast(me,SPELL_EMERGE); + CreatureState(me, false); + bHealth1 = true; + me->RemoveAllAuras(); + } - void JustSummoned(Creature* pSummon) - { - if (HealthBelowPct(5)) - pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5 , NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - pSummon->AI()->AttackStart(me->getVictim()); - } -}; + if (MightyBlowTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTY_BLOW, true); + MightyBlowTimer = 10*IN_MILLISECONDS; + } else MightyBlowTimer -= diff; -struct boss_drakkari_elementalAI : public ScriptedAI -{ - boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } + if (!me->hasUnitState(UNIT_STAT_STUNNED)) + DoMeleeAttackIfReady(); + } - ScriptedInstance* pInstance; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); + } - uint32 uiSurgeTimer; + void JustSummoned(Creature* pSummon) + { + if (HealthBelowPct(5)) + pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5 , NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pSummon->AI()->AttackStart(me->getVictim()); + } + }; - bool bGoToColossus; +}; +
class boss_drakkari_elemental : public CreatureScript +{ +public: + boss_drakkari_elemental() : CreatureScript("boss_drakkari_elemental") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) - CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->CreatureState(me, true); - uiSurgeTimer = 7*IN_MILLISECONDS; - bGoToColossus = false; + return new boss_drakkari_elementalAI (pCreature); } - void EnterEvadeMode() + struct boss_drakkari_elementalAI : public ScriptedAI { - me->RemoveFromWorld(); - } + boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + InstanceScript* pInstance; + + uint32 uiSurgeTimer; + + bool bGoToColossus; + + void Reset() { - CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->CreatureState(pColossus, true); - CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->bHealth1 = false; + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI, pColossus->AI())->CreatureState(me, true); + uiSurgeTimer = 7*IN_MILLISECONDS; + bGoToColossus = false; } - me->RemoveFromWorld(); - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterEvadeMode() + { + me->RemoveFromWorld(); + } - if (!bGoToColossus && HealthBelowPct(50)) + void MovementInform(uint32 uiType, uint32 /*uiId*/) { + if (uiType != POINT_MOTION_TYPE) + return; if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) { - if (!CAST_AI(boss_drakkari_colossusAI,pColossus->AI())->HealthBelowPct(6)) - { - me->InterruptNonMeleeSpells(true); - DoCast(pColossus, SPELL_MERGE); - bGoToColossus = true; - } + CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI, pColossus->AI())->CreatureState(pColossus, true); + CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI, pColossus->AI())->bHealth1 = false; } + me->RemoveFromWorld(); } - if (uiSurgeTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SURGE); - uiSurgeTimer = 7*IN_MILLISECONDS; - } else uiSurgeTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } + if (!bGoToColossus && HealthBelowPct(50)) + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + { + if (!CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI,pColossus->AI())->HealthBelowPct(6)) + { + me->InterruptNonMeleeSpells(true); + DoCast(pColossus, SPELL_MERGE); + bGoToColossus = true; + } + } + } - void JustDied(Unit* /*killer*/) - { - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) - pColossus->Kill(pColossus); - } -}; + if (uiSurgeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SURGE); + uiSurgeTimer = 7*IN_MILLISECONDS; + } else uiSurgeTimer -= diff; -struct npc_living_mojoAI : public ScriptedAI -{ - npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } + DoMeleeAttackIfReady(); + } - ScriptedInstance* pInstance; + void JustDied(Unit* /*killer*/) + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + pColossus->Kill(pColossus); + } + }; - uint32 uiMojoWaveTimer; - uint32 uiMojoPuddleTimer; +}; +
class npc_living_mojo : public CreatureScript +{ +public: + npc_living_mojo() : CreatureScript("npc_living_mojo") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiMojoWaveTimer = 2*IN_MILLISECONDS; - uiMojoPuddleTimer = 7*IN_MILLISECONDS; + return new npc_living_mojoAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct npc_living_mojoAI : public ScriptedAI { + npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - //Check if the npc is near of Drakkari Colossus. - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + InstanceScript* pInstance; + + uint32 uiMojoWaveTimer; + uint32 uiMojoPuddleTimer; + + void Reset() { - if (pColossus->isAlive() && me->IsInRange3d(pColossus->GetHomePosition().GetPositionX(),pColossus->GetHomePosition().GetPositionY(),pColossus->GetHomePosition().GetPositionZ(),0.0f,17.0f)) - me->SetReactState(REACT_PASSIVE); - else - me->SetReactState(REACT_AGGRESSIVE); + uiMojoWaveTimer = 2*IN_MILLISECONDS; + uiMojoPuddleTimer = 7*IN_MILLISECONDS; } - } - void DamageTaken(Unit* pDone_by, uint32& /*uiDamage*/) - { - if (me->HasReactState(REACT_PASSIVE)) + void EnterCombat(Unit* /*who*/) { + + //Check if the npc is near of Drakkari Colossus. if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) { - if (pColossus->isAlive() && !pColossus->isInCombat()) + if (pColossus->isAlive() && me->IsInRange3d(pColossus->GetHomePosition().GetPositionX(),pColossus->GetHomePosition().GetPositionY(),pColossus->GetHomePosition().GetPositionZ(),0.0f,17.0f)) + me->SetReactState(REACT_PASSIVE); + else + me->SetReactState(REACT_AGGRESSIVE); + } + } + + void DamageTaken(Unit* pDone_by, uint32& /*uiDamage*/) + { + if (me->HasReactState(REACT_PASSIVE)) + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) { - pColossus->RemoveAura(SPELL_FREEZE_ANIM); - pColossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pColossus->SetReactState(REACT_AGGRESSIVE); - if (pDone_by && pDone_by->isAlive()) - pColossus->AI()->AttackStart(pDone_by); - EnterEvadeMode(); + if (pColossus->isAlive() && !pColossus->isInCombat()) + { + pColossus->RemoveAura(SPELL_FREEZE_ANIM); + pColossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pColossus->SetReactState(REACT_AGGRESSIVE); + if (pDone_by && pDone_by->isAlive()) + pColossus->AI()->AttackStart(pDone_by); + EnterEvadeMode(); + } } } } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiMojoWaveTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MOJO_WAVE); - uiMojoWaveTimer = 15*IN_MILLISECONDS; - } else uiMojoWaveTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiMojoPuddleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_MOJO_PUDDLE); - uiMojoPuddleTimer = 18*IN_MILLISECONDS; - } else uiMojoPuddleTimer -= diff; + if (uiMojoWaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MOJO_WAVE); + uiMojoWaveTimer = 15*IN_MILLISECONDS; + } else uiMojoWaveTimer -= diff; + + if (uiMojoPuddleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MOJO_PUDDLE); + uiMojoPuddleTimer = 18*IN_MILLISECONDS; + } else uiMojoPuddleTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_drakkari_colossus(Creature* pCreature) -{ - return new boss_drakkari_colossusAI (pCreature); -} -CreatureAI* GetAI_boss_drakkari_elemental(Creature* pCreature) -{ - return new boss_drakkari_elementalAI (pCreature); -} -CreatureAI* GetAI_npc_living_mojo(Creature* pCreature) -{ - return new npc_living_mojoAI (pCreature); -} void AddSC_boss_drakkari_colossus() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_drakkari_colossus"; - newscript->GetAI = &GetAI_boss_drakkari_colossus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_drakkari_elemental"; - newscript->GetAI = &GetAI_boss_drakkari_elemental; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_living_mojo"; - newscript->GetAI = &GetAI_npc_living_mojo; - newscript->RegisterSelf(); + new boss_drakkari_colossus(); + new boss_drakkari_elemental(); + new npc_living_mojo(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp index 8ddcc12ae49..b25cf7d27be 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp @@ -28,140 +28,145 @@ enum Spells }; static Position EckSpawnPoint = { 1643.877930, 936.278015, 107.204948, 0.668432 }; - -struct boss_eckAI : public ScriptedAI +
class boss_eck : public CreatureScript { - boss_eckAI(Creature *c) : ScriptedAI(c) +public: + boss_eck() : CreatureScript("boss_eck") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_eckAI (pCreature); } - uint32 uiBerserkTimer; - uint32 uiBiteTimer; - uint32 uiSpitTimer; - uint32 uiSpringTimer; - - bool bBerserk; + struct boss_eckAI : public ScriptedAI + { + boss_eckAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance* pInstance; + uint32 uiBerserkTimer; + uint32 uiBiteTimer; + uint32 uiSpitTimer; + uint32 uiSpringTimer; - void Reset() - { - uiBerserkTimer = urand(60*IN_MILLISECONDS,90*IN_MILLISECONDS); //60-90 secs according to wowwiki - uiBiteTimer = 5*IN_MILLISECONDS; - uiSpitTimer = 10*IN_MILLISECONDS; - uiSpringTimer = 8*IN_MILLISECONDS; + bool bBerserk; - bBerserk = false; + InstanceScript* pInstance; - if (pInstance) - pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED); - } + void Reset() + { + uiBerserkTimer = urand(60*IN_MILLISECONDS,90*IN_MILLISECONDS); //60-90 secs according to wowwiki + uiBiteTimer = 5*IN_MILLISECONDS; + uiSpitTimer = 10*IN_MILLISECONDS; + uiSpringTimer = 8*IN_MILLISECONDS; - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS); - } + bBerserk = false; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED); + } - if (uiBiteTimer <= diff) + void EnterCombat(Unit* /*who*/) { - DoCast(me->getVictim(), SPELL_ECK_BITE); - uiBiteTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); - } else uiBiteTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS); + } - if (uiSpitTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_ECK_SPIT); - uiSpitTimer = urand(6*IN_MILLISECONDS,14*IN_MILLISECONDS); - } else uiSpitTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiSpringTimer <= diff) - { - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + if (uiBiteTimer <= diff) { - DoCast(pTarget, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2)); - uiSpringTimer = urand(5*IN_MILLISECONDS,10*IN_MILLISECONDS); - } - } else uiSpringTimer -= diff; + DoCast(me->getVictim(), SPELL_ECK_BITE); + uiBiteTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); + } else uiBiteTimer -= diff; - //Berserk on timer or 20% of health - if (!bBerserk) - { - if (uiBerserkTimer <= diff) + if (uiSpitTimer <= diff) { - DoCast(me, SPELL_ECK_BERSERK); - bBerserk = true; - } - else + DoCast(me->getVictim(), SPELL_ECK_SPIT); + uiSpitTimer = urand(6*IN_MILLISECONDS,14*IN_MILLISECONDS); + } else uiSpitTimer -= diff; + + if (uiSpringTimer <= diff) + { + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + { + DoCast(pTarget, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2)); + uiSpringTimer = urand(5*IN_MILLISECONDS,10*IN_MILLISECONDS); + } + } else uiSpringTimer -= diff; + + //Berserk on timer or 20% of health + if (!bBerserk) { - uiBerserkTimer -= diff; - if (HealthBelowPct(20)) + if (uiBerserkTimer <= diff) { DoCast(me, SPELL_ECK_BERSERK); bBerserk = true; } + else + { + uiBerserkTimer -= diff; + if (HealthBelowPct(20)) + { + DoCast(me, SPELL_ECK_BERSERK); + bBerserk = true; + } + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE); + } + }; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_eck(Creature* pCreature) +
class npc_ruins_dweller : public CreatureScript { - return new boss_eckAI (pCreature); -} +public: + npc_ruins_dweller() : CreatureScript("npc_ruins_dweller") { } -struct npc_ruins_dwellerAI : public ScriptedAI -{ - npc_ruins_dwellerAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_ruins_dwellerAI (pCreature); } - ScriptedInstance* pInstance; - - void JustDied(Unit * /*who*/) + struct npc_ruins_dwellerAI : public ScriptedAI { - if (pInstance) + npc_ruins_dwellerAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData64(DATA_RUIN_DWELLER_DIED,me->GetGUID()); - if (pInstance->GetData(DATA_ALIVE_RUIN_DWELLERS) == 0) - me->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300*IN_MILLISECONDS); + pInstance = c->GetInstanceScript(); } - } + + InstanceScript* pInstance; + + void JustDied(Unit * /*who*/) + { + if (pInstance) + { + pInstance->SetData64(DATA_RUIN_DWELLER_DIED,me->GetGUID()); + if (pInstance->GetData(DATA_ALIVE_RUIN_DWELLERS) == 0) + me->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300*IN_MILLISECONDS); + } + } + }; + }; -CreatureAI* GetAI_npc_ruins_dweller(Creature* pCreature) -{ - return new npc_ruins_dwellerAI (pCreature); -} void AddSC_boss_eck() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_eck"; - newscript->GetAI = &GetAI_boss_eck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ruins_dweller"; - newscript->GetAI = &GetAI_npc_ruins_dweller; - newscript->RegisterSelf(); + new boss_eck(); + new npc_ruins_dweller(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index e90b244b118..be92b9dc52c 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -67,221 +67,223 @@ enum CombatPhase TROLL, RHINO }; - -struct boss_gal_darahAI : public ScriptedAI +
class boss_gal_darah : public CreatureScript { - boss_gal_darahAI(Creature *c) : ScriptedAI(c) +public: + boss_gal_darah() : CreatureScript("boss_gal_darah") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_gal_darahAI (pCreature); } - uint32 uiStampedeTimer; - uint32 uiWhirlingSlashTimer; - uint32 uiPunctureTimer; - uint32 uiEnrageTimer; - uint32 uiImpalingChargeTimer; - uint32 uiStompTimer; - uint32 uiTransformationTimer; - std::set<uint64> lImpaledPlayers; + struct boss_gal_darahAI : public ScriptedAI + { + boss_gal_darahAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - CombatPhase Phase; + uint32 uiStampedeTimer; + uint32 uiWhirlingSlashTimer; + uint32 uiPunctureTimer; + uint32 uiEnrageTimer; + uint32 uiImpalingChargeTimer; + uint32 uiStompTimer; + uint32 uiTransformationTimer; + std::set<uint64> lImpaledPlayers; - uint8 uiPhaseCounter; + CombatPhase Phase; - bool bStartOfTransformation; + uint8 uiPhaseCounter; - ScriptedInstance* pInstance; + bool bStartOfTransformation; - void Reset() - { - uiStampedeTimer = 10*IN_MILLISECONDS; - uiWhirlingSlashTimer = 21*IN_MILLISECONDS; - uiPunctureTimer = 10*IN_MILLISECONDS; - uiEnrageTimer = 15*IN_MILLISECONDS; - uiImpalingChargeTimer = 21*IN_MILLISECONDS; - uiStompTimer = 25*IN_MILLISECONDS; - uiTransformationTimer = 9*IN_MILLISECONDS; - uiPhaseCounter = 0; + InstanceScript* pInstance; - lImpaledPlayers.clear(); + void Reset() + { + uiStampedeTimer = 10*IN_MILLISECONDS; + uiWhirlingSlashTimer = 21*IN_MILLISECONDS; + uiPunctureTimer = 10*IN_MILLISECONDS; + uiEnrageTimer = 15*IN_MILLISECONDS; + uiImpalingChargeTimer = 21*IN_MILLISECONDS; + uiStompTimer = 25*IN_MILLISECONDS; + uiTransformationTimer = 9*IN_MILLISECONDS; + uiPhaseCounter = 0; - bStartOfTransformation = true; + lImpaledPlayers.clear(); - Phase = TROLL; + bStartOfTransformation = true; - me->SetDisplayId(DISPLAY_TROLL); + Phase = TROLL; - if (pInstance) - pInstance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED); - } + me->SetDisplayId(DISPLAY_TROLL); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED); + } - if (pInstance) - pInstance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + pInstance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS); + } - switch (Phase) + void UpdateAI(const uint32 diff) { - case TROLL: - if (uiPhaseCounter == 2) - { - if (uiTransformationTimer <= diff) - { - me->SetDisplayId(DISPLAY_RHINO); - Phase = RHINO; - uiPhaseCounter = 0; - DoScriptText(SAY_TRANSFORM_1, me); - uiTransformationTimer = 5*IN_MILLISECONDS; - bStartOfTransformation = true; - me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_AGGRESSIVE); - } - else - { - uiTransformationTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (bStartOfTransformation) + switch (Phase) + { + case TROLL: + if (uiPhaseCounter == 2) + { + if (uiTransformationTimer <= diff) + { + me->SetDisplayId(DISPLAY_RHINO); + Phase = RHINO; + uiPhaseCounter = 0; + DoScriptText(SAY_TRANSFORM_1, me); + uiTransformationTimer = 5*IN_MILLISECONDS; + bStartOfTransformation = true; + me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_AGGRESSIVE); + } + else { - bStartOfTransformation = false; - me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_PASSIVE); + uiTransformationTimer -= diff; + + if (bStartOfTransformation) + { + bStartOfTransformation = false; + me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_PASSIVE); + } } } - } - else - { - if (uiStampedeTimer <= diff) + else { - DoCast(me, SPELL_STAMPEDE); - DoScriptText(RAND(SAY_SUMMON_RHINO_1,SAY_SUMMON_RHINO_2,SAY_SUMMON_RHINO_3),me); - uiStampedeTimer = 15*IN_MILLISECONDS; - } else uiStampedeTimer -= diff; + if (uiStampedeTimer <= diff) + { + DoCast(me, SPELL_STAMPEDE); + DoScriptText(RAND(SAY_SUMMON_RHINO_1,SAY_SUMMON_RHINO_2,SAY_SUMMON_RHINO_3),me); + uiStampedeTimer = 15*IN_MILLISECONDS; + } else uiStampedeTimer -= diff; - if (uiWhirlingSlashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WHIRLING_SLASH); - uiWhirlingSlashTimer = 21*IN_MILLISECONDS; - ++uiPhaseCounter; - } else uiWhirlingSlashTimer -= diff; - } - break; - case RHINO: - if (uiPhaseCounter == 2) - { - if (uiTransformationTimer <= diff) - { - me->SetDisplayId(DISPLAY_TROLL); - Phase = TROLL; - uiPhaseCounter = 0; - DoScriptText(SAY_TRANSFORM_2, me); - uiTransformationTimer = 9*IN_MILLISECONDS; - bStartOfTransformation = true; - me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_AGGRESSIVE); + if (uiWhirlingSlashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLING_SLASH); + uiWhirlingSlashTimer = 21*IN_MILLISECONDS; + ++uiPhaseCounter; + } else uiWhirlingSlashTimer -= diff; } - else + break; + case RHINO: + if (uiPhaseCounter == 2) { - uiTransformationTimer -= diff; - - if (bStartOfTransformation) + if (uiTransformationTimer <= diff) + { + me->SetDisplayId(DISPLAY_TROLL); + Phase = TROLL; + uiPhaseCounter = 0; + DoScriptText(SAY_TRANSFORM_2, me); + uiTransformationTimer = 9*IN_MILLISECONDS; + bStartOfTransformation = true; + me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_AGGRESSIVE); + } + else { - bStartOfTransformation = false; - me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_PASSIVE); + uiTransformationTimer -= diff; + + if (bStartOfTransformation) + { + bStartOfTransformation = false; + me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_PASSIVE); + } } } - } - else - { - if (uiPunctureTimer <= diff) - { - DoCast(me->getVictim(), SPELL_PUNCTURE); - uiPunctureTimer = 8*IN_MILLISECONDS; - } else uiPunctureTimer -= diff; - - if (uiEnrageTimer <= diff) + else { - DoCast(me->getVictim(), SPELL_ENRAGE); - uiEnrageTimer = 20*IN_MILLISECONDS; - } else uiEnrageTimer -= diff; + if (uiPunctureTimer <= diff) + { + DoCast(me->getVictim(), SPELL_PUNCTURE); + uiPunctureTimer = 8*IN_MILLISECONDS; + } else uiPunctureTimer -= diff; - if (uiStompTimer <= diff) - { - DoCast(me->getVictim(), SPELL_STOMP); - uiStompTimer = 20*IN_MILLISECONDS; - } else uiStompTimer -= diff; + if (uiEnrageTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ENRAGE); + uiEnrageTimer = 20*IN_MILLISECONDS; + } else uiEnrageTimer -= diff; - if (uiImpalingChargeTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiStompTimer <= diff) { - DoCast(pTarget, SPELL_IMPALING_CHARGE); - lImpaledPlayers.insert(pTarget->GetGUID()); - } - uiImpalingChargeTimer = 31*IN_MILLISECONDS; - ++uiPhaseCounter; - } else uiImpalingChargeTimer -= diff; - } - break; - } + DoCast(me->getVictim(), SPELL_STOMP); + uiStompTimer = 20*IN_MILLISECONDS; + } else uiStompTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiImpalingChargeTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoCast(pTarget, SPELL_IMPALING_CHARGE); + lImpaledPlayers.insert(pTarget->GetGUID()); + } + uiImpalingChargeTimer = 31*IN_MILLISECONDS; + ++uiPhaseCounter; + } else uiImpalingChargeTimer -= diff; + } + break; + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + DoMeleeAttackIfReady(); + } - if (pInstance) + void JustDied(Unit* /*killer*/) { - if (IsHeroic()) - { - if (lImpaledPlayers.size() == 5) - pInstance->DoCompleteAchievement(ACHIEV_SHARE_THE_LOVE); + DoScriptText(SAY_DEATH, me); - AchievementEntry const *achievWhatTheEck = GetAchievementStore()->LookupEntry(ACHIEV_WHAT_THE_ECK); - if (achievWhatTheEck) + if (pInstance) + { + if (IsHeroic()) { - Map::PlayerList const &players = pInstance->instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (itr->getSource()->HasAura(SPELL_ECK_RESIDUE)) - itr->getSource()->CompletedAchievement(achievWhatTheEck); + if (lImpaledPlayers.size() == 5) + pInstance->DoCompleteAchievement(ACHIEV_SHARE_THE_LOVE); + + AchievementEntry const *achievWhatTheEck = GetAchievementStore()->LookupEntry(ACHIEV_WHAT_THE_ECK); + if (achievWhatTheEck) + { + Map::PlayerList const &players = pInstance->instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (itr->getSource()->HasAura(SPELL_ECK_RESIDUE)) + itr->getSource()->CompletedAchievement(achievWhatTheEck); + } } - } - pInstance->SetData(DATA_GAL_DARAH_EVENT, DONE); + pInstance->SetData(DATA_GAL_DARAH_EVENT, DONE); + } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_gal_darah(Creature* pCreature) -{ - return new boss_gal_darahAI (pCreature); -} void AddSC_boss_gal_darah() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_gal_darah"; - newscript->GetAI = &GetAI_boss_gal_darah; - newscript->RegisterSelf(); + new boss_gal_darah(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp index 7a9278b2fde..4aa8bac0cb5 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp @@ -47,128 +47,130 @@ enum eSays SAY_QUAKE = -1604016, EMOTE_TRANSFORM = -1604017 }; - -struct boss_moorabiAI : public ScriptedAI +
class boss_moorabi : public CreatureScript { - boss_moorabiAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - bool bPhase; - - uint32 uiNumblingShoutTimer; - uint32 uiGroundTremorTimer; - uint32 uiDeterminedStabTimer; - uint32 uiTransformationTImer; +public: + boss_moorabi() : CreatureScript("boss_moorabi") { } - void Reset() + CreatureAI* GetAI(Creature *pCreature) { - uiGroundTremorTimer = 18*IN_MILLISECONDS; - uiNumblingShoutTimer = 10*IN_MILLISECONDS; - uiDeterminedStabTimer = 20*IN_MILLISECONDS; - uiTransformationTImer = 12*IN_MILLISECONDS; - bPhase = false; - - if (pInstance) - pInstance->SetData(DATA_MOORABI_EVENT, NOT_STARTED); + return new boss_moorabiAI(pCreature); } - void EnterCombat(Unit* /*pWho*/) + struct boss_moorabiAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_MOJO_FRENZY, true); + boss_moorabiAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + bool bPhase; + + uint32 uiNumblingShoutTimer; + uint32 uiGroundTremorTimer; + uint32 uiDeterminedStabTimer; + uint32 uiTransformationTImer; - if (!bPhase && me->HasAura(SPELL_TRANSFORMATION)) + void Reset() { - bPhase = true; - me->RemoveAura(SPELL_MOJO_FRENZY); + uiGroundTremorTimer = 18*IN_MILLISECONDS; + uiNumblingShoutTimer = 10*IN_MILLISECONDS; + uiDeterminedStabTimer = 20*IN_MILLISECONDS; + uiTransformationTImer = 12*IN_MILLISECONDS; + bPhase = false; + + if (pInstance) + pInstance->SetData(DATA_MOORABI_EVENT, NOT_STARTED); } - if (uiGroundTremorTimer <= uiDiff) - { - DoScriptText(SAY_QUAKE, me); - if (bPhase) - DoCast(me->getVictim(), SPELL_QUAKE, true); - else - DoCast(me->getVictim(), SPELL_GROUND_TREMOR, true); - uiGroundTremorTimer = 10*IN_MILLISECONDS; - } else uiGroundTremorTimer -= uiDiff; - - if (uiNumblingShoutTimer <= uiDiff) + void EnterCombat(Unit* /*pWho*/) { - if (bPhase) - DoCast(me->getVictim(), SPELL_NUMBING_ROAR, true); - else - DoCast(me->getVictim(), SPELL_NUMBING_SHOUT, true); - uiNumblingShoutTimer = 10*IN_MILLISECONDS; - } else uiNumblingShoutTimer -=uiDiff; - - if (uiDeterminedStabTimer <= uiDiff) - { - if (bPhase) - DoCast(me->getVictim(), SPELL_DETERMINED_GORE); - else - DoCast(me->getVictim(), SPELL_DETERMINED_STAB, true); - uiDeterminedStabTimer = 8*IN_MILLISECONDS; - } else uiDeterminedStabTimer -=uiDiff; - - if (!bPhase && uiTransformationTImer <= uiDiff) - { - DoScriptText(EMOTE_TRANSFORM, me); - DoScriptText(SAY_TRANSFORM, me); - DoCast(me, SPELL_TRANSFORMATION, false); - uiTransformationTImer = 10*IN_MILLISECONDS; - } else uiTransformationTImer -= uiDiff; + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_MOJO_FRENZY, true); - DoMeleeAttackIfReady(); - } + if (pInstance) + pInstance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS); + } - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bPhase && me->HasAura(SPELL_TRANSFORMATION)) + { + bPhase = true; + me->RemoveAura(SPELL_MOJO_FRENZY); + } + + if (uiGroundTremorTimer <= uiDiff) + { + DoScriptText(SAY_QUAKE, me); + if (bPhase) + DoCast(me->getVictim(), SPELL_QUAKE, true); + else + DoCast(me->getVictim(), SPELL_GROUND_TREMOR, true); + uiGroundTremorTimer = 10*IN_MILLISECONDS; + } else uiGroundTremorTimer -= uiDiff; + + if (uiNumblingShoutTimer <= uiDiff) + { + if (bPhase) + DoCast(me->getVictim(), SPELL_NUMBING_ROAR, true); + else + DoCast(me->getVictim(), SPELL_NUMBING_SHOUT, true); + uiNumblingShoutTimer = 10*IN_MILLISECONDS; + } else uiNumblingShoutTimer -=uiDiff; + + if (uiDeterminedStabTimer <= uiDiff) + { + if (bPhase) + DoCast(me->getVictim(), SPELL_DETERMINED_GORE); + else + DoCast(me->getVictim(), SPELL_DETERMINED_STAB, true); + uiDeterminedStabTimer = 8*IN_MILLISECONDS; + } else uiDeterminedStabTimer -=uiDiff; + + if (!bPhase && uiTransformationTImer <= uiDiff) + { + DoScriptText(EMOTE_TRANSFORM, me); + DoScriptText(SAY_TRANSFORM, me); + DoCast(me, SPELL_TRANSFORMATION, false); + uiTransformationTImer = 10*IN_MILLISECONDS; + } else uiTransformationTImer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + pInstance->SetData(DATA_MOORABI_EVENT, DONE); + + if (IsHeroic() && !bPhase) + pInstance->DoCompleteAchievement(ACHIEV_LESS_RABI); + } + } - if (pInstance) + void KilledUnit(Unit* pVictim) { - pInstance->SetData(DATA_MOORABI_EVENT, DONE); + if (pVictim == me) + return; - if (IsHeroic() && !bPhase) - pInstance->DoCompleteAchievement(ACHIEV_LESS_RABI); + DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), me); } - } + }; - void KilledUnit(Unit* pVictim) - { - if (pVictim == me) - return; - - DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_moorabi(Creature *pCreature) -{ - return new boss_moorabiAI(pCreature); -} void AddSC_boss_moorabi() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_moorabi"; - newscript->GetAI = &GetAI_boss_moorabi; - newscript->RegisterSelf(); + new boss_moorabi(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 47a55440b92..13f0a722bf2 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -64,202 +64,210 @@ static Position SpawnLoc[]= {1765.66, 646.542, 134.02, 5.11381}, {1716.76, 635.159, 129.282, 0.191986} }; - -struct boss_slad_ranAI : public ScriptedAI +
class boss_slad_ran : public CreatureScript { - boss_slad_ranAI(Creature *c) : ScriptedAI(c), lSummons(me) +public: + boss_slad_ran() : CreatureScript("boss_slad_ran") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_slad_ranAI (pCreature); } - uint32 uiPoisonNovaTimer; - uint32 uiPowerfullBiteTimer; - uint32 uiVenomBoltTimer; - uint32 uiSpawnTimer; + struct boss_slad_ranAI : public ScriptedAI + { + boss_slad_ranAI(Creature *c) : ScriptedAI(c), lSummons(me) + { + pInstance = c->GetInstanceScript(); + } - uint8 uiPhase; + uint32 uiPoisonNovaTimer; + uint32 uiPowerfullBiteTimer; + uint32 uiVenomBoltTimer; + uint32 uiSpawnTimer; - SummonList lSummons; + uint8 uiPhase; - ScriptedInstance* pInstance; + SummonList lSummons; - void Reset() - { - uiPoisonNovaTimer = 10*IN_MILLISECONDS; - uiPowerfullBiteTimer = 3*IN_MILLISECONDS; - uiVenomBoltTimer = 15*IN_MILLISECONDS; - uiSpawnTimer = 5*IN_MILLISECONDS; - uiPhase = 0; + InstanceScript* pInstance; - lSummons.DespawnAll(); + void Reset() + { + uiPoisonNovaTimer = 10*IN_MILLISECONDS; + uiPowerfullBiteTimer = 3*IN_MILLISECONDS; + uiVenomBoltTimer = 15*IN_MILLISECONDS; + uiSpawnTimer = 5*IN_MILLISECONDS; + uiPhase = 0; - if (pInstance) - pInstance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED); - } + lSummons.DespawnAll(); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED); + } - if (pInstance) - pInstance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + pInstance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS); + } - if (uiPoisonNovaTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_POISON_NOVA); - uiPoisonNovaTimer = 15*IN_MILLISECONDS; - } else uiPoisonNovaTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiPowerfullBiteTimer <= diff) - { - DoCast(me->getVictim(), SPELL_POWERFULL_BITE); - uiPowerfullBiteTimer = 10*IN_MILLISECONDS; - } else uiPowerfullBiteTimer -= diff; + if (uiPoisonNovaTimer <= diff) + { + DoCast(me->getVictim(), SPELL_POISON_NOVA); + uiPoisonNovaTimer = 15*IN_MILLISECONDS; + } else uiPoisonNovaTimer -= diff; - if (uiVenomBoltTimer <= diff) - { - DoCast(me->getVictim(), SPELL_VENOM_BOLT); - uiVenomBoltTimer = 10*IN_MILLISECONDS; - } else uiVenomBoltTimer -= diff; + if (uiPowerfullBiteTimer <= diff) + { + DoCast(me->getVictim(), SPELL_POWERFULL_BITE); + uiPowerfullBiteTimer = 10*IN_MILLISECONDS; + } else uiPowerfullBiteTimer -= diff; - if (uiPhase) - { - if (uiSpawnTimer <= diff) + if (uiVenomBoltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_VENOM_BOLT); + uiVenomBoltTimer = 10*IN_MILLISECONDS; + } else uiVenomBoltTimer -= diff; + + if (uiPhase) { - if (uiPhase == 1) - for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) - me->SummonCreature(CREATURE_SNAKE, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); - if (uiPhase == 2) - for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) - me->SummonCreature(CREATURE_CONSTRICTORS, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); - uiSpawnTimer = 5*IN_MILLISECONDS; - } else uiSpawnTimer -= diff; + if (uiSpawnTimer <= diff) + { + if (uiPhase == 1) + for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) + me->SummonCreature(CREATURE_SNAKE, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); + if (uiPhase == 2) + for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) + me->SummonCreature(CREATURE_CONSTRICTORS, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); + uiSpawnTimer = 5*IN_MILLISECONDS; + } else uiSpawnTimer -= diff; + } + + if (uiPhase == 0 && HealthBelowPct(30)) + { + DoScriptText(SAY_SUMMON_SNAKES,me); + uiPhase = 1; + } + + if (uiPhase == 1 && HealthBelowPct(25)) + { + DoScriptText(SAY_SUMMON_CONSTRICTORS,me); + uiPhase = 2; + } + + DoMeleeAttackIfReady(); } - if (uiPhase == 0 && HealthBelowPct(30)) + void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_SUMMON_SNAKES,me); - uiPhase = 1; + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_SLAD_RAN_EVENT, DONE); } - if (uiPhase == 1 && HealthBelowPct(25)) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(SAY_SUMMON_CONSTRICTORS,me); - uiPhase = 2; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void JustSummoned(Creature* summoned) + { + summoned->GetMotionMaster()->MovePoint(0,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ()); + lSummons.Summon(summoned); + } + }; - if (pInstance) - pInstance->SetData(DATA_SLAD_RAN_EVENT, DONE); - } +}; +
class mob_slad_ran_constrictor : public CreatureScript +{ +public: + mob_slad_ran_constrictor() : CreatureScript("mob_slad_ran_constrictor") { } - void KilledUnit(Unit * /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + return new mob_slad_ran_constrictorAI (pCreature); } - void JustSummoned(Creature* summoned) + struct mob_slad_ran_constrictorAI : public ScriptedAI { - summoned->GetMotionMaster()->MovePoint(0,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ()); - lSummons.Summon(summoned); - } -}; - -struct mob_slad_ran_constrictorAI : public ScriptedAI -{ - mob_slad_ran_constrictorAI(Creature *c) : ScriptedAI(c) {} + mob_slad_ran_constrictorAI(Creature *c) : ScriptedAI(c) {} - uint32 uiGripOfSladRanTimer; + uint32 uiGripOfSladRanTimer; - void Reset() - { - uiGripOfSladRanTimer = 1*IN_MILLISECONDS; - } + void Reset() + { + uiGripOfSladRanTimer = 1*IN_MILLISECONDS; + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (uiGripOfSladRanTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); - uiGripOfSladRanTimer = 5*IN_MILLISECONDS; - } else uiGripOfSladRanTimer -= diff; - } + if (!UpdateVictim()) + return; + if (uiGripOfSladRanTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); + uiGripOfSladRanTimer = 5*IN_MILLISECONDS; + } else uiGripOfSladRanTimer -= diff; + } - ScriptedInstance* pInstance; -}; + InstanceScript* pInstance; + }; -struct mob_slad_ran_viperAI : public ScriptedAI +}; +
class mob_slad_ran_viper : public CreatureScript { - mob_slad_ran_viperAI(Creature *c) : ScriptedAI(c) {} - - uint32 uiVenomousBiteTimer; - - ScriptedInstance* pInstance; +public: + mob_slad_ran_viper() : CreatureScript("mob_slad_ran_viper") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiVenomousBiteTimer = 2*IN_MILLISECONDS; + return new mob_slad_ran_viperAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_slad_ran_viperAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_slad_ran_viperAI(Creature *c) : ScriptedAI(c) {} - if (uiVenomousBiteTimer <= diff) + uint32 uiVenomousBiteTimer; + + InstanceScript* pInstance; + + void Reset() { - DoCast(me->getVictim(), SPELL_VENOMOUS_BITE); - uiVenomousBiteTimer = 10*IN_MILLISECONDS; - } else uiVenomousBiteTimer -= diff; - } + uiVenomousBiteTimer = 2*IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiVenomousBiteTimer <= diff) + { + DoCast(me->getVictim(), SPELL_VENOMOUS_BITE); + uiVenomousBiteTimer = 10*IN_MILLISECONDS; + } else uiVenomousBiteTimer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_slad_ran(Creature* pCreature) -{ - return new boss_slad_ranAI (pCreature); -} -CreatureAI* GetAI_mob_slad_ran_constrictor(Creature* pCreature) -{ - return new mob_slad_ran_constrictorAI (pCreature); -} -CreatureAI* GetAI_mob_slad_ran_viper(Creature* pCreature) -{ - return new mob_slad_ran_viperAI (pCreature); -} void AddSC_boss_slad_ran() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_slad_ran"; - newscript->GetAI = &GetAI_boss_slad_ran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_slad_ran_constrictor"; - newscript->GetAI = &GetAI_mob_slad_ran_constrictor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_slad_ran_viper"; - newscript->GetAI = &GetAI_mob_slad_ran_viper; - newscript->RegisterSelf(); + new boss_slad_ran(); + new mob_slad_ran_constrictor(); + new mob_slad_ran_viper(); } diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index 63bbb3f2f8b..ef9c45246ec 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -27,509 +27,514 @@ 3 - Gal'Darah 4 - Eck the Ferocious */ - -struct instance_gundrak : public ScriptedInstance +
class instance_gundrak : public InstanceMapScript { - instance_gundrak(Map* pMap) : ScriptedInstance(pMap) +public: + instance_gundrak() : InstanceMapScript("instance_gundrak") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - bHeroicMode = pMap->IsHeroic(); - Initialize(); - }; + return new instance_gundrak_InstanceMapScript(pMap); + } - bool bHeroicMode; - bool spawnSupport; - - uint32 timer; - uint32 phase; - uint64 toActivate; - - uint64 uiSladRan; - uint64 uiMoorabi; - uint64 uiDrakkariColossus; - uint64 uiGalDarah; - uint64 uiEckTheFerocious; - - uint64 uiSladRanAltar; - uint64 uiMoorabiAltar; - uint64 uiDrakkariColossusAltar; - uint64 uiSladRanStatue; - uint64 uiMoorabiStatue; - uint64 uiDrakkariColossusStatue; - uint64 uiGalDarahStatue; - uint64 uiEckTheFerociousDoor; - uint64 uiEckTheFerociousDoorBehind; - uint64 uiGalDarahDoor1; - uint64 uiGalDarahDoor2; - uint64 uiBridge; - uint64 uiCollision; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - GOState uiSladRanStatueState; - GOState uiMoorabiStatueState; - GOState uiDrakkariColossusStatueState; - GOState uiGalDarahStatueState; - GOState uiBridgeState; - GOState uiCollisionState; - - std::set<uint64> DwellerGUIDs; - - std::string str_data; - - void Initialize() + struct instance_gundrak_InstanceMapScript : public InstanceScript { - spawnSupport = false; + instance_gundrak_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + bHeroicMode = pMap->IsHeroic(); + Initialize(); + }; + + bool bHeroicMode; + bool spawnSupport; + + uint32 timer; + uint32 phase; + uint64 toActivate; + + uint64 uiSladRan; + uint64 uiMoorabi; + uint64 uiDrakkariColossus; + uint64 uiGalDarah; + uint64 uiEckTheFerocious; + + uint64 uiSladRanAltar; + uint64 uiMoorabiAltar; + uint64 uiDrakkariColossusAltar; + uint64 uiSladRanStatue; + uint64 uiMoorabiStatue; + uint64 uiDrakkariColossusStatue; + uint64 uiGalDarahStatue; + uint64 uiEckTheFerociousDoor; + uint64 uiEckTheFerociousDoorBehind; + uint64 uiGalDarahDoor1; + uint64 uiGalDarahDoor2; + uint64 uiBridge; + uint64 uiCollision; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + GOState uiSladRanStatueState; + GOState uiMoorabiStatueState; + GOState uiDrakkariColossusStatueState; + GOState uiGalDarahStatueState; + GOState uiBridgeState; + GOState uiCollisionState; + + std::set<uint64> DwellerGUIDs; + + std::string str_data; + + void Initialize() + { + spawnSupport = false; - timer = 0; - phase = 0; - toActivate = 0; + timer = 0; + phase = 0; + toActivate = 0; - uiSladRan = 0; - uiMoorabi = 0; - uiDrakkariColossus = 0; - uiGalDarah = 0; - uiEckTheFerocious = 0; + uiSladRan = 0; + uiMoorabi = 0; + uiDrakkariColossus = 0; + uiGalDarah = 0; + uiEckTheFerocious = 0; - uiSladRanAltar = 0; - uiMoorabiAltar = 0; - uiDrakkariColossusAltar = 0; + uiSladRanAltar = 0; + uiMoorabiAltar = 0; + uiDrakkariColossusAltar = 0; - uiSladRanStatue = 0; - uiMoorabiStatue = 0; - uiDrakkariColossusStatue = 0; - uiGalDarahStatue = 0; + uiSladRanStatue = 0; + uiMoorabiStatue = 0; + uiDrakkariColossusStatue = 0; + uiGalDarahStatue = 0; - uiEckTheFerociousDoor = 0; - uiEckTheFerociousDoorBehind = 0; - uiGalDarahDoor1 = 0; - uiGalDarahDoor2 = 0; + uiEckTheFerociousDoor = 0; + uiEckTheFerociousDoorBehind = 0; + uiGalDarahDoor1 = 0; + uiGalDarahDoor2 = 0; - uiBridge = 0; - uiCollision = 0; + uiBridge = 0; + uiCollision = 0; - uiSladRanStatueState = GO_STATE_ACTIVE; - uiMoorabiStatueState = GO_STATE_ACTIVE; - uiDrakkariColossusStatueState = GO_STATE_ACTIVE; - uiGalDarahStatueState = GO_STATE_READY; - uiBridgeState = GO_STATE_ACTIVE; - uiCollisionState = GO_STATE_READY; + uiSladRanStatueState = GO_STATE_ACTIVE; + uiMoorabiStatueState = GO_STATE_ACTIVE; + uiDrakkariColossusStatueState = GO_STATE_ACTIVE; + uiGalDarahStatueState = GO_STATE_READY; + uiBridgeState = GO_STATE_ACTIVE; + uiCollisionState = GO_STATE_READY; - DwellerGUIDs.clear(); + DwellerGUIDs.clear(); - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; - } + return false; + } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case CREATURE_SLAD_RAN: uiSladRan = pCreature->GetGUID(); break; - case CREATURE_MOORABI: uiMoorabi = pCreature->GetGUID(); break; - case CREATURE_GALDARAH: uiGalDarah = pCreature->GetGUID(); break; - case CREATURE_DRAKKARICOLOSSUS: uiDrakkariColossus = pCreature->GetGUID(); break; - case CREATURE_ECK: uiEckTheFerocious = pCreature->GetGUID(); break; - case CREATURE_RUIN_DWELLER: - if (pCreature->isAlive()) - DwellerGUIDs.insert(pCreature->GetGUID()); - break; + switch(pCreature->GetEntry()) + { + case CREATURE_SLAD_RAN: uiSladRan = pCreature->GetGUID(); break; + case CREATURE_MOORABI: uiMoorabi = pCreature->GetGUID(); break; + case CREATURE_GALDARAH: uiGalDarah = pCreature->GetGUID(); break; + case CREATURE_DRAKKARICOLOSSUS: uiDrakkariColossus = pCreature->GetGUID(); break; + case CREATURE_ECK: uiEckTheFerocious = pCreature->GetGUID(); break; + case CREATURE_RUIN_DWELLER: + if (pCreature->isAlive()) + DwellerGUIDs.insert(pCreature->GetGUID()); + break; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 192518: - uiSladRanAltar = pGo->GetGUID(); - // Make sure that they start out as unusuable - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (m_auiEncounter[0] == DONE) - { - if (uiSladRanStatueState == GO_STATE_ACTIVE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - else + switch(pGo->GetEntry()) + { + case 192518: + uiSladRanAltar = pGo->GetGUID(); + // Make sure that they start out as unusuable + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (m_auiEncounter[0] == DONE) { - ++phase; - pGo->SetGoState(GO_STATE_ACTIVE); + if (uiSladRanStatueState == GO_STATE_ACTIVE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + else + { + ++phase; + pGo->SetGoState(GO_STATE_ACTIVE); + } } - } - break; - case 192519: - uiMoorabiAltar = pGo->GetGUID(); - // Make sure that they start out as unusuable - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (m_auiEncounter[0] == DONE) - { - if (uiMoorabiStatueState == GO_STATE_ACTIVE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - else + break; + case 192519: + uiMoorabiAltar = pGo->GetGUID(); + // Make sure that they start out as unusuable + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (m_auiEncounter[0] == DONE) { - ++phase; - pGo->SetGoState(GO_STATE_ACTIVE); + if (uiMoorabiStatueState == GO_STATE_ACTIVE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + else + { + ++phase; + pGo->SetGoState(GO_STATE_ACTIVE); + } } - } - break; - case 192520: - uiDrakkariColossusAltar = pGo->GetGUID(); - // Make sure that they start out as unusuable - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (m_auiEncounter[0] == DONE) - { - if (uiDrakkariColossusStatueState == GO_STATE_ACTIVE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - else + break; + case 192520: + uiDrakkariColossusAltar = pGo->GetGUID(); + // Make sure that they start out as unusuable + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (m_auiEncounter[0] == DONE) { - ++phase; - pGo->SetGoState(GO_STATE_ACTIVE); + if (uiDrakkariColossusStatueState == GO_STATE_ACTIVE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + else + { + ++phase; + pGo->SetGoState(GO_STATE_ACTIVE); + } } + break; + case 192564: + uiSladRanStatue = pGo->GetGUID(); + pGo->SetGoState(uiSladRanStatueState); + break; + case 192565: + uiMoorabiStatue = pGo->GetGUID(); + pGo->SetGoState(uiMoorabiStatueState); + break; + case 192566: + uiGalDarahStatue = pGo->GetGUID(); + pGo->SetGoState(uiGalDarahStatueState); + break; + case 192567: + uiDrakkariColossusStatue = pGo->GetGUID(); + pGo->SetGoState(uiDrakkariColossusStatueState); + break; + case 192632: + uiEckTheFerociousDoor = pGo->GetGUID(); + if (bHeroicMode && m_auiEncounter[1] == DONE) + HandleGameObject(NULL,true,pGo); + break; + case 192569: + uiEckTheFerociousDoorBehind = pGo->GetGUID(); + if (bHeroicMode && m_auiEncounter[4] == DONE) + HandleGameObject(NULL,true,pGo); + case 193208: + uiGalDarahDoor1 = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL,true,pGo); + break; + case 193209: + uiGalDarahDoor2 = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL,true,pGo); + break; + case 193188: + uiBridge = pGo->GetGUID(); + pGo->SetGoState(uiBridgeState); + break; + case 192633: + uiCollision = pGo->GetGUID(); + pGo->SetGoState(uiCollisionState); + + // Can't spawn here with SpawnGameObject because pGo isn't added to world yet... + if (uiCollisionState == GO_STATE_ACTIVE_ALTERNATIVE) + spawnSupport = true; + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_SLAD_RAN_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + { + GameObject* pGo = instance->GetGameObject(uiSladRanAltar); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); } break; - case 192564: - uiSladRanStatue = pGo->GetGUID(); - pGo->SetGoState(uiSladRanStatueState); - break; - case 192565: - uiMoorabiStatue = pGo->GetGUID(); - pGo->SetGoState(uiMoorabiStatueState); - break; - case 192566: - uiGalDarahStatue = pGo->GetGUID(); - pGo->SetGoState(uiGalDarahStatueState); - break; - case 192567: - uiDrakkariColossusStatue = pGo->GetGUID(); - pGo->SetGoState(uiDrakkariColossusStatueState); - break; - case 192632: - uiEckTheFerociousDoor = pGo->GetGUID(); - if (bHeroicMode && m_auiEncounter[1] == DONE) - HandleGameObject(NULL,true,pGo); - break; - case 192569: - uiEckTheFerociousDoorBehind = pGo->GetGUID(); - if (bHeroicMode && m_auiEncounter[4] == DONE) - HandleGameObject(NULL,true,pGo); - case 193208: - uiGalDarahDoor1 = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(NULL,true,pGo); + case DATA_MOORABI_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) + { + GameObject* pGo = instance->GetGameObject(uiMoorabiAltar); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (bHeroicMode) + HandleGameObject(uiEckTheFerociousDoor,true); + } break; - case 193209: - uiGalDarahDoor2 = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(NULL,true,pGo); + case DATA_DRAKKARI_COLOSSUS_EVENT: + m_auiEncounter[2] = data; + if (data == DONE) + { + GameObject* pGo = instance->GetGameObject(uiDrakkariColossusAltar); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + } break; - case 193188: - uiBridge = pGo->GetGUID(); - pGo->SetGoState(uiBridgeState); + case DATA_GAL_DARAH_EVENT: + m_auiEncounter[3] = data; + if (data == DONE) + { + HandleGameObject(uiGalDarahDoor1,true); + HandleGameObject(uiGalDarahDoor2,true); + } break; - case 192633: - uiCollision = pGo->GetGUID(); - pGo->SetGoState(uiCollisionState); - - // Can't spawn here with SpawnGameObject because pGo isn't added to world yet... - if (uiCollisionState == GO_STATE_ACTIVE_ALTERNATIVE) - spawnSupport = true; + case DATA_ECK_THE_FEROCIOUS_EVENT: + m_auiEncounter[4] = data; + if (bHeroicMode && data == DONE) + HandleGameObject(uiEckTheFerociousDoorBehind,true); break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_SLAD_RAN_EVENT: - m_auiEncounter[0] = data; - if (data == DONE) - { - GameObject* pGo = instance->GetGameObject(uiSladRanAltar); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - } - break; - case DATA_MOORABI_EVENT: - m_auiEncounter[1] = data; - if (data == DONE) - { - GameObject* pGo = instance->GetGameObject(uiMoorabiAltar); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (bHeroicMode) - HandleGameObject(uiEckTheFerociousDoor,true); - } - break; - case DATA_DRAKKARI_COLOSSUS_EVENT: - m_auiEncounter[2] = data; - if (data == DONE) - { - GameObject* pGo = instance->GetGameObject(uiDrakkariColossusAltar); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); } - break; - case DATA_GAL_DARAH_EVENT: - m_auiEncounter[3] = data; + if (data == DONE) - { - HandleGameObject(uiGalDarahDoor1,true); - HandleGameObject(uiGalDarahDoor2,true); - } - break; - case DATA_ECK_THE_FEROCIOUS_EVENT: - m_auiEncounter[4] = data; - if (bHeroicMode && data == DONE) - HandleGameObject(uiEckTheFerociousDoorBehind,true); - break; + SaveToDB(); } - if (data == DONE) - SaveToDB(); - } - - void SetData64(uint32 type, uint64 data) - { - if (type == DATA_RUIN_DWELLER_DIED) - DwellerGUIDs.erase(data); - } - - uint32 GetData(uint32 type) - { - switch(type) + void SetData64(uint32 type, uint64 data) { - case DATA_SLAD_RAN_EVENT: return m_auiEncounter[0]; - case DATA_MOORABI_EVENT: return m_auiEncounter[1]; - case DATA_GAL_DARAH_EVENT: return m_auiEncounter[2]; - case DATA_DRAKKARI_COLOSSUS_EVENT: return m_auiEncounter[3]; - case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4]; - case DATA_ALIVE_RUIN_DWELLERS: return DwellerGUIDs.size(); + if (type == DATA_RUIN_DWELLER_DIED) + DwellerGUIDs.erase(data); } - return 0; - } - - uint64 GetData64(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_SLAD_RAN_ALTAR: return uiSladRanAltar; - case DATA_MOORABI_ALTAR: return uiMoorabiAltar; - case DATA_DRAKKARI_COLOSSUS_ALTAR: return uiDrakkariColossusAltar; - case DATA_SLAD_RAN_STATUE: return uiSladRanStatue; - case DATA_MOORABI_STATUE: return uiMoorabiStatue; - case DATA_DRAKKARI_COLOSSUS_STATUE: return uiDrakkariColossusStatue; - case DATA_DRAKKARI_COLOSSUS: return uiDrakkariColossus; + switch(type) + { + case DATA_SLAD_RAN_EVENT: return m_auiEncounter[0]; + case DATA_MOORABI_EVENT: return m_auiEncounter[1]; + case DATA_GAL_DARAH_EVENT: return m_auiEncounter[2]; + case DATA_DRAKKARI_COLOSSUS_EVENT: return m_auiEncounter[3]; + case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4]; + case DATA_ALIVE_RUIN_DWELLERS: return DwellerGUIDs.size(); + } + + return 0; } - return 0; - } + uint64 GetData64(uint32 type) + { + switch(type) + { + case DATA_SLAD_RAN_ALTAR: return uiSladRanAltar; + case DATA_MOORABI_ALTAR: return uiMoorabiAltar; + case DATA_DRAKKARI_COLOSSUS_ALTAR: return uiDrakkariColossusAltar; + case DATA_SLAD_RAN_STATUE: return uiSladRanStatue; + case DATA_MOORABI_STATUE: return uiMoorabiStatue; + case DATA_DRAKKARI_COLOSSUS_STATUE: return uiDrakkariColossusStatue; + case DATA_DRAKKARI_COLOSSUS: return uiDrakkariColossus; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + return 0; + } - std::ostringstream saveStream; - saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " - << (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << " " << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << " " - << (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << " " << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << " " - << (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << " " << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY); + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream saveStream; + saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " + << (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << " " << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << " " + << (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << " " << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << " " + << (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << " " << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY); - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + str_data = saveStream.str(); - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; } - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10; + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 - >> data4 >> data5 >> data6 >> data7 >> data8 >> data9 >> data10; + OUT_LOAD_INST_DATA(in); - if (dataHead1 == 'G' && dataHead2 == 'D') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; - uiSladRanStatueState = GOState(data5); - uiMoorabiStatueState = GOState(data6); - uiDrakkariColossusStatueState = GOState(data7); - uiGalDarahStatueState = GOState(data8); - uiBridgeState = GOState(data9); - uiCollisionState = GOState(data10); + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 + >> data4 >> data5 >> data6 >> data7 >> data8 >> data9 >> data10; - OUT_LOAD_INST_DATA_COMPLETE; - } + if (dataHead1 == 'G' && dataHead2 == 'D') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; + uiSladRanStatueState = GOState(data5); + uiMoorabiStatueState = GOState(data6); + uiDrakkariColossusStatueState = GOState(data7); + uiGalDarahStatueState = GOState(data8); + uiBridgeState = GOState(data9); + uiCollisionState = GOState(data10); + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } - bool QueueActivation(uint64 guid, uint32 time) - { - if (timer) - return false; - - toActivate = guid; - timer = time; - phase++; - return true; - } - - void Update(uint32 diff) - { - // Spawn the support for the bridge if necessary - if (spawnSupport) + bool QueueActivation(uint64 guid, uint32 time) { - if (GameObject* pCollision = instance->GetGameObject(uiCollision)) - pCollision->SummonGameObject(192743, pCollision->GetPositionX(), pCollision->GetPositionY(), pCollision->GetPositionZ(), pCollision->GetOrientation(), 0, 0, 0, 0, 0); - spawnSupport = false; - } + if (timer) + return false; - // If there is nothing to activate, then return - if (!toActivate) - return; + toActivate = guid; + timer = time; + phase++; + return true; + } - if (timer < diff) + void Update(uint32 diff) { - timer = 0; - if (toActivate == uiBridge) + // Spawn the support for the bridge if necessary + if (spawnSupport) { - toActivate = 0; - GameObject* pBridge = instance->GetGameObject(uiBridge); - GameObject* pCollision = instance->GetGameObject(uiCollision); - GameObject* pSladRanStatue = instance->GetGameObject(uiSladRanStatue); - GameObject* pMoorabiStatue = instance->GetGameObject(uiMoorabiStatue); - GameObject* pDrakkariColossusStatue = instance->GetGameObject(uiDrakkariColossusStatue); - GameObject* pGalDarahStatue = instance->GetGameObject(uiGalDarahStatue); - - if (pBridge && pCollision && pSladRanStatue && pMoorabiStatue && pDrakkariColossusStatue && pGalDarahStatue) - { - pBridge->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pCollision->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pSladRanStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pMoorabiStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pDrakkariColossusStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pGalDarahStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - - // Add the GO that solidifies the bridge so you can walk on it - spawnSupport = true; - SaveToDB(); - } + if (GameObject* pCollision = instance->GetGameObject(uiCollision)) + pCollision->SummonGameObject(192743, pCollision->GetPositionX(), pCollision->GetPositionY(), pCollision->GetPositionZ(), pCollision->GetOrientation(), 0, 0, 0, 0, 0); + spawnSupport = false; } - else + + // If there is nothing to activate, then return + if (!toActivate) + return; + + if (timer < diff) { - uint32 spell = 0; - GameObject* pAltar = NULL; - if (toActivate == uiSladRanStatue) - { - spell = 57071; - pAltar = instance->GetGameObject(uiSladRanAltar); - } else if (toActivate == uiMoorabiStatue) + timer = 0; + if (toActivate == uiBridge) { - spell = 57068; - pAltar = instance->GetGameObject(uiMoorabiAltar); - } else if (toActivate == uiDrakkariColossusStatue) - { - spell = 57072; - pAltar = instance->GetGameObject(uiDrakkariColossusAltar); + toActivate = 0; + GameObject* pBridge = instance->GetGameObject(uiBridge); + GameObject* pCollision = instance->GetGameObject(uiCollision); + GameObject* pSladRanStatue = instance->GetGameObject(uiSladRanStatue); + GameObject* pMoorabiStatue = instance->GetGameObject(uiMoorabiStatue); + GameObject* pDrakkariColossusStatue = instance->GetGameObject(uiDrakkariColossusStatue); + GameObject* pGalDarahStatue = instance->GetGameObject(uiGalDarahStatue); + + if (pBridge && pCollision && pSladRanStatue && pMoorabiStatue && pDrakkariColossusStatue && pGalDarahStatue) + { + pBridge->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pCollision->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pSladRanStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pMoorabiStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pDrakkariColossusStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pGalDarahStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + + // Add the GO that solidifies the bridge so you can walk on it + spawnSupport = true; + SaveToDB(); + } } - - // This is a workaround to make the beam cast properly. The caster should be ID 30298 but since the spells - // all are with scripted target for that same ID, it will hit itself. - if (pAltar) - if (Creature* trigger = pAltar->SummonCreature(18721, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ() + 3, pAltar->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 5000)) + else + { + uint32 spell = 0; + GameObject* pAltar = NULL; + if (toActivate == uiSladRanStatue) + { + spell = 57071; + pAltar = instance->GetGameObject(uiSladRanAltar); + } else if (toActivate == uiMoorabiStatue) { - // Set the trigger model to invisible - trigger->SetDisplayId(11686); - trigger->CastSpell(trigger, spell, false); + spell = 57068; + pAltar = instance->GetGameObject(uiMoorabiAltar); + } else if (toActivate == uiDrakkariColossusStatue) + { + spell = 57072; + pAltar = instance->GetGameObject(uiDrakkariColossusAltar); } - if (GameObject* statueGO = instance->GetGameObject(toActivate)) - statueGO->SetGoState(GO_STATE_READY); - - toActivate = 0; + // This is a workaround to make the beam cast properly. The caster should be ID 30298 but since the spells + // all are with scripted target for that same ID, it will hit itself. + if (pAltar) + if (Creature* trigger = pAltar->SummonCreature(18721, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ() + 3, pAltar->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 5000)) + { + // Set the trigger model to invisible + trigger->SetDisplayId(11686); + trigger->CastSpell(trigger, spell, false); + } + + if (GameObject* statueGO = instance->GetGameObject(toActivate)) + statueGO->SetGoState(GO_STATE_READY); + + toActivate = 0; + + if (phase == 3) + QueueActivation(uiBridge, 3000); + else + SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance + } + } else timer -= diff; + } - if (phase == 3) - QueueActivation(uiBridge, 3000); - else - SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance - } - } else timer -= diff; - } + GOState GetObjState(uint64 guid) + { + if (GameObject* go = instance->GetGameObject(guid)) + return go->GetGoState(); + return GO_STATE_ACTIVE; + } + }; - GOState GetObjState(uint64 guid) - { - if (GameObject* go = instance->GetGameObject(guid)) - return go->GetGoState(); - return GO_STATE_ACTIVE; - } }; - -bool GOHello_altar(Player * /*pPlayer*/, GameObject *pGO) +
class go_gundrak_altar : public GameObjectScript { - ScriptedInstance *pInstance = pGO->GetInstanceData(); - uint64 uiStatue = 0; - - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); +public: + go_gundrak_altar() : GameObjectScript("go_gundrak_altar") { } - if (pInstance) + bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { - switch(pGO->GetEntry()) - { - case 192518: uiStatue = pInstance->GetData64(DATA_SLAD_RAN_STATUE); break; - case 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break; - case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); break; - } - if (CAST_INST(instance_gundrak, pInstance)->QueueActivation(uiStatue, 3500)) + InstanceScript *pInstance = pGO->GetInstanceScript(); + uint64 uiStatue = 0; + + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + + if (pInstance) { - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); + switch(pGO->GetEntry()) + { + case 192518: uiStatue = pInstance->GetData64(DATA_SLAD_RAN_STATUE); break; + case 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break; + case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); break; + } + if (CAST_INST(instance_gundrak::instance_gundrak_InstanceMapScript, pInstance)->QueueActivation(uiStatue, 3500)) + { + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + } + return true; } - return true; + return false; } - return false; -} -InstanceData* GetInstanceData_instance_gundrak(Map* pMap) -{ - return new instance_gundrak(pMap); -} +}; + void AddSC_instance_gundrak() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_gundrak"; - newscript->GetInstanceData = &GetInstanceData_instance_gundrak; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_gundrak_altar"; - newscript->pGOHello = &GOHello_altar; - newscript->RegisterSelf(); + new instance_gundrak(); + new go_gundrak_altar(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 567f1f01c4d..4af58272127 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -50,137 +50,140 @@ enum { ACHIEV_TIMED_START_EVENT = 9891, }; - -struct boss_anubrekhanAI : public BossAI +
class boss_anubrekhan : public CreatureScript { - boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) {} +public: + boss_anubrekhan() : CreatureScript("boss_anubrekhan") { } - bool hasTaunted; + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_anubrekhanAI (pCreature); + } - void Reset() + struct boss_anubrekhanAI : public BossAI { - _Reset(); + boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) {} - hasTaunted = false; + bool hasTaunted; - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + void Reset() { - Position pos; + _Reset(); - // respawn guard using home position, - // otherwise, after a wipe, they respawn where boss was at wipe moment. - pos = me->GetHomePosition(); - pos.m_positionY -= 10.0f; - me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); + hasTaunted = false; + + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + { + Position pos; - pos = me->GetHomePosition(); - pos.m_positionY += 10.0f; - me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); + // respawn guard using home position, + // otherwise, after a wipe, they respawn where boss was at wipe moment. + pos = me->GetHomePosition(); + pos.m_positionY -= 10.0f; + me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); + + pos = me->GetHomePosition(); + pos.m_positionY += 10.0f; + me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); + } } - } - void KilledUnit(Unit* victim) - { - //Force the player to spawn corpse scarabs via spell, TODO: Check percent chance for scarabs, 20% at the moment - if (!(rand()%5)) - if (victim->GetTypeId() == TYPEID_PLAYER) - victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, NULL, NULL, me->GetGUID()); + void KilledUnit(Unit* victim) + { + //Force the player to spawn corpse scarabs via spell, TODO: Check percent chance for scarabs, 20% at the moment + if (!(rand()%5)) + if (victim->GetTypeId() == TYPEID_PLAYER) + victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, NULL, NULL, me->GetGUID()); - DoScriptText(SAY_SLAY, me); - } + DoScriptText(SAY_SLAY, me); + } - void JustDied(Unit *) - { - _JustDied(); + void JustDied(Unit *) + { + _JustDied(); - // start achievement timer (kill Maexna within 20 min) - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoScriptText(SAY_AGGRO, me); - events.ScheduleEvent(EVENT_IMPALE, 10000 + rand()%10000); - events.ScheduleEvent(EVENT_LOCUST, 90000); - events.ScheduleEvent(EVENT_BERSERK, 600000); - - if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) - events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000,20000)); - } + // start achievement timer (kill Maexna within 20 min) + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoScriptText(SAY_AGGRO, me); + events.ScheduleEvent(EVENT_IMPALE, 10000 + rand()%10000); + events.ScheduleEvent(EVENT_LOCUST, 90000); + events.ScheduleEvent(EVENT_BERSERK, 600000); + + if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000,20000)); + } - void MoveInLineOfSight(Unit *who) - { - if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f) && who->GetTypeId() == TYPEID_PLAYER) + void MoveInLineOfSight(Unit *who) { - DoScriptText(SAY_GREET, me); - hasTaunted = true; + if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f) && who->GetTypeId() == TYPEID_PLAYER) + { + DoScriptText(SAY_GREET, me); + hasTaunted = true; + } + ScriptedAI::MoveInLineOfSight(who); } - ScriptedAI::MoveInLineOfSight(who); - } - void SummonedCreatureDespawn(Creature *summon) - { - BossAI::SummonedCreatureDespawn(summon); + void SummonedCreatureDespawn(Creature *summon) + { + BossAI::SummonedCreatureDespawn(summon); - // check if it is an actual killed guard - if (!me->isAlive() || summon->isAlive() || summon->GetEntry() != MOB_CRYPT_GUARD) - return; + // check if it is an actual killed guard + if (!me->isAlive() || summon->isAlive() || summon->GetEntry() != MOB_CRYPT_GUARD) + return; - summon->CastSpell(summon, SPELL_SUMMON_CORPSE_SCARABS_MOB, true, NULL, NULL, me->GetGUID()); - } + summon->CastSpell(summon, SPELL_SUMMON_CORPSE_SCARABS_MOB, true, NULL, NULL, me->GetGUID()); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_IMPALE: - //Cast Impale on a random target - //Do NOT cast it when we are afflicted by locust swarm - if (!me->HasAura(RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25))) - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_IMPALE_10,SPELL_IMPALE_25)); - events.ScheduleEvent(EVENT_IMPALE, urand(10000,20000)); - break; - case EVENT_LOCUST: - // TODO : Add Text - DoCast(me, RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25)); - DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); - events.ScheduleEvent(EVENT_LOCUST, 90000); - break; - case EVENT_SPAWN_GUARDIAN_NORMAL: - // TODO : Add Text - DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); - break; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK, true); - events.ScheduleEvent(EVENT_BERSERK, 600000); - break; + switch(eventId) + { + case EVENT_IMPALE: + //Cast Impale on a random target + //Do NOT cast it when we are afflicted by locust swarm + if (!me->HasAura(RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25))) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_IMPALE_10,SPELL_IMPALE_25)); + events.ScheduleEvent(EVENT_IMPALE, urand(10000,20000)); + break; + case EVENT_LOCUST: + // TODO : Add Text + DoCast(me, RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25)); + DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); + events.ScheduleEvent(EVENT_LOCUST, 90000); + break; + case EVENT_SPAWN_GUARDIAN_NORMAL: + // TODO : Add Text + DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); + break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK, true); + events.ScheduleEvent(EVENT_BERSERK, 600000); + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_anubrekhan(Creature* pCreature) -{ - return new boss_anubrekhanAI (pCreature); -} void AddSC_boss_anubrekhan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_anubrekhan"; - newscript->GetAI = &GetAI_boss_anubrekhan; - newscript->RegisterSelf(); + new boss_anubrekhan(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index b6a3760e6b6..a2513e5173a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -56,162 +56,166 @@ enum Achievements ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_10 = 1997, ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_25 = 2140 }; - -struct boss_faerlinaAI : public BossAI +
class boss_faerlina : public CreatureScript { - boss_faerlinaAI(Creature *c) : BossAI(c, BOSS_FAERLINA), greet(false) {} - - bool greet; - bool doDelayFrenzy; - bool bAchievement; +public: + boss_faerlina() : CreatureScript("boss_faerlina") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3,SAY_AGGRO_4), me); - events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); - events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); - events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); + return new boss_faerlinaAI (pCreature); } - void Reset() + struct boss_faerlinaAI : public BossAI { - doDelayFrenzy = false; - bAchievement = true; - _Reset(); - } + boss_faerlinaAI(Creature *c) : BossAI(c, BOSS_FAERLINA), greet(false) {} - void MoveInLineOfSight(Unit *who) - { - if (!greet && who->GetTypeId() == TYPEID_PLAYER) + bool greet; + bool doDelayFrenzy; + bool bAchievement; + + void EnterCombat(Unit * /*who*/) { - DoScriptText(SAY_GREET, me); - greet = true; + _EnterCombat(); + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3,SAY_AGGRO_4), me); + events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); + events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); + events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); } - BossAI::MoveInLineOfSight(who); - } - - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%3)) - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - if (instance && bAchievement) - instance->DoCompleteAchievement(RAID_MODE(ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_10,ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_25)); - } + void Reset() + { + doDelayFrenzy = false; + bAchievement = true; + _Reset(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void MoveInLineOfSight(Unit *who) + { + if (!greet && who->GetTypeId() == TYPEID_PLAYER) + { + DoScriptText(SAY_GREET, me); + greet = true; + } + BossAI::MoveInLineOfSight(who); + } - if (doDelayFrenzy && !me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE, H_SPELL_WIDOWS_EMBRACE))) + void KilledUnit(Unit* /*victim*/) { - doDelayFrenzy = false; - DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY), true); + if (!(rand()%3)) + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - events.Update(diff); + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (instance && bAchievement) + instance->DoCompleteAchievement(RAID_MODE(ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_10,ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_25)); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + if (doDelayFrenzy && !me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE, H_SPELL_WIDOWS_EMBRACE))) { - case EVENT_POISON: - if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) - DoCastAOE(RAID_MODE(SPELL_POISON_BOLT_VOLLEY,H_SPELL_POISON_BOLT_VOLLEY)); - events.ScheduleEvent(EVENT_POISON, urand(8000,15000)); - break; - case EVENT_FIRE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_RAIN_OF_FIRE, H_SPELL_RAIN_OF_FIRE)); - events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); - break; - case EVENT_FRENZY: - // TODO : Add Text - if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) - DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY)); - else - doDelayFrenzy = true; - - events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); - break; + doDelayFrenzy = false; + DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY), true); } - } - DoMeleeAttackIfReady(); - } + events.Update(diff); - void SpellHit(Unit* caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_WIDOWS_EMBRACE || spell->Id == H_SPELL_WIDOWS_EMBRACE) + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_POISON: + if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) + DoCastAOE(RAID_MODE(SPELL_POISON_BOLT_VOLLEY,H_SPELL_POISON_BOLT_VOLLEY)); + events.ScheduleEvent(EVENT_POISON, urand(8000,15000)); + break; + case EVENT_FIRE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_RAIN_OF_FIRE, H_SPELL_RAIN_OF_FIRE)); + events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); + break; + case EVENT_FRENZY: + // TODO : Add Text + if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) + DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY)); + else + doDelayFrenzy = true; + + events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); + break; + } + } + + DoMeleeAttackIfReady(); + } + + void SpellHit(Unit* caster, const SpellEntry *spell) { - // TODO : Add Text - bAchievement = false; - doDelayFrenzy = true; - me->Kill(caster); + if (spell->Id == SPELL_WIDOWS_EMBRACE || spell->Id == H_SPELL_WIDOWS_EMBRACE) + { + // TODO : Add Text + bAchievement = false; + doDelayFrenzy = true; + me->Kill(caster); + } } - } + }; + }; -CreatureAI* GetAI_boss_faerlina(Creature* pCreature) +
class mob_faerlina_add : public CreatureScript { - return new boss_faerlinaAI (pCreature); -} +public: + mob_faerlina_add() : CreatureScript("mob_faerlina_add") { } -struct mob_faerlina_addAI : public ScriptedAI -{ - mob_faerlina_addAI(Creature* pCreature) : ScriptedAI(pCreature) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_faerlina_addAI (pCreature); } - ScriptedInstance *pInstance; - - void Reset() + struct mob_faerlina_addAI : public ScriptedAI { - if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, SPELL_EFFECT_BIND, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); + mob_faerlina_addAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); } - } - void JustDied(Unit * /*killer*/) - { - if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + InstanceScript *pInstance; + + void Reset() { - if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) - DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); + if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, SPELL_EFFECT_BIND, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); + } } - } + + void JustDied(Unit * /*killer*/) + { + if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + { + if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) + DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); + } + } + }; + }; -CreatureAI* GetAI_mob_faerlina_add(Creature* pCreature) -{ - return new mob_faerlina_addAI (pCreature); -} void AddSC_boss_faerlina() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_faerlina"; - newscript->GetAI = &GetAI_boss_faerlina; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_faerlina_add"; - newscript->GetAI = &GetAI_mob_faerlina_add; - newscript->RegisterSelf(); + new boss_faerlina(); + new mob_faerlina_add(); } - - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 0313f9eb893..73647bc4f21 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -76,323 +76,325 @@ const int32 SAY_DEATH[] = {-1533057, -1533050, -1533074, -1533064}; #define SAY_BARON_AGGRO RAND(-1533065,-1533066,-1533067) #define SAY_BARON_SLAY RAND(-1533068,-1533069) - -struct boss_four_horsemenAI : public BossAI +
class boss_four_horsemen : public CreatureScript { - boss_four_horsemenAI(Creature *c) : BossAI(c, BOSS_HORSEMEN) - { - id = Horsemen(0); - for (uint8 i = 0; i < 4; ++i) - if (me->GetEntry() == MOB_HORSEMEN[i]) - id = Horsemen(i); - caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); - } +public: + boss_four_horsemen() : CreatureScript("boss_four_horsemen") { } - Horsemen id; - uint64 uiEventStarterGUID; - uint8 nextWP; - uint32 punishTimer; - bool caster; - bool nextMovementStarted; - bool movementCompleted; - bool movementStarted; - bool encounterActionAttack; - bool encounterActionReset; - bool doDelayPunish; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!encounterActionReset) - DoEncounterAction(NULL, false, true, false); - - if (instance) - instance->SetData(DATA_HORSEMEN0 + id, NOT_STARTED); - - me->SetReactState(REACT_AGGRESSIVE); - uiEventStarterGUID = 0; - nextWP = 0; - punishTimer = 2000; - nextMovementStarted = false; - movementCompleted = false; - movementStarted = false; - encounterActionAttack = false; - encounterActionReset = false; - doDelayPunish = false; - _Reset(); + return new boss_four_horsemenAI (pCreature); } - bool DoEncounterAction(Unit *who, bool attack, bool reset, bool checkAllDead) + struct boss_four_horsemenAI : public BossAI { - if (!instance) - return false; + boss_four_horsemenAI(Creature *c) : BossAI(c, BOSS_HORSEMEN) + { + id = Horsemen(0); + for (uint8 i = 0; i < 4; ++i) + if (me->GetEntry() == MOB_HORSEMEN[i]) + id = Horsemen(i); + caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); + } + + Horsemen id; + uint64 uiEventStarterGUID; + uint8 nextWP; + uint32 punishTimer; + bool caster; + bool nextMovementStarted; + bool movementCompleted; + bool movementStarted; + bool encounterActionAttack; + bool encounterActionReset; + bool doDelayPunish; + + void Reset() + { + if (!encounterActionReset) + DoEncounterAction(NULL, false, true, false); - Creature *Thane = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_THANE))); - Creature *Lady = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_LADY))); - Creature *Baron = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_BARON))); - Creature *Sir = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_SIR))); + if (instance) + instance->SetData(DATA_HORSEMEN0 + id, NOT_STARTED); - if (Thane && Lady && Baron && Sir) + me->SetReactState(REACT_AGGRESSIVE); + uiEventStarterGUID = 0; + nextWP = 0; + punishTimer = 2000; + nextMovementStarted = false; + movementCompleted = false; + movementStarted = false; + encounterActionAttack = false; + encounterActionReset = false; + doDelayPunish = false; + _Reset(); + } + + bool DoEncounterAction(Unit *who, bool attack, bool reset, bool checkAllDead) { - if (attack && who) - { - CAST_AI(boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; - - CAST_AI(boss_four_horsemenAI, Thane->AI())->AttackStart(who); - CAST_AI(boss_four_horsemenAI, Lady->AI())->AttackStart(who); - CAST_AI(boss_four_horsemenAI, Baron->AI())->AttackStart(who); - CAST_AI(boss_four_horsemenAI, Sir->AI())->AttackStart(who); - } + if (!instance) + return false; + + Creature *Thane = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_THANE))); + Creature *Lady = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_LADY))); + Creature *Baron = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_BARON))); + Creature *Sir = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_SIR))); - if (reset) + if (Thane && Lady && Baron && Sir) { - if (instance->GetBossState(BOSS_HORSEMEN) != NOT_STARTED) + if (attack && who) { - if (!Thane->isAlive()) - Thane->Respawn(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; + + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->AttackStart(who); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->AttackStart(who); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->AttackStart(who); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->AttackStart(who); + } + + if (reset) + { + if (instance->GetBossState(BOSS_HORSEMEN) != NOT_STARTED) + { + if (!Thane->isAlive()) + Thane->Respawn(); - if (!Lady->isAlive()) - Lady->Respawn(); + if (!Lady->isAlive()) + Lady->Respawn(); - if (!Baron->isAlive()) - Baron->Respawn(); + if (!Baron->isAlive()) + Baron->Respawn(); - if (!Sir->isAlive()) - Sir->Respawn(); + if (!Sir->isAlive()) + Sir->Respawn(); - CAST_AI(boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); + } } - } - if (checkAllDead) - return !Thane->isAlive() && !Lady->isAlive() && !Baron->isAlive() && !Sir->isAlive(); + if (checkAllDead) + return !Thane->isAlive() && !Lady->isAlive() && !Baron->isAlive() && !Sir->isAlive(); + } + return false; } - return false; - } - - void BeginFourHorsemenMovement() - { - movementStarted = true; - me->SetReactState(REACT_PASSIVE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); - switch(id) + void BeginFourHorsemenMovement() { - case HORSEMEN_THANE: - me->GetMotionMaster()->MovePoint(0, WaypointPositions[0]); - break; - case HORSEMEN_LADY: - me->GetMotionMaster()->MovePoint(3, WaypointPositions[3]); - break; - case HORSEMEN_BARON: - me->GetMotionMaster()->MovePoint(6, WaypointPositions[6]); - break; - case HORSEMEN_SIR: - me->GetMotionMaster()->MovePoint(9, WaypointPositions[9]); - break; - } - } + movementStarted = true; + me->SetReactState(REACT_PASSIVE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + switch(id) + { + case HORSEMEN_THANE: + me->GetMotionMaster()->MovePoint(0, WaypointPositions[0]); + break; + case HORSEMEN_LADY: + me->GetMotionMaster()->MovePoint(3, WaypointPositions[3]); + break; + case HORSEMEN_BARON: + me->GetMotionMaster()->MovePoint(6, WaypointPositions[6]); + break; + case HORSEMEN_SIR: + me->GetMotionMaster()->MovePoint(9, WaypointPositions[9]); + break; + } + } - if (id == 2 || id == 5 || id == 8 || id == 11) + void MovementInform(uint32 type, uint32 id) { - movementCompleted = true; - me->SetReactState(REACT_AGGRESSIVE); - - Unit *eventStarter = Unit::GetUnit(*me, uiEventStarterGUID); + if (type != POINT_MOTION_TYPE) + return; - if (eventStarter && me->canAttack(eventStarter)) - AttackStart(eventStarter); - else if (!UpdateVictim()) + if (id == 2 || id == 5 || id == 8 || id == 11) { - EnterEvadeMode(); + movementCompleted = true; + me->SetReactState(REACT_AGGRESSIVE); + + Unit *eventStarter = Unit::GetUnit(*me, uiEventStarterGUID); + + if (eventStarter && me->canAttack(eventStarter)) + AttackStart(eventStarter); + else if (!UpdateVictim()) + { + EnterEvadeMode(); + return; + } + + if (caster) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + } + return; } - if (caster) + nextMovementStarted = false; + nextWP = id + 1; + } + + // switch to "who" if nearer than current target. + void SelectNearestTarget(Unit *who) + { + if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who)) { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + me->AddThreat(who, 1000000.0f); } - - return; } - nextMovementStarted = false; - nextWP = id + 1; - } - - // switch to "who" if nearer than current target. - void SelectNearestTarget(Unit *who) - { - if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who)) + void MoveInLineOfSight(Unit *who) { - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); - me->AddThreat(who, 1000000.0f); + BossAI::MoveInLineOfSight(who); + if (caster) + SelectNearestTarget(who); } - } - - void MoveInLineOfSight(Unit *who) - { - BossAI::MoveInLineOfSight(who); - if (caster) - SelectNearestTarget(who); - } - void AttackStart(Unit *who) - { - if (!movementCompleted && !movementStarted) + void AttackStart(Unit *who) { - uiEventStarterGUID = who->GetGUID(); - BeginFourHorsemenMovement(); + if (!movementCompleted && !movementStarted) + { + uiEventStarterGUID = who->GetGUID(); + BeginFourHorsemenMovement(); - if (!encounterActionAttack) - DoEncounterAction(who, true, false, false); + if (!encounterActionAttack) + DoEncounterAction(who, true, false, false); + } + else if (movementCompleted && movementStarted) + { + if (caster) + me->Attack(who, false); + else + BossAI::AttackStart(who); + } } - else if (movementCompleted && movementStarted) + + void KilledUnit(Unit* /*victim*/) { - if (caster) - me->Attack(who, false); - else - BossAI::AttackStart(who); + if (!(rand()%5)) + { + if (id == HORSEMEN_BARON) + DoScriptText(SAY_BARON_SLAY, me); + else + DoScriptText(SAY_SLAY[id], me); + } } - } - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) + void JustDied(Unit* /*killer*/) { - if (id == HORSEMEN_BARON) - DoScriptText(SAY_BARON_SLAY, me); - else - DoScriptText(SAY_SLAY[id], me); - } - } + events.Reset(); + summons.DespawnAll(); - void JustDied(Unit* /*killer*/) - { - events.Reset(); - summons.DespawnAll(); + if (instance) + instance->SetData(DATA_HORSEMEN0 + id, DONE); - if (instance) - instance->SetData(DATA_HORSEMEN0 + id, DONE); + if (instance && DoEncounterAction(NULL, false, false, true)) + { + instance->SetBossState(BOSS_HORSEMEN, DONE); + instance->SaveToDB(); - if (instance && DoEncounterAction(NULL, false, false, true)) - { - instance->SetBossState(BOSS_HORSEMEN, DONE); - instance->SaveToDB(); + // Achievements related to the 4-horsemen are given through spell 59450 which does not exist. + // There is thus no way it can be given by casting the spell on the players. + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59450); + } - // Achievements related to the 4-horsemen are given through spell 59450 which does not exist. - // There is thus no way it can be given by casting the spell on the players. - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59450); + DoScriptText(SAY_DEATH[id], me); } - DoScriptText(SAY_DEATH[id], me); - } - - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); - if (id == HORSEMEN_BARON) - DoScriptText(SAY_BARON_AGGRO, me); - else - DoScriptText(SAY_AGGRO[id], me); + if (id == HORSEMEN_BARON) + DoScriptText(SAY_BARON_AGGRO, me); + else + DoScriptText(SAY_AGGRO[id], me); - events.ScheduleEvent(EVENT_MARK, 15000); - events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000); - events.ScheduleEvent(EVENT_BERSERK, 15*100*1000); - } + events.ScheduleEvent(EVENT_MARK, 15000); + events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000); + events.ScheduleEvent(EVENT_BERSERK, 15*100*1000); + } - void UpdateAI(const uint32 diff) - { - if (nextWP && movementStarted && !movementCompleted && !nextMovementStarted) + void UpdateAI(const uint32 diff) { - nextMovementStarted = true; - me->GetMotionMaster()->MovePoint(nextWP, WaypointPositions[nextWP]); - } + if (nextWP && movementStarted && !movementCompleted && !nextMovementStarted) + { + nextMovementStarted = true; + me->GetMotionMaster()->MovePoint(nextWP, WaypointPositions[nextWP]); + } - if (!UpdateVictim() || !CheckInRoom() || !movementCompleted) - return; + if (!UpdateVictim() || !CheckInRoom() || !movementCompleted) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_MARK: - if (!(rand()%5)) + switch(eventId) + { + case EVENT_MARK: + if (!(rand()%5)) + DoScriptText(SAY_SPECIAL[id], me); + DoCastAOE(SPELL_MARK[id]); + events.ScheduleEvent(EVENT_MARK, 15000); + break; + case EVENT_CAST: + if (!(rand()%5)) + DoScriptText(SAY_TAUNT[rand()%3][id], me); + + if (caster) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + DoCast(pTarget, SPELL_PRIMARY(id)); + } + else + DoCast(me->getVictim(), SPELL_PRIMARY(id)); + + events.ScheduleEvent(EVENT_CAST, 15000); + break; + case EVENT_BERSERK: DoScriptText(SAY_SPECIAL[id], me); - DoCastAOE(SPELL_MARK[id]); - events.ScheduleEvent(EVENT_MARK, 15000); - break; - case EVENT_CAST: - if (!(rand()%5)) - DoScriptText(SAY_TAUNT[rand()%3][id], me); - - if (caster) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) - DoCast(pTarget, SPELL_PRIMARY(id)); - } - else - DoCast(me->getVictim(), SPELL_PRIMARY(id)); - - events.ScheduleEvent(EVENT_CAST, 15000); - break; - case EVENT_BERSERK: - DoScriptText(SAY_SPECIAL[id], me); - DoCast(me, EVENT_BERSERK); - break; + DoCast(me, EVENT_BERSERK); + break; + } } - } - if (punishTimer <= diff) - { - if (doDelayPunish) + if (punishTimer <= diff) { - DoCastAOE(SPELL_PUNISH[id], true); - doDelayPunish = false; - } - punishTimer = 2000; - } else punishTimer -= diff; + if (doDelayPunish) + { + DoCastAOE(SPELL_PUNISH[id], true); + doDelayPunish = false; + } + punishTimer = 2000; + } else punishTimer -= diff; - if (!caster) - DoMeleeAttackIfReady(); - else if ((!DoSpellAttackIfReady(SPELL_SECONDARY(id)) || !me->IsWithinLOSInMap(me->getVictim())) && movementCompleted && !doDelayPunish) - doDelayPunish = true; - } -}; + if (!caster) + DoMeleeAttackIfReady(); + else if ((!DoSpellAttackIfReady(SPELL_SECONDARY(id)) || !me->IsWithinLOSInMap(me->getVictim())) && movementCompleted && !doDelayPunish) + doDelayPunish = true; + } + }; -CreatureAI* GetAI_four_horsemen(Creature* pCreature) -{ - return new boss_four_horsemenAI (pCreature); -} +}; void AddSC_boss_four_horsemen() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_four_horsemen"; - newscript->GetAI = &GetAI_four_horsemen; - newscript->RegisterSelf(); + new boss_four_horsemen(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index a91fa207df7..c1fbc4d2d93 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -44,105 +44,107 @@ enum Events }; #define EMOTE_NEARBY " spots a nearby zombie to devour!" - -struct boss_gluthAI : public BossAI +
class boss_gluth : public CreatureScript { - boss_gluthAI(Creature *c) : BossAI(c, BOSS_GLUTH) +public: + boss_gluth() : CreatureScript("boss_gluth") { } + + CreatureAI* GetAI(Creature* pCreature) const { - // Do not let Gluth be affected by zombies' debuff - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true); + return new boss_gluthAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct boss_gluthAI : public BossAI { - if (who->GetEntry() == MOB_ZOMBIE && me->IsWithinDistInMap(who, 7)) + boss_gluthAI(Creature *c) : BossAI(c, BOSS_GLUTH) { - SetGazeOn(who); - // TODO: use a script text - me->MonsterTextEmote(EMOTE_NEARBY, 0, true); + // Do not let Gluth be affected by zombies' debuff + me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true); } - else - BossAI::MoveInLineOfSight(who); - } - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - events.ScheduleEvent(EVENT_WOUND, 10000); - events.ScheduleEvent(EVENT_ENRAGE, 15000); - events.ScheduleEvent(EVENT_DECIMATE, 105000); - events.ScheduleEvent(EVENT_BERSERK, 8*60000); - events.ScheduleEvent(EVENT_SUMMON, 15000); - } - - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == MOB_ZOMBIE) - summon->AI()->AttackStart(me); - summons.Summon(summon); - } + void MoveInLineOfSight(Unit *who) + { + if (who->GetEntry() == MOB_ZOMBIE && me->IsWithinDistInMap(who, 7)) + { + SetGazeOn(who); + // TODO: use a script text + me->MonsterTextEmote(EMOTE_NEARBY, 0, true); + } + else + BossAI::MoveInLineOfSight(who); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictimWithGaze() || !CheckInRoom()) - return; + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + events.ScheduleEvent(EVENT_WOUND, 10000); + events.ScheduleEvent(EVENT_ENRAGE, 15000); + events.ScheduleEvent(EVENT_DECIMATE, 105000); + events.ScheduleEvent(EVENT_BERSERK, 8*60000); + events.ScheduleEvent(EVENT_SUMMON, 15000); + } - events.Update(diff); + void JustSummoned(Creature *summon) + { + if (summon->GetEntry() == MOB_ZOMBIE) + summon->AI()->AttackStart(me); + summons.Summon(summon); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictimWithGaze() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_WOUND: - DoCast(me->getVictim(), SPELL_MORTAL_WOUND); - events.ScheduleEvent(EVENT_WOUND, 10000); - break; - case EVENT_ENRAGE: - // TODO : Add missing text - DoCast(me, SPELL_ENRAGE); - events.ScheduleEvent(EVENT_ENRAGE, 15000); - break; - case EVENT_DECIMATE: - // TODO : Add missing text - DoCastAOE(SPELL_DECIMATE); - events.ScheduleEvent(EVENT_DECIMATE, 105000); - break; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - events.ScheduleEvent(EVENT_BERSERK, 5*60000); - break; - case EVENT_SUMMON: - for (uint32 i = 0; i < RAID_MODE(1,2); ++i) - DoSummon(MOB_ZOMBIE, PosSummon[rand()%3]); - events.ScheduleEvent(EVENT_SUMMON, 10000); - break; + switch(eventId) + { + case EVENT_WOUND: + DoCast(me->getVictim(), SPELL_MORTAL_WOUND); + events.ScheduleEvent(EVENT_WOUND, 10000); + break; + case EVENT_ENRAGE: + // TODO : Add missing text + DoCast(me, SPELL_ENRAGE); + events.ScheduleEvent(EVENT_ENRAGE, 15000); + break; + case EVENT_DECIMATE: + // TODO : Add missing text + DoCastAOE(SPELL_DECIMATE); + events.ScheduleEvent(EVENT_DECIMATE, 105000); + break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + events.ScheduleEvent(EVENT_BERSERK, 5*60000); + break; + case EVENT_SUMMON: + for (uint32 i = 0; i < RAID_MODE(1,2); ++i) + DoSummon(MOB_ZOMBIE, PosSummon[rand()%3]); + events.ScheduleEvent(EVENT_SUMMON, 10000); + break; + } } - } - if (me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE) - { - if (me->IsWithinMeleeRange(me->getVictim())) + if (me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE) { - me->Kill(me->getVictim()); - me->ModifyHealth(me->GetMaxHealth() * 0.05f); + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->Kill(me->getVictim()); + me->ModifyHealth(me->GetMaxHealth() * 0.05f); + } } + else + DoMeleeAttackIfReady(); } - else - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_boss_gluth(Creature* pCreature) -{ - return new boss_gluthAI (pCreature); -} void AddSC_boss_gluth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gluth"; - newscript->GetAI = &GetAI_boss_gluth; - newscript->RegisterSelf(); + new boss_gluth(); } - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 4fcf902714c..56f1a216fcd 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -142,442 +142,448 @@ struct NotOnSameSide : public std::unary_function<Unit *, bool> { return (m_inLiveSide != IN_LIVE_SIDE(pTarget)); } }; - -struct boss_gothikAI : public BossAI +
class boss_gothik : public CreatureScript { - boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} - - uint32 waveCount; - typedef std::vector<Creature*> TriggerVct; - TriggerVct liveTrigger, deadTrigger; - bool mergedSides; - bool phaseTwo; - bool thirtyPercentReached; - - std::vector<uint64> LiveTriggerGUID; - std::vector<uint64> DeadTriggerGUID; +public: + boss_gothik() : CreatureScript("boss_gothik") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - LiveTriggerGUID.clear(); - DeadTriggerGUID.clear(); - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - me->SetReactState(REACT_PASSIVE); - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - _Reset(); - mergedSides = false; - phaseTwo = false; - thirtyPercentReached = false; + return new boss_gothikAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_gothikAI : public BossAI { - for (uint32 i = 0; i < POS_LIVE; ++i) - if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) - LiveTriggerGUID.push_back(trigger->GetGUID()); - for (uint32 i = 0; i < POS_DEAD; ++i) - if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) - DeadTriggerGUID.push_back(trigger->GetGUID()); - - if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) + boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} + + uint32 waveCount; + typedef std::vector<Creature*> TriggerVct; + TriggerVct liveTrigger, deadTrigger; + bool mergedSides; + bool phaseTwo; + bool thirtyPercentReached; + + std::vector<uint64> LiveTriggerGUID; + std::vector<uint64> DeadTriggerGUID; + + void Reset() { - sLog.outError("Script Gothik: cannot summon triggers!"); - EnterEvadeMode(); - return; - } + LiveTriggerGUID.clear(); + DeadTriggerGUID.clear(); - _EnterCombat(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - waveCount = 0; - events.ScheduleEvent(EVENT_SUMMON, 30000); - DoTeleportTo(PosPlatform); - DoScriptText(SAY_SPEECH, me); - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY); - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + me->SetReactState(REACT_PASSIVE); + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + _Reset(); + mergedSides = false; + phaseTwo = false; + thirtyPercentReached = false; + } - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == WORLD_TRIGGER) - summon->setActive(true); - else if (!mergedSides) + void EnterCombat(Unit * /*who*/) { - summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); - summon->AI()->EnterEvadeMode(); + for (uint32 i = 0; i < POS_LIVE; ++i) + if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) + LiveTriggerGUID.push_back(trigger->GetGUID()); + for (uint32 i = 0; i < POS_DEAD; ++i) + if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) + DeadTriggerGUID.push_back(trigger->GetGUID()); + + if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) + { + sLog.outError("Script Gothik: cannot summon triggers!"); + EnterEvadeMode(); + return; + } + + _EnterCombat(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + waveCount = 0; + events.ScheduleEvent(EVENT_SUMMON, 30000); + DoTeleportTo(PosPlatform); + DoScriptText(SAY_SPEECH, me); + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY); } - else + + void JustSummoned(Creature *summon) { - summon->AI()->DoAction(0); - summon->AI()->DoZoneInCombat(); + if (summon->GetEntry() == WORLD_TRIGGER) + summon->setActive(true); + else if (!mergedSides) + { + summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); + summon->AI()->EnterEvadeMode(); + } + else + { + summon->AI()->DoAction(0); + summon->AI()->DoZoneInCombat(); + } + summons.Summon(summon); } - summons.Summon(summon); - } - void SummonedCreatureDespawn(Creature *summon) - { - summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature *summon) + { + summons.Despawn(summon); + } - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - DoScriptText(SAY_KILL, me); - } + void KilledUnit(Unit* /*victim*/) + { + if (!(rand()%5)) + DoScriptText(SAY_KILL, me); + } - void JustDied(Unit* /*Killer*/) - { - LiveTriggerGUID.clear(); - DeadTriggerGUID.clear(); - _JustDied(); - DoScriptText(SAY_DEATH, me); - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - } + void JustDied(Unit* /*Killer*/) + { + LiveTriggerGUID.clear(); + DeadTriggerGUID.clear(); + _JustDied(); + DoScriptText(SAY_DEATH, me); + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + } - void DoGothikSummon(uint32 entry) - { - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + void DoGothikSummon(uint32 entry) { - switch(entry) + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { - case MOB_LIVE_TRAINEE: - { - if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[0])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); - if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); - if (Creature *LiveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger2, 1); - break; - } - case MOB_LIVE_KNIGHT: - { - if (Creature *LiveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3])) - DoSummon(MOB_LIVE_KNIGHT, LiveTrigger3, 1); - if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5])) - DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); - break; - } - case MOB_LIVE_RIDER: + switch(entry) { - if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); - break; + case MOB_LIVE_TRAINEE: + { + if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[0])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); + if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); + if (Creature *LiveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger2, 1); + break; + } + case MOB_LIVE_KNIGHT: + { + if (Creature *LiveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3])) + DoSummon(MOB_LIVE_KNIGHT, LiveTrigger3, 1); + if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5])) + DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); + break; + } + case MOB_LIVE_RIDER: + { + if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); + break; + } } } - } - else - { - switch(entry) + else { - case MOB_LIVE_TRAINEE: - { - if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); - if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); - break; - } - case MOB_LIVE_KNIGHT: - { - if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); - break; - } - case MOB_LIVE_RIDER: + switch(entry) { - if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); - break; + case MOB_LIVE_TRAINEE: + { + if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); + if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); + break; + } + case MOB_LIVE_KNIGHT: + { + if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); + break; + } + case MOB_LIVE_RIDER: + { + if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); + break; + } } } } - } - - bool CheckGroupSplitted() - { - bool checklife = false; - bool checkdead = false; - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) + bool CheckGroupSplitted() { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) + bool checklife = false; + bool checkdead = false; + + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (!PlayerList.isEmpty()) { - if (i->getSource() && i->getSource()->isAlive() && - i->getSource()->GetPositionX() <= POS_X_NORTH && - i->getSource()->GetPositionX() >= POS_X_SOUTH && - i->getSource()->GetPositionY() <= POS_Y_GATE && - i->getSource()->GetPositionY() >= POS_Y_EAST) - { - checklife = true; - } - else if (i->getSource() && i->getSource()->isAlive() && - i->getSource()->GetPositionX() <= POS_X_NORTH && - i->getSource()->GetPositionX() >= POS_X_SOUTH && - i->getSource()->GetPositionY() >= POS_Y_GATE && - i->getSource()->GetPositionY() <= POS_Y_WEST) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - checkdead = true; - } + if (i->getSource() && i->getSource()->isAlive() && + i->getSource()->GetPositionX() <= POS_X_NORTH && + i->getSource()->GetPositionX() >= POS_X_SOUTH && + i->getSource()->GetPositionY() <= POS_Y_GATE && + i->getSource()->GetPositionY() >= POS_Y_EAST) + { + checklife = true; + } + else if (i->getSource() && i->getSource()->isAlive() && + i->getSource()->GetPositionX() <= POS_X_NORTH && + i->getSource()->GetPositionX() >= POS_X_SOUTH && + i->getSource()->GetPositionY() >= POS_Y_GATE && + i->getSource()->GetPositionY() <= POS_Y_WEST) + { + checkdead = true; + } - if (checklife && checkdead) - return true; + if (checklife && checkdead) + return true; + } } } - } - return false; - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - uint32 spellId = 0; - switch(spell->Id) - { - case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; - case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; - case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; + return false; } - if (spellId && me->isInCombat()) + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) { - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); - if (Creature *pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) - me->CastSpell(pRandomDeadTrigger, spellId, true); + uint32 spellId = 0; + switch(spell->Id) + { + case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; + case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; + case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; + } + if (spellId && me->isInCombat()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); + if (Creature *pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) + me->CastSpell(pRandomDeadTrigger, spellId, true); + } } - } - - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) - { - if (!me->isInCombat()) - return; - switch(spell->Id) + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) { - case SPELL_INFORM_DEAD_TRAINEE: - DoSummon(MOB_DEAD_TRAINEE, pTarget, 0); - break; - case SPELL_INFORM_DEAD_KNIGHT: - DoSummon(MOB_DEAD_KNIGHT, pTarget, 0); - break; - case SPELL_INFORM_DEAD_RIDER: - DoSummon(MOB_DEAD_RIDER, pTarget, 1.0f); - DoSummon(MOB_DEAD_HORSE, pTarget, 1.0f); - break; + if (!me->isInCombat()) + return; + + switch(spell->Id) + { + case SPELL_INFORM_DEAD_TRAINEE: + DoSummon(MOB_DEAD_TRAINEE, pTarget, 0); + break; + case SPELL_INFORM_DEAD_KNIGHT: + DoSummon(MOB_DEAD_KNIGHT, pTarget, 0); + break; + case SPELL_INFORM_DEAD_RIDER: + DoSummon(MOB_DEAD_RIDER, pTarget, 1.0f); + DoSummon(MOB_DEAD_HORSE, pTarget, 1.0f); + break; + } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateCombatState() || !CheckInRoom()) - return; + void UpdateAI(const uint32 diff) + { + if (!UpdateCombatState() || !CheckInRoom()) + return; - events.Update(diff); + events.Update(diff); - if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo) - { - thirtyPercentReached = true; - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - } + if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo) + { + thirtyPercentReached = true; + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SUMMON: - if (waves[waveCount].entry) - { - if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) - DoGothikSummon(waves[waveCount].entry); - else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) - DoGothikSummon(waves[waveCount].entry); - else if (waves[waveCount].mode == 1) - DoGothikSummon(waves[waveCount].entry); - - // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11) - if (waveCount == 11) + switch(eventId) + { + case EVENT_SUMMON: + if (waves[waveCount].entry) { - if (!CheckGroupSplitted()) + if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + DoGothikSummon(waves[waveCount].entry); + else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + DoGothikSummon(waves[waveCount].entry); + else if (waves[waveCount].mode == 1) + DoGothikSummon(waves[waveCount].entry); + + // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11) + if (waveCount == 11) { - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - summons.DoAction(0, 0); - summons.DoZoneInCombat(); - mergedSides = true; + if (!CheckGroupSplitted()) + { + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + summons.DoAction(0, 0); + summons.DoZoneInCombat(); + mergedSides = true; + } } - } - if (waves[waveCount].mode == 1) - events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) - events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) - events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else - events.ScheduleEvent(EVENT_SUMMON, 0); + if (waves[waveCount].mode == 1) + events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); + else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); + else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); + else + events.ScheduleEvent(EVENT_SUMMON, 0); - ++waveCount; - } - else - { - phaseTwo = true; - DoScriptText(SAY_TELEPORT, me); - DoTeleportTo(PosGroundLiveSide); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - summons.DoAction(0, 0); - summons.DoZoneInCombat(); - events.ScheduleEvent(EVENT_BOLT, 1000); - events.ScheduleEvent(EVENT_HARVEST, urand(3000,15000)); - events.ScheduleEvent(EVENT_TELEPORT, 20000); - } - break; - case EVENT_BOLT: - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); - events.ScheduleEvent(EVENT_BOLT, 1000); - break; - case EVENT_HARVEST: - DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true); - events.ScheduleEvent(EVENT_HARVEST, urand(20000,25000)); - break; - case EVENT_TELEPORT: - if (!thirtyPercentReached) - { - me->AttackStop(); - if (IN_LIVE_SIDE(me)) - { - DoTeleportTo(PosGroundDeadSide); + ++waveCount; } else { + phaseTwo = true; + DoScriptText(SAY_TELEPORT, me); DoTeleportTo(PosGroundLiveSide); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + summons.DoAction(0, 0); + summons.DoZoneInCombat(); + events.ScheduleEvent(EVENT_BOLT, 1000); + events.ScheduleEvent(EVENT_HARVEST, urand(3000,15000)); + events.ScheduleEvent(EVENT_TELEPORT, 20000); } - - me->getThreatManager().resetAggro(NotOnSameSide(me)); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) + break; + case EVENT_BOLT: + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); + events.ScheduleEvent(EVENT_BOLT, 1000); + break; + case EVENT_HARVEST: + DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true); + events.ScheduleEvent(EVENT_HARVEST, urand(20000,25000)); + break; + case EVENT_TELEPORT: + if (!thirtyPercentReached) { - me->getThreatManager().addThreat(pTarget, 100.0f); - AttackStart(pTarget); - } + me->AttackStop(); + if (IN_LIVE_SIDE(me)) + { + DoTeleportTo(PosGroundDeadSide); + } + else + { + DoTeleportTo(PosGroundLiveSide); + } - events.ScheduleEvent(EVENT_TELEPORT, 20000); - } - break; + me->getThreatManager().resetAggro(NotOnSameSide(me)); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) + { + me->getThreatManager().addThreat(pTarget, 100.0f); + AttackStart(pTarget); + } + + events.ScheduleEvent(EVENT_TELEPORT, 20000); + } + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_gothik_minionAI : public CombatAI +
class mob_gothik_minion : public CreatureScript { - mob_gothik_minionAI(Creature *c) : CombatAI(c) - { - liveSide = IN_LIVE_SIDE(me); - } +public: + mob_gothik_minion() : CreatureScript("mob_gothik_minion") { } - bool liveSide; - bool gateClose; - - bool isOnSameSide(const Unit *pWho) + CreatureAI* GetAI(Creature* pCreature) const { - return (liveSide == IN_LIVE_SIDE(pWho)); + return new mob_gothik_minionAI (pCreature); } - void DoAction(const int32 param) + struct mob_gothik_minionAI : public CombatAI { - gateClose = param; - } + mob_gothik_minionAI(Creature *c) : CombatAI(c) + { + liveSide = IN_LIVE_SIDE(me); + } - void DamageTaken(Unit *attacker, uint32 &damage) - { - if (gateClose && !isOnSameSide(attacker)) - damage = 0; - } + bool liveSide; + bool gateClose; - void JustDied(Unit * /*killer*/) - { - if (me->isSummon()) + bool isOnSameSide(const Unit *pWho) { - if (Unit *owner = CAST_SUM(me)->GetSummoner()) - CombatAI::JustDied(owner); + return (liveSide == IN_LIVE_SIDE(pWho)); } - } - void EnterEvadeMode() - { - if (!gateClose) + void DoAction(const int32 param) { - CombatAI::EnterEvadeMode(); - return; + gateClose = param; } - if (!_EnterEvadeMode()) - return; + void DamageTaken(Unit *attacker, uint32 &damage) + { + if (gateClose && !isOnSameSide(attacker)) + damage = 0; + } - Map* pMap = me->GetMap(); - if (pMap->IsDungeon()) + void JustDied(Unit * /*killer*/) { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) + if (me->isSummon()) { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Unit *owner = CAST_SUM(me)->GetSummoner()) + CombatAI::JustDied(owner); + } + } + + void EnterEvadeMode() + { + if (!gateClose) + { + CombatAI::EnterEvadeMode(); + return; + } + + if (!_EnterEvadeMode()) + return; + + Map* pMap = me->GetMap(); + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (!PlayerList.isEmpty()) { - if (i->getSource() && i->getSource()->isAlive() && isOnSameSide(i->getSource())) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - AttackStart(i->getSource()); - return; + if (i->getSource() && i->getSource()->isAlive() && isOnSameSide(i->getSource())) + { + AttackStart(i->getSource()); + return; + } } } } - } - me->GetMotionMaster()->MoveIdle(); - Reset(); - } + me->GetMotionMaster()->MoveIdle(); + Reset(); + } - void UpdateAI(const uint32 diff) - { - if (gateClose && (!isOnSameSide(me) || me->getVictim() && !isOnSameSide(me->getVictim()))) + void UpdateAI(const uint32 diff) { - EnterEvadeMode(); - return; + if (gateClose && (!isOnSameSide(me) || me->getVictim() && !isOnSameSide(me->getVictim()))) + { + EnterEvadeMode(); + return; + } + + CombatAI::UpdateAI(diff); } + }; - CombatAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_boss_gothik(Creature* pCreature) -{ - return new boss_gothikAI (pCreature); -} -CreatureAI* GetAI_mob_gothik_minion(Creature* pCreature) -{ - return new mob_gothik_minionAI (pCreature); -} void AddSC_boss_gothik() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gothik"; - newscript->GetAI = &GetAI_boss_gothik; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_gothik_minion"; - newscript->GetAI = &GetAI_mob_gothik_minion; - newscript->RegisterSelf(); + new boss_gothik(); + new mob_gothik_minion(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 1d96a2d70ab..cc2789d582d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -32,112 +32,118 @@ #define EVENT_SPRAY 4 #define MOB_FALLOUT_SLIME 16290 - -struct boss_grobbulusAI : public BossAI +
class boss_grobbulus : public CreatureScript { - boss_grobbulusAI(Creature *c) : BossAI(c, BOSS_GROBBULUS) - { - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_POISON_CLOUD_ADD, true); - } +public: + boss_grobbulus() : CreatureScript("boss_grobbulus") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - events.ScheduleEvent(EVENT_CLOUD, 15000); - events.ScheduleEvent(EVENT_INJECT, 20000); - events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); //not sure - events.ScheduleEvent(EVENT_BERSERK, 12*60000); + return new boss_grobbulusAI (pCreature); } - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) + struct boss_grobbulusAI : public BossAI { - if (spell->Id == uint32(SPELL_SLIME_SPRAY)) + boss_grobbulusAI(Creature *c) : BossAI(c, BOSS_GROBBULUS) { - if (TempSummon *slime = me->SummonCreature(MOB_FALLOUT_SLIME, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - DoZoneInCombat(slime); + me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_POISON_CLOUD_ADD, true); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + events.ScheduleEvent(EVENT_CLOUD, 15000); + events.ScheduleEvent(EVENT_INJECT, 20000); + events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); //not sure + events.ScheduleEvent(EVENT_BERSERK, 12*60000); + } - events.Update(diff); + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) + { + if (spell->Id == uint32(SPELL_SLIME_SPRAY)) + { + if (TempSummon *slime = me->SummonCreature(MOB_FALLOUT_SLIME, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + DoZoneInCombat(slime); + } + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_CLOUD: - DoCastAOE(SPELL_POISON_CLOUD); - events.ScheduleEvent(EVENT_CLOUD, 15000); - return; - case EVENT_BERSERK: - DoCastAOE(SPELL_BERSERK); - return; - case EVENT_SPRAY: - DoCastAOE(SPELL_SLIME_SPRAY); - events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); - return; - case EVENT_INJECT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) - if (!pTarget->HasAura(SPELL_MUTATING_INJECTION)) - DoCast(pTarget, SPELL_MUTATING_INJECTION); - events.ScheduleEvent(EVENT_INJECT, 8000 + 12000 * ((float)me->GetHealth() / me->GetMaxHealth())); - return; + switch(eventId) + { + case EVENT_CLOUD: + DoCastAOE(SPELL_POISON_CLOUD); + events.ScheduleEvent(EVENT_CLOUD, 15000); + return; + case EVENT_BERSERK: + DoCastAOE(SPELL_BERSERK); + return; + case EVENT_SPRAY: + DoCastAOE(SPELL_SLIME_SPRAY); + events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); + return; + case EVENT_INJECT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) + if (!pTarget->HasAura(SPELL_MUTATING_INJECTION)) + DoCast(pTarget, SPELL_MUTATING_INJECTION); + events.ScheduleEvent(EVENT_INJECT, 8000 + 12000 * ((float)me->GetHealth() / me->GetMaxHealth())); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct npc_grobbulus_poison_cloudAI : public Scripted_NoMovementAI +
class npc_grobbulus_poison_cloud : public CreatureScript { - npc_grobbulus_poison_cloudAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - Reset(); - } - - uint32 Cloud_Timer; +public: + npc_grobbulus_poison_cloud() : CreatureScript("npc_grobbulus_poison_cloud") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Cloud_Timer = 1000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + return new npc_grobbulus_poison_cloudAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_grobbulus_poison_cloudAI : public Scripted_NoMovementAI { - if (Cloud_Timer <= diff) + npc_grobbulus_poison_cloudAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) { - DoCast(me, SPELL_POISON_CLOUD_ADD); - Cloud_Timer = 10000; - } else Cloud_Timer -= diff; - } + Reset(); + } + + uint32 Cloud_Timer; + + void Reset() + { + Cloud_Timer = 1000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + void UpdateAI(const uint32 diff) + { + if (Cloud_Timer <= diff) + { + DoCast(me, SPELL_POISON_CLOUD_ADD); + Cloud_Timer = 10000; + } else Cloud_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_grobbulus(Creature* pCreature) -{ - return new boss_grobbulusAI (pCreature); -} -CreatureAI* GetAI_npc_grobbulus_poison_cloud(Creature* pCreature) -{ - return new npc_grobbulus_poison_cloudAI(pCreature); -} void AddSC_boss_grobbulus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_grobbulus"; - newscript->GetAI = &GetAI_boss_grobbulus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_grobbulus_poison_cloud"; - newscript->GetAI = &GetAI_npc_grobbulus_poison_cloud; - newscript->RegisterSelf(); + new boss_grobbulus(); + new npc_grobbulus_poison_cloud(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 00b6f498ce0..85e084f9081 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -41,110 +41,113 @@ enum Phases PHASE_FIGHT = 1, PHASE_DANCE, }; - -struct boss_heiganAI : public BossAI +
class boss_heigan : public CreatureScript { - boss_heiganAI(Creature *c) : BossAI(c, BOSS_HEIGAN) {} - - uint32 eruptSection; - bool eruptDirection; - Phases phase; +public: + boss_heigan() : CreatureScript("boss_heigan") { } - void KilledUnit(Unit* /*Victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); + return new boss_heiganAI (pCreature); } - void JustDied(Unit* /*Killer*/) + struct boss_heiganAI : public BossAI { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } + boss_heiganAI(Creature *c) : BossAI(c, BOSS_HEIGAN) {} - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoScriptText(SAY_AGGRO, me); - EnterPhase(PHASE_FIGHT); - } + uint32 eruptSection; + bool eruptDirection; + Phases phase; - void EnterPhase(Phases newPhase) - { - phase = newPhase; - events.Reset(); - eruptSection = 3; - if (phase == PHASE_FIGHT) + void KilledUnit(Unit* /*Victim*/) { - events.ScheduleEvent(EVENT_DISRUPT, urand(10000, 25000)); - events.ScheduleEvent(EVENT_FEVER, urand(15000, 20000)); - events.ScheduleEvent(EVENT_PHASE, 90000); - events.ScheduleEvent(EVENT_ERUPT, 15000); + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); } - else + + void JustDied(Unit* /*Killer*/) { - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o); - DoCastAOE(SPELL_PLAGUE_CLOUD); - events.ScheduleEvent(EVENT_PHASE, 45000); - events.ScheduleEvent(EVENT_ERUPT, 8000); + _JustDied(); + DoScriptText(SAY_DEATH, me); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoScriptText(SAY_AGGRO, me); + EnterPhase(PHASE_FIGHT); + } - events.Update(diff); + void EnterPhase(Phases newPhase) + { + phase = newPhase; + events.Reset(); + eruptSection = 3; + if (phase == PHASE_FIGHT) + { + events.ScheduleEvent(EVENT_DISRUPT, urand(10000, 25000)); + events.ScheduleEvent(EVENT_FEVER, urand(15000, 20000)); + events.ScheduleEvent(EVENT_PHASE, 90000); + events.ScheduleEvent(EVENT_ERUPT, 15000); + } + else + { + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->NearTeleportTo(x, y, z, o); + DoCastAOE(SPELL_PLAGUE_CLOUD); + events.ScheduleEvent(EVENT_PHASE, 45000); + events.ScheduleEvent(EVENT_ERUPT, 8000); + } + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_DISRUPT: - DoCastAOE(SPELL_SPELL_DISRUPTION); - events.ScheduleEvent(EVENT_DISRUPT, urand(5000, 10000)); - break; - case EVENT_FEVER: - DoCastAOE(SPELL_DECREPIT_FEVER); - events.ScheduleEvent(EVENT_FEVER, urand(20000, 25000)); - break; - case EVENT_PHASE: - // TODO : Add missing texts for both phase switches - EnterPhase(phase == PHASE_FIGHT ? PHASE_DANCE : PHASE_FIGHT); - break; - case EVENT_ERUPT: - instance->SetData(DATA_HEIGAN_ERUPT, eruptSection); - TeleportCheaters(); - - if (eruptSection == 0) - eruptDirection = true; - else if (eruptSection == 3) - eruptDirection = false; - - eruptDirection ? ++eruptSection : --eruptSection; - - events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 3000); - break; + switch(eventId) + { + case EVENT_DISRUPT: + DoCastAOE(SPELL_SPELL_DISRUPTION); + events.ScheduleEvent(EVENT_DISRUPT, urand(5000, 10000)); + break; + case EVENT_FEVER: + DoCastAOE(SPELL_DECREPIT_FEVER); + events.ScheduleEvent(EVENT_FEVER, urand(20000, 25000)); + break; + case EVENT_PHASE: + // TODO : Add missing texts for both phase switches + EnterPhase(phase == PHASE_FIGHT ? PHASE_DANCE : PHASE_FIGHT); + break; + case EVENT_ERUPT: + instance->SetData(DATA_HEIGAN_ERUPT, eruptSection); + TeleportCheaters(); + + if (eruptSection == 0) + eruptDirection = true; + else if (eruptSection == 3) + eruptDirection = false; + + eruptDirection ? ++eruptSection : --eruptSection; + + events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 3000); + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_heigan(Creature* pCreature) -{ - return new boss_heiganAI (pCreature); -} void AddSC_boss_heigan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_heigan"; - newscript->GetAI = &GetAI_boss_heigan; - newscript->RegisterSelf(); + new boss_heigan(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 196d0771b97..8395fe13e1c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -251,458 +251,462 @@ struct NotCharmedTargetSelector : public std::unary_function<Unit *, bool> { return (!pTarget->isCharmed()); } }; - -struct boss_kelthuzadAI : public BossAI +
class boss_kelthuzad : public CreatureScript { - boss_kelthuzadAI(Creature* c) : BossAI(c, BOSS_KELTHUZAD), spawns(c) - { - uiFaction = me->getFaction(); - } - - uint32 Phase; - uint32 uiGuardiansOfIcecrownTimer; - uint32 uiFaction; +public: + boss_kelthuzad() : CreatureScript("boss_kelthuzad") { } - uint8 nGuardiansOfIcecrownCount; - uint8 nAbomination; - uint8 nWeaver; + struct boss_kelthuzadAI : public BossAI + { + boss_kelthuzadAI(Creature* c) : BossAI(c, BOSS_KELTHUZAD), spawns(c) + { + uiFaction = me->getFaction(); + } - std::map<uint64, float> chained; + uint32 Phase; + uint32 uiGuardiansOfIcecrownTimer; + uint32 uiFaction; - uint64 PortalsGUID[4]; - uint64 KTTriggerGUID; + uint8 nGuardiansOfIcecrownCount; + uint8 nAbomination; + uint8 nWeaver; - SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons) + std::map<uint64, float> chained; - void Reset() - { - _Reset(); + uint64 PortalsGUID[4]; + uint64 KTTriggerGUID; - PortalsGUID[0] = PortalsGUID[1] = PortalsGUID[2] = PortalsGUID[3] = 0; - KTTriggerGUID = 0; + SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons) - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - std::map<uint64, float>::const_iterator itr; - for (itr = chained.begin(); itr != chained.end(); ++itr) + void Reset() { - if (Player* charmed = Unit::GetPlayer(*me, (*itr).first)) - charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); - } + _Reset(); - chained.clear(); - spawns.DespawnAll(); + PortalsGUID[0] = PortalsGUID[1] = PortalsGUID[2] = PortalsGUID[3] = 0; + KTTriggerGUID = 0; - FindGameObjects(); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + std::map<uint64, float>::const_iterator itr; + for (itr = chained.begin(); itr != chained.end(); ++itr) + { + if (Player* charmed = Unit::GetPlayer(*me, (*itr).first)) + charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + } - if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) - { - pKTTrigger->ResetDoorOrButton(); - pKTTrigger->SetPhaseMask(1, true); - } + chained.clear(); + spawns.DespawnAll(); - for (uint8 i = 0; i <= 3; ++i) - { - if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + FindGameObjects(); + + if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) { - if (!((pPortal->getLootState() == GO_READY) || (pPortal->getLootState() == GO_NOT_READY))) - pPortal->ResetDoorOrButton(); + pKTTrigger->ResetDoorOrButton(); + pKTTrigger->SetPhaseMask(1, true); } - } - nGuardiansOfIcecrownCount = 0; - uiGuardiansOfIcecrownTimer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 + for (uint8 i = 0; i <= 3; ++i) + { + if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + { + if (!((pPortal->getLootState() == GO_READY) || (pPortal->getLootState() == GO_NOT_READY))) + pPortal->ResetDoorOrButton(); + } + } - Phase = 0; - nAbomination = 0; - nWeaver = 0; - } + nGuardiansOfIcecrownCount = 0; + uiGuardiansOfIcecrownTimer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 - void KilledUnit() - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); + Phase = 0; + nAbomination = 0; + nWeaver = 0; + } - std::map<uint64, float>::const_iterator itr; - for (itr = chained.begin(); itr != chained.end(); ++itr) + void KilledUnit() { - if (Player* pPlayer = Unit::GetPlayer(*me, (*itr).first)) - pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - chained.clear(); - } - - void EnterCombat(Unit* /*who*/) - { - me->setFaction(uiFaction); - _EnterCombat(); - FindGameObjects(); - for (uint8 i = 0; i <= 3; ++i) + void JustDied(Unit* /*Killer*/) { - if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) - pPortal->ResetDoorOrButton(); + _JustDied(); + DoScriptText(SAY_DEATH, me); + + std::map<uint64, float>::const_iterator itr; + for (itr = chained.begin(); itr != chained.end(); ++itr) + { + if (Player* pPlayer = Unit::GetPlayer(*me, (*itr).first)) + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + } + chained.clear(); } - DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); - DoScriptText(SAY_SUMMON_MINIONS, me); - Phase = 1; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 4); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 4); - events.ScheduleEvent(EVENT_TRIGGER, 5000); - events.ScheduleEvent(EVENT_WASTE, 15000); - events.ScheduleEvent(EVENT_ABOMIN, 30000); - events.ScheduleEvent(EVENT_WEAVER, 50000); - events.ScheduleEvent(EVENT_PHASE, 228000); - } - void FindGameObjects() - { - PortalsGUID[0] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL01) : 0; - PortalsGUID[1] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL02) : 0; - PortalsGUID[2] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL03) : 0; - PortalsGUID[3] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL04) : 0; - KTTriggerGUID = instance ? instance->GetData64(DATA_KELTHUZAD_TRIGGER) : 0; - } + void EnterCombat(Unit* /*who*/) + { + me->setFaction(uiFaction); - void UpdateAI(const uint32 diff) - { - if (!UpdateCombatState()) - return; + _EnterCombat(); + FindGameObjects(); + for (uint8 i = 0; i <= 3; ++i) + { + if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + pPortal->ResetDoorOrButton(); + } + DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); + DoScriptText(SAY_SUMMON_MINIONS, me); + Phase = 1; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 4); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 4); + events.ScheduleEvent(EVENT_TRIGGER, 5000); + events.ScheduleEvent(EVENT_WASTE, 15000); + events.ScheduleEvent(EVENT_ABOMIN, 30000); + events.ScheduleEvent(EVENT_WEAVER, 50000); + events.ScheduleEvent(EVENT_PHASE, 228000); + } - events.Update(diff); + void FindGameObjects() + { + PortalsGUID[0] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL01) : 0; + PortalsGUID[1] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL02) : 0; + PortalsGUID[2] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL03) : 0; + PortalsGUID[3] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL04) : 0; + KTTriggerGUID = instance ? instance->GetData64(DATA_KELTHUZAD_TRIGGER) : 0; + } - if (Phase == 1) + void UpdateAI(const uint32 diff) { - while (uint32 eventId = events.GetEvent()) + if (!UpdateCombatState()) + return; + + events.Update(diff); + + if (Phase == 1) { - switch(eventId) + while (uint32 eventId = events.GetEvent()) { - case EVENT_WASTE: - DoSummon(NPC_WASTE, Pos[RAND(0,3,6,9)]); - events.RepeatEvent(urand(2000,5000)); - break; - case EVENT_ABOMIN: - if (nAbomination < 8) - { - DoSummon(NPC_ABOMINATION, Pos[RAND(1,4,7,10)]); - nAbomination++; - events.RepeatEvent(20000); - } - else + switch(eventId) + { + case EVENT_WASTE: + DoSummon(NPC_WASTE, Pos[RAND(0,3,6,9)]); + events.RepeatEvent(urand(2000,5000)); + break; + case EVENT_ABOMIN: + if (nAbomination < 8) + { + DoSummon(NPC_ABOMINATION, Pos[RAND(1,4,7,10)]); + nAbomination++; + events.RepeatEvent(20000); + } + else + events.PopEvent(); + break; + case EVENT_WEAVER: + if (nWeaver < 8) + { + DoSummon(NPC_WEAVER, Pos[RAND(0,3,6,9)]); + nWeaver++; + events.RepeatEvent(25000); + } + else + events.PopEvent(); + break; + case EVENT_TRIGGER: + if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) + pKTTrigger->SetPhaseMask(2, true); events.PopEvent(); - break; - case EVENT_WEAVER: - if (nWeaver < 8) - { - DoSummon(NPC_WEAVER, Pos[RAND(0,3,6,9)]); - nWeaver++; - events.RepeatEvent(25000); - } - else + break; + case EVENT_PHASE: + events.Reset(); + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + spawns.DespawnAll(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + me->CastStop(); + + DoStartMovement(me->getVictim()); + events.ScheduleEvent(EVENT_BOLT, urand(5000,10000)); + events.ScheduleEvent(EVENT_NOVA, 15000); + events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); + events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); + events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); + Phase = 2; + break; + default: events.PopEvent(); - break; - case EVENT_TRIGGER: - if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) - pKTTrigger->SetPhaseMask(2, true); - events.PopEvent(); - break; - case EVENT_PHASE: - events.Reset(); - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - spawns.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - me->CastStop(); - - DoStartMovement(me->getVictim()); - events.ScheduleEvent(EVENT_BOLT, urand(5000,10000)); - events.ScheduleEvent(EVENT_NOVA, 15000); - events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); - events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); - events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) - events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); - Phase = 2; - break; - default: - events.PopEvent(); - break; + break; + } } } - } - else - { - //start phase 3 when we are 45% health - if (Phase != 3) + else { - if (HealthBelowPct(45)) + //start phase 3 when we are 45% health + if (Phase != 3) { - Phase = 3 ; - DoScriptText(SAY_REQUEST_AID, me); - //here Lich King should respond to KelThuzad but I don't know which Creature to make talk - //so for now just make Kelthuzad says it. - DoScriptText(SAY_ANSWER_REQUEST, me); - - for (uint8 i = 0; i <= 3; ++i) + if (HealthBelowPct(45)) { - if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + Phase = 3 ; + DoScriptText(SAY_REQUEST_AID, me); + //here Lich King should respond to KelThuzad but I don't know which Creature to make talk + //so for now just make Kelthuzad says it. + DoScriptText(SAY_ANSWER_REQUEST, me); + + for (uint8 i = 0; i <= 3; ++i) { - if (pPortal->getLootState() == GO_READY) - pPortal->UseDoorOrButton(); + if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + { + if (pPortal->getLootState() == GO_READY) + pPortal->UseDoorOrButton(); + } } } } - } - else if (nGuardiansOfIcecrownCount < RAID_MODE(2,4)) - { - if (uiGuardiansOfIcecrownTimer <= diff) + else if (nGuardiansOfIcecrownCount < RAID_MODE(2,4)) { - // TODO : Add missing text - if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2,5,8,11)])) - pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); - ++nGuardiansOfIcecrownCount; - uiGuardiansOfIcecrownTimer = 5000; + if (uiGuardiansOfIcecrownTimer <= diff) + { + // TODO : Add missing text + if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2,5,8,11)])) + pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); + ++nGuardiansOfIcecrownCount; + uiGuardiansOfIcecrownTimer = 5000; + } + else uiGuardiansOfIcecrownTimer -= diff; } - else uiGuardiansOfIcecrownTimer -= diff; - } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - if (uint32 eventId = events.GetEvent()) - { - switch(eventId) + if (uint32 eventId = events.GetEvent()) { - case EVENT_BOLT: - DoCastVictim(RAID_MODE(SPELL_FROST_BOLT,H_SPELL_FROST_BOLT)); - events.RepeatEvent(urand(5000,10000)); - break; - case EVENT_NOVA: - DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE,H_SPELL_FROST_BOLT_AOE)); - events.RepeatEvent(urand(15000,30000)); - break; - case EVENT_CHAIN: + switch(eventId) { - uint32 count = urand(1,3); - for (uint8 i = 1; i <= count; i++) + case EVENT_BOLT: + DoCastVictim(RAID_MODE(SPELL_FROST_BOLT,H_SPELL_FROST_BOLT)); + events.RepeatEvent(urand(5000,10000)); + break; + case EVENT_NOVA: + DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE,H_SPELL_FROST_BOLT_AOE)); + events.RepeatEvent(urand(15000,30000)); + break; + case EVENT_CHAIN: { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); - if (pTarget && !pTarget->isCharmed() && (chained.find(pTarget->GetGUID()) == chained.end())) + uint32 count = urand(1,3); + for (uint8 i = 1; i <= count; i++) { - DoCast(pTarget, SPELL_CHAINS_OF_KELTHUZAD); - float scale = pTarget->GetFloatValue(OBJECT_FIELD_SCALE_X); - chained.insert(std::make_pair(pTarget->GetGUID(), scale)); - pTarget->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); - events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); + if (pTarget && !pTarget->isCharmed() && (chained.find(pTarget->GetGUID()) == chained.end())) + { + DoCast(pTarget, SPELL_CHAINS_OF_KELTHUZAD); + float scale = pTarget->GetFloatValue(OBJECT_FIELD_SCALE_X); + chained.insert(std::make_pair(pTarget->GetGUID(), scale)); + pTarget->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); + events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm + } } + if (!chained.empty()) + DoScriptText(RAND(SAY_CHAIN_1,SAY_CHAIN_2), me); + events.RepeatEvent(urand(100000,180000)); + break; } - if (!chained.empty()) - DoScriptText(RAND(SAY_CHAIN_1,SAY_CHAIN_2), me); - events.RepeatEvent(urand(100000,180000)); - break; - } - case EVENT_CHAINED_SPELL: - { - std::map<uint64, float>::iterator itr; - for (itr = chained.begin(); itr != chained.end();) + case EVENT_CHAINED_SPELL: { - if (Unit* player = Unit::GetPlayer(*me, (*itr).first)) + std::map<uint64, float>::iterator itr; + for (itr = chained.begin(); itr != chained.end();) { - if (!player->isCharmed()) + if (Unit* player = Unit::GetPlayer(*me, (*itr).first)) { - player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); - std::map<uint64, float>::iterator next = itr; - ++next; - chained.erase(itr); - itr = next; - continue; - } + if (!player->isCharmed()) + { + player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + std::map<uint64, float>::iterator next = itr; + ++next; + chained.erase(itr); + itr = next; + continue; + } - if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) - { - switch(player->getClass()) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) { - case CLASS_DRUID: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_MOONFIRE, false); - else - player->CastSpell(me, SPELL_LIFEBLOOM, false); - break; - case CLASS_HUNTER: - player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); - break; - case CLASS_MAGE: - player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); - break; - case CLASS_WARLOCK: - player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); - break; - case CLASS_WARRIOR: - player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); - break; - case CLASS_PALADIN: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false); - else - player->CastSpell(me, SPELL_HOLY_SHOCK, false); - break; - case CLASS_PRIEST: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false); - else - player->CastSpell(me, SPELL_RENEW, false); - break; - case CLASS_SHAMAN: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false); - else - player->CastSpell(me, SPELL_HEALING_WAVE, false); - break; - case CLASS_ROGUE: - player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); - break; - case CLASS_DEATH_KNIGHT: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true); - else - player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true); - break; + switch(player->getClass()) + { + case CLASS_DRUID: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_MOONFIRE, false); + else + player->CastSpell(me, SPELL_LIFEBLOOM, false); + break; + case CLASS_HUNTER: + player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); + break; + case CLASS_MAGE: + player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); + break; + case CLASS_WARLOCK: + player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); + break; + case CLASS_WARRIOR: + player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); + break; + case CLASS_PALADIN: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false); + else + player->CastSpell(me, SPELL_HOLY_SHOCK, false); + break; + case CLASS_PRIEST: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false); + else + player->CastSpell(me, SPELL_RENEW, false); + break; + case CLASS_SHAMAN: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false); + else + player->CastSpell(me, SPELL_HEALING_WAVE, false); + break; + case CLASS_ROGUE: + player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); + break; + case CLASS_DEATH_KNIGHT: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true); + else + player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true); + break; + } } } + ++itr; } - ++itr; - } - if (chained.empty()) - events.PopEvent(); - else - events.RepeatEvent(5000); + if (chained.empty()) + events.PopEvent(); + else + events.RepeatEvent(5000); - break; - } - case EVENT_DETONATE: - { - std::vector<Unit*> unitList; - std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) - { - if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER - && (*itr)->getTarget()->getPowerType() == POWER_MANA - && (*itr)->getTarget()->GetPower(POWER_MANA)) - unitList.push_back((*itr)->getTarget()); + break; } - - if (!unitList.empty()) + case EVENT_DETONATE: { - std::vector<Unit*>::const_iterator itr = unitList.begin(); - advance(itr, rand()%unitList.size()); - DoCast(*itr, SPELL_MANA_DETONATION); - DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); - } + std::vector<Unit*> unitList; + std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) + { + if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER + && (*itr)->getTarget()->getPowerType() == POWER_MANA + && (*itr)->getTarget()->GetPower(POWER_MANA)) + unitList.push_back((*itr)->getTarget()); + } + + if (!unitList.empty()) + { + std::vector<Unit*>::const_iterator itr = unitList.begin(); + advance(itr, rand()%unitList.size()); + DoCast(*itr, SPELL_MANA_DETONATION); + DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); + } - events.RepeatEvent(urand(20000,50000)); - break; + events.RepeatEvent(urand(20000,50000)); + break; + } + case EVENT_FISSURE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SHADOW_FISURE); + events.RepeatEvent(urand(10000,45000)); + break; + case EVENT_BLAST: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) + DoCast(pTarget, SPELL_FROST_BLAST); + if (rand()%2) + DoScriptText(SAY_FROST_BLAST, me); + events.RepeatEvent(urand(30000,90000)); + break; + default: + events.PopEvent(); + break; } - case EVENT_FISSURE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SHADOW_FISURE); - events.RepeatEvent(urand(10000,45000)); - break; - case EVENT_BLAST: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) - DoCast(pTarget, SPELL_FROST_BLAST); - if (rand()%2) - DoScriptText(SAY_FROST_BLAST, me); - events.RepeatEvent(urand(30000,90000)); - break; - default: - events.PopEvent(); - break; } - } - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } } - } -}; + }; -CreatureAI* GetAI_boss_kelthuzadAI(Creature* pCreature) -{ - return new boss_kelthuzadAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_kelthuzadAI (pCreature); + } -bool AreaTrigger_at_kelthuzad_center(Player* pPlayer, const AreaTriggerEntry * /*at*/) +}; +
class at_kelthuzad_center : public AreaTriggerScript { - if (pPlayer->isGameMaster()) - return false; +public: + at_kelthuzad_center() : AreaTriggerScript("at_kelthuzad_center") { } - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); - if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE) - return false; + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) + { + if (pPlayer->isGameMaster()) + return false; - Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD))); - if (!pKelthuzad) - return false; + InstanceScript* pInstance = pPlayer->GetInstanceScript(); + if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE) + return false; - boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzadAI, pKelthuzad->AI()); - if (!pKelthuzadAI) - return false; + Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD))); + if (!pKelthuzad) + return false; - pKelthuzadAI->AttackStart(pPlayer); - if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER))) - { - if (trigger->getLootState() == GO_READY) - trigger->UseDoorOrButton(); + boss_kelthuzad::boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzad::boss_kelthuzadAI, pKelthuzad->AI()); + if (!pKelthuzadAI) + return false; - // Note: summon must be done by trigger and not by KT. - // Otherwise, they attack immediately as KT is in combat. - for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i) + pKelthuzadAI->AttackStart(pPlayer); + if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER))) { - if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i])) + if (trigger->getLootState() == GO_READY) + trigger->UseDoorOrButton(); + + // Note: summon must be done by trigger and not by KT. + // Otherwise, they attack immediately as KT is in combat. + for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i) { - pKelthuzadAI->spawns.Summon(sum); - sum->GetMotionMaster()->MoveRandom(9.0f); - sum->SetReactState(REACT_DEFENSIVE); + if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i])) + { + pKelthuzadAI->spawns.Summon(sum); + sum->GetMotionMaster()->MoveRandom(9.0f); + sum->SetReactState(REACT_DEFENSIVE); + } } - } - for (uint8 i = 0; i <= MAX_WASTES; ++i) - { - if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i])) + for (uint8 i = 0; i <= MAX_WASTES; ++i) { - pKelthuzadAI->spawns.Summon(sum); - sum->GetMotionMaster()->MoveRandom(5.0f); - sum->SetReactState(REACT_DEFENSIVE); + if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i])) + { + pKelthuzadAI->spawns.Summon(sum); + sum->GetMotionMaster()->MoveRandom(5.0f); + sum->SetReactState(REACT_DEFENSIVE); + } } - } - for (uint8 i = 0; i <= MAX_WEAVERS; ++i) - { - if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i])) + for (uint8 i = 0; i <= MAX_WEAVERS; ++i) { - pKelthuzadAI->spawns.Summon(sum); - sum->GetMotionMaster()->MoveRandom(9.0f); - sum->SetReactState(REACT_DEFENSIVE); + if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i])) + { + pKelthuzadAI->spawns.Summon(sum); + sum->GetMotionMaster()->MoveRandom(9.0f); + sum->SetReactState(REACT_DEFENSIVE); + } } } + + return true; } - return true; -} +}; void AddSC_boss_kelthuzad() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kelthuzad"; - newscript->GetAI = &GetAI_boss_kelthuzadAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_kelthuzad_center"; - newscript->pAreaTrigger = &AreaTrigger_at_kelthuzad_center; - newscript->RegisterSelf(); + new boss_kelthuzad(); + new at_kelthuzad_center(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index c22bf236ec3..b44559f80f0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -35,90 +35,92 @@ enum Events EVENT_BLOOM, EVENT_DOOM, }; - -struct boss_loathebAI : public BossAI +
class boss_loatheb : public CreatureScript { - boss_loathebAI(Creature *c) : BossAI(c, BOSS_LOATHEB) {} +public: + boss_loatheb() : CreatureScript("boss_loatheb") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - events.ScheduleEvent(EVENT_AURA, 10000); - events.ScheduleEvent(EVENT_BLOOM, 5000); - events.ScheduleEvent(EVENT_DOOM, 120000); + return new boss_loathebAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_loathebAI : public BossAI { - if (!UpdateVictim()) - return; + boss_loathebAI(Creature *c) : BossAI(c, BOSS_LOATHEB) {} - events.Update(diff); + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + events.ScheduleEvent(EVENT_AURA, 10000); + events.ScheduleEvent(EVENT_BLOOM, 5000); + events.ScheduleEvent(EVENT_DOOM, 120000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_AURA: - DoCastAOE(SPELL_NECROTIC_AURA); - events.ScheduleEvent(EVENT_AURA, 20000); - break; - case EVENT_BLOOM: - // TODO : Add missing text - DoCastAOE(SPELL_SUMMON_SPORE, true); - DoCastAOE(RAID_MODE(SPELL_DEATHBLOOM,H_SPELL_DEATHBLOOM)); - events.ScheduleEvent(EVENT_BLOOM, 30000); - break; - case EVENT_DOOM: - DoCastAOE(RAID_MODE(SPELL_INEVITABLE_DOOM,H_SPELL_INEVITABLE_DOOM)); - events.ScheduleEvent(EVENT_DOOM, events.GetTimer() < 5*60000 ? 30000 : 15000); - break; + switch(eventId) + { + case EVENT_AURA: + DoCastAOE(SPELL_NECROTIC_AURA); + events.ScheduleEvent(EVENT_AURA, 20000); + break; + case EVENT_BLOOM: + // TODO : Add missing text + DoCastAOE(SPELL_SUMMON_SPORE, true); + DoCastAOE(RAID_MODE(SPELL_DEATHBLOOM,H_SPELL_DEATHBLOOM)); + events.ScheduleEvent(EVENT_BLOOM, 30000); + break; + case EVENT_DOOM: + DoCastAOE(RAID_MODE(SPELL_INEVITABLE_DOOM,H_SPELL_INEVITABLE_DOOM)); + events.ScheduleEvent(EVENT_DOOM, events.GetTimer() < 5*60000 ? 30000 : 15000); + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_loatheb(Creature* pCreature) -{ - return new boss_loathebAI (pCreature); -} enum SporeSpells { SPELL_FUNGAL_CREEP = 29232 }; - -struct mob_loatheb_sporeAI : public ScriptedAI +
class mob_loatheb_spore : public CreatureScript { - mob_loatheb_sporeAI(Creature *c) : ScriptedAI(c) {} +public: + mob_loatheb_spore() : CreatureScript("mob_loatheb_spore") { } - void JustDied(Unit* killer) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(killer, SPELL_FUNGAL_CREEP); + return new mob_loatheb_sporeAI (pCreature); } + + struct mob_loatheb_sporeAI : public ScriptedAI + { + mob_loatheb_sporeAI(Creature *c) : ScriptedAI(c) {} + + void JustDied(Unit* killer) + { + DoCast(killer, SPELL_FUNGAL_CREEP); + } + }; + }; -CreatureAI* GetAI_mob_loatheb_spore(Creature* pCreature) -{ - return new mob_loatheb_sporeAI (pCreature); -} void AddSC_boss_loatheb() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_loatheb"; - newscript->GetAI = &GetAI_boss_loatheb; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_loatheb_spore"; - newscript->GetAI = &GetAI_mob_loatheb_spore; - newscript->RegisterSelf(); - - // Fungal Creep - //GetAISpellInfo(29232)->condition = AICOND_DIE; + new boss_loatheb(); + new mob_loatheb_spore(); } - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index b7a61ad0aca..b1aee9c90bc 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -55,131 +55,134 @@ enum Events EVENT_SUMMON, EVENT_FRENZY, }; - -struct boss_maexxnaAI : public BossAI +
class boss_maexxna : public CreatureScript { - boss_maexxnaAI(Creature *c) : BossAI(c, BOSS_MAEXXNA) {} - - bool enraged; +public: + boss_maexxna() : CreatureScript("boss_maexxna") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - enraged = false; - events.ScheduleEvent(EVENT_WRAP, 20000); - events.ScheduleEvent(EVENT_SPRAY, 40000); - events.ScheduleEvent(EVENT_SHOCK, urand(5000,10000)); - events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); - events.ScheduleEvent(EVENT_SUMMON, 30000); + return new boss_maexxnaAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_maexxnaAI : public BossAI { - if (!UpdateVictim() || !CheckInRoom()) - return; + boss_maexxnaAI(Creature *c) : BossAI(c, BOSS_MAEXXNA) {} - if (!enraged && HealthBelowPct(30)) + bool enraged; + + void EnterCombat(Unit * /*who*/) { - enraged = true; - events.ScheduleEvent(EVENT_FRENZY, 0); // will be cast immediately + _EnterCombat(); + enraged = false; + events.ScheduleEvent(EVENT_WRAP, 20000); + events.ScheduleEvent(EVENT_SPRAY, 40000); + events.ScheduleEvent(EVENT_SHOCK, urand(5000,10000)); + events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); + events.ScheduleEvent(EVENT_SUMMON, 30000); } - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim() || !CheckInRoom()) + return; + + if (!enraged && HealthBelowPct(30)) { - case EVENT_WRAP: - // TODO : Add missing text - for (uint8 i = 0; i < RAID_MODE(1,2); ++i) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) + enraged = true; + events.ScheduleEvent(EVENT_FRENZY, 0); // will be cast immediately + } + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_WRAP: + // TODO : Add missing text + for (uint8 i = 0; i < RAID_MODE(1,2); ++i) { - pTarget->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); - uint8 pos = rand()%MAX_POS_WRAP; - pTarget->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); - if (Creature *wrap = DoSummon(MOB_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN)) - wrap->AI()->SetGUID(pTarget->GetGUID()); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) + { + pTarget->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); + uint8 pos = rand()%MAX_POS_WRAP; + pTarget->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); + if (Creature *wrap = DoSummon(MOB_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN)) + wrap->AI()->SetGUID(pTarget->GetGUID()); + } } - } - events.ScheduleEvent(EVENT_WRAP, 40000); - break; - case EVENT_SPRAY: - DoCastAOE(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); - events.ScheduleEvent(EVENT_SPRAY, 40000); - break; - case EVENT_SHOCK: - DoCastAOE(RAID_MODE(SPELL_POISON_SHOCK_10,SPELL_POISON_SHOCK_25)); - events.ScheduleEvent(EVENT_SHOCK, urand(10000,20000)); - break; - case EVENT_POISON: - DoCast(me->getVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10,SPELL_NECROTIC_POISON_25)); - events.ScheduleEvent(EVENT_POISON, urand(10000, 20000)); - break; - case EVENT_FRENZY: - DoCast(me, RAID_MODE(SPELL_FRENZY_10,SPELL_FRENZY_25), true); - events.ScheduleEvent(EVENT_FRENZY, 600000); - break; - case EVENT_SUMMON: - // TODO : Add missing text - uint8 amount = urand(8,10); - for (uint8 i = 0; i < amount; ++i) - DoSummon(MOB_SPIDERLING, me, 0, TEMPSUMMON_CORPSE_DESPAWN); - events.ScheduleEvent(EVENT_SUMMON, 40000); - break; + events.ScheduleEvent(EVENT_WRAP, 40000); + break; + case EVENT_SPRAY: + DoCastAOE(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); + events.ScheduleEvent(EVENT_SPRAY, 40000); + break; + case EVENT_SHOCK: + DoCastAOE(RAID_MODE(SPELL_POISON_SHOCK_10,SPELL_POISON_SHOCK_25)); + events.ScheduleEvent(EVENT_SHOCK, urand(10000,20000)); + break; + case EVENT_POISON: + DoCast(me->getVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10,SPELL_NECROTIC_POISON_25)); + events.ScheduleEvent(EVENT_POISON, urand(10000, 20000)); + break; + case EVENT_FRENZY: + DoCast(me, RAID_MODE(SPELL_FRENZY_10,SPELL_FRENZY_25), true); + events.ScheduleEvent(EVENT_FRENZY, 600000); + break; + case EVENT_SUMMON: + // TODO : Add missing text + uint8 amount = urand(8,10); + for (uint8 i = 0; i < amount; ++i) + DoSummon(MOB_SPIDERLING, me, 0, TEMPSUMMON_CORPSE_DESPAWN); + events.ScheduleEvent(EVENT_SUMMON, 40000); + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_webwrapAI : public NullCreatureAI +
class mob_webwrap : public CreatureScript { - mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} +public: + mob_webwrap() : CreatureScript("mob_webwrap") { } - uint64 victimGUID; - - void SetGUID(const uint64 &guid, int32 /*param*/) + CreatureAI* GetAI(Creature* pCreature) const { - victimGUID = guid; - if (me->m_spells[0] && victimGUID) - if (Unit *victim = Unit::GetUnit(*me, victimGUID)) - victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); + return new mob_webwrapAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct mob_webwrapAI : public NullCreatureAI { - if (me->m_spells[0] && victimGUID) - if (Unit *victim = Unit::GetUnit(*me, victimGUID)) - victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); - } -}; + mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} -CreatureAI* GetAI_boss_maexxna(Creature* pCreature) -{ - return new boss_maexxnaAI (pCreature); -} + uint64 victimGUID; -CreatureAI* GetAI_mob_webwrap(Creature* pCreature) -{ - return new mob_webwrapAI (pCreature); -} + void SetGUID(const uint64 &guid, int32 /*param*/) + { + victimGUID = guid; + if (me->m_spells[0] && victimGUID) + if (Unit *victim = Unit::GetUnit(*me, victimGUID)) + victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); + } -void AddSC_boss_maexxna() -{ - Script *newscript; + void JustDied(Unit * /*killer*/) + { + if (me->m_spells[0] && victimGUID) + if (Unit *victim = Unit::GetUnit(*me, victimGUID)) + victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); + } + }; - newscript = new Script; - newscript->Name = "boss_maexxna"; - newscript->GetAI = &GetAI_boss_maexxna; - newscript->RegisterSelf(); +}; - newscript = new Script; - newscript->Name = "mob_webwrap"; - newscript->GetAI = &GetAI_mob_webwrap; - newscript->RegisterSelf(); -} +void AddSC_boss_maexxna() +{ + new boss_maexxna(); + new mob_webwrap(); +} diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index 6b93e5ea19d..569ef2b1670 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -62,152 +62,155 @@ enum Events EVENT_WAVE, EVENT_GROUND, }; - -struct boss_nothAI : public BossAI +
class boss_noth : public CreatureScript { - boss_nothAI(Creature *c) : BossAI(c, BOSS_NOTH) {} - - uint32 waveCount, balconyCount; +public: + boss_noth() : CreatureScript("boss_noth") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - _Reset(); + return new boss_nothAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_nothAI : public BossAI { - _EnterCombat(); - DoScriptText(SAY_AGGRO, me); - balconyCount = 0; - EnterPhaseGround(); - } + boss_nothAI(Creature *c) : BossAI(c, BOSS_NOTH) {} - void EnterPhaseGround() - { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoZoneInCombat(); - if (me->getThreatManager().isThreatListEmpty()) - EnterEvadeMode(); - else + uint32 waveCount, balconyCount; + + void Reset() { - events.ScheduleEvent(EVENT_BALCONY, 110000); - events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000); - events.ScheduleEvent(EVENT_WARRIOR, 30000); - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) - events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + _Reset(); } - } - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); - } + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoScriptText(SAY_AGGRO, me); + balconyCount = 0; + EnterPhaseGround(); + } - void JustSummoned(Creature *summon) - { - summons.Summon(summon); - summon->setActive(true); - summon->AI()->DoZoneInCombat(); - } + void EnterPhaseGround() + { + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoZoneInCombat(); + if (me->getThreatManager().isThreatListEmpty()) + EnterEvadeMode(); + else + { + events.ScheduleEvent(EVENT_BALCONY, 110000); + events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000); + events.ScheduleEvent(EVENT_WARRIOR, 30000); + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000); + } + } - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } + void KilledUnit(Unit* /*victim*/) + { + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); + } - void SummonUndead(uint32 entry, uint32 num) - { - for (uint32 i = 0; i < num; ++i) + void JustSummoned(Creature *summon) { - uint32 pos = rand()%MAX_SUMMON_POS; - me->SummonCreature(entry, SummonPos[pos][0], SummonPos[pos][1], SummonPos[pos][2], - SummonPos[pos][3], TEMPSUMMON_CORPSE_DESPAWN, 60000); + summons.Summon(summon); + summon->setActive(true); + summon->AI()->DoZoneInCombat(); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateCombatState() || !CheckInRoom()) - return; + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } - events.Update(diff); + void SummonUndead(uint32 entry, uint32 num) + { + for (uint32 i = 0; i < num; ++i) + { + uint32 pos = rand()%MAX_SUMMON_POS; + me->SummonCreature(entry, SummonPos[pos][0], SummonPos[pos][1], SummonPos[pos][2], + SummonPos[pos][3], TEMPSUMMON_CORPSE_DESPAWN, 60000); + } + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateCombatState() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_CURSE: - DoCastAOE(SPELL_CURSE_PLAGUEBRINGER); - events.ScheduleEvent(EVENT_CURSE, 50000 + rand()%10000); - return; - case EVENT_WARRIOR: - DoScriptText(SAY_SUMMON, me); - SummonUndead(MOB_WARRIOR, RAID_MODE(2,3)); - events.ScheduleEvent(EVENT_WARRIOR, 30000); - return; - case EVENT_BLINK: - DoCastAOE(SPELL_CRIPPLE, true); - DoCastAOE(SPELL_BLINK); - DoResetThreat(); - events.ScheduleEvent(EVENT_BLINK, 40000); - return; - case EVENT_BALCONY: - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AttackStop(); - me->RemoveAllAuras(); - me->NearTeleportTo(TELE_X, TELE_Y, TELE_Z, TELE_O); - events.Reset(); - events.ScheduleEvent(EVENT_WAVE, 2000 + rand()%3000); - waveCount = 0; - return; - case EVENT_WAVE: - DoScriptText(SAY_SUMMON, me); - switch(balconyCount) + switch(eventId) + { + case EVENT_CURSE: + DoCastAOE(SPELL_CURSE_PLAGUEBRINGER); + events.ScheduleEvent(EVENT_CURSE, 50000 + rand()%10000); + return; + case EVENT_WARRIOR: + DoScriptText(SAY_SUMMON, me); + SummonUndead(MOB_WARRIOR, RAID_MODE(2,3)); + events.ScheduleEvent(EVENT_WARRIOR, 30000); + return; + case EVENT_BLINK: + DoCastAOE(SPELL_CRIPPLE, true); + DoCastAOE(SPELL_BLINK); + DoResetThreat(); + events.ScheduleEvent(EVENT_BLINK, 40000); + return; + case EVENT_BALCONY: + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AttackStop(); + me->RemoveAllAuras(); + me->NearTeleportTo(TELE_X, TELE_Y, TELE_Z, TELE_O); + events.Reset(); + events.ScheduleEvent(EVENT_WAVE, 2000 + rand()%3000); + waveCount = 0; + return; + case EVENT_WAVE: + DoScriptText(SAY_SUMMON, me); + switch(balconyCount) + { + case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2,4)); break; + case 1: SummonUndead(MOB_CHAMPION, RAID_MODE(1,2)); + SummonUndead(MOB_GUARDIAN, RAID_MODE(1,2)); break; + case 2: SummonUndead(MOB_GUARDIAN, RAID_MODE(2,4)); break; + default:SummonUndead(MOB_CHAMPION, RAID_MODE(5,10)); + SummonUndead(MOB_GUARDIAN, RAID_MODE(5,10));break; + } + ++waveCount; + events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, 30000 + rand()%15000); + return; + case EVENT_GROUND: { - case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2,4)); break; - case 1: SummonUndead(MOB_CHAMPION, RAID_MODE(1,2)); - SummonUndead(MOB_GUARDIAN, RAID_MODE(1,2)); break; - case 2: SummonUndead(MOB_GUARDIAN, RAID_MODE(2,4)); break; - default:SummonUndead(MOB_CHAMPION, RAID_MODE(5,10)); - SummonUndead(MOB_GUARDIAN, RAID_MODE(5,10));break; + ++balconyCount; + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->NearTeleportTo(x, y, z, o); + events.ScheduleEvent(EVENT_BALCONY, 110000); + EnterPhaseGround(); + return; } - ++waveCount; - events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, 30000 + rand()%15000); - return; - case EVENT_GROUND: - { - ++balconyCount; - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o); - events.ScheduleEvent(EVENT_BALCONY, 110000); - EnterPhaseGround(); - return; } } + + if (me->HasReactState(REACT_AGGRESSIVE)) + DoMeleeAttackIfReady(); } + }; - if (me->HasReactState(REACT_AGGRESSIVE)) - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_noth(Creature* pCreature) -{ - return new boss_nothAI (pCreature); -} void AddSC_boss_noth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_noth"; - newscript->GetAI = &GetAI_boss_noth; - newscript->RegisterSelf(); + new boss_noth(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index bd30cb20471..22551ac379e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -49,112 +49,115 @@ enum { ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286, }; - -struct boss_patchwerkAI : public BossAI +
class boss_patchwerk : public CreatureScript { - boss_patchwerkAI(Creature *c) : BossAI(c, BOSS_PATCHWERK) {} - - bool Enraged; +public: + boss_patchwerk() : CreatureScript("boss_patchwerk") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); + return new boss_patchwerkAI (pCreature); } - void KilledUnit(Unit* /*Victim*/) + struct boss_patchwerkAI : public BossAI { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); - } + boss_patchwerkAI(Creature *c) : BossAI(c, BOSS_PATCHWERK) {} - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } + bool Enraged; - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - Enraged = false; - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); - events.ScheduleEvent(EVENT_HATEFUL, 1200); - events.ScheduleEvent(EVENT_BERSERK, 360000); - - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); - } + void Reset() + { + _Reset(); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); + } + + void KilledUnit(Unit* /*Victim*/) + { + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); + } - events.Update(diff); + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit * /*who*/) { - switch(eventId) + _EnterCombat(); + Enraged = false; + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); + events.ScheduleEvent(EVENT_HATEFUL, 1200); + events.ScheduleEvent(EVENT_BERSERK, 360000); + + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_HATEFUL: + switch(eventId) { - //Cast Hateful strike on the player with the highest - //amount of HP within melee distance - uint32 MostHP = 0; - Unit* pMostHPTarget = NULL; - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + case EVENT_HATEFUL: { - Unit *pTarget = (*i)->getTarget(); - if (pTarget->isAlive() && pTarget->GetHealth() > MostHP && me->IsWithinMeleeRange(pTarget)) + //Cast Hateful strike on the player with the highest + //amount of HP within melee distance + uint32 MostHP = 0; + Unit* pMostHPTarget = NULL; + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) { - MostHP = pTarget->GetHealth(); - pMostHPTarget = pTarget; + Unit *pTarget = (*i)->getTarget(); + if (pTarget->isAlive() && pTarget->GetHealth() > MostHP && me->IsWithinMeleeRange(pTarget)) + { + MostHP = pTarget->GetHealth(); + pMostHPTarget = pTarget; + } } - } - if (pMostHPTarget) - DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE,H_SPELL_HATEFUL_STRIKE), true); + if (pMostHPTarget) + DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE,H_SPELL_HATEFUL_STRIKE), true); - events.ScheduleEvent(EVENT_HATEFUL, 1200); - break; + events.ScheduleEvent(EVENT_HATEFUL, 1200); + break; + } + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK, true); + DoScriptText(EMOTE_BERSERK, me); + events.ScheduleEvent(EVENT_SLIME, 2000); + break; + case EVENT_SLIME: + DoCast(me->getVictim(), SPELL_SLIME_BOLT); + events.ScheduleEvent(EVENT_SLIME, 2000); + break; } - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK, true); - DoScriptText(EMOTE_BERSERK, me); - events.ScheduleEvent(EVENT_SLIME, 2000); - break; - case EVENT_SLIME: - DoCast(me->getVictim(), SPELL_SLIME_BOLT); - events.ScheduleEvent(EVENT_SLIME, 2000); - break; } - } - if (!Enraged && HealthBelowPct(5)) - { - DoCast(me, SPELL_FRENZY, true); - DoScriptText(EMOTE_ENRAGE, me); - Enraged = true; + if (!Enraged && HealthBelowPct(5)) + { + DoCast(me, SPELL_FRENZY, true); + DoScriptText(EMOTE_ENRAGE, me); + Enraged = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_patchwerk(Creature* pCreature) -{ - return new boss_patchwerkAI (pCreature); -} void AddSC_boss_patchwerk() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_patchwerk"; - newscript->GetAI = &GetAI_boss_patchwerk; - newscript->RegisterSelf(); + new boss_patchwerk(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index 12d5b3057f5..bef81ded30f 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -51,88 +51,91 @@ enum Events EVENT_KNIFE, EVENT_COMMAND, }; - -struct boss_razuviousAI : public BossAI +
class boss_razuvious : public CreatureScript { - boss_razuviousAI(Creature *c) : BossAI(c, BOSS_RAZUVIOUS) {} +public: + boss_razuvious() : CreatureScript("boss_razuvious") { } - void KilledUnit(Unit* /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (!(rand()%3)) - DoPlaySoundToSet(me, SOUND_SLAY); + return new boss_razuviousAI (pCreature); } - void DamageTaken(Unit* pDone_by, uint32& uiDamage) + struct boss_razuviousAI : public BossAI { - // Damage done by the controlled Death Knight understudies should also count toward damage done by players - if (pDone_by->GetTypeId() == TYPEID_UNIT && (pDone_by->GetEntry() == 16803 || pDone_by->GetEntry() == 29941)) + boss_razuviousAI(Creature *c) : BossAI(c, BOSS_RAZUVIOUS) {} + + void KilledUnit(Unit* /*victim*/) { - me->LowerPlayerDamageReq(uiDamage); + if (!(rand()%3)) + DoPlaySoundToSet(me, SOUND_SLAY); } - } - - void JustDied(Unit* /*killer*/) - { - _JustDied(); - DoPlaySoundToSet(me, SOUND_DEATH); - me->CastSpell(me, SPELL_HOPELESS, true); // TODO: this may affect other creatures - } - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoPlaySoundToSet(me, SOUND_AGGRO); - events.ScheduleEvent(EVENT_STRIKE, 30000); - events.ScheduleEvent(EVENT_SHOUT, 25000); - events.ScheduleEvent(EVENT_COMMAND, 40000); - events.ScheduleEvent(EVENT_KNIFE, 10000); - } + void DamageTaken(Unit* pDone_by, uint32& uiDamage) + { + // Damage done by the controlled Death Knight understudies should also count toward damage done by players + if (pDone_by->GetTypeId() == TYPEID_UNIT && (pDone_by->GetEntry() == 16803 || pDone_by->GetEntry() == 29941)) + { + me->LowerPlayerDamageReq(uiDamage); + } + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void JustDied(Unit* /*killer*/) + { + _JustDied(); + DoPlaySoundToSet(me, SOUND_DEATH); + me->CastSpell(me, SPELL_HOPELESS, true); // TODO: this may affect other creatures + } - events.Update(diff); + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoPlaySoundToSet(me, SOUND_AGGRO); + events.ScheduleEvent(EVENT_STRIKE, 30000); + events.ScheduleEvent(EVENT_SHOUT, 25000); + events.ScheduleEvent(EVENT_COMMAND, 40000); + events.ScheduleEvent(EVENT_KNIFE, 10000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_STRIKE: - DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); - events.ScheduleEvent(EVENT_STRIKE, 30000); - return; - case EVENT_SHOUT: - DoCastAOE(SPELL_DISRUPTING_SHOUT); - events.ScheduleEvent(EVENT_SHOUT, 25000); - return; - case EVENT_KNIFE: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) - DoCast(pTarget, SPELL_JAGGED_KNIFE); - events.ScheduleEvent(EVENT_KNIFE, 10000); - return; - case EVENT_COMMAND: - DoPlaySoundToSet(me, SOUND_COMMND); - events.ScheduleEvent(EVENT_COMMAND, 40000); - return; + switch(eventId) + { + case EVENT_STRIKE: + DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); + events.ScheduleEvent(EVENT_STRIKE, 30000); + return; + case EVENT_SHOUT: + DoCastAOE(SPELL_DISRUPTING_SHOUT); + events.ScheduleEvent(EVENT_SHOUT, 25000); + return; + case EVENT_KNIFE: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + DoCast(pTarget, SPELL_JAGGED_KNIFE); + events.ScheduleEvent(EVENT_KNIFE, 10000); + return; + case EVENT_COMMAND: + DoPlaySoundToSet(me, SOUND_COMMND); + events.ScheduleEvent(EVENT_COMMAND, 40000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_razuvious(Creature* pCreature) -{ - return new boss_razuviousAI (pCreature); -} void AddSC_boss_razuvious() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_razuvious"; - newscript->GetAI = &GetAI_boss_razuvious; - newscript->RegisterSelf(); + new boss_razuvious(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 0b2ac4173e2..d2c341d6db1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -68,335 +68,334 @@ enum Events }; typedef std::map<uint64, uint64> IceBlockMap; - -struct boss_sapphironAI : public BossAI +
class boss_sapphiron : public CreatureScript { - boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) - , phase(PHASE_NULL) +public: + boss_sapphiron() : CreatureScript("boss_sapphiron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pMap = me->GetMap(); + return new boss_sapphironAI (pCreature); } - Phases phase; - uint32 iceboltCount; - IceBlockMap iceblocks; + struct boss_sapphironAI : public BossAI + { + boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) + , phase(PHASE_NULL) + { + pMap = me->GetMap(); + } - bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147) - uint32 CheckFrostResistTimer; - Map* pMap; + Phases phase; + uint32 iceboltCount; + IceBlockMap iceblocks; - void InitializeAI() - { - float x, y, z; - me->GetPosition(x, y, z); - me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - - ScriptedAI::InitializeAI(); - } + bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147) + uint32 CheckFrostResistTimer; + Map* pMap; - void Reset() - { - _Reset(); + void InitializeAI() + { + float x, y, z; + me->GetPosition(x, y, z); + me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + + ScriptedAI::InitializeAI(); + } - if (phase == PHASE_FLIGHT) - ClearIceBlock(); + void Reset() + { + _Reset(); - phase = PHASE_NULL; + if (phase == PHASE_FLIGHT) + ClearIceBlock(); - CanTheHundredClub = true; - CheckFrostResistTimer = 5000; - } + phase = PHASE_NULL; - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); + CanTheHundredClub = true; + CheckFrostResistTimer = 5000; + } - me->CastSpell(me, SPELL_FROST_AURA, true); + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); - events.ScheduleEvent(EVENT_BERSERK, 15*60000); - EnterPhaseGround(); + me->CastSpell(me, SPELL_FROST_AURA, true); - CheckPlayersFrostResist(); - } + events.ScheduleEvent(EVENT_BERSERK, 15*60000); + EnterPhaseGround(); - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) - { - if (spell->Id == SPELL_ICEBOLT) + CheckPlayersFrostResist(); + } + + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) { - IceBlockMap::iterator itr = iceblocks.find(pTarget->GetGUID()); - if (itr != iceblocks.end() && !itr->second) + if (spell->Id == SPELL_ICEBOLT) { - if (GameObject *iceblock = me->SummonGameObject(GO_ICEBLOCK, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, 0, 0, 0, 0, 25000)) - itr->second = iceblock->GetGUID(); + IceBlockMap::iterator itr = iceblocks.find(pTarget->GetGUID()); + if (itr != iceblocks.end() && !itr->second) + { + if (GameObject *iceblock = me->SummonGameObject(GO_ICEBLOCK, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, 0, 0, 0, 0, 25000)) + itr->second = iceblock->GetGUID(); + } } } - } - - void JustDied(Unit* /*who*/) - { - _JustDied(); - me->CastSpell(me, SPELL_DIES, true); - CheckPlayersFrostResist(); - if (CanTheHundredClub) + void JustDied(Unit* /*who*/) { - AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); - if (AchievTheHundredClub) + _JustDied(); + me->CastSpell(me, SPELL_DIES, true); + + CheckPlayersFrostResist(); + if (CanTheHundredClub) { - if (pMap && pMap->IsDungeon()) + AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); + if (AchievTheHundredClub) { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievTheHundredClub); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievTheHundredClub); + } } } } - } - void MovementInform(uint32, uint32 id) - { - if (id == 1) - events.ScheduleEvent(EVENT_LIFTOFF, 0); - } + void MovementInform(uint32, uint32 id) + { + if (id == 1) + events.ScheduleEvent(EVENT_LIFTOFF, 0); + } - void DoAction(const int32 param) - { - if (param == DATA_SAPPHIRON_BIRTH) + void DoAction(const int32 param) { - phase = PHASE_BIRTH; - events.ScheduleEvent(EVENT_BIRTH, 23000); + if (param == DATA_SAPPHIRON_BIRTH) + { + phase = PHASE_BIRTH; + events.ScheduleEvent(EVENT_BIRTH, 23000); + } } - } - void CheckPlayersFrostResist() - { - if (CanTheHundredClub && pMap && pMap->IsDungeon()) + void CheckPlayersFrostResist() { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (CanTheHundredClub && pMap && pMap->IsDungeon()) { - if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - CanTheHundredClub = false; - break; + if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) + { + CanTheHundredClub = false; + break; + } } } } - } - void EnterPhaseGround() - { - phase = PHASE_GROUND; - me->SetReactState(REACT_AGGRESSIVE); - events.SetPhase(PHASE_GROUND); - events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_BLIZZARD, 5000+rand()%5000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_FLIGHT, 45000); - } + void EnterPhaseGround() + { + phase = PHASE_GROUND; + me->SetReactState(REACT_AGGRESSIVE); + events.SetPhase(PHASE_GROUND); + events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_BLIZZARD, 5000+rand()%5000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_FLIGHT, 45000); + } - void ClearIceBlock() - { - for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) + void ClearIceBlock() { - if (Player* pPlayer = Unit::GetPlayer(*me, itr->first)) - pPlayer->RemoveAura(SPELL_ICEBOLT); - if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) - pGo->Delete(); + for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) + { + if (Player* pPlayer = Unit::GetPlayer(*me, itr->first)) + pPlayer->RemoveAura(SPELL_ICEBOLT); + if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) + pGo->Delete(); + } + iceblocks.clear(); } - iceblocks.clear(); - } - void UpdateAI(const uint32 diff) - { - if (!phase) - return; + void UpdateAI(const uint32 diff) + { + if (!phase) + return; - events.Update(diff); + events.Update(diff); - if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom()) - return; + if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom()) + return; - if (CanTheHundredClub) - { - if (CheckFrostResistTimer <= diff) + if (CanTheHundredClub) { - CheckPlayersFrostResist(); - CheckFrostResistTimer = (rand() % 5 + 5) * 1000; - } else CheckFrostResistTimer -= diff; - } + if (CheckFrostResistTimer <= diff) + { + CheckPlayersFrostResist(); + CheckFrostResistTimer = (rand() % 5 + 5) * 1000; + } else CheckFrostResistTimer -= diff; + } - if (phase == PHASE_GROUND) - { - while (uint32 eventId = events.ExecuteEvent()) + if (phase == PHASE_GROUND) { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_BERSERK: - DoScriptText(EMOTE_ENRAGE, me); - DoCast(me, SPELL_BERSERK); - return; - case EVENT_CLEAVE: - DoCast(me->getVictim(), SPELL_CLEAVE); - events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); - return; - case EVENT_TAIL: - DoCastAOE(SPELL_TAIL_SWEEP); - events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); - return; - case EVENT_DRAIN: - DoCastAOE(SPELL_LIFE_DRAIN); - events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); - return; - case EVENT_BLIZZARD: + switch(eventId) { - //DoCastAOE(SPELL_SUMMON_BLIZZARD); - if (Creature *pSummon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000,30000), TEMPSUMMON_TIMED_DESPAWN)) - pSummon->GetMotionMaster()->MoveRandom(40); - events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000,7000), 0, PHASE_GROUND); - break; + case EVENT_BERSERK: + DoScriptText(EMOTE_ENRAGE, me); + DoCast(me, SPELL_BERSERK); + return; + case EVENT_CLEAVE: + DoCast(me->getVictim(), SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); + return; + case EVENT_TAIL: + DoCastAOE(SPELL_TAIL_SWEEP); + events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); + return; + case EVENT_DRAIN: + DoCastAOE(SPELL_LIFE_DRAIN); + events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); + return; + case EVENT_BLIZZARD: + { + //DoCastAOE(SPELL_SUMMON_BLIZZARD); + if (Creature *pSummon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000,30000), TEMPSUMMON_TIMED_DESPAWN)) + pSummon->GetMotionMaster()->MoveRandom(40); + events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000,7000), 0, PHASE_GROUND); + break; + } + case EVENT_FLIGHT: + phase = PHASE_FLIGHT; + events.SetPhase(PHASE_FLIGHT); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(1, x, y, z); + return; } - case EVENT_FLIGHT: - phase = PHASE_FLIGHT; - events.SetPhase(PHASE_FLIGHT); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(1, x, y, z); - return; } - } - DoMeleeAttackIfReady(); - } - else - { - if (uint32 eventId = events.ExecuteEvent()) + DoMeleeAttackIfReady(); + } + else { - switch(eventId) + if (uint32 eventId = events.ExecuteEvent()) { - case EVENT_LIFTOFF: - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_ICEBOLT, 1500); - iceboltCount = RAID_MODE(2,3); - return; - case EVENT_ICEBOLT: + switch(eventId) { - std::vector<Unit*> targets; - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) - targets.push_back((*i)->getTarget()); - - if (targets.empty()) - iceboltCount = 0; - else + case EVENT_LIFTOFF: + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SendMovementFlagUpdate(); + events.ScheduleEvent(EVENT_ICEBOLT, 1500); + iceboltCount = RAID_MODE(2,3); + return; + case EVENT_ICEBOLT: { - std::vector<Unit*>::const_iterator itr = targets.begin(); - advance(itr, rand()%targets.size()); - iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); - DoCast(*itr, SPELL_ICEBOLT); - --iceboltCount; + std::vector<Unit*> targets; + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) + targets.push_back((*i)->getTarget()); + + if (targets.empty()) + iceboltCount = 0; + else + { + std::vector<Unit*>::const_iterator itr = targets.begin(); + advance(itr, rand()%targets.size()); + iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); + DoCast(*itr, SPELL_ICEBOLT); + --iceboltCount; + } + + if (iceboltCount) + events.ScheduleEvent(EVENT_ICEBOLT, 1000); + else + events.ScheduleEvent(EVENT_BREATH, 1000); + return; } - - if (iceboltCount) - events.ScheduleEvent(EVENT_ICEBOLT, 1000); - else - events.ScheduleEvent(EVENT_BREATH, 1000); - return; - } - case EVENT_BREATH: - { - DoScriptText(EMOTE_BREATH, me); - DoCastAOE(SPELL_FROST_MISSILE); - events.ScheduleEvent(EVENT_EXPLOSION, 8000); - return; + case EVENT_BREATH: + { + DoScriptText(EMOTE_BREATH, me); + DoCastAOE(SPELL_FROST_MISSILE); + events.ScheduleEvent(EVENT_EXPLOSION, 8000); + return; + } + case EVENT_EXPLOSION: + CastExplosion(); + ClearIceBlock(); + events.ScheduleEvent(EVENT_LAND, 3000); + return; + case EVENT_LAND: + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SendMovementFlagUpdate(); + events.ScheduleEvent(EVENT_GROUND, 1500); + return; + case EVENT_GROUND: + EnterPhaseGround(); + return; + case EVENT_BIRTH: + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + return; } - case EVENT_EXPLOSION: - CastExplosion(); - ClearIceBlock(); - events.ScheduleEvent(EVENT_LAND, 3000); - return; - case EVENT_LAND: - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_GROUND, 1500); - return; - case EVENT_GROUND: - EnterPhaseGround(); - return; - case EVENT_BIRTH: - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - return; - } - }//if (uint32 eventId = events.ExecuteEvent()) - }//if (phase == PHASE_GROUND) - } + }//if (uint32 eventId = events.ExecuteEvent()) + }//if (phase == PHASE_GROUND) + } - void CastExplosion() - { - DoZoneInCombat(); // make sure everyone is in threatlist - std::vector<Unit*> targets; - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + void CastExplosion() { - Unit *pTarget = (*i)->getTarget(); - if (pTarget->GetTypeId() != TYPEID_PLAYER) - continue; - - if (pTarget->HasAura(SPELL_ICEBOLT)) + DoZoneInCombat(); // make sure everyone is in threatlist + std::vector<Unit*> targets; + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) { - pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); - targets.push_back(pTarget); - continue; - } + Unit *pTarget = (*i)->getTarget(); + if (pTarget->GetTypeId() != TYPEID_PLAYER) + continue; - for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) - { - if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) + if (pTarget->HasAura(SPELL_ICEBOLT)) + { + pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); + targets.push_back(pTarget); + continue; + } + + for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) { - if (pGo->IsInBetween(me, pTarget, 2.0f) - && me->GetExactDist2d(pTarget->GetPositionX(), pTarget->GetPositionY()) - me->GetExactDist2d(pGo->GetPositionX(), pGo->GetPositionY()) < 5.0f) + if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) { - pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); - targets.push_back(pTarget); - break; + if (pGo->IsInBetween(me, pTarget, 2.0f) + && me->GetExactDist2d(pTarget->GetPositionX(), pTarget->GetPositionY()) - me->GetExactDist2d(pGo->GetPositionX(), pGo->GetPositionY()) < 5.0f) + { + pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); + targets.push_back(pTarget); + break; + } } } } - } - me->CastSpell(me, SPELL_FROST_EXPLOSION, true); + me->CastSpell(me, SPELL_FROST_EXPLOSION, true); + + for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); + } + }; - for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); - } }; -CreatureAI* GetAI_boss_sapphiron(Creature* pCreature) -{ - return new boss_sapphironAI (pCreature); -} void AddSC_boss_sapphiron() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_sapphiron"; - newscript->GetAI = &GetAI_boss_sapphiron; - newscript->RegisterSelf(); - - // Chill - GetAISpellInfo(28547)->cooldown = 1000; - GetAISpellInfo(55699)->cooldown = 1000; + new boss_sapphiron(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 9d224f01022..a027aeda3bc 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -93,307 +93,316 @@ enum Events EVENT_CHAIN, EVENT_BERSERK, }; - -struct boss_thaddiusAI : public BossAI +
class boss_thaddius : public CreatureScript { - boss_thaddiusAI(Creature *c) : BossAI(c, BOSS_THADDIUS) - { - // init is a bit tricky because thaddius shall track the life of both adds, but not if there was a wipe - // and, in particular, if there was a crash after both adds were killed (should not respawn) +public: + boss_thaddius() : CreatureScript("boss_thaddius") { } - // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn - // and each mob will send its status at reset (meaning that it is alive) - checkFeugenAlive = false; - if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) - checkFeugenAlive = pFeugen->isAlive(); - - checkStalaggAlive = false; - if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) - checkStalaggAlive = pStalagg->isAlive(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_thaddiusAI (pCreature); + } - if (!checkFeugenAlive && !checkStalaggAlive) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_AGGRESSIVE); - } - else + struct boss_thaddiusAI : public BossAI + { + boss_thaddiusAI(Creature *c) : BossAI(c, BOSS_THADDIUS) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); - } - } + // init is a bit tricky because thaddius shall track the life of both adds, but not if there was a wipe + // and, in particular, if there was a crash after both adds were killed (should not respawn) - bool checkStalaggAlive; - bool checkFeugenAlive; - uint32 uiAddsTimer; + // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn + // and each mob will send its status at reset (meaning that it is alive) + checkFeugenAlive = false; + if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + checkFeugenAlive = pFeugen->isAlive(); - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); - } + checkStalaggAlive = false; + if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) + checkStalaggAlive = pStalagg->isAlive(); - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } + if (!checkFeugenAlive && !checkStalaggAlive) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_AGGRESSIVE); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); + } + } - void DoAction(const int32 action) - { - switch(action) + bool checkStalaggAlive; + bool checkFeugenAlive; + uint32 uiAddsTimer; + + void KilledUnit(Unit* /*victim*/) { - case ACTION_FEUGEN_RESET: - checkFeugenAlive = true; - break; - case ACTION_FEUGEN_DIED: - checkFeugenAlive = false; - break; - case ACTION_STALAGG_RESET: - checkStalaggAlive = true; - break; - case ACTION_STALAGG_DIED: - checkStalaggAlive = false; - break; + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); } - if (!checkFeugenAlive && !checkStalaggAlive) + void JustDied(Unit* /*Killer*/) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - // REACT_AGGRESSIVE only reset when he takes damage. - DoZoneInCombat(); + _JustDied(); + DoScriptText(SAY_DEATH, me); } - else + + void DoAction(const int32 action) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); - } - } + switch(action) + { + case ACTION_FEUGEN_RESET: + checkFeugenAlive = true; + break; + case ACTION_FEUGEN_DIED: + checkFeugenAlive = false; + break; + case ACTION_STALAGG_RESET: + checkStalaggAlive = true; + break; + case ACTION_STALAGG_DIED: + checkStalaggAlive = false; + break; + } - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - events.ScheduleEvent(EVENT_SHIFT, 30000); - events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); - events.ScheduleEvent(EVENT_BERSERK, 360000); - } + if (!checkFeugenAlive && !checkStalaggAlive) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + // REACT_AGGRESSIVE only reset when he takes damage. + DoZoneInCombat(); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); + } + } - void DamageTaken(Unit * /*pDoneBy*/, uint32 & /*uiDamage*/) - { - me->SetReactState(REACT_AGGRESSIVE); - } + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + events.ScheduleEvent(EVENT_SHIFT, 30000); + events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); + events.ScheduleEvent(EVENT_BERSERK, 360000); + } - void UpdateAI(const uint32 diff) - { - if (checkFeugenAlive && checkStalaggAlive) - uiAddsTimer = 0; + void DamageTaken(Unit * /*pDoneBy*/, uint32 & /*uiDamage*/) + { + me->SetReactState(REACT_AGGRESSIVE); + } - if (checkStalaggAlive != checkFeugenAlive) + void UpdateAI(const uint32 diff) { - uiAddsTimer += diff; - if (uiAddsTimer > 5000) + if (checkFeugenAlive && checkStalaggAlive) + uiAddsTimer = 0; + + if (checkStalaggAlive != checkFeugenAlive) { - if (!checkStalaggAlive) - { - if (instance) - if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) - pStalagg->Respawn(); - } - else + uiAddsTimer += diff; + if (uiAddsTimer > 5000) { - if (instance) - if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) - pFeugen->Respawn(); + if (!checkStalaggAlive) + { + if (instance) + if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) + pStalagg->Respawn(); + } + else + { + if (instance) + if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + pFeugen->Respawn(); + } } } - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHIFT: - DoCastAOE(SPELL_POLARITY_SHIFT); - events.ScheduleEvent(EVENT_SHIFT, 30000); - return; - case EVENT_CHAIN: - DoCast(me->getVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING, H_SPELL_CHAIN_LIGHTNING)); - events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); - return; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - return; + switch(eventId) + { + case EVENT_SHIFT: + DoCastAOE(SPELL_POLARITY_SHIFT); + events.ScheduleEvent(EVENT_SHIFT, 30000); + return; + case EVENT_CHAIN: + DoCast(me->getVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING, H_SPELL_CHAIN_LIGHTNING)); + events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); + return; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + return; + } } + + if (events.GetTimer() > 15000 && !me->IsWithinMeleeRange(me->getVictim())) + DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); + else + DoMeleeAttackIfReady(); } + }; - if (events.GetTimer() > 15000 && !me->IsWithinMeleeRange(me->getVictim())) - DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); - else - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_thaddius(Creature* pCreature) +
class mob_stalagg : public CreatureScript { - return new boss_thaddiusAI (pCreature); -} +public: + mob_stalagg() : CreatureScript("mob_stalagg") { } -struct mob_stalaggAI : public ScriptedAI -{ - mob_stalaggAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_stalaggAI(pCreature); } - ScriptedInstance* pInstance; + struct mob_stalaggAI : public ScriptedAI + { + mob_stalaggAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 powerSurgeTimer; - uint32 magneticPullTimer; + InstanceScript* pInstance; - void Reset() - { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_STALAGG_RESET); - powerSurgeTimer = urand(20000,25000); - magneticPullTimer = 20000; - } + uint32 powerSurgeTimer; + uint32 magneticPullTimer; - void EnterCombat(Unit * /*pWho*/) - { - DoCast(SPELL_STALAGG_TESLA); - } + void Reset() + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_STALAGG_RESET); + powerSurgeTimer = urand(20000,25000); + magneticPullTimer = 20000; + } - void JustDied(Unit * /*killer*/) - { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_STALAGG_DIED); - } + void EnterCombat(Unit * /*pWho*/) + { + DoCast(SPELL_STALAGG_TESLA); + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void JustDied(Unit * /*killer*/) + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_STALAGG_DIED); + } - if (magneticPullTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (Creature *pFeugen = me->GetCreature(*me, pInstance->GetData64(DATA_FEUGEN))) - { - Unit* pStalaggVictim = me->getVictim(); - Unit* pFeugenVictim = pFeugen->getVictim(); + if (!UpdateVictim()) + return; - if (pFeugenVictim && pStalaggVictim) + if (magneticPullTimer <= uiDiff) + { + if (Creature *pFeugen = me->GetCreature(*me, pInstance->GetData64(DATA_FEUGEN))) { - // magnetic pull is not working. So just jump. + Unit* pStalaggVictim = me->getVictim(); + Unit* pFeugenVictim = pFeugen->getVictim(); - // reset aggro to be sure that feugen will not follow the jump - pFeugen->getThreatManager().modifyThreatPercent(pFeugenVictim, -100); - pFeugenVictim->JumpTo(me, 0.3f); + if (pFeugenVictim && pStalaggVictim) + { + // magnetic pull is not working. So just jump. - me->getThreatManager().modifyThreatPercent(pStalaggVictim, -100); - pStalaggVictim->JumpTo(pFeugen, 0.3f); + // reset aggro to be sure that feugen will not follow the jump + pFeugen->getThreatManager().modifyThreatPercent(pFeugenVictim, -100); + pFeugenVictim->JumpTo(me, 0.3f); + + me->getThreatManager().modifyThreatPercent(pStalaggVictim, -100); + pStalaggVictim->JumpTo(pFeugen, 0.3f); + } } + + magneticPullTimer = 20000; } + else magneticPullTimer -= uiDiff; - magneticPullTimer = 20000; - } - else magneticPullTimer -= uiDiff; + if (powerSurgeTimer <= uiDiff) + { + DoCast(me, RAID_MODE(SPELL_POWERSURGE, H_SPELL_POWERSURGE)); + powerSurgeTimer = urand(15000,20000); + } else powerSurgeTimer -= uiDiff; - if (powerSurgeTimer <= uiDiff) - { - DoCast(me, RAID_MODE(SPELL_POWERSURGE, H_SPELL_POWERSURGE)); - powerSurgeTimer = urand(15000,20000); - } else powerSurgeTimer -= uiDiff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_stalagg(Creature* pCreature) +
class mob_feugen : public CreatureScript { - return new mob_stalaggAI(pCreature); -} +public: + mob_feugen() : CreatureScript("mob_feugen") { } -struct mob_feugenAI : public ScriptedAI -{ - mob_feugenAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_feugenAI(pCreature); } - ScriptedInstance* pInstance; + struct mob_feugenAI : public ScriptedAI + { + mob_feugenAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 staticFieldTimer; + InstanceScript* pInstance; - void Reset() - { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET); - staticFieldTimer = 5000; - } + uint32 staticFieldTimer; - void EnterCombat(Unit * /*pWho*/) - { - DoCast(SPELL_FEUGEN_TESLA); - } + void Reset() + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET); + staticFieldTimer = 5000; + } - void JustDied(Unit * /*killer*/) - { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED); - } + void EnterCombat(Unit * /*pWho*/) + { + DoCast(SPELL_FEUGEN_TESLA); + } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void JustDied(Unit * /*killer*/) + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED); + } - if (staticFieldTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me, RAID_MODE(SPELL_STATICFIELD, H_SPELL_STATICFIELD)); - staticFieldTimer = 5000; - } else staticFieldTimer -= uiDiff; + if (!UpdateVictim()) + return; + + if (staticFieldTimer <= uiDiff) + { + DoCast(me, RAID_MODE(SPELL_STATICFIELD, H_SPELL_STATICFIELD)); + staticFieldTimer = 5000; + } else staticFieldTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_feugen(Creature* pCreature) -{ - return new mob_feugenAI(pCreature); -} void AddSC_boss_thaddius() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_thaddius"; - newscript->GetAI = &GetAI_boss_thaddius; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_stalagg"; - newscript->GetAI = &GetAI_mob_stalagg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_feugen"; - newscript->GetAI = &GetAI_mob_feugen; - newscript->RegisterSelf(); + new boss_thaddius(); + new mob_stalagg(); + new mob_feugen(); } diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 6ece32054ae..0f408914e39 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -101,246 +101,249 @@ inline uint32 GetEruptionSection(float x, float y) return i; return 3; } - -struct instance_naxxramas : public InstanceData +
class instance_naxxramas : public InstanceMapScript { - instance_naxxramas(Map* pMap) : InstanceData(pMap) +public: + instance_naxxramas() : InstanceMapScript("instance_naxxramas") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - SetBossNumber(MAX_BOSS_NUMBER); - LoadDoorData(doorData); - LoadMinionData(minionData); + return new instance_naxxramas_InstanceMapScript(pMap); } - std::set<uint64> HeiganEruptionGUID[4]; - uint64 GothikGateGUID; - uint64 HorsemenChestGUID; - uint64 SapphironGUID; - uint64 uiFaerlina; - uint64 uiThane; - uint64 uiLady; - uint64 uiBaron; - uint64 uiSir; + struct instance_naxxramas_InstanceMapScript : public InstanceScript + { + instance_naxxramas_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + SetBossNumber(MAX_BOSS_NUMBER); + LoadDoorData(doorData); + LoadMinionData(minionData); + } - uint64 uiThaddius; - uint64 uiFeugen; - uint64 uiStalagg; + std::set<uint64> HeiganEruptionGUID[4]; + uint64 GothikGateGUID; + uint64 HorsemenChestGUID; + uint64 SapphironGUID; + uint64 uiFaerlina; + uint64 uiThane; + uint64 uiLady; + uint64 uiBaron; + uint64 uiSir; - uint64 uiKelthuzad; - uint64 uiKelthuzadTrigger; - uint64 uiPortals[4]; + uint64 uiThaddius; + uint64 uiFeugen; + uint64 uiStalagg; - GOState gothikDoorState; + uint64 uiKelthuzad; + uint64 uiKelthuzadTrigger; + uint64 uiPortals[4]; - time_t minHorsemenDiedTime; - time_t maxHorsemenDiedTime; + GOState gothikDoorState; - void OnCreatureCreate(Creature* pCreature, bool add) - { - switch(pCreature->GetEntry()) - { - case 15989: SapphironGUID = add ? pCreature->GetGUID() : 0; return; - case 15953: uiFaerlina = pCreature->GetGUID(); return; - case 16064: uiThane = pCreature->GetGUID(); return; - case 16065: uiLady = pCreature->GetGUID(); return; - case 30549: uiBaron = pCreature->GetGUID(); return; - case 16063: uiSir = pCreature->GetGUID(); return; - case 15928: uiThaddius = pCreature->GetGUID(); return; - case 15930: uiFeugen = pCreature->GetGUID(); return; - case 15929: uiStalagg = pCreature->GetGUID(); return; - case 15990: uiKelthuzad = pCreature->GetGUID(); return; - } + time_t minHorsemenDiedTime; + time_t maxHorsemenDiedTime; - AddMinion(pCreature, add); - } - - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) + void OnCreatureCreate(Creature* pCreature, bool add) { - uint32 section = GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY()); - if (add) - HeiganEruptionGUID[section].insert(pGo->GetGUID()); - else - HeiganEruptionGUID[section].erase(pGo->GetGUID()); - return; + switch(pCreature->GetEntry()) + { + case 15989: SapphironGUID = add ? pCreature->GetGUID() : 0; return; + case 15953: uiFaerlina = pCreature->GetGUID(); return; + case 16064: uiThane = pCreature->GetGUID(); return; + case 16065: uiLady = pCreature->GetGUID(); return; + case 30549: uiBaron = pCreature->GetGUID(); return; + case 16063: uiSir = pCreature->GetGUID(); return; + case 15928: uiThaddius = pCreature->GetGUID(); return; + case 15930: uiFeugen = pCreature->GetGUID(); return; + case 15929: uiStalagg = pCreature->GetGUID(); return; + case 15990: uiKelthuzad = pCreature->GetGUID(); return; + } + + AddMinion(pCreature, add); } - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool add) { - case GO_BIRTH: - if (!add && SapphironGUID) + if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) { - if (Creature *pSapphiron = instance->GetCreature(SapphironGUID)) - pSapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); + uint32 section = GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY()); + if (add) + HeiganEruptionGUID[section].insert(pGo->GetGUID()); + else + HeiganEruptionGUID[section].erase(pGo->GetGUID()); return; } - case GO_GOTHIK_GATE: - GothikGateGUID = add ? pGo->GetGUID() : 0; - pGo->SetGoState(gothikDoorState); - break; - case GO_HORSEMEN_CHEST: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; - case GO_HORSEMEN_CHEST_HERO: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; - case GO_KELTHUZAD_PORTAL01: uiPortals[0] = pGo->GetGUID(); break; - case GO_KELTHUZAD_PORTAL02: uiPortals[1] = pGo->GetGUID(); break; - case GO_KELTHUZAD_PORTAL03: uiPortals[2] = pGo->GetGUID(); break; - case GO_KELTHUZAD_PORTAL04: uiPortals[3] = pGo->GetGUID(); break; - case GO_KELTHUZAD_TRIGGER: uiKelthuzadTrigger = pGo->GetGUID(); break; - } - - AddDoor(pGo, add); - } - void SetData(uint32 id, uint32 value) - { - switch(id) - { - case DATA_HEIGAN_ERUPT: - HeiganErupt(value); - break; - case DATA_GOTHIK_GATE: - if (GameObject *pGothikGate = instance->GetGameObject(GothikGateGUID)) - pGothikGate->SetGoState(GOState(value)); - gothikDoorState = GOState(value); - break; - - case DATA_HORSEMEN0: - case DATA_HORSEMEN1: - case DATA_HORSEMEN2: - case DATA_HORSEMEN3: - if (value == NOT_STARTED) + switch(pGo->GetEntry()) + { + case GO_BIRTH: + if (!add && SapphironGUID) { - minHorsemenDiedTime = 0; - maxHorsemenDiedTime = 0; + if (Creature *pSapphiron = instance->GetCreature(SapphironGUID)) + pSapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); + return; } - else if (value == DONE) - { - time_t now = time(NULL); - - if (minHorsemenDiedTime == 0) - minHorsemenDiedTime = now; + case GO_GOTHIK_GATE: + GothikGateGUID = add ? pGo->GetGUID() : 0; + pGo->SetGoState(gothikDoorState); + break; + case GO_HORSEMEN_CHEST: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; + case GO_HORSEMEN_CHEST_HERO: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; + case GO_KELTHUZAD_PORTAL01: uiPortals[0] = pGo->GetGUID(); break; + case GO_KELTHUZAD_PORTAL02: uiPortals[1] = pGo->GetGUID(); break; + case GO_KELTHUZAD_PORTAL03: uiPortals[2] = pGo->GetGUID(); break; + case GO_KELTHUZAD_PORTAL04: uiPortals[3] = pGo->GetGUID(); break; + case GO_KELTHUZAD_TRIGGER: uiKelthuzadTrigger = pGo->GetGUID(); break; + } - maxHorsemenDiedTime = now; - } - break; + AddDoor(pGo, add); } - } - uint64 GetData64(uint32 id) - { - switch(id) + void SetData(uint32 id, uint32 value) { - case DATA_FAERLINA: - return uiFaerlina; - case DATA_THANE: - return uiThane; - case DATA_LADY: - return uiLady; - case DATA_BARON: - return uiBaron; - case DATA_SIR: - return uiSir; - case DATA_THADDIUS: - return uiThaddius; - case DATA_FEUGEN: - return uiFeugen; - case DATA_STALAGG: - return uiStalagg; - case DATA_KELTHUZAD: - return uiKelthuzad; - case DATA_KELTHUZAD_PORTAL01: - return uiPortals[0]; - case DATA_KELTHUZAD_PORTAL02: - return uiPortals[1]; - case DATA_KELTHUZAD_PORTAL03: - return uiPortals[2]; - case DATA_KELTHUZAD_PORTAL04: - return uiPortals[3]; - case DATA_KELTHUZAD_TRIGGER: - return uiKelthuzadTrigger; + switch(id) + { + case DATA_HEIGAN_ERUPT: + HeiganErupt(value); + break; + case DATA_GOTHIK_GATE: + if (GameObject *pGothikGate = instance->GetGameObject(GothikGateGUID)) + pGothikGate->SetGoState(GOState(value)); + gothikDoorState = GOState(value); + break; + + case DATA_HORSEMEN0: + case DATA_HORSEMEN1: + case DATA_HORSEMEN2: + case DATA_HORSEMEN3: + if (value == NOT_STARTED) + { + minHorsemenDiedTime = 0; + maxHorsemenDiedTime = 0; + } + else if (value == DONE) + { + time_t now = time(NULL); + + if (minHorsemenDiedTime == 0) + minHorsemenDiedTime = now; + + maxHorsemenDiedTime = now; + } + break; + } } - return 0; - } - - bool SetBossState(uint32 id, EncounterState state) - { - if (!InstanceData::SetBossState(id, state)) - return false; - if (id == BOSS_HORSEMEN && state == DONE) + uint64 GetData64(uint32 id) { - if (GameObject *pHorsemenChest = instance->GetGameObject(HorsemenChestGUID)) - pHorsemenChest->SetRespawnTime(pHorsemenChest->GetRespawnDelay()); + switch(id) + { + case DATA_FAERLINA: + return uiFaerlina; + case DATA_THANE: + return uiThane; + case DATA_LADY: + return uiLady; + case DATA_BARON: + return uiBaron; + case DATA_SIR: + return uiSir; + case DATA_THADDIUS: + return uiThaddius; + case DATA_FEUGEN: + return uiFeugen; + case DATA_STALAGG: + return uiStalagg; + case DATA_KELTHUZAD: + return uiKelthuzad; + case DATA_KELTHUZAD_PORTAL01: + return uiPortals[0]; + case DATA_KELTHUZAD_PORTAL02: + return uiPortals[1]; + case DATA_KELTHUZAD_PORTAL03: + return uiPortals[2]; + case DATA_KELTHUZAD_PORTAL04: + return uiPortals[3]; + case DATA_KELTHUZAD_TRIGGER: + return uiKelthuzadTrigger; + } + return 0; } - return true; - } - - void HeiganErupt(uint32 section) - { - for (uint32 i = 0; i < 4; ++i) + bool SetBossState(uint32 id, EncounterState state) { - if (i == section) - continue; + if (!InstanceScript::SetBossState(id, state)) + return false; + + if (id == BOSS_HORSEMEN && state == DONE) + { + if (GameObject *pHorsemenChest = instance->GetGameObject(HorsemenChestGUID)) + pHorsemenChest->SetRespawnTime(pHorsemenChest->GetRespawnDelay()); + } + + return true; + } - for (std::set<uint64>::const_iterator itr = HeiganEruptionGUID[i].begin(); itr != HeiganEruptionGUID[i].end(); ++itr) + void HeiganErupt(uint32 section) + { + for (uint32 i = 0; i < 4; ++i) { - if (GameObject *pHeiganEruption = instance->GetGameObject(*itr)) + if (i == section) + continue; + + for (std::set<uint64>::const_iterator itr = HeiganEruptionGUID[i].begin(); itr != HeiganEruptionGUID[i].end(); ++itr) { - pHeiganEruption->SendCustomAnim(); - pHeiganEruption->CastSpell(NULL, SPELL_ERUPTION); + if (GameObject *pHeiganEruption = instance->GetGameObject(*itr)) + { + pHeiganEruption->SendCustomAnim(); + pHeiganEruption->CastSpell(NULL, SPELL_ERUPTION); + } } } } - } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) - { - switch(criteria_id) + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) { - case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man - if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) - return true; - return false; - case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man - if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) - return true; - return false; - case 13233: // Criteria for achievement 2186: The Immortal (25-man) - // TODO. - break; - case 13237: // Criteria for achievement 2187: The Undying (10-man) - // TODO. - break; + switch(criteria_id) + { + case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man + if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) + return true; + return false; + case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man + if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) + return true; + return false; + case 13233: // Criteria for achievement 2186: The Immortal (25-man) + // TODO. + break; + case 13237: // Criteria for achievement 2187: The Undying (10-man) + // TODO. + break; + } + return false; } - return false; - } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " " << gothikDoorState; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << GetBossSaveData() << " " << gothikDoorState; + return saveStream.str(); + } + + void Load(const char * data) + { + std::istringstream loadStream(LoadBossState(data)); + uint32 buff; + loadStream >> buff; + gothikDoorState = GOState(buff); + } + }; - void Load(const char * data) - { - std::istringstream loadStream(LoadBossState(data)); - uint32 buff; - loadStream >> buff; - gothikDoorState = GOState(buff); - } }; -InstanceData* GetInstanceData_instance_naxxramas(Map* pMap) -{ - return new instance_naxxramas(pMap); -} void AddSC_instance_naxxramas() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_naxxramas"; - newscript->GetInstanceData = &GetInstanceData_instance_naxxramas; - newscript->RegisterSelf(); + new instance_naxxramas(); } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 71e8ad69ff4..3523672b1c8 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -104,89 +104,91 @@ enum { ACHIEV_TIMED_START_EVENT = 20387, }; - -struct boss_malygosAI : public ScriptedAI +
class boss_malygos : public CreatureScript { - boss_malygosAI(Creature *c) : ScriptedAI(c) +public: + boss_malygos() : CreatureScript("boss_malygos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - instance = me->GetInstanceData(); + return new boss_malygosAI (pCreature); } - InstanceData *instance; - - uint32 phase; - uint32 enrage; - - void Reset() + struct boss_malygosAI : public ScriptedAI { - phase = 1; - enrage = 615000; //Source Deadly Boss Mod + boss_malygosAI(Creature *c) : ScriptedAI(c) + { + instance = me->GetInstanceScript(); + } - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + InstanceScript *instance; - void EnterCombat(Unit* /*who*/) - { - if (phase == 1) + uint32 phase; + uint32 enrage; + + void Reset() { - DoScriptText(SAY_PHASE1_AGGRO, me); + phase = 1; + enrage = 615000; //Source Deadly Boss Mod + if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - if (phase == 2) - DoScriptText(SAY_PHASE1_AGGRO, me); - if (phase == 3) - DoScriptText(SAY_PHASE1_AGGRO, me); - } + void EnterCombat(Unit* /*who*/) + { + if (phase == 1) + { + DoScriptText(SAY_PHASE1_AGGRO, me); + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } + + if (phase == 2) + DoScriptText(SAY_PHASE1_AGGRO, me); + if (phase == 3) + DoScriptText(SAY_PHASE1_AGGRO, me); + } - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (phase == 1 && HealthBelowPct(50)) { - phase = 2; - //spawn adds - //set malygos unatackable untill all adds spawned dead - //start phase3 + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (phase == 1 && HealthBelowPct(50)) { + phase = 2; + //spawn adds + //set malygos unatackable untill all adds spawned dead + //start phase3 + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + if (phase == 1) + DoScriptText(RAND(SAY_PHASE1_SLAY_1,SAY_PHASE1_SLAY_2,SAY_PHASE1_SLAY_3), me); + if (phase == 2) + DoScriptText(RAND(SAY_PHASE2_SLAY_1,SAY_PHASE2_SLAY_2,SAY_PHASE2_SLAY_3), me); + if (phase == 3) + DoScriptText(RAND(SAY_PHASE3_SLAY_1,SAY_PHASE3_SLAY_2,SAY_PHASE3_SLAY_3), me); + } + }; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - - if (phase == 1) - DoScriptText(RAND(SAY_PHASE1_SLAY_1,SAY_PHASE1_SLAY_2,SAY_PHASE1_SLAY_3), me); - if (phase == 2) - DoScriptText(RAND(SAY_PHASE2_SLAY_1,SAY_PHASE2_SLAY_2,SAY_PHASE2_SLAY_3), me); - if (phase == 3) - DoScriptText(RAND(SAY_PHASE3_SLAY_1,SAY_PHASE3_SLAY_2,SAY_PHASE3_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_malygos(Creature* pCreature) -{ - return new boss_malygosAI (pCreature); -} void AddSC_boss_malygos() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_malygos"; - newscript->GetAI = &GetAI_boss_malygos; - newscript->RegisterSelf(); + new boss_malygos(); } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index e8ba3c89a67..c5714db534d 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -17,22 +17,25 @@ #include "ScriptPCH.h" #include "eye_of_eternity.h" - -struct instance_eye_of_eternity : public ScriptedInstance +
class instance_eye_of_eternity : public InstanceMapScript { - instance_eye_of_eternity(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_eye_of_eternity() : InstanceMapScript("instance_eye_of_eternity") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_eye_of_eternity_InstanceMapScript(pMap); + } + + struct instance_eye_of_eternity_InstanceMapScript : public InstanceScript + { + instance_eye_of_eternity_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + }; + }; -InstanceData* GetInstanceData_instance_eye_of_eternity(Map* pMap) -{ - return new instance_eye_of_eternity(pMap); -} void AddSC_instance_eye_of_eternity() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_eye_of_eternity"; - newscript->GetInstanceData = &GetInstanceData_instance_eye_of_eternity; - newscript->RegisterSelf(); + new instance_eye_of_eternity(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index 767aeabcc42..fbb00e9b9bf 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -58,114 +58,121 @@ const Position RiftLocation[6] = {639.87, -314.11, -9.49}, {651.72, -297.44, -9.37} }; - -struct boss_anomalusAI : public ScriptedAI +
class boss_anomalus : public CreatureScript { - boss_anomalusAI(Creature *c) : ScriptedAI(c) +public: + boss_anomalus() : CreatureScript("boss_anomalus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_anomalusAI (pCreature); } - ScriptedInstance* pInstance; - - uint8 Phase; - uint32 uiSparkTimer; - uint32 uiCreateRiftTimer; - uint64 uiChaoticRiftGUID; - - bool bDeadChaoticRift; // needed for achievement: Chaos Theory(2037) - - void Reset() + struct boss_anomalusAI : public ScriptedAI { - Phase = 0; - uiSparkTimer = 5*IN_MILLISECONDS; - uiChaoticRiftGUID = 0; + boss_anomalusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - bDeadChaoticRift = false; + InstanceScript* pInstance; - if (pInstance) - pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED); - } + uint8 Phase; + uint32 uiSparkTimer; + uint32 uiCreateRiftTimer; + uint64 uiChaoticRiftGUID; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + bool bDeadChaoticRift; // needed for achievement: Chaos Theory(2037) - if (pInstance) - pInstance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS); - } + void Reset() + { + Phase = 0; + uiSparkTimer = 5*IN_MILLISECONDS; + uiChaoticRiftGUID = 0; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + bDeadChaoticRift = false; - if (pInstance) - { - if (IsHeroic() && !bDeadChaoticRift) - pInstance->DoCompleteAchievement(ACHIEV_CHAOS_THEORY); - pInstance->SetData(DATA_ANOMALUS_EVENT, DONE); + if (pInstance) + pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - if (me->GetDistance(me->GetHomePosition()) > 60.0f) + if (pInstance) + pInstance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) { - //Not blizzlike, hack to avoid an exploit - EnterEvadeMode(); - return; + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (IsHeroic() && !bDeadChaoticRift) + pInstance->DoCompleteAchievement(ACHIEV_CHAOS_THEORY); + pInstance->SetData(DATA_ANOMALUS_EVENT, DONE); + } } - if (me->HasAura(SPELL_RIFT_SHIELD)) + void UpdateAI(const uint32 diff) { - if (uiChaoticRiftGUID) + if (!UpdateVictim()) + return; + + if (me->GetDistance(me->GetHomePosition()) > 60.0f) { - Unit* Rift = Unit::GetUnit((*me), uiChaoticRiftGUID); - if (Rift && Rift->isDead()) - { - me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD); - uiChaoticRiftGUID = 0; - } + //Not blizzlike, hack to avoid an exploit + EnterEvadeMode(); return; } - } else - uiChaoticRiftGUID = 0; - if ((Phase == 0) && HealthBelowPct(50)) - { - Phase = 1; - DoScriptText(SAY_SHIELD, me); - DoCast(me, SPELL_RIFT_SHIELD); - Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0,5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); - if (Rift) + if (me->HasAura(SPELL_RIFT_SHIELD)) { - //DoCast(Rift, SPELL_CHARGE_RIFT); - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Rift->AI()->AttackStart(pTarget); - uiChaoticRiftGUID = Rift->GetGUID(); - DoScriptText(SAY_RIFT , me); + if (uiChaoticRiftGUID) + { + Unit* Rift = Unit::GetUnit((*me), uiChaoticRiftGUID); + if (Rift && Rift->isDead()) + { + me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD); + uiChaoticRiftGUID = 0; + } + return; + } + } else + uiChaoticRiftGUID = 0; + + if ((Phase == 0) && HealthBelowPct(50)) + { + Phase = 1; + DoScriptText(SAY_SHIELD, me); + DoCast(me, SPELL_RIFT_SHIELD); + Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0,5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); + if (Rift) + { + //DoCast(Rift, SPELL_CHARGE_RIFT); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Rift->AI()->AttackStart(pTarget); + uiChaoticRiftGUID = Rift->GetGUID(); + DoScriptText(SAY_RIFT , me); + } } - } - if (uiSparkTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SPARK); - uiSparkTimer = 5*IN_MILLISECONDS; - } else uiSparkTimer -= diff; + if (uiSparkTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SPARK); + uiSparkTimer = 5*IN_MILLISECONDS; + } else uiSparkTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_anomalus(Creature* pCreature) -{ - return new boss_anomalusAI (pCreature); -} enum RiftSpells { @@ -173,82 +180,80 @@ enum RiftSpells SPELL_CHARGED_CHAOTIC_ENERGY_BURST = 47737, SPELL_ARCANEFORM = 48019 //Chaotic Rift visual }; - -struct mob_chaotic_riftAI : public Scripted_NoMovementAI +
class mob_chaotic_rift : public CreatureScript { - mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiChaoticEnergyBurstTimer; - uint32 uiSummonCrazedManaWraithTimer; +public: + mob_chaotic_rift() : CreatureScript("mob_chaotic_rift") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS; - uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; - //me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different. - //Model for ally (1126) does not show auras. Horde model works perfect. - //Set model to horde number - DoCast(me, SPELL_ARCANEFORM, false); + return new mob_chaotic_riftAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct mob_chaotic_riftAI : public Scripted_NoMovementAI { - if (Creature* pAnomalus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0)) - CAST_AI(boss_anomalusAI,pAnomalus->AI())->bDeadChaoticRift = true; - } + mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c) + { + pInstance = c->GetInstanceScript(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (uiChaoticEnergyBurstTimer <= diff) + uint32 uiChaoticEnergyBurstTimer; + uint32 uiSummonCrazedManaWraithTimer; + + void Reset() { - Unit* pAnomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - if (pAnomalus && pAnomalus->HasAura(SPELL_RIFT_SHIELD)) - DoCast(pTarget, SPELL_CHARGED_CHAOTIC_ENERGY_BURST); - else - DoCast(pTarget, SPELL_CHAOTIC_ENERGY_BURST); uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS; - } else uiChaoticEnergyBurstTimer -= diff; + uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; + //me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different. + //Model for ally (1126) does not show auras. Horde model works perfect. + //Set model to horde number + DoCast(me, SPELL_ARCANEFORM, false); + } - if (uiSummonCrazedManaWraithTimer <= diff) + void JustDied(Unit * /*killer*/) { - Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX()+1, me->GetPositionY()+1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); - if (Wraith) + if (Creature* pAnomalus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0)) + CAST_AI(boss_anomalus::boss_anomalusAI,pAnomalus->AI())->bDeadChaoticRift = true; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiChaoticEnergyBurstTimer <= diff) + { + Unit* pAnomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Wraith->AI()->AttackStart(pTarget); - Unit* Anomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); - if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) - uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; - else - uiSummonCrazedManaWraithTimer = 10*IN_MILLISECONDS; - } else uiSummonCrazedManaWraithTimer -= diff; - } + if (pAnomalus && pAnomalus->HasAura(SPELL_RIFT_SHIELD)) + DoCast(pTarget, SPELL_CHARGED_CHAOTIC_ENERGY_BURST); + else + DoCast(pTarget, SPELL_CHAOTIC_ENERGY_BURST); + uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS; + } else uiChaoticEnergyBurstTimer -= diff; + + if (uiSummonCrazedManaWraithTimer <= diff) + { + Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX()+1, me->GetPositionY()+1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); + if (Wraith) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Wraith->AI()->AttackStart(pTarget); + Unit* Anomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); + if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) + uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; + else + uiSummonCrazedManaWraithTimer = 10*IN_MILLISECONDS; + } else uiSummonCrazedManaWraithTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_chaotic_rift(Creature* pCreature) -{ - return new mob_chaotic_riftAI (pCreature); -} void AddSC_boss_anomalus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_anomalus"; - newscript->GetAI = &GetAI_boss_anomalus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_chaotic_rift"; - newscript->GetAI = &GetAI_mob_chaotic_rift; - newscript->RegisterSelf(); + new boss_anomalus(); + new mob_chaotic_rift(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index befa9fb068d..d2421bae1ef 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -49,200 +49,204 @@ enum Misc { DATA_CONTAINMENT_SPHERES = 3 }; - -struct boss_keristraszaAI : public ScriptedAI +
class boss_keristrasza : public CreatureScript { - boss_keristraszaAI(Creature *c) : ScriptedAI(c) +public: + boss_keristrasza() : CreatureScript("boss_keristrasza") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_keristraszaAI (pCreature); } - ScriptedInstance* pInstance; + struct boss_keristraszaAI : public ScriptedAI + { + boss_keristraszaAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 uiCrystalfireBreathTimer; - uint32 uiCrystalChainsCrystalizeTimer; - uint32 uiTailSweepTimer; - bool bEnrage; + InstanceScript* pInstance; - uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; + uint32 uiCrystalfireBreathTimer; + uint32 uiCrystalChainsCrystalizeTimer; + uint32 uiTailSweepTimer; + bool bEnrage; - uint32 uiCheckIntenseColdTimer; - bool bMoreThanTwoIntenseCold; // needed for achievement: Intense Cold(2036) + uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; - void Reset() - { - uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; - uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); - uiTailSweepTimer = 5*IN_MILLISECONDS; - bEnrage = false; + uint32 uiCheckIntenseColdTimer; + bool bMoreThanTwoIntenseCold; // needed for achievement: Intense Cold(2036) - uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; - bMoreThanTwoIntenseCold = false; + void Reset() + { + uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; + uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); + uiTailSweepTimer = 5*IN_MILLISECONDS; + bEnrage = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; + bMoreThanTwoIntenseCold = false; - RemovePrison(CheckContainmentSpheres()); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if (pInstance) - pInstance->SetData(DATA_KERISTRASZA_EVENT, NOT_STARTED); - } + RemovePrison(CheckContainmentSpheres()); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoCastAOE(SPELL_INTENSE_COLD); + if (pInstance) + pInstance->SetData(DATA_KERISTRASZA_EVENT, NOT_STARTED); + } - if (pInstance) - pInstance->SetData(DATA_KERISTRASZA_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + DoCastAOE(SPELL_INTENSE_COLD); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_KERISTRASZA_EVENT, IN_PROGRESS); + } - if (pInstance) + void JustDied(Unit* /*killer*/) { - if (IsHeroic() && !bMoreThanTwoIntenseCold) - pInstance->DoCompleteAchievement(ACHIEV_INTENSE_COLD); - pInstance->SetData(DATA_KERISTRASZA_EVENT, DONE); + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (IsHeroic() && !bMoreThanTwoIntenseCold) + pInstance->DoCompleteAchievement(ACHIEV_INTENSE_COLD); + pInstance->SetData(DATA_KERISTRASZA_EVENT, DONE); + } } - } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_SLAY, me); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_SLAY, me); + } - bool CheckContainmentSpheres(bool remove_prison = false) - { - if (!pInstance) - return false; + bool CheckContainmentSpheres(bool remove_prison = false) + { + if (!pInstance) + return false; - auiContainmentSphereGUIDs[0] = pInstance->GetData64(ANOMALUS_CONTAINMET_SPHERE); - auiContainmentSphereGUIDs[1] = pInstance->GetData64(ORMOROKS_CONTAINMET_SPHERE); - auiContainmentSphereGUIDs[2] = pInstance->GetData64(TELESTRAS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[0] = pInstance->GetData64(ANOMALUS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[1] = pInstance->GetData64(ORMOROKS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[2] = pInstance->GetData64(TELESTRAS_CONTAINMET_SPHERE); - GameObject *ContainmentSpheres[DATA_CONTAINMENT_SPHERES]; + GameObject *ContainmentSpheres[DATA_CONTAINMENT_SPHERES]; - for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i) - { - ContainmentSpheres[i] = pInstance->instance->GetGameObject(auiContainmentSphereGUIDs[i]); - if (!ContainmentSpheres[i]) - return false; - if (ContainmentSpheres[i]->GetGoState() != GO_STATE_ACTIVE) - return false; + for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i) + { + ContainmentSpheres[i] = pInstance->instance->GetGameObject(auiContainmentSphereGUIDs[i]); + if (!ContainmentSpheres[i]) + return false; + if (ContainmentSpheres[i]->GetGoState() != GO_STATE_ACTIVE) + return false; + } + if (remove_prison) + RemovePrison(true); + return true; } - if (remove_prison) - RemovePrison(true); - return true; - } - void RemovePrison(bool remove) - { - if (remove) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (me->HasAura(SPELL_FROZEN_PRISON)) - me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); - } - else + void RemovePrison(bool remove) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoCast(me, SPELL_FROZEN_PRISON, false); + if (remove) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (me->HasAura(SPELL_FROZEN_PRISON)) + me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + DoCast(me, SPELL_FROZEN_PRISON, false); + } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold) + void UpdateAI(const uint32 diff) { - std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) - { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER) - continue; + if (!UpdateVictim()) + return; - Aura *AuraIntenseCold = pTarget->GetAura(SPELL_INTENSE_COLD_TRIGGERED); - if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2) + if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold) + { + std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { - bMoreThanTwoIntenseCold = true; - break; + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER) + continue; + + Aura *AuraIntenseCold = pTarget->GetAura(SPELL_INTENSE_COLD_TRIGGERED); + if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2) + { + bMoreThanTwoIntenseCold = true; + break; + } } - } - uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; - } else uiCheckIntenseColdTimer -= diff; + uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; + } else uiCheckIntenseColdTimer -= diff; - if (!bEnrage && HealthBelowPct(25)) - { - DoScriptText(SAY_ENRAGE, me); - DoCast(me, SPELL_ENRAGE); - bEnrage = true; - } + if (!bEnrage && HealthBelowPct(25)) + { + DoScriptText(SAY_ENRAGE, me); + DoCast(me, SPELL_ENRAGE); + bEnrage = true; + } - if (uiCrystalfireBreathTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CRYSTALFIRE_BREATH); - uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; - } else uiCrystalfireBreathTimer -= diff; + if (uiCrystalfireBreathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CRYSTALFIRE_BREATH); + uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; + } else uiCrystalfireBreathTimer -= diff; - if (uiTailSweepTimer <= diff) - { - DoCast(me, SPELL_TAIL_SWEEP); - uiTailSweepTimer = 5*IN_MILLISECONDS; - } else uiTailSweepTimer -= diff; + if (uiTailSweepTimer <= diff) + { + DoCast(me, SPELL_TAIL_SWEEP); + uiTailSweepTimer = 5*IN_MILLISECONDS; + } else uiTailSweepTimer -= diff; - if (uiCrystalChainsCrystalizeTimer <= diff) - { - DoScriptText(SAY_CRYSTAL_NOVA, me); - if (IsHeroic()) - DoCast(me, SPELL_CRYSTALIZE); - else if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CRYSTAL_CHAINS); - uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); - } else uiCrystalChainsCrystalizeTimer -= diff; + if (uiCrystalChainsCrystalizeTimer <= diff) + { + DoScriptText(SAY_CRYSTAL_NOVA, me); + if (IsHeroic()) + DoCast(me, SPELL_CRYSTALIZE); + else if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CRYSTAL_CHAINS); + uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); + } else uiCrystalChainsCrystalizeTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_keristrasza(Creature* pCreature) -{ - return new boss_keristraszaAI (pCreature); -} - -bool GOHello_containment_sphere(Player * /*pPlayer*/, GameObject *pGO) +
class containment_sphere : public GameObjectScript { - ScriptedInstance *pInstance = pGO->GetInstanceData(); +public: + containment_sphere() : GameObjectScript("containment_sphere") { } - Creature *pKeristrasza = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_KERISTRASZA) : 0); - if (pKeristrasza && pKeristrasza->isAlive()) + bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { - // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); + InstanceScript *pInstance = pGO->GetInstanceScript(); - CAST_AI(boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); + Creature *pKeristrasza = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_KERISTRASZA) : 0); + if (pKeristrasza && pKeristrasza->isAlive()) + { + // maybe these are hacks :( + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + + CAST_AI(boss_keristrasza::boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); + } + return true; } - return true; -} + +}; void AddSC_boss_keristrasza() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_keristrasza"; - newscript->GetAI = &GetAI_boss_keristrasza; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "containment_sphere"; - newscript->pGOHello = &GOHello_containment_sphere; - newscript->RegisterSelf(); + new boss_keristrasza(); + new containment_sphere(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index 77dd3025451..3c5d50cfc12 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -54,275 +54,277 @@ enum Achievements }; const Position CenterOfRoom = {504.80, 89.07, -16.12, 6.27}; - -struct boss_magus_telestraAI : public ScriptedAI +
class boss_magus_telestra : public CreatureScript { - boss_magus_telestraAI(Creature* c) : ScriptedAI(c) +public: + boss_magus_telestra() : CreatureScript("boss_magus_telestra") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_magus_telestraAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 uiFireMagusGUID; - uint64 uiFrostMagusGUID; - uint64 uiArcaneMagusGUID; - - bool bFireMagusDead; - bool bFrostMagusDead; - bool bArcaneMagusDead; - bool bIsWaitingToAppear; - bool bIsAchievementTimerRunning; + struct boss_magus_telestraAI : public ScriptedAI + { + boss_magus_telestraAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 uiIsWaitingToAppearTimer; - uint32 uiIceNovaTimer; - uint32 uiFireBombTimer; - uint32 uiGravityWellTimer; - uint32 uiCooldown; - uint32 uiAchievementTimer; + InstanceScript* pInstance; - uint8 Phase; - uint8 uiAchievementProgress; + uint64 uiFireMagusGUID; + uint64 uiFrostMagusGUID; + uint64 uiArcaneMagusGUID; - void Reset() - { - Phase = 0; - //These times are probably wrong - uiIceNovaTimer = 7*IN_MILLISECONDS; - uiFireBombTimer = 0; - uiGravityWellTimer = 15*IN_MILLISECONDS; - uiCooldown = 0; + bool bFireMagusDead; + bool bFrostMagusDead; + bool bArcaneMagusDead; + bool bIsWaitingToAppear; + bool bIsAchievementTimerRunning; - uiFireMagusGUID = 0; - uiFrostMagusGUID = 0; - uiArcaneMagusGUID = 0; + uint32 uiIsWaitingToAppearTimer; + uint32 uiIceNovaTimer; + uint32 uiFireBombTimer; + uint32 uiGravityWellTimer; + uint32 uiCooldown; + uint32 uiAchievementTimer; - uiAchievementProgress = 0; - uiAchievementTimer = 0; + uint8 Phase; + uint8 uiAchievementProgress; - bIsAchievementTimerRunning = false; - bIsWaitingToAppear = false; + void Reset() + { + Phase = 0; + //These times are probably wrong + uiIceNovaTimer = 7*IN_MILLISECONDS; + uiFireBombTimer = 0; + uiGravityWellTimer = 15*IN_MILLISECONDS; + uiCooldown = 0; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_ON); + uiFireMagusGUID = 0; + uiFrostMagusGUID = 0; + uiArcaneMagusGUID = 0; - if (pInstance) - pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, NOT_STARTED); - } + uiAchievementProgress = 0; + uiAchievementTimer = 0; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + bIsAchievementTimerRunning = false; + bIsWaitingToAppear = false; - if (pInstance) - pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, IN_PROGRESS); - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_ON); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, NOT_STARTED); + } - if (pInstance) + void EnterCombat(Unit* /*who*/) { - if (IsHeroic() && uiAchievementProgress == 2) - pInstance->DoCompleteAchievement(ACHIEV_SPLIT_PERSONALITY); - pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE); - } - } + DoScriptText(SAY_AGGRO, me); - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + if (pInstance) + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, IN_PROGRESS); + } - uint64 SplitPersonality(uint32 entry) - { - if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS)) + void JustDied(Unit* /*killer*/) { - switch (entry) + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - case MOB_FIRE_MAGUS: - { - Summoned->CastSpell(Summoned, SPELL_FIRE_MAGUS_VISUAL, false); - break; - } - case MOB_FROST_MAGUS: - { - Summoned->CastSpell(Summoned, SPELL_FROST_MAGUS_VISUAL, false); - break; - } - case MOB_ARCANE_MAGUS: - { - Summoned->CastSpell(Summoned, SPELL_ARCANE_MAGUS_VISUAL, false); - break; - } + if (IsHeroic() && uiAchievementProgress == 2) + pInstance->DoCompleteAchievement(ACHIEV_SPLIT_PERSONALITY); + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE); } - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Summoned->AI()->AttackStart(pTarget); - return Summoned->GetGUID(); } - return 0; - } - - void SummonedCreatureDespawn(Creature *summon) - { - if (summon->isAlive()) - return; - if (summon->GetGUID() == uiFireMagusGUID) - { - bFireMagusDead = true; - bIsAchievementTimerRunning = true; - } - else if (summon->GetGUID() == uiFrostMagusGUID) + void KilledUnit(Unit * /*victim*/) { - bFrostMagusDead = true; - bIsAchievementTimerRunning = true; + DoScriptText(SAY_KILL, me); } - else if (summon->GetGUID() == uiArcaneMagusGUID) - { - bArcaneMagusDead = true; - bIsAchievementTimerRunning = true; - } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (bIsWaitingToAppear) + uint64 SplitPersonality(uint32 entry) { - me->StopMoving(); - me->AttackStop(); - if (uiIsWaitingToAppearTimer <= diff) + if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS)) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - bIsWaitingToAppear = false; - } else uiIsWaitingToAppearTimer -= diff; - return; + switch (entry) + { + case MOB_FIRE_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_FIRE_MAGUS_VISUAL, false); + break; + } + case MOB_FROST_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_FROST_MAGUS_VISUAL, false); + break; + } + case MOB_ARCANE_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_ARCANE_MAGUS_VISUAL, false); + break; + } + } + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Summoned->AI()->AttackStart(pTarget); + return Summoned->GetGUID(); + } + return 0; } - if ((Phase == 1) ||(Phase == 3)) + void SummonedCreatureDespawn(Creature *summon) { - if (bIsAchievementTimerRunning) - uiAchievementTimer += diff; - if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead) - { - if (uiAchievementTimer <= ACHIEV_TIMER) - uiAchievementProgress +=1; - me->GetMotionMaster()->Clear(); - me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); - DoCast(me, SPELL_TELESTRA_BACK); - me->SetVisibility(VISIBILITY_ON); - if (Phase == 1) - Phase = 2; - if (Phase == 3) - Phase = 4; - uiFireMagusGUID = 0; - uiFrostMagusGUID = 0; - uiArcaneMagusGUID = 0; - bIsWaitingToAppear = true; - uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS; - DoScriptText(SAY_MERGE, me); - bIsAchievementTimerRunning = false; - uiAchievementTimer = 0; - } - else + if (summon->isAlive()) return; - } - if ((Phase == 0) && HealthBelowPct(50)) - { - Phase = 1; - me->CastStop(); - me->RemoveAllAuras(); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); - uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); - uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); - return; + if (summon->GetGUID() == uiFireMagusGUID) + { + bFireMagusDead = true; + bIsAchievementTimerRunning = true; + } + else if (summon->GetGUID() == uiFrostMagusGUID) + { + bFrostMagusDead = true; + bIsAchievementTimerRunning = true; + } + else if (summon->GetGUID() == uiArcaneMagusGUID) + { + bArcaneMagusDead = true; + bIsAchievementTimerRunning = true; + } } - if (IsHeroic() && (Phase == 2) && HealthBelowPct(10)) + void UpdateAI(const uint32 diff) { - Phase = 3; - me->CastStop(); - me->RemoveAllAuras(); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); - uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); - uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); - return; - } + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiCooldown) - { - if (uiCooldown <= diff) - uiCooldown = 0; - else + if (bIsWaitingToAppear) { - uiCooldown -= diff; + me->StopMoving(); + me->AttackStop(); + if (uiIsWaitingToAppearTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + bIsWaitingToAppear = false; + } else uiIsWaitingToAppearTimer -= diff; return; } - } - if (uiIceNovaTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if ((Phase == 1) ||(Phase == 3)) { - DoCast(pTarget, SPELL_ICE_NOVA, false); - uiCooldown = 1.5*IN_MILLISECONDS; + if (bIsAchievementTimerRunning) + uiAchievementTimer += diff; + if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead) + { + if (uiAchievementTimer <= ACHIEV_TIMER) + uiAchievementProgress +=1; + me->GetMotionMaster()->Clear(); + me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); + DoCast(me, SPELL_TELESTRA_BACK); + me->SetVisibility(VISIBILITY_ON); + if (Phase == 1) + Phase = 2; + if (Phase == 3) + Phase = 4; + uiFireMagusGUID = 0; + uiFrostMagusGUID = 0; + uiArcaneMagusGUID = 0; + bIsWaitingToAppear = true; + uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS; + DoScriptText(SAY_MERGE, me); + bIsAchievementTimerRunning = false; + uiAchievementTimer = 0; + } + else + return; } - uiIceNovaTimer = 15*IN_MILLISECONDS; - } else uiIceNovaTimer -= diff; - if (uiGravityWellTimer <= diff) - { - if (Unit *pTarget = me->getVictim()) + if ((Phase == 0) && HealthBelowPct(50)) { - DoCast(pTarget, SPELL_GRAVITY_WELL); - uiCooldown = 6*IN_MILLISECONDS; + Phase = 1; + me->CastStop(); + me->RemoveAllAuras(); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); + uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); + uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); + bFireMagusDead = false; + bFrostMagusDead = false; + bArcaneMagusDead = false; + DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); + return; } - uiGravityWellTimer = 15*IN_MILLISECONDS; - } else uiGravityWellTimer -= diff; - if (uiFireBombTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (IsHeroic() && (Phase == 2) && HealthBelowPct(10)) { - DoCast(pTarget, SPELL_FIREBOMB, false); - uiCooldown = 2*IN_MILLISECONDS; + Phase = 3; + me->CastStop(); + me->RemoveAllAuras(); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); + uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); + uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); + bFireMagusDead = false; + bFrostMagusDead = false; + bArcaneMagusDead = false; + DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); + return; } - uiFireBombTimer = 2*IN_MILLISECONDS; - } else uiFireBombTimer -=diff; - DoMeleeAttackIfReady(); - } + if (uiCooldown) + { + if (uiCooldown <= diff) + uiCooldown = 0; + else + { + uiCooldown -= diff; + return; + } + } + + if (uiIceNovaTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_ICE_NOVA, false); + uiCooldown = 1.5*IN_MILLISECONDS; + } + uiIceNovaTimer = 15*IN_MILLISECONDS; + } else uiIceNovaTimer -= diff; + + if (uiGravityWellTimer <= diff) + { + if (Unit *pTarget = me->getVictim()) + { + DoCast(pTarget, SPELL_GRAVITY_WELL); + uiCooldown = 6*IN_MILLISECONDS; + } + uiGravityWellTimer = 15*IN_MILLISECONDS; + } else uiGravityWellTimer -= diff; + + if (uiFireBombTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_FIREBOMB, false); + uiCooldown = 2*IN_MILLISECONDS; + } + uiFireBombTimer = 2*IN_MILLISECONDS; + } else uiFireBombTimer -=diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_magus_telestra(Creature* pCreature) -{ - return new boss_magus_telestraAI (pCreature); -} void AddSC_boss_magus_telestra() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_magus_telestra"; - newscript->GetAI = &GetAI_boss_magus_telestra; - newscript->RegisterSelf(); + new boss_magus_telestra(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index c28aff66ed1..e77534d9ea1 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -48,252 +48,260 @@ enum Creatures }; #define SPIKE_DISTANCE 5.0f - -struct boss_ormorokAI : public ScriptedAI +
class boss_ormorok : public CreatureScript { - boss_ormorokAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_ormorok() : CreatureScript("boss_ormorok") { } - ScriptedInstance* pInstance; - - bool bFrenzy; - bool bCrystalSpikes; - uint8 uiCrystalSpikesCount; - float fBaseX; - float fBaseY; - float fBaseZ; - float fBaseO; - float fSpikeXY[4][2]; - - uint32 uiCrystalSpikesTimer; - uint32 uiCrystalSpikesTimer2; - uint32 uiTrampleTimer; - uint32 uiFrenzyTimer; - uint32 uiSpellReflectionTimer; - uint32 uiSummonCrystallineTanglerTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiCrystalSpikesTimer = 12*IN_MILLISECONDS; - uiTrampleTimer = 10*IN_MILLISECONDS; - uiSpellReflectionTimer = 30*IN_MILLISECONDS; - uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; - bFrenzy = false; - bCrystalSpikes = false; - - if (pInstance) - pInstance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); + return new boss_ormorokAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_ormorokAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); + boss_ormorokAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); - } + InstanceScript* pInstance; + + bool bFrenzy; + bool bCrystalSpikes; + uint8 uiCrystalSpikesCount; + float fBaseX; + float fBaseY; + float fBaseZ; + float fBaseO; + float fSpikeXY[4][2]; + + uint32 uiCrystalSpikesTimer; + uint32 uiCrystalSpikesTimer2; + uint32 uiTrampleTimer; + uint32 uiFrenzyTimer; + uint32 uiSpellReflectionTimer; + uint32 uiSummonCrystallineTanglerTimer; + + void Reset() + { + uiCrystalSpikesTimer = 12*IN_MILLISECONDS; + uiTrampleTimer = 10*IN_MILLISECONDS; + uiSpellReflectionTimer = 30*IN_MILLISECONDS; + uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; + bFrenzy = false; + bCrystalSpikes = false; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); + } - if (pInstance) - pInstance->SetData(DATA_ORMOROK_EVENT, DONE); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) + void JustDied(Unit* /*killer*/) { - return; + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, DONE); } - if (bCrystalSpikes) - if (uiCrystalSpikesTimer2 <= diff) - { - fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); - fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); - for (uint8 i = 0; i < 4; ++i) - me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); - if (++uiCrystalSpikesCount >= 13) - bCrystalSpikes = false; - uiCrystalSpikesTimer2 = 200; - } else uiCrystalSpikesTimer2 -= diff; - - if (!bFrenzy && (me->GetHealth() < me->GetMaxHealth() * 0.25)) + + void KilledUnit(Unit * /*victim*/) { - DoCast(me, SPELL_FRENZY); - bFrenzy = true; + DoScriptText(SAY_KILL, me); } - if (uiTrampleTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_TRAMPLE); - uiTrampleTimer = 10*IN_MILLISECONDS; - } else uiTrampleTimer -= diff; + if (!UpdateVictim()) + { + return; + } + if (bCrystalSpikes) + if (uiCrystalSpikesTimer2 <= diff) + { + fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); + fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); + fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); + fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); + fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); + fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); + fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); + fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); + for (uint8 i = 0; i < 4; ++i) + me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); + if (++uiCrystalSpikesCount >= 13) + bCrystalSpikes = false; + uiCrystalSpikesTimer2 = 200; + } else uiCrystalSpikesTimer2 -= diff; + + if (!bFrenzy && (me->GetHealth() < me->GetMaxHealth() * 0.25)) + { + DoCast(me, SPELL_FRENZY); + bFrenzy = true; + } - if (uiSpellReflectionTimer <= diff) - { - DoScriptText(SAY_REFLECT, me); - DoCast(me, SPELL_SPELL_REFLECTION); - uiSpellReflectionTimer = 30*IN_MILLISECONDS; - } else uiSpellReflectionTimer -= diff; + if (uiTrampleTimer <= diff) + { + DoCast(me, SPELL_TRAMPLE); + uiTrampleTimer = 10*IN_MILLISECONDS; + } else uiTrampleTimer -= diff; - if (uiCrystalSpikesTimer <= diff) - { - DoScriptText(SAY_CRYSTAL_SPIKES, me); - bCrystalSpikes = true; - uiCrystalSpikesCount = 1; - uiCrystalSpikesTimer2 = 0; - fBaseX = me->GetPositionX(); - fBaseY = me->GetPositionY(); - fBaseZ = me->GetPositionZ(); - fBaseO = me->GetOrientation(); - uiCrystalSpikesTimer = 20*IN_MILLISECONDS; - } else uiCrystalSpikesTimer -= diff; - - if (IsHeroic() && (uiSummonCrystallineTanglerTimer <= diff)) - { - Creature* Crystalline_Tangler = me->SummonCreature(MOB_CRYSTALLINE_TANGLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - if (Crystalline_Tangler) + if (uiSpellReflectionTimer <= diff) { - Unit *pTarget = NULL; - uint8 Healer = 0; - for (uint8 j = 1; j <= 4; j++) + DoScriptText(SAY_REFLECT, me); + DoCast(me, SPELL_SPELL_REFLECTION); + uiSpellReflectionTimer = 30*IN_MILLISECONDS; + } else uiSpellReflectionTimer -= diff; + + if (uiCrystalSpikesTimer <= diff) + { + DoScriptText(SAY_CRYSTAL_SPIKES, me); + bCrystalSpikes = true; + uiCrystalSpikesCount = 1; + uiCrystalSpikesTimer2 = 0; + fBaseX = me->GetPositionX(); + fBaseY = me->GetPositionY(); + fBaseZ = me->GetPositionZ(); + fBaseO = me->GetOrientation(); + uiCrystalSpikesTimer = 20*IN_MILLISECONDS; + } else uiCrystalSpikesTimer -= diff; + + if (IsHeroic() && (uiSummonCrystallineTanglerTimer <= diff)) + { + Creature* Crystalline_Tangler = me->SummonCreature(MOB_CRYSTALLINE_TANGLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Crystalline_Tangler) { - switch (j) - { - case 1: Healer = CLASS_PRIEST; break; - case 2: Healer = CLASS_PALADIN; break; - case 3: Healer = CLASS_DRUID; break; - case 4: Healer = CLASS_SHAMAN; break; - } - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + Unit *pTarget = NULL; + uint8 Healer = 0; + for (uint8 j = 1; j <= 4; j++) { - Unit* pTemp = Unit::GetUnit((*me),(*i)->getUnitGuid()); - if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER && pTemp->getClass() == Healer) + switch (j) { - pTarget = pTemp; - break; + case 1: Healer = CLASS_PRIEST; break; + case 2: Healer = CLASS_PALADIN; break; + case 3: Healer = CLASS_DRUID; break; + case 4: Healer = CLASS_SHAMAN; break; + } + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pTemp = Unit::GetUnit((*me),(*i)->getUnitGuid()); + if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER && pTemp->getClass() == Healer) + { + pTarget = pTemp; + break; + } } + if (pTarget) + break; } + if (!pTarget) + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) - break; - } - if (!pTarget) - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - { - Crystalline_Tangler->AI()->AttackStart(pTarget); - Crystalline_Tangler->getThreatManager().addThreat(pTarget, 1000000000.0f); + { + Crystalline_Tangler->AI()->AttackStart(pTarget); + Crystalline_Tangler->getThreatManager().addThreat(pTarget, 1000000000.0f); + } } - } - uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; - } else uiSummonCrystallineTanglerTimer -= diff; + uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; + } else uiSummonCrystallineTanglerTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -struct mob_crystal_spikeAI : public Scripted_NoMovementAI +}; +
class mob_crystal_spike : public CreatureScript { - mob_crystal_spikeAI(Creature *c) : Scripted_NoMovementAI(c) - { - } +public: + mob_crystal_spike() : CreatureScript("mob_crystal_spike") { } - uint32 SpellCrystalSpikeDamageTimer; - uint32 SpellCrystalSpikePrevisualTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SpellCrystalSpikeDamageTimer = 3.7*IN_MILLISECONDS; - SpellCrystalSpikePrevisualTimer = 1*IN_MILLISECONDS; + return new mob_crystal_spikeAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_crystal_spikeAI : public Scripted_NoMovementAI { - if (SpellCrystalSpikePrevisualTimer <= diff) + mob_crystal_spikeAI(Creature *c) : Scripted_NoMovementAI(c) { - DoCast(me, SPELL_CRYSTAL_SPIKE_PREVISUAL); - SpellCrystalSpikePrevisualTimer = 10*IN_MILLISECONDS; - } else SpellCrystalSpikePrevisualTimer -= diff; + } + + uint32 SpellCrystalSpikeDamageTimer; + uint32 SpellCrystalSpikePrevisualTimer; - if (SpellCrystalSpikeDamageTimer <= diff) + void Reset() { - DoCast(me, SPELL_CRYSTALL_SPIKE_DAMAGE); - SpellCrystalSpikeDamageTimer = 10*IN_MILLISECONDS; - } else SpellCrystalSpikeDamageTimer -= diff; - } -}; + SpellCrystalSpikeDamageTimer = 3.7*IN_MILLISECONDS; + SpellCrystalSpikePrevisualTimer = 1*IN_MILLISECONDS; + } -struct mob_crystalline_tanglerAI : public ScriptedAI -{ - mob_crystalline_tanglerAI(Creature *c) : ScriptedAI(c) {} + void UpdateAI(const uint32 diff) + { + if (SpellCrystalSpikePrevisualTimer <= diff) + { + DoCast(me, SPELL_CRYSTAL_SPIKE_PREVISUAL); + SpellCrystalSpikePrevisualTimer = 10*IN_MILLISECONDS; + } else SpellCrystalSpikePrevisualTimer -= diff; + + if (SpellCrystalSpikeDamageTimer <= diff) + { + DoCast(me, SPELL_CRYSTALL_SPIKE_DAMAGE); + SpellCrystalSpikeDamageTimer = 10*IN_MILLISECONDS; + } else SpellCrystalSpikeDamageTimer -= diff; + } + }; - uint32 uiRootsTimer; +}; +
class mob_crystalline_tangler : public CreatureScript +{ +public: + mob_crystalline_tangler() : CreatureScript("mob_crystalline_tangler") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiRootsTimer = 1*IN_MILLISECONDS; + return new mob_crystalline_tanglerAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_crystalline_tanglerAI : public ScriptedAI { - if (uiRootsTimer <= diff) + mob_crystalline_tanglerAI(Creature *c) : ScriptedAI(c) {} + + uint32 uiRootsTimer; + + void Reset() { - if (me->IsWithinDist(me->getVictim(), 5.0f, false)) + uiRootsTimer = 1*IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (uiRootsTimer <= diff) { - DoCast(me->getVictim(), SPELL_ROOTS); - uiRootsTimer = 15*IN_MILLISECONDS; - } - } else uiRootsTimer -= diff; - } + if (me->IsWithinDist(me->getVictim(), 5.0f, false)) + { + DoCast(me->getVictim(), SPELL_ROOTS); + uiRootsTimer = 15*IN_MILLISECONDS; + } + } else uiRootsTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_crystal_spike(Creature* pCreature) -{ - return new mob_crystal_spikeAI (pCreature); -} -CreatureAI* GetAI_mob_crystalline_tangler(Creature* pCreature) -{ - return new mob_crystalline_tanglerAI (pCreature); -} -CreatureAI* GetAI_boss_ormorok(Creature* pCreature) -{ - return new boss_ormorokAI (pCreature); -} void AddSC_boss_ormorok() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ormorok"; - newscript->GetAI = &GetAI_boss_ormorok; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_crystal_spike"; - newscript->GetAI = &GetAI_mob_crystal_spike; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_crystalline_tangler"; - newscript->GetAI = &GetAI_mob_crystalline_tangler; - newscript->RegisterSelf(); + new boss_ormorok(); + new mob_crystal_spike(); + new mob_crystalline_tangler(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp index 2a95007a477..52b1943b7d6 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp @@ -39,37 +39,39 @@ update creature_template set scriptname = 'boss_commander_kolurg' where entry = #define SAY_AGGRO -1576024 #define SAY_KILL -1576025 #define SAY_DEATH -1576026 - -struct boss_commander_kolurgAI : public ScriptedAI +
class boss_commander_kolurg : public CreatureScript { - boss_commander_kolurgAI(Creature *c) : ScriptedAI(c) {} +public: + boss_commander_kolurg() : CreatureScript("boss_commander_kolurg") { } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) + CreatureAI* GetAI(Creature* pCreature) const { - //Return since we have no target - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + return new boss_commander_kolurgAI (pCreature); } - void JustDied(Unit* /*killer*/) {} + + struct boss_commander_kolurgAI : public ScriptedAI + { + boss_commander_kolurgAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) {} + }; + }; -CreatureAI* GetAI_boss_commander_kolurg(Creature* pCreature) -{ - return new boss_commander_kolurgAI (pCreature); -} void AddSC_boss_commander_kolurg() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_commander_kolurg"; - newscript->GetAI = &GetAI_boss_commander_kolurg; - newscript->RegisterSelf(); + new boss_commander_kolurg(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp index a4e8f9559ce..baa851e3f2b 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp @@ -39,43 +39,45 @@ update creature_template set scriptname = 'boss_commander_stoutbeard' where entr #define SAY_AGGRO -1576021 #define SAY_KILL -1576022 #define SAY_DEATH -1576023 - -struct boss_commander_stoutbeardAI : public ScriptedAI +
class boss_commander_stoutbeard : public CreatureScript { - boss_commander_stoutbeardAI(Creature *c) : ScriptedAI(c) {} +public: + boss_commander_stoutbeard() : CreatureScript("boss_commander_stoutbeard") { } - void Reset() {} - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me); + return new boss_commander_stoutbeardAI (pCreature); } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } - void JustDied(Unit* /*killer*/) + struct boss_commander_stoutbeardAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); - } + boss_commander_stoutbeardAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + } + }; + }; -CreatureAI* GetAI_boss_commander_stoutbeard(Creature* pCreature) -{ - return new boss_commander_stoutbeardAI (pCreature); -} void AddSC_boss_commander_stoutbeard() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_commander_stoutbeard"; - newscript->GetAI = &GetAI_boss_commander_stoutbeard; - newscript->RegisterSelf(); + new boss_commander_stoutbeard(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 356a7eab12f..74b04dd672e 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -25,236 +25,239 @@ enum Factions { FACTION_HOSTILE_FOR_ALL = 16 }; - -struct instance_nexus : public ScriptedInstance +
class instance_nexus : public InstanceMapScript { - instance_nexus(Map *pMap) : ScriptedInstance(pMap) { Initialize(); } +public: + instance_nexus() : InstanceMapScript("instance_nexus") { } - uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; + InstanceScript *GetInstanceData_InstanceMapScript(Map *pMap) + { + return new instance_nexus_InstanceMapScript(pMap); + } - uint64 Anomalus; - uint64 Keristrasza; + struct instance_nexus_InstanceMapScript : public InstanceScript + { + instance_nexus_InstanceMapScript(Map *pMap) : InstanceScript(pMap) { Initialize(); } - uint64 AnomalusContainmentSphere; - uint64 OrmoroksContainmentSphere; - uint64 TelestrasContainmentSphere; + uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; - std::string strInstData; + uint64 Anomalus; + uint64 Keristrasza; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + uint64 AnomalusContainmentSphere; + uint64 OrmoroksContainmentSphere; + uint64 TelestrasContainmentSphere; - Anomalus = 0; - Keristrasza = 0; - } - - void OnCreatureCreate(Creature *pCreature, bool /*bAdd*/) - { - Map::PlayerList const &players = instance->GetPlayers(); - uint32 TeamInInstance = 0; + std::string strInstData; - if (!players.isEmpty()) + void Initialize() { - if (Player* pPlayer = players.begin()->getSource()) - TeamInInstance = pPlayer->GetTeam(); + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + Anomalus = 0; + Keristrasza = 0; } - switch (pCreature->GetEntry()) + + void OnCreatureCreate(Creature *pCreature, bool /*bAdd*/) { - case 26763: - Anomalus = pCreature->GetGUID(); - break; - case 26723: - Keristrasza = pCreature->GetGUID(); - break; - // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs. - case 26800: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26799, HORDE); - break; - } - case 26802: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26801, HORDE); - break; - } - case 26805: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26803, HORDE); - break; - } - case 27949: + Map::PlayerList const &players = instance->GetPlayers(); + uint32 TeamInInstance = 0; + + if (!players.isEmpty()) { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(27947, HORDE); - break; + if (Player* pPlayer = players.begin()->getSource()) + TeamInInstance = pPlayer->GetTeam(); } - case 26796: + switch (pCreature->GetEntry()) { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26798, HORDE); - break; + case 26763: + Anomalus = pCreature->GetGUID(); + break; + case 26723: + Keristrasza = pCreature->GetGUID(); + break; + // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs. + case 26800: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26799, HORDE); + break; + } + case 26802: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26801, HORDE); + break; + } + case 26805: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26803, HORDE); + break; + } + case 27949: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(27947, HORDE); + break; + } + case 26796: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26798, HORDE); + break; + } } } - } - void OnGameObjectCreate(GameObject *pGo, bool /*bAdd*/) - { - switch (pGo->GetEntry()) + void OnGameObjectCreate(GameObject *pGo, bool /*bAdd*/) { - case 188527: + switch (pGo->GetEntry()) { - AnomalusContainmentSphere = pGo->GetGUID(); - if (m_auiEncounter[1] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - } - case 188528: - { - OrmoroksContainmentSphere = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - } - case 188526: - { - TelestrasContainmentSphere = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; + case 188527: + { + AnomalusContainmentSphere = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + } + case 188528: + { + OrmoroksContainmentSphere = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + } + case 188526: + { + TelestrasContainmentSphere = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + } } } - } - uint32 GetData(uint32 identifier) - { - switch(identifier) + uint32 GetData(uint32 identifier) { - case DATA_MAGUS_TELESTRA_EVENT: return m_auiEncounter[0]; - case DATA_ANOMALUS_EVENT: return m_auiEncounter[1]; - case DATA_ORMOROK_EVENT: return m_auiEncounter[2]; - case DATA_KERISTRASZA_EVENT: return m_auiEncounter[3]; + switch(identifier) + { + case DATA_MAGUS_TELESTRA_EVENT: return m_auiEncounter[0]; + case DATA_ANOMALUS_EVENT: return m_auiEncounter[1]; + case DATA_ORMOROK_EVENT: return m_auiEncounter[2]; + case DATA_KERISTRASZA_EVENT: return m_auiEncounter[3]; + } + return 0; } - return 0; - } - void SetData(uint32 identifier, uint32 data) - { - switch (identifier) + void SetData(uint32 identifier, uint32 data) { - case DATA_MAGUS_TELESTRA_EVENT: + switch (identifier) { - if (data == DONE) + case DATA_MAGUS_TELESTRA_EVENT: { - GameObject *Sphere = instance->GetGameObject(TelestrasContainmentSphere); - if (Sphere) - Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + if (data == DONE) + { + GameObject *Sphere = instance->GetGameObject(TelestrasContainmentSphere); + if (Sphere) + Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + m_auiEncounter[0] = data; + break; } - m_auiEncounter[0] = data; - break; - } - case DATA_ANOMALUS_EVENT: - { - if (data == DONE) + case DATA_ANOMALUS_EVENT: { - if (GameObject *Sphere = instance->GetGameObject(AnomalusContainmentSphere)) - Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + if (data == DONE) + { + if (GameObject *Sphere = instance->GetGameObject(AnomalusContainmentSphere)) + Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + m_auiEncounter[1] = data; + break; } - m_auiEncounter[1] = data; - break; - } - case DATA_ORMOROK_EVENT: - { - if (data == DONE) + case DATA_ORMOROK_EVENT: { - if (GameObject *Sphere = instance->GetGameObject(OrmoroksContainmentSphere)) - Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + if (data == DONE) + { + if (GameObject *Sphere = instance->GetGameObject(OrmoroksContainmentSphere)) + Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + m_auiEncounter[2] = data; + break; } - m_auiEncounter[2] = data; - break; + case DATA_KERISTRASZA_EVENT: + m_auiEncounter[3] = data; + break; } - case DATA_KERISTRASZA_EVENT: - m_auiEncounter[3] = data; - break; - } - if (data == DONE) - { - OUT_SAVE_INST_DATA; + if (data == DONE) + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3]; + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3]; - strInstData = saveStream.str(); + strInstData = saveStream.str(); - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } - } - uint64 GetData64(uint32 uiIdentifier) - { - switch(uiIdentifier) + uint64 GetData64(uint32 uiIdentifier) { - case DATA_ANOMALUS: return Anomalus; - case DATA_KERISTRASZA: return Keristrasza; - case ANOMALUS_CONTAINMET_SPHERE: return AnomalusContainmentSphere; - case ORMOROKS_CONTAINMET_SPHERE: return OrmoroksContainmentSphere; - case TELESTRAS_CONTAINMET_SPHERE: return TelestrasContainmentSphere; + switch(uiIdentifier) + { + case DATA_ANOMALUS: return Anomalus; + case DATA_KERISTRASZA: return Keristrasza; + case ANOMALUS_CONTAINMET_SPHERE: return AnomalusContainmentSphere; + case ORMOROKS_CONTAINMET_SPHERE: return OrmoroksContainmentSphere; + case TELESTRAS_CONTAINMET_SPHERE: return TelestrasContainmentSphere; + } + return 0; } - return 0; - } - std::string GetSaveData() - { - return strInstData; - } - - void Load(const char *chrIn) - { - if (!chrIn) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; + return strInstData; } - OUT_LOAD_INST_DATA(chrIn); + void Load(const char *chrIn) + { + if (!chrIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::istringstream loadStream(chrIn); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; + OUT_LOAD_INST_DATA(chrIn); - for (uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + std::istringstream loadStream(chrIn); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; + + for (uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData *GetInstanceData_instance_nexus(Map *pMap) -{ - return new instance_nexus(pMap); -} void AddSC_instance_nexus() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_nexus"; - newscript->GetInstanceData = &GetInstanceData_instance_nexus; - newscript->RegisterSelf(); + new instance_nexus(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index a1201b838c5..1d6f581b170 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -51,169 +51,174 @@ enum { ACHIEV_TIMED_START_EVENT = 18153, }; - -struct boss_drakosAI : public ScriptedAI +
class boss_drakos : public CreatureScript { - boss_drakosAI(Creature* pCreature) : ScriptedAI(pCreature), lSummons(me) +public: + boss_drakos() : CreatureScript("boss_drakos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_drakosAI (pCreature); } - uint32 uiMagicPullTimer; - uint32 uiStompTimer; - uint32 uiBombSummonTimer; + struct boss_drakosAI : public ScriptedAI + { + boss_drakosAI(Creature* pCreature) : ScriptedAI(pCreature), lSummons(me) + { + pInstance = pCreature->GetInstanceScript(); + } - bool bPostPull; + uint32 uiMagicPullTimer; + uint32 uiStompTimer; + uint32 uiBombSummonTimer; - ScriptedInstance* pInstance; - SummonList lSummons; + bool bPostPull; - void Reset() - { - lSummons.DespawnAll(); - uiMagicPullTimer = 15000; - uiStompTimer = 17000; - uiBombSummonTimer = 2000; + InstanceScript* pInstance; + SummonList lSummons; - bPostPull = false; + void Reset() + { + lSummons.DespawnAll(); + uiMagicPullTimer = 15000; + uiStompTimer = 17000; + uiBombSummonTimer = 2000; - if (pInstance) - pInstance->SetData(DATA_DRAKOS_EVENT, NOT_STARTED); - } + bPostPull = false; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_DRAKOS_EVENT, NOT_STARTED); + } - if (pInstance) - pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - void JustSummoned(Creature* pSummon) - { - lSummons.Summon(pSummon); - } + if (pInstance) + pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void JustSummoned(Creature* pSummon) + { + lSummons.Summon(pSummon); + } - if (uiBombSummonTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - Position pPosition; - me->GetPosition(&pPosition); + //Return since we have no target + if (!UpdateVictim()) + return; - if (bPostPull) + if (uiBombSummonTimer <= uiDiff) { - for (uint8 uiI = 0; uiI >= 3; uiI++) + Position pPosition; + me->GetPosition(&pPosition); + + if (bPostPull) + { + for (uint8 uiI = 0; uiI >= 3; uiI++) + { + me->GetRandomNearPosition(pPosition, float(urand(0,10))); + me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); + } + } + else { me->GetRandomNearPosition(pPosition, float(urand(0,10))); me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); } - } - else + + uiBombSummonTimer = 2000; + } else uiBombSummonTimer -= uiDiff; + + if (uiMagicPullTimer <= uiDiff) { - me->GetRandomNearPosition(pPosition, float(urand(0,10))); - me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); - } + DoCast(SPELL_MAGIC_PULL); - uiBombSummonTimer = 2000; - } else uiBombSummonTimer -= uiDiff; + bPostPull = true; - if (uiMagicPullTimer <= uiDiff) - { - DoCast(SPELL_MAGIC_PULL); + uiMagicPullTimer = 15000; + } else uiMagicPullTimer -= uiDiff; - bPostPull = true; + if (uiStompTimer <= uiDiff) + { + DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), me); + DoCast(SPELL_THUNDERING_STOMP); + uiStompTimer = 17000; + } else uiStompTimer -= uiDiff; - uiMagicPullTimer = 15000; - } else uiMagicPullTimer -= uiDiff; + DoMeleeAttackIfReady(); + } - if (uiStompTimer <= uiDiff) + void JustDied(Unit* /*killer*/) { - DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), me); - DoCast(SPELL_THUNDERING_STOMP); - uiStompTimer = 17000; - } else uiStompTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } + DoScriptText(SAY_DEATH, me); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + { + pInstance->SetData(DATA_DRAKOS_EVENT, DONE); + // start achievement timer (kill Eregos within 20 min) + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - if (pInstance) + lSummons.DespawnAll(); + } + void KilledUnit(Unit* /*victim*/) { - pInstance->SetData(DATA_DRAKOS_EVENT, DONE); - // start achievement timer (kill Eregos within 20 min) - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); } + }; - lSummons.DespawnAll(); - } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); - } }; -CreatureAI* GetAI_boss_drakos(Creature* pCreature) +
class npc_unstable_sphere : public CreatureScript { - return new boss_drakosAI (pCreature); -} - -struct npc_unstable_sphereAI : public ScriptedAI -{ - npc_unstable_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } - uint32 uiPulseTimer; - uint32 uiDeathTimer; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_unstable_sphereAI (pCreature); + } - void Reset() + struct npc_unstable_sphereAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRandom(40.0f); + npc_unstable_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) {} - me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); + uint32 uiPulseTimer; + uint32 uiDeathTimer; - uiPulseTimer = 3000; - uiDeathTimer = 19000; - } + void Reset() + { + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveRandom(40.0f); - void UpdateAI(const uint32 uiDiff) - { - if (uiPulseTimer <= uiDiff) + me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); + me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); + + uiPulseTimer = 3000; + uiDeathTimer = 19000; + } + + void UpdateAI(const uint32 uiDiff) { - DoCast(SPELL_UNSTABLE_SPHERE_PULSE); - uiPulseTimer = 3*IN_MILLISECONDS; - } else uiPulseTimer -= uiDiff; + if (uiPulseTimer <= uiDiff) + { + DoCast(SPELL_UNSTABLE_SPHERE_PULSE); + uiPulseTimer = 3*IN_MILLISECONDS; + } else uiPulseTimer -= uiDiff; + + if (uiDeathTimer <= uiDiff) + me->DisappearAndDie(); + else uiDeathTimer -= uiDiff; + } + }; - if (uiDeathTimer <= uiDiff) - me->DisappearAndDie(); - else uiDeathTimer -= uiDiff; - } }; -CreatureAI* GetAI_npc_unstable_sphere(Creature* pCreature) -{ - return new npc_unstable_sphereAI (pCreature); -} void AddSC_boss_drakos() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_drakos"; - newscript->GetAI = &GetAI_boss_drakos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_unstable_sphere"; - newscript->GetAI = &GetAI_npc_unstable_sphere; - newscript->RegisterSelf(); + new boss_drakos(); + new npc_unstable_sphere(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index cde22d0268c..5604f82f9d7 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -74,57 +74,59 @@ enum EmeraldDrake // you do not have access to until you kill the Mage-Lord Urom SPELL_EMERALD_DREAM_FUNNEL = 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. }; - -struct boss_eregosAI : public ScriptedAI +
class boss_eregos : public CreatureScript { - boss_eregosAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; +public: + boss_eregos() : CreatureScript("boss_eregos") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, NOT_STARTED); + return new boss_eregosAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_eregosAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, IN_PROGRESS); - } + boss_eregosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - DoMeleeAttackIfReady(); - } + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_EREGOS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_EREGOS_EVENT, IN_PROGRESS); + } + + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_EREGOS_EVENT, DONE); + } + }; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_eregos(Creature* pCreature) -{ - return new boss_eregosAI (pCreature); -} void AddSC_boss_eregos() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_eregos"; - newscript->GetAI = &GetAI_boss_eregos; - newscript->RegisterSelf(); + new boss_eregos(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 86735b9ff81..5d1626ec3d1 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -85,273 +85,275 @@ static int32 SayAggro[]= { SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3,SAY_AGGRO_4 }; - -struct boss_uromAI : public ScriptedAI +
class boss_urom : public CreatureScript { - boss_uromAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_urom() : CreatureScript("boss_urom") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_uromAI (pCreature); } - ScriptedInstance* pInstance; - - float x,y; - - bool bCanCast; - bool bCanGoBack; - - uint8 uiGroup[3]; - - uint32 uiTeleportTimer; - uint32 uiArcaneExplosionTimer; - uint32 uiCastArcaneExplosionTimer; - uint32 uiFrostBombTimer; - uint32 uiTimeBombTimer; - - void Reset() + struct boss_uromAI : public ScriptedAI { - if (pInstance && pInstance->GetData(DATA_VAROS_EVENT) != DONE) - DoCast(SPELL_ARCANE_SHIELD); - - if (pInstance) - pInstance->SetData(DATA_UROM_EVENT, NOT_STARTED); - - if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) == 0) + boss_uromAI(Creature* pCreature) : ScriptedAI(pCreature) { - uiGroup[0] = 0; - uiGroup[1] = 0; - uiGroup[2] = 0; + pInstance = pCreature->GetInstanceScript(); } - x,y = 0.0f; - bCanCast = false; - bCanGoBack = false; + InstanceScript* pInstance; - me->GetMotionMaster()->MoveIdle(); + float x,y; - uiTeleportTimer = urand(30000,35000); - uiArcaneExplosionTimer = 9000; - uiCastArcaneExplosionTimer = 2000; - uiFrostBombTimer = urand(5000,8000); - uiTimeBombTimer = urand(20000,25000); - } + bool bCanCast; + bool bCanGoBack; - void EnterCombat(Unit* pWho) - { - if (pInstance) - pInstance->SetData(DATA_UROM_EVENT, IN_PROGRESS); + uint8 uiGroup[3]; - SetGroups(); - SummonGroups(); - CastTeleport(); + uint32 uiTeleportTimer; + uint32 uiArcaneExplosionTimer; + uint32 uiCastArcaneExplosionTimer; + uint32 uiFrostBombTimer; + uint32 uiTimeBombTimer; - if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) != 3) - pInstance->SetData(DATA_UROM_PLATAFORM,pInstance->GetData(DATA_UROM_PLATAFORM)+1); - } - - void AttackStart(Unit* pWho) - { - if (!pWho) - return; + void Reset() + { + if (pInstance && pInstance->GetData(DATA_VAROS_EVENT) != DONE) + DoCast(SPELL_ARCANE_SHIELD); - if (me->GetPositionZ() > 518.63) - DoStartNoMovement(pWho); + if (pInstance) + pInstance->SetData(DATA_UROM_EVENT, NOT_STARTED); - if (me->GetPositionZ() < 518.63) - { - if (me->Attack(pWho, true)) + if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) == 0) { - DoScriptText(SayAggro[3],me); + uiGroup[0] = 0; + uiGroup[1] = 0; + uiGroup[2] = 0; + } - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + x,y = 0.0f; + bCanCast = false; + bCanGoBack = false; - me->GetMotionMaster()->MoveChase(pWho, 0,0); - } - } - } + me->GetMotionMaster()->MoveIdle(); - void SetGroups() - { - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) != 0) - return; + uiTeleportTimer = urand(30000,35000); + uiArcaneExplosionTimer = 9000; + uiCastArcaneExplosionTimer = 2000; + uiFrostBombTimer = urand(5000,8000); + uiTimeBombTimer = urand(20000,25000); + } - while (uiGroup[0] == uiGroup[1] || uiGroup[0] == uiGroup[2] || uiGroup[1] == uiGroup[2]) + void EnterCombat(Unit* pWho) { - uiGroup[0] = urand(0,2); - uiGroup[1] = urand(0,2); - uiGroup[2] = urand(0,2); - } - } + if (pInstance) + pInstance->SetData(DATA_UROM_EVENT, IN_PROGRESS); - void SetPosition(uint8 uiI) - { - switch(uiI) - { - case 0: - x = me->GetPositionX() + 4; - y = me->GetPositionY() - 4; - break; - case 1: - x = me->GetPositionX() + 4; - y = me->GetPositionY() + 4; - break; - case 2: - x = me->GetPositionX() - 4; - y = me->GetPositionY() + 4; - break; - case 3: - x = me->GetPositionX() - 4; - y = me->GetPositionY() - 4; - break; - default: - break; - } - } + SetGroups(); + SummonGroups(); + CastTeleport(); - void SummonGroups() - { - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) - return; + if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) != 3) + pInstance->SetData(DATA_UROM_PLATAFORM,pInstance->GetData(DATA_UROM_PLATAFORM)+1); + } - for (uint8 uiI = 0; uiI < 4 ; uiI++) + void AttackStart(Unit* pWho) { - SetPosition(uiI); - me->SummonCreature(Group[uiGroup[pInstance->GetData(DATA_UROM_PLATAFORM)]].uiEntry[uiI],x,y,me->GetPositionZ(),me->GetOrientation()); - } - } + if (!pWho) + return; - void CastTeleport() - { - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) - return; + if (me->GetPositionZ() > 518.63) + DoStartNoMovement(pWho); - DoScriptText(SayAggro[pInstance->GetData(DATA_UROM_PLATAFORM)],me); - DoCast(TeleportSpells[pInstance->GetData(DATA_UROM_PLATAFORM)]); - } + if (me->GetPositionZ() < 518.63) + { + if (me->Attack(pWho, true)) + { + DoScriptText(SayAggro[3],me); - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2) - return; - - if (uiTeleportTimer <= uiDiff) + me->GetMotionMaster()->MoveChase(pWho, 0,0); + } + } + } + + void SetGroups() { - me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_TELEPORT,me); - me->GetMotionMaster()->MoveIdle(); - DoCast(SPELL_TELEPORT); - uiTeleportTimer = urand(30000,35000); + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) != 0) + return; - } else uiTeleportTimer -= uiDiff; + while (uiGroup[0] == uiGroup[1] || uiGroup[0] == uiGroup[2] || uiGroup[1] == uiGroup[2]) + { + uiGroup[0] = urand(0,2); + uiGroup[1] = urand(0,2); + uiGroup[2] = urand(0,2); + } + } - if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) + void SetPosition(uint8 uiI) { - if (uiCastArcaneExplosionTimer <= uiDiff) + switch(uiI) { - bCanCast = false; - bCanGoBack = true; - DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); - uiCastArcaneExplosionTimer = 2000; - }else uiCastArcaneExplosionTimer -= uiDiff; + case 0: + x = me->GetPositionX() + 4; + y = me->GetPositionY() - 4; + break; + case 1: + x = me->GetPositionX() + 4; + y = me->GetPositionY() + 4; + break; + case 2: + x = me->GetPositionX() - 4; + y = me->GetPositionY() + 4; + break; + case 3: + x = me->GetPositionX() - 4; + y = me->GetPositionY() - 4; + break; + default: + break; + } } - if (bCanGoBack) + void SummonGroups() { - if (uiArcaneExplosionTimer <= uiDiff) + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) + return; + + for (uint8 uiI = 0; uiI < 4 ; uiI++) { - Position pPos; - me->getVictim()->GetPosition(&pPos); + SetPosition(uiI); + me->SummonCreature(Group[uiGroup[pInstance->GetData(DATA_UROM_PLATAFORM)]].uiEntry[uiI],x,y,me->GetPositionZ(),me->GetOrientation()); + } + } - me->NearTeleportTo(pPos.GetPositionX(),pPos.GetPositionY(),pPos.GetPositionZ(),pPos.GetOrientation()); - me->GetMotionMaster()->MoveChase(me->getVictim(),0,0); - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + void CastTeleport() + { + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) + return; - bCanCast = false; - bCanGoBack = false; - uiArcaneExplosionTimer = 9000; - } else uiArcaneExplosionTimer -= uiDiff; + DoScriptText(SayAggro[pInstance->GetData(DATA_UROM_PLATAFORM)],me); + DoCast(TeleportSpells[pInstance->GetData(DATA_UROM_PLATAFORM)]); } - if (!me->IsNonMeleeSpellCasted(false, true, true)) + void UpdateAI(const uint32 uiDiff) { - if (uiFrostBombTimer <= uiDiff) - { - DoCastVictim(SPELL_FROSTBOMB); - uiFrostBombTimer = urand(5000,8000); - } else uiFrostBombTimer -= uiDiff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiTimeBombTimer <= uiDiff) + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2) + return; + + if (uiTeleportTimer <= uiDiff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pUnit,SPELL_TIME_BOMB); + me->InterruptNonMeleeSpells(false); + DoScriptText(SAY_TELEPORT,me); + me->GetMotionMaster()->MoveIdle(); + DoCast(SPELL_TELEPORT); + uiTeleportTimer = urand(30000,35000); - uiTimeBombTimer = urand(20000,25000); - } else uiTimeBombTimer -= uiDiff; - } + } else uiTeleportTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) + { + if (uiCastArcaneExplosionTimer <= uiDiff) + { + bCanCast = false; + bCanGoBack = true; + DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); + uiCastArcaneExplosionTimer = 2000; + }else uiCastArcaneExplosionTimer -= uiDiff; + } + + if (bCanGoBack) + { + if (uiArcaneExplosionTimer <= uiDiff) + { + Position pPos; + me->getVictim()->GetPosition(&pPos); + + me->NearTeleportTo(pPos.GetPositionX(),pPos.GetPositionY(),pPos.GetPositionZ(),pPos.GetOrientation()); + me->GetMotionMaster()->MoveChase(me->getVictim(),0,0); + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + + bCanCast = false; + bCanGoBack = false; + uiArcaneExplosionTimer = 9000; + } else uiArcaneExplosionTimer -= uiDiff; + } + + if (!me->IsNonMeleeSpellCasted(false, true, true)) + { + if (uiFrostBombTimer <= uiDiff) + { + DoCastVictim(SPELL_FROSTBOMB); + uiFrostBombTimer = urand(5000,8000); + } else uiFrostBombTimer -= uiDiff; + + if (uiTimeBombTimer <= uiDiff) + { + if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pUnit,SPELL_TIME_BOMB); + + uiTimeBombTimer = urand(20000,25000); + } else uiTimeBombTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_UROM_EVENT, DONE); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_UROM_EVENT, DONE); + } - void JustSummoned(Creature* pSummon) - { - pSummon->SetInCombatWithZone(); - } + void JustSummoned(Creature* pSummon) + { + pSummon->SetInCombatWithZone(); + } - void LeaveCombat() - { - me->RemoveAllAuras(); - me->CombatStop(false); - me->DeleteThreatList(); - } + void LeaveCombat() + { + me->RemoveAllAuras(); + me->CombatStop(false); + me->DeleteThreatList(); + } - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - switch(pSpell->Id) + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) { - case SPELL_SUMMON_MENAGERIE: - me->SetHomePosition(968.66,1042.53,527.32,0.077); - LeaveCombat(); - break; - case SPELL_SUMMON_MENAGERIE_2: - me->SetHomePosition(1164.02,1170.85,527.321,3.66); - LeaveCombat(); - break; - case SPELL_SUMMON_MENAGERIE_3: - me->SetHomePosition(1118.31,1080.377,508.361,4.25); - LeaveCombat(); - break; - case SPELL_TELEPORT: - me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting - bCanCast = true; - break; - default: - break; + switch(pSpell->Id) + { + case SPELL_SUMMON_MENAGERIE: + me->SetHomePosition(968.66,1042.53,527.32,0.077); + LeaveCombat(); + break; + case SPELL_SUMMON_MENAGERIE_2: + me->SetHomePosition(1164.02,1170.85,527.321,3.66); + LeaveCombat(); + break; + case SPELL_SUMMON_MENAGERIE_3: + me->SetHomePosition(1118.31,1080.377,508.361,4.25); + LeaveCombat(); + break; + case SPELL_TELEPORT: + me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting + bCanCast = true; + break; + default: + break; + } } - } + }; + }; -CreatureAI* GetAI_boss_urom(Creature* pCreature) -{ - return new boss_uromAI (pCreature); -} void AddSC_boss_urom() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_urom"; - newscript->GetAI = &GetAI_boss_urom; - newscript->RegisterSelf(); + new boss_urom(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 1a67d07dcb0..f9f22a37990 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -43,64 +43,66 @@ enum Yells SAY_STRIKE_3 = -1578028, SAY_SPAWN = -1578029 }; - -struct boss_varosAI : public ScriptedAI +
class boss_varos : public CreatureScript { - boss_varosAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_varos() : CreatureScript("boss_varos") { } - ScriptedInstance* pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_VAROS_EVENT, NOT_STARTED); + return new boss_varosAI (pCreature); } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_VAROS_EVENT, IN_PROGRESS); - } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) + struct boss_varosAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_varosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - DoMeleeAttackIfReady(); - } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + InstanceScript* pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_VAROS_EVENT, NOT_STARTED); + } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_VAROS_EVENT, IN_PROGRESS); + } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_VAROS_EVENT, DONE); + } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } + }; - if (pInstance) - pInstance->SetData(DATA_VAROS_EVENT, DONE); - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } }; -CreatureAI* GetAI_boss_varos(Creature* pCreature) -{ - return new boss_varosAI (pCreature); -} void AddSC_boss_varos() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_varos"; - newscript->GetAI = &GetAI_boss_varos; - newscript->RegisterSelf(); + new boss_varos(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index bc1ce7f58dd..8f023a98968 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -25,182 +25,185 @@ 1 - Varos Cloudstrider 2 - Mage-Lord Urom 3 - Ley-Guardian Eregos */ - -struct instance_oculus : public ScriptedInstance +
class instance_oculus : public InstanceMapScript { - instance_oculus(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_oculus() : InstanceMapScript("instance_oculus") { } - uint64 uiDrakos; - uint64 uiVaros; - uint64 uiUrom; - uint64 uiEregos; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_oculus_InstanceMapScript(pMap); + } - uint8 uiPlataformUrom; + struct instance_oculus_InstanceMapScript : public InstanceScript + { + instance_oculus_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint8 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; + uint64 uiDrakos; + uint64 uiVaros; + uint64 uiUrom; + uint64 uiEregos; - std::list<uint64> GameObjectList; + uint8 uiPlataformUrom; - void Initialize() - { - uiPlataformUrom = 0; - } + uint8 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + std::list<uint64> GameObjectList; + + void Initialize() { - case CREATURE_DRAKOS: - uiDrakos = pCreature->GetGUID(); - break; - case CREATURE_VAROS: - uiVaros = pCreature->GetGUID(); - break; - case CREATURE_UROM: - uiUrom = pCreature->GetGUID(); - break; - case CREATURE_EREGOS: - uiEregos = pCreature->GetGUID(); - break; + uiPlataformUrom = 0; } - } - void OnGameObjectCreate(GameObject* pGO, bool bAdd) - { - if (pGO->GetEntry() == GO_DRAGON_CAGE_DOOR) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - if (DATA_DRAKOS_EVENT == DONE) - pGO->SetGoState(GO_STATE_ACTIVE); - else - pGO->SetGoState(GO_STATE_READY); - - GameObjectList.push_back(pGO->GetGUID()); + switch(pCreature->GetEntry()) + { + case CREATURE_DRAKOS: + uiDrakos = pCreature->GetGUID(); + break; + case CREATURE_VAROS: + uiVaros = pCreature->GetGUID(); + break; + case CREATURE_UROM: + uiUrom = pCreature->GetGUID(); + break; + case CREATURE_EREGOS: + uiEregos = pCreature->GetGUID(); + break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnGameObjectCreate(GameObject* pGO, bool bAdd) { - case DATA_DRAKOS_EVENT: - m_auiEncounter[0] = data; - if (data == DONE) - OpenCageDoors(); - break; - case DATA_VAROS_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_UROM_EVENT: - m_auiEncounter[2] = data; - break; - case DATA_EREGOS_EVENT: - m_auiEncounter[3] = data; - break; - case DATA_UROM_PLATAFORM: - uiPlataformUrom = data; - break; + if (pGO->GetEntry() == GO_DRAGON_CAGE_DOOR) + { + if (DATA_DRAKOS_EVENT == DONE) + pGO->SetGoState(GO_STATE_ACTIVE); + else + pGO->SetGoState(GO_STATE_READY); + + GameObjectList.push_back(pGO->GetGUID()); + } } - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case DATA_DRAKOS_EVENT: return m_auiEncounter[0]; - case DATA_VAROS_EVENT: return m_auiEncounter[1]; - case DATA_UROM_EVENT: return m_auiEncounter[2]; - case DATA_EREGOS_EVENT: return m_auiEncounter[3]; - case DATA_UROM_PLATAFORM: return uiPlataformUrom; + switch(type) + { + case DATA_DRAKOS_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + OpenCageDoors(); + break; + case DATA_VAROS_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_UROM_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_EREGOS_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_UROM_PLATAFORM: + uiPlataformUrom = data; + break; + } + + if (data == DONE) + SaveToDB(); } - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) + uint32 GetData(uint32 type) { - case DATA_DRAKOS: return uiDrakos; - case DATA_VAROS: return uiVaros; - case DATA_UROM: return uiUrom; - case DATA_EREGOS: return uiEregos; + switch(type) + { + case DATA_DRAKOS_EVENT: return m_auiEncounter[0]; + case DATA_VAROS_EVENT: return m_auiEncounter[1]; + case DATA_UROM_EVENT: return m_auiEncounter[2]; + case DATA_EREGOS_EVENT: return m_auiEncounter[3]; + case DATA_UROM_PLATAFORM: return uiPlataformUrom; + } + + return 0; } - return 0; - } + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_DRAKOS: return uiDrakos; + case DATA_VAROS: return uiVaros; + case DATA_UROM: return uiUrom; + case DATA_EREGOS: return uiEregos; + } + + return 0; + } - void OpenCageDoors() - { - if (GameObjectList.empty()) - return; - - for (std::list<uint64>::const_iterator itr = GameObjectList.begin(); itr != GameObjectList.end(); ++itr) + void OpenCageDoors() { - if (GameObject* pGO = instance->GetGameObject(*itr)) - pGO->SetGoState(GO_STATE_ACTIVE); + if (GameObjectList.empty()) + return; + + for (std::list<uint64>::const_iterator itr = GameObjectList.begin(); itr != GameObjectList.end(); ++itr) + { + if (GameObject* pGO = instance->GetGameObject(*itr)) + pGO->SetGoState(GO_STATE_ACTIVE); + } } - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "T O " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; + std::ostringstream saveStream; + saveStream << "T O " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'T' && dataHead2 == 'O') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + if (dataHead1 == 'T' && dataHead2 == 'O') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_oculus(Map* pMap) -{ - return new instance_oculus(pMap); -} void AddSC_instance_oculus() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_oculus"; - newscript->GetInstanceData = &GetInstanceData_instance_oculus; - newscript->RegisterSelf(); + new instance_oculus(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index b3572bd92ff..484edc3aa0c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -49,127 +49,128 @@ enum Drakes NPC_BELGARISTRASZ = 27658, NPC_ETERNOS = 27659 }; - -bool GossipHello_npc_oculus_drake(Player* pPlayer, Creature* pCreature) +
class npc_oculus_drake : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pCreature->GetInstanceData()->GetData(DATA_DRAKOS_EVENT) == DONE) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID()); - } - - return true; -} +public: + npc_oculus_drake() : CreatureScript("npc_oculus_drake") { } -bool GossipSelect_npc_oculus_drake(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(pCreature->GetEntry()) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case NPC_VERDISA: //Verdisa - switch(uiAction) + switch(pCreature->GetEntry()) { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) + case NPC_VERDISA: //Verdisa + switch(uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, pCreature->GetGUID()); - } - else + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, pCreature->GetGUID()); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, pCreature->GetGUID()); + break; } break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, pCreature->GetGUID()); - break; - } - break; - case NPC_BELGARISTRASZ: //Belgaristrasz - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) + case NPC_BELGARISTRASZ: //Belgaristrasz + switch(uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, pCreature->GetGUID()); - } - else + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, pCreature->GetGUID()); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, pCreature->GetGUID()); + break; } break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, pCreature->GetGUID()); - break; - } - break; - case NPC_ETERNOS: //Eternos - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) + case NPC_ETERNOS: //Eternos + switch(uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, pCreature->GetGUID()); - } - else + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, pCreature->GetGUID()); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, pCreature->GetGUID()); + break; } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); break; } - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, pCreature->GetGUID()); - break; + + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->GetInstanceScript()->GetData(DATA_DRAKOS_EVENT) == DONE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID()); } - break; + + return true; } - return true; -} +}; + void AddSC_oculus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_oculus_drake"; - newscript->pGossipHello = &GossipHello_npc_oculus_drake; - newscript->pGossipSelect = &GossipSelect_npc_oculus_drake; - newscript->RegisterSelf(); + new npc_oculus_drake(); } diff --git a/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp index 971f60fe435..6dc24313584 100644 --- a/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp @@ -217,490 +217,497 @@ Locations TwilightEggsSarth[] = /*###### ## Boss Sartharion ######*/ - -struct boss_sartharionAI : public ScriptedAI +
class boss_sartharion : public CreatureScript { - boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_sartharion() : CreatureScript("boss_sartharion") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_sartharionAI(pCreature); } - ScriptedInstance* pInstance; + struct boss_sartharionAI : public ScriptedAI + { + boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - bool m_bIsBerserk; - bool m_bIsSoftEnraged; + InstanceScript* pInstance; - uint32 m_uiEnrageTimer; - bool m_bIsHardEnraged; + bool m_bIsBerserk; + bool m_bIsSoftEnraged; - uint32 m_uiTenebronTimer; - uint32 m_uiShadronTimer; - uint32 m_uiVesperonTimer; + uint32 m_uiEnrageTimer; + bool m_bIsHardEnraged; - uint32 m_uiFlameTsunamiTimer; - uint32 m_uiFlameBreathTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiLavaStrikeTimer; + uint32 m_uiTenebronTimer; + uint32 m_uiShadronTimer; + uint32 m_uiVesperonTimer; - bool m_bHasCalledTenebron; - bool m_bHasCalledShadron; - bool m_bHasCalledVesperon; + uint32 m_uiFlameTsunamiTimer; + uint32 m_uiFlameBreathTimer; + uint32 m_uiTailSweepTimer; + uint32 m_uiCleaveTimer; + uint32 m_uiLavaStrikeTimer; - uint32 achievProgress; + bool m_bHasCalledTenebron; + bool m_bHasCalledShadron; + bool m_bHasCalledVesperon; - void Reset() - { - m_bIsBerserk = false; - m_bIsSoftEnraged = false; + uint32 achievProgress; - m_uiEnrageTimer = 15*MINUTE*IN_MILLISECONDS; - m_bIsHardEnraged = false; + void Reset() + { + m_bIsBerserk = false; + m_bIsSoftEnraged = false; - m_uiTenebronTimer = 30000; - m_uiShadronTimer = 75000; - m_uiVesperonTimer = 120000; + m_uiEnrageTimer = 15*MINUTE*IN_MILLISECONDS; + m_bIsHardEnraged = false; - m_uiFlameTsunamiTimer = 30000; - m_uiFlameBreathTimer = 20000; - m_uiTailSweepTimer = 20000; - m_uiCleaveTimer = 7000; - m_uiLavaStrikeTimer = 5000; + m_uiTenebronTimer = 30000; + m_uiShadronTimer = 75000; + m_uiVesperonTimer = 120000; - m_bHasCalledTenebron = false; - m_bHasCalledShadron = false; - m_bHasCalledVesperon = false; + m_uiFlameTsunamiTimer = 30000; + m_uiFlameBreathTimer = 20000; + m_uiTailSweepTimer = 20000; + m_uiCleaveTimer = 7000; + m_uiLavaStrikeTimer = 5000; - if (me->HasAura(SPELL_TWILIGHT_REVENGE)) - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); + m_bHasCalledTenebron = false; + m_bHasCalledShadron = false; + m_bHasCalledVesperon = false; - me->ResetLootMode(); - me->SetHomePosition(3246.57, 551.263, 58.6164, 4.66003); + if (me->HasAura(SPELL_TWILIGHT_REVENGE)) + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); - achievProgress = 0; + me->ResetLootMode(); + me->SetHomePosition(3246.57, 551.263, 58.6164, 4.66003); - // Drakes respawning system - if (pInstance) - { - Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); - Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); - Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); - if (pTenebron) + achievProgress = 0; + + // Drakes respawning system + if (pInstance) { - pTenebron->SetHomePosition(3239.07, 657.235, 86.8775, 4.74729); - if(pTenebron->isAlive()) + Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); + Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); + Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); + if (pTenebron) { - if (pTenebron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pTenebron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTenebron->GetMotionMaster()->MoveTargetedHome(); - }else - { - if(pInstance->GetData(TYPE_TENEBRON_PREKILLED) == false) + pTenebron->SetHomePosition(3239.07, 657.235, 86.8775, 4.74729); + if(pTenebron->isAlive()) { - pTenebron->Respawn(); + if (pTenebron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pTenebron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pTenebron->GetMotionMaster()->MoveTargetedHome(); - pTenebron->AI()->SetData(DATA_CAN_LOOT,0); + }else + { + if(pInstance->GetData(TYPE_TENEBRON_PREKILLED) == false) + { + pTenebron->Respawn(); + pTenebron->GetMotionMaster()->MoveTargetedHome(); + pTenebron->AI()->SetData(DATA_CAN_LOOT,0); + } } } - } - if (pShadron) - { - pShadron->SetHomePosition(3363.06, 525.28, 98.362, 4.76475); - if(pShadron->isAlive()) - { - if (pShadron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pShadron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pShadron->GetMotionMaster()->MoveTargetedHome(); - }else + if (pShadron) { - if(pInstance->GetData(TYPE_SHADRON_PREKILLED) == false) + pShadron->SetHomePosition(3363.06, 525.28, 98.362, 4.76475); + if(pShadron->isAlive()) { - pShadron->Respawn(); + if (pShadron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pShadron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pShadron->GetMotionMaster()->MoveTargetedHome(); - pShadron->AI()->SetData(DATA_CAN_LOOT,0); + }else + { + if(pInstance->GetData(TYPE_SHADRON_PREKILLED) == false) + { + pShadron->Respawn(); + pShadron->GetMotionMaster()->MoveTargetedHome(); + pShadron->AI()->SetData(DATA_CAN_LOOT,0); + } } } - } - if (pVesperon) - { - pVesperon->SetHomePosition(3145.68, 520.71, 89.7, 4.64258); - if(pVesperon->isAlive()) - { - if (pVesperon->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pVesperon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pVesperon->GetMotionMaster()->MoveTargetedHome(); - }else + if (pVesperon) { - if(pInstance->GetData(TYPE_VESPERON_PREKILLED) == false) + pVesperon->SetHomePosition(3145.68, 520.71, 89.7, 4.64258); + if(pVesperon->isAlive()) { - pVesperon->Respawn(); + if (pVesperon->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pVesperon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pVesperon->GetMotionMaster()->MoveTargetedHome(); - pVesperon->AI()->SetData(DATA_CAN_LOOT,0); + }else + { + if(pInstance->GetData(TYPE_VESPERON_PREKILLED) == false) + { + pVesperon->Respawn(); + pVesperon->GetMotionMaster()->MoveTargetedHome(); + pVesperon->AI()->SetData(DATA_CAN_LOOT,0); + } } } } } - } - void JustReachedHome() - { - if (pInstance) - pInstance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_SARTHARION_AGGRO,me); - DoZoneInCombat(); - - if (pInstance) + void JustReachedHome() { - pInstance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS); - FetchDragons(); + if (pInstance) + pInstance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED); } - } - - void JustDied(Unit* pKiller) - { - DoScriptText(SAY_SARTHARION_DEATH,me); - if (pInstance) + void EnterCombat(Unit* pWho) { - Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); - Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); - Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); - if (pTenebron && pTenebron->isAlive()) - pTenebron->DisappearAndDie(); - if (pShadron && pShadron->isAlive()) - pShadron->DisappearAndDie(); - if (pVesperon && pVesperon->isAlive()) - pVesperon->DisappearAndDie(); - - if (achievProgress == 1) - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); - else if (achievProgress == 2) + DoScriptText(SAY_SARTHARION_AGGRO,me); + DoZoneInCombat(); + + if (pInstance) { - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); + pInstance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS); + FetchDragons(); } - else if (achievProgress == 3) + } + + void JustDied(Unit* pKiller) + { + DoScriptText(SAY_SARTHARION_DEATH,me); + + if (pInstance) { - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ZONE,H_ACHIEV_TWILIGHT_ZONE)); - } + Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); + Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); + Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); + if (pTenebron && pTenebron->isAlive()) + pTenebron->DisappearAndDie(); + if (pShadron && pShadron->isAlive()) + pShadron->DisappearAndDie(); + if (pVesperon && pVesperon->isAlive()) + pVesperon->DisappearAndDie(); + + if (achievProgress == 1) + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); + else if (achievProgress == 2) + { + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); + } + else if (achievProgress == 3) + { + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ZONE,H_ACHIEV_TWILIGHT_ZONE)); + } - pInstance->SetData(TYPE_SARTHARION_EVENT, DONE); + pInstance->SetData(TYPE_SARTHARION_EVENT, DONE); + } } - } - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_SARTHARION_SLAY_1,SAY_SARTHARION_SLAY_2,SAY_SARTHARION_SLAY_3), me); - } + void KilledUnit(Unit* pVictim) + { + DoScriptText(RAND(SAY_SARTHARION_SLAY_1,SAY_SARTHARION_SLAY_2,SAY_SARTHARION_SLAY_3), me); + } - // me->ResetLootMode() is called from Reset() - // AddDrakeLootMode() should only ever be called from FetchDragons(), which is called from Aggro() - void AddDrakeLootMode() - { - if (me->HasLootMode(LOOT_MODE_HARD_MODE_2)) // Has two Drake loot modes - me->AddLootMode(LOOT_MODE_HARD_MODE_3); // Add 3rd Drake loot mode - else if (me->HasLootMode(LOOT_MODE_HARD_MODE_1)) // Has one Drake loot mode - me->AddLootMode(LOOT_MODE_HARD_MODE_2); // Add 2nd Drake loot mode - else // Has no Drake loot modes - me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode - } + // me->ResetLootMode() is called from Reset() + // AddDrakeLootMode() should only ever be called from FetchDragons(), which is called from Aggro() + void AddDrakeLootMode() + { + if (me->HasLootMode(LOOT_MODE_HARD_MODE_2)) // Has two Drake loot modes + me->AddLootMode(LOOT_MODE_HARD_MODE_3); // Add 3rd Drake loot mode + else if (me->HasLootMode(LOOT_MODE_HARD_MODE_1)) // Has one Drake loot mode + me->AddLootMode(LOOT_MODE_HARD_MODE_2); // Add 2nd Drake loot mode + else // Has no Drake loot modes + me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode + } - void FetchDragons() - { - if(!pInstance) - return; + void FetchDragons() + { + if(!pInstance) + return; - me->ResetLootMode(); - achievProgress = 0; + me->ResetLootMode(); + achievProgress = 0; - Creature* pFetchTene = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); - Creature* pFetchShad = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); - Creature* pFetchVesp = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); + Creature* pFetchTene = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); + Creature* pFetchShad = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); + Creature* pFetchVesp = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); - //if at least one of the dragons are alive and are being called - bool bCanUseWill = false; + //if at least one of the dragons are alive and are being called + bool bCanUseWill = false; - if (pFetchTene && pFetchTene->isAlive() && !pFetchTene->getVictim()) - { - bCanUseWill = true; - if(!pFetchTene->isInCombat()) + if (pFetchTene && pFetchTene->isAlive() && !pFetchTene->getVictim()) { - AddDrakeLootMode(); - achievProgress++; - } - pFetchTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); + bCanUseWill = true; + if(!pFetchTene->isInCombat()) + { + AddDrakeLootMode(); + achievProgress++; + } + pFetchTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); - if (!pFetchTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + if (!pFetchTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pFetchTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - if (pFetchShad && pFetchShad->isAlive() && !pFetchShad->getVictim()) - { - bCanUseWill = true; - if(!pFetchShad->isInCombat()) + if (pFetchShad && pFetchShad->isAlive() && !pFetchShad->getVictim()) { - AddDrakeLootMode(); - achievProgress++; - } - pFetchShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); + bCanUseWill = true; + if(!pFetchShad->isInCombat()) + { + AddDrakeLootMode(); + achievProgress++; + } + pFetchShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); - if (!pFetchShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + if (!pFetchShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pFetchShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - if (pFetchVesp && pFetchVesp->isAlive() && !pFetchVesp->getVictim()) - { - bCanUseWill = true; - if(!pFetchVesp->isInCombat()) + if (pFetchVesp && pFetchVesp->isAlive() && !pFetchVesp->getVictim()) { - AddDrakeLootMode(); - achievProgress++; + bCanUseWill = true; + if(!pFetchVesp->isInCombat()) + { + AddDrakeLootMode(); + achievProgress++; + } + pFetchVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); + + if (!pFetchVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pFetchVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - pFetchVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); - if (!pFetchVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (bCanUseWill) + DoCast(me, SPELL_WILL_OF_SARTHARION); } - if (bCanUseWill) - DoCast(me, SPELL_WILL_OF_SARTHARION); - } - - void CallDragon(uint32 uiDataId) - { - if (pInstance) + void CallDragon(uint32 uiDataId) { - if (Creature *pTemp = Unit::GetCreature(*me,pInstance->GetData64(uiDataId))) + if (pInstance) { - if (pTemp->isAlive() && !pTemp->getVictim()) + if (Creature *pTemp = Unit::GetCreature(*me,pInstance->GetData64(uiDataId))) { - if (pTemp->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - - if (pTemp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - int32 iTextId = 0; - - switch(pTemp->GetEntry()) + if (pTemp->isAlive() && !pTemp->getVictim()) { - case NPC_TENEBRON: - iTextId = SAY_SARTHARION_CALL_TENEBRON; - pTemp->AddAura(SPELL_POWER_OF_TENEBRON, pTemp); - pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ); - break; - case NPC_SHADRON: - iTextId = SAY_SARTHARION_CALL_SHADRON; - pTemp->AddAura(SPELL_POWER_OF_SHADRON, pTemp); - pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ); - break; - case NPC_VESPERON: - iTextId = SAY_SARTHARION_CALL_VESPERON; - pTemp->AddAura(SPELL_POWER_OF_VESPERON, pTemp); - pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ); - break; + if (pTemp->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + + if (pTemp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + int32 iTextId = 0; + + switch(pTemp->GetEntry()) + { + case NPC_TENEBRON: + iTextId = SAY_SARTHARION_CALL_TENEBRON; + pTemp->AddAura(SPELL_POWER_OF_TENEBRON, pTemp); + pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ); + break; + case NPC_SHADRON: + iTextId = SAY_SARTHARION_CALL_SHADRON; + pTemp->AddAura(SPELL_POWER_OF_SHADRON, pTemp); + pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ); + break; + case NPC_VESPERON: + iTextId = SAY_SARTHARION_CALL_VESPERON; + pTemp->AddAura(SPELL_POWER_OF_VESPERON, pTemp); + pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ); + break; + } + + DoScriptText(iTextId, me); } - - DoScriptText(iTextId, me); } } } - } - void SendFlameTsunami() - { - if (Map* pMap = me->GetMap()) - if (pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource() && i->getSource()->isAlive()) - DoScriptText(WHISPER_LAVA_CHURN, me, i->getSource()); - } - } - - // Selects a random Fire Cyclone and makes it cast Lava Strike. - // FIXME: Frequency of the casts reduced to compensate 100% chance of spawning a Lava Blaze add - void CastLavaStrikeOnTarget(Unit* target) - { - std::list<Creature*> pFireCyclonesList; - Trinity::AllCreaturesOfEntryInRange checker(me, NPC_FIRE_CYCLONE, 200.0f); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, pFireCyclonesList, checker); - me->VisitNearbyObject(200.0f, searcher); - - if(pFireCyclonesList.empty()) - return; + void SendFlameTsunami() + { + if (Map* pMap = me->GetMap()) + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); - std::list<Creature*>::iterator itr = pFireCyclonesList.begin(); - uint32 rnd = rand()%pFireCyclonesList.size(); + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource() && i->getSource()->isAlive()) + DoScriptText(WHISPER_LAVA_CHURN, me, i->getSource()); + } + } - for(uint32 i = 0; i < rnd; ++i) - ++itr; + // Selects a random Fire Cyclone and makes it cast Lava Strike. + // FIXME: Frequency of the casts reduced to compensate 100% chance of spawning a Lava Blaze add + void CastLavaStrikeOnTarget(Unit* target) + { + std::list<Creature*> pFireCyclonesList; + Trinity::AllCreaturesOfEntryInRange checker(me, NPC_FIRE_CYCLONE, 200.0f); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, pFireCyclonesList, checker); + me->VisitNearbyObject(200.0f, searcher); - (*itr)->CastSpell(target, SPELL_LAVA_STRIKE, true); - } + if(pFireCyclonesList.empty()) + return; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + std::list<Creature*>::iterator itr = pFireCyclonesList.begin(); + uint32 rnd = rand()%pFireCyclonesList.size(); - Unit* pTene = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_TENEBRON) : 0); - Unit* pShad = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SHADRON) : 0); - Unit* pVesp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_VESPERON) : 0); + for(uint32 i = 0; i < rnd; ++i) + ++itr; - //spell will target dragons, if they are still alive at 35% - if (!m_bIsBerserk && (me->GetHealth()*100 / me->GetMaxHealth()) <= 35 - && ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive()))) - { - DoScriptText(SAY_SARTHARION_BERSERK, me); - DoCast(me, SPELL_BERSERK); - m_bIsBerserk = true; + (*itr)->CastSpell(target, SPELL_LAVA_STRIKE, true); } - //soft enrage - if (!m_bIsSoftEnraged && HealthBelowPct(10)) + void UpdateAI(const uint32 uiDiff) { - // m_bIsSoftEnraged is used while determining Lava Strike cooldown. - m_bIsSoftEnraged = true; - } + //Return since we have no target + if (!UpdateVictim()) + return; - // hard enrage - if (!m_bIsHardEnraged) - { - if (m_uiEnrageTimer <= uiDiff) + Unit* pTene = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_TENEBRON) : 0); + Unit* pShad = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SHADRON) : 0); + Unit* pVesp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_VESPERON) : 0); + + //spell will target dragons, if they are still alive at 35% + if (!m_bIsBerserk && (me->GetHealth()*100 / me->GetMaxHealth()) <= 35 + && ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive()))) { - DoCast(me, SPELL_PYROBUFFET, true); - m_bIsHardEnraged = true; + DoScriptText(SAY_SARTHARION_BERSERK, me); + DoCast(me, SPELL_BERSERK); + m_bIsBerserk = true; } - else - m_uiEnrageTimer -= uiDiff; - } - // flame tsunami - if (m_uiFlameTsunamiTimer <= uiDiff) - { - SendFlameTsunami(); - switch(urand(0,1)) + //soft enrage + if (!m_bIsSoftEnraged && HealthBelowPct(10)) + { + // m_bIsSoftEnraged is used while determining Lava Strike cooldown. + m_bIsSoftEnraged = true; + } + + // hard enrage + if (!m_bIsHardEnraged) { - case 0: + if (m_uiEnrageTimer <= uiDiff) { - Creature *Right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn.x, FlameRight1Spawn.y , FlameRight1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Creature *Right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn.x, FlameRight2Spawn.y , FlameRight2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Creature *Right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn.x, FlameRight3Spawn.y , FlameRight3Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction.x, FlameRight1Direction.y, FlameRight1Direction.z); - Right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction.x, FlameRight2Direction.y, FlameRight2Direction.z); - Right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction.x, FlameRight3Direction.y, FlameRight3Direction.z); - break; + DoCast(me, SPELL_PYROBUFFET, true); + m_bIsHardEnraged = true; } - case 1: + else + m_uiEnrageTimer -= uiDiff; + } + + // flame tsunami + if (m_uiFlameTsunamiTimer <= uiDiff) + { + SendFlameTsunami(); + switch(urand(0,1)) { - Creature *Left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn.x, FlameLeft1Spawn.y , FlameLeft1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Creature *Left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn.x, FlameLeft2Spawn.y , FlameLeft2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction.x, FlameLeft1Direction.y, FlameLeft1Direction.z); - Left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction.x, FlameLeft2Direction.y, FlameLeft2Direction.z); - break; + case 0: + { + Creature *Right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn.x, FlameRight1Spawn.y , FlameRight1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Creature *Right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn.x, FlameRight2Spawn.y , FlameRight2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Creature *Right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn.x, FlameRight3Spawn.y , FlameRight3Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction.x, FlameRight1Direction.y, FlameRight1Direction.z); + Right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction.x, FlameRight2Direction.y, FlameRight2Direction.z); + Right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction.x, FlameRight3Direction.y, FlameRight3Direction.z); + break; + } + case 1: + { + Creature *Left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn.x, FlameLeft1Spawn.y , FlameLeft1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Creature *Left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn.x, FlameLeft2Spawn.y , FlameLeft2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction.x, FlameLeft1Direction.y, FlameLeft1Direction.z); + Left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction.x, FlameLeft2Direction.y, FlameLeft2Direction.z); + break; + } } - } - m_uiFlameTsunamiTimer = 30000; - } - else - m_uiFlameTsunamiTimer -= uiDiff; + m_uiFlameTsunamiTimer = 30000; + } + else + m_uiFlameTsunamiTimer -= uiDiff; - // flame breath - if (m_uiFlameBreathTimer <= uiDiff) - { - DoScriptText(SAY_SARTHARION_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H)); - m_uiFlameBreathTimer = urand(25000,35000); - } - else - m_uiFlameBreathTimer -= uiDiff; + // flame breath + if (m_uiFlameBreathTimer <= uiDiff) + { + DoScriptText(SAY_SARTHARION_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H)); + m_uiFlameBreathTimer = urand(25000,35000); + } + else + m_uiFlameBreathTimer -= uiDiff; - // Tail Sweep - if (m_uiTailSweepTimer <= uiDiff) - { - DoCast(me->getVictim(), RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H)); - m_uiTailSweepTimer = urand(15000,20000); - } - else - m_uiTailSweepTimer -= uiDiff; + // Tail Sweep + if (m_uiTailSweepTimer <= uiDiff) + { + DoCast(me->getVictim(), RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H)); + m_uiTailSweepTimer = urand(15000,20000); + } + else + m_uiTailSweepTimer -= uiDiff; - // Cleave - if (m_uiCleaveTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - m_uiCleaveTimer = urand(7000,10000); - } - else - m_uiCleaveTimer -= uiDiff; + // Cleave + if (m_uiCleaveTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + m_uiCleaveTimer = urand(7000,10000); + } + else + m_uiCleaveTimer -= uiDiff; - // Lavas Strike - if (m_uiLavaStrikeTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + // Lavas Strike + if (m_uiLavaStrikeTimer <= uiDiff) { - CastLavaStrikeOnTarget(pTarget); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + CastLavaStrikeOnTarget(pTarget); - if(urand(0,5) == 0) - DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1,SAY_SARTHARION_SPECIAL_2,SAY_SARTHARION_SPECIAL_3), me); + if(urand(0,5) == 0) + DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1,SAY_SARTHARION_SPECIAL_2,SAY_SARTHARION_SPECIAL_3), me); + } + m_uiLavaStrikeTimer = (m_bIsSoftEnraged ? urand(1400, 2000) : urand(5000,20000)); } - m_uiLavaStrikeTimer = (m_bIsSoftEnraged ? urand(1400, 2000) : urand(5000,20000)); - } - else - m_uiLavaStrikeTimer -= uiDiff; + else + m_uiLavaStrikeTimer -= uiDiff; - // call tenebron - if (!m_bHasCalledTenebron && m_uiTenebronTimer <= uiDiff) - { - CallDragon(DATA_TENEBRON); - m_bHasCalledTenebron = true; - } - else - m_uiTenebronTimer -= uiDiff; + // call tenebron + if (!m_bHasCalledTenebron && m_uiTenebronTimer <= uiDiff) + { + CallDragon(DATA_TENEBRON); + m_bHasCalledTenebron = true; + } + else + m_uiTenebronTimer -= uiDiff; - // call shadron - if (!m_bHasCalledShadron && m_uiShadronTimer <= uiDiff) - { - CallDragon(DATA_SHADRON); - m_bHasCalledShadron = true; - } - else - m_uiShadronTimer -= uiDiff; + // call shadron + if (!m_bHasCalledShadron && m_uiShadronTimer <= uiDiff) + { + CallDragon(DATA_SHADRON); + m_bHasCalledShadron = true; + } + else + m_uiShadronTimer -= uiDiff; - // call vesperon - if (!m_bHasCalledVesperon && m_uiVesperonTimer <= uiDiff) - { - CallDragon(DATA_VESPERON); - m_bHasCalledVesperon = true; - } - else - m_uiVesperonTimer -= uiDiff; + // call vesperon + if (!m_bHasCalledVesperon && m_uiVesperonTimer <= uiDiff) + { + CallDragon(DATA_VESPERON); + m_bHasCalledVesperon = true; + } + else + m_uiVesperonTimer -= uiDiff; - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(uiDiff); + } + }; - EnterEvadeIfOutOfCombatArea(uiDiff); - } }; -CreatureAI* GetAI_boss_sartharion(Creature* pCreature) -{ - return new boss_sartharionAI(pCreature); -} enum TeneText { @@ -743,10 +750,10 @@ struct dummy_dragonAI : public ScriptedAI { dummy_dragonAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 m_uiWaypointId; uint32 m_uiMoveNextTimer; @@ -994,720 +1001,742 @@ struct dummy_dragonAI : public ScriptedAI /*###### ## Mob Tenebron ######*/ - -struct mob_tenebronAI : public dummy_dragonAI +
class mob_tenebron : public CreatureScript { - mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiHatchEggTimer; +public: + mob_tenebron() : CreatureScript("mob_tenebron") { } - bool m_bHasPortalOpen; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiHatchEggTimer = 30000; - - m_bHasPortalOpen = false; + return new mob_tenebronAI(pCreature); } - void EnterCombat(Unit* pWho) + struct mob_tenebronAI : public dummy_dragonAI { - DoScriptText(SAY_TENEBRON_AGGRO, me); - DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_TENEBRON); - } + mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_TENEBRON_SLAY_1,SAY_TENEBRON_SLAY_2), me); - } + uint32 m_uiShadowBreathTimer; + uint32 m_uiShadowFissureTimer; + uint32 m_uiHatchEggTimer; - void UpdateAI(const uint32 uiDiff) - { - //if no target, update dummy and return - if (!UpdateVictim()) - { - dummy_dragonAI::UpdateAI(uiDiff); - return; - } + bool m_bHasPortalOpen; - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) + void Reset() { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE)); + m_uiShadowBreathTimer = 20000; + m_uiShadowFissureTimer = 5000; + m_uiHatchEggTimer = 30000; - m_uiShadowFissureTimer = urand(15000,20000); + m_bHasPortalOpen = false; } - else - m_uiShadowFissureTimer -= uiDiff; - // Hatch Egg - if (m_uiHatchEggTimer <= uiDiff) + void EnterCombat(Unit* pWho) { - OpenPortal(); - m_uiHatchEggTimer = 30000; + DoScriptText(SAY_TENEBRON_AGGRO, me); + DoZoneInCombat(); + DoCast(me, SPELL_POWER_OF_TENEBRON); } - else - m_uiHatchEggTimer -= uiDiff; - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) + void KilledUnit(Unit* pVictim) { - DoScriptText(SAY_TENEBRON_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000,25000); + DoScriptText(RAND(SAY_TENEBRON_SLAY_1,SAY_TENEBRON_SLAY_2), me); } - else - m_uiShadowBreathTimer -= uiDiff; - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + void UpdateAI(const uint32 uiDiff) + { + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(uiDiff); + return; + } + + // shadow fissure + if (m_uiShadowFissureTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE)); + + m_uiShadowFissureTimer = urand(15000,20000); + } + else + m_uiShadowFissureTimer -= uiDiff; + + // Hatch Egg + if (m_uiHatchEggTimer <= uiDiff) + { + OpenPortal(); + m_uiHatchEggTimer = 30000; + } + else + m_uiHatchEggTimer -= uiDiff; + + // shadow breath + if (m_uiShadowBreathTimer <= uiDiff) + { + DoScriptText(SAY_TENEBRON_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + m_uiShadowBreathTimer = urand(20000,25000); + } + else + m_uiShadowBreathTimer -= uiDiff; + + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_tenebron(Creature* pCreature) -{ - return new mob_tenebronAI(pCreature); -} /*###### ## Mob Shadron ######*/ - -struct mob_shadronAI : public dummy_dragonAI +
class mob_shadron : public CreatureScript { - mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} +public: + mob_shadron() : CreatureScript("mob_shadron") { } - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiAcolyteShadronTimer; - - bool m_bHasPortalOpen; + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_shadronAI(pCreature); + } - void Reset() + struct mob_shadronAI : public dummy_dragonAI { - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiAcolyteShadronTimer = 60000; + mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - if (me->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + uint32 m_uiShadowBreathTimer; + uint32 m_uiShadowFissureTimer; + uint32 m_uiAcolyteShadronTimer; - if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - me->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + bool m_bHasPortalOpen; - m_bHasPortalOpen = false; - } + void Reset() + { + m_uiShadowBreathTimer = 20000; + m_uiShadowFissureTimer = 5000; + m_uiAcolyteShadronTimer = 60000; - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_SHADRON_AGGRO,me); - DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_SHADRON); - } + if (me->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_SHADRON_SLAY_1,SAY_SHADRON_SLAY_2), me); - } + if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + me->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); - void UpdateAI(const uint32 uiDiff) - { - //if no target, update dummy and return - if (!UpdateVictim()) - { - dummy_dragonAI::UpdateAI(uiDiff); - return; + m_bHasPortalOpen = false; } - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) + void EnterCombat(Unit* pWho) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + DoScriptText(SAY_SHADRON_AGGRO,me); + DoZoneInCombat(); + DoCast(me, SPELL_POWER_OF_SHADRON); + } - m_uiShadowFissureTimer = urand(15000,20000); + void KilledUnit(Unit* pVictim) + { + DoScriptText(RAND(SAY_SHADRON_SLAY_1,SAY_SHADRON_SLAY_2), me); } - else - m_uiShadowFissureTimer -= uiDiff; - // Portal Event - if (m_uiAcolyteShadronTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if(m_bHasPortalOpen) - m_uiAcolyteShadronTimer = 10000; + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(uiDiff); + return; + } + + // shadow fissure + if (m_uiShadowFissureTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + + m_uiShadowFissureTimer = urand(15000,20000); + } else + m_uiShadowFissureTimer -= uiDiff; + + // Portal Event + if (m_uiAcolyteShadronTimer <= uiDiff) { - if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - return; + if(m_bHasPortalOpen) + m_uiAcolyteShadronTimer = 10000; + else + { + if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + return; - OpenPortal(); - m_bHasPortalOpen = true; - m_uiAcolyteShadronTimer = urand(60000,65000); + OpenPortal(); + m_bHasPortalOpen = true; + m_uiAcolyteShadronTimer = urand(60000,65000); + } } - } - else - m_uiAcolyteShadronTimer -= uiDiff; + else + m_uiAcolyteShadronTimer -= uiDiff; - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - DoScriptText(SAY_SHADRON_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000,25000); - } - else - m_uiShadowBreathTimer -= uiDiff; + // shadow breath + if (m_uiShadowBreathTimer <= uiDiff) + { + DoScriptText(SAY_SHADRON_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + m_uiShadowBreathTimer = urand(20000,25000); + } + else + m_uiShadowBreathTimer -= uiDiff; - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_shadron(Creature* pCreature) -{ - return new mob_shadronAI(pCreature); -} /*###### ## Mob Vesperon ######*/ - -struct mob_vesperonAI : public dummy_dragonAI +
class mob_vesperon : public CreatureScript { - mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiAcolyteVesperonTimer; +public: + mob_vesperon() : CreatureScript("mob_vesperon") { } - bool m_bHasPortalOpen; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiAcolyteVesperonTimer = 60000; - - m_bHasPortalOpen = false; + return new mob_vesperonAI(pCreature); } - void EnterCombat(Unit* pWho) + struct mob_vesperonAI : public dummy_dragonAI { - DoScriptText(SAY_VESPERON_AGGRO,me); - DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_VESPERON); - } + mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_VESPERON_SLAY_1,SAY_VESPERON_SLAY_2), me); - } + uint32 m_uiShadowBreathTimer; + uint32 m_uiShadowFissureTimer; + uint32 m_uiAcolyteVesperonTimer; - void UpdateAI(const uint32 uiDiff) - { - //if no target, update dummy and return - if (!UpdateVictim()) + bool m_bHasPortalOpen; + + void Reset() { - dummy_dragonAI::UpdateAI(uiDiff); - return; + m_uiShadowBreathTimer = 20000; + m_uiShadowFissureTimer = 5000; + m_uiAcolyteVesperonTimer = 60000; + + m_bHasPortalOpen = false; } - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) + void EnterCombat(Unit* pWho) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + DoScriptText(SAY_VESPERON_AGGRO,me); + DoZoneInCombat(); + DoCast(me, SPELL_POWER_OF_VESPERON); + } - m_uiShadowFissureTimer = urand(15000,20000); + void KilledUnit(Unit* pVictim) + { + DoScriptText(RAND(SAY_VESPERON_SLAY_1,SAY_VESPERON_SLAY_2), me); } - else - m_uiShadowFissureTimer -= uiDiff; - // Portal Event - if (m_uiAcolyteVesperonTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if(m_bHasPortalOpen) - m_uiAcolyteVesperonTimer = 10000; + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(uiDiff); + return; + } + + // shadow fissure + if (m_uiShadowFissureTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + + m_uiShadowFissureTimer = urand(15000,20000); + } else + m_uiShadowFissureTimer -= uiDiff; + + // Portal Event + if (m_uiAcolyteVesperonTimer <= uiDiff) { - OpenPortal(); - DoCast(me->getVictim(), SPELL_TWILIGHT_TORMENT_VESP); - m_uiAcolyteVesperonTimer = urand(60000,70000); + if(m_bHasPortalOpen) + m_uiAcolyteVesperonTimer = 10000; + else + { + OpenPortal(); + DoCast(me->getVictim(), SPELL_TWILIGHT_TORMENT_VESP); + m_uiAcolyteVesperonTimer = urand(60000,70000); + } } - } - else - m_uiAcolyteVesperonTimer -= uiDiff; + else + m_uiAcolyteVesperonTimer -= uiDiff; - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - DoScriptText(SAY_VESPERON_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000,25000); - } - else - m_uiShadowBreathTimer -= uiDiff; + // shadow breath + if (m_uiShadowBreathTimer <= uiDiff) + { + DoScriptText(SAY_VESPERON_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + m_uiShadowBreathTimer = urand(20000,25000); + } + else + m_uiShadowBreathTimer -= uiDiff; - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_vesperon(Creature* pCreature) -{ - return new mob_vesperonAI(pCreature); -} /*###### ## Mob Acolyte of Shadron ######*/ - -struct mob_acolyte_of_shadronAI : public ScriptedAI +
class mob_acolyte_of_shadron : public CreatureScript { - mob_acolyte_of_shadronAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_acolyte_of_shadron() : CreatureScript("mob_acolyte_of_shadron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); - Reset(); + return new mob_acolyte_of_shadronAI(pCreature); } - ScriptedInstance* pInstance; - uint32 uiDespawnTimer; - - void Reset() + struct mob_acolyte_of_shadronAI : public ScriptedAI { - uiDespawnTimer = 28000; - if (pInstance) + mob_acolyte_of_shadronAI(Creature* pCreature) : ScriptedAI(pCreature) { - Creature* pTarget = NULL; - //if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT - if (pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - { - if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SARTHARION)))) - pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, pTarget); - } - else - { - if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SHADRON)))) - pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, pTarget); - } - } - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); - } + pInstance = pCreature->GetInstanceScript(); + Reset(); + } - void JustDied(Unit* killer) - { - if (pInstance) + InstanceScript* pInstance; + uint32 uiDespawnTimer; + + void Reset() { - Creature* Shadron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); - if(Shadron) + uiDespawnTimer = 28000; + if (pInstance) { - (CAST_AI(mob_shadronAI,Shadron->AI()))->m_bHasPortalOpen = false; - } + Creature* pTarget = NULL; + //if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT + if (pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) + { + if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SARTHARION)))) + pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, pTarget); + } + else + { + if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SHADRON)))) + pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, pTarget); + } + } + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + } - Creature* pDebuffTarget = NULL; - Map *map = me->GetMap(); - if (map->IsDungeon()) + void JustDied(Unit* killer) + { + if (pInstance) { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; + Creature* Shadron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); + if(Shadron) + { + (CAST_AI(mob_shadron::mob_shadronAI,Shadron->AI()))->m_bHasPortalOpen = false; + } - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Creature* pDebuffTarget = NULL; + Map *map = me->GetMap(); + if (map->IsDungeon()) { - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); - } - } - } + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) + { + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + } + } + } - //not solo fight, so main boss has deduff - pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SARTHARION)); - if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) - pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); + //not solo fight, so main boss has deduff + pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SARTHARION)); + if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) + pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); - //event not in progress, then solo fight and must remove debuff mini-boss - pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); - if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + //event not in progress, then solo fight and must remove debuff mini-boss + pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); + if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + } } - } - void UpdateAI(const uint32 uiDiff) - { - if(uiDespawnTimer < uiDiff) + void UpdateAI(const uint32 uiDiff) { - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); - uiDespawnTimer = 28000; - return; - }else uiDespawnTimer -= uiDiff; + if(uiDespawnTimer < uiDiff) + { + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + uiDespawnTimer = 28000; + return; + }else uiDespawnTimer -= uiDiff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_acolyte_of_shadron(Creature* pCreature) -{ - return new mob_acolyte_of_shadronAI(pCreature); -} /*###### ## Mob Acolyte of Vesperon ######*/ - -struct mob_acolyte_of_vesperonAI : public ScriptedAI +
class mob_acolyte_of_vesperon : public CreatureScript { - mob_acolyte_of_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_acolyte_of_vesperon() : CreatureScript("mob_acolyte_of_vesperon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_acolyte_of_vesperonAI(pCreature); } - ScriptedInstance* pInstance; - uint32 uiDespawnTimer; - - void Reset() + struct mob_acolyte_of_vesperonAI : public ScriptedAI { - uiDespawnTimer = 28000; - if (pInstance) + mob_acolyte_of_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature) { - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + pInstance = pCreature->GetInstanceScript(); } - DoCast(me, SPELL_TWILIGHT_TORMENT_VESP_ACO); - } - void JustDied(Unit* pKiller) - { - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); + InstanceScript* pInstance; + uint32 uiDespawnTimer; - // remove twilight torment on Vesperon - if (pInstance) + void Reset() { - Creature* pVesperon = pInstance->instance->GetCreature(pInstance->GetData64(DATA_VESPERON)); - if (pVesperon) - (CAST_AI(mob_vesperonAI,pVesperon->AI()))->m_bHasPortalOpen = false; - - if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) - pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - - Map *map = me->GetMap(); - if (map->IsDungeon()) + uiDespawnTimer = 28000; + if (pInstance) { - Map::PlayerList const &PlayerList = map->GetPlayers(); + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + } + DoCast(me, SPELL_TWILIGHT_TORMENT_VESP_ACO); + } + + void JustDied(Unit* pKiller) + { + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); - if (PlayerList.isEmpty()) - return; + // remove twilight torment on Vesperon + if (pInstance) + { + Creature* pVesperon = pInstance->instance->GetCreature(pInstance->GetData64(DATA_VESPERON)); + if (pVesperon) + (CAST_AI(mob_vesperon::mob_vesperonAI,pVesperon->AI()))->m_bHasPortalOpen = false; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) + pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + + Map *map = me->GetMap(); + if (map->IsDungeon()) { - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) + { + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + } + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP,0) && !i->getSource()->getVictim()) + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP,0) && !i->getSource()->getVictim()) - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); } - } - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); - pInstance->DoRemoveAurasDueToSpellOnPlayers(57935); - pInstance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); + pInstance->DoRemoveAurasDueToSpellOnPlayers(57935); + pInstance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment + } } - } - void UpdateAI(const uint32 uiDiff) - { - if(uiDespawnTimer < uiDiff) + void UpdateAI(const uint32 uiDiff) { - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); - uiDespawnTimer = 28000; - return; - }else uiDespawnTimer -= uiDiff; + if(uiDespawnTimer < uiDiff) + { + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + uiDespawnTimer = 28000; + return; + }else uiDespawnTimer -= uiDiff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_acolyte_of_vesperon(Creature* pCreature) -{ - return new mob_acolyte_of_vesperonAI(pCreature); -} /*###### ## Mob Twilight Eggs ######*/ - -struct mob_twilight_eggsAI : public Scripted_NoMovementAI +
class mob_twilight_eggs : public CreatureScript { - mob_twilight_eggsAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); +public: + mob_twilight_eggs() : CreatureScript("mob_twilight_eggs") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_twilight_eggsAI(pCreature); } - uint32 m_uiFadeArmorTimer; - uint32 m_uiHatchEggTimer; + struct mob_twilight_eggsAI : public Scripted_NoMovementAI + { + mob_twilight_eggsAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - ScriptedInstance* pInstance; + uint32 m_uiFadeArmorTimer; + uint32 m_uiHatchEggTimer; - void Reset() - { - if(pInstance) + InstanceScript* pInstance; + + void Reset() { - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + if(pInstance) + { + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + } + m_uiFadeArmorTimer = 1000; + m_uiHatchEggTimer = 20000; } - m_uiFadeArmorTimer = 1000; - m_uiHatchEggTimer = 20000; - } - void SpawnWhelps() - { - me->RemoveAllAuras(); + void SpawnWhelps() + { + me->RemoveAllAuras(); - if (!pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - me->SummonCreature(NPC_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - else - me->SummonCreature(NPC_SHARTHARION_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->DealDamage(me, me->GetHealth()); - } + if (!pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) + me->SummonCreature(NPC_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + else + me->SummonCreature(NPC_SHARTHARION_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->DealDamage(me, me->GetHealth()); + } - void JustSummoned(Creature* pWho) - { - pWho->SetInCombatWithZone(); - } + void JustSummoned(Creature* pWho) + { + pWho->SetInCombatWithZone(); + } - void UpdateAI(const uint32 uiDiff) - { - if (m_uiHatchEggTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - Creature* Tenebron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TENEBRON)); - if(Tenebron) - (CAST_AI(mob_tenebronAI,Tenebron->AI()))->m_bHasPortalOpen = false; - SpawnWhelps(); + if (m_uiHatchEggTimer <= uiDiff) + { + Creature* Tenebron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TENEBRON)); + if(Tenebron) + (CAST_AI(mob_tenebron::mob_tenebronAI,Tenebron->AI()))->m_bHasPortalOpen = false; + SpawnWhelps(); + } + else + m_uiHatchEggTimer -= uiDiff; } - else - m_uiHatchEggTimer -= uiDiff; - } - void AttackStart(Unit* pWho) {} - void MoveInLineOfSight(Unit* pWho) {} + void AttackStart(Unit* pWho) {} + void MoveInLineOfSight(Unit* pWho) {} + }; + }; -CreatureAI* GetAI_mob_twilight_eggs(Creature* pCreature) -{ - return new mob_twilight_eggsAI(pCreature); -} /*###### ## Mob Flame Tsunami -######*/ -struct npc_flame_tsunamiAI : public ScriptedAI +######*/
class npc_flame_tsunami : public CreatureScript { - npc_flame_tsunamiAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->SetDisplayId(11686); - me->AddAura(SPELL_FLAME_TSUNAMI, me); - } +public: + npc_flame_tsunami() : CreatureScript("npc_flame_tsunami") { } - uint32 Tsunami_Timer; - uint32 TsunamiBuff_timer; - uint32 entry; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Tsunami_Timer = 100; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - TsunamiBuff_timer = 1000; - entry = 0; + return new npc_flame_tsunamiAI(pCreature); } - - void UpdateAI(const uint32 diff) + + struct npc_flame_tsunamiAI : public ScriptedAI { - if (Tsunami_Timer <= diff) + npc_flame_tsunamiAI(Creature* pCreature) : ScriptedAI(pCreature) { - DoCast(me,SPELL_FLAME_TSUNAMI_DMG_AURA); - Tsunami_Timer = 500; - }else Tsunami_Timer -= diff; - - if(TsunamiBuff_timer <= diff) + me->SetDisplayId(11686); + me->AddAura(SPELL_FLAME_TSUNAMI, me); + } + + uint32 Tsunami_Timer; + uint32 TsunamiBuff_timer; + uint32 entry; + + void Reset() { - if (Unit* LavaBlaze = GetClosestCreatureWithEntry(me,NPC_LAVA_BLAZE, 10.0f, true)) - LavaBlaze->CastSpell(LavaBlaze, SPELL_FLAME_TSUNAMI_BUFF, true); + Tsunami_Timer = 100; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); TsunamiBuff_timer = 1000; - }else TsunamiBuff_timer -= diff; - } + entry = 0; + } + + void UpdateAI(const uint32 diff) + { + if (Tsunami_Timer <= diff) + { + DoCast(me,SPELL_FLAME_TSUNAMI_DMG_AURA); + Tsunami_Timer = 500; + }else Tsunami_Timer -= diff; + + if(TsunamiBuff_timer <= diff) + { + if (Unit* LavaBlaze = GetClosestCreatureWithEntry(me,NPC_LAVA_BLAZE, 10.0f, true)) + LavaBlaze->CastSpell(LavaBlaze, SPELL_FLAME_TSUNAMI_BUFF, true); + TsunamiBuff_timer = 1000; + }else TsunamiBuff_timer -= diff; + } + }; + }; -// Twilight Fissure -struct npc_twilight_fissureAI : public Scripted_NoMovementAI +// Twilight Fissure
class npc_twilight_fissure : public CreatureScript { - npc_twilight_fissureAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - Reset(); - } - - uint32 VoidBlast_Timer; +public: + npc_twilight_fissure() : CreatureScript("npc_twilight_fissure") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura( 46265 , me ); // Wrong, can't find proper visual - me->AddAura( 69422 , me ); - VoidBlast_Timer = 5000; + return new npc_twilight_fissureAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_twilight_fissureAI : public Scripted_NoMovementAI { - if (VoidBlast_Timer <= diff) + npc_twilight_fissureAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) { - DoCastAOE(RAID_MODE(SPELL_VOID_BLAST, SPELL_VOID_BLAST_H)); - ////twilight realm - //DoCast(me->getVictim(), 57620, true); - //DoCast(me->getVictim(), 57874, true); - VoidBlast_Timer = 9000; - me->RemoveAllAuras(); - me->Kill(me); - } else VoidBlast_Timer -= diff; - } + Reset(); + } + + uint32 VoidBlast_Timer; + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura( 46265 , me ); // Wrong, can't find proper visual + me->AddAura( 69422 , me ); + VoidBlast_Timer = 5000; + } + + void UpdateAI(const uint32 diff) + { + if (VoidBlast_Timer <= diff) + { + DoCastAOE(RAID_MODE(SPELL_VOID_BLAST, SPELL_VOID_BLAST_H)); + ////twilight realm + //DoCast(me->getVictim(), 57620, true); + //DoCast(me->getVictim(), 57874, true); + VoidBlast_Timer = 9000; + me->RemoveAllAuras(); + me->Kill(me); + } else VoidBlast_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_npc_flame_tsunami(Creature* pCreature) -{ - return new npc_flame_tsunamiAI(pCreature); -} -CreatureAI* GetAI_npc_twilight_fissure(Creature* pCreature) -{ - return new npc_twilight_fissureAI(pCreature); -} /*###### ## Mob Twilight Whelps ######*/ - -struct mob_twilight_whelpAI : public ScriptedAI +
class mob_twilight_whelp : public CreatureScript { - mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) - { - Reset(); - } +public: + mob_twilight_whelp() : CreatureScript("mob_twilight_whelp") { } - uint32 m_uiFadeArmorTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->RemoveAllAuras(); - me->SetInCombatWithZone(); - m_uiFadeArmorTimer = 1000; + return new mob_twilight_whelpAI(pCreature); } - void UpdateAI(const uint32 uiDiff) + struct mob_twilight_whelpAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) + { + Reset(); + } + + uint32 m_uiFadeArmorTimer; - // twilight torment - if (m_uiFadeArmorTimer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_FADE_ARMOR); - m_uiFadeArmorTimer = urand(5000,10000); + me->RemoveAllAuras(); + me->SetInCombatWithZone(); + m_uiFadeArmorTimer = 1000; } - else - m_uiFadeArmorTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + // twilight torment + if (m_uiFadeArmorTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_FADE_ARMOR); + m_uiFadeArmorTimer = urand(5000,10000); + } + else + m_uiFadeArmorTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_twilight_whelp(Creature* pCreature) -{ - return new mob_twilight_whelpAI(pCreature); -} void AddSC_boss_sartharion() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sartharion"; - newscript->GetAI = &GetAI_boss_sartharion; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_vesperon"; - newscript->GetAI = &GetAI_mob_vesperon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadron"; - newscript->GetAI = &GetAI_mob_shadron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tenebron"; - newscript->GetAI = &GetAI_mob_tenebron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_acolyte_of_shadron"; - newscript->GetAI = &GetAI_mob_acolyte_of_shadron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_acolyte_of_vesperon"; - newscript->GetAI = &GetAI_mob_acolyte_of_vesperon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_twilight_eggs"; - newscript->GetAI = &GetAI_mob_twilight_eggs; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_flame_tsunami"; - newscript->GetAI = &GetAI_npc_flame_tsunami; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_twilight_fissure"; - newscript->GetAI = &GetAI_npc_twilight_fissure; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_twilight_whelp"; - newscript->GetAI = &GetAI_mob_twilight_whelp; - newscript->RegisterSelf(); + new boss_sartharion(); + new mob_vesperon(); + new mob_shadron(); + new mob_tenebron(); + new mob_acolyte_of_shadron(); + new mob_acolyte_of_vesperon(); + new mob_twilight_eggs(); + new npc_flame_tsunami(); + new npc_twilight_fissure(); + new mob_twilight_whelp(); } diff --git a/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp index 4cb38db3a28..520d7c89a8a 100644 --- a/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -23,112 +23,115 @@ /* Obsidian Sanctum encounters: 0 - Sartharion */ - -struct instance_obsidian_sanctum : public ScriptedInstance +
class instance_obsidian_sanctum : public InstanceMapScript { - instance_obsidian_sanctum(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 m_uiSartharionGUID; - uint64 m_uiTenebronGUID; - uint64 m_uiShadronGUID; - uint64 m_uiVesperonGUID; +public: + instance_obsidian_sanctum() : InstanceMapScript("instance_obsidian_sanctum") { } - bool m_bTenebronKilled; - bool m_bShadronKilled; - bool m_bVesperonKilled; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_obsidian_sanctum_InstanceMapScript(pMap); + } - void Initialize() + struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + instance_obsidian_sanctum_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - m_uiSartharionGUID = 0; - m_uiTenebronGUID = 0; - m_uiShadronGUID = 0; - m_uiVesperonGUID = 0; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 m_uiSartharionGUID; + uint64 m_uiTenebronGUID; + uint64 m_uiShadronGUID; + uint64 m_uiVesperonGUID; - m_bTenebronKilled = false; - m_bShadronKilled = false; - m_bVesperonKilled = false; - } + bool m_bTenebronKilled; + bool m_bShadronKilled; + bool m_bVesperonKilled; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void Initialize() { - case NPC_SARTHARION: - m_uiSartharionGUID = pCreature->GetGUID(); - break; - //three dragons below set to active state once created. - //we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences - case NPC_TENEBRON: - m_uiTenebronGUID = pCreature->GetGUID(); - pCreature->setActive(true); - break; - case NPC_SHADRON: - m_uiShadronGUID = pCreature->GetGUID(); - pCreature->setActive(true); - break; - case NPC_VESPERON: - m_uiVesperonGUID = pCreature->GetGUID(); - pCreature->setActive(true); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiSartharionGUID = 0; + m_uiTenebronGUID = 0; + m_uiShadronGUID = 0; + m_uiVesperonGUID = 0; + + m_bTenebronKilled = false; + m_bShadronKilled = false; + m_bVesperonKilled = false; } - } - void SetData(uint32 uiType, uint32 uiData) - { - if (uiType == TYPE_SARTHARION_EVENT) - m_auiEncounter[0] = uiData; - else if(uiType == TYPE_TENEBRON_PREKILLED) - m_bTenebronKilled = true; - else if(uiType == TYPE_SHADRON_PREKILLED) - m_bShadronKilled = true; - else if(uiType == TYPE_VESPERON_PREKILLED) - m_bVesperonKilled = true; - } + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case NPC_SARTHARION: + m_uiSartharionGUID = pCreature->GetGUID(); + break; + //three dragons below set to active state once created. + //we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences + case NPC_TENEBRON: + m_uiTenebronGUID = pCreature->GetGUID(); + pCreature->setActive(true); + break; + case NPC_SHADRON: + m_uiShadronGUID = pCreature->GetGUID(); + pCreature->setActive(true); + break; + case NPC_VESPERON: + m_uiVesperonGUID = pCreature->GetGUID(); + pCreature->setActive(true); + break; + } + } - uint32 GetData(uint32 uiType) - { - if (uiType == TYPE_SARTHARION_EVENT) - return m_auiEncounter[0]; - else if(uiType == TYPE_TENEBRON_PREKILLED) - return m_bTenebronKilled; - else if(uiType == TYPE_SHADRON_PREKILLED) - return m_bShadronKilled; - else if(uiType == TYPE_VESPERON_PREKILLED) - return m_bVesperonKilled; - - return 0; - } + void SetData(uint32 uiType, uint32 uiData) + { + if (uiType == TYPE_SARTHARION_EVENT) + m_auiEncounter[0] = uiData; + else if(uiType == TYPE_TENEBRON_PREKILLED) + m_bTenebronKilled = true; + else if(uiType == TYPE_SHADRON_PREKILLED) + m_bShadronKilled = true; + else if(uiType == TYPE_VESPERON_PREKILLED) + m_bVesperonKilled = true; + } - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint32 GetData(uint32 uiType) { - case DATA_SARTHARION: - return m_uiSartharionGUID; - case DATA_TENEBRON: - return m_uiTenebronGUID; - case DATA_SHADRON: - return m_uiShadronGUID; - case DATA_VESPERON: - return m_uiVesperonGUID; + if (uiType == TYPE_SARTHARION_EVENT) + return m_auiEncounter[0]; + else if(uiType == TYPE_TENEBRON_PREKILLED) + return m_bTenebronKilled; + else if(uiType == TYPE_SHADRON_PREKILLED) + return m_bShadronKilled; + else if(uiType == TYPE_VESPERON_PREKILLED) + return m_bVesperonKilled; + + return 0; } - return 0; - } + + uint64 GetData64(uint32 uiData) + { + switch(uiData) + { + case DATA_SARTHARION: + return m_uiSartharionGUID; + case DATA_TENEBRON: + return m_uiTenebronGUID; + case DATA_SHADRON: + return m_uiShadronGUID; + case DATA_VESPERON: + return m_uiVesperonGUID; + } + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_obsidian_sanctum(Map* pMap) -{ - return new instance_obsidian_sanctum(pMap); -} void AddSC_instance_obsidian_sanctum() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_obsidian_sanctum"; - newscript->GetInstanceData = &GetInstanceData_instance_obsidian_sanctum; - newscript->RegisterSelf(); + new instance_obsidian_sanctum(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index aa0be07d7bd..c376104ccf7 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -80,355 +80,360 @@ enum eEnums /*###### ## boss_bjarngrim ######*/ - -struct boss_bjarngrimAI : public ScriptedAI +
class boss_bjarngrim : public CreatureScript { - boss_bjarngrimAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + boss_bjarngrim() : CreatureScript("boss_bjarngrim") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - m_uiStance = STANCE_DEFENSIVE; - memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); + return new boss_bjarngrimAI(pCreature); } - ScriptedInstance* m_pInstance; + struct boss_bjarngrimAI : public ScriptedAI + { + boss_bjarngrimAI(Creature *pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + m_uiStance = STANCE_DEFENSIVE; + memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); + } - bool m_bIsChangingStance; + InstanceScript* m_pInstance; - uint8 m_uiChargingStatus; - uint8 m_uiStance; + bool m_bIsChangingStance; - uint32 m_uiCharge_Timer; - uint32 m_uiChangeStance_Timer; + uint8 m_uiChargingStatus; + uint8 m_uiStance; - uint32 m_uiReflection_Timer; - uint32 m_uiKnockAway_Timer; - uint32 m_uiPummel_Timer; - uint32 m_uiIronform_Timer; + uint32 m_uiCharge_Timer; + uint32 m_uiChangeStance_Timer; - uint32 m_uiIntercept_Timer; - uint32 m_uiWhirlwind_Timer; - uint32 m_uiCleave_Timer; + uint32 m_uiReflection_Timer; + uint32 m_uiKnockAway_Timer; + uint32 m_uiPummel_Timer; + uint32 m_uiIronform_Timer; - uint32 m_uiMortalStrike_Timer; - uint32 m_uiSlam_Timer; + uint32 m_uiIntercept_Timer; + uint32 m_uiWhirlwind_Timer; + uint32 m_uiCleave_Timer; - uint64 m_auiStormforgedLieutenantGUID[2]; + uint32 m_uiMortalStrike_Timer; + uint32 m_uiSlam_Timer; - void Reset() - { - m_bIsChangingStance = false; + uint64 m_auiStormforgedLieutenantGUID[2]; - m_uiChargingStatus = 0; - m_uiCharge_Timer = 1000; + void Reset() + { + m_bIsChangingStance = false; + + m_uiChargingStatus = 0; + m_uiCharge_Timer = 1000; - m_uiChangeStance_Timer = 20000 + rand()%5000; + m_uiChangeStance_Timer = 20000 + rand()%5000; - m_uiReflection_Timer = 8000; - m_uiKnockAway_Timer = 20000; - m_uiPummel_Timer = 10000; - m_uiIronform_Timer = 25000; + m_uiReflection_Timer = 8000; + m_uiKnockAway_Timer = 20000; + m_uiPummel_Timer = 10000; + m_uiIronform_Timer = 25000; - m_uiIntercept_Timer = 5000; - m_uiWhirlwind_Timer = 10000; - m_uiCleave_Timer = 8000; + m_uiIntercept_Timer = 5000; + m_uiWhirlwind_Timer = 10000; + m_uiCleave_Timer = 8000; - m_uiMortalStrike_Timer = 8000; - m_uiSlam_Timer = 10000; + m_uiMortalStrike_Timer = 8000; + m_uiSlam_Timer = 10000; - for (uint8 i = 0; i < 2; ++i) - { - if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i]))) + for (uint8 i = 0; i < 2; ++i) { - if (!pStormforgedLieutenant->isAlive()) - pStormforgedLieutenant->Respawn(); + if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i]))) + { + if (!pStormforgedLieutenant->isAlive()) + pStormforgedLieutenant->Respawn(); + } } - } - if (m_uiStance != STANCE_DEFENSIVE) - { - DoRemoveStanceAura(m_uiStance); - DoCast(me, SPELL_DEFENSIVE_STANCE); - m_uiStance = STANCE_DEFENSIVE; - } - - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); + if (m_uiStance != STANCE_DEFENSIVE) + { + DoRemoveStanceAura(m_uiStance); + DoCast(me, SPELL_DEFENSIVE_STANCE); + m_uiStance = STANCE_DEFENSIVE; + } - //must get both lieutenants here and make sure they are with him - me->CallForHelp(30.0f); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); + } - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); + //must get both lieutenants here and make sure they are with him + me->CallForHelp(30.0f); - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, DONE); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); + } - //TODO: remove when removal is done by the core - void DoRemoveStanceAura(uint8 uiStance) - { - switch(uiStance) + void KilledUnit(Unit* /*pVictim*/) { - case STANCE_DEFENSIVE: - me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE); - break; - case STANCE_BERSERKER: - me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE); - break; - case STANCE_BATTLE: - me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE); - break; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - // Change stance - if (m_uiChangeStance_Timer <= uiDiff) + void JustDied(Unit* /*pKiller*/) { - //wait for current spell to finish before change stance - if (me->IsNonMeleeSpellCasted(false)) - return; - - DoRemoveStanceAura(m_uiStance); - - int uiTempStance = rand()%(3-1); - - if (uiTempStance >= m_uiStance) - ++uiTempStance; + DoScriptText(SAY_DEATH, me); - m_uiStance = uiTempStance; + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, DONE); + } - switch(m_uiStance) + //TODO: remove when removal is done by the core + void DoRemoveStanceAura(uint8 uiStance) + { + switch(uiStance) { case STANCE_DEFENSIVE: - DoScriptText(SAY_DEFENSIVE_STANCE, me); - DoScriptText(EMOTE_DEFENSIVE_STANCE, me); - DoCast(me, SPELL_DEFENSIVE_STANCE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE); break; case STANCE_BERSERKER: - DoScriptText(SAY_BERSEKER_STANCE, me); - DoScriptText(EMOTE_BERSEKER_STANCE, me); - DoCast(me, SPELL_BERSEKER_STANCE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE); break; case STANCE_BATTLE: - DoScriptText(SAY_BATTLE_STANCE, me); - DoScriptText(EMOTE_BATTLE_STANCE, me); - DoCast(me, SPELL_BATTLE_STANCE); - SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE); break; } - - m_uiChangeStance_Timer = 20000 + rand()%5000; - return; } - else - m_uiChangeStance_Timer -= uiDiff; - switch(m_uiStance) + void UpdateAI(const uint32 uiDiff) { - case STANCE_DEFENSIVE: + //Return since we have no target + if (!UpdateVictim()) + return; + + // Change stance + if (m_uiChangeStance_Timer <= uiDiff) { - if (m_uiReflection_Timer <= uiDiff) - { - DoCast(me, SPELL_SPELL_REFLECTION); - m_uiReflection_Timer = 8000 + rand()%1000; - } - else - m_uiReflection_Timer -= uiDiff; + //wait for current spell to finish before change stance + if (me->IsNonMeleeSpellCasted(false)) + return; - if (m_uiKnockAway_Timer <= uiDiff) - { - DoCast(me, SPELL_KNOCK_AWAY); - m_uiKnockAway_Timer = 20000 + rand()%1000; - } - else - m_uiKnockAway_Timer -= uiDiff; + DoRemoveStanceAura(m_uiStance); - if (m_uiPummel_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_PUMMEL); - m_uiPummel_Timer = 10000 + rand()%1000; - } - else - m_uiPummel_Timer -= uiDiff; + int uiTempStance = rand()%(3-1); + + if (uiTempStance >= m_uiStance) + ++uiTempStance; - if (m_uiIronform_Timer <= uiDiff) + m_uiStance = uiTempStance; + + switch(m_uiStance) { - DoCast(me, SPELL_IRONFORM); - m_uiIronform_Timer = 25000 + rand()%1000; + case STANCE_DEFENSIVE: + DoScriptText(SAY_DEFENSIVE_STANCE, me); + DoScriptText(EMOTE_DEFENSIVE_STANCE, me); + DoCast(me, SPELL_DEFENSIVE_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + break; + case STANCE_BERSERKER: + DoScriptText(SAY_BERSEKER_STANCE, me); + DoScriptText(EMOTE_BERSEKER_STANCE, me); + DoCast(me, SPELL_BERSEKER_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + break; + case STANCE_BATTLE: + DoScriptText(SAY_BATTLE_STANCE, me); + DoScriptText(EMOTE_BATTLE_STANCE, me); + DoCast(me, SPELL_BATTLE_STANCE); + SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + break; } - else - m_uiIronform_Timer -= uiDiff; - break; + m_uiChangeStance_Timer = 20000 + rand()%5000; + return; } - case STANCE_BERSERKER: + else + m_uiChangeStance_Timer -= uiDiff; + + switch(m_uiStance) { - if (m_uiIntercept_Timer <= uiDiff) + case STANCE_DEFENSIVE: { - //not much point is this, better random target and more often? - DoCast(me->getVictim(), SPELL_INTERCEPT); - m_uiIntercept_Timer = 45000 + rand()%1000; - } - else - m_uiIntercept_Timer -= uiDiff; + if (m_uiReflection_Timer <= uiDiff) + { + DoCast(me, SPELL_SPELL_REFLECTION); + m_uiReflection_Timer = 8000 + rand()%1000; + } + else + m_uiReflection_Timer -= uiDiff; + + if (m_uiKnockAway_Timer <= uiDiff) + { + DoCast(me, SPELL_KNOCK_AWAY); + m_uiKnockAway_Timer = 20000 + rand()%1000; + } + else + m_uiKnockAway_Timer -= uiDiff; + + if (m_uiPummel_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_PUMMEL); + m_uiPummel_Timer = 10000 + rand()%1000; + } + else + m_uiPummel_Timer -= uiDiff; + + if (m_uiIronform_Timer <= uiDiff) + { + DoCast(me, SPELL_IRONFORM); + m_uiIronform_Timer = 25000 + rand()%1000; + } + else + m_uiIronform_Timer -= uiDiff; - if (m_uiWhirlwind_Timer <= uiDiff) - { - DoCast(me, SPELL_WHIRLWIND); - m_uiWhirlwind_Timer = 10000 + rand()%1000; + break; } - else - m_uiWhirlwind_Timer -= uiDiff; - - if (m_uiCleave_Timer <= uiDiff) + case STANCE_BERSERKER: { - DoCast(me->getVictim(), SPELL_CLEAVE); - m_uiCleave_Timer = 8000 + rand()%1000; - } - else - m_uiCleave_Timer -= uiDiff; + if (m_uiIntercept_Timer <= uiDiff) + { + //not much point is this, better random target and more often? + DoCast(me->getVictim(), SPELL_INTERCEPT); + m_uiIntercept_Timer = 45000 + rand()%1000; + } + else + m_uiIntercept_Timer -= uiDiff; + + if (m_uiWhirlwind_Timer <= uiDiff) + { + DoCast(me, SPELL_WHIRLWIND); + m_uiWhirlwind_Timer = 10000 + rand()%1000; + } + else + m_uiWhirlwind_Timer -= uiDiff; + + if (m_uiCleave_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + m_uiCleave_Timer = 8000 + rand()%1000; + } + else + m_uiCleave_Timer -= uiDiff; - break; - } - case STANCE_BATTLE: - { - if (m_uiMortalStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - m_uiMortalStrike_Timer = 20000 + rand()%1000; + break; } - else - m_uiMortalStrike_Timer -= uiDiff; - - if (m_uiSlam_Timer <= uiDiff) + case STANCE_BATTLE: { - DoCast(me->getVictim(), SPELL_SLAM); - m_uiSlam_Timer = 15000 + rand()%1000; - } - else - m_uiSlam_Timer -= uiDiff; + if (m_uiMortalStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + m_uiMortalStrike_Timer = 20000 + rand()%1000; + } + else + m_uiMortalStrike_Timer -= uiDiff; + + if (m_uiSlam_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SLAM); + m_uiSlam_Timer = 15000 + rand()%1000; + } + else + m_uiSlam_Timer -= uiDiff; - break; + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; /*###### ## mob_stormforged_lieutenant ######*/ - -struct mob_stormforged_lieutenantAI : public ScriptedAI +
class mob_stormforged_lieutenant : public CreatureScript { - mob_stormforged_lieutenantAI(Creature *pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } +public: + mob_stormforged_lieutenant() : CreatureScript("mob_stormforged_lieutenant") { } - ScriptedInstance* m_pInstance; - - uint32 m_uiArcWeld_Timer; - uint32 m_uiRenewSteel_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiArcWeld_Timer = 20000 + rand()%1000; - m_uiRenewSteel_Timer = 10000 + rand()%1000; + return new mob_stormforged_lieutenantAI(pCreature); } - void EnterCombat(Unit* pWho) + struct mob_stormforged_lieutenantAI : public ScriptedAI { - if (m_pInstance) + mob_stormforged_lieutenantAI(Creature *pCreature) : ScriptedAI(pCreature) { - if (Creature* pBjarngrim = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_BJARNGRIM))) - { - if (pBjarngrim->isAlive() && !pBjarngrim->getVictim()) - pBjarngrim->AI()->AttackStart(pWho); - } + m_pInstance = pCreature->GetInstanceScript(); } - } - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* m_pInstance; + + uint32 m_uiArcWeld_Timer; + uint32 m_uiRenewSteel_Timer; - if (m_uiArcWeld_Timer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_ARC_WELD); m_uiArcWeld_Timer = 20000 + rand()%1000; + m_uiRenewSteel_Timer = 10000 + rand()%1000; } - else - m_uiArcWeld_Timer -= uiDiff; - if (m_uiRenewSteel_Timer <= uiDiff) + void EnterCombat(Unit* pWho) { if (m_pInstance) { if (Creature* pBjarngrim = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_BJARNGRIM))) { - if (pBjarngrim->isAlive()) - DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); + if (pBjarngrim->isAlive() && !pBjarngrim->getVictim()) + pBjarngrim->AI()->AttackStart(pWho); } } - m_uiRenewSteel_Timer = 10000 + rand()%4000; } - else - m_uiRenewSteel_Timer -= uiDiff; - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_uiArcWeld_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_ARC_WELD); + m_uiArcWeld_Timer = 20000 + rand()%1000; + } + else + m_uiArcWeld_Timer -= uiDiff; + + if (m_uiRenewSteel_Timer <= uiDiff) + { + if (m_pInstance) + { + if (Creature* pBjarngrim = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_BJARNGRIM))) + { + if (pBjarngrim->isAlive()) + DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); + } + } + m_uiRenewSteel_Timer = 10000 + rand()%4000; + } + else + m_uiRenewSteel_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_bjarngrim(Creature* pCreature) -{ - return new boss_bjarngrimAI(pCreature); -} -CreatureAI* GetAI_mob_stormforged_lieutenant(Creature* pCreature) -{ - return new mob_stormforged_lieutenantAI(pCreature); -} void AddSC_boss_bjarngrim() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_bjarngrim"; - newscript->GetAI = &GetAI_boss_bjarngrim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_stormforged_lieutenant"; - newscript->GetAI = &GetAI_mob_stormforged_lieutenant; - newscript->RegisterSelf(); + new boss_bjarngrim(); + new mob_stormforged_lieutenant(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index 88c240b49bd..e8eb2b20a31 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -65,325 +65,330 @@ enum Misc /*###### ## Boss Ionar ######*/ - -struct boss_ionarAI : public ScriptedAI +
class boss_ionar : public CreatureScript { - boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature), lSparkList(pCreature) +public: + boss_ionar() : CreatureScript("boss_ionar") { } + + bool EffectDummyCreature(Unit* /*pCaster*/, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { - pInstance = pCreature->GetInstanceData(); + //always check spellid and effectindex + if (uiSpellId == SPELL_DISPERSE && uiEffIndex == 0) + { + if (pCreatureTarget->GetEntry() != NPC_IONAR) + return true; + + for (uint8 i = 0; i < DATA_MAX_SPARKS; ++i) + pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true); + + pCreatureTarget->AttackStop(); + pCreatureTarget->SetVisibility(VISIBILITY_OFF); + pCreatureTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + + pCreatureTarget->GetMotionMaster()->Clear(); + pCreatureTarget->GetMotionMaster()->MoveIdle(); + + //always return true when we are handling this spell and effect + return true; + } + return false; } - ScriptedInstance* pInstance; + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_ionarAI(pCreature); + } - SummonList lSparkList; + struct boss_ionarAI : public ScriptedAI + { + boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature), lSparkList(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - bool bIsSplitPhase; - bool bHasDispersed; + InstanceScript* pInstance; - uint32 uiSplitTimer; + SummonList lSparkList; - uint32 uiStaticOverloadTimer; - uint32 uiBallLightningTimer; + bool bIsSplitPhase; + bool bHasDispersed; - uint32 uiDisperseHealth; + uint32 uiSplitTimer; - void Reset() - { - lSparkList.DespawnAll(); + uint32 uiStaticOverloadTimer; + uint32 uiBallLightningTimer; - bIsSplitPhase = true; - bHasDispersed = false; + uint32 uiDisperseHealth; - uiSplitTimer = 25*IN_MILLISECONDS; + void Reset() + { + lSparkList.DespawnAll(); - uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); - uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); + bIsSplitPhase = true; + bHasDispersed = false; - uiDisperseHealth = 45 + urand(0,10); + uiSplitTimer = 25*IN_MILLISECONDS; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); + uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); - if (me->GetVisibility() == VISIBILITY_OFF) - me->SetVisibility(VISIBILITY_ON); + uiDisperseHealth = 45 + urand(0,10); - if (pInstance) - pInstance->SetData(TYPE_IONAR, NOT_STARTED); - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + if (me->GetVisibility() == VISIBILITY_OFF) + me->SetVisibility(VISIBILITY_ON); - if (pInstance) - pInstance->SetData(TYPE_IONAR, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(TYPE_IONAR, NOT_STARTED); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - lSparkList.DespawnAll(); + if (pInstance) + pInstance->SetData(TYPE_IONAR, IN_PROGRESS); + } - if (pInstance) - pInstance->SetData(TYPE_IONAR, DONE); - } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + lSparkList.DespawnAll(); - //make sparks come back - void CallBackSparks() - { - //should never be empty here, but check - if (lSparkList.empty()) - return; + if (pInstance) + pInstance->SetData(TYPE_IONAR, DONE); + } - Position pos; - me->GetPosition(&pos); + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } - for (std::list<uint64>::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr) + //make sparks come back + void CallBackSparks() { - if (Creature* pSpark = Unit::GetCreature(*me, *itr)) + //should never be empty here, but check + if (lSparkList.empty()) + return; + + Position pos; + me->GetPosition(&pos); + + for (std::list<uint64>::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr) { - if (pSpark->isAlive()) + if (Creature* pSpark = Unit::GetCreature(*me, *itr)) { - pSpark->SetSpeed(MOVE_RUN, 2.0f); - pSpark->GetMotionMaster()->Clear(); - pSpark->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); + if (pSpark->isAlive()) + { + pSpark->SetSpeed(MOVE_RUN, 2.0f); + pSpark->GetMotionMaster()->Clear(); + pSpark->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); + } + else + pSpark->ForcedDespawn(); } - else - pSpark->ForcedDespawn(); } } - } - void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) - { - if (me->GetVisibility() == VISIBILITY_OFF) - uiDamage = 0; - } + void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + { + if (me->GetVisibility() == VISIBILITY_OFF) + uiDamage = 0; + } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) + void JustSummoned(Creature* pSummoned) { - lSparkList.Summon(pSummoned); + if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) + { + lSparkList.Summon(pSummoned); - pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER,H_SPELL_SPARK_VISUAL_TRIGGER), true); + pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER,H_SPELL_SPARK_VISUAL_TRIGGER), true); - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - { - pSummoned->SetInCombatWith(pTarget); - pSummoned->GetMotionMaster()->Clear(); - pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0.0f, 0.0f); + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + pSummoned->SetInCombatWith(pTarget); + pSummoned->GetMotionMaster()->Clear(); + pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0.0f, 0.0f); + } } } - } - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) - lSparkList.Despawn(pSummoned); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) + lSparkList.Despawn(pSummoned); + } - // Splitted - if (me->GetVisibility() == VISIBILITY_OFF) + void UpdateAI(const uint32 uiDiff) { - if (uiSplitTimer <= uiDiff) - { - uiSplitTimer = 2.5*IN_MILLISECONDS; + //Return since we have no target + if (!UpdateVictim()) + return; - // Return sparks to where Ionar splitted - if (bIsSplitPhase) - { - CallBackSparks(); - bIsSplitPhase = false; - } - // Lightning effect and restore Ionar - else if (lSparkList.empty()) + // Splitted + if (me->GetVisibility() == VISIBILITY_OFF) + { + if (uiSplitTimer <= uiDiff) { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + uiSplitTimer = 2.5*IN_MILLISECONDS; - DoCast(me, SPELL_SPARK_DESPAWN, false); + // Return sparks to where Ionar splitted + if (bIsSplitPhase) + { + CallBackSparks(); + bIsSplitPhase = false; + } + // Lightning effect and restore Ionar + else if (lSparkList.empty()) + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + + DoCast(me, SPELL_SPARK_DESPAWN, false); - uiSplitTimer = 25*IN_MILLISECONDS; - bIsSplitPhase = true; + uiSplitTimer = 25*IN_MILLISECONDS; + bIsSplitPhase = true; - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } } + else + uiSplitTimer -= uiDiff; + + return; } - else - uiSplitTimer -= uiDiff; - return; - } + if (uiStaticOverloadTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_STATIC_OVERLOAD); - if (uiStaticOverloadTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_STATIC_OVERLOAD); + uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); + } + else + uiStaticOverloadTimer -= uiDiff; - uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); - } - else - uiStaticOverloadTimer -= uiDiff; + if (uiBallLightningTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); + uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); + } + else + uiBallLightningTimer -= uiDiff; - if (uiBallLightningTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); - uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); - } - else - uiBallLightningTimer -= uiDiff; + // Health check + if (!bHasDispersed && HealthBelowPct(uiDisperseHealth)) + { + bHasDispersed = true; - // Health check - if (!bHasDispersed && HealthBelowPct(uiDisperseHealth)) - { - bHasDispersed = true; + DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_DISPERSE, true); + } - DoCast(me, SPELL_DISPERSE, true); + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ionar(Creature* pCreature) -{ - return new boss_ionarAI(pCreature); -} - -bool EffectDummyCreature_boss_ionar(Unit* /*pCaster*/, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) -{ - //always check spellid and effectindex - if (uiSpellId == SPELL_DISPERSE && uiEffIndex == 0) - { - if (pCreatureTarget->GetEntry() != NPC_IONAR) - return true; - - for (uint8 i = 0; i < DATA_MAX_SPARKS; ++i) - pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true); - - pCreatureTarget->AttackStop(); - pCreatureTarget->SetVisibility(VISIBILITY_OFF); - pCreatureTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); - - pCreatureTarget->GetMotionMaster()->Clear(); - pCreatureTarget->GetMotionMaster()->MoveIdle(); - //always return true when we are handling this spell and effect - return true; - } - return false; -} /*###### ## mob_spark_of_ionar ######*/ - -struct mob_spark_of_ionarAI : public ScriptedAI +
class mob_spark_of_ionar : public CreatureScript { - mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + mob_spark_of_ionar() : CreatureScript("mob_spark_of_ionar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_spark_of_ionarAI(pCreature); } - ScriptedInstance* pInstance; + struct mob_spark_of_ionarAI : public ScriptedAI + { + mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - uint32 uiCheckTimer; + InstanceScript* pInstance; - void Reset() - { - uiCheckTimer = 2*IN_MILLISECONDS; - me->SetReactState(REACT_PASSIVE); - } + uint32 uiCheckTimer; - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE || !pInstance) - return; + void Reset() + { + uiCheckTimer = 2*IN_MILLISECONDS; + me->SetReactState(REACT_PASSIVE); + } - if (uiPointId == DATA_POINT_CALLBACK) - me->ForcedDespawn(); - } + void MovementInform(uint32 uiType, uint32 uiPointId) + { + if (uiType != POINT_MOTION_TYPE || !pInstance) + return; - void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) - { - uiDamage = 0; - } + if (uiPointId == DATA_POINT_CALLBACK) + me->ForcedDespawn(); + } - void UpdateAI(const uint32 uiDiff) - { - // Despawn if the encounter is not running - if (pInstance && pInstance->GetData(TYPE_IONAR) != IN_PROGRESS) + void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) { - me->ForcedDespawn(); - return; + uiDamage = 0; } - // Prevent them to follow players through the whole instance - if (uiCheckTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (pInstance) + // Despawn if the encounter is not running + if (pInstance && pInstance->GetData(TYPE_IONAR) != IN_PROGRESS) + { + me->ForcedDespawn(); + return; + } + + // Prevent them to follow players through the whole instance + if (uiCheckTimer <= uiDiff) { - Creature* pIonar = pInstance->instance->GetCreature(pInstance->GetData64(DATA_IONAR)); - if (pIonar && pIonar->isAlive()) + if (pInstance) { - if (me->GetDistance(pIonar) > DATA_MAX_SPARK_DISTANCE) + Creature* pIonar = pInstance->instance->GetCreature(pInstance->GetData64(DATA_IONAR)); + if (pIonar && pIonar->isAlive()) { - Position pos; - pIonar->GetPosition(&pos); - - me->SetSpeed(MOVE_RUN, 2.0f); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); + if (me->GetDistance(pIonar) > DATA_MAX_SPARK_DISTANCE) + { + Position pos; + pIonar->GetPosition(&pos); + + me->SetSpeed(MOVE_RUN, 2.0f); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); + } } + else + me->ForcedDespawn(); } - else - me->ForcedDespawn(); + uiCheckTimer = 2*IN_MILLISECONDS; } - uiCheckTimer = 2*IN_MILLISECONDS; + else + uiCheckTimer -= uiDiff; + + // No melee attack at all! } - else - uiCheckTimer -= uiDiff; + }; - // No melee attack at all! - } }; -CreatureAI* GetAI_mob_spark_of_ionar(Creature* pCreature) -{ - return new mob_spark_of_ionarAI(pCreature); -} void AddSC_boss_ionar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ionar"; - newscript->GetAI = &GetAI_boss_ionar; - newscript->pEffectDummyCreature = &EffectDummyCreature_boss_ionar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_spark_of_ionar"; - newscript->GetAI = &GetAI_mob_spark_of_ionar; - newscript->RegisterSelf(); + new boss_ionar(); + new mob_spark_of_ionar(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index e0a55a79ccd..ba6d5bba5f9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -57,168 +57,170 @@ enum eEnums /*###### ## Boss Loken ######*/ - -struct boss_lokenAI : public ScriptedAI +
class boss_loken : public CreatureScript { - boss_lokenAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; +public: + boss_loken() : CreatureScript("boss_loken") { } - bool m_bIsAura; - - uint32 m_uiArcLightning_Timer; - uint32 m_uiLightningNova_Timer; - uint32 m_uiPulsingShockwave_Timer; - uint32 m_uiResumePulsingShockwave_Timer; - - uint32 m_uiHealthAmountModifier; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_bIsAura = false; - - m_uiArcLightning_Timer = 15000; - m_uiLightningNova_Timer = 20000; - m_uiPulsingShockwave_Timer = 2000; - m_uiResumePulsingShockwave_Timer = 15000; - - m_uiHealthAmountModifier = 1; - - if (m_pInstance) - { - m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); - } + return new boss_lokenAI(pCreature); } - void EnterCombat(Unit* /*pWho*/) + struct boss_lokenAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - - if (m_pInstance) + boss_lokenAI(Creature* pCreature) : ScriptedAI(pCreature) { - m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + m_pInstance = pCreature->GetInstanceScript(); } - } - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); + InstanceScript* m_pInstance; - if (m_pInstance) - m_pInstance->SetData(TYPE_LOKEN, DONE); - } + bool m_bIsAura; - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + uint32 m_uiArcLightning_Timer; + uint32 m_uiLightningNova_Timer; + uint32 m_uiPulsingShockwave_Timer; + uint32 m_uiResumePulsingShockwave_Timer; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 m_uiHealthAmountModifier; - if (m_bIsAura) + void Reset() { - // workaround for PULSING_SHOCKWAVE - if (m_uiPulsingShockwave_Timer <= uiDiff) - { - Map* pMap = me->GetMap(); - if (pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - - if (PlayerList.isEmpty()) - return; + m_bIsAura = false; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) - { - int32 dmg; - float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ()); + m_uiArcLightning_Timer = 15000; + m_uiLightningNova_Timer = 20000; + m_uiPulsingShockwave_Timer = 2000; + m_uiResumePulsingShockwave_Timer = 15000; - dmg = DUNGEON_MODE(100, 150); // need to correct damage - if (m_fDist > 1.0f) // Further from 1 yard - dmg *= m_fDist; + m_uiHealthAmountModifier = 1; - me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false); - } - } - m_uiPulsingShockwave_Timer = 2000; - } else m_uiPulsingShockwave_Timer -= uiDiff; + if (m_pInstance) + { + m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + } } - else + + void EnterCombat(Unit* /*pWho*/) { - if (m_uiResumePulsingShockwave_Timer <= uiDiff) - { - //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? - DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); + DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support - m_bIsAura = true; - m_uiResumePulsingShockwave_Timer = 0; + if (m_pInstance) + { + m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); } - else - m_uiResumePulsingShockwave_Timer -= uiDiff; } - if (m_uiArcLightning_Timer <= uiDiff) + void JustDied(Unit* /*pKiller*/) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ARC_LIGHTNING); + DoScriptText(SAY_DEATH, me); - m_uiArcLightning_Timer = 15000 + rand()%1000; + if (m_pInstance) + m_pInstance->SetData(TYPE_LOKEN, DONE); } - else - m_uiArcLightning_Timer -= uiDiff; - if (m_uiLightningNova_Timer <= uiDiff) + void KilledUnit(Unit* /*pVictim*/) { - DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), me); - DoScriptText(EMOTE_NOVA, me); - DoCast(me, SPELL_LIGHTNING_NOVA_N); - - m_bIsAura = false; - m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura - m_uiLightningNova_Timer = 20000 + rand()%1000; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - else - m_uiLightningNova_Timer -= uiDiff; - // Health check - if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier))) + void UpdateAI(const uint32 uiDiff) { - switch(m_uiHealthAmountModifier) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_bIsAura) + { + // workaround for PULSING_SHOCKWAVE + if (m_uiPulsingShockwave_Timer <= uiDiff) + { + Map* pMap = me->GetMap(); + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) + { + int32 dmg; + float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ()); + + dmg = DUNGEON_MODE(100, 150); // need to correct damage + if (m_fDist > 1.0f) // Further from 1 yard + dmg *= m_fDist; + + me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false); + } + } + m_uiPulsingShockwave_Timer = 2000; + } else m_uiPulsingShockwave_Timer -= uiDiff; + } + else + { + if (m_uiResumePulsingShockwave_Timer <= uiDiff) + { + //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? + DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); + + DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support + m_bIsAura = true; + m_uiResumePulsingShockwave_Timer = 0; + } + else + m_uiResumePulsingShockwave_Timer -= uiDiff; + } + + if (m_uiArcLightning_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ARC_LIGHTNING); + + m_uiArcLightning_Timer = 15000 + rand()%1000; + } + else + m_uiArcLightning_Timer -= uiDiff; + + if (m_uiLightningNova_Timer <= uiDiff) { - case 1: DoScriptText(SAY_75HEALTH, me); break; - case 2: DoScriptText(SAY_50HEALTH, me); break; - case 3: DoScriptText(SAY_25HEALTH, me); break; + DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), me); + DoScriptText(EMOTE_NOVA, me); + DoCast(me, SPELL_LIGHTNING_NOVA_N); + + m_bIsAura = false; + m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura + m_uiLightningNova_Timer = 20000 + rand()%1000; } + else + m_uiLightningNova_Timer -= uiDiff; - ++m_uiHealthAmountModifier; + // Health check + if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier))) + { + switch(m_uiHealthAmountModifier) + { + case 1: DoScriptText(SAY_75HEALTH, me); break; + case 2: DoScriptText(SAY_50HEALTH, me); break; + case 3: DoScriptText(SAY_25HEALTH, me); break; + } + + ++m_uiHealthAmountModifier; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_loken(Creature* pCreature) -{ - return new boss_lokenAI(pCreature); -} void AddSC_boss_loken() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_loken"; - newscript->GetAI = &GetAI_boss_loken; - newscript->RegisterSelf(); + new boss_loken(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index cb5878defb3..7cdf9c4e287 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -73,408 +73,415 @@ enum eEnums /*###### ## Boss Volkhan ######*/ - -struct boss_volkhanAI : public ScriptedAI +
class boss_volkhan : public CreatureScript { - boss_volkhanAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + boss_volkhan() : CreatureScript("boss_volkhan") { } + + bool EffectDummyCreature(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { - m_pInstance = pCreature->GetInstanceData(); + //always check spellid and effectindex + if (uiSpellId == SPELL_TEMPER_DUMMY && uiEffIndex == 0) + { + if (pCaster->GetEntry() != NPC_VOLKHAN_ANVIL || pCreatureTarget->GetEntry() != NPC_VOLKHAN) + return true; + + for (uint8 i = 0; i < MAX_GOLEM; ++i) + { + pCreatureTarget->CastSpell(pCaster, SPELL_SUMMON_MOLTEN_GOLEM, true); + } + + //always return true when we are handling this spell and effect + return true; + } + + return false; } - ScriptedInstance* m_pInstance; + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_volkhanAI(pCreature); + } - std::list<uint64> m_lGolemGUIDList; + struct boss_volkhanAI : public ScriptedAI + { + boss_volkhanAI(Creature *pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - bool m_bHasTemper; - bool m_bIsStriking; - bool m_bCanShatterGolem; + InstanceScript* m_pInstance; - uint8 GolemsShattered; - uint32 m_uiPause_Timer; - uint32 m_uiShatteringStomp_Timer; - uint32 m_uiShatter_Timer; + std::list<uint64> m_lGolemGUIDList; - uint32 m_uiHealthAmountModifier; + bool m_bHasTemper; + bool m_bIsStriking; + bool m_bCanShatterGolem; - void Reset() - { - m_bIsStriking = false; - m_bHasTemper = false; - m_bCanShatterGolem = false; + uint8 GolemsShattered; + uint32 m_uiPause_Timer; + uint32 m_uiShatteringStomp_Timer; + uint32 m_uiShatter_Timer; - m_uiPause_Timer = 3500; - m_uiShatteringStomp_Timer = 0; - m_uiShatter_Timer = 5000; - GolemsShattered = 0; + uint32 m_uiHealthAmountModifier; - m_uiHealthAmountModifier = 1; + void Reset() + { + m_bIsStriking = false; + m_bHasTemper = false; + m_bCanShatterGolem = false; - DespawnGolem(); - m_lGolemGUIDList.clear(); + m_uiPause_Timer = 3500; + m_uiShatteringStomp_Timer = 0; + m_uiShatter_Timer = 5000; + GolemsShattered = 0; - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); - } + m_uiHealthAmountModifier = 1; - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); + DespawnGolem(); + m_lGolemGUIDList.clear(); - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); - } + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); + } - void AttackStart(Unit* pWho) - { - if (me->Attack(pWho, true)) + void EnterCombat(Unit* /*pWho*/) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + DoScriptText(SAY_AGGRO, me); - if (!m_bHasTemper) - me->GetMotionMaster()->MoveChase(pWho); + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); } - } - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); - DespawnGolem(); + void AttackStart(Unit* pWho) + { + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, DONE); + if (!m_bHasTemper) + me->GetMotionMaster()->MoveChase(pWho); + } + } - if (IsHeroic() && GolemsShattered < 5) + void JustDied(Unit* /*pKiller*/) { - AchievementEntry const *AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); - if (AchievShatterResistant) + DoScriptText(SAY_DEATH, me); + DespawnGolem(); + + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, DONE); + + if (IsHeroic() && GolemsShattered < 5) { - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) + AchievementEntry const *AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); + if (AchievShatterResistant) { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievShatterResistant); + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievShatterResistant); + } } } } - } - - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - void DespawnGolem() - { - if (m_lGolemGUIDList.empty()) - return; + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } - for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + void DespawnGolem() { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (m_lGolemGUIDList.empty()) + return; + + for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { - if (pTemp->isAlive()) - pTemp->ForcedDespawn(); + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + { + if (pTemp->isAlive()) + pTemp->ForcedDespawn(); + } } - } - - m_lGolemGUIDList.clear(); - } - void ShatterGolem() - { - if (m_lGolemGUIDList.empty()) - return; + m_lGolemGUIDList.clear(); + } - for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + void ShatterGolem() { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (m_lGolemGUIDList.empty()) + return; + + for (std::list<uint64>::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { - // only shatter brittle golems - if (pTemp->isAlive() && pTemp->GetEntry() == NPC_BRITTLE_GOLEM) + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) { - pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SHATTER_N, SPELL_SHATTER_H), false); - GolemsShattered += 1; + // only shatter brittle golems + if (pTemp->isAlive() && pTemp->GetEntry() == NPC_BRITTLE_GOLEM) + { + pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SHATTER_N, SPELL_SHATTER_H), false); + GolemsShattered += 1; + } } } } - } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_TEMPER_DUMMY) - m_bIsStriking = true; - } + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + { + if (pSpell->Id == SPELL_TEMPER_DUMMY) + m_bIsStriking = true; + } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == NPC_MOLTEN_GOLEM) + void JustSummoned(Creature* pSummoned) { - m_lGolemGUIDList.push_back(pSummoned->GetGUID()); + if (pSummoned->GetEntry() == NPC_MOLTEN_GOLEM) + { + m_lGolemGUIDList.push_back(pSummoned->GetGUID()); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); - //why healing when just summoned? - pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_HEAT_N, SPELL_HEAT_H), false, NULL, NULL, me->GetGUID()); + //why healing when just summoned? + pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_HEAT_N, SPELL_HEAT_H), false, NULL, NULL, me->GetGUID()); + } } - } - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_bIsStriking) + void UpdateAI(const uint32 uiDiff) { - if (m_uiPause_Timer <= uiDiff) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_bIsStriking) { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + if (m_uiPause_Timer <= uiDiff) { - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + + m_bHasTemper = false; + m_bIsStriking = false; + m_uiPause_Timer = 3500; } + else + m_uiPause_Timer -= uiDiff; - m_bHasTemper = false; - m_bIsStriking = false; - m_uiPause_Timer = 3500; + return; } - else - m_uiPause_Timer -= uiDiff; - return; - } - - // When to start shatter? After 60, 40 or 20% hp? - if (!m_bHasTemper && m_uiHealthAmountModifier >= 3) - { - if (m_uiShatteringStomp_Timer <= uiDiff) + // When to start shatter? After 60, 40 or 20% hp? + if (!m_bHasTemper && m_uiHealthAmountModifier >= 3) { - //should he stomp even if he has no brittle golem to shatter? + if (m_uiShatteringStomp_Timer <= uiDiff) + { + //should he stomp even if he has no brittle golem to shatter? - DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2), me); + DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2), me); - DoCast(me, SPELL_SHATTERING_STOMP_N); + DoCast(me, SPELL_SHATTERING_STOMP_N); - DoScriptText(EMOTE_SHATTER, me); + DoScriptText(EMOTE_SHATTER, me); - m_uiShatteringStomp_Timer = 30000; - m_bCanShatterGolem = true; + m_uiShatteringStomp_Timer = 30000; + m_bCanShatterGolem = true; + } + else + m_uiShatteringStomp_Timer -= uiDiff; } - else - m_uiShatteringStomp_Timer -= uiDiff; - } - // Shatter Golems 3 seconds after Shattering Stomp - if (m_bCanShatterGolem) - { - if (m_uiShatter_Timer <= uiDiff) + // Shatter Golems 3 seconds after Shattering Stomp + if (m_bCanShatterGolem) { - ShatterGolem(); - m_uiShatter_Timer = 3000; - m_bCanShatterGolem = false; + if (m_uiShatter_Timer <= uiDiff) + { + ShatterGolem(); + m_uiShatter_Timer = 3000; + m_bCanShatterGolem = false; + } + else + m_uiShatter_Timer -= uiDiff; } - else - m_uiShatter_Timer -= uiDiff; - } - // Health check - if (!m_bCanShatterGolem && (me->GetHealth()*100 / me->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier))) - { - ++m_uiHealthAmountModifier; + // Health check + if (!m_bCanShatterGolem && (me->GetHealth()*100 / me->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier))) + { + ++m_uiHealthAmountModifier; - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - DoScriptText(RAND(SAY_FORGE_1,SAY_FORGE_2), me); + DoScriptText(RAND(SAY_FORGE_1,SAY_FORGE_2), me); - m_bHasTemper = true; + m_bHasTemper = true; - DoCast(me, SPELL_TEMPER, false); + DoCast(me, SPELL_TEMPER, false); + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_volkhan(Creature* pCreature) -{ - return new boss_volkhanAI(pCreature); -} - -bool EffectDummyCreature_boss_volkhan(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) -{ - //always check spellid and effectindex - if (uiSpellId == SPELL_TEMPER_DUMMY && uiEffIndex == 0) - { - if (pCaster->GetEntry() != NPC_VOLKHAN_ANVIL || pCreatureTarget->GetEntry() != NPC_VOLKHAN) - return true; - - for (uint8 i = 0; i < MAX_GOLEM; ++i) - { - pCreatureTarget->CastSpell(pCaster, SPELL_SUMMON_MOLTEN_GOLEM, true); - } - - //always return true when we are handling this spell and effect - return true; - } - return false; -} /*###### ## npc_volkhan_anvil ######*/ - -bool EffectDummyCreature_npc_volkhan_anvil(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) +
class npc_volkhan_anvil : public CreatureScript { - //always check spellid and effectindex - if (uiSpellId == SPELL_TEMPER && uiEffIndex == 0) +public: + npc_volkhan_anvil() : CreatureScript("npc_volkhan_anvil") { } + + bool EffectDummyCreature(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { - if (pCaster->GetEntry() != NPC_VOLKHAN || pCreatureTarget->GetEntry() != NPC_VOLKHAN_ANVIL) - return true; + //always check spellid and effectindex + if (uiSpellId == SPELL_TEMPER && uiEffIndex == 0) + { + if (pCaster->GetEntry() != NPC_VOLKHAN || pCreatureTarget->GetEntry() != NPC_VOLKHAN_ANVIL) + return true; - Creature *cre = CAST_CRE(pCaster); + Creature *cre = CAST_CRE(pCaster); - DoScriptText(EMOTE_TO_ANVIL, pCaster); + DoScriptText(EMOTE_TO_ANVIL, pCaster); - float fX, fY, fZ; - pCreatureTarget->GetContactPoint(pCaster, fX, fY, fZ, INTERACTION_DISTANCE); + float fX, fY, fZ; + pCreatureTarget->GetContactPoint(pCaster, fX, fY, fZ, INTERACTION_DISTANCE); - pCaster->AttackStop(); + pCaster->AttackStop(); - if (pCaster->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) - pCaster->GetMotionMaster()->MovementExpired(); + if (pCaster->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + pCaster->GetMotionMaster()->MovementExpired(); - cre->GetMap()->CreatureRelocation(cre, fX, fY, fZ, pCreatureTarget->GetOrientation()); - cre->SendMonsterMove(fX, fY, fZ, 0, cre->GetUnitMovementFlags(), 1); + cre->GetMap()->CreatureRelocation(cre, fX, fY, fZ, pCreatureTarget->GetOrientation()); + cre->SendMonsterMove(fX, fY, fZ, 0, cre->GetUnitMovementFlags(), 1); - pCreatureTarget->CastSpell(pCaster, SPELL_TEMPER_DUMMY, false); + pCreatureTarget->CastSpell(pCaster, SPELL_TEMPER_DUMMY, false); - //always return true when we are handling this spell and effect - return true; + //always return true when we are handling this spell and effect + return true; + } + + return false; } - return false; -} +}; /*###### ## mob_molten_golem ######*/ - -struct mob_molten_golemAI : public ScriptedAI +
class mob_molten_golem : public CreatureScript { - mob_molten_golemAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + mob_molten_golem() : CreatureScript("mob_molten_golem") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_molten_golemAI(pCreature); } - bool m_bIsFrozen; - - uint32 m_uiBlast_Timer; - uint32 m_uiDeathDelay_Timer; - uint32 m_uiImmolation_Timer; - - void Reset() + struct mob_molten_golemAI : public ScriptedAI { - m_bIsFrozen = false; + mob_molten_golemAI(Creature *pCreature) : ScriptedAI(pCreature) + { + } - m_uiBlast_Timer = 20000; - m_uiDeathDelay_Timer = 0; - m_uiImmolation_Timer = 5000; - } + bool m_bIsFrozen; - void AttackStart(Unit* pWho) - { - if (me->Attack(pWho, true)) + uint32 m_uiBlast_Timer; + uint32 m_uiDeathDelay_Timer; + uint32 m_uiImmolation_Timer; + + void Reset() { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + m_bIsFrozen = false; - if (!m_bIsFrozen) - me->GetMotionMaster()->MoveChase(pWho); + m_uiBlast_Timer = 20000; + m_uiDeathDelay_Timer = 0; + m_uiImmolation_Timer = 5000; } - } - void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth()) + void AttackStart(Unit* pWho) { - me->UpdateEntry(NPC_BRITTLE_GOLEM); - me->SetHealth(1); - uiDamage = 0; - me->RemoveAllAuras(); - me->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); - m_bIsFrozen = true; + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + if (!m_bIsFrozen) + me->GetMotionMaster()->MoveChase(pWho); + } } - } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - //this is the dummy effect of the spells - if (pSpell->Id == SPELL_SHATTER_N || pSpell->Id == SPELL_SHATTER_H) + void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) { - if (me->GetEntry() == NPC_BRITTLE_GOLEM) - me->ForcedDespawn(); + if (uiDamage > me->GetHealth()) + { + me->UpdateEntry(NPC_BRITTLE_GOLEM); + me->SetHealth(1); + uiDamage = 0; + me->RemoveAllAuras(); + me->AttackStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); + m_bIsFrozen = true; + } } - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target or if we are frozen - if (!UpdateVictim() || m_bIsFrozen) - return; - if (m_uiBlast_Timer <= uiDiff) + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) { - DoCast(me, SPELL_BLAST_WAVE); - m_uiBlast_Timer = 20000; + //this is the dummy effect of the spells + if (pSpell->Id == SPELL_SHATTER_N || pSpell->Id == SPELL_SHATTER_H) + { + if (me->GetEntry() == NPC_BRITTLE_GOLEM) + me->ForcedDespawn(); + } } - else - m_uiBlast_Timer -= uiDiff; - if (m_uiImmolation_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me->getVictim(), SPELL_IMMOLATION_STRIKE_N); - m_uiImmolation_Timer = 5000; + //Return since we have no target or if we are frozen + if (!UpdateVictim() || m_bIsFrozen) + return; + + if (m_uiBlast_Timer <= uiDiff) + { + DoCast(me, SPELL_BLAST_WAVE); + m_uiBlast_Timer = 20000; + } + else + m_uiBlast_Timer -= uiDiff; + + if (m_uiImmolation_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_IMMOLATION_STRIKE_N); + m_uiImmolation_Timer = 5000; + } + else + m_uiImmolation_Timer -= uiDiff; + + DoMeleeAttackIfReady(); } - else - m_uiImmolation_Timer -= uiDiff; + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_molten_golem(Creature* pCreature) -{ - return new mob_molten_golemAI(pCreature); -} void AddSC_boss_volkhan() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_volkhan"; - newscript->GetAI = &GetAI_boss_volkhan; - newscript->pEffectDummyCreature = &EffectDummyCreature_boss_volkhan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_volkhan_anvil"; - newscript->pEffectDummyCreature = &EffectDummyCreature_npc_volkhan_anvil; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_molten_golem"; - newscript->GetAI = &GetAI_mob_molten_golem; - newscript->RegisterSelf(); + new boss_volkhan(); + new npc_volkhan_anvil(); + new mob_molten_golem(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index 8dbcf8da23f..3dda1e0c77a 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -32,219 +32,222 @@ EndScriptData */ 2 - Ionar 3 - Loken */ - -struct instance_halls_of_lightning : public ScriptedInstance +
class instance_halls_of_lightning : public InstanceMapScript { - instance_halls_of_lightning(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 m_uiGeneralBjarngrimGUID; - uint64 m_uiIonarGUID; - uint64 m_uiLokenGUID; - uint64 m_uiVolkhanGUID; - - uint64 m_uiBjarngrimDoorGUID; - uint64 m_uiVolkhanDoorGUID; - uint64 m_uiIonarDoorGUID; - uint64 m_uiLokenDoorGUID; - uint64 m_uiLokenGlobeGUID; +public: + instance_halls_of_lightning() : InstanceMapScript("instance_halls_of_lightning") { } - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiGeneralBjarngrimGUID = 0; - m_uiVolkhanGUID = 0; - m_uiIonarGUID = 0; - m_uiLokenGUID = 0; - - m_uiBjarngrimDoorGUID = 0; - m_uiVolkhanDoorGUID = 0; - m_uiIonarDoorGUID = 0; - m_uiLokenDoorGUID = 0; - m_uiLokenGlobeGUID = 0; + return new instance_halls_of_lightning_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_halls_of_lightning_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_halls_of_lightning_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint64 m_uiGeneralBjarngrimGUID; + uint64 m_uiIonarGUID; + uint64 m_uiLokenGUID; + uint64 m_uiVolkhanGUID; + + uint64 m_uiBjarngrimDoorGUID; + uint64 m_uiVolkhanDoorGUID; + uint64 m_uiIonarDoorGUID; + uint64 m_uiLokenDoorGUID; + uint64 m_uiLokenGlobeGUID; + + void Initialize() { - case NPC_BJARNGRIM: - m_uiGeneralBjarngrimGUID = pCreature->GetGUID(); - break; - case NPC_VOLKHAN: - m_uiVolkhanGUID = pCreature->GetGUID(); - break; - case NPC_IONAR: - m_uiIonarGUID = pCreature->GetGUID(); - break; - case NPC_LOKEN: - m_uiLokenGUID = pCreature->GetGUID(); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiGeneralBjarngrimGUID = 0; + m_uiVolkhanGUID = 0; + m_uiIonarGUID = 0; + m_uiLokenGUID = 0; + + m_uiBjarngrimDoorGUID = 0; + m_uiVolkhanDoorGUID = 0; + m_uiIonarDoorGUID = 0; + m_uiLokenDoorGUID = 0; + m_uiLokenGlobeGUID = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_BJARNGRIM_DOOR: - m_uiBjarngrimDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_VOLKHAN_DOOR: - m_uiVolkhanDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[1] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_IONAR_DOOR: - m_uiIonarDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_LOKEN_DOOR: - m_uiLokenDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_LOKEN_THRONE: - m_uiLokenGlobeGUID = pGo->GetGUID(); - break; + switch(pCreature->GetEntry()) + { + case NPC_BJARNGRIM: + m_uiGeneralBjarngrimGUID = pCreature->GetGUID(); + break; + case NPC_VOLKHAN: + m_uiVolkhanGUID = pCreature->GetGUID(); + break; + case NPC_IONAR: + m_uiIonarGUID = pCreature->GetGUID(); + break; + case NPC_LOKEN: + m_uiLokenGUID = pCreature->GetGUID(); + break; + } } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case TYPE_BJARNGRIM: - if (uiData == DONE) - DoUseDoorOrButton(m_uiBjarngrimDoorGUID); - m_auiEncounter[0] = uiData; - break; - case TYPE_VOLKHAN: - if (uiData == DONE) - DoUseDoorOrButton(m_uiVolkhanDoorGUID); - m_auiEncounter[1] = uiData; - break; - case TYPE_IONAR: - if (uiData == DONE) - DoUseDoorOrButton(m_uiIonarDoorGUID); - m_auiEncounter[2] = uiData; - break; - case TYPE_LOKEN: - if (uiData == DONE) - { - DoUseDoorOrButton(m_uiLokenDoorGUID); - - //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder - if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) - pGlobe->SetGoState(GO_STATE_ACTIVE); - } - m_auiEncounter[3] = uiData; - break; + switch(pGo->GetEntry()) + { + case GO_BJARNGRIM_DOOR: + m_uiBjarngrimDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_VOLKHAN_DOOR: + m_uiVolkhanDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_IONAR_DOOR: + m_uiIonarDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_LOKEN_DOOR: + m_uiLokenDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_LOKEN_THRONE: + m_uiLokenGlobeGUID = pGo->GetGUID(); + break; + } } - if (uiData == DONE) - SaveToDB(); - } + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_BJARNGRIM: + if (uiData == DONE) + DoUseDoorOrButton(m_uiBjarngrimDoorGUID); + m_auiEncounter[0] = uiData; + break; + case TYPE_VOLKHAN: + if (uiData == DONE) + DoUseDoorOrButton(m_uiVolkhanDoorGUID); + m_auiEncounter[1] = uiData; + break; + case TYPE_IONAR: + if (uiData == DONE) + DoUseDoorOrButton(m_uiIonarDoorGUID); + m_auiEncounter[2] = uiData; + break; + case TYPE_LOKEN: + if (uiData == DONE) + { + DoUseDoorOrButton(m_uiLokenDoorGUID); + + //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder + if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) + pGlobe->SetGoState(GO_STATE_ACTIVE); + } + m_auiEncounter[3] = uiData; + break; + } + + if (uiData == DONE) + SaveToDB(); + } - uint32 GetData(uint32 uiType) - { - switch(uiType) + uint32 GetData(uint32 uiType) { - case TYPE_BJARNGRIM: - return m_auiEncounter[0]; - case TYPE_VOLKHAN: - return m_auiEncounter[1]; - case TYPE_IONAR: - return m_auiEncounter[2]; - case TYPE_LOKEN: - return m_auiEncounter[3]; + switch(uiType) + { + case TYPE_BJARNGRIM: + return m_auiEncounter[0]; + case TYPE_VOLKHAN: + return m_auiEncounter[1]; + case TYPE_IONAR: + return m_auiEncounter[2]; + case TYPE_LOKEN: + return m_auiEncounter[3]; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint64 GetData64(uint32 uiData) { - case DATA_BJARNGRIM: - return m_uiGeneralBjarngrimGUID; - case DATA_VOLKHAN: - return m_uiVolkhanGUID; - case DATA_IONAR: - return m_uiIonarGUID; - case DATA_LOKEN: - return m_uiLokenGUID; + switch(uiData) + { + case DATA_BJARNGRIM: + return m_uiGeneralBjarngrimGUID; + case DATA_VOLKHAN: + return m_uiVolkhanGUID; + case DATA_IONAR: + return m_uiIonarGUID; + case DATA_LOKEN: + return m_uiLokenGUID; + } + return 0; } - return 0; - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "H L " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3]; + std::ostringstream saveStream; + saveStream << "H L " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3]; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'H' && dataHead2 == 'L') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + if (dataHead1 == 'H' && dataHead2 == 'L') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_halls_of_lightning(Map* pMap) -{ - return new instance_halls_of_lightning(pMap); -} void AddSC_instance_halls_of_lightning() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_halls_of_lightning"; - newscript->GetInstanceData = &GetInstanceData_instance_halls_of_lightning; - newscript->RegisterSelf(); + new instance_halls_of_lightning(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index 63b1de56c38..3c61b2f4abc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -51,143 +51,145 @@ enum Yells SAY_DEATH = -1599009, SAY_SHATTER = -1599010 }; - -struct boss_krystallusAI : public ScriptedAI +
class boss_krystallus : public CreatureScript { - boss_krystallusAI(Creature *c) : ScriptedAI(c) +public: + boss_krystallus() : CreatureScript("boss_krystallus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_krystallusAI (pCreature); } - uint32 uiBoulderTossTimer; - uint32 uiGroundSpikeTimer; - uint32 uiGroundSlamTimer; - uint32 uiShatterTimer; - uint32 uiStompTimer; - - bool bIsSlam; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_krystallusAI : public ScriptedAI { - bIsSlam = false; - - uiBoulderTossTimer = 3000 + rand()%6000; - uiGroundSpikeTimer = 9000 + rand()%5000; - uiGroundSlamTimer = 15000 + rand()%3000; - uiStompTimer = 20000 + rand()%9000; - uiShatterTimer = 0; + boss_krystallusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_KRYSTALLUS_EVENT, NOT_STARTED); - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + uint32 uiBoulderTossTimer; + uint32 uiGroundSpikeTimer; + uint32 uiGroundSlamTimer; + uint32 uiShatterTimer; + uint32 uiStompTimer; - if (pInstance) - pInstance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS); - } + bool bIsSlam; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (uiBoulderTossTimer <= diff) + void Reset() { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BOULDER_TOSS); - uiBoulderTossTimer = 9000 + rand()%6000; - } else uiBoulderTossTimer -= diff; + bIsSlam = false; - if (uiGroundSpikeTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_GROUND_SPIKE); - uiGroundSpikeTimer = 12000 + rand()%5000; - } else uiGroundSpikeTimer -= diff; - - if (uiStompTimer <= diff) - { - DoCast(me, SPELL_STOMP); + uiBoulderTossTimer = 3000 + rand()%6000; + uiGroundSpikeTimer = 9000 + rand()%5000; + uiGroundSlamTimer = 15000 + rand()%3000; uiStompTimer = 20000 + rand()%9000; - } else uiStompTimer -= diff; + uiShatterTimer = 0; - if (uiGroundSlamTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_KRYSTALLUS_EVENT, NOT_STARTED); + } + void EnterCombat(Unit* /*who*/) { - DoCast(me, SPELL_GROUND_SLAM); - bIsSlam = true; - uiShatterTimer = 10000; - uiGroundSlamTimer = 15000 + rand()%3000; - } else uiGroundSlamTimer -= diff; + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS); + } - if (bIsSlam) + void UpdateAI(const uint32 diff) { - if (uiShatterTimer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiBoulderTossTimer <= diff) { - DoCast(me, DUNGEON_MODE(SPELL_SHATTER, H_SPELL_SHATTER)); - } else uiShatterTimer -= diff; - } + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BOULDER_TOSS); + uiBoulderTossTimer = 9000 + rand()%6000; + } else uiBoulderTossTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiGroundSpikeTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_GROUND_SPIKE); + uiGroundSpikeTimer = 12000 + rand()%5000; + } else uiGroundSpikeTimer -= diff; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (uiStompTimer <= diff) + { + DoCast(me, SPELL_STOMP); + uiStompTimer = 20000 + rand()%9000; + } else uiStompTimer -= diff; - if (pInstance) - pInstance->SetData(DATA_KRYSTALLUS_EVENT, DONE); - } + if (uiGroundSlamTimer <= diff) + { + DoCast(me, SPELL_GROUND_SLAM); + bIsSlam = true; + uiShatterTimer = 10000; + uiGroundSlamTimer = 15000 + rand()%3000; + } else uiGroundSlamTimer -= diff; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(SAY_KILL, me); - } + if (bIsSlam) + { + if (uiShatterTimer <= diff) + { + DoCast(me, DUNGEON_MODE(SPELL_SHATTER, H_SPELL_SHATTER)); + } else uiShatterTimer -= diff; + } - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) - { - //this part should be in the core - if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) { - //this spell must have custom handling in the core, dealing damage based on distance - pTarget->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true); + DoScriptText(SAY_DEATH, me); - if (pTarget->HasAura(SPELL_STONED)) - pTarget->RemoveAurasDueToSpell(SPELL_STONED); + if (pInstance) + pInstance->SetData(DATA_KRYSTALLUS_EVENT, DONE); + } - //clear this, if we are still performing - if (bIsSlam) + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(SAY_KILL, me); + } + + void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) + { + //this part should be in the core + if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) { - bIsSlam = false; + //this spell must have custom handling in the core, dealing damage based on distance + pTarget->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true); - //and correct movement, if not already - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + if (pTarget->HasAura(SPELL_STONED)) + pTarget->RemoveAurasDueToSpell(SPELL_STONED); + + //clear this, if we are still performing + if (bIsSlam) { - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + bIsSlam = false; + + //and correct movement, if not already + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } } } } - } + }; + }; -CreatureAI* GetAI_boss_krystallus(Creature* pCreature) -{ - return new boss_krystallusAI (pCreature); -} void AddSC_boss_krystallus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_krystallus"; - newscript->GetAI = &GetAI_boss_krystallus; - newscript->RegisterSelf(); + new boss_krystallus(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp index e7fde3dcea7..6b14beb9881 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp @@ -55,129 +55,131 @@ enum Achievements { ACHIEV_GOOD_GRIEF_START_EVENT = 20383, }; - -struct boss_maiden_of_griefAI : public ScriptedAI +
class boss_maiden_of_grief : public CreatureScript { - boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) +public: + boss_maiden_of_grief() : CreatureScript("boss_maiden_of_grief") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_maiden_of_griefAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 PartingSorrowTimer; - uint32 StormOfGriefTimer; - uint32 ShockOfSorrowTimer; - uint32 PillarOfWoeTimer; - - void Reset() + struct boss_maiden_of_griefAI : public ScriptedAI { - PartingSorrowTimer = 25000 + rand()%5000; - StormOfGriefTimer = 10000; - ShockOfSorrowTimer = 20000+rand()%5000; - PillarOfWoeTimer = 5000 + rand()%10000; - - if (pInstance) + boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED); - pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + pInstance = me->GetInstanceScript(); } - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + InstanceScript* pInstance; + + uint32 PartingSorrowTimer; + uint32 StormOfGriefTimer; + uint32 ShockOfSorrowTimer; + uint32 PillarOfWoeTimer; - if (pInstance) + void Reset() { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAIDEN_DOOR))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } + PartingSorrowTimer = 25000 + rand()%5000; + StormOfGriefTimer = 10000; + ShockOfSorrowTimer = 20000+rand()%5000; + PillarOfWoeTimer = 5000 + rand()%10000; - pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS); - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + if (pInstance) + { + pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED); + pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + } } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAIDEN_DOOR))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + + pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS); + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + } + } - if (IsHeroic()) + void UpdateAI(const uint32 diff) { - if (PartingSorrowTimer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (IsHeroic()) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (PartingSorrowTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_PARTING_SORROW); + if (pTarget) + DoCast(pTarget, SPELL_PARTING_SORROW); - PartingSorrowTimer = 30000 + rand()%10000; - } else PartingSorrowTimer -= diff; - } + PartingSorrowTimer = 30000 + rand()%10000; + } else PartingSorrowTimer -= diff; + } - if (StormOfGriefTimer <= diff) - { - DoCast(me->getVictim(), SPELL_STORM_OF_GRIEF_N, true); - StormOfGriefTimer = 15000 + rand()%5000; - } else StormOfGriefTimer -= diff; + if (StormOfGriefTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STORM_OF_GRIEF_N, true); + StormOfGriefTimer = 15000 + rand()%5000; + } else StormOfGriefTimer -= diff; - if (ShockOfSorrowTimer <= diff) - { - DoResetThreat(); - DoScriptText(SAY_STUN, me); - DoCast(me, SPELL_SHOCK_OF_SORROW_N); - ShockOfSorrowTimer = 20000 + rand()%10000; - } else ShockOfSorrowTimer -= diff; + if (ShockOfSorrowTimer <= diff) + { + DoResetThreat(); + DoScriptText(SAY_STUN, me); + DoCast(me, SPELL_SHOCK_OF_SORROW_N); + ShockOfSorrowTimer = 20000 + rand()%10000; + } else ShockOfSorrowTimer -= diff; - if (PillarOfWoeTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (PillarOfWoeTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (pTarget) - DoCast(pTarget, SPELL_PILLAR_OF_WOE_N); - else - DoCast(me->getVictim(), SPELL_PILLAR_OF_WOE_N); + if (pTarget) + DoCast(pTarget, SPELL_PILLAR_OF_WOE_N); + else + DoCast(me->getVictim(), SPELL_PILLAR_OF_WOE_N); - PillarOfWoeTimer = 5000 + rand()%20000; - } else PillarOfWoeTimer -= diff; + PillarOfWoeTimer = 5000 + rand()%20000; + } else PillarOfWoeTimer -= diff; - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE); + } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); - } }; -CreatureAI* GetAI_boss_maiden_of_grief(Creature* pCreature) -{ - return new boss_maiden_of_griefAI (pCreature); -} void AddSC_boss_maiden_of_grief() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_maiden_of_grief"; - newscript->GetAI = &GetAI_boss_maiden_of_grief; - newscript->RegisterSelf(); + new boss_maiden_of_grief(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 1cab83db949..0bdc8ace4de 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -81,237 +81,245 @@ static Locations PipeLocations[] = }; static Locations CenterPoint = {1295.21, 667.157, 189.691}; - -struct boss_sjonnirAI : public ScriptedAI +
class boss_sjonnir : public CreatureScript { - boss_sjonnirAI(Creature *c) : ScriptedAI(c), lSummons(me) +public: + boss_sjonnir() : CreatureScript("boss_sjonnir") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_sjonnirAI (pCreature); } - bool bIsFrenzy; + struct boss_sjonnirAI : public ScriptedAI + { + boss_sjonnirAI(Creature *c) : ScriptedAI(c), lSummons(me) + { + pInstance = c->GetInstanceScript(); + } - uint32 uiChainLightningTimer; - uint32 uiLightningShieldTimer; - uint32 uiStaticChargeTimer; - uint32 uiLightningRingTimer; - uint32 uiSummonTimer; - uint32 uiFrenzyTimer; - uint32 uiEncounterTimer; - uint32 uiKilledIronSludges; + bool bIsFrenzy; - SummonList lSummons; + uint32 uiChainLightningTimer; + uint32 uiLightningShieldTimer; + uint32 uiStaticChargeTimer; + uint32 uiLightningRingTimer; + uint32 uiSummonTimer; + uint32 uiFrenzyTimer; + uint32 uiEncounterTimer; + uint32 uiKilledIronSludges; - ScriptedInstance* pInstance; + SummonList lSummons; - void Reset() - { - bIsFrenzy = false; + InstanceScript* pInstance; - uiEncounterTimer = 0; - uiChainLightningTimer = 3000 + rand()%5000; - uiLightningShieldTimer = 20000 + rand()%5000; - uiStaticChargeTimer = 20000 + rand()%5000; - uiLightningRingTimer = 30000 + rand()%5000; - uiSummonTimer = 5000; - uiFrenzyTimer = 300000; //5 minutes - uiKilledIronSludges = 0; + void Reset() + { + bIsFrenzy = false; - lSummons.DespawnAll(); + uiEncounterTimer = 0; + uiChainLightningTimer = 3000 + rand()%5000; + uiLightningShieldTimer = 20000 + rand()%5000; + uiStaticChargeTimer = 20000 + rand()%5000; + uiLightningRingTimer = 30000 + rand()%5000; + uiSummonTimer = 5000; + uiFrenzyTimer = 300000; //5 minutes + uiKilledIronSludges = 0; - if (pInstance) - pInstance->SetData(DATA_SJONNIR_EVENT, NOT_STARTED); - } + lSummons.DespawnAll(); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - uiEncounterTimer = 0; + if (pInstance) + pInstance->SetData(DATA_SJONNIR_EVENT, NOT_STARTED); + } - if (pInstance) + void EnterCombat(Unit* /*who*/) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SJONNIR_DOOR))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } + DoScriptText(SAY_AGGRO, me); - pInstance->SetData(DATA_SJONNIR_EVENT, IN_PROGRESS); - } - } + uiEncounterTimer = 0; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SJONNIR_DOOR))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + + pInstance->SetData(DATA_SJONNIR_EVENT, IN_PROGRESS); + } + } - if (uiChainLightningTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CHAIN_LIGHTING); - uiChainLightningTimer = 10000 + rand()%5000; - } else uiChainLightningTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiLightningShieldTimer <= diff) - { - DoCast(me, SPELL_LIGHTING_SHIELD); - uiLightningShieldTimer -= diff; + if (uiChainLightningTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CHAIN_LIGHTING); + uiChainLightningTimer = 10000 + rand()%5000; + } else uiChainLightningTimer -= diff; + + if (uiLightningShieldTimer <= diff) + { + DoCast(me, SPELL_LIGHTING_SHIELD); + uiLightningShieldTimer -= diff; + } + + if (uiStaticChargeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STATIC_CHARGE); + uiStaticChargeTimer = 20000 + rand()%5000; + } uiStaticChargeTimer -= diff; + + if (uiLightningRingTimer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_LIGHTING_RING); + uiLightningRingTimer = 30000 + rand()%5000; + } else uiLightningRingTimer -= diff; + + if (uiSummonTimer <= diff) + { + uint32 uiSummonPipe = rand()%2; + me->SummonCreature(uiEncounterTimer > DATA_TIME_BEFORE_OOZE ? CREATURE_MALFORMED_OOZE : + RAND(CREATURE_FORGED_IRON_DWARF,CREATURE_FORGED_IRON_TROGG), + PipeLocations[uiSummonPipe].x, PipeLocations[uiSummonPipe].y, PipeLocations[uiSummonPipe].z, 0.0f, + TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + uiSummonTimer = 20000; + } else uiSummonTimer -= diff; + + if (!bIsFrenzy) + { + if (uiFrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + bIsFrenzy = true; + } + else uiFrenzyTimer -= diff; + } + + uiEncounterTimer +=diff; + + DoMeleeAttackIfReady(); } - if (uiStaticChargeTimer <= diff) + void JustSummoned(Creature* summon) { - DoCast(me->getVictim(), SPELL_STATIC_CHARGE); - uiStaticChargeTimer = 20000 + rand()%5000; - } uiStaticChargeTimer -= diff; + summon->GetMotionMaster()->MovePoint(0, CenterPoint.x, CenterPoint.y, CenterPoint.z); + /*if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + summon->AI()->AttackStart(pTarget);*/ + lSummons.Summon(summon); + } - if (uiLightningRingTimer <= diff) + void JustDied(Unit* /*killer*/) { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_LIGHTING_RING); - uiLightningRingTimer = 30000 + rand()%5000; - } else uiLightningRingTimer -= diff; + DoScriptText(SAY_DEATH, me); + lSummons.DespawnAll(); - if (uiSummonTimer <= diff) - { - uint32 uiSummonPipe = rand()%2; - me->SummonCreature(uiEncounterTimer > DATA_TIME_BEFORE_OOZE ? CREATURE_MALFORMED_OOZE : - RAND(CREATURE_FORGED_IRON_DWARF,CREATURE_FORGED_IRON_TROGG), - PipeLocations[uiSummonPipe].x, PipeLocations[uiSummonPipe].y, PipeLocations[uiSummonPipe].z, 0.0f, - TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - uiSummonTimer = 20000; - } else uiSummonTimer -= diff; - - if (!bIsFrenzy) + if (pInstance) + { + pInstance->SetData(DATA_SJONNIR_EVENT, DONE); + if (IsHeroic() && uiKilledIronSludges > 4) + pInstance->DoCompleteAchievement(ACHIEV_ABUSE_THE_OOZE); + } + } + void KilledUnit(Unit * victim) { - if (uiFrenzyTimer <= diff) - { - DoCast(me, SPELL_FRENZY); - bIsFrenzy = true; - } - else uiFrenzyTimer -= diff; + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - uiEncounterTimer +=diff; - - DoMeleeAttackIfReady(); - } - - void JustSummoned(Creature* summon) - { - summon->GetMotionMaster()->MovePoint(0, CenterPoint.x, CenterPoint.y, CenterPoint.z); - /*if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - summon->AI()->AttackStart(pTarget);*/ - lSummons.Summon(summon); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - lSummons.DespawnAll(); - - if (pInstance) + void KilledIronSludge() { - pInstance->SetData(DATA_SJONNIR_EVENT, DONE); - if (IsHeroic() && uiKilledIronSludges > 4) - pInstance->DoCompleteAchievement(ACHIEV_ABUSE_THE_OOZE); + ++uiKilledIronSludges; } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + }; - void KilledIronSludge() - { - ++uiKilledIronSludges; - } }; -CreatureAI* GetAI_boss_sjonnir(Creature* pCreature) -{ - return new boss_sjonnirAI (pCreature); -} - -struct mob_malformed_oozeAI : public ScriptedAI +
class mob_malformed_ooze : public CreatureScript { - mob_malformed_oozeAI(Creature *c) : ScriptedAI(c) {} - - uint32 uiMergeTimer; +public: + mob_malformed_ooze() : CreatureScript("mob_malformed_ooze") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiMergeTimer = 10000; + return new mob_malformed_oozeAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_malformed_oozeAI : public ScriptedAI { - if (uiMergeTimer <= diff) + mob_malformed_oozeAI(Creature *c) : ScriptedAI(c) {} + + uint32 uiMergeTimer; + + void Reset() + { + uiMergeTimer = 10000; + } + + void UpdateAI(const uint32 diff) { - if (Creature* pTemp = me->FindNearestCreature(CREATURE_MALFORMED_OOZE, 3.0f, true)) + if (uiMergeTimer <= diff) { - DoSpawnCreature(CREATURE_IRON_SLUDGE, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); - pTemp->DisappearAndDie(); - me->DisappearAndDie(); - } - uiMergeTimer = 3000; - } else uiMergeTimer -= diff; + if (Creature* pTemp = me->FindNearestCreature(CREATURE_MALFORMED_OOZE, 3.0f, true)) + { + DoSpawnCreature(CREATURE_IRON_SLUDGE, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); + pTemp->DisappearAndDie(); + me->DisappearAndDie(); + } + uiMergeTimer = 3000; + } else uiMergeTimer -= diff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_malformed_ooze(Creature* pCreature) +
class mob_iron_sludge : public CreatureScript { - return new mob_malformed_oozeAI(pCreature); -} +public: + mob_iron_sludge() : CreatureScript("mob_iron_sludge") { } -struct mob_iron_sludgeAI : public ScriptedAI -{ - mob_iron_sludgeAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_iron_sludgeAI(pCreature); } - ScriptedInstance* pInstance; - - void JustDied(Unit* /*pKiller*/) + struct mob_iron_sludgeAI : public ScriptedAI { - if (pInstance) - if (Creature* pSjonnir = Unit::GetCreature(*me, pInstance->GetData64(DATA_SJONNIR))) - CAST_AI(boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); - } + mob_iron_sludgeAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + if (Creature* pSjonnir = Unit::GetCreature(*me, pInstance->GetData64(DATA_SJONNIR))) + CAST_AI(boss_sjonnir::boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); + } + }; + }; -CreatureAI* GetAI_mob_iron_sludge(Creature* pCreature) -{ - return new mob_iron_sludgeAI(pCreature); -} void AddSC_boss_sjonnir() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sjonnir"; - newscript->GetAI = &GetAI_boss_sjonnir; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_malformed_ooze"; - newscript->GetAI = &GetAI_mob_malformed_ooze; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_iron_sludge"; - newscript->GetAI = &GetAI_mob_iron_sludge; - newscript->RegisterSelf(); + new boss_sjonnir(); + new mob_malformed_ooze(); + new mob_iron_sludge(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index d7e7f495cfb..a358b99d269 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -131,611 +131,616 @@ static Position SpawnLocations[]= {946.992, 397.016, 208.374}, {960.748, 382.944, 208.374}, }; - -struct mob_tribuna_controllerAI : public ScriptedAI +
class mob_tribuna_controller : public CreatureScript { - mob_tribuna_controllerAI(Creature *c) : ScriptedAI(c) +public: + mob_tribuna_controller() : CreatureScript("mob_tribuna_controller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - SetCombatMovement(false); + return new mob_tribuna_controllerAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 uiKaddrakEncounterTimer; - uint32 uiMarnakEncounterTimer; - uint32 uiAbedneumEncounterTimer; + struct mob_tribuna_controllerAI : public ScriptedAI + { + mob_tribuna_controllerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + SetCombatMovement(false); + } - bool bKaddrakActivated; - bool bMarnakActivated; - bool bAbedneumActivated; + InstanceScript* pInstance; - std::list<uint64> KaddrakGUIDList; + uint32 uiKaddrakEncounterTimer; + uint32 uiMarnakEncounterTimer; + uint32 uiAbedneumEncounterTimer; - void Reset() - { - uiKaddrakEncounterTimer = 1500; - uiMarnakEncounterTimer = 10000; - uiAbedneumEncounterTimer = 10000; + bool bKaddrakActivated; + bool bMarnakActivated; + bool bAbedneumActivated; - bKaddrakActivated = false; - bMarnakActivated = false; - bAbedneumActivated = false; + std::list<uint64> KaddrakGUIDList; - if (pInstance) + void Reset() { - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); - } + uiKaddrakEncounterTimer = 1500; + uiMarnakEncounterTimer = 10000; + uiAbedneumEncounterTimer = 10000; - KaddrakGUIDList.clear(); - } + bKaddrakActivated = false; + bMarnakActivated = false; + bAbedneumActivated = false; - void UpdateFacesList() - { - /*GetCreatureListWithEntryInGrid(lKaddrakGUIDList, me, CREATURE_KADDRAK, 50.0f); - if (!lKaddrakGUIDList.empty()) - { - uint32 uiPositionCounter = 0; - for (std::list<Creature*>::const_iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) + if (pInstance) { - if ((*itr)->isAlive()) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); + } + + KaddrakGUIDList.clear(); + } + + void UpdateFacesList() + { + /*GetCreatureListWithEntryInGrid(lKaddrakGUIDList, me, CREATURE_KADDRAK, 50.0f); + if (!lKaddrakGUIDList.empty()) + { + uint32 uiPositionCounter = 0; + for (std::list<Creature*>::const_iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) { - if (uiPositionCounter == 0) - { - (*itr)->GetMap()->CreatureRelocation((*itr), 927.265, 333.200, 218.780, (*itr)->GetOrientation()); - (*itr)->SendMonsterMove(927.265, 333.200, 218.780, 0, (*itr)->GetMovementFlags(), 1); - } - else + if ((*itr)->isAlive()) { - (*itr)->GetMap()->CreatureRelocation((*itr), 921.745, 328.076, 218.780, (*itr)->GetOrientation()); - (*itr)->SendMonsterMove(921.745, 328.076, 218.780, 0, (*itr)->GetMovementFlags(), 1); + if (uiPositionCounter == 0) + { + (*itr)->GetMap()->CreatureRelocation((*itr), 927.265, 333.200, 218.780, (*itr)->GetOrientation()); + (*itr)->SendMonsterMove(927.265, 333.200, 218.780, 0, (*itr)->GetMovementFlags(), 1); + } + else + { + (*itr)->GetMap()->CreatureRelocation((*itr), 921.745, 328.076, 218.780, (*itr)->GetOrientation()); + (*itr)->SendMonsterMove(921.745, 328.076, 218.780, 0, (*itr)->GetMovementFlags(), 1); + } } + ++uiPositionCounter; } - ++uiPositionCounter; - } - }*/ - } + }*/ + } - void UpdateAI(const uint32 diff) - { - if (bKaddrakActivated) + void UpdateAI(const uint32 diff) { - if (uiKaddrakEncounterTimer <= diff) + if (bKaddrakActivated) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (!KaddrakGUIDList.empty()) - for (std::list<uint64>::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) - { - if (Creature *pKaddrak = Unit::GetCreature(*me, *itr)) + if (uiKaddrakEncounterTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!KaddrakGUIDList.empty()) + for (std::list<uint64>::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) { - if (pKaddrak->isAlive()) - pKaddrak->CastSpell(pTarget, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, H_SPELL_GLARE_OF_THE_TRIBUNAL), true); + if (Creature *pKaddrak = Unit::GetCreature(*me, *itr)) + { + if (pKaddrak->isAlive()) + pKaddrak->CastSpell(pTarget, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, H_SPELL_GLARE_OF_THE_TRIBUNAL), true); + } } - } - uiKaddrakEncounterTimer = 1500; - } else uiKaddrakEncounterTimer -= diff; - } - if (bMarnakActivated) - { - if (uiMarnakEncounterTimer <= diff) + uiKaddrakEncounterTimer = 1500; + } else uiKaddrakEncounterTimer -= diff; + } + if (bMarnakActivated) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiMarnakEncounterTimer <= diff) { - if (Creature* pSummon = me->SummonCreature(CREATURE_DARK_MATTER_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - pSummon->SetDisplayId(11686); - pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_DARK_MATTER, H_SPELL_DARK_MATTER), true); + if (Creature* pSummon = me->SummonCreature(CREATURE_DARK_MATTER_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) + { + pSummon->SetDisplayId(11686); + pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_DARK_MATTER, H_SPELL_DARK_MATTER), true); + } } - } - uiMarnakEncounterTimer = 30000 + rand()%1000; - } else uiMarnakEncounterTimer -= diff; - } - if (bAbedneumActivated) - { - if (uiAbedneumEncounterTimer <= diff) + uiMarnakEncounterTimer = 30000 + rand()%1000; + } else uiMarnakEncounterTimer -= diff; + } + if (bAbedneumActivated) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiAbedneumEncounterTimer <= diff) { - if (Creature* pSummon = me->SummonCreature(CREATURE_SEARING_GAZE_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - pSummon->SetDisplayId(11686); - pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_SEARING_GAZE, H_SPELL_SEARING_GAZE), true); + if (Creature* pSummon = me->SummonCreature(CREATURE_SEARING_GAZE_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) + { + pSummon->SetDisplayId(11686); + pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_SEARING_GAZE, H_SPELL_SEARING_GAZE), true); + } } - } - uiAbedneumEncounterTimer = 30000 + rand()%1000; - } else uiAbedneumEncounterTimer -= diff; + uiAbedneumEncounterTimer = 30000 + rand()%1000; + } else uiAbedneumEncounterTimer -= diff; + } } - } -}; + }; -struct npc_brann_hosAI : public npc_escortAI +}; +
class npc_brann_hos : public CreatureScript { - npc_brann_hosAI(Creature *c) : npc_escortAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + npc_brann_hos() : CreatureScript("npc_brann_hos") { } - uint32 uiStep; - uint32 uiPhaseTimer; - - uint64 uiControllerGUID; - std::list<uint64> lDwarfGUIDList; - - ScriptedInstance* pInstance; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1 || uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_brann_hos::npc_brann_hosAI, pCreature->AI())->StartWP(); + } - bool bIsBattle; - bool bIsLowHP; - bool bHasBeenDamaged; + return true; + } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - { - bIsLowHP = false; - bIsBattle = false; - bHasBeenDamaged = false; - uiStep = 0; - uiPhaseTimer = 0; - uiControllerGUID = 0; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - DespawnDwarf(); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_START, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); - if (pInstance) - pInstance->SetData(DATA_BRANN_EVENT, NOT_STARTED); - } + return true; } - void DespawnDwarf() + CreatureAI* GetAI(Creature* pCreature) const { - if (lDwarfGUIDList.empty()) - return; - for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) - { - Creature* pTemp = Unit::GetCreature(*me, pInstance ? (*itr) : 0); - if (pTemp && pTemp->isAlive()) - pTemp->ForcedDespawn(); - } - lDwarfGUIDList.clear(); + return new npc_brann_hosAI(pCreature); } - void WaypointReached(uint32 uiPointId) + struct npc_brann_hosAI : public npc_escortAI { - switch(uiPointId) + npc_brann_hosAI(Creature *c) : npc_escortAI(c) { - case 7: - if (Creature* pCreature = GetClosestCreatureWithEntry(me, CREATURE_TRIBUNAL_OF_THE_AGES, 100.0f)) - { - if (!pCreature->isAlive()) - pCreature->Respawn(); - CAST_AI(mob_tribuna_controllerAI, pCreature->AI())->UpdateFacesList(); - uiControllerGUID = pCreature->GetGUID(); - } - break; - case 13: - DoScriptText(SAY_EVENT_INTRO_1, me); - SetEscortPaused(true); - JumpToNextStep(20000); - break; - case 17: - DoScriptText(SAY_EVENT_INTRO_2, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_TRIBUNAL_CONSOLE),true); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - SetEscortPaused(true); - JumpToNextStep(8500); - break; - case 18: - SetEscortPaused(true); - break; + pInstance = c->GetInstanceScript(); } - } - void SpawnDwarf(uint32 uiType) - { - switch(uiType) - { - case 1: - { - uint32 uiSpawnNumber = DUNGEON_MODE(2,3); - for (uint8 i = 0; i < uiSpawnNumber; ++i) - me->SummonCreature(CREATURE_DARK_RUNE_PROTECTOR, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - break; - } - case 2: - for (uint8 i = 0; i < 2; ++i) - me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - break; - case 3: - me->SummonCreature(CREATURE_IRON_GOLEM_CUSTODIAN, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - break; - } - } - - void JustSummoned(Creature* pSummoned) - { - lDwarfGUIDList.push_back(pSummoned->GetGUID()); - pSummoned->AddThreat(me, 0.0f); - pSummoned->AI()->AttackStart(me); - } + uint32 uiStep; + uint32 uiPhaseTimer; - void JumpToNextStep(uint32 uiTimer) - { - uiPhaseTimer = uiTimer; - ++uiStep; - } + uint64 uiControllerGUID; + std::list<uint64> lDwarfGUIDList; - void StartWP() - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetEscortPaused(false); - uiStep = 1; - Start(); - } + InstanceScript* pInstance; - void DamageTaken(Unit* /*done_by*/, uint32 & /*damage*/) - { - if (!bHasBeenDamaged) - bHasBeenDamaged = true; - } + bool bIsBattle; + bool bIsLowHP; + bool bHasBeenDamaged; - void UpdateEscortAI(const uint32 uiDiff) - { - if (uiPhaseTimer <= uiDiff) + void Reset() { - switch(uiStep) + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - case 1: - if (pInstance) + bIsLowHP = false; + bIsBattle = false; + bHasBeenDamaged = false; + uiStep = 0; + uiPhaseTimer = 0; + uiControllerGUID = 0; + + DespawnDwarf(); + + if (pInstance) + pInstance->SetData(DATA_BRANN_EVENT, NOT_STARTED); + } + } + + void DespawnDwarf() + { + if (lDwarfGUIDList.empty()) + return; + for (std::list<uint64>::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) + { + Creature* pTemp = Unit::GetCreature(*me, pInstance ? (*itr) : 0); + if (pTemp && pTemp->isAlive()) + pTemp->ForcedDespawn(); + } + lDwarfGUIDList.clear(); + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 7: + if (Creature* pCreature = GetClosestCreatureWithEntry(me, CREATURE_TRIBUNAL_OF_THE_AGES, 100.0f)) { - if (pInstance->GetData(DATA_BRANN_EVENT) != NOT_STARTED) - return; - pInstance->SetData(DATA_BRANN_EVENT, IN_PROGRESS); + if (!pCreature->isAlive()) + pCreature->Respawn(); + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pCreature->AI())->UpdateFacesList(); + uiControllerGUID = pCreature->GetGUID(); } - bIsBattle = false; - DoScriptText(SAY_ESCORT_START, me); - SetRun(true); - JumpToNextStep(0); - break; - case 3: - SetEscortPaused(false); - JumpToNextStep(0); - break; - case 5: - if (pInstance) - if (Creature* pTemp = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))) - DoScriptText(SAY_EVENT_INTRO_3_ABED, pTemp); - JumpToNextStep(8500); - break; - case 6: - DoScriptText(SAY_EVENT_A_1, me); - JumpToNextStep(6500); - break; - case 7: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_A_2_KADD, pTemp); - JumpToNextStep(12500); - break; - case 8: - DoScriptText(SAY_EVENT_A_3, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - CAST_AI(mob_tribuna_controllerAI, pTemp->AI())->bKaddrakActivated = true; - JumpToNextStep(5000); - break; - case 9: - me->SetReactState(REACT_PASSIVE); - SpawnDwarf(1); - JumpToNextStep(20000); - break; - case 10: - DoScriptText(SAY_EVENT_B_1, me); - JumpToNextStep(6000); - break; - case 11: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_B_2_MARN, pTemp); - SpawnDwarf(1); - JumpToNextStep(20000); - break; - case 12: - DoScriptText(SAY_EVENT_B_3, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - CAST_AI(mob_tribuna_controllerAI, pTemp->AI())->bMarnakActivated = true; - JumpToNextStep(10000); break; case 13: - SpawnDwarf(1); - JumpToNextStep(10000); - break; - case 14: - SpawnDwarf(2); - JumpToNextStep(20000); - break; - case 15: - DoScriptText(SAY_EVENT_C_1, me); - SpawnDwarf(1); - JumpToNextStep(10000); - break; - case 16: - SpawnDwarf(2); + DoScriptText(SAY_EVENT_INTRO_1, me); + SetEscortPaused(true); JumpToNextStep(20000); break; case 17: + DoScriptText(SAY_EVENT_INTRO_2, me); if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_C_2_ABED, pTemp); - SpawnDwarf(1); - JumpToNextStep(20000); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_TRIBUNAL_CONSOLE),true); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + SetEscortPaused(true); + JumpToNextStep(8500); break; case 18: - DoScriptText(SAY_EVENT_C_3, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - CAST_AI(mob_tribuna_controllerAI, pTemp->AI())->bAbedneumActivated = true; - JumpToNextStep(5000); - break; - case 19: - SpawnDwarf(2); - JumpToNextStep(10000); - break; - case 20: - SpawnDwarf(1); - JumpToNextStep(15000); - break; - case 21: - DoScriptText(SAY_EVENT_D_1, me); - SpawnDwarf(3); - JumpToNextStep(20000); - break; - case 22: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_D_2_ABED, pTemp); - SpawnDwarf(1); - JumpToNextStep(5000); - break; - case 23: - SpawnDwarf(2); - JumpToNextStep(15000); - break; - case 24: - DoScriptText(SAY_EVENT_D_3, me); - SpawnDwarf(3); - JumpToNextStep(5000); - break; - case 25: - SpawnDwarf(1); - JumpToNextStep(5000); - break; - case 26: - SpawnDwarf(2); - JumpToNextStep(10000); - break; - case 27: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_D_4_ABED, pTemp); - SpawnDwarf(1); - JumpToNextStep(10000); - break; - case 28: - me->SetReactState(REACT_DEFENSIVE); - DoScriptText(SAY_EVENT_END_01, me); - me->SetStandState(UNIT_STAND_STATE_STAND); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - bIsBattle = true; - SetEscortPaused(false); - JumpToNextStep(6500); + SetEscortPaused(true); break; - case 29: - DoScriptText(SAY_EVENT_END_02, me); - if (pInstance) - { - pInstance->SetData(DATA_BRANN_EVENT, DONE); + } + } - // Achievement criteria is with spell 59046 which does not exist. - // There is thus no way it can be given by casting the spell on the players. - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59046); + void SpawnDwarf(uint32 uiType) + { + switch(uiType) + { + case 1: + { + uint32 uiSpawnNumber = DUNGEON_MODE(2,3); + for (uint8 i = 0; i < uiSpawnNumber; ++i) + me->SummonCreature(CREATURE_DARK_RUNE_PROTECTOR, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + break; + } + case 2: + for (uint8 i = 0; i < 2; ++i) + me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + break; + case 3: + me->SummonCreature(CREATURE_IRON_GOLEM_CUSTODIAN, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + break; + } + } - if (!bHasBeenDamaged) - pInstance->DoCompleteAchievement(ACHIEV_BRANN_SPANKIN_NEW); - } + void JustSummoned(Creature* pSummoned) + { + lDwarfGUIDList.push_back(pSummoned->GetGUID()); + pSummoned->AddThreat(me, 0.0f); + pSummoned->AI()->AttackStart(me); + } - JumpToNextStep(5500); - break; - case 30: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_03_ABED, pTemp); - JumpToNextStep(8500); - break; - case 31: - DoScriptText(SAY_EVENT_END_04, me); - JumpToNextStep(11500); - break; - case 32: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_05_ABED, pTemp); - JumpToNextStep(11500); - break; - case 33: - DoScriptText(SAY_EVENT_END_06, me); - JumpToNextStep(4500); - break; - case 34: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_07_ABED, pTemp); - JumpToNextStep(22500); - break; - case 35: - DoScriptText(SAY_EVENT_END_08, me); - JumpToNextStep(7500); - break; - case 36: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_END_09_KADD, pTemp); - JumpToNextStep(18500); - break; - case 37: - DoScriptText(SAY_EVENT_END_10, me); - JumpToNextStep(5500); - break; - case 38: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_END_11_KADD, pTemp); - JumpToNextStep(20500); - break; - case 39: - DoScriptText(SAY_EVENT_END_12, me); - JumpToNextStep(2500); - break; - case 40: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_END_13_KADD, pTemp); - JumpToNextStep(19500); - break; - case 41: - DoScriptText(SAY_EVENT_END_14, me); - JumpToNextStep(10500); - break; - case 42: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_END_15_MARN, pTemp); + void JumpToNextStep(uint32 uiTimer) + { + uiPhaseTimer = uiTimer; + ++uiStep; + } + + void StartWP() + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetEscortPaused(false); + uiStep = 1; + Start(); + } + + void DamageTaken(Unit* /*done_by*/, uint32 & /*damage*/) + { + if (!bHasBeenDamaged) + bHasBeenDamaged = true; + } + + void UpdateEscortAI(const uint32 uiDiff) + { + if (uiPhaseTimer <= uiDiff) + { + switch(uiStep) + { + case 1: + if (pInstance) + { + if (pInstance->GetData(DATA_BRANN_EVENT) != NOT_STARTED) + return; + pInstance->SetData(DATA_BRANN_EVENT, IN_PROGRESS); + } + bIsBattle = false; + DoScriptText(SAY_ESCORT_START, me); + SetRun(true); + JumpToNextStep(0); + break; + case 3: + SetEscortPaused(false); + JumpToNextStep(0); + break; + case 5: + if (pInstance) + if (Creature* pTemp = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))) + DoScriptText(SAY_EVENT_INTRO_3_ABED, pTemp); + JumpToNextStep(8500); + break; + case 6: + DoScriptText(SAY_EVENT_A_1, me); JumpToNextStep(6500); - break; - case 43: - DoScriptText(SAY_EVENT_END_16, me); - JumpToNextStep(6500); - break; - case 44: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_END_17_MARN, pTemp); - JumpToNextStep(25500); - break; - case 45: - DoScriptText(SAY_EVENT_END_18, me); - JumpToNextStep(23500); - break; - case 46: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_END_19_MARN, pTemp); - JumpToNextStep(3500); - break; - case 47: - DoScriptText(SAY_EVENT_END_20, me); - JumpToNextStep(8500); - break; - case 48: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_21_ABED, pTemp); + break; + case 7: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_A_2_KADD, pTemp); + JumpToNextStep(12500); + break; + case 8: + DoScriptText(SAY_EVENT_A_3, me); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bKaddrakActivated = true; + JumpToNextStep(5000); + break; + case 9: + me->SetReactState(REACT_PASSIVE); + SpawnDwarf(1); + JumpToNextStep(20000); + break; + case 10: + DoScriptText(SAY_EVENT_B_1, me); + JumpToNextStep(6000); + break; + case 11: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_B_2_MARN, pTemp); + SpawnDwarf(1); + JumpToNextStep(20000); + break; + case 12: + DoScriptText(SAY_EVENT_B_3, me); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bMarnakActivated = true; + JumpToNextStep(10000); + break; + case 13: + SpawnDwarf(1); + JumpToNextStep(10000); + break; + case 14: + SpawnDwarf(2); + JumpToNextStep(20000); + break; + case 15: + DoScriptText(SAY_EVENT_C_1, me); + SpawnDwarf(1); + JumpToNextStep(10000); + break; + case 16: + SpawnDwarf(2); + JumpToNextStep(20000); + break; + case 17: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_C_2_ABED, pTemp); + SpawnDwarf(1); + JumpToNextStep(20000); + break; + case 18: + DoScriptText(SAY_EVENT_C_3, me); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bAbedneumActivated = true; + JumpToNextStep(5000); + break; + case 19: + SpawnDwarf(2); + JumpToNextStep(10000); + break; + case 20: + SpawnDwarf(1); + JumpToNextStep(15000); + break; + case 21: + DoScriptText(SAY_EVENT_D_1, me); + SpawnDwarf(3); + JumpToNextStep(20000); + break; + case 22: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_D_2_ABED, pTemp); + SpawnDwarf(1); + JumpToNextStep(5000); + break; + case 23: + SpawnDwarf(2); + JumpToNextStep(15000); + break; + case 24: + DoScriptText(SAY_EVENT_D_3, me); + SpawnDwarf(3); + JumpToNextStep(5000); + break; + case 25: + SpawnDwarf(1); + JumpToNextStep(5000); + break; + case 26: + SpawnDwarf(2); + JumpToNextStep(10000); + break; + case 27: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_D_4_ABED, pTemp); + SpawnDwarf(1); + JumpToNextStep(10000); + break; + case 28: + me->SetReactState(REACT_DEFENSIVE); + DoScriptText(SAY_EVENT_END_01, me); + me->SetStandState(UNIT_STAND_STATE_STAND); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + bIsBattle = true; + SetEscortPaused(false); + JumpToNextStep(6500); + break; + case 29: + DoScriptText(SAY_EVENT_END_02, me); + if (pInstance) + { + pInstance->SetData(DATA_BRANN_EVENT, DONE); + + // Achievement criteria is with spell 59046 which does not exist. + // There is thus no way it can be given by casting the spell on the players. + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59046); + + if (!bHasBeenDamaged) + pInstance->DoCompleteAchievement(ACHIEV_BRANN_SPANKIN_NEW); + } + JumpToNextStep(5500); - break; - case 49: - { - if (pInstance) + break; + case 30: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_03_ABED, pTemp); + JumpToNextStep(8500); + break; + case 31: + DoScriptText(SAY_EVENT_END_04, me); + JumpToNextStep(11500); + break; + case 32: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_05_ABED, pTemp); + JumpToNextStep(11500); + break; + case 33: + DoScriptText(SAY_EVENT_END_06, me); + JumpToNextStep(4500); + break; + case 34: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_07_ABED, pTemp); + JumpToNextStep(22500); + break; + case 35: + DoScriptText(SAY_EVENT_END_08, me); + JumpToNextStep(7500); + break; + case 36: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_END_09_KADD, pTemp); + JumpToNextStep(18500); + break; + case 37: + DoScriptText(SAY_EVENT_END_10, me); + JumpToNextStep(5500); + break; + case 38: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_END_11_KADD, pTemp); + JumpToNextStep(20500); + break; + case 39: + DoScriptText(SAY_EVENT_END_12, me); + JumpToNextStep(2500); + break; + case 40: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_END_13_KADD, pTemp); + JumpToNextStep(19500); + break; + case 41: + DoScriptText(SAY_EVENT_END_14, me); + JumpToNextStep(10500); + break; + case 42: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_END_15_MARN, pTemp); + JumpToNextStep(6500); + break; + case 43: + DoScriptText(SAY_EVENT_END_16, me); + JumpToNextStep(6500); + break; + case 44: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_END_17_MARN, pTemp); + JumpToNextStep(25500); + break; + case 45: + DoScriptText(SAY_EVENT_END_18, me); + JumpToNextStep(23500); + break; + case 46: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_END_19_MARN, pTemp); + JumpToNextStep(3500); + break; + case 47: + DoScriptText(SAY_EVENT_END_20, me); + JumpToNextStep(8500); + break; + case 48: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_21_ABED, pTemp); + JumpToNextStep(5500); + break; + case 49: { - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); + if (pInstance) + { + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); + } + Player* pPlayer = GetPlayerForEscort(); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_HALLS_OF_STONE, me); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + JumpToNextStep(180000); + break; } - Player* pPlayer = GetPlayerForEscort(); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_HALLS_OF_STONE, me); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - JumpToNextStep(180000); - break; + case 50: + SetEscortPaused(false); + break; } - case 50: - SetEscortPaused(false); - break; + } else uiPhaseTimer -= uiDiff; + + if (!bIsLowHP && HealthBelowPct(30)) + { + DoScriptText(SAY_LOW_HEALTH, me); + bIsLowHP = true; } - } else uiPhaseTimer -= uiDiff; + else if (bIsLowHP && !HealthBelowPct(30)) + bIsLowHP = false; - if (!bIsLowHP && HealthBelowPct(30)) - { - DoScriptText(SAY_LOW_HEALTH, me); - bIsLowHP = true; - } - else if (bIsLowHP && !HealthBelowPct(30)) - bIsLowHP = false; + if (!UpdateVictim()) + return; - if (!UpdateVictim()) - return; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool GossipHello_npc_brann_hos(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_START, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_brann_hos(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1 || uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_brann_hosAI, pCreature->AI())->StartWP(); - } - return true; -} -CreatureAI* GetAI_mob_tribuna_controller(Creature* pCreature) -{ - return new mob_tribuna_controllerAI(pCreature); -} -CreatureAI* GetAI_npc_brann_hos(Creature* pCreature) -{ - return new npc_brann_hosAI(pCreature); -} void AddSC_halls_of_stone() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_brann_hos"; - newscript->GetAI = &GetAI_npc_brann_hos; - newscript->pGossipHello = &GossipHello_npc_brann_hos; - newscript->pGossipSelect = &GossipSelect_npc_brann_hos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tribuna_controller"; - newscript->GetAI = &GetAI_mob_tribuna_controller; - newscript->RegisterSelf(); + new npc_brann_hos(); + new mob_tribuna_controller(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index e4bbcdd9690..621655876dc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -26,246 +26,249 @@ 2- Escort Event 3- Sjonnir The Ironshaper */ - -struct instance_halls_of_stone : public ScriptedInstance +
class instance_halls_of_stone : public InstanceMapScript { - instance_halls_of_stone(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_halls_of_stone() : InstanceMapScript("instance_halls_of_stone") { } - uint64 uiMaidenOfGrief; - uint64 uiKrystallus; - uint64 uiSjonnir; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_halls_of_stone_InstanceMapScript(pMap); + } - uint64 uiKaddrak; - uint64 uiAbedneum; - uint64 uiMarnak; - uint64 uiBrann; + struct instance_halls_of_stone_InstanceMapScript : public InstanceScript + { + instance_halls_of_stone_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint64 uiMaidenOfGriefDoor; - uint64 uiSjonnirDoor; - uint64 uiBrannDoor; - uint64 uiTribunalConsole; - uint64 uiTribunalChest; - uint64 uiTribunalSkyFloor; - uint64 uiKaddrakGo; - uint64 uiAbedneumGo; - uint64 uiMarnakGo; + uint64 uiMaidenOfGrief; + uint64 uiKrystallus; + uint64 uiSjonnir; - uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 uiKaddrak; + uint64 uiAbedneum; + uint64 uiMarnak; + uint64 uiBrann; - std::string str_data; + uint64 uiMaidenOfGriefDoor; + uint64 uiSjonnirDoor; + uint64 uiBrannDoor; + uint64 uiTribunalConsole; + uint64 uiTribunalChest; + uint64 uiTribunalSkyFloor; + uint64 uiKaddrakGo; + uint64 uiAbedneumGo; + uint64 uiMarnakGo; - void Initialize() - { - uiMaidenOfGrief = 0; - uiKrystallus = 0; - uiSjonnir = 0; - - uiKaddrak = 0; - uiMarnak = 0; - uiAbedneum = 0; - uiBrann = 0; - - uiMaidenOfGriefDoor = 0; - uiSjonnirDoor = 0; - uiBrannDoor = 0; - uiKaddrakGo = 0; - uiMarnakGo = 0; - uiAbedneumGo = 0; - uiTribunalConsole = 0; - uiTribunalChest = 0; - uiTribunalSkyFloor = 0; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - m_auiEncounter[i] = NOT_STARTED; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + std::string str_data; + + void Initialize() { - case CREATURE_MAIDEN: uiMaidenOfGrief = pCreature->GetGUID(); break; - case CREATURE_KRYSTALLUS: uiKrystallus = pCreature->GetGUID(); break; - case CREATURE_SJONNIR: uiSjonnir = pCreature->GetGUID(); break; - case CREATURE_MARNAK: uiMarnak = pCreature->GetGUID(); break; - case CREATURE_KADDRAK: uiKaddrak = pCreature->GetGUID(); break; - case CREATURE_ABEDNEUM: uiAbedneum = pCreature->GetGUID(); break; - case CREATURE_BRANN: uiBrann = pCreature->GetGUID(); break; + uiMaidenOfGrief = 0; + uiKrystallus = 0; + uiSjonnir = 0; + + uiKaddrak = 0; + uiMarnak = 0; + uiAbedneum = 0; + uiBrann = 0; + + uiMaidenOfGriefDoor = 0; + uiSjonnirDoor = 0; + uiBrannDoor = 0; + uiKaddrakGo = 0; + uiMarnakGo = 0; + uiAbedneumGo = 0; + uiTribunalConsole = 0; + uiTribunalChest = 0; + uiTribunalSkyFloor = 0; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + m_auiEncounter[i] = NOT_STARTED; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_ABEDNEUM: - uiAbedneumGo = pGo->GetGUID(); - break; - case GO_MARNAK: - uiMarnakGo = pGo->GetGUID(); - break; - case GO_KADDRAK: - uiKaddrakGo = pGo->GetGUID(); - break; - case GO_MAIDEN_DOOR: - uiMaidenOfGriefDoor = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_BRANN_DOOR: - uiBrannDoor = pGo->GetGUID(); - if (m_auiEncounter[1] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_SJONNIR_DOOR: - uiSjonnirDoor = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_TRIBUNAL_CONSOLE: - uiTribunalConsole = pGo->GetGUID(); - break; - case GO_TRIBUNAL_CHEST: - case GO_TRIBUNAL_CHEST_HERO: - uiTribunalChest = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - break; - case 191527: - uiTribunalSkyFloor = pGo->GetGUID(); - break; + switch(pCreature->GetEntry()) + { + case CREATURE_MAIDEN: uiMaidenOfGrief = pCreature->GetGUID(); break; + case CREATURE_KRYSTALLUS: uiKrystallus = pCreature->GetGUID(); break; + case CREATURE_SJONNIR: uiSjonnir = pCreature->GetGUID(); break; + case CREATURE_MARNAK: uiMarnak = pCreature->GetGUID(); break; + case CREATURE_KADDRAK: uiKaddrak = pCreature->GetGUID(); break; + case CREATURE_ABEDNEUM: uiAbedneum = pCreature->GetGUID(); break; + case CREATURE_BRANN: uiBrann = pCreature->GetGUID(); break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_MAIDEN_OF_GRIEF_EVENT: - m_auiEncounter[1] = data; - if (m_auiEncounter[1] == DONE) - HandleGameObject(uiBrannDoor,true); - break; - case DATA_KRYSTALLUS_EVENT: - m_auiEncounter[0] = data; - if (m_auiEncounter[0] == DONE) - HandleGameObject(uiMaidenOfGriefDoor,true); - break; - case DATA_SJONNIR_EVENT: - m_auiEncounter[3] = data; - break; - case DATA_BRANN_EVENT: - m_auiEncounter[2] = data; - if (m_auiEncounter[2] == DONE) - { - HandleGameObject(uiSjonnirDoor,true); - GameObject *pGo = instance->GetGameObject(uiTribunalChest); - if (pGo) + switch(pGo->GetEntry()) + { + case GO_ABEDNEUM: + uiAbedneumGo = pGo->GetGUID(); + break; + case GO_MARNAK: + uiMarnakGo = pGo->GetGUID(); + break; + case GO_KADDRAK: + uiKaddrakGo = pGo->GetGUID(); + break; + case GO_MAIDEN_DOOR: + uiMaidenOfGriefDoor = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_BRANN_DOOR: + uiBrannDoor = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_SJONNIR_DOOR: + uiSjonnirDoor = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_TRIBUNAL_CONSOLE: + uiTribunalConsole = pGo->GetGUID(); + break; + case GO_TRIBUNAL_CHEST: + case GO_TRIBUNAL_CHEST_HERO: + uiTribunalChest = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - } - break; + break; + case 191527: + uiTribunalSkyFloor = pGo->GetGUID(); + break; + } } - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case DATA_KRYSTALLUS_EVENT: return m_auiEncounter[0]; - case DATA_MAIDEN_OF_GRIEF_EVENT: return m_auiEncounter[1]; - case DATA_SJONNIR_EVENT: return m_auiEncounter[2]; - case DATA_BRANN_EVENT: return m_auiEncounter[3]; + switch(type) + { + case DATA_MAIDEN_OF_GRIEF_EVENT: + m_auiEncounter[1] = data; + if (m_auiEncounter[1] == DONE) + HandleGameObject(uiBrannDoor,true); + break; + case DATA_KRYSTALLUS_EVENT: + m_auiEncounter[0] = data; + if (m_auiEncounter[0] == DONE) + HandleGameObject(uiMaidenOfGriefDoor,true); + break; + case DATA_SJONNIR_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_BRANN_EVENT: + m_auiEncounter[2] = data; + if (m_auiEncounter[2] == DONE) + { + HandleGameObject(uiSjonnirDoor,true); + GameObject *pGo = instance->GetGameObject(uiTribunalChest); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + } + break; + } + + if (data == DONE) + SaveToDB(); } - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) + uint32 GetData(uint32 type) { - case DATA_MAIDEN_OF_GRIEF: return uiMaidenOfGrief; - case DATA_KRYSTALLUS: return uiKrystallus; - case DATA_SJONNIR: return uiSjonnir; - case DATA_KADDRAK: return uiKaddrak; - case DATA_MARNAK: return uiMarnak; - case DATA_ABEDNEUM: return uiAbedneum; - case DATA_GO_TRIBUNAL_CONSOLE: return uiTribunalConsole; - case DATA_GO_KADDRAK: return uiKaddrakGo; - case DATA_GO_ABEDNEUM: return uiAbedneumGo; - case DATA_GO_MARNAK: return uiMarnakGo; - case DATA_GO_SKY_FLOOR: return uiTribunalSkyFloor; - case DATA_SJONNIR_DOOR: return uiSjonnirDoor; - case DATA_MAIDEN_DOOR: return uiMaidenOfGriefDoor; + switch(type) + { + case DATA_KRYSTALLUS_EVENT: return m_auiEncounter[0]; + case DATA_MAIDEN_OF_GRIEF_EVENT: return m_auiEncounter[1]; + case DATA_SJONNIR_EVENT: return m_auiEncounter[2]; + case DATA_BRANN_EVENT: return m_auiEncounter[3]; + } + + return 0; } - return 0; - } + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MAIDEN_OF_GRIEF: return uiMaidenOfGrief; + case DATA_KRYSTALLUS: return uiKrystallus; + case DATA_SJONNIR: return uiSjonnir; + case DATA_KADDRAK: return uiKaddrak; + case DATA_MARNAK: return uiMarnak; + case DATA_ABEDNEUM: return uiAbedneum; + case DATA_GO_TRIBUNAL_CONSOLE: return uiTribunalConsole; + case DATA_GO_KADDRAK: return uiKaddrakGo; + case DATA_GO_ABEDNEUM: return uiAbedneumGo; + case DATA_GO_MARNAK: return uiMarnakGo; + case DATA_GO_SKY_FLOOR: return uiTribunalSkyFloor; + case DATA_SJONNIR_DOOR: return uiSjonnirDoor; + case DATA_MAIDEN_DOOR: return uiMaidenOfGriefDoor; + } + + return 0; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "H S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; + std::ostringstream saveStream; + saveStream << "H S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - if (dataHead1 == 'H' && dataHead2 == 'S') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + if (dataHead1 == 'H' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_halls_of_stone(Map* pMap) -{ - return new instance_halls_of_stone(pMap); -} void AddSC_instance_halls_of_stone() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_halls_of_stone"; - newscript->GetInstanceData = &GetInstanceData_instance_halls_of_stone; - newscript->RegisterSelf(); + new instance_halls_of_stone(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp index 5019bb29d21..167fbec1077 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp @@ -80,304 +80,309 @@ enum Yells SAY_SUMMON_2 = -1603018, SAY_SUMMON_3 = -1603019, }; - -struct boss_algalonAI : public ScriptedAI +
class boss_algalon : public CreatureScript { - boss_algalonAI(Creature *c) : ScriptedAI(c) +public: + boss_algalon() : CreatureScript("boss_algalon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Summon = false; // not in reset. intro speech done only once. + return new boss_algalonAI(pCreature); } - ScriptedInstance* pInstance; - - std::list<uint64> m_lCollapsingStarGUIDList; - - uint32 Phase; - uint32 Ascend_Timer; - uint32 Berserk_Timer; - uint32 BigBang_Timer; - uint32 CosmicSmash_Timer; - uint32 PhasePunch_Timer; - uint32 QuantumStrike_Timer; - uint32 CollapsingStar_Timer; - uint32 uiPhase_timer; - uint32 uiStep; - - uint64 BlackHoleGUID; - - bool Enrage; - bool Summon; - - void EnterCombat(Unit* who) + struct boss_algalonAI : public ScriptedAI { - if (Summon) + boss_algalonAI(Creature *c) : ScriptedAI(c) { - DoScriptText(SAY_AGGRO, me); - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoZoneInCombat(who->ToCreature()); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - uiStep = 1; + pInstance = c->GetInstanceScript(); + Summon = false; // not in reset. intro speech done only once. } - if (pInstance) - pInstance->SetData(TYPE_ALGALON, IN_PROGRESS); - } + InstanceScript* pInstance; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + std::list<uint64> m_lCollapsingStarGUIDList; - void Reset() - { - Phase = 1; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(TYPE_ALGALON, NOT_STARTED); - - BlackHoleGUID = 0; - - uiPhase_timer = 0; - Ascend_Timer = 480000; //8 minutes - QuantumStrike_Timer = 4000 + rand()%10000; - Berserk_Timer = 360000; //6 minutes - CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds - BigBang_Timer = 90000; - PhasePunch_Timer = 8000; - CosmicSmash_Timer = urand(30000, 60000); - Enrage = false; - } + uint32 Phase; + uint32 Ascend_Timer; + uint32 Berserk_Timer; + uint32 BigBang_Timer; + uint32 CosmicSmash_Timer; + uint32 PhasePunch_Timer; + uint32 QuantumStrike_Timer; + uint32 CollapsingStar_Timer; + uint32 uiPhase_timer; + uint32 uiStep; - void JumpToNextStep(uint32 uiTimer) - { - uiPhase_timer = uiTimer; - ++uiStep; - } + uint64 BlackHoleGUID; - void DespawnCollapsingStar() - { - if (m_lCollapsingStarGUIDList.empty()) - return; + bool Enrage; + bool Summon; - for (std::list<uint64>::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) + void EnterCombat(Unit* who) { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (Summon) { - if (pTemp->isAlive()) - pTemp->ForcedDespawn(); + DoScriptText(SAY_AGGRO, me); + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + DoZoneInCombat(who->ToCreature()); } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + uiStep = 1; + } + + if (pInstance) + pInstance->SetData(TYPE_ALGALON, IN_PROGRESS); } - m_lCollapsingStarGUIDList.clear(); - } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == CREATURE_COLLAPSING_STAR) + void KilledUnit(Unit * /*victim*/) { - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (me->getVictim()) - pSummoned->AI()->AttackStart(pTarget ? pTarget : me->getVictim()); - m_lCollapsingStarGUIDList.push_back(pSummoned->GetGUID()); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - } - void SummonCollapsingStar(Unit* target) - { - DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me); - me->SummonCreature(CREATURE_COLLAPSING_STAR,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 100000); - me->SummonCreature(CREATURE_BLACK_HOLE,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 27000); - } + void Reset() + { + Phase = 1; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(TYPE_ALGALON, NOT_STARTED); + + BlackHoleGUID = 0; + + uiPhase_timer = 0; + Ascend_Timer = 480000; //8 minutes + QuantumStrike_Timer = 4000 + rand()%10000; + Berserk_Timer = 360000; //6 minutes + CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds + BigBang_Timer = 90000; + PhasePunch_Timer = 8000; + CosmicSmash_Timer = urand(30000, 60000); + Enrage = false; + } - if (Phase == 1 && HealthBelowPct(20)) + void JumpToNextStep(uint32 uiTimer) { - Phase = 2; - DoScriptText(SAY_PHASE_2, me); + uiPhase_timer = uiTimer; + ++uiStep; } - if (HealthBelowPct(2)) + void DespawnCollapsingStar() { - me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667, -295.101166,417.321381,0,0,0,0,0,0); - - // All of them. or random? - DoScriptText(SAY_DEATH_1, me); - DoScriptText(SAY_DEATH_2, me); - DoScriptText(SAY_DEATH_3, me); - DoScriptText(SAY_DEATH_4, me); - DoScriptText(SAY_DEATH_5, me); + if (m_lCollapsingStarGUIDList.empty()) + return; - me->DisappearAndDie(); + for (std::list<uint64>::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) + { + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + { + if (pTemp->isAlive()) + pTemp->ForcedDespawn(); + } + } + m_lCollapsingStarGUIDList.clear(); + } - if (pInstance) - pInstance->SetData(TYPE_ALGALON, DONE); + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == CREATURE_COLLAPSING_STAR) + { + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (me->getVictim()) + pSummoned->AI()->AttackStart(pTarget ? pTarget : me->getVictim()); + m_lCollapsingStarGUIDList.push_back(pSummoned->GetGUID()); + } + } - return; + void SummonCollapsingStar(Unit* target) + { + DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me); + me->SummonCreature(CREATURE_COLLAPSING_STAR,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 100000); + me->SummonCreature(CREATURE_BLACK_HOLE,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 27000); } - if (Phase == 1) + void UpdateAI(const uint32 diff) { - if (!Summon) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (Phase == 1 && HealthBelowPct(20)) { - if (uiPhase_timer <= diff) - { - switch(uiStep) - { - case 1: - DoScriptText(SAY_SUMMON_1, me); - JumpToNextStep(3000); - break; - case 2: - DoScriptText(SAY_SUMMON_2, me); - JumpToNextStep(3000); - break; - case 3: - DoScriptText(SAY_SUMMON_3, me); - JumpToNextStep(3000); - break; - case 4: - DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); - JumpToNextStep(3000); - break; - case 5: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - Summon = true; - break; - } - } else uiPhase_timer -= diff; + Phase = 2; + DoScriptText(SAY_PHASE_2, me); + } + + if (HealthBelowPct(2)) + { + me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667, -295.101166,417.321381,0,0,0,0,0,0); + + // All of them. or random? + DoScriptText(SAY_DEATH_1, me); + DoScriptText(SAY_DEATH_2, me); + DoScriptText(SAY_DEATH_3, me); + DoScriptText(SAY_DEATH_4, me); + DoScriptText(SAY_DEATH_5, me); + + me->DisappearAndDie(); + + if (pInstance) + pInstance->SetData(TYPE_ALGALON, DONE); return; } - if (QuantumStrike_Timer <= diff) + if (Phase == 1) { - DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE,H_SPELL_QUANTUM_STRIKE), true); + if (!Summon) + { + if (uiPhase_timer <= diff) + { + switch(uiStep) + { + case 1: + DoScriptText(SAY_SUMMON_1, me); + JumpToNextStep(3000); + break; + case 2: + DoScriptText(SAY_SUMMON_2, me); + JumpToNextStep(3000); + break; + case 3: + DoScriptText(SAY_SUMMON_3, me); + JumpToNextStep(3000); + break; + case 4: + DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); + JumpToNextStep(3000); + break; + case 5: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + Summon = true; + break; + } + } else uiPhase_timer -= diff; + + return; + } + + if (QuantumStrike_Timer <= diff) + { + DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE,H_SPELL_QUANTUM_STRIKE), true); - QuantumStrike_Timer = urand(4000, 14000); - } else QuantumStrike_Timer -= diff; + QuantumStrike_Timer = urand(4000, 14000); + } else QuantumStrike_Timer -= diff; - if (BigBang_Timer <= diff) - { - DoScriptText(RAND(SAY_BIG_BANG_1,SAY_BIG_BANG_2), me); - DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG,H_SPELL_BIG_BANG), true); + if (BigBang_Timer <= diff) + { + DoScriptText(RAND(SAY_BIG_BANG_1,SAY_BIG_BANG_2), me); + DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG,H_SPELL_BIG_BANG), true); - BigBang_Timer = 90000; - } else BigBang_Timer -= diff; + BigBang_Timer = 90000; + } else BigBang_Timer -= diff; - if (Ascend_Timer <= diff) - { - DoCast(me->getVictim(),SPELL_ASCEND, true); + if (Ascend_Timer <= diff) + { + DoCast(me->getVictim(),SPELL_ASCEND, true); - Ascend_Timer = 480000; - } else Ascend_Timer -= diff; + Ascend_Timer = 480000; + } else Ascend_Timer -= diff; - if (PhasePunch_Timer <= diff) - { - DoCast(me->getVictim(),SPELL_PHASE_PUNCH, true); + if (PhasePunch_Timer <= diff) + { + DoCast(me->getVictim(),SPELL_PHASE_PUNCH, true); - PhasePunch_Timer = 8000; - } else PhasePunch_Timer -= diff; + PhasePunch_Timer = 8000; + } else PhasePunch_Timer -= diff; - if (CosmicSmash_Timer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH,H_SPELL_COSMIC_SMASH), true); + if (CosmicSmash_Timer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH,H_SPELL_COSMIC_SMASH), true); - CosmicSmash_Timer = urand(30000, 60000); - } else CosmicSmash_Timer -= diff; + CosmicSmash_Timer = urand(30000, 60000); + } else CosmicSmash_Timer -= diff; - if (Berserk_Timer <= diff) - { - DoScriptText(SAY_BERSERK, me); - DoCast(me->getVictim(),SPELL_BERSERK, true); + if (Berserk_Timer <= diff) + { + DoScriptText(SAY_BERSERK, me); + DoCast(me->getVictim(),SPELL_BERSERK, true); - Berserk_Timer = 360000; - } else Berserk_Timer -= diff; + Berserk_Timer = 360000; + } else Berserk_Timer -= diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - EnterEvadeIfOutOfCombatArea(diff); - } + EnterEvadeIfOutOfCombatArea(diff); + } - if (Phase == 2) - { - if (Enrage) + if (Phase == 2) { - if (Ascend_Timer <= diff) + if (Enrage) { - DoCast(me, SPELL_ASCEND); - DoScriptText(SAY_BERSERK, me); - Ascend_Timer = urand(360000,365000); - Enrage = false; - } else Ascend_Timer -= diff; + if (Ascend_Timer <= diff) + { + DoCast(me, SPELL_ASCEND); + DoScriptText(SAY_BERSERK, me); + Ascend_Timer = urand(360000,365000); + Enrage = false; + } else Ascend_Timer -= diff; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -//Collapsing Star -struct mob_collapsing_starAI : public ScriptedAI +//Collapsing Star
class mob_collapsing_star : public CreatureScript { - mob_collapsing_starAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } +public: + mob_collapsing_star() : CreatureScript("mob_collapsing_star") { } - ScriptedInstance* pInstance; - - uint32 BlackHoleExplosion_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BlackHoleExplosion_Timer = 0; + return new mob_collapsing_starAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_collapsing_starAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_collapsing_starAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 BlackHoleExplosion_Timer; - if (BlackHoleExplosion_Timer <= diff) + void Reset() { - me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false); BlackHoleExplosion_Timer = 0; - } else BlackHoleExplosion_Timer -= diff; - } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (BlackHoleExplosion_Timer <= diff) + { + me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false); + BlackHoleExplosion_Timer = 0; + } else BlackHoleExplosion_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_algalon(Creature* pCreature) -{ - return new boss_algalonAI(pCreature); -} -CreatureAI* GetAI_mob_collapsing_star(Creature* pCreature) -{ - return new mob_collapsing_starAI(pCreature); -} void AddSC_boss_Algalon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_algalon"; - newscript->GetAI = &GetAI_boss_algalon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_collapsing_star"; - newscript->GetAI = &GetAI_mob_collapsing_star; - newscript->RegisterSelf(); + new boss_algalon(); + new mob_collapsing_star(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp index 98fac4f80d2..d55653a2498 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp @@ -112,7 +112,7 @@ enum Yells SAY_BRUNDIR_BERSERK = -1603047, }; -bool IsEncounterComplete(ScriptedInstance* pInstance, Creature* me) +bool IsEncounterComplete(InstanceScript* pInstance, Creature* me) { if (!pInstance || !me) return false; @@ -133,456 +133,469 @@ bool IsEncounterComplete(ScriptedInstance* pInstance, Creature* me) } return true; } - -struct boss_steelbreakerAI : public ScriptedAI +
class boss_steelbreaker : public CreatureScript { - boss_steelbreakerAI(Creature *c) : ScriptedAI(c) +public: + boss_steelbreaker() : CreatureScript("boss_steelbreaker") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_steelbreakerAI (pCreature); } - void Reset() + struct boss_steelbreakerAI : public ScriptedAI { - events.Reset(); - phase = 0; - me->RemoveAllAuras(); - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - } + boss_steelbreakerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - EventMap events; - ScriptedInstance* pInstance; - uint32 phase; + void Reset() + { + events.Reset(); + phase = 0; + me->RemoveAllAuras(); + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_STEELBREAKER_AGGRO, me); - DoZoneInCombat(); - DoCast(me, RAID_MODE(SPELL_HIGH_VOLTAGE, SPELL_HIGH_VOLTAGE_H)); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); - } + EventMap events; + InstanceScript* pInstance; + uint32 phase; - void UpdatePhase() - { - ++phase; - events.SetPhase(phase); - events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000); - if (phase >= 2) - events.RescheduleEvent(EVENT_STATIC_DISRUPTION, 30000); - if (phase >= 3) - events.RescheduleEvent(EVENT_OVERWHELMING_POWER, rand()%5000); - } + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_STEELBREAKER_AGGRO, me); + DoZoneInCombat(); + DoCast(me, RAID_MODE(SPELL_HIGH_VOLTAGE, SPELL_HIGH_VOLTAGE_H)); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); + } - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + void UpdatePhase() { - if (Creature* Brundir = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) - if (Brundir->isAlive()) - Brundir->SetHealth(Brundir->GetMaxHealth()); + ++phase; + events.SetPhase(phase); + events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000); + if (phase >= 2) + events.RescheduleEvent(EVENT_STATIC_DISRUPTION, 30000); + if (phase >= 3) + events.RescheduleEvent(EVENT_OVERWHELMING_POWER, rand()%5000); + } - if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) - if (Molgeim->isAlive()) - Molgeim->SetHealth(Molgeim->GetMaxHealth()); + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (damage >= me->GetHealth()) + { + if (Creature* Brundir = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) + if (Brundir->isAlive()) + Brundir->SetHealth(Brundir->GetMaxHealth()); - DoCast(SPELL_SUPERCHARGE); + if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) + if (Molgeim->isAlive()) + Molgeim->SetHealth(Molgeim->GetMaxHealth()); + + DoCast(SPELL_SUPERCHARGE); + } } - } - void JustDied(Unit* /*Killer*/) - { - DoScriptText(RAND(SAY_STEELBREAKER_DEATH_1,SAY_STEELBREAKER_DEATH_2), me); - if (IsEncounterComplete(pInstance, me) && pInstance) - pInstance->SetData(TYPE_ASSEMBLY, DONE); - } + void JustDied(Unit* /*Killer*/) + { + DoScriptText(RAND(SAY_STEELBREAKER_DEATH_1,SAY_STEELBREAKER_DEATH_2), me); + if (IsEncounterComplete(pInstance, me) && pInstance) + pInstance->SetData(TYPE_ASSEMBLY, DONE); + } - void KilledUnit(Unit * /*who*/) - { - DoScriptText(RAND(SAY_STEELBREAKER_SLAY_1,SAY_STEELBREAKER_SLAY_2), me); + void KilledUnit(Unit * /*who*/) + { + DoScriptText(RAND(SAY_STEELBREAKER_SLAY_1,SAY_STEELBREAKER_SLAY_2), me); - if (phase == 3) - DoCast(me, SPELL_ELECTRICAL_CHARGE); - } + if (phase == 3) + DoCast(me, SPELL_ELECTRICAL_CHARGE); + } - void SpellHit(Unit * /*from*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } + void SpellHit(Unit * /*from*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ENRAGE: - DoScriptText(SAY_STEELBREAKER_BERSERK, me); - DoCast(SPELL_BERSERK); - break; - case EVENT_FUSION_PUNCH: - DoCast(me->getVictim(), RAID_MODE(SPELL_FUSION_PUNCH, SPELL_FUSION_PUNCH_H)); - events.ScheduleEvent(EVENT_FUSION_PUNCH, urand(13000, 22000)); - break; - case EVENT_STATIC_DISRUPTION: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, RAID_MODE(SPELL_STATIC_DISRUPTION, SPELL_STATIC_DISRUPTION_H)); - events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(20000, 40000)); - break; - case EVENT_OVERWHELMING_POWER: - DoScriptText(SAY_STEELBREAKER_POWER, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_OVERWHELMING_POWER, SPELL_OVERWHELMING_POWER_H)); - events.ScheduleEvent(EVENT_OVERWHELMING_POWER, RAID_MODE(60000, 35000)); - break; + switch(eventId) + { + case EVENT_ENRAGE: + DoScriptText(SAY_STEELBREAKER_BERSERK, me); + DoCast(SPELL_BERSERK); + break; + case EVENT_FUSION_PUNCH: + DoCast(me->getVictim(), RAID_MODE(SPELL_FUSION_PUNCH, SPELL_FUSION_PUNCH_H)); + events.ScheduleEvent(EVENT_FUSION_PUNCH, urand(13000, 22000)); + break; + case EVENT_STATIC_DISRUPTION: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, RAID_MODE(SPELL_STATIC_DISRUPTION, SPELL_STATIC_DISRUPTION_H)); + events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(20000, 40000)); + break; + case EVENT_OVERWHELMING_POWER: + DoScriptText(SAY_STEELBREAKER_POWER, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_OVERWHELMING_POWER, SPELL_OVERWHELMING_POWER_H)); + events.ScheduleEvent(EVENT_OVERWHELMING_POWER, RAID_MODE(60000, 35000)); + break; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct boss_runemaster_molgeimAI : public ScriptedAI +
class boss_runemaster_molgeim : public CreatureScript { - boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c) +public: + boss_runemaster_molgeim() : CreatureScript("boss_runemaster_molgeim") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_runemaster_molgeimAI (pCreature); } - void Reset() + struct boss_runemaster_molgeimAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - events.Reset(); - me->RemoveAllAuras(); - phase = 0; - } + boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance* pInstance; - EventMap events; - uint32 phase; + void Reset() + { + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + events.Reset(); + me->RemoveAllAuras(); + phase = 0; + } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_MOLGEIM_AGGRO, me); - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); - } + InstanceScript* pInstance; + EventMap events; + uint32 phase; - void UpdatePhase() - { - ++phase; - events.SetPhase(phase); - events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000); - events.RescheduleEvent(EVENT_RUNE_OF_POWER, 60000); - if (phase >= 2) - events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000); - if (phase >= 3) - events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_MOLGEIM_AGGRO, me); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); + } - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + void UpdatePhase() { - if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) - if (Steelbreaker->isAlive()) - Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); + ++phase; + events.SetPhase(phase); + events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000); + events.RescheduleEvent(EVENT_RUNE_OF_POWER, 60000); + if (phase >= 2) + events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000); + if (phase >= 3) + events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); + } + + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (damage >= me->GetHealth()) + { + if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) + if (Steelbreaker->isAlive()) + Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); - if (Creature* Brundir = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) - if (Brundir->isAlive()) - Brundir->SetHealth(Brundir->GetMaxHealth()); + if (Creature* Brundir = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) + if (Brundir->isAlive()) + Brundir->SetHealth(Brundir->GetMaxHealth()); - DoCast(me, SPELL_SUPERCHARGE); + DoCast(me, SPELL_SUPERCHARGE); + } } - } - void JustDied(Unit* /*Killer*/) - { - DoScriptText(RAND(SAY_MOLGEIM_DEATH_1,SAY_MOLGEIM_DEATH_2), me); - if (IsEncounterComplete(pInstance, me) && pInstance) - pInstance->SetData(TYPE_ASSEMBLY, DONE); - } + void JustDied(Unit* /*Killer*/) + { + DoScriptText(RAND(SAY_MOLGEIM_DEATH_1,SAY_MOLGEIM_DEATH_2), me); + if (IsEncounterComplete(pInstance, me) && pInstance) + pInstance->SetData(TYPE_ASSEMBLY, DONE); + } - void KilledUnit(Unit * /*who*/) - { - DoScriptText(RAND(SAY_MOLGEIM_SLAY_1,SAY_MOLGEIM_SLAY_2), me); - } + void KilledUnit(Unit * /*who*/) + { + DoScriptText(RAND(SAY_MOLGEIM_SLAY_1,SAY_MOLGEIM_SLAY_2), me); + } - void SpellHit(Unit * /*from*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } + void SpellHit(Unit * /*from*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ENRAGE: - DoScriptText(SAY_MOLGEIM_BERSERK, me); - DoCast(SPELL_BERSERK); - break; - case EVENT_RUNE_OF_POWER: // Improve target selection; random alive friendly + switch(eventId) { - Unit *pTarget = DoSelectLowestHpFriendly(60); - if (!pTarget || (pTarget && !pTarget->isAlive())) - pTarget = me; - DoCast(pTarget, SPELL_RUNE_OF_POWER); - events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000); - break; + case EVENT_ENRAGE: + DoScriptText(SAY_MOLGEIM_BERSERK, me); + DoCast(SPELL_BERSERK); + break; + case EVENT_RUNE_OF_POWER: // Improve target selection; random alive friendly + { + Unit *pTarget = DoSelectLowestHpFriendly(60); + if (!pTarget || (pTarget && !pTarget->isAlive())) + pTarget = me; + DoCast(pTarget, SPELL_RUNE_OF_POWER); + events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000); + break; + } + case EVENT_SHIELD_OF_RUNES: + DoCast(me, RAID_MODE(SPELL_SHIELD_OF_RUNES, SPELL_SHIELD_OF_RUNES_H)); + events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000,34000)); + break; + case EVENT_RUNE_OF_DEATH: + DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_RUNE_OF_DEATH); + events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000,40000)); + break; + case EVENT_RUNE_OF_SUMMONING: + DoScriptText(SAY_MOLGEIM_SUMMON, me); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_RUNE_OF_SUMMONING); + events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); + break; } - case EVENT_SHIELD_OF_RUNES: - DoCast(me, RAID_MODE(SPELL_SHIELD_OF_RUNES, SPELL_SHIELD_OF_RUNES_H)); - events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000,34000)); - break; - case EVENT_RUNE_OF_DEATH: - DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_RUNE_OF_DEATH); - events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000,40000)); - break; - case EVENT_RUNE_OF_SUMMONING: - DoScriptText(SAY_MOLGEIM_SUMMON, me); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_RUNE_OF_SUMMONING); - events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); - break; } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_lightning_elementalAI : public ScriptedAI +
class mob_lightning_elemental : public CreatureScript { - mob_lightning_elementalAI(Creature *c) : ScriptedAI(c) - { - Charge(); - } +public: + mob_lightning_elemental() : CreatureScript("mob_lightning_elemental") { } - void Charge() + CreatureAI* GetAI(Creature* pCreature) const { - Unit* pTarget = me->SelectNearestTarget(); - me->AddThreat(pTarget, 5000000.0f); - AttackStart(pTarget); + return new mob_lightning_elementalAI (pCreature); } - void UpdateAI(const uint32 /*diff*/) + struct mob_lightning_elementalAI : public ScriptedAI { - if (!me->isInCombat()) - return; + mob_lightning_elementalAI(Creature *c) : ScriptedAI(c) + { + Charge(); + } - if (!UpdateVictim()) - return; + void Charge() + { + Unit* pTarget = me->SelectNearestTarget(); + me->AddThreat(pTarget, 5000000.0f); + AttackStart(pTarget); + } - if (me->IsWithinMeleeRange(me->getVictim())) + void UpdateAI(const uint32 /*diff*/) { - DoCast(me->getVictim(), RAID_MODE(SPELL_LIGHTNING_BLAST, SPELL_LIGHTNING_BLAST_H)); - me->Kill(me); // hack until spell works + if (!me->isInCombat()) + return; + + if (!UpdateVictim()) + return; + + if (me->IsWithinMeleeRange(me->getVictim())) + { + DoCast(me->getVictim(), RAID_MODE(SPELL_LIGHTNING_BLAST, SPELL_LIGHTNING_BLAST_H)); + me->Kill(me); // hack until spell works + } + + me->GetMotionMaster()->MoveChase(me->getVictim()); // needed at every update? } + }; - me->GetMotionMaster()->MoveChase(me->getVictim()); // needed at every update? - } }; - -struct mob_rune_of_summoningAI : public ScriptedAI +
class mob_rune_of_summoning : public CreatureScript { - mob_rune_of_summoningAI(Creature *c) : ScriptedAI(c) - { - SummonLightningElemental(); - } +public: + mob_rune_of_summoning() : CreatureScript("mob_rune_of_summoning") { } - void SummonLightningElemental() + CreatureAI* GetAI(Creature* pCreature) const { - me->SummonCreature(CREATURE_RUNE_OF_SUMMONING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); - me->DealDamage(me, me->GetHealth()); + return new mob_rune_of_summoningAI (pCreature); } -}; -struct boss_stormcaller_brundirAI : public ScriptedAI -{ - boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) + struct mob_rune_of_summoningAI : public ScriptedAI { - pInstance = c->GetInstanceData(); - } + mob_rune_of_summoningAI(Creature *c) : ScriptedAI(c) + { + SummonLightningElemental(); + } - void Reset() - { - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - me->RemoveAllAuras(); - events.Reset(); - phase = 0; - } + void SummonLightningElemental() + { + me->SummonCreature(CREATURE_RUNE_OF_SUMMONING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); + me->DealDamage(me, me->GetHealth()); + } + }; - EventMap events; - ScriptedInstance* pInstance; - uint32 phase; +}; +
class boss_stormcaller_brundir : public CreatureScript +{ +public: + boss_stormcaller_brundir() : CreatureScript("boss_stormcaller_brundir") { } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_BRUNDIR_AGGRO, me); - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); + return new boss_stormcaller_brundirAI (pCreature); } - void UpdatePhase() + struct boss_stormcaller_brundirAI : public ScriptedAI { - ++phase; - events.SetPhase(phase); - events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); - events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); - if (phase >= 2) - events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); - if (phase >= 3) + boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) { - DoCast(me, SPELL_STORMSHIELD); - events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(40000,80000)); + pInstance = c->GetInstanceScript(); } - } - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + void Reset() { - if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) - if (Steelbreaker->isAlive()) - Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); - - if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) - if (Molgeim->isAlive()) - Molgeim->SetHealth(Molgeim->GetMaxHealth()); - - DoCast(SPELL_SUPERCHARGE); + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + me->RemoveAllAuras(); + events.Reset(); + phase = 0; } - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(RAND(SAY_BRUNDIR_DEATH_1,SAY_BRUNDIR_DEATH_2), me); - if (IsEncounterComplete(pInstance, me) && pInstance) - pInstance->SetData(TYPE_ASSEMBLY, DONE); - } - void KilledUnit(Unit * /*who*/) - { - DoScriptText(RAND(SAY_BRUNDIR_SLAY_1,SAY_BRUNDIR_SLAY_2), me); - } + EventMap events; + InstanceScript* pInstance; + uint32 phase; - void SpellHit(Unit * /*from*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SUPERCHARGE) + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_BRUNDIR_AGGRO, me); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ENRAGE, 900000); UpdatePhase(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + } - events.Update(diff); + void UpdatePhase() + { + ++phase; + events.SetPhase(phase); + events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); + events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); + if (phase >= 2) + events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); + if (phase >= 3) + { + DoCast(me, SPELL_STORMSHIELD); + events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(40000,80000)); + } + } - while (uint32 eventId = events.ExecuteEvent()) + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) { - switch(eventId) + if (damage >= me->GetHealth()) { - case EVENT_ENRAGE: - DoScriptText(SAY_BRUNDIR_BERSERK, me); - DoCast(SPELL_BERSERK); - break; - case EVENT_CHAIN_LIGHTNING: - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, RAID_MODE(SPELL_CHAIN_LIGHTNING_N , SPELL_CHAIN_LIGHTNING_H)); - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); - break; - case EVENT_OVERLOAD: - DoCast(RAID_MODE(SPELL_OVERLOAD , SPELL_OVERLOAD_H)); - events.ScheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); - break; - case EVENT_LIGHTNING_WHIRL: - DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL , SPELL_LIGHTNING_WHIRL_H)); - events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); - break; - case EVENT_LIGHTNING_TENDRILS: - DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H)); - events.DelayEvents(15000, 5000); - DoResetThreat(); - break; + if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) + if (Steelbreaker->isAlive()) + Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); + + if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) + if (Molgeim->isAlive()) + Molgeim->SetHealth(Molgeim->GetMaxHealth()); + + DoCast(SPELL_SUPERCHARGE); } } - DoMeleeAttackIfReady(); - } -}; + void JustDied(Unit* /*Killer*/) + { + DoScriptText(RAND(SAY_BRUNDIR_DEATH_1,SAY_BRUNDIR_DEATH_2), me); + if (IsEncounterComplete(pInstance, me) && pInstance) + pInstance->SetData(TYPE_ASSEMBLY, DONE); + } -CreatureAI* GetAI_boss_steelbreaker(Creature* pCreature) -{ - return new boss_steelbreakerAI (pCreature); -} + void KilledUnit(Unit * /*who*/) + { + DoScriptText(RAND(SAY_BRUNDIR_SLAY_1,SAY_BRUNDIR_SLAY_2), me); + } -CreatureAI* GetAI_boss_runemaster_molgeim(Creature* pCreature) -{ - return new boss_runemaster_molgeimAI (pCreature); -} + void SpellHit(Unit * /*from*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } -CreatureAI* GetAI_boss_stormcaller_brundir(Creature* pCreature) -{ - return new boss_stormcaller_brundirAI (pCreature); -} + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; -CreatureAI* GetAI_mob_lightning_elemental(Creature* pCreature) -{ - return new mob_lightning_elementalAI (pCreature); -} + events.Update(diff); -CreatureAI* GetAI_mob_rune_of_summoning(Creature* pCreature) -{ - return new mob_rune_of_summoningAI (pCreature); -} + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ENRAGE: + DoScriptText(SAY_BRUNDIR_BERSERK, me); + DoCast(SPELL_BERSERK); + break; + case EVENT_CHAIN_LIGHTNING: + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, RAID_MODE(SPELL_CHAIN_LIGHTNING_N , SPELL_CHAIN_LIGHTNING_H)); + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); + break; + case EVENT_OVERLOAD: + DoCast(RAID_MODE(SPELL_OVERLOAD , SPELL_OVERLOAD_H)); + events.ScheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); + break; + case EVENT_LIGHTNING_WHIRL: + DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL , SPELL_LIGHTNING_WHIRL_H)); + events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); + break; + case EVENT_LIGHTNING_TENDRILS: + DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H)); + events.DelayEvents(15000, 5000); + DoResetThreat(); + break; + } + } -void AddSC_boss_assembly_of_iron() -{ - Script *newscript; + DoMeleeAttackIfReady(); + } + }; + +}; - newscript = new Script; - newscript->Name = "boss_steelbreaker"; - newscript->GetAI = &GetAI_boss_steelbreaker; - newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "boss_runemaster_molgeim"; - newscript->GetAI = &GetAI_boss_runemaster_molgeim; - newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "boss_stormcaller_brundir"; - newscript->GetAI = &GetAI_boss_stormcaller_brundir; - newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "mob_lightning_elemental"; - newscript->GetAI = &GetAI_mob_lightning_elemental; - newscript->RegisterSelf(); - newscript = new Script; - newscript->Name = "mob_rune_of_summoning"; - newscript->GetAI = &GetAI_mob_rune_of_summoning; - newscript->RegisterSelf(); +void AddSC_boss_assembly_of_iron() +{ + new boss_steelbreaker(); + new boss_runemaster_molgeim(); + new boss_stormcaller_brundir(); + new mob_lightning_elemental(); + new mob_rune_of_summoning(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp index da3d671eb6d..c259adb1d94 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp @@ -32,74 +32,75 @@ enum Yells SAY_DEATH = -1603053, SAY_BERSERK = -1603054, }; - -struct boss_auriaya_AI : public BossAI +
class boss_auriaya : public CreatureScript { - boss_auriaya_AI(Creature *pCreature) : BossAI(pCreature, TYPE_AURIAYA) - { - } - - uint32 TERRIFYING_SCREECH_Timer; - uint32 SONIC_SCREECH_Timer; +public: + boss_auriaya() : CreatureScript("boss_auriaya") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); - TERRIFYING_SCREECH_Timer = 180000; - SONIC_SCREECH_Timer = 30000; + return new boss_auriaya_AI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_auriaya_AI : public BossAI { - _EnterCombat(); - DoScriptText(SAY_AGGRO,me); - } + boss_auriaya_AI(Creature *pCreature) : BossAI(pCreature, TYPE_AURIAYA) + { + } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + uint32 TERRIFYING_SCREECH_Timer; + uint32 SONIC_SCREECH_Timer; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + void Reset() + { + _Reset(); + TERRIFYING_SCREECH_Timer = 180000; + SONIC_SCREECH_Timer = 30000; + } - void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + DoScriptText(SAY_AGGRO,me); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - if (TERRIFYING_SCREECH_Timer <= diff) + void JustDied(Unit * /*victim*/) { - DoCast(SPELL_TERRIFYING_SCREECH); - TERRIFYING_SCREECH_Timer = 180000; - } else TERRIFYING_SCREECH_Timer -= diff; + DoScriptText(SAY_DEATH, me); + _JustDied(); + } + + void MoveInLineOfSight(Unit* /*who*/) {} - if (SONIC_SCREECH_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCastVictim(SPELL_SONIC_SCREECH); - SONIC_SCREECH_Timer = 30000; - } else SONIC_SCREECH_Timer -= diff; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } -}; + if (TERRIFYING_SCREECH_Timer <= diff) + { + DoCast(SPELL_TERRIFYING_SCREECH); + TERRIFYING_SCREECH_Timer = 180000; + } else TERRIFYING_SCREECH_Timer -= diff; -CreatureAI* GetAI_boss_auriaya(Creature* pCreature) -{ - return new boss_auriaya_AI (pCreature); -} + if (SONIC_SCREECH_Timer <= diff) + { + DoCastVictim(SPELL_SONIC_SCREECH); + SONIC_SCREECH_Timer = 30000; + } else SONIC_SCREECH_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_auriaya() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_auriaya"; - newscript->GetAI = &GetAI_boss_auriaya; - newscript->RegisterSelf(); + new boss_auriaya(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp index 0d462097213..c503f909d52 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -196,1037 +196,1069 @@ const Position PosDemolisher[5] = {-756.01,-219.23,430.50,2.369}, {-798.01,-227.24,429.84,1.446}, }; - -struct boss_flame_leviathanAI : public BossAI +
class boss_flame_leviathan : public CreatureScript { - boss_flame_leviathanAI(Creature* pCreature) : BossAI(pCreature, TYPE_LEVIATHAN), vehicle(pCreature->GetVehicleKit()) - { - assert(vehicle); - pInstance = me->GetInstanceData(); - uiActiveTowers = 4; - ActiveTowers = false; - towerOfStorms = false; - towerOfLife = false; - towerOfFlames = false; - towerOfFrost = false; - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); - me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); //deathgrip - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); - } - - ScriptedInstance* pInstance; +public: + boss_flame_leviathan() : CreatureScript("boss_flame_leviathan") { } - Vehicle* vehicle; - uint8 uiActiveTowers; - bool ActiveTowers; - bool towerOfStorms; - bool towerOfLife; - bool towerOfFlames; - bool towerOfFrost; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); - /*me->SetLootMode(LOOT_MODE_HARD_MODE_4); - me->SetLootMode(LOOT_MODE_HARD_MODE_3); - me->SetLootMode(LOOT_MODE_HARD_MODE_2); - me->SetLootMode(LOOT_MODE_HARD_MODE_1);*/ - if (pInstance) - pInstance->SetData(TYPE_LEVIATHAN, NOT_STARTED); - assert(vehicle); - me->GetVehicleKit(); - me->SetReactState(REACT_DEFENSIVE); + return new boss_flame_leviathanAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_flame_leviathanAI : public BossAI { - _EnterCombat(); - pInstance->SetData(TYPE_LEVIATHAN, IN_PROGRESS); //_Reset doesnt do this correctly - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_PURSUE, 0); - events.ScheduleEvent(EVENT_MISSILE, 1500); - events.ScheduleEvent(EVENT_VENT, 20000); - events.ScheduleEvent(EVENT_SPEED, 15000); - events.ScheduleEvent(EVENT_SUMMON, 0); - if (ActiveTowers) + boss_flame_leviathanAI(Creature* pCreature) : BossAI(pCreature, TYPE_LEVIATHAN), vehicle(pCreature->GetVehicleKit()) { - if (towerOfStorms) - { - me->AddAura(SPELL_BUFF_TOWER_OF_STORMS, me); - events.ScheduleEvent(EVENT_THORIM_S_HAMMER, 35000); - } + assert(vehicle); + pInstance = me->GetInstanceScript(); + uiActiveTowers = 4; + ActiveTowers = false; + towerOfStorms = false; + towerOfLife = false; + towerOfFlames = false; + towerOfFrost = false; + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); + me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); //deathgrip - if (towerOfFlames) - { - me->AddAura(SPELL_BUFF_TOWER_OF_FLAMES, me); - events.ScheduleEvent(EVENT_MIMIRON_S_INFERNO,70000); - } + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); + } - if (towerOfFrost) - { - me->AddAura(SPELL_BUFF_TOWER_OF_FR0ST, me); - events.ScheduleEvent(EVENT_HODIR_S_FURY, 105000); - } + InstanceScript* pInstance; - if (towerOfLife) - { - me->AddAura(SPELL_BUFF_TOWER_OF_LIFE, me); - events.ScheduleEvent(EVENT_FREYA_S_WARD, 140000); - } + Vehicle* vehicle; + uint8 uiActiveTowers; + bool ActiveTowers; + bool towerOfStorms; + bool towerOfLife; + bool towerOfFlames; + bool towerOfFrost; - if (!towerOfLife && !towerOfFrost && !towerOfFlames && !towerOfStorms) - DoScriptText(SAY_TOWER_NONE, me); - else - DoScriptText(SAY_HARDMODE, me); + void Reset() + { + _Reset(); + /*me->SetLootMode(LOOT_MODE_HARD_MODE_4); + me->SetLootMode(LOOT_MODE_HARD_MODE_3); + me->SetLootMode(LOOT_MODE_HARD_MODE_2); + me->SetLootMode(LOOT_MODE_HARD_MODE_1);*/ + if (pInstance) + pInstance->SetData(TYPE_LEVIATHAN, NOT_STARTED); + assert(vehicle); + me->GetVehicleKit(); + me->SetReactState(REACT_DEFENSIVE); } - else - DoScriptText(SAY_AGGRO, me); - if (Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) - turret->AI()->DoZoneInCombat(); - } + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + pInstance->SetData(TYPE_LEVIATHAN, IN_PROGRESS); //_Reset doesnt do this correctly + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(EVENT_PURSUE, 0); + events.ScheduleEvent(EVENT_MISSILE, 1500); + events.ScheduleEvent(EVENT_VENT, 20000); + events.ScheduleEvent(EVENT_SPEED, 15000); + events.ScheduleEvent(EVENT_SUMMON, 0); + if (ActiveTowers) + { + if (towerOfStorms) + { + me->AddAura(SPELL_BUFF_TOWER_OF_STORMS, me); + events.ScheduleEvent(EVENT_THORIM_S_HAMMER, 35000); + } - // TODO: effect 0 and effect 1 may be on different target - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_PURSUED) - AttackStart(pTarget); - } + if (towerOfFlames) + { + me->AddAura(SPELL_BUFF_TOWER_OF_FLAMES, me); + events.ScheduleEvent(EVENT_MIMIRON_S_INFERNO,70000); + } + if (towerOfFrost) + { + me->AddAura(SPELL_BUFF_TOWER_OF_FR0ST, me); + events.ScheduleEvent(EVENT_HODIR_S_FURY, 105000); + } - void JustDied(Unit* /*victim*/) - { - _JustDied(); - pInstance->SetData(TYPE_LEVIATHAN, DONE); //_Reset doesnt do this correctly - DoScriptText(SAY_DEATH, me); + if (towerOfLife) + { + me->AddAura(SPELL_BUFF_TOWER_OF_LIFE, me); + events.ScheduleEvent(EVENT_FREYA_S_WARD, 140000); + } - if (ActiveTowers) - { - switch (uiActiveTowers) - { - case 4: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBIT_UARY, ACHIEV_25_ORBIT_UARY)); - break; - case 3: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_NUKED_FROM_ORBIT, ACHIEV_25_NUKED_FROM_ORBIT)); - break; - case 2: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_DEVASTATION, ACHIEV_25_ORBITAL_DEVASTATION)); - break; - case 1: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_BOMBARDMENT, ACHIEV_25_ORBITAL_BOMBARDMENT)); - break; + if (!towerOfLife && !towerOfFrost && !towerOfFlames && !towerOfStorms) + DoScriptText(SAY_TOWER_NONE, me); + else + DoScriptText(SAY_HARDMODE, me); } - } - } - - void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_START_THE_ENGINE) - vehicle->InstallAllAccessories(); - else - if (pSpell->Id == SPELL_ELECTROSHOCK) - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - } + else + DoScriptText(SAY_AGGRO, me); - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - return; + if (Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) + turret->AI()->DoZoneInCombat(); + } - if (me->getThreatManager().isThreatListEmpty()) + // TODO: effect 0 and effect 1 may be on different target + void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) { - EnterEvadeMode(); - return; + if (pSpell->Id == SPELL_PURSUED) + AttackStart(pTarget); } - events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) + void JustDied(Unit* /*victim*/) { - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - return; + _JustDied(); + pInstance->SetData(TYPE_LEVIATHAN, DONE); //_Reset doesnt do this correctly + DoScriptText(SAY_DEATH, me); + + if (ActiveTowers) + { + switch (uiActiveTowers) + { + case 4: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBIT_UARY, ACHIEV_25_ORBIT_UARY)); + break; + case 3: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_NUKED_FROM_ORBIT, ACHIEV_25_NUKED_FROM_ORBIT)); + break; + case 2: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_DEVASTATION, ACHIEV_25_ORBITAL_DEVASTATION)); + break; + case 1: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_BOMBARDMENT, ACHIEV_25_ORBITAL_BOMBARDMENT)); + break; + } + } } - else + + void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (pSpell->Id == SPELL_START_THE_ENGINE) + vehicle->InstallAllAccessories(); + else + if (pSpell->Id == SPELL_ELECTROSHOCK) + me->InterruptSpell(CURRENT_CHANNELED_SPELL); } - uint32 eventId = events.GetEvent(); - if (!me->getVictim()) - eventId = EVENT_PURSUE; - - switch(eventId) + void UpdateAI(const uint32 diff) { - case 0: break; // this is a must - case EVENT_PURSUE: - DoCastAOE(SPELL_PURSUED, true); - DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); - events.RescheduleEvent(EVENT_PURSUE, 30000); - UpdateVictim(); // begin to kill other things - if (me->getVictim()) - me->MonsterTextEmote(EMOTE_PURSUE, me->getVictim()->GetGUID(), true); - return; - case EVENT_MISSILE: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_MISSILE_BARRAGE); - events.RepeatEvent(1500); - return; - case EVENT_VENT: - DoCastAOE(SPELL_FLAME_VENTS); - events.RepeatEvent(20000); - return; - case EVENT_SPEED: - DoCastAOE(SPELL_GATHERING_SPEED); - events.RepeatEvent(15000); - return; - case EVENT_SUMMON: - if (summons.size() < 15) // 4seat+1turret+10lift - if (Creature* pLift = DoSummonFlyer(MOB_MECHANOLIFT, me, urand(20,40), 50, 0)) - pLift->GetMotionMaster()->MoveRandom(100); - events.RepeatEvent(2000); - return; - case EVENT_SHUTDOWN: - DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); - me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); - DoCast(SPELL_SYSTEMS_SHUTDOWN); - me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); - me->MonsterTextEmote(EMOTE_REPAIR, 0, true); - events.CancelEvent(EVENT_SHUTDOWN); - return; - case EVENT_THORIM_S_HAMMER: // Tower of Storms - for (uint8 i = 0; i < 7; ++i) + if (!me->isInCombat()) + return; + + if (me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return; + } + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) { - if (Creature* pThorim = DoSummon(MOB_THORIM_BEACON, me, urand(20,60), 20000, TEMPSUMMON_TIMED_DESPAWN)) - pThorim->GetMotionMaster()->MoveRandom(100); + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + return; } - DoScriptText(SAY_TOWER_STORM, me); - events.CancelEvent(EVENT_THORIM_S_HAMMER); - return; - case EVENT_MIMIRON_S_INFERNO: // Tower of Flames - me->SummonCreature(MOB_MIMIRON_BEACON, 390.93, -13.91, 409.81); - DoScriptText(SAY_TOWER_FLAME, me); - events.CancelEvent(EVENT_MIMIRON_S_INFERNO); - return; - case EVENT_HODIR_S_FURY: // Tower of Frost - for (uint8 i = 0; i < 7; ++i) + else { - if (Creature* pHodir = DoSummon(MOB_HODIR_BEACON, me, 50, 0)) - pHodir->GetMotionMaster()->MoveRandom(100); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } - DoScriptText(SAY_TOWER_FROST, me); - events.CancelEvent(EVENT_HODIR_S_FURY); - return; - case EVENT_FREYA_S_WARD: // Tower of Nature - DoScriptText(SAY_TOWER_NATURE, me); - StartFreyaEvent(); - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_FREYA_S_WARD); - events.CancelEvent(EVENT_FREYA_S_WARD); - return; - default: - events.PopEvent(); - break; - } - if (me->IsWithinMeleeRange(me->getVictim())) - DoSpellAttackIfReady(SPELL_BATTERING_RAM); - } - void StartFreyaEvent()//summon these 4 on each corner wich wil spawn additional hostile mobs - { - me->SummonCreature(MOB_FREYA_BEACON, 377.02, -119.10, 409.81); - me->SummonCreature(MOB_FREYA_BEACON, 377.02, 54.78, 409.81); - me->SummonCreature(MOB_FREYA_BEACON, 185.62, 54.78, 409.81); - me->SummonCreature(MOB_FREYA_BEACON, 185.62, -119.10, 409.81); - } + uint32 eventId = events.GetEvent(); + if (!me->getVictim()) + eventId = EVENT_PURSUE; - void DoAction(const int32 uiAction) - { - // Start encounter - if (uiAction == 10) + switch(eventId) + { + case 0: break; // this is a must + case EVENT_PURSUE: + DoCastAOE(SPELL_PURSUED, true); + DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); + events.RescheduleEvent(EVENT_PURSUE, 30000); + UpdateVictim(); // begin to kill other things + if (me->getVictim()) + me->MonsterTextEmote(EMOTE_PURSUE, me->getVictim()->GetGUID(), true); + return; + case EVENT_MISSILE: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_MISSILE_BARRAGE); + events.RepeatEvent(1500); + return; + case EVENT_VENT: + DoCastAOE(SPELL_FLAME_VENTS); + events.RepeatEvent(20000); + return; + case EVENT_SPEED: + DoCastAOE(SPELL_GATHERING_SPEED); + events.RepeatEvent(15000); + return; + case EVENT_SUMMON: + if (summons.size() < 15) // 4seat+1turret+10lift + if (Creature* pLift = DoSummonFlyer(MOB_MECHANOLIFT, me, urand(20,40), 50, 0)) + pLift->GetMotionMaster()->MoveRandom(100); + events.RepeatEvent(2000); + return; + case EVENT_SHUTDOWN: + DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); + me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); + DoCast(SPELL_SYSTEMS_SHUTDOWN); + me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); + me->MonsterTextEmote(EMOTE_REPAIR, 0, true); + events.CancelEvent(EVENT_SHUTDOWN); + return; + case EVENT_THORIM_S_HAMMER: // Tower of Storms + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* pThorim = DoSummon(MOB_THORIM_BEACON, me, urand(20,60), 20000, TEMPSUMMON_TIMED_DESPAWN)) + pThorim->GetMotionMaster()->MoveRandom(100); + } + DoScriptText(SAY_TOWER_STORM, me); + events.CancelEvent(EVENT_THORIM_S_HAMMER); + return; + case EVENT_MIMIRON_S_INFERNO: // Tower of Flames + me->SummonCreature(MOB_MIMIRON_BEACON, 390.93, -13.91, 409.81); + DoScriptText(SAY_TOWER_FLAME, me); + events.CancelEvent(EVENT_MIMIRON_S_INFERNO); + return; + case EVENT_HODIR_S_FURY: // Tower of Frost + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* pHodir = DoSummon(MOB_HODIR_BEACON, me, 50, 0)) + pHodir->GetMotionMaster()->MoveRandom(100); + } + DoScriptText(SAY_TOWER_FROST, me); + events.CancelEvent(EVENT_HODIR_S_FURY); + return; + case EVENT_FREYA_S_WARD: // Tower of Nature + DoScriptText(SAY_TOWER_NATURE, me); + StartFreyaEvent(); + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_FREYA_S_WARD); + events.CancelEvent(EVENT_FREYA_S_WARD); + return; + default: + events.PopEvent(); + break; + } + if (me->IsWithinMeleeRange(me->getVictim())) + DoSpellAttackIfReady(SPELL_BATTERING_RAM); + } + + void StartFreyaEvent()//summon these 4 on each corner wich wil spawn additional hostile mobs { - me->SetHomePosition(354.8771, -12.90240, 409.803, 0); - me->GetMotionMaster()->MoveCharge(354.8771, -12.90240, 409.803); //position center - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - DoZoneInCombat(); - return; + me->SummonCreature(MOB_FREYA_BEACON, 377.02, -119.10, 409.81); + me->SummonCreature(MOB_FREYA_BEACON, 377.02, 54.78, 409.81); + me->SummonCreature(MOB_FREYA_BEACON, 185.62, 54.78, 409.81); + me->SummonCreature(MOB_FREYA_BEACON, 185.62, -119.10, 409.81); } - if (uiAction && uiAction <= 4) // Tower destruction, debuff leviathan loot and reduce active tower + void DoAction(const int32 uiAction) { - if (me->HasLootMode(31) && uiActiveTowers == 4) - { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_4); - --uiActiveTowers; - } - if (me->HasLootMode(15) && uiActiveTowers == 3) + // Start encounter + if (uiAction == 10) { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); - --uiActiveTowers; + me->SetHomePosition(354.8771, -12.90240, 409.803, 0); + me->GetMotionMaster()->MoveCharge(354.8771, -12.90240, 409.803); //position center + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + DoZoneInCombat(); + return; } - if (me->HasLootMode(7) && uiActiveTowers == 2) + + if (uiAction && uiAction <= 4) // Tower destruction, debuff leviathan loot and reduce active tower { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); - --uiActiveTowers; + if (me->HasLootMode(31) && uiActiveTowers == 4) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_4); + --uiActiveTowers; + } + if (me->HasLootMode(15) && uiActiveTowers == 3) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); + --uiActiveTowers; + } + if (me->HasLootMode(7) && uiActiveTowers == 2) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); + --uiActiveTowers; + } + if (me->HasLootMode(3) && uiActiveTowers == 1) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); + --uiActiveTowers; + } } - if (me->HasLootMode(3) && uiActiveTowers == 1) + + switch (uiAction) { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); - --uiActiveTowers; + case 0: // Activate hard-mode setting counter to 4 towers, enable all towers apply buffs on levithian + ActiveTowers = true; + towerOfStorms = true; + towerOfLife = true; + towerOfFlames = true; + towerOfFrost = true; + me->SetLootMode(31); + break; + case 1: // Tower of Storms destroyed + towerOfStorms = false; + break; + case 2: // Tower of Flames destroyed + towerOfFlames = false; + break; + case 3: // Tower of Frost destroyed + towerOfFrost = false; + break; + case 4: // Tower of Nature destroyed + towerOfLife = false; + break; + case 9: // Schedule event + events.ScheduleEvent(EVENT_SHUTDOWN, 0); + break; } } + }; - switch (uiAction) - { - case 0: // Activate hard-mode setting counter to 4 towers, enable all towers apply buffs on levithian - ActiveTowers = true; - towerOfStorms = true; - towerOfLife = true; - towerOfFlames = true; - towerOfFrost = true; - me->SetLootMode(31); - break; - case 1: // Tower of Storms destroyed - towerOfStorms = false; - break; - case 2: // Tower of Flames destroyed - towerOfFlames = false; - break; - case 3: // Tower of Frost destroyed - towerOfFrost = false; - break; - case 4: // Tower of Nature destroyed - towerOfLife = false; - break; - case 9: // Schedule event - events.ScheduleEvent(EVENT_SHUTDOWN, 0); - break; - } - } }; //#define BOSS_DEBUG - -struct boss_flame_leviathan_seatAI : public PassiveAI +
class boss_flame_leviathan_seat : public CreatureScript { - boss_flame_leviathan_seatAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) - { - assert(vehicle); -#ifdef BOSS_DEBUG - me->SetReactState(REACT_AGGRESSIVE); -#endif - } - - Vehicle* vehicle; +public: + boss_flame_leviathan_seat() : CreatureScript("boss_flame_leviathan_seat") { } -#ifdef BOSS_DEBUG - void MoveInLineOfSight(Unit *who) + CreatureAI* GetAI(Creature* pCreature) const { - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster() - && !who->GetVehicle() && vehicle->GetPassenger(SEAT_TURRET)) - who->EnterVehicle(vehicle, SEAT_PLAYER); + return new boss_flame_leviathan_seatAI (pCreature); } -#endif - void PassengerBoarded(Unit* who, int8 seatId, bool apply) + struct boss_flame_leviathan_seatAI : public PassiveAI { - if (!me->GetVehicle()) - return; + boss_flame_leviathan_seatAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) + { + assert(vehicle); + #ifdef BOSS_DEBUG + me->SetReactState(REACT_AGGRESSIVE); + #endif + } + + Vehicle* vehicle; + + #ifdef BOSS_DEBUG + void MoveInLineOfSight(Unit *who) + { + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster() + && !who->GetVehicle() && vehicle->GetPassenger(SEAT_TURRET)) + who->EnterVehicle(vehicle, SEAT_PLAYER); + } + #endif - if (seatId == SEAT_PLAYER) + void PassengerBoarded(Unit* who, int8 seatId, bool apply) { - if (!apply) + if (!me->GetVehicle()) return; - if (Creature* turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) - { - turret->setFaction(me->GetVehicleBase()->getFaction()); - turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable - turret->AI()->AttackStart(who); - } - if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) - { - device->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } - else - if (seatId == SEAT_TURRET) + if (seatId == SEAT_PLAYER) { - if (apply) + if (!apply) return; + + if (Creature* turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) + { + turret->setFaction(me->GetVehicleBase()->getFaction()); + turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + turret->AI()->AttackStart(who); + } if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) { - device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + device->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } - } -}; + else + if (seatId == SEAT_TURRET) + { + if (apply) + return; + if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) + { + device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + } + } + } + }; -struct boss_flame_leviathan_defense_turretAI : public TurretAI +}; +
class boss_flame_leviathan_defense_turret : public CreatureScript { - boss_flame_leviathan_defense_turretAI(Creature *c) : TurretAI(c) {} +public: + boss_flame_leviathan_defense_turret() : CreatureScript("boss_flame_leviathan_defense_turret") { } - void DamageTaken(Unit* who, uint32 &damage) + CreatureAI* GetAI(Creature* pCreature) const { - if (!CanAIAttack(who)) - damage = 0; + return new boss_flame_leviathan_defense_turretAI (pCreature); } - bool CanAIAttack(const Unit *who) const + struct boss_flame_leviathan_defense_turretAI : public TurretAI { - if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) - return false; - return true; - } -}; + boss_flame_leviathan_defense_turretAI(Creature *c) : TurretAI(c) {} -struct boss_flame_leviathan_overload_deviceAI : public PassiveAI + void DamageTaken(Unit* who, uint32 &damage) + { + if (!CanAIAttack(who)) + damage = 0; + } + + bool CanAIAttack(const Unit *who) const + { + if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) + return false; + return true; + } + }; + +}; +
class boss_flame_leviathan_overload_device : public CreatureScript { - boss_flame_leviathan_overload_deviceAI(Creature* pCreature) : PassiveAI(pCreature) +public: + boss_flame_leviathan_overload_device() : CreatureScript("boss_flame_leviathan_overload_device") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_flame_leviathan_overload_deviceAI (pCreature); } - ScriptedInstance *pInstance; - - void DoAction(const int32 param) + struct boss_flame_leviathan_overload_deviceAI : public PassiveAI { - if (param == EVENT_SPELLCLICK) + boss_flame_leviathan_overload_deviceAI(Creature* pCreature) : PassiveAI(pCreature) { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pInstance->instance->GetCreature(TYPE_LEVIATHAN)->AI()->DoAction(9); //should be called if all 3 overload devices are active - if (me->GetVehicle()) + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void DoAction(const int32 param) + { + if (param == EVENT_SPELLCLICK) { - if (Unit* pPlayer = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pInstance->instance->GetCreature(TYPE_LEVIATHAN)->AI()->DoAction(9); //should be called if all 3 overload devices are active + if (me->GetVehicle()) { - pPlayer->ExitVehicle(); - me->GetVehicleBase()->CastSpell(pPlayer, SPELL_SMOKE_TRAIL, true); - if (Unit* leviathan = me->GetVehicleBase()->GetVehicleBase()) - pPlayer->GetMotionMaster()->MoveKnockbackFrom(leviathan->GetPositionX(), leviathan->GetPositionY(), 30, 30); + if (Unit* pPlayer = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) + { + pPlayer->ExitVehicle(); + me->GetVehicleBase()->CastSpell(pPlayer, SPELL_SMOKE_TRAIL, true); + if (Unit* leviathan = me->GetVehicleBase()->GetVehicleBase()) + pPlayer->GetMotionMaster()->MoveKnockbackFrom(leviathan->GetPositionX(), leviathan->GetPositionY(), 30, 30); + } } } } - } -}; + }; -struct boss_flame_leviathan_safety_containerAI : public PassiveAI +}; +
class boss_flame_leviathan_safety_container : public CreatureScript { - boss_flame_leviathan_safety_containerAI(Creature* pCreature) : PassiveAI(pCreature) - { - } +public: + boss_flame_leviathan_safety_container() : CreatureScript("boss_flame_leviathan_safety_container") { } - void JustDied() + CreatureAI* GetAI(Creature* pCreature) const { - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); + return new boss_flame_leviathan_safety_containerAI(pCreature); } - void UpdateAI(const uint32 diff) - { - } -}; -struct npc_mechanoliftAI : public PassiveAI -{ - npc_mechanoliftAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) + struct boss_flame_leviathan_safety_containerAI : public PassiveAI { - assert(vehicle); - } + boss_flame_leviathan_safety_containerAI(Creature* pCreature) : PassiveAI(pCreature) + { + } + + void JustDied() + { + float x,y,z; + me->GetPosition(x,y,z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + me->GetMap()->CreatureRelocation(me, x,y,z,0); + } - Vehicle* vehicle; + void UpdateAI(const uint32 diff) + { + } + };
}; - uint32 MoveTimer; +class npc_mechanolift : public CreatureScript +{ +public: + npc_mechanolift() : CreatureScript("npc_mechanolift") { } - void Reset () + CreatureAI* GetAI(Creature* pCreature) const { - MoveTimer = 0; - me->GetMotionMaster()->MoveRandom(50); + return new npc_mechanoliftAI(pCreature); } - void JustDied(Unit* pKiller) + struct npc_mechanoliftAI : public PassiveAI { - me->GetMotionMaster()->MoveTargetedHome(); - Creature* pLiquid = DoSummon(MOB_LIQUID, me, 0); - if (pLiquid) + npc_mechanoliftAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) { - pLiquid->CastSpell(pLiquid, SPELL_LIQUID_PYRITE, true); - pLiquid->GetMotionMaster()->MoveFall(pKiller->GetPositionZ()); + assert(vehicle); } - } + Vehicle* vehicle; - void MovementInform(uint32 type, uint32 id) - { - if (id == 1) + uint32 MoveTimer; + + void Reset () { - Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 5, true); - if (pContainer) - pContainer->EnterVehicle(me); + MoveTimer = 0; + me->GetMotionMaster()->MoveRandom(50); } - } - void UpdateAI(const uint32 diff) - { - if (MoveTimer <= diff) + void JustDied(Unit* pKiller) { - if (me->GetVehicleKit()->HasEmptySeat(-1)) + me->GetMotionMaster()->MoveTargetedHome(); + Creature* pLiquid = DoSummon(MOB_LIQUID, me, 0); + if (pLiquid) { - Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 50, true); - if (pContainer && !pContainer->GetVehicle()) - me->GetMotionMaster()->MovePoint(1,pContainer->GetPositionX(),pContainer->GetPositionY(),pContainer->GetPositionZ()); + pLiquid->CastSpell(pLiquid, SPELL_LIQUID_PYRITE, true); + pLiquid->GetMotionMaster()->MoveFall(pKiller->GetPositionZ()); } - MoveTimer = 30000; //check next 30 seconds - } - else - MoveTimer-=diff; - } -}; + } -struct spell_pool_of_tarAI : public PassiveAI -{ - spell_pool_of_tarAI(Creature* pCreature) : PassiveAI(pCreature) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + void MovementInform(uint32 type, uint32 id) + { + if (id == 1) + { + Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 5, true); + if (pContainer) + pContainer->EnterVehicle(me); + } + } - void DamageTaken(Unit * /*who*/, uint32 &damage) - { - damage = 0; - } + void UpdateAI(const uint32 diff) + { + if (MoveTimer <= diff) + { + if (me->GetVehicleKit()->HasEmptySeat(-1)) + { + Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 50, true); + if (pContainer && !pContainer->GetVehicle()) + me->GetMotionMaster()->MovePoint(1,pContainer->GetPositionX(),pContainer->GetPositionY(),pContainer->GetPositionZ()); + } + MoveTimer = 30000; //check next 30 seconds + } + else + MoveTimer-=diff; + } + }; - void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) - { - if (pSpell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) - me->CastSpell(me, SPELL_BLAZE, true); - } }; -struct npc_colossusAI : public ScriptedAI +
class spell_pool_of_tar : public CreatureScript { - npc_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + spell_pool_of_tar() : CreatureScript("spell_pool_of_tar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new spell_pool_of_tarAI (pCreature); } - ScriptedInstance *pInstance; - - void JustDied(Unit* /*Who*/) + struct spell_pool_of_tarAI : public PassiveAI { - if (me->GetHomePosition().IsInDist(Center,50.f)) + spell_pool_of_tarAI(Creature* pCreature) : PassiveAI(pCreature) { - if (pInstance) - pInstance->SetData(TYPE_COLOSSUS,pInstance->GetData(TYPE_COLOSSUS)+1); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady() ; - } -}; + void DamageTaken(Unit * /*who*/, uint32 &damage) + { + damage = 0; + } + + void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) + { + if (pSpell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) + me->CastSpell(me, SPELL_BLAZE, true); + } + }; -struct npc_thorims_hammerAI : public ScriptedAI +}; +
class npc_colossus : public CreatureScript { - npc_thorims_hammerAI(Creature* pCreature) : ScriptedAI (pCreature) +public: + npc_colossus() : CreatureScript("npc_colossus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_BLUE, me); + return new npc_colossusAI(pCreature); } - void MoveInLineOfSight(Unit* who) + struct npc_colossusAI : public ScriptedAI { - if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,10,false)) + npc_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (Creature* pTrigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - pTrigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true); + pInstance = pCreature->GetInstanceScript(); } - } - void Reset () + InstanceScript *pInstance; + + void JustDied(Unit* /*Who*/) + { + if (me->GetHomePosition().IsInDist(Center,50.f)) + { + if (pInstance) + pInstance->SetData(TYPE_COLOSSUS,pInstance->GetData(TYPE_COLOSSUS)+1); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady() ; + } + }; + +}; +
class npc_thorims_hammer : public CreatureScript +{ +public: + npc_thorims_hammer() : CreatureScript("npc_thorims_hammer") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new npc_thorims_hammerAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_thorims_hammerAI : public ScriptedAI { - if (!me->HasAura(AURA_DUMMY_BLUE)) + npc_thorims_hammerAI(Creature* pCreature) : ScriptedAI (pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->AddAura(AURA_DUMMY_BLUE, me); + } - if (!UpdateVictim()) - return; - } -}; + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,10,false)) + { + if (Creature* pTrigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + pTrigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true); + } + } + + void Reset () + { + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_DUMMY_BLUE)) + me->AddAura(AURA_DUMMY_BLUE, me); -struct npc_mimirons_infernoAI : public npc_escortAI + if (!UpdateVictim()) + return; + } + }; + +}; +
class npc_mimirons_inferno : public CreatureScript { - npc_mimirons_infernoAI(Creature* pCreature) : npc_escortAI(pCreature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_YELLOW, me); - me->SetReactState(REACT_PASSIVE); - } +public: + npc_mimirons_inferno() : CreatureScript("npc_mimirons_inferno") { } - void WaypointReached(uint32 i) + CreatureAI* GetAI(Creature* pCreature) const { + return new npc_mimirons_infernoAI(pCreature); } - void Reset() + struct npc_mimirons_infernoAI : public npc_escortAI { - infernoTimer = 2000; - } - - uint32 infernoTimer; + npc_mimirons_infernoAI(Creature* pCreature) : npc_escortAI(pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_YELLOW, me); + me->SetReactState(REACT_PASSIVE); + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void WaypointReached(uint32 i) + { + } - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + void Reset() { - Start(false,true,0,NULL,false,true); + infernoTimer = 2000; } - else + + uint32 infernoTimer; + + void UpdateAI(const uint32 diff) { - if(infernoTimer <= diff) + npc_escortAI::UpdateAI(diff); + + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - if (Creature* pTrigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - { - pTrigger->CastSpell(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); - infernoTimer = 2000; - } + Start(false,true,0,NULL,false,true); } else - infernoTimer -= diff; + { + if(infernoTimer <= diff) + { + if (Creature* pTrigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + { + pTrigger->CastSpell(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); + infernoTimer = 2000; + } + } + else + infernoTimer -= diff; - if (!me->HasAura(AURA_DUMMY_YELLOW)) - me->AddAura(AURA_DUMMY_YELLOW, me); + if (!me->HasAura(AURA_DUMMY_YELLOW)) + me->AddAura(AURA_DUMMY_YELLOW, me); + } } - } -}; + }; +}; -struct npc_hodirs_furyAI : public ScriptedAI +
class npc_hodirs_fury : public CreatureScript { - npc_hodirs_furyAI(Creature* pCreature) : ScriptedAI (pCreature) +public: + npc_hodirs_fury() : CreatureScript("npc_hodirs_fury") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_GREEN, me); + return new npc_hodirs_furyAI(pCreature); } - void MoveInLineOfSight(Unit* who) + struct npc_hodirs_furyAI : public ScriptedAI { - if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,5,false)) + npc_hodirs_furyAI(Creature* pCreature) : ScriptedAI (pCreature) { - if (Creature* pTrigger = DoSummonFlyer(NPC_HODIR_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - pTrigger->CastSpell(who, SPELL_HODIR_S_FURY, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_GREEN, me); } - } - void Reset() - { - } + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,5,false)) + { + if (Creature* pTrigger = DoSummonFlyer(NPC_HODIR_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + pTrigger->CastSpell(who, SPELL_HODIR_S_FURY, true); + } + } - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_DUMMY_GREEN)) - me->AddAura(AURA_DUMMY_GREEN, me); + void Reset() + { + } - if (!UpdateVictim()) - return; - } -}; + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_DUMMY_GREEN)) + me->AddAura(AURA_DUMMY_GREEN, me); -struct npc_freyas_wardAI : public ScriptedAI -{ - npc_freyas_wardAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->AddAura(AURA_DUMMY_GREEN, me); - } + if (!UpdateVictim()) + return; + } + }; - uint32 summonTimer ; +}; +
class npc_freyas_ward : public CreatureScript +{ +public: + npc_freyas_ward() : CreatureScript("npc_freyas_ward") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - summonTimer = 5000 ; + return new npc_freyas_wardAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_freyas_wardAI : public ScriptedAI { - if(summonTimer <= diff) + npc_freyas_wardAI(Creature* pCreature) : ScriptedAI(pCreature) { - DoCast(SPELL_FREYA_S_WARD_EFFECT_1) ; - DoCast(SPELL_FREYA_S_WARD_EFFECT_2) ; - summonTimer = 20000 ; + me->AddAura(AURA_DUMMY_GREEN, me); } - else - summonTimer -= diff ; - if (!me->HasAura(AURA_DUMMY_GREEN)) - me->AddAura(AURA_DUMMY_GREEN, me); + uint32 summonTimer ; - if (!UpdateVictim()) - return; - } -}; + void Reset() + { + summonTimer = 5000 ; + } -struct npc_freya_ward_summonAI : public ScriptedAI -{ - npc_freya_ward_summonAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pCreature->GetMotionMaster()->MoveRandom(100); - } + void UpdateAI(const uint32 diff) + { + if(summonTimer <= diff) + { + DoCast(SPELL_FREYA_S_WARD_EFFECT_1) ; + DoCast(SPELL_FREYA_S_WARD_EFFECT_2) ; + summonTimer = 20000 ; + } + else + summonTimer -= diff ; - uint32 lashTimer ; + if (!me->HasAura(AURA_DUMMY_GREEN)) + me->AddAura(AURA_DUMMY_GREEN, me); - void Reset() + if (!UpdateVictim()) + return; + } + }; + +}; +
class npc_freya_ward_summon : public CreatureScript +{ +public: + npc_freya_ward_summon() : CreatureScript("npc_freya_ward_summon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - lashTimer = 5000 ; + return new npc_freya_ward_summonAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_freya_ward_summonAI : public ScriptedAI { - if (!UpdateVictim()) - return; - - if(lashTimer <= diff) + npc_freya_ward_summonAI(Creature* pCreature) : ScriptedAI(pCreature) { - DoCast(SPELL_LASH); - lashTimer = 20000; + pCreature->GetMotionMaster()->MoveRandom(100); } - else - lashTimer -= diff; - DoMeleeAttackIfReady(); - } -}; -//npc lore keeper -#define GOSSIP_ITEM_1 "Activate secondary defensive systems" -#define GOSSIP_ITEM_2 "Confirmed" -struct npc_lorekeeperAI : public ScriptedAI -{ - npc_lorekeeperAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } + uint32 lashTimer ; - ScriptedInstance* pInstance; + void Reset() + { + lashTimer = 5000 ; + } - void DoAction(const int32 uiAction) - { - // Start encounter - if (uiAction == 0) + void UpdateAI(const uint32 diff) { - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_SIEGE, PosSiege[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_CHOPPER, PosChopper[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_DEMOLISHER,PosDemolisher[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - return; + if (!UpdateVictim()) + return; + + if(lashTimer <= diff) + { + DoCast(SPELL_LASH); + lashTimer = 20000; + } + else + lashTimer -= diff; + + DoMeleeAttackIfReady(); } - } + }; + }; -bool GossipHello_npc_lorekeeper(Player* pPlayer, Creature* pCreature) +//npc lore keeper +#define GOSSIP_ITEM_1 "Activate secondary defensive systems" +#define GOSSIP_ITEM_2 "Confirmed"
class npc_lorekeeper : public CreatureScript { - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE && pPlayer) - { - pPlayer->PrepareGossipMenu(pCreature); +public: + npc_lorekeeper() : CreatureScript("npc_lorekeeper") { } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - return true; -} -//enable hardmode -bool GossipSelect_npc_lorekeeper(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - if (pPlayer) + InstanceScript* pInstance = pCreature->GetInstanceScript(); + switch(uiAction) { - pPlayer->PrepareGossipMenu(pCreature); - pInstance->instance->LoadGrid(364,-16); //make sure leviathan is loaded + case GOSSIP_ACTION_INFO_DEF+1: + if (pPlayer) + { + pPlayer->PrepareGossipMenu(pCreature); + pInstance->instance->LoadGrid(364,-16); //make sure leviathan is loaded - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF+2: - if (pPlayer) - pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF+2: + if (pPlayer) + pPlayer->CLOSE_GOSSIP_MENU(); - if (Creature* pLeviathan = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_LEVIATHAN))) - { - CAST_AI(boss_flame_leviathanAI, (pLeviathan->AI()))->DoAction(0); //enable hard mode activating the 4 additional events spawning additional vehicles - pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->AI()->DoAction(0); // spawn the vehicles - pCreature->SetVisibility(VISIBILITY_OFF); - if (Creature* Delorah = pCreature->FindNearestCreature(NPC_DELORAH, 1000, true)) + if (Creature* pLeviathan = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_LEVIATHAN))) { - if (Creature* Branz = pCreature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) + CAST_AI(boss_flame_leviathan::boss_flame_leviathanAI, (pLeviathan->AI()))->DoAction(0); //enable hard mode activating the 4 additional events spawning additional vehicles + pCreature->SetVisibility(VISIBILITY_OFF); + pCreature->AI()->DoAction(0); // spawn the vehicles + pCreature->SetVisibility(VISIBILITY_OFF); + if (Creature* Delorah = pCreature->FindNearestCreature(NPC_DELORAH, 1000, true)) { - Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); - //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz + if (Creature* Branz = pCreature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) + { + Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); + //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz + } } } - } - break; - } - return true; -} -////npc_brann_bronzebeard this requires more work involving area triggers. if reached this guy speaks through his radio.. -//#define GOSSIP_ITEM_1 "xxxxx" -//#define GOSSIP_ITEM_2 "xxxxx" -// -//bool GossipHello_npc_brann_bronzebeard(Player* pPlayer, Creature* pCreature) -//{ -// ScriptedInstance* pInstance = pCreature->GetInstanceData(); -// if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE) -// { -// pPlayer->PrepareGossipMenu(pCreature); -// -// pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); -// pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -// } -// return true; -//} -// -//bool GossipSelect_npc_brann_bronzebeard(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -//{ -// switch(uiAction) -// { -// case GOSSIP_ACTION_INFO_DEF+1: -// if (pPlayer) -// { -// pPlayer->PrepareGossipMenu(pCreature); -// -// pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); -// pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -// } -// break; -// case GOSSIP_ACTION_INFO_DEF+2: -// if (pPlayer) -// pPlayer->CLOSE_GOSSIP_MENU(); -// if (Creature* Lorekeeper = pCreature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon -// Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); -// break; -// } -// return true; -//} - -void GODestroyed_go_ulduar_tower(Player* pPlayer, GameObject* pGO, uint32 value) -{ - ScriptedInstance* pInstance = pGO->GetInstanceData(); - if (pGO->GetGOValue()->building.health == 0) - { - switch(pGO->GetEntry()) - { - case GO_TOWER_OF_STORMS: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_STORM_DESTROYED); - break; - case GO_TOWER_OF_FLAMES: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FLAMES_DESTROYED); - break; - case GO_TOWER_OF_FROST: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FROST_DESTROYED); - break; - case GO_TOWER_OF_LIFE: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_LIFE_DESTROYED); break; } + return true; } -} -bool AreaTrigger_at_RX_214_repair_o_matic_station(Player* pPlayer, const AreaTriggerEntry* pAt) -{ - if(Creature* vehicle = pPlayer->GetVehicleCreatureBase()) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if(!vehicle->HasAura(SPELL_AUTO_REPAIR)) + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE && pPlayer) { - pPlayer->MonsterTextEmote(EMOTE_REPAIR, pPlayer->GetGUID(), true); - pPlayer->CastSpell(vehicle, SPELL_AUTO_REPAIR, true); + pPlayer->PrepareGossipMenu(pCreature); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); } + return true; } - return true; -} -CreatureAI* GetAI_boss_flame_leviathan(Creature* pCreature) -{ - return new boss_flame_leviathanAI (pCreature); -} - -CreatureAI* GetAI_boss_flame_leviathan_seat(Creature* pCreature) -{ - return new boss_flame_leviathan_seatAI (pCreature); -} - -CreatureAI* GetAI_boss_flame_leviathan_defense_turret(Creature* pCreature) -{ - return new boss_flame_leviathan_defense_turretAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_lorekeeperAI (pCreature); + } -CreatureAI* GetAI_boss_flame_leviathan_overload_device(Creature* pCreature) -{ - return new boss_flame_leviathan_overload_deviceAI (pCreature); -} + struct npc_lorekeeperAI : public ScriptedAI + { + npc_lorekeeperAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } -CreatureAI* GetAI_boss_flame_leviathan_safety_container(Creature* pCreature) -{ - return new boss_flame_leviathan_safety_containerAI(pCreature); -} + InstanceScript* pInstance; -CreatureAI* GetAI_npc_mechanolift(Creature* pCreature) -{ - return new npc_mechanoliftAI(pCreature); -} + void DoAction(const int32 uiAction) + { + // Start encounter + if (uiAction == 0) + { + for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) + DoSummon(VEHICLE_SIEGE, PosSiege[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) + DoSummon(VEHICLE_CHOPPER, PosChopper[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) + DoSummon(VEHICLE_DEMOLISHER,PosDemolisher[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + return; + } + } + }; -CreatureAI* GetAI_spell_pool_of_tar(Creature* pCreature) -{ - return new spell_pool_of_tarAI (pCreature); -} +}; -CreatureAI* GetAI_npc_colossus(Creature* pCreature) +//enable hardmode +////npc_brann_bronzebeard this requires more work involving area triggers. if reached this guy speaks through his radio.. +//#define GOSSIP_ITEM_1 "xxxxx" +//#define GOSSIP_ITEM_2 "xxxxx" +//
/*
class npc_brann_bronzebeard : public CreatureScript { - return new npc_colossusAI(pCreature); -} - -CreatureAI* GetAI_npc_thorims_hammer(Creature* pCreature) +public: + npc_brann_bronzebeard() : CreatureScript("npc_brann_bronzebeard") { } + + //bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + //{ + // switch(uiAction) + // { + // case GOSSIP_ACTION_INFO_DEF+1: + // if (pPlayer) + // { + // pPlayer->PrepareGossipMenu(pCreature); + // + // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + // } + // break; + // case GOSSIP_ACTION_INFO_DEF+2: + // if (pPlayer) + // pPlayer->CLOSE_GOSSIP_MENU(); + // if (Creature* Lorekeeper = pCreature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon + // Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + // break; + // } + // return true; + //} + //bool OnGossipHello(Player* pPlayer, Creature* pCreature) + //{ + // InstanceScript* pInstance = pCreature->GetInstanceScript(); + // if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE) + // { + // pPlayer->PrepareGossipMenu(pCreature); + // + // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + // } + // return true; + //} + //
}
*/
class go_ulduar_tower : public GameObjectScript { - return new npc_thorims_hammerAI(pCreature); -} +public: + go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { } -CreatureAI* GetAI_npc_mimirons_inferno(Creature* pCreature) -{ - return new npc_mimirons_infernoAI(pCreature); -} + void OnDestroyed(Player* pPlayer, GameObject* pGO, uint32 value) + { + InstanceScript* pInstance = pGO->GetInstanceScript(); + if (pGO->GetGOValue()->building.health == 0) + { + switch(pGO->GetEntry()) + { + case GO_TOWER_OF_STORMS: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_STORM_DESTROYED); + break; + case GO_TOWER_OF_FLAMES: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FLAMES_DESTROYED); + break; + case GO_TOWER_OF_FROST: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FROST_DESTROYED); + break; + case GO_TOWER_OF_LIFE: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_LIFE_DESTROYED); + break; + } + } + } -CreatureAI* GetAI_npc_hodirs_fury(Creature* pCreature) +}; +
class at_RX_214_repair_o_matic_station : public AreaTriggerScript { - return new npc_hodirs_furyAI(pCreature); -} +public: + at_RX_214_repair_o_matic_station() : AreaTriggerScript("at_RX_214_repair_o_matic_station") { } -CreatureAI* GetAI_npc_freyas_ward(Creature* pCreature) -{ - return new npc_freyas_wardAI(pCreature); -} + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry* pAt) + { + if(Creature* vehicle = pPlayer->GetVehicleCreatureBase()) + { + if(!vehicle->HasAura(SPELL_AUTO_REPAIR)) + { + pPlayer->MonsterTextEmote(EMOTE_REPAIR, pPlayer->GetGUID(), true); + pPlayer->CastSpell(vehicle, SPELL_AUTO_REPAIR, true); + } + } + return true; + } -CreatureAI* GetAI_npc_freya_ward_summon(Creature* pCreature) -{ - return new npc_freya_ward_summonAI (pCreature); -} -CreatureAI* GetAI_npc_lorekeeper(Creature* pCreature) -{ - return new npc_lorekeeperAI (pCreature); -} +}; void AddSC_boss_flame_leviathan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_flame_leviathan"; - newscript->GetAI = &GetAI_boss_flame_leviathan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_seat"; - newscript->GetAI = &GetAI_boss_flame_leviathan_seat; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_defense_turret"; - newscript->GetAI = &GetAI_boss_flame_leviathan_defense_turret; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_overload_device"; - newscript->GetAI = &GetAI_boss_flame_leviathan_overload_device; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_safety_container"; - newscript->GetAI = &GetAI_boss_flame_leviathan_safety_container; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mechanolift"; - newscript->GetAI = &GetAI_npc_mechanolift; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "spell_pool_of_tar"; - newscript->GetAI = &GetAI_spell_pool_of_tar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_colossus"; - newscript->GetAI = &GetAI_npc_colossus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thorims_hammer"; - newscript->GetAI = &GetAI_npc_thorims_hammer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mimirons_inferno"; - newscript->GetAI = &GetAI_npc_mimirons_inferno; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_hodirs_fury"; - newscript->GetAI = &GetAI_npc_hodirs_fury; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_freyas_ward"; - newscript->GetAI = &GetAI_npc_freyas_ward; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_freya_ward_summon"; - newscript->GetAI = &GetAI_npc_freya_ward_summon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lorekeeper"; - newscript->GetAI = &GetAI_npc_lorekeeper; - newscript->pGossipHello = &GossipHello_npc_lorekeeper; - newscript->pGossipSelect = &GossipSelect_npc_lorekeeper; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "npc_brann_bronzebeard"; - newscript->pGossipHello = &GossipHello_npc_brann_bronzebeard; - newscript->pGossipSelect = &GossipSelect_npc_brann_bronzebeard; - newscript->RegisterSelf();*/ - - newscript = new Script; - newscript->Name = "go_ulduar_tower"; - newscript->pGODestroyed = &GODestroyed_go_ulduar_tower; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_RX_214_repair_o_matic_station"; - newscript->pAreaTrigger = &AreaTrigger_at_RX_214_repair_o_matic_station; - newscript->RegisterSelf(); + new boss_flame_leviathan(); + new boss_flame_leviathan_seat(); + new boss_flame_leviathan_defense_turret(); + new boss_flame_leviathan_overload_device(); + new boss_flame_leviathan_safety_container(); + new npc_mechanolift(); + new spell_pool_of_tar(); + new npc_colossus(); + new npc_thorims_hammer(); + new npc_mimirons_inferno(); + new npc_hodirs_fury(); + new npc_freyas_ward(); + new npc_freya_ward_summon(); + new npc_lorekeeper(); + // new npc_brann_bronzebeard(); + new go_ulduar_tower(); + new at_RX_214_repair_o_matic_station(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp index df1298eb3b7..31fee5e09e2 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp @@ -63,62 +63,65 @@ enum ACHIEV_LUMBERJACKED = 21686, SPELL_LUMBERJACKED_ACHIEVEMENT_CHECK = 65296, }; - -struct boss_freyaAI : public BossAI +
class boss_freya : public CreatureScript { - boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA) - { - } +public: + boss_freya() : CreatureScript("boss_freya") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); + return new boss_freyaAI(pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_freyaAI : public BossAI { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA) + { + } + + void Reset() + { + _Reset(); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + + // cast is not rewarding the achievement. + // DoCast(SPELL_ACHIEVEMENT_CHECK); + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_ACHIEVEMENT_CHECK); + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + //SPELLS TODO: + + // + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); + } + }; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - - // cast is not rewarding the achievement. - // DoCast(SPELL_ACHIEVEMENT_CHECK); - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_ACHIEVEMENT_CHECK); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; -//SPELLS TODO: - -// - DoMeleeAttackIfReady(); - - EnterEvadeIfOutOfCombatArea(diff); - } }; -CreatureAI* GetAI_boss_freya(Creature* pCreature) -{ - return new boss_freyaAI(pCreature); -} void AddSC_boss_freya() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_freya"; - newscript->GetAI = &GetAI_boss_freya; - newscript->RegisterSelf(); + new boss_freya(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp index b43dbe82b60..1f3327381a6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp @@ -30,59 +30,61 @@ enum Yells SAY_YS_HELP = -1603217, SAY_HARD_MODE_MISSED = -1603218, }; - -struct boss_hodirAI : public BossAI +
class boss_hodir : public CreatureScript { - boss_hodirAI(Creature *pCreature) : BossAI(pCreature, TYPE_HODIR) - { - } +public: + boss_hodir() : CreatureScript("boss_hodir") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); + return new boss_hodirAI(pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_hodirAI : public BossAI { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + boss_hodirAI(Creature *pCreature) : BossAI(pCreature, TYPE_HODIR) + { + } - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + void Reset() + { + _Reset(); + } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; -//SPELLS TODO: + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } -// - DoMeleeAttackIfReady(); + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + //SPELLS TODO: + + // + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); + } + }; - EnterEvadeIfOutOfCombatArea(diff); - } }; -CreatureAI* GetAI_boss_hodir(Creature* pCreature) -{ - return new boss_hodirAI(pCreature); -} void AddSC_boss_hodir() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_hodir"; - newscript->GetAI = &GetAI_boss_hodir; - newscript->RegisterSelf(); - + new boss_hodir(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp index ac5414eaedf..01220de94d6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp @@ -39,98 +39,99 @@ enum { ACHIEV_TIMED_START_EVENT = 20951, }; - -struct boss_ignis_AI : public BossAI +
class boss_ignis : public CreatureScript { - boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {} - - uint32 uiFlameJetsTimer; - uint32 uiScorchTimer; - uint32 uiSlagPotTimer; +public: + boss_ignis() : CreatureScript("boss_ignis") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); - uiFlameJetsTimer = 32000; - uiScorchTimer = 100; - uiSlagPotTimer = 100; - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + return new boss_ignis_AI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_ignis_AI : public BossAI { - DoScriptText(SAY_AGGRO,me); - _EnterCombat(); + boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {} - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + uint32 uiFlameJetsTimer; + uint32 uiScorchTimer; + uint32 uiSlagPotTimer; - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void Reset() + { + _Reset(); + uiFlameJetsTimer = 32000; + uiScorchTimer = 100; + uiSlagPotTimer = 100; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO,me); + _EnterCombat(); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - if (me->GetPositionY() < 150 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. + void KilledUnit(Unit* /*victim*/) { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(false); - me->GetMotionMaster()->MoveTargetedHome(); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - if (uiFlameJetsTimer <= diff) + void JustDied(Unit * /*victim*/) { - DoCast(SPELL_FLAME_JETS); - uiFlameJetsTimer = 25000; - } else uiFlameJetsTimer -= diff; + DoScriptText(SAY_DEATH, me); + _JustDied(); + } - if (uiScorchTimer <= diff) - { - DoScriptText(RAND(SAY_SCORCH_1,SAY_SCORCH_2), me); - DoCast(SPELL_SCORCH); - uiScorchTimer = 20000; - } else uiScorchTimer -= diff; + void MoveInLineOfSight(Unit* /*who*/) {} - if (uiSlagPotTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!UpdateVictim()) + return; + + if (me->GetPositionY() < 150 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. { - DoScriptText(SAY_SLAG_POT, me); - DoCast(pTarget, SPELL_SLAG_POT); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(false); + me->GetMotionMaster()->MoveTargetedHome(); } - uiSlagPotTimer = 30000; - } else uiSlagPotTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + if (uiFlameJetsTimer <= diff) + { + DoCast(SPELL_FLAME_JETS); + uiFlameJetsTimer = 25000; + } else uiFlameJetsTimer -= diff; -CreatureAI* GetAI_boss_ignis(Creature* pCreature) -{ - return new boss_ignis_AI (pCreature); -} + if (uiScorchTimer <= diff) + { + DoScriptText(RAND(SAY_SCORCH_1,SAY_SCORCH_2), me); + DoCast(SPELL_SCORCH); + uiScorchTimer = 20000; + } else uiScorchTimer -= diff; + + if (uiSlagPotTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(SAY_SLAG_POT, me); + DoCast(pTarget, SPELL_SLAG_POT); + } + uiSlagPotTimer = 30000; + } else uiSlagPotTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_ignis() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ignis"; - newscript->GetAI = &GetAI_boss_ignis; - newscript->RegisterSelf(); + new boss_ignis(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp index 710484de42c..d8f7a3eb6e7 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp @@ -53,113 +53,116 @@ enum { ACHIEV_DISARMED_START_EVENT = 21687, }; - -struct boss_kologarnAI : public BossAI +
class boss_kologarn : public CreatureScript { - boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(pCreature->GetVehicleKit()), - left(false), right(false) - { - assert(vehicle); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // i think this is a hack, but there is no other way to disable his rotation - } - - Vehicle *vehicle; - bool left, right; - - void AttackStart(Unit *who) - { - me->Attack(who, true); - } +public: + boss_kologarn() : CreatureScript("boss_kologarn") { } - void JustDied(Unit * /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_DEATH, me); - _JustDied(); + return new boss_kologarnAI (pCreature); } - void KilledUnit(Unit* /*who*/) + struct boss_kologarnAI : public BossAI { - DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_2), me); - } - - void PassengerBoarded(Unit *who, int8 /*seatId*/, bool apply) - { - if (who->GetTypeId() == TYPEID_UNIT) + boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(pCreature->GetVehicleKit()), + left(false), right(false) { - if (who->GetEntry() == 32933) - left = apply; - else if (who->GetEntry() == 32934) - right = apply; + assert(vehicle); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // i think this is a hack, but there is no other way to disable his rotation + } - if (!apply && instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); + Vehicle *vehicle; + bool left, right; - who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - CAST_CRE(who)->SetReactState(REACT_PASSIVE); + void AttackStart(Unit *who) + { + me->Attack(who, true); } - } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - events.ScheduleEvent(EVENT_SMASH, 5000); - events.ScheduleEvent(EVENT_SWEEP, 10000); - events.ScheduleEvent(EVENT_GRIP, 15000); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void KilledUnit(Unit* /*who*/) + { + DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_2), me); + } - events.Update(diff); + void PassengerBoarded(Unit *who, int8 /*seatId*/, bool apply) + { + if (who->GetTypeId() == TYPEID_UNIT) + { + if (who->GetEntry() == 32933) + left = apply; + else if (who->GetEntry() == 32934) + right = apply; + + if (!apply && instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); + + who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + CAST_CRE(who)->SetReactState(REACT_PASSIVE); + } + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + events.ScheduleEvent(EVENT_SMASH, 5000); + events.ScheduleEvent(EVENT_SWEEP, 10000); + events.ScheduleEvent(EVENT_GRIP, 15000); + } - // TODO: because we are using hack, he is stunned and cannot cast, so we use triggered for every spell - switch(events.GetEvent()) + void UpdateAI(const uint32 diff) { - case EVENT_NONE: - break; - case EVENT_SMASH: - if (left && right) - DoCastVictim(SPELL_TWO_ARM_SMASH, true); - else if (left || right) - DoCastVictim(SPELL_ONE_ARM_SMASH, true); - events.RepeatEvent(15000); - break; - case EVENT_SWEEP: - if (left) - DoCastAOE(SPELL_ARM_SWEEP, true); - events.RepeatEvent(15000); - break; - case EVENT_GRIP: - if (right) - DoCastAOE(SPELL_STONE_GRIP, true); - events.RepeatEvent(15000); - break; - default: - events.PopEvent(); - break; + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + // TODO: because we are using hack, he is stunned and cannot cast, so we use triggered for every spell + switch(events.GetEvent()) + { + case EVENT_NONE: + break; + case EVENT_SMASH: + if (left && right) + DoCastVictim(SPELL_TWO_ARM_SMASH, true); + else if (left || right) + DoCastVictim(SPELL_ONE_ARM_SMASH, true); + events.RepeatEvent(15000); + break; + case EVENT_SWEEP: + if (left) + DoCastAOE(SPELL_ARM_SWEEP, true); + events.RepeatEvent(15000); + break; + case EVENT_GRIP: + if (right) + DoCastAOE(SPELL_STONE_GRIP, true); + events.RepeatEvent(15000); + break; + default: + events.PopEvent(); + break; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kologarn(Creature* pCreature) -{ - return new boss_kologarnAI (pCreature); -} void AddSC_boss_kologarn() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kologarn"; - newscript->GetAI = &GetAI_boss_kologarn; - newscript->RegisterSelf(); + new boss_kologarn(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp index bf4ddae9e99..0af01cecd5d 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp @@ -46,285 +46,288 @@ enum Mobs { NPC_DARK_RUNE_SENTINEL = 33846 }; - -struct boss_razorscaleAI : public BossAI +
class boss_razorscale : public CreatureScript { - boss_razorscaleAI(Creature *pCreature) : BossAI(pCreature, TYPE_RAZORSCALE) {} - - uint8 Phase; - - uint32 FlameBreathTimer; - uint32 FuseArmorTimer; - uint32 DevouringFlameTimer; - uint32 FlameBuffetTimer; - uint32 SummonAddsTimer; - uint32 WingBuffetTimer; - uint32 FireballTimer; - //uint32 StunTimer; - //uint32 CastSpellsTimer; +public: + boss_razorscale() : CreatureScript("boss_razorscale") { } - bool InitialSpawn; - bool IsFlying; + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_razorscaleAI (pCreature); + } - void Reset() + struct boss_razorscaleAI : public BossAI { - Phase = 1; + boss_razorscaleAI(Creature *pCreature) : BossAI(pCreature, TYPE_RAZORSCALE) {} - FlyPhase(Phase, 0); + uint8 Phase; - FlameBreathTimer = 20000; - DevouringFlameTimer = 2000; - FuseArmorTimer = 15000; - FlameBuffetTimer = 3000; - SummonAddsTimer = 45000; - WingBuffetTimer = 17000; - FireballTimer = 18000; - //StunTimer = 30000; - //CastSpellsTimer = 0; + uint32 FlameBreathTimer; + uint32 FuseArmorTimer; + uint32 DevouringFlameTimer; + uint32 FlameBuffetTimer; + uint32 SummonAddsTimer; + uint32 WingBuffetTimer; + uint32 FireballTimer; + //uint32 StunTimer; + //uint32 CastSpellsTimer; - InitialSpawn = true; - IsFlying = true; + bool InitialSpawn; + bool IsFlying; - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); - } + void Reset() + { + Phase = 1; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - } + FlyPhase(Phase, 0); - void JustDied(Unit* /*Killer*/) - { - } + FlameBreathTimer = 20000; + DevouringFlameTimer = 2000; + FuseArmorTimer = 15000; + FlameBuffetTimer = 3000; + SummonAddsTimer = 45000; + WingBuffetTimer = 17000; + FireballTimer = 18000; + //StunTimer = 30000; + //CastSpellsTimer = 0; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + InitialSpawn = true; + IsFlying = true; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + } - if (me->GetPositionY() > -60 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. + void EnterCombat(Unit* /*who*/) { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(false); - me->GetMotionMaster()->MoveTargetedHome(); + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); } - // Victim is not controlled by a player (should never happen) - if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) - me->Kill(me->getVictim()); - - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 99 && Phase == 1) // TODO: Only land (exit Phase 1) if brought down with harpoon guns! This is important! + void JustDied(Unit* /*Killer*/) { - Phase = 2; - DoScriptText(SAY_PHASE_2_TRANS, me); // Audio: "Move quickly! She won't remain grounded for long!" } - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 33 && Phase == 2) // Health under 33%, Razorscale can't fly anymore. + void KilledUnit(Unit * /*victim*/) { - Phase = 3; - DoScriptText(SAY_PHASE_3_TRANS, me); // "Razorscale lands permanently!" - // TODO: Cast Devouring Flame on all harpoon guns simultaneously, briefly after Phase 3 starts (lasts until the harpoon guns are destroyed) + DoScriptText(SAY_KILL, me); } - /* - if (Phase == 2 && CastSpellsTimer > 0) // 5 seconds of spell casting, after stun breaks, during Phase 2 + void UpdateAI(const uint32 diff) { - if (CastSpellsTimer <= diff) // 5 seconds are up - Phase = 1; // Return to phase 1 - else - CastSpellsTimer -= diff; - }*/ + if (!UpdateVictim()) + return; - FlyPhase(Phase, diff); + if (me->GetPositionY() > -60 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. + { + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(false); + me->GetMotionMaster()->MoveTargetedHome(); + } - if (Phase >= 2) // Ground Phase (Phase 3 = permanent ground phase) - { - if (FuseArmorTimer <= diff) + // Victim is not controlled by a player (should never happen) + if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->Kill(me->getVictim()); + + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 99 && Phase == 1) // TODO: Only land (exit Phase 1) if brought down with harpoon guns! This is important! { - DoCastVictim(SPELL_FUSEARMOR); - FuseArmorTimer = 10000; - } else FuseArmorTimer -= diff; + Phase = 2; + DoScriptText(SAY_PHASE_2_TRANS, me); // Audio: "Move quickly! She won't remain grounded for long!" + } - if (WingBuffetTimer <= diff) + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 33 && Phase == 2) // Health under 33%, Razorscale can't fly anymore. { - DoCast(SPELL_WINGBUFFET); - WingBuffetTimer = urand(7000,14000); - } else WingBuffetTimer -= diff; + Phase = 3; + DoScriptText(SAY_PHASE_3_TRANS, me); // "Razorscale lands permanently!" + // TODO: Cast Devouring Flame on all harpoon guns simultaneously, briefly after Phase 3 starts (lasts until the harpoon guns are destroyed) + } - if (FireballTimer <= diff) + /* + if (Phase == 2 && CastSpellsTimer > 0) // 5 seconds of spell casting, after stun breaks, during Phase 2 { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) - { - me->SetInFront(pTarget); - DoCast(pTarget, SPELL_FIREBALL); - } + if (CastSpellsTimer <= diff) // 5 seconds are up + Phase = 1; // Return to phase 1 + else + CastSpellsTimer -= diff; + }*/ - FireballTimer = 18000; - } else FireballTimer -= diff; + FlyPhase(Phase, diff); - if (FlameBreathTimer <= diff) + if (Phase >= 2) // Ground Phase (Phase 3 = permanent ground phase) { - DoScriptText(EMOTE_BREATH, me); // TODO: "Razorscale takes a deep breath..." - DoCastVictim(SPELL_FLAMEBREATH); - FlameBreathTimer = 15000; - WingBuffetTimer = 0; - } else FlameBreathTimer -= diff; + if (FuseArmorTimer <= diff) + { + DoCastVictim(SPELL_FUSEARMOR); + FuseArmorTimer = 10000; + } else FuseArmorTimer -= diff; - if (Phase == 3) - { - if (FlameBuffetTimer <= diff) + if (WingBuffetTimer <= diff) + { + DoCast(SPELL_WINGBUFFET); + WingBuffetTimer = urand(7000,14000); + } else WingBuffetTimer -= diff; + + if (FireballTimer <= diff) { - DoScriptText(EMOTE_BREATH, me); - std::list<Unit*> pTargets; - SelectTargetList(pTargets, RAID_MODE(3,9), SELECT_TARGET_RANDOM, 100, true); - uint8 i = 0; - for (std::list<Unit*>::const_iterator itr = pTargets.begin(); itr != pTargets.end();) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) { - if (me->HasInArc(M_PI, *itr)) - { - DoCast(*itr, SPELL_FLAMEBUFFET, true); - ++i; - } - if (++itr == pTargets.end() || i == RAID_MODE(3,9)) - { - AttackStart(*--itr); // seems to attack targets randomly during perma-ground phase.. - break; - } + me->SetInFront(pTarget); + DoCast(pTarget, SPELL_FIREBALL); } - FlameBuffetTimer = 25000; - } else FlameBuffetTimer -= diff; - } - DoMeleeAttackIfReady(); - } - else if (Phase == 1) //Flying Phase - { - if (InitialSpawn) - SummonAdds(); + FireballTimer = 18000; + } else FireballTimer -= diff; - InitialSpawn = false; + if (FlameBreathTimer <= diff) + { + DoScriptText(EMOTE_BREATH, me); // TODO: "Razorscale takes a deep breath..." + DoCastVictim(SPELL_FLAMEBREATH); + FlameBreathTimer = 15000; + WingBuffetTimer = 0; + } else FlameBreathTimer -= diff; - if (FireballTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + if (Phase == 3) { - me->SetInFront(pTarget); - DoCast(pTarget, SPELL_FIREBALL); + if (FlameBuffetTimer <= diff) + { + DoScriptText(EMOTE_BREATH, me); + std::list<Unit*> pTargets; + SelectTargetList(pTargets, RAID_MODE(3,9), SELECT_TARGET_RANDOM, 100, true); + uint8 i = 0; + for (std::list<Unit*>::const_iterator itr = pTargets.begin(); itr != pTargets.end();) + { + if (me->HasInArc(M_PI, *itr)) + { + DoCast(*itr, SPELL_FLAMEBUFFET, true); + ++i; + } + if (++itr == pTargets.end() || i == RAID_MODE(3,9)) + { + AttackStart(*--itr); // seems to attack targets randomly during perma-ground phase.. + break; + } + } + FlameBuffetTimer = 25000; + } else FlameBuffetTimer -= diff; } - FireballTimer = 18000; - } else FireballTimer -= diff; - - if (DevouringFlameTimer <= diff) + DoMeleeAttackIfReady(); + } + else if (Phase == 1) //Flying Phase { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + if (InitialSpawn) + SummonAdds(); + + InitialSpawn = false; + + if (FireballTimer <= diff) { - me->SetInFront(pTarget); - DoCast(pTarget, SPELL_DEVOURINGFLAME); - } + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + me->SetInFront(pTarget); + DoCast(pTarget, SPELL_FIREBALL); + } + + FireballTimer = 18000; + } else FireballTimer -= diff; + + if (DevouringFlameTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + me->SetInFront(pTarget); + DoCast(pTarget, SPELL_DEVOURINGFLAME); + } - DevouringFlameTimer = 10000; - } else DevouringFlameTimer -= diff; + DevouringFlameTimer = 10000; + } else DevouringFlameTimer -= diff; - if (SummonAddsTimer <= diff) - SummonAdds(); - else SummonAddsTimer -= diff; + if (SummonAddsTimer <= diff) + SummonAdds(); + else SummonAddsTimer -= diff; + } } - } - void SummonAdds() - { - // TODO: Adds will come in waves from mole machines. One mole can spawn a Dark Rune Watcher - // with 1-2 Guardians, or a lone Sentinel. Up to 4 mole machines can spawn adds at any given time. - uint8 random = urand(1,4); - for (uint8 i = 0; i < random; ++i) + void SummonAdds() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + // TODO: Adds will come in waves from mole machines. One mole can spawn a Dark Rune Watcher + // with 1-2 Guardians, or a lone Sentinel. Up to 4 mole machines can spawn adds at any given time. + uint8 random = urand(1,4); + for (uint8 i = 0; i < random; ++i) { - float x = std::max(500.0f, std::min(650.0f, pTarget->GetPositionX() + irand(-20,20))); // Safe range is between 500 and 650 - float y = std::max(-235.0f, std::min(-145.0f, pTarget->GetPositionY() + irand(-20,20))); // Safe range is between -235 and -145 - float z = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); // Ground level - // TODO: Spawn drillers, then spawn adds 5 seconds later - if (Creature *pAdd = me->SummonCreature(NPC_DARK_RUNE_SENTINEL, x, y, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) - pAdd->AI()->AttackStart(pTarget); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + float x = std::max(500.0f, std::min(650.0f, pTarget->GetPositionX() + irand(-20,20))); // Safe range is between 500 and 650 + float y = std::max(-235.0f, std::min(-145.0f, pTarget->GetPositionY() + irand(-20,20))); // Safe range is between -235 and -145 + float z = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); // Ground level + // TODO: Spawn drillers, then spawn adds 5 seconds later + if (Creature *pAdd = me->SummonCreature(NPC_DARK_RUNE_SENTINEL, x, y, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) + pAdd->AI()->AttackStart(pTarget); + } } + SummonAddsTimer = 45000; } - SummonAddsTimer = 45000; - } - void FlyPhase(uint8 Phase, const uint32 /*diff*/) - { - const float x = 587.54; - const float y = -174.92; - const float GroundLevel = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); - const float FlightHeight = GroundLevel + 4.0f; // TODO: Fly out of range of attacks (442 is sufficient height for this), minus ~(10*number of harpoon gun chains attached to Razorscale) + void FlyPhase(uint8 Phase, const uint32 /*diff*/) + { + const float x = 587.54; + const float y = -174.92; + const float GroundLevel = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); + const float FlightHeight = GroundLevel + 4.0f; // TODO: Fly out of range of attacks (442 is sufficient height for this), minus ~(10*number of harpoon gun chains attached to Razorscale) - if (Phase == 1) // Always flying during Phase 1 - IsFlying = true; + if (Phase == 1) // Always flying during Phase 1 + IsFlying = true; - me->SetFlying(IsFlying); - me->SendMovementFlagUpdate(); - me->SetSpeed(MOVE_WALK, IsFlying ? 7.0f : 2.5f, IsFlying); + me->SetFlying(IsFlying); + me->SendMovementFlagUpdate(); + me->SetSpeed(MOVE_WALK, IsFlying ? 7.0f : 2.5f, IsFlying); - if (Phase == 1) // Flying Phase - { - if (me->GetPositionZ() > FlightHeight) // Correct height, stop moving - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - else // Incorrect height + if (Phase == 1) // Flying Phase { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->GetMotionMaster()->MovePoint(0, x, y, FlightHeight + 0.5f); // Fly to slightly above (x, y, FlightHeight) + if (me->GetPositionZ() > FlightHeight) // Correct height, stop moving + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + else // Incorrect height + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->GetMotionMaster()->MovePoint(0, x, y, FlightHeight + 0.5f); // Fly to slightly above (x, y, FlightHeight) + } + } + else // Ground Phases + { + const float CurrentGroundLevel = me->GetBaseMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT); + //if (StunTimer == 30000) // Only fly around if not stunned. + //{ + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + if (IsFlying && me->GetPositionZ() > CurrentGroundLevel) // Fly towards the ground + me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), CurrentGroundLevel); + // TODO: Swoop up just before landing + else + IsFlying = false; // Landed, no longer flying + //} + + //if (!IsFlying &&Phase == 2 && CastSpellsTimer == 0 && StunTimer >= diff) // No longer flying, non-permanent ground phase, and not casting spells + //{ + // TODO: Add stun here. 30 second stun after Razorscale is grounded by harpoon guns + //StunTimer -= diff; + //} + //else if (StunTimer != 30000 && (StunTimer < 0 || Phase == 3)) // Stun is active, and needs to end. Note: Stun breaks instantly if Phase 3 starts + //{ + // TODO: Remove stun here. + //DoCast(SPELL_WINGBUFFET); // "Used in the beginning of the phase." + //WingBuffetTimer = urand(7000,14000); + //StunTimer = 30000; // Reinitialize the stun timer + //if (Phase == 2) // Non-permanent ground phase + // CastSpellsTimer = 5000; // Five seconds of casting before returning to Phase 1 + //} } } - else // Ground Phases - { - const float CurrentGroundLevel = me->GetBaseMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT); - //if (StunTimer == 30000) // Only fly around if not stunned. - //{ - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - if (IsFlying && me->GetPositionZ() > CurrentGroundLevel) // Fly towards the ground - me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), CurrentGroundLevel); - // TODO: Swoop up just before landing - else - IsFlying = false; // Landed, no longer flying - //} - - //if (!IsFlying &&Phase == 2 && CastSpellsTimer == 0 && StunTimer >= diff) // No longer flying, non-permanent ground phase, and not casting spells - //{ - // TODO: Add stun here. 30 second stun after Razorscale is grounded by harpoon guns - //StunTimer -= diff; - //} - //else if (StunTimer != 30000 && (StunTimer < 0 || Phase == 3)) // Stun is active, and needs to end. Note: Stun breaks instantly if Phase 3 starts - //{ - // TODO: Remove stun here. - //DoCast(SPELL_WINGBUFFET); // "Used in the beginning of the phase." - //WingBuffetTimer = urand(7000,14000); - //StunTimer = 30000; // Reinitialize the stun timer - //if (Phase == 2) // Non-permanent ground phase - // CastSpellsTimer = 5000; // Five seconds of casting before returning to Phase 1 - //} - } - } + }; + }; -CreatureAI* GetAI_boss_razorscale(Creature* pCreature) -{ - return new boss_razorscaleAI (pCreature); -} void AddSC_boss_razorscale() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_razorscale"; - newscript->GetAI = &GetAI_boss_razorscale; - newscript->RegisterSelf(); + new boss_razorscale(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp index a508457e62a..fc6093b081d 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp @@ -39,64 +39,67 @@ enum Yells SAY_END_HARD_3 = -1603286, SAY_YS_HELP = -1603287, }; - -struct boss_thorimAI : public BossAI +
class boss_thorim : public CreatureScript { - boss_thorimAI(Creature* pCreature) : BossAI(pCreature, TYPE_THORIM) - { - } +public: + boss_thorim() : CreatureScript("boss_thorim") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); + return new boss_thorimAI(pCreature); } - void EnterEvadeMode() + struct boss_thorimAI : public BossAI { - DoScriptText(SAY_WIPE, me); - _EnterEvadeMode(); - } + boss_thorimAI(Creature* pCreature) : BossAI(pCreature, TYPE_THORIM) + { + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void Reset() + { + _Reset(); + } - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + void EnterEvadeMode() + { + DoScriptText(SAY_WIPE, me); + _EnterEvadeMode(); + } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); - _EnterCombat(); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; -//SPELLS TODO: + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } -// - DoMeleeAttackIfReady(); + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); + _EnterCombat(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + //SPELLS TODO: + + // + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); + } + }; - EnterEvadeIfOutOfCombatArea(diff); - } }; -CreatureAI* GetAI_boss_thorim(Creature* pCreature) -{ - return new boss_thorimAI(pCreature); -} void AddSC_boss_thorim() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_thorim"; - newscript->GetAI = &GetAI_boss_thorim; - newscript->RegisterSelf(); + new boss_thorim(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp index 600bb41a469..c1698214f47 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp @@ -164,686 +164,704 @@ enum * XT-002 DECONSTRUCTOR * *///---------------------------------------------------- -struct boss_xt002_AI : public BossAI +class boss_xt002 : public CreatureScript { - boss_xt002_AI(Creature *pCreature) : BossAI(pCreature, TYPE_XT002) +public: + boss_xt002() : CreatureScript("boss_xt002") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_xt002_AI(pCreature); } - uint32 uiSearingLightTimer; - uint32 uiSpawnLifeSparkTimer; - uint32 uiGravityBombTimer; - uint32 uiGravityBombAuraTimer; - uint32 uiTympanicTantrumTimer; - uint32 uiHeartPhaseTimer; - uint32 uiSpawnAddTimer; - uint32 uiEnrageTimer; - - bool searing_light_active; - uint64 uiSearingLightTarget; - - bool gravity_bomb_active; - uint64 uiGravityBombTarget; + struct boss_xt002_AI : public BossAI + { + boss_xt002_AI(Creature *pCreature) : BossAI(pCreature, TYPE_XT002) + { + } - uint8 phase; - uint8 heart_exposed; - bool enraged; + uint32 uiSearingLightTimer; + uint32 uiSpawnLifeSparkTimer; + uint32 uiGravityBombTimer; + uint32 uiGravityBombAuraTimer; + uint32 uiTympanicTantrumTimer; + uint32 uiHeartPhaseTimer; + uint32 uiSpawnAddTimer; + uint32 uiEnrageTimer; - uint32 transferHealth; - bool enterHardMode; - bool hardMode; + bool searing_light_active; + uint64 uiSearingLightTarget; - void Reset() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - - //Makes XT-002 to cast a light bomb 10 seconds after aggro. - uiSearingLightTimer = TIMER_SEARING_LIGHT/2; - uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; - uiGravityBombTimer = TIMER_GRAVITY_BOMB; - uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; - uiHeartPhaseTimer = TIMER_HEART_PHASE; - uiSpawnAddTimer = TIMER_SPAWN_ADD; - uiEnrageTimer = TIMER_ENRAGE; - - //Tantrum is casted a bit slower the first time. - uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX) * 2; - - searing_light_active = false; - gravity_bomb_active = false; - enraged = false; - hardMode = false; - enterHardMode = false; - - phase = 1; - heart_exposed = 0; - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + bool gravity_bomb_active; + uint64 uiGravityBombTarget; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); + uint8 phase; + uint8 heart_exposed; + bool enraged; - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + uint32 transferHealth; + bool enterHardMode; + bool hardMode; - void DoAction(const int32 action) - { - switch (action) + void Reset() { - case ACTION_ENTER_HARD_MODE: - if (!hardMode) - { - hardMode = true; - - // Enter hard mode - enterHardMode = true; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + + //Makes XT-002 to cast a light bomb 10 seconds after aggro. + uiSearingLightTimer = TIMER_SEARING_LIGHT/2; + uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; + uiGravityBombTimer = TIMER_GRAVITY_BOMB; + uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; + uiHeartPhaseTimer = TIMER_HEART_PHASE; + uiSpawnAddTimer = TIMER_SPAWN_ADD; + uiEnrageTimer = TIMER_ENRAGE; + + //Tantrum is casted a bit slower the first time. + uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX) * 2; + + searing_light_active = false; + gravity_bomb_active = false; + enraged = false; + hardMode = false; + enterHardMode = false; - // set max health - me->SetHealth(me->GetMaxHealth()); + phase = 1; + heart_exposed = 0; - // Get his heartbreak buff - me->CastSpell(me, RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25), true); - } - break; + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - } - void SetData(uint32 id, uint32 value) - { - switch(id) + void EnterCombat(Unit* /*who*/) { - case DATA_TRANSFERED_HEALTH: - transferHealth = value; - break; + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void DoAction(const int32 action) + { + switch (action) + { + case ACTION_ENTER_HARD_MODE: + if (!hardMode) + { + hardMode = true; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + // Enter hard mode + enterHardMode = true; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + // set max health + me->SetHealth(me->GetMaxHealth()); - if (enterHardMode) - { - SetPhaseOne(); - enterHardMode = false; + // Get his heartbreak buff + me->CastSpell(me, RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25), true); + } + break; + } } - // Handles spell casting. These spells only occur during phase 1 and hard mode - if (phase == 1 || hardMode) + void SetData(uint32 id, uint32 value) { - if (uiSearingLightTimer <= diff) + switch(id) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25)); - uiSearingLightTarget = pTarget->GetGUID(); - } - uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; - if (hardMode) - searing_light_active = true; - uiSearingLightTimer = TIMER_SEARING_LIGHT; - } else uiSearingLightTimer -= diff; + case DATA_TRANSFERED_HEALTH: + transferHealth = value; + break; + } + } - if (uiGravityBombTimer <= diff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); - uiGravityBombTarget = pTarget->GetGUID(); - } - uiGravityBombTimer = TIMER_GRAVITY_BOMB; - gravity_bomb_active = true; - } else uiGravityBombTimer -= diff; + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - if (uiTympanicTantrumTimer <= 0) - { - DoScriptText(SAY_TYMPANIC_TANTRUM, me); - DoCast(SPELL_TYMPANIC_TANTRUM); - uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); - } else uiTympanicTantrumTimer -= diff; + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); } - if (!hardMode) + void UpdateAI(const uint32 diff) { - if (phase == 1) + if (!UpdateVictim()) + return; + + if (enterHardMode) { - if (HealthBelowPct(75) && heart_exposed == 0) - { - exposeHeart(); - } - else if (HealthBelowPct(50) && heart_exposed == 1) + SetPhaseOne(); + enterHardMode = false; + } + + // Handles spell casting. These spells only occur during phase 1 and hard mode + if (phase == 1 || hardMode) + { + if (uiSearingLightTimer <= diff) { - exposeHeart(); - } - else if (HealthBelowPct(25) && heart_exposed == 2) + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25)); + uiSearingLightTarget = pTarget->GetGUID(); + } + uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; + if (hardMode) + searing_light_active = true; + uiSearingLightTimer = TIMER_SEARING_LIGHT; + } else uiSearingLightTimer -= diff; + + if (uiGravityBombTimer <= diff) { - exposeHeart(); - } + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); + uiGravityBombTarget = pTarget->GetGUID(); + } + uiGravityBombTimer = TIMER_GRAVITY_BOMB; + gravity_bomb_active = true; + } else uiGravityBombTimer -= diff; - DoMeleeAttackIfReady(); + if (uiTympanicTantrumTimer <= 0) + { + DoScriptText(SAY_TYMPANIC_TANTRUM, me); + DoCast(SPELL_TYMPANIC_TANTRUM); + uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); + } else uiTympanicTantrumTimer -= diff; } - else - { - //Stop moving - me->StopMoving(); - //Start summoning adds - if (uiSpawnAddTimer <= diff) + if (!hardMode) + { + if (phase == 1) { - DoScriptText(SAY_SUMMON, me); - - // Spawn Pummeller - switch (rand() % 4) + if (HealthBelowPct(75) && heart_exposed == 0) + { + exposeHeart(); + } + else if (HealthBelowPct(50) && heart_exposed == 1) { - case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + exposeHeart(); + } + else if (HealthBelowPct(25) && heart_exposed == 2) + { + exposeHeart(); } - // Spawn 5 Bombs - for (int8 n = 0; n < 5; n++) + DoMeleeAttackIfReady(); + } + else + { + //Stop moving + me->StopMoving(); + + //Start summoning adds + if (uiSpawnAddTimer <= diff) { - //Some randomes are added so they wont spawn in a pile - switch(rand() % 4) + DoScriptText(SAY_SUMMON, me); + + // Spawn Pummeller + switch (rand() % 4) { - case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LR_X - 3, LR_X + 3), irand(LR_Y - 3, LR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LL_X - 3, LL_X + 3), irand(LL_Y - 3, LL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UR_X - 3, UR_X + 3), irand(UR_Y - 3, UR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UL_X - 3, UL_X + 3), irand(UL_Y - 3, UL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; } - } - //Spawn 5 Scrapbots - switch (rand() % 4) - { - case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - } + // Spawn 5 Bombs + for (int8 n = 0; n < 5; n++) + { + //Some randomes are added so they wont spawn in a pile + switch(rand() % 4) + { + case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LR_X - 3, LR_X + 3), irand(LR_Y - 3, LR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LL_X - 3, LL_X + 3), irand(LL_Y - 3, LL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UR_X - 3, UR_X + 3), irand(UR_Y - 3, UR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UL_X - 3, UL_X + 3), irand(UL_Y - 3, UL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + } + } - uiSpawnAddTimer = TIMER_SPAWN_ADD; - } else uiSpawnAddTimer -= diff; + //Spawn 5 Scrapbots + switch (rand() % 4) + { + case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + } - // Is the phase over? - if (uiHeartPhaseTimer <= diff) - { - DoScriptText(SAY_HEART_CLOSED, me); - SetPhaseOne(); + uiSpawnAddTimer = TIMER_SPAWN_ADD; + } else uiSpawnAddTimer -= diff; + + // Is the phase over? + if (uiHeartPhaseTimer <= diff) + { + DoScriptText(SAY_HEART_CLOSED, me); + SetPhaseOne(); + } + else + uiHeartPhaseTimer -= diff; } - else - uiHeartPhaseTimer -= diff; } - } - else - { - // Adding life sparks when searing light debuff runs out if hard mode - if (searing_light_active) + else { - if (uiSpawnLifeSparkTimer <= diff) + // Adding life sparks when searing light debuff runs out if hard mode + if (searing_light_active) { - if (Unit *pSearingLightTarget = me->GetUnit(*me, uiSearingLightTarget)) - pSearingLightTarget->SummonCreature(NPC_LIFE_SPARK, pSearingLightTarget->GetPositionX(), pSearingLightTarget->GetPositionY(), pSearingLightTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; - searing_light_active = false; - } else uiSpawnLifeSparkTimer -= diff; - } + if (uiSpawnLifeSparkTimer <= diff) + { + if (Unit *pSearingLightTarget = me->GetUnit(*me, uiSearingLightTarget)) + pSearingLightTarget->SummonCreature(NPC_LIFE_SPARK, pSearingLightTarget->GetPositionX(), pSearingLightTarget->GetPositionY(), pSearingLightTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; + searing_light_active = false; + } else uiSpawnLifeSparkTimer -= diff; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - if (gravity_bomb_active) - { - if (uiGravityBombAuraTimer <= diff) + if (gravity_bomb_active) { - if (Unit *pGravityBombTarget = me->GetUnit(*me, uiGravityBombTarget)) + if (uiGravityBombAuraTimer <= diff) { - pGravityBombTarget->RemoveAurasDueToSpell(RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); - if (hardMode) + if (Unit *pGravityBombTarget = me->GetUnit(*me, uiGravityBombTarget)) { - //Remains spawned for 3 minutes - pGravityBombTarget->SummonCreature(NPC_VOID_ZONE, pGravityBombTarget->GetPositionX(), pGravityBombTarget->GetPositionY(), pGravityBombTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); + pGravityBombTarget->RemoveAurasDueToSpell(RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); + if (hardMode) + { + //Remains spawned for 3 minutes + pGravityBombTarget->SummonCreature(NPC_VOID_ZONE, pGravityBombTarget->GetPositionX(), pGravityBombTarget->GetPositionY(), pGravityBombTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); + } } - } - gravity_bomb_active = false; - uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; - //gravityBomb(); - } else uiGravityBombAuraTimer -= diff; - } + gravity_bomb_active = false; + uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; + //gravityBomb(); + } else uiGravityBombAuraTimer -= diff; + } - //Enrage stuff - if (!enraged) - if (uiEnrageTimer <= diff) - { - DoScriptText(SAY_BERSERK, me); - DoCast(me, SPELL_ENRAGE); - enraged = true; - } else uiEnrageTimer -= diff; - } + //Enrage stuff + if (!enraged) + if (uiEnrageTimer <= diff) + { + DoScriptText(SAY_BERSERK, me); + DoCast(me, SPELL_ENRAGE); + enraged = true; + } else uiEnrageTimer -= diff; + } - void exposeHeart() - { - //Make untargetable - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + void exposeHeart() + { + //Make untargetable + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - //Summon the heart npc - me->SummonCreature(NPC_XT002_HEART, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 7, 0, TEMPSUMMON_TIMED_DESPAWN, TIMER_HEART_PHASE); + //Summon the heart npc + me->SummonCreature(NPC_XT002_HEART, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 7, 0, TEMPSUMMON_TIMED_DESPAWN, TIMER_HEART_PHASE); - // Start "end of phase 2 timer" - uiHeartPhaseTimer = TIMER_HEART_PHASE; + // Start "end of phase 2 timer" + uiHeartPhaseTimer = TIMER_HEART_PHASE; - //Phase 2 has offically started - phase = 2; - heart_exposed++; + //Phase 2 has offically started + phase = 2; + heart_exposed++; - //Reset the add spawning timer - uiSpawnAddTimer = TIMER_SPAWN_ADD; + //Reset the add spawning timer + uiSpawnAddTimer = TIMER_SPAWN_ADD; - DoScriptText(SAY_HEART_OPENED, me); - } + DoScriptText(SAY_HEART_OPENED, me); + } - void SetPhaseOne() - { - uiSearingLightTimer = TIMER_SEARING_LIGHT / 2; - uiGravityBombTimer = TIMER_GRAVITY_BOMB; - uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); - uiSpawnAddTimer = TIMER_SPAWN_ADD; + void SetPhaseOne() + { + uiSearingLightTimer = TIMER_SEARING_LIGHT / 2; + uiGravityBombTimer = TIMER_GRAVITY_BOMB; + uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); + uiSpawnAddTimer = TIMER_SPAWN_ADD; - if (!hardMode) - me->ModifyHealth(-((int32)transferHealth)); + if (!hardMode) + me->ModifyHealth(-((int32)transferHealth)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - phase = 1; - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + phase = 1; + } - // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. - ////Have to do this the custom way since the original spell messes up player movement - //void gravityBomb() - //{ - // uint32 maxDamage = RAID_MODE(GRAVITY_BOMB_DMG_MAX_10, GRAVITY_BOMB_DMG_MAX_25); - // uint32 minDamage = RAID_MODE(GRAVITY_BOMB_DMG_MIN_10, GRAVITY_BOMB_DMG_MIN_25); - // uint16 range = GRAVITY_BOMB_RADIUS; - // Map* pMap = me->GetMap(); - // if (pMap && pMap->IsDungeon()) - // { - // Map::PlayerList const &PlayerList = pMap->GetPlayers(); - // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - // { - // //If a player is within the range of the spell - // if (i->getSource() && i->getSource()->GetDistance2d(pGravityBombTarget) <= range) - // { - // //Deal damage to the victim - // int32 damage = urand(minDamage, maxDamage); - // i->getSource()->ModifyHealth(-damage); - // me->SendSpellNonMeleeDamageLog(i->getSource(), SPELL_GRAVITY_BOMB_AURA_10, damage, SPELL_SCHOOL_MASK_SHADOW, 0, 0, false, 0); - - // //Replacing the tractor beam effect - // i->getSource()->JumpTo(pGravityBombTarget, 5); - // } - // } - // } - //} + // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. + ////Have to do this the custom way since the original spell messes up player movement + //void gravityBomb() + //{ + // uint32 maxDamage = RAID_MODE(GRAVITY_BOMB_DMG_MAX_10, GRAVITY_BOMB_DMG_MAX_25); + // uint32 minDamage = RAID_MODE(GRAVITY_BOMB_DMG_MIN_10, GRAVITY_BOMB_DMG_MIN_25); + // uint16 range = GRAVITY_BOMB_RADIUS; + // Map* pMap = me->GetMap(); + // if (pMap && pMap->IsDungeon()) + // { + // Map::PlayerList const &PlayerList = pMap->GetPlayers(); + // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + // { + // //If a player is within the range of the spell + // if (i->getSource() && i->getSource()->GetDistance2d(pGravityBombTarget) <= range) + // { + // //Deal damage to the victim + // int32 damage = urand(minDamage, maxDamage); + // i->getSource()->ModifyHealth(-damage); + // me->SendSpellNonMeleeDamageLog(i->getSource(), SPELL_GRAVITY_BOMB_AURA_10, damage, SPELL_SCHOOL_MASK_SHADOW, 0, 0, false, 0); + + // //Replacing the tractor beam effect + // i->getSource()->JumpTo(pGravityBombTarget, 5); + // } + // } + // } + //} + }; }; -CreatureAI* GetAI_boss_xt002(Creature* pCreature) -{ - return new boss_xt002_AI(pCreature); -} - /*------------------------------------------------------- * * XT-002 HEART * *///---------------------------------------------------- -struct mob_xt002_heartAI : public ScriptedAI +class mob_xt002_heart : public CreatureScript { - mob_xt002_heartAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_xt002_heart() : CreatureScript("mob_xt002_heart") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_EXPOSED_HEART); + return new mob_xt002_heartAI(pCreature); } - ScriptedInstance* m_pInstance; - - void JustDied(Unit * /*victim*/) + struct mob_xt002_heartAI : public ScriptedAI { - if (m_pInstance) + mob_xt002_heartAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_EXPOSED_HEART); + } + + InstanceScript* m_pInstance; + + void JustDied(Unit * /*victim*/) + { + if (m_pInstance) + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + if (pXT002->AI()) + pXT002->AI()->DoAction(ACTION_ENTER_HARD_MODE); + + //removes the aura + me->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); + } + + void DamageTaken(Unit * /*pDone*/, uint32 &damage) + { if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) if (pXT002->AI()) - pXT002->AI()->DoAction(ACTION_ENTER_HARD_MODE); - - //removes the aura - me->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); - } + { + uint32 health = me->GetHealth(); + health -= damage; + if (health < 0) + health = 0; - void DamageTaken(Unit * /*pDone*/, uint32 &damage) - { - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) - if (pXT002->AI()) - { - uint32 health = me->GetHealth(); - health -= damage; - if (health < 0) - health = 0; + pXT002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetMaxHealth() - health); + } + } + }; - pXT002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetMaxHealth() - health); - } - } }; -CreatureAI* GetAI_mob_xt002_heart(Creature* pCreature) -{ - return new mob_xt002_heartAI(pCreature); -} - /*------------------------------------------------------- * * XS-013 SCRAPBOT * - *///---------------------------------------------------- -struct mob_scrapbotAI : public ScriptedAI + *///----------------------------------------------------
class mob_scrapbot : public CreatureScript { - mob_scrapbotAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_scrapbot() : CreatureScript("mob_scrapbot") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = me->GetInstanceData(); + return new mob_scrapbotAI(pCreature); } - ScriptedInstance* m_pInstance; - - void Reset() + struct mob_scrapbotAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); + mob_scrapbotAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = me->GetInstanceScript(); + } - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) - me->GetMotionMaster()->MoveChase(pXT002); - } + InstanceScript* m_pInstance; - void UpdateAI(const uint32 /*diff*/) - { - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + void Reset() + { + me->SetReactState(REACT_PASSIVE); + + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + me->GetMotionMaster()->MoveChase(pXT002); + } + + void UpdateAI(const uint32 /*diff*/) { - if (me->GetDistance2d(pXT002) <= 0.5) + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) { - // TODO Send raid message + if (me->GetDistance2d(pXT002) <= 0.5) + { + // TODO Send raid message - // Increase health with 1 percent - pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01); + // Increase health with 1 percent + pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01); - // Despawns the scrapbot - me->ForcedDespawn(); + // Despawns the scrapbot + me->ForcedDespawn(); + } } } - } + }; + }; -CreatureAI* GetAI_mob_scrapbot(Creature* pCreature) -{ - return new mob_scrapbotAI(pCreature); -} /*------------------------------------------------------- * * XM-024 PUMMELLER * - *///---------------------------------------------------- -struct mob_pummellerAI : public ScriptedAI + *///----------------------------------------------------
class mob_pummeller : public CreatureScript { - mob_pummellerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; - int32 uiArcingSmashTimer; - int32 uiTrampleTimer; - int32 uiUppercutTimer; +public: + mob_pummeller() : CreatureScript("mob_pummeller") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiArcingSmashTimer = TIMER_ARCING_SMASH; - uiTrampleTimer = TIMER_TRAMPLE; - uiUppercutTimer = TIMER_UPPERCUT; + return new mob_pummellerAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_pummellerAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_pummellerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* m_pInstance; + int32 uiArcingSmashTimer; + int32 uiTrampleTimer; + int32 uiUppercutTimer; - if (me->IsWithinMeleeRange(me->getVictim())) + void Reset() { - if (uiArcingSmashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCING_SMASH); - uiArcingSmashTimer = TIMER_ARCING_SMASH; - } else uiArcingSmashTimer -= diff; + uiArcingSmashTimer = TIMER_ARCING_SMASH; + uiTrampleTimer = TIMER_TRAMPLE; + uiUppercutTimer = TIMER_UPPERCUT; + } - if (uiTrampleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_TRAMPLE); - uiTrampleTimer = TIMER_TRAMPLE; - } else uiTrampleTimer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - if (uiUppercutTimer <= diff) + if (me->IsWithinMeleeRange(me->getVictim())) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - uiUppercutTimer = TIMER_UPPERCUT; - } else uiUppercutTimer -= diff; + if (uiArcingSmashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCING_SMASH); + uiArcingSmashTimer = TIMER_ARCING_SMASH; + } else uiArcingSmashTimer -= diff; + + if (uiTrampleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_TRAMPLE); + uiTrampleTimer = TIMER_TRAMPLE; + } else uiTrampleTimer -= diff; + + if (uiUppercutTimer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + uiUppercutTimer = TIMER_UPPERCUT; + } else uiUppercutTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_pummeller(Creature* pCreature) -{ - return new mob_pummellerAI(pCreature); -} /*------------------------------------------------------- * * XE-321 BOOMBOT * - *///---------------------------------------------------- -struct mob_boombotAI : public ScriptedAI + *///----------------------------------------------------
class mob_boombot : public CreatureScript { - mob_boombotAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_boombot() : CreatureScript("mob_boombot") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new mob_boombotAI(pCreature); } - ScriptedInstance* m_pInstance; - - void Reset() + struct mob_boombotAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); + mob_boombotAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) - me->GetMotionMaster()->MoveChase(pXT002); - } + InstanceScript* m_pInstance; - void JustDied(Unit * /*killer*/) - { - DoCast(SPELL_BOOM); - } + void Reset() + { + me->SetReactState(REACT_PASSIVE); - void UpdateAI(const uint32 /*diff*/) - { - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + me->GetMotionMaster()->MoveChase(pXT002); + } + + void JustDied(Unit * /*killer*/) + { + DoCast(SPELL_BOOM); + } + + void UpdateAI(const uint32 /*diff*/) { - if (me->GetDistance2d(pXT002) <= 0.5) + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) { - //Explosion - DoCast(me, SPELL_BOOM); + if (me->GetDistance2d(pXT002) <= 0.5) + { + //Explosion + DoCast(me, SPELL_BOOM); - //Despawns the boombot - me->ForcedDespawn(); + //Despawns the boombot + me->ForcedDespawn(); + } } } - } + }; + }; -CreatureAI* GetAI_mob_boombot(Creature* pCreature) -{ - return new mob_boombotAI(pCreature); -} /*------------------------------------------------------- * * VOID ZONE * - *///---------------------------------------------------- -struct mob_void_zoneAI : public ScriptedAI + *///----------------------------------------------------
class mob_void_zone : public CreatureScript { - mob_void_zoneAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - } +public: + mob_void_zone() : CreatureScript("mob_void_zone") { } - ScriptedInstance* m_pInstance; - uint32 uiVoidZoneTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiVoidZoneTimer = TIMER_VOID_ZONE; + return new mob_void_zoneAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_void_zoneAI : public ScriptedAI { - if (uiVoidZoneTimer <= diff) + mob_void_zoneAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + } + + InstanceScript* m_pInstance; + uint32 uiVoidZoneTimer; + + void Reset() { - //voidZone(); uiVoidZoneTimer = TIMER_VOID_ZONE; - } else uiVoidZoneTimer -= diff; - } + } + + void UpdateAI(const uint32 diff) + { + if (uiVoidZoneTimer <= diff) + { + //voidZone(); + uiVoidZoneTimer = TIMER_VOID_ZONE; + } else uiVoidZoneTimer -= diff; + } + + // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. + //void voidZone() + //{ + // Map* pMap = me->GetMap(); + // if (pMap && pMap->IsDungeon()) + // { + // Map::PlayerList const &PlayerList = pMap->GetPlayers(); + // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + // { + // // If a player is within the range of the spell + // if (i->getSource() && i->getSource()->GetDistance2d(me) <= 16) + // { + // // Deal damage to the victim + // int32 damage = RAID_MODE(VOID_ZONE_DMG_10, VOID_ZONE_DMG_25); + // me->DealDamage(i->getSource(), damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_SHADOW); + // } + // } + // } + //} + }; - // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. - //void voidZone() - //{ - // Map* pMap = me->GetMap(); - // if (pMap && pMap->IsDungeon()) - // { - // Map::PlayerList const &PlayerList = pMap->GetPlayers(); - // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - // { - // // If a player is within the range of the spell - // if (i->getSource() && i->getSource()->GetDistance2d(me) <= 16) - // { - // // Deal damage to the victim - // int32 damage = RAID_MODE(VOID_ZONE_DMG_10, VOID_ZONE_DMG_25); - // me->DealDamage(i->getSource(), damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_SHADOW); - // } - // } - // } - //} }; -CreatureAI* GetAI_mob_void_zone(Creature* pCreature) -{ - return new mob_void_zoneAI(pCreature); -} /*------------------------------------------------------- * * LIFE SPARK * - *///---------------------------------------------------- -struct mob_life_sparkAI : public ScriptedAI + *///----------------------------------------------------
class mob_life_spark : public CreatureScript { - mob_life_sparkAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; - uint32 uiShockTimer; +public: + mob_life_spark() : CreatureScript("mob_life_spark") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, RAID_MODE(SPELL_STATIC_CHARGED_10, SPELL_STATIC_CHARGED_25)); - uiShockTimer = 0; // first one is immediate. + return new mob_life_sparkAI(pCreature); } - void UpdateAI(const uint32 diff) + struct mob_life_sparkAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_life_sparkAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } - if (uiShockTimer <= diff) + InstanceScript* m_pInstance; + uint32 uiShockTimer; + + void Reset() { - if (me->IsWithinMeleeRange(me->getVictim())) + DoCast(me, RAID_MODE(SPELL_STATIC_CHARGED_10, SPELL_STATIC_CHARGED_25)); + uiShockTimer = 0; // first one is immediate. + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiShockTimer <= diff) { - DoCast(me->getVictim(), SPELL_SHOCK); - uiShockTimer = TIMER_SHOCK; + if (me->IsWithinMeleeRange(me->getVictim())) + { + DoCast(me->getVictim(), SPELL_SHOCK); + uiShockTimer = TIMER_SHOCK; + } } + else uiShockTimer -= diff; } - else uiShockTimer -= diff; - } -}; + }; -CreatureAI* GetAI_mob_life_spark(Creature* pCreature) -{ - return new mob_life_sparkAI(pCreature); -} +}; void AddSC_boss_xt002() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_xt002"; - newscript->GetAI = &GetAI_boss_xt002; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_xt002_heart"; - newscript->GetAI = &GetAI_mob_xt002_heart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_scrapbot"; - newscript->GetAI = &GetAI_mob_scrapbot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_pummeller"; - newscript->GetAI = &GetAI_mob_pummeller; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_boombot"; - newscript->GetAI = &GetAI_mob_boombot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_void_zone"; - newscript->GetAI = &GetAI_mob_void_zone; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_life_spark"; - newscript->GetAI = &GetAI_mob_life_spark; - newscript->RegisterSelf(); + new mob_xt002_heart(); + new mob_scrapbot(); + new mob_pummeller(); + new mob_boombot(); + new mob_void_zone(); + new mob_life_spark(); + new boss_xt002(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp index 27f59ebb835..d436d96d15f 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp @@ -31,364 +31,367 @@ enum eGameObjects GO_LEVIATHAN_DOOR = 194905, GO_LEVIATHAN_GATE = 194630 }; - -struct instance_ulduar : public ScriptedInstance +
class instance_ulduar : public InstanceMapScript { - instance_ulduar(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; - - uint32 uiEncounter[MAX_ENCOUNTER]; - std::string m_strInstData; - uint8 flag; - - uint64 uiLeviathanGUID; - uint64 uiIgnisGUID; - uint64 uiRazorscaleGUID; - uint64 uiXT002GUID; - uint64 uiAssemblyGUIDs[3]; - uint64 uiKologarnGUID; - uint64 uiAuriayaGUID; - uint64 uiMimironGUID; - uint64 uiHodirGUID; - uint64 uiThorimGUID; - uint64 uiFreyaGUID; - uint64 uiVezaxGUID; - uint64 uiYoggSaronGUID; - uint64 uiAlgalonGUID; - uint64 uiLeviathanDoor[7]; - uint64 uiLeviathanGateGUID; - - uint64 uiKologarnChestGUID; - uint64 uiThorimChestGUID; - uint64 uiHodirChestGUID; - uint64 uiFreyaChestGUID; - - void Initialize() - { - uiIgnisGUID = 0; - uiRazorscaleGUID = 0; - uiXT002GUID = 0; - uiKologarnGUID = 0; - uiAuriayaGUID = 0; - uiMimironGUID = 0; - uiHodirGUID = 0; - uiThorimGUID = 0; - uiFreyaGUID = 0; - uiVezaxGUID = 0; - uiYoggSaronGUID = 0; - uiAlgalonGUID = 0; - uiKologarnChestGUID = 0; - uiKologarnChestGUID = 0; - uiHodirChestGUID = 0; - uiFreyaChestGUID = 0; - uiLeviathanGateGUID = 0; - flag = 0; - - memset(&uiEncounter, 0, sizeof(uiEncounter)); - memset(&uiAssemblyGUIDs, 0, sizeof(uiAssemblyGUIDs)); - memset(&uiLeviathanDoor, 0, sizeof(uiLeviathanDoor)); - } +public: + instance_ulduar() : InstanceMapScript("instance_ulduar") { } - bool IsEncounterInProgress() const + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (uiEncounter[i] == IN_PROGRESS) - return true; - } - - return false; + return new instance_ulduar_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_ulduar_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) - { - case NPC_LEVIATHAN: - uiLeviathanGUID = pCreature->GetGUID(); - break; - case NPC_IGNIS: - uiIgnisGUID = pCreature->GetGUID(); - break; - case NPC_RAZORSCALE: - uiRazorscaleGUID = pCreature->GetGUID(); - break; - case NPC_XT002: - uiXT002GUID = pCreature->GetGUID(); - break; - - // Assembly of Iron - case NPC_STEELBREAKER: - uiAssemblyGUIDs[0] = pCreature->GetGUID(); - break; - case NPC_MOLGEIM: - uiAssemblyGUIDs[1] = pCreature->GetGUID(); - break; - case NPC_BRUNDIR: - uiAssemblyGUIDs[2] = pCreature->GetGUID(); - break; - - case NPC_KOLOGARN: - uiKologarnGUID = pCreature->GetGUID(); - break; - case NPC_AURIAYA: - uiAuriayaGUID = pCreature->GetGUID(); - break; - case NPC_MIMIRON: - uiMimironGUID = pCreature->GetGUID(); - break; - case NPC_HODIR: - uiHodirGUID = pCreature->GetGUID(); - break; - case NPC_THORIM: - uiThorimGUID = pCreature->GetGUID(); - break; - case NPC_FREYA: - uiFreyaGUID = pCreature->GetGUID(); - break; - case NPC_VEZAX: - uiVezaxGUID = pCreature->GetGUID(); - break; - case NPC_YOGGSARON: - uiYoggSaronGUID = pCreature->GetGUID(); - break; - case NPC_ALGALON: - uiAlgalonGUID = pCreature->GetGUID(); - break; + instance_ulduar_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; + + uint32 uiEncounter[MAX_ENCOUNTER]; + std::string m_strInstData; + uint8 flag; + + uint64 uiLeviathanGUID; + uint64 uiIgnisGUID; + uint64 uiRazorscaleGUID; + uint64 uiXT002GUID; + uint64 uiAssemblyGUIDs[3]; + uint64 uiKologarnGUID; + uint64 uiAuriayaGUID; + uint64 uiMimironGUID; + uint64 uiHodirGUID; + uint64 uiThorimGUID; + uint64 uiFreyaGUID; + uint64 uiVezaxGUID; + uint64 uiYoggSaronGUID; + uint64 uiAlgalonGUID; + uint64 uiLeviathanDoor[7]; + uint64 uiLeviathanGateGUID; + + uint64 uiKologarnChestGUID; + uint64 uiThorimChestGUID; + uint64 uiHodirChestGUID; + uint64 uiFreyaChestGUID; + + void Initialize() + { + uiIgnisGUID = 0; + uiRazorscaleGUID = 0; + uiXT002GUID = 0; + uiKologarnGUID = 0; + uiAuriayaGUID = 0; + uiMimironGUID = 0; + uiHodirGUID = 0; + uiThorimGUID = 0; + uiFreyaGUID = 0; + uiVezaxGUID = 0; + uiYoggSaronGUID = 0; + uiAlgalonGUID = 0; + uiKologarnChestGUID = 0; + uiKologarnChestGUID = 0; + uiHodirChestGUID = 0; + uiFreyaChestGUID = 0; + uiLeviathanGateGUID = 0; + flag = 0; + + memset(&uiEncounter, 0, sizeof(uiEncounter)); + memset(&uiAssemblyGUIDs, 0, sizeof(uiAssemblyGUIDs)); + memset(&uiLeviathanDoor, 0, sizeof(uiLeviathanDoor)); } - } - - void OnGameObjectCreate(GameObject* pGO, bool add) - { - switch(pGO->GetEntry()) + bool IsEncounterInProgress() const { - case GO_KOLOGARN_CHEST_HERO: - case GO_KOLOGARN_CHEST: - uiKologarnChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_THORIM_CHEST_HERO: - case GO_THORIM_CHEST: - uiThorimChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_HODIR_CHEST_HERO: - case GO_HODIR_CHEST: - uiHodirChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_FREYA_CHEST_HERO: - case GO_FREYA_CHEST: - uiFreyaChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_LEVIATHAN_DOOR: - uiLeviathanDoor[flag] = pGO->GetGUID(); - HandleGameObject(NULL, true, pGO); - flag++; - if (flag == 7) - flag =0; - break; - case GO_LEVIATHAN_GATE: - uiLeviathanGateGUID = add ? pGO->GetGUID() : NULL; - HandleGameObject(NULL, false, pGO); - break; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (uiEncounter[i] == IN_PROGRESS) + return true; + } + + return false; } - } - void ProcessEvent(GameObject* pGO, uint32 uiEventId) - { - // Flame Leviathan's Tower Event triggers - Creature* pFlameLeviathan = instance->GetCreature(uiLeviathanGUID); + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case NPC_LEVIATHAN: + uiLeviathanGUID = pCreature->GetGUID(); + break; + case NPC_IGNIS: + uiIgnisGUID = pCreature->GetGUID(); + break; + case NPC_RAZORSCALE: + uiRazorscaleGUID = pCreature->GetGUID(); + break; + case NPC_XT002: + uiXT002GUID = pCreature->GetGUID(); + break; + + // Assembly of Iron + case NPC_STEELBREAKER: + uiAssemblyGUIDs[0] = pCreature->GetGUID(); + break; + case NPC_MOLGEIM: + uiAssemblyGUIDs[1] = pCreature->GetGUID(); + break; + case NPC_BRUNDIR: + uiAssemblyGUIDs[2] = pCreature->GetGUID(); + break; + + case NPC_KOLOGARN: + uiKologarnGUID = pCreature->GetGUID(); + break; + case NPC_AURIAYA: + uiAuriayaGUID = pCreature->GetGUID(); + break; + case NPC_MIMIRON: + uiMimironGUID = pCreature->GetGUID(); + break; + case NPC_HODIR: + uiHodirGUID = pCreature->GetGUID(); + break; + case NPC_THORIM: + uiThorimGUID = pCreature->GetGUID(); + break; + case NPC_FREYA: + uiFreyaGUID = pCreature->GetGUID(); + break; + case NPC_VEZAX: + uiVezaxGUID = pCreature->GetGUID(); + break; + case NPC_YOGGSARON: + uiYoggSaronGUID = pCreature->GetGUID(); + break; + case NPC_ALGALON: + uiAlgalonGUID = pCreature->GetGUID(); + break; + } - if (pFlameLeviathan && pFlameLeviathan->isAlive()) //No leviathan, no event triggering ;) - switch(uiEventId) + } + + void OnGameObjectCreate(GameObject* pGO, bool add) + { + switch(pGO->GetEntry()) { - case EVENT_TOWER_OF_STORM_DESTROYED: - //pGO->GetInstanceData()->SetData(DATA_TOWER_STORMS,DESTROYED); - pFlameLeviathan->AI()->DoAction(1); + case GO_KOLOGARN_CHEST_HERO: + case GO_KOLOGARN_CHEST: + uiKologarnChestGUID = add ? pGO->GetGUID() : NULL; + break; + case GO_THORIM_CHEST_HERO: + case GO_THORIM_CHEST: + uiThorimChestGUID = add ? pGO->GetGUID() : NULL; break; - case EVENT_TOWER_OF_FROST_DESTROYED: - pFlameLeviathan->AI()->DoAction(2); + case GO_HODIR_CHEST_HERO: + case GO_HODIR_CHEST: + uiHodirChestGUID = add ? pGO->GetGUID() : NULL; break; - case EVENT_TOWER_OF_FLAMES_DESTROYED: - pFlameLeviathan->AI()->DoAction(3); + case GO_FREYA_CHEST_HERO: + case GO_FREYA_CHEST: + uiFreyaChestGUID = add ? pGO->GetGUID() : NULL; break; - case EVENT_TOWER_OF_LIFE_DESTROYED: - pFlameLeviathan->AI()->DoAction(4); + case GO_LEVIATHAN_DOOR: + uiLeviathanDoor[flag] = pGO->GetGUID(); + HandleGameObject(NULL, true, pGO); + flag++; + if (flag == 7) + flag =0; break; + case GO_LEVIATHAN_GATE: + uiLeviathanGateGUID = add ? pGO->GetGUID() : NULL; + HandleGameObject(NULL, false, pGO); + break; } - } + } - void SetData(uint32 type, uint32 data) - { - switch(type) + void ProcessEvent(GameObject* pGO, uint32 uiEventId) { - /*case TYPE_IGNIS: - case TYPE_RAZORSCALE: - case TYPE_XT002: - case TYPE_ASSEMBLY: - case TYPE_AURIAYA: - case TYPE_MIMIRON: - case TYPE_VEZAX: - case TYPE_YOGGSARON: - break;*/ - case TYPE_LEVIATHAN: - if (data == IN_PROGRESS) - { - for (uint8 uiI = 0; uiI < 7; ++uiI) - HandleGameObject(uiLeviathanDoor[uiI],false); - } - else - { - for (uint8 uiI = 0; uiI < 7; ++uiI) - HandleGameObject(uiLeviathanDoor[uiI],true); - } - break; - case TYPE_KOLOGARN: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiKologarnChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_HODIR: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiHodirChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_THORIM: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiThorimChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_FREYA: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiFreyaChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_COLOSSUS: - uiEncounter[TYPE_COLOSSUS] = data; - if (data == 2) + // Flame Leviathan's Tower Event triggers + Creature* pFlameLeviathan = instance->GetCreature(uiLeviathanGUID); + + if (pFlameLeviathan && pFlameLeviathan->isAlive()) //No leviathan, no event triggering ;) + switch(uiEventId) { - if (Creature* pBoss = instance->GetCreature(uiLeviathanGUID)) - pBoss->AI()->DoAction(10); - if (GameObject* pGate = instance->GetGameObject(uiLeviathanGateGUID)) - pGate->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + case EVENT_TOWER_OF_STORM_DESTROYED: + //pGO->GetInstanceScript()->SetData(DATA_TOWER_STORMS,DESTROYED); + pFlameLeviathan->AI()->DoAction(1); + break; + case EVENT_TOWER_OF_FROST_DESTROYED: + pFlameLeviathan->AI()->DoAction(2); + break; + case EVENT_TOWER_OF_FLAMES_DESTROYED: + pFlameLeviathan->AI()->DoAction(3); + break; + case EVENT_TOWER_OF_LIFE_DESTROYED: + pFlameLeviathan->AI()->DoAction(4); + break; } - break; - default: - break; } - if (data == DONE) - SaveToDB(); - } - - uint64 GetData64(uint32 data) - { - switch(data) + void SetData(uint32 type, uint32 data) { - case TYPE_LEVIATHAN: return uiLeviathanGUID; - case TYPE_IGNIS: return uiIgnisGUID; - case TYPE_RAZORSCALE: return uiRazorscaleGUID; - case TYPE_XT002: return uiXT002GUID; - case TYPE_KOLOGARN: return uiKologarnGUID; - case TYPE_AURIAYA: return uiAuriayaGUID; - case TYPE_MIMIRON: return uiMimironGUID; - case TYPE_HODIR: return uiMimironGUID; - case TYPE_THORIM: return uiThorimGUID; - case TYPE_FREYA: return uiFreyaGUID; - case TYPE_VEZAX: return uiVezaxGUID; - case TYPE_YOGGSARON: return uiYoggSaronGUID; - case TYPE_ALGALON: return uiAlgalonGUID; - - // Assembly of Iron - case DATA_STEELBREAKER: return uiAssemblyGUIDs[0]; - case DATA_MOLGEIM: return uiAssemblyGUIDs[1]; - case DATA_BRUNDIR: return uiAssemblyGUIDs[2]; - } + switch(type) + { + /*case TYPE_IGNIS: + case TYPE_RAZORSCALE: + case TYPE_XT002: + case TYPE_ASSEMBLY: + case TYPE_AURIAYA: + case TYPE_MIMIRON: + case TYPE_VEZAX: + case TYPE_YOGGSARON: + break;*/ + case TYPE_LEVIATHAN: + if (data == IN_PROGRESS) + { + for (uint8 uiI = 0; uiI < 7; ++uiI) + HandleGameObject(uiLeviathanDoor[uiI],false); + } + else + { + for (uint8 uiI = 0; uiI < 7; ++uiI) + HandleGameObject(uiLeviathanDoor[uiI],true); + } + break; + case TYPE_KOLOGARN: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiKologarnChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_HODIR: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiHodirChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_THORIM: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiThorimChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_FREYA: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiFreyaChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_COLOSSUS: + uiEncounter[TYPE_COLOSSUS] = data; + if (data == 2) + { + if (Creature* pBoss = instance->GetCreature(uiLeviathanGUID)) + pBoss->AI()->DoAction(10); + if (GameObject* pGate = instance->GetGameObject(uiLeviathanGateGUID)) + pGate->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } + break; + default: + break; + } - return 0; - } + if (data == DONE) + SaveToDB(); + } - uint32 GetData(uint32 type) - { - switch(type) + uint64 GetData64(uint32 data) { - case TYPE_LEVIATHAN: - case TYPE_IGNIS: - case TYPE_RAZORSCALE: - case TYPE_XT002: - case TYPE_ASSEMBLY: - case TYPE_KOLOGARN: - case TYPE_AURIAYA: - case TYPE_MIMIRON: - case TYPE_HODIR: - case TYPE_THORIM: - case TYPE_FREYA: - case TYPE_VEZAX: - case TYPE_YOGGSARON: - case TYPE_ALGALON: - case TYPE_COLOSSUS: - return uiEncounter[type]; + switch(data) + { + case TYPE_LEVIATHAN: return uiLeviathanGUID; + case TYPE_IGNIS: return uiIgnisGUID; + case TYPE_RAZORSCALE: return uiRazorscaleGUID; + case TYPE_XT002: return uiXT002GUID; + case TYPE_KOLOGARN: return uiKologarnGUID; + case TYPE_AURIAYA: return uiAuriayaGUID; + case TYPE_MIMIRON: return uiMimironGUID; + case TYPE_HODIR: return uiMimironGUID; + case TYPE_THORIM: return uiThorimGUID; + case TYPE_FREYA: return uiFreyaGUID; + case TYPE_VEZAX: return uiVezaxGUID; + case TYPE_YOGGSARON: return uiYoggSaronGUID; + case TYPE_ALGALON: return uiAlgalonGUID; + + // Assembly of Iron + case DATA_STEELBREAKER: return uiAssemblyGUIDs[0]; + case DATA_MOLGEIM: return uiAssemblyGUIDs[1]; + case DATA_BRUNDIR: return uiAssemblyGUIDs[2]; + } + + return 0; } - return 0; - } + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_LEVIATHAN: + case TYPE_IGNIS: + case TYPE_RAZORSCALE: + case TYPE_XT002: + case TYPE_ASSEMBLY: + case TYPE_KOLOGARN: + case TYPE_AURIAYA: + case TYPE_MIMIRON: + case TYPE_HODIR: + case TYPE_THORIM: + case TYPE_FREYA: + case TYPE_VEZAX: + case TYPE_YOGGSARON: + case TYPE_ALGALON: + case TYPE_COLOSSUS: + return uiEncounter[type]; + } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + return 0; + } - std::ostringstream saveStream; - saveStream << "U U " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2] << " " << uiEncounter[3] - << " " << uiEncounter[4] << " " << uiEncounter[5] << " " << uiEncounter[6] << " " << uiEncounter[7] - << " " << uiEncounter[8] << " " << uiEncounter[9] << " " << uiEncounter[10] << " " << uiEncounter[11] - << " " << uiEncounter[12] << " " << uiEncounter[13] << " " << uiEncounter[14]; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - m_strInstData = saveStream.str(); + std::ostringstream saveStream; + saveStream << "U U " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2] << " " << uiEncounter[3] + << " " << uiEncounter[4] << " " << uiEncounter[5] << " " << uiEncounter[6] << " " << uiEncounter[7] + << " " << uiEncounter[8] << " " << uiEncounter[9] << " " << uiEncounter[10] << " " << uiEncounter[11] + << " " << uiEncounter[12] << " " << uiEncounter[13] << " " << uiEncounter[14]; - OUT_SAVE_INST_DATA_COMPLETE; - return m_strInstData; - } + m_strInstData = saveStream.str(); - void Load(const char* strIn) - { - if (!strIn) - { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA_COMPLETE; + return m_strInstData; } - OUT_LOAD_INST_DATA(strIn); + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(strIn); - char dataHead1, dataHead2; - uint32 data0, data1, data2, data3, data4, data5, data6, - data7, data8, data9, data10, data11, data12, data13, data14; + char dataHead1, dataHead2; + uint32 data0, data1, data2, data3, data4, data5, data6, + data7, data8, data9, data10, data11, data12, data13, data14; - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6 - >> data7 >> data8 >> data9 >> data10 >> data11 >> data12 >> data13 >> data14; + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6 + >> data7 >> data8 >> data9 >> data10 >> data11 >> data12 >> data13 >> data14; - if (dataHead1 == 'U' && dataHead2 == 'U') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (dataHead1 == 'U' && dataHead2 == 'U') { - loadStream >> uiEncounter[i]; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> uiEncounter[i]; - if (uiEncounter[i] == IN_PROGRESS) - uiEncounter[i] = NOT_STARTED; + if (uiEncounter[i] == IN_PROGRESS) + uiEncounter[i] = NOT_STARTED; + } } + OUT_LOAD_INST_DATA_COMPLETE; } - OUT_LOAD_INST_DATA_COMPLETE; - } + }; + }; -InstanceData* GetInstanceData_instance_ulduar(Map* pMap) -{ - return new instance_ulduar(pMap); -} void AddSC_instance_ulduar() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_ulduar"; - newscript->GetInstanceData = &GetInstanceData_instance_ulduar; - newscript->RegisterSelf(); + new instance_ulduar(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp index 102cb69a3b1..dfa86ad005a 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp @@ -38,73 +38,74 @@ The teleporter appears to be active and stable. #define ANTECHAMBER 204 #define WALKWAY 205 #define CONSERVATORY 206 - -bool GoHello_ulduar_teleporter(Player *pPlayer, GameObject *pGO) +
class ulduar_teleporter : public GameObjectScript { - ScriptedInstance *pInstance = pGO->GetInstanceData(); - if (!pInstance) return true; +public: + ulduar_teleporter() : GameObjectScript("ulduar_teleporter") { } - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP); - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS); - if (pInstance->GetData(TYPE_LEVIATHAN) == DONE) + bool OnGossipSelect(Player *pPlayer, GameObject * /*pGO*/, uint32 sender, uint32 action) { - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge", GOSSIP_SENDER_MAIN, FORGE); - if (pInstance->GetData(TYPE_XT002) == DONE) + if (sender != GOSSIP_SENDER_MAIN) return true; + if (!pPlayer->getAttackers().empty()) return true; + + switch(action) { - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard", GOSSIP_SENDER_MAIN, SCRAPYARD); - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar", GOSSIP_SENDER_MAIN, ANTECHAMBER); - if (pInstance->GetData(TYPE_KOLOGARN) == DONE) - { - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway", GOSSIP_SENDER_MAIN, WALKWAY); - if (pInstance->GetData(TYPE_AURIAYA) == DONE) - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life", GOSSIP_SENDER_MAIN, CONSERVATORY); - } + case BASE_CAMP: + pPlayer->TeleportTo(603, -706.122, -92.6024, 429.876, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case GROUNDS: + pPlayer->TeleportTo(603, 131.248, -35.3802, 409.804, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case FORGE: + pPlayer->TeleportTo(603, 553.233, -12.3247, 409.679, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case SCRAPYARD: + pPlayer->TeleportTo(603, 926.292, -11.4635, 418.595, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case ANTECHAMBER: + pPlayer->TeleportTo(603, 1498.09, -24.246, 420.967, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case WALKWAY: + pPlayer->TeleportTo(603, 1859.45, -24.1, 448.9, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case CONSERVATORY: + pPlayer->TeleportTo(603, 2086.27, -24.3134, 421.239, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; } + + return true; } - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pGO->GetGUID()); - return true; -} + bool OnGossipHello(Player *pPlayer, GameObject *pGO) + { + InstanceScript *pInstance = pGO->GetInstanceScript(); + if (!pInstance) return true; -bool GOSelect_ulduar_teleporter(Player *pPlayer, GameObject * /*pGO*/, uint32 sender, uint32 action) -{ - if (sender != GOSSIP_SENDER_MAIN) return true; - if (!pPlayer->getAttackers().empty()) return true; + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP); + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS); + if (pInstance->GetData(TYPE_LEVIATHAN) == DONE) + { + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge", GOSSIP_SENDER_MAIN, FORGE); + if (pInstance->GetData(TYPE_XT002) == DONE) + { + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard", GOSSIP_SENDER_MAIN, SCRAPYARD); + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar", GOSSIP_SENDER_MAIN, ANTECHAMBER); + if (pInstance->GetData(TYPE_KOLOGARN) == DONE) + { + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway", GOSSIP_SENDER_MAIN, WALKWAY); + if (pInstance->GetData(TYPE_AURIAYA) == DONE) + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life", GOSSIP_SENDER_MAIN, CONSERVATORY); + } + } + } + pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pGO->GetGUID()); - switch(action) - { - case BASE_CAMP: - pPlayer->TeleportTo(603, -706.122, -92.6024, 429.876, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case GROUNDS: - pPlayer->TeleportTo(603, 131.248, -35.3802, 409.804, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case FORGE: - pPlayer->TeleportTo(603, 553.233, -12.3247, 409.679, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case SCRAPYARD: - pPlayer->TeleportTo(603, 926.292, -11.4635, 418.595, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case ANTECHAMBER: - pPlayer->TeleportTo(603, 1498.09, -24.246, 420.967, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case WALKWAY: - pPlayer->TeleportTo(603, 1859.45, -24.1, 448.9, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case CONSERVATORY: - pPlayer->TeleportTo(603, 2086.27, -24.3134, 421.239, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; + return true; } - return true; -} +}; void AddSC_ulduar_teleporter() { - Script *newscript; - newscript = new Script; - newscript->Name = "ulduar_teleporter"; - newscript->pGOHello = &GoHello_ulduar_teleporter; - newscript->pGOSelect = &GOSelect_ulduar_teleporter; - newscript->RegisterSelf(); + new ulduar_teleporter(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index bc2270cf79f..d4ecbbcedc2 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -70,198 +70,205 @@ enum Spells ENTRY_THROW_TARGET = 23996, SPELL_SHADOW_AXE_SUMMON = 42749 }; - -struct boss_ingvar_the_plundererAI : public ScriptedAI +
class boss_ingvar_the_plunderer : public CreatureScript { - boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c) +public: + boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_ingvar_the_plundererAI(pCreature); } - ScriptedInstance* pInstance; + struct boss_ingvar_the_plundererAI : public ScriptedAI + { + boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - bool bIsUndead; - bool bEventInProgress; + InstanceScript* pInstance; - uint32 uiCleaveTimer; - uint32 uiSmashTimer; - uint32 uiEnrageTimer; - uint32 uiRoarTimer; - uint32 uiSpawnResTimer; + bool bIsUndead; + bool bEventInProgress; - void Reset() - { - if (bIsUndead) - me->UpdateEntry(MOB_INGVAR_HUMAN); + uint32 uiCleaveTimer; + uint32 uiSmashTimer; + uint32 uiEnrageTimer; + uint32 uiRoarTimer; + uint32 uiSpawnResTimer; - bIsUndead = false; - bEventInProgress = false; + void Reset() + { + if (bIsUndead) + me->UpdateEntry(MOB_INGVAR_HUMAN); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); + bIsUndead = false; + bEventInProgress = false; - uiCleaveTimer = 2000; - uiSmashTimer = 5000; - uiEnrageTimer = 10000; - uiRoarTimer = 15000; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); - uiSpawnResTimer = 3000; + uiCleaveTimer = 2000; + uiSmashTimer = 5000; + uiEnrageTimer = 10000; + uiRoarTimer = 15000; - if (pInstance) - pInstance->SetData(DATA_INGVAR_EVENT, NOT_STARTED); - } + uiSpawnResTimer = 3000; - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth() && !bIsUndead) - { - //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? - // visuel hack - me->SetHealth(0); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - // visuel hack end - - bEventInProgress = true; - bIsUndead = true; - - DoScriptText(YELL_DEAD_1,me); + if (pInstance) + pInstance->SetData(DATA_INGVAR_EVENT, NOT_STARTED); } - if (bEventInProgress) + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - damage = 0; - } - } - - void StartZombiePhase() - { - bIsUndead = true; - bEventInProgress = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->UpdateEntry(MOB_INGVAR_UNDEAD); - me->SetInCombatWith(me->getVictim()); - me->GetMotionMaster()->MoveChase(me->getVictim()); - - DoScriptText(YELL_AGGRO_2,me); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(YELL_AGGRO_1,me); + if (damage >= me->GetHealth() && !bIsUndead) + { + //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? + // visuel hack + me->SetHealth(0); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + // visuel hack end + + bEventInProgress = true; + bIsUndead = true; + + DoScriptText(YELL_DEAD_1,me); + } - if (pInstance) - pInstance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS); - } + if (bEventInProgress) + { + damage = 0; + } + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(YELL_DEAD_2,me); + void StartZombiePhase() + { + bIsUndead = true; + bEventInProgress = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->UpdateEntry(MOB_INGVAR_UNDEAD); + me->SetInCombatWith(me->getVictim()); + me->GetMotionMaster()->MoveChase(me->getVictim()); - if (pInstance) - pInstance->SetData(DATA_INGVAR_EVENT, DONE); - } + DoScriptText(YELL_AGGRO_2,me); + } - void KilledUnit(Unit * /*victim*/) - { - if (bIsUndead) - DoScriptText(YELL_KILL_1,me); - else - DoScriptText(YELL_KILL_2,me); - } + void EnterCombat(Unit * /*who*/) + { + DoScriptText(YELL_AGGRO_1,me); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + if (pInstance) + pInstance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS); + } - if (bEventInProgress) + void JustDied(Unit* /*killer*/) { - if (uiSpawnResTimer) - if (uiSpawnResTimer <= diff) - { - DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position - // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ? - uiSpawnResTimer = 0; - } else uiSpawnResTimer -= diff; + DoScriptText(YELL_DEAD_2,me); - return; + if (pInstance) + pInstance->SetData(DATA_INGVAR_EVENT, DONE); } - if (uiCleaveTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - if (!me->hasUnitState(UNIT_STAT_CASTING)) - { - if (bIsUndead) - DoCast(me->getVictim(), SPELL_WOE_STRIKE); - else - DoCast(me->getVictim(), SPELL_CLEAVE); - uiCleaveTimer = rand()%5000 + 2000; - } - } else uiCleaveTimer -= diff; + if (bIsUndead) + DoScriptText(YELL_KILL_1,me); + else + DoScriptText(YELL_KILL_2,me); + } - if (uiSmashTimer <= diff) + void UpdateAI(const uint32 diff) { - if (!me->hasUnitState(UNIT_STAT_CASTING)) + if (!UpdateVictim()) + return; + + if (bEventInProgress) { - if (bIsUndead) - DoCast(me->getVictim(), SPELL_DARK_SMASH); - else - DoCast(me->getVictim(), SPELL_SMASH); - uiSmashTimer = 10000; + if (uiSpawnResTimer) + if (uiSpawnResTimer <= diff) + { + DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position + // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ? + uiSpawnResTimer = 0; + } else uiSpawnResTimer -= diff; + + return; } - } else uiSmashTimer -= diff; - if (!bIsUndead) - { - if (uiEnrageTimer <= diff) - { - DoCast(me, SPELL_ENRAGE); - uiEnrageTimer = 10000; - } else uiEnrageTimer -= diff; - } else // In Undead form used to summon weapon - { - if (uiEnrageTimer <= diff) + if (uiCleaveTimer <= diff) { if (!me->hasUnitState(UNIT_STAT_CASTING)) { - // Spawn target for Axe - Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); - if (pTarget) - { - me->SummonCreature(ENTRY_THROW_TARGET,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000); + if (bIsUndead) + DoCast(me->getVictim(), SPELL_WOE_STRIKE); + else + DoCast(me->getVictim(), SPELL_CLEAVE); + uiCleaveTimer = rand()%5000 + 2000; + } + } else uiCleaveTimer -= diff; - DoCast(me, SPELL_SHADOW_AXE_SUMMON); - } - uiEnrageTimer = 30000; + if (uiSmashTimer <= diff) + { + if (!me->hasUnitState(UNIT_STAT_CASTING)) + { + if (bIsUndead) + DoCast(me->getVictim(), SPELL_DARK_SMASH); + else + DoCast(me->getVictim(), SPELL_SMASH); + uiSmashTimer = 10000; } - } else uiEnrageTimer -= diff; - } + } else uiSmashTimer -= diff; - if (uiRoarTimer <= diff) - { - if (!me->hasUnitState(UNIT_STAT_CASTING)) + if (!bIsUndead) { - if (bIsUndead) - DoCast(me, SPELL_DREADFUL_ROAR); - else - DoCast(me, SPELL_STAGGERING_ROAR); - uiRoarTimer = 10000; + if (uiEnrageTimer <= diff) + { + DoCast(me, SPELL_ENRAGE); + uiEnrageTimer = 10000; + } else uiEnrageTimer -= diff; + } else // In Undead form used to summon weapon + { + if (uiEnrageTimer <= diff) + { + if (!me->hasUnitState(UNIT_STAT_CASTING)) + { + // Spawn target for Axe + Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); + if (pTarget) + { + me->SummonCreature(ENTRY_THROW_TARGET,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000); + + DoCast(me, SPELL_SHADOW_AXE_SUMMON); + } + uiEnrageTimer = 30000; + } + } else uiEnrageTimer -= diff; } - } else uiRoarTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiRoarTimer <= diff) + { + if (!me->hasUnitState(UNIT_STAT_CASTING)) + { + if (bIsUndead) + DoCast(me, SPELL_DREADFUL_ROAR); + else + DoCast(me, SPELL_STAGGERING_ROAR); + uiRoarTimer = 10000; + } + } else uiRoarTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_ingvar_the_plunderer(Creature* pCreature) -{ - return new boss_ingvar_the_plundererAI(pCreature); -} enum eSpells { @@ -274,168 +281,169 @@ enum eSpells SPELL_SCOURG_RESURRECTION_DUMMY = 42862, //Some Emote Dummy? SPELL_INGVAR_TRANSFORM = 42796 }; - -struct mob_annhylde_the_callerAI : public ScriptedAI +
class mob_annhylde_the_caller : public CreatureScript { - mob_annhylde_the_callerAI(Creature *c) : ScriptedAI(c) +public: + mob_annhylde_the_caller() : CreatureScript("mob_annhylde_the_caller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_annhylde_the_callerAI (pCreature); } - float x,y,z; - ScriptedInstance* pInstance; - uint32 uiResurectTimer; - uint32 uiResurectPhase; - - void Reset() + struct mob_annhylde_the_callerAI : public ScriptedAI { - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_HOVER); - me->SetSpeed(MOVE_SWIM , 1.0f); - me->SetSpeed(MOVE_RUN , 1.0f); - me->SetSpeed(MOVE_WALK , 1.0f); - //me->SetSpeed(MOVE_FLIGHT , 1.0f); + mob_annhylde_the_callerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - me->GetPosition(x,y,z); - DoTeleportTo(x+1,y,z+30); + float x,y,z; + InstanceScript* pInstance; + uint32 uiResurectTimer; + uint32 uiResurectPhase; - Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); - if (ingvar) + void Reset() { - me->GetMotionMaster()->MovePoint(1,x,y,z+15); + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_HOVER); + me->SetSpeed(MOVE_SWIM , 1.0f); + me->SetSpeed(MOVE_RUN , 1.0f); + me->SetSpeed(MOVE_WALK , 1.0f); + //me->SetSpeed(MOVE_FLIGHT , 1.0f); + + me->GetPosition(x,y,z); + DoTeleportTo(x+1,y,z+30); + + Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); + if (ingvar) + { + me->GetMotionMaster()->MovePoint(1,x,y,z+15); -// DoScriptText(YELL_RESSURECT,me); + // DoScriptText(YELL_RESSURECT,me); + } } - } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - Unit* ingvar = Unit::GetUnit((*me), pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); - if (ingvar) + void MovementInform(uint32 type, uint32 id) { - switch (id) + if (type != POINT_MOTION_TYPE) + return; + Unit* ingvar = Unit::GetUnit((*me), pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); + if (ingvar) { - case 1: - ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); - ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_DUMMY,true); - DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); - uiResurectTimer = 8000; - uiResurectPhase = 1; - break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - me->DealDamage(me,me->GetHealth()); - me->RemoveCorpse(); - break; + switch (id) + { + case 1: + ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); + ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_DUMMY,true); + DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); + uiResurectTimer = 8000; + uiResurectPhase = 1; + break; + case 2: + me->SetVisibility(VISIBILITY_OFF); + me->DealDamage(me,me->GetHealth()); + me->RemoveCorpse(); + break; + } } } - } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void EnterCombat(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (uiResurectTimer) - if (uiResurectTimer <= diff) - { - if (uiResurectPhase == 1) + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit * /*who*/) {} + void UpdateAI(const uint32 diff) + { + if (uiResurectTimer) + if (uiResurectTimer <= diff) { - Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); - if (ingvar) + if (uiResurectPhase == 1) { - ingvar->SetStandState(UNIT_STAND_STATE_STAND); - ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_HEAL,false); + Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); + if (ingvar) + { + ingvar->SetStandState(UNIT_STAND_STATE_STAND); + ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_HEAL,false); + } + uiResurectTimer = 3000; + uiResurectPhase = 2; } - uiResurectTimer = 3000; - uiResurectPhase = 2; - } - else if (uiResurectPhase == 2) - { - if (Creature* ingvar = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0)) + else if (uiResurectPhase == 2) { - ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); + if (Creature* ingvar = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0)) + { + ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); - if (boss_ingvar_the_plundererAI* pAI = CAST_AI(boss_ingvar_the_plundererAI, ingvar->AI())) - pAI->StartZombiePhase(); + if (boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI* pAI = CAST_AI(boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI, ingvar->AI())) + pAI->StartZombiePhase(); - me->GetMotionMaster()->MovePoint(2,x+1,y,z+30); - ++uiResurectPhase; - uiResurectTimer = 0; + me->GetMotionMaster()->MovePoint(2,x+1,y,z+30); + ++uiResurectPhase; + uiResurectTimer = 0; + } } - } - } else uiResurectTimer -= diff; - } + } else uiResurectTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_annhylde_the_caller(Creature* pCreature) -{ - return new mob_annhylde_the_callerAI (pCreature); -} enum eShadowAxe { SPELL_SHADOW_AXE_DAMAGE = 42750, H_SPELL_SHADOW_AXE_DAMAGE = 59719 }; - -struct mob_ingvar_throw_dummyAI : public ScriptedAI +
class mob_ingvar_throw_dummy : public CreatureScript { - mob_ingvar_throw_dummyAI(Creature *c) : ScriptedAI(c) +public: + mob_ingvar_throw_dummy() : CreatureScript("mob_ingvar_throw_dummy") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_ingvar_throw_dummyAI (pCreature); } - uint32 uiDespawnTimer; - - void Reset() + struct mob_ingvar_throw_dummyAI : public ScriptedAI { - Unit *pTarget = me->FindNearestCreature(ENTRY_THROW_TARGET,50); - if (pTarget) + mob_ingvar_throw_dummyAI(Creature *c) : ScriptedAI(c) { - DoCast(me, SPELL_SHADOW_AXE_DAMAGE); - float x,y,z; - pTarget->GetPosition(x,y,z); - me->GetMotionMaster()->MovePoint(0,x,y,z); } - uiDespawnTimer = 7000; - } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void EnterCombat(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (uiDespawnTimer <= diff) + + uint32 uiDespawnTimer; + + void Reset() { - me->DealDamage(me,me->GetHealth()); - me->RemoveCorpse(); - uiDespawnTimer = 0; - } else uiDespawnTimer -= diff; - } + Unit *pTarget = me->FindNearestCreature(ENTRY_THROW_TARGET,50); + if (pTarget) + { + DoCast(me, SPELL_SHADOW_AXE_DAMAGE); + float x,y,z; + pTarget->GetPosition(x,y,z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + } + uiDespawnTimer = 7000; + } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit * /*who*/) {} + void UpdateAI(const uint32 diff) + { + if (uiDespawnTimer <= diff) + { + me->DealDamage(me,me->GetHealth()); + me->RemoveCorpse(); + uiDespawnTimer = 0; + } else uiDespawnTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_ingvar_throw_dummy(Creature* pCreature) -{ - return new mob_ingvar_throw_dummyAI (pCreature); -} void AddSC_boss_ingvar_the_plunderer() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ingvar_the_plunderer"; - newscript->GetAI = &GetAI_boss_ingvar_the_plunderer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_annhylde_the_caller"; - newscript->GetAI = &GetAI_mob_annhylde_the_caller; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ingvar_throw_dummy"; - newscript->GetAI = &GetAI_mob_ingvar_throw_dummy; - newscript->RegisterSelf(); + new boss_ingvar_the_plunderer(); + new mob_annhylde_the_caller(); + new mob_ingvar_throw_dummy(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 8e0b69a1d3c..1f7cf12fabb 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -59,302 +59,310 @@ float SkeletonSpawnPoint[5][5]= float AttackLoc[3]={197.636, 194.046, 40.8164}; bool ShatterFrostTomb; // needed for achievement: On The Rocks(1919) - -struct mob_frost_tombAI : public ScriptedAI +
class mob_frost_tomb : public CreatureScript { - mob_frost_tombAI(Creature *c) : ScriptedAI(c) +public: + mob_frost_tomb() : CreatureScript("mob_frost_tomb") { } + + CreatureAI* GetAI(Creature* pCreature) const { - FrostTombGUID = 0; + return new mob_frost_tombAI(pCreature); } - uint64 FrostTombGUID; - - void SetPrisoner(Unit* uPrisoner) + struct mob_frost_tombAI : public ScriptedAI { - FrostTombGUID = uPrisoner->GetGUID(); - } + mob_frost_tombAI(Creature *c) : ScriptedAI(c) + { + FrostTombGUID = 0; + } - void Reset(){ FrostTombGUID = 0; } - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} + uint64 FrostTombGUID; - void JustDied(Unit *killer) - { - if (killer->GetGUID() != me->GetGUID()) - ShatterFrostTomb = true; + void SetPrisoner(Unit* uPrisoner) + { + FrostTombGUID = uPrisoner->GetGUID(); + } + + void Reset(){ FrostTombGUID = 0; } + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void JustDied(Unit *killer) + { + if (killer->GetGUID() != me->GetGUID()) + ShatterFrostTomb = true; + + if (FrostTombGUID) + { + Unit* FrostTomb = Unit::GetUnit((*me),FrostTombGUID); + if (FrostTomb) + FrostTomb->RemoveAurasDueToSpell(SPELL_FROST_TOMB); + } + } - if (FrostTombGUID) + void UpdateAI(const uint32 /*diff*/) { - Unit* FrostTomb = Unit::GetUnit((*me),FrostTombGUID); - if (FrostTomb) - FrostTomb->RemoveAurasDueToSpell(SPELL_FROST_TOMB); + Unit* temp = Unit::GetUnit((*me),FrostTombGUID); + if ((temp && temp->isAlive() && !temp->HasAura(SPELL_FROST_TOMB)) || !temp) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - } + }; - void UpdateAI(const uint32 /*diff*/) - { - Unit* temp = Unit::GetUnit((*me),FrostTombGUID); - if ((temp && temp->isAlive() && !temp->HasAura(SPELL_FROST_TOMB)) || !temp) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } }; - -struct boss_kelesethAI : public ScriptedAI +
class boss_keleseth : public CreatureScript { - boss_kelesethAI(Creature *c) : ScriptedAI(c) +public: + boss_keleseth() : CreatureScript("boss_keleseth") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kelesethAI (pCreature); } - ScriptedInstance* pInstance; + struct boss_kelesethAI : public ScriptedAI + { + boss_kelesethAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 FrostTombTimer; - uint32 SummonSkeletonsTimer; - uint32 RespawnSkeletonsTimer; - uint32 ShadowboltTimer; - uint64 SkeletonGUID[5]; - bool Skeletons; - bool RespawnSkeletons; + InstanceScript* pInstance; - void Reset() - { - ShadowboltTimer = 0; - Skeletons = false; + uint32 FrostTombTimer; + uint32 SummonSkeletonsTimer; + uint32 RespawnSkeletonsTimer; + uint32 ShadowboltTimer; + uint64 SkeletonGUID[5]; + bool Skeletons; + bool RespawnSkeletons; - ShatterFrostTomb = false; + void Reset() + { + ShadowboltTimer = 0; + Skeletons = false; - ResetTimer(); + ShatterFrostTomb = false; - if (pInstance) - pInstance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); - } + ResetTimer(); - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + if (pInstance) + pInstance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); + } - DoScriptText(SAY_KILL, me); - } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + DoScriptText(SAY_KILL, me); + } - if (IsHeroic() && !ShatterFrostTomb) + void JustDied(Unit* /*killer*/) { - AchievementEntry const *AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); - if (AchievOnTheRocks) + DoScriptText(SAY_DEATH, me); + + if (IsHeroic() && !ShatterFrostTomb) { - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) + AchievementEntry const *AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); + if (AchievOnTheRocks) { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievOnTheRocks); + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievOnTheRocks); + } } } - } - if (pInstance) - pInstance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); + } - if (pInstance) - pInstance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); - void ResetTimer(uint32 inc = 0) - { - SummonSkeletonsTimer = 5000 + inc; - FrostTombTimer = 28000 + inc; - } + if (pInstance) + pInstance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void ResetTimer(uint32 inc = 0) + { + SummonSkeletonsTimer = 5000 + inc; + FrostTombTimer = 28000 + inc; + } - if (ShadowboltTimer <= diff) + void UpdateAI(const uint32 diff) { - Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); - if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - me->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHADOWBOLT, SPELL_SHADOWBOLT_HEROIC), true); - ShadowboltTimer = 10000; - } else ShadowboltTimer -= diff; - - if (!Skeletons) - if ((SummonSkeletonsTimer <= diff)) + if (!UpdateVictim()) + return; + + if (ShadowboltTimer <= diff) { - Creature* Skeleton; - DoScriptText(SAY_SKELETONS, me); - for (uint8 i = 0; i < 5; ++i) + Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); + if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + me->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHADOWBOLT, SPELL_SHADOWBOLT_HEROIC), true); + ShadowboltTimer = 10000; + } else ShadowboltTimer -= diff; + + if (!Skeletons) + if ((SummonSkeletonsTimer <= diff)) { - Skeleton = me->SummonCreature(CREATURE_SKELETON, SkeletonSpawnPoint[i][0], SkeletonSpawnPoint[i][1] , SKELETONSPAWN_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - if (Skeleton) + Creature* Skeleton; + DoScriptText(SAY_SKELETONS, me); + for (uint8 i = 0; i < 5; ++i) { - Skeleton->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Skeleton->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY() , me->GetPositionZ()); - Skeleton->AddThreat(me->getVictim(), 0.0f); - DoZoneInCombat(Skeleton); + Skeleton = me->SummonCreature(CREATURE_SKELETON, SkeletonSpawnPoint[i][0], SkeletonSpawnPoint[i][1] , SKELETONSPAWN_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + if (Skeleton) + { + Skeleton->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Skeleton->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY() , me->GetPositionZ()); + Skeleton->AddThreat(me->getVictim(), 0.0f); + DoZoneInCombat(Skeleton); + } } - } - Skeletons = true; - } else SummonSkeletonsTimer -= diff; + Skeletons = true; + } else SummonSkeletonsTimer -= diff; - if (FrostTombTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (pTarget->isAlive()) - { - //DoCast(pTarget, SPELL_FROST_TOMB_SUMMON, true); - if (Creature *pChains = me->SummonCreature(CREATURE_FROSTTOMB, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + if (FrostTombTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (pTarget->isAlive()) { - CAST_AI(mob_frost_tombAI, pChains->AI())->SetPrisoner(pTarget); - pChains->CastSpell(pTarget, SPELL_FROST_TOMB, true); - - DoScriptText(SAY_FROST_TOMB, me); + //DoCast(pTarget, SPELL_FROST_TOMB_SUMMON, true); + if (Creature *pChains = me->SummonCreature(CREATURE_FROSTTOMB, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + { + CAST_AI(mob_frost_tomb::mob_frost_tombAI, pChains->AI())->SetPrisoner(pTarget); + pChains->CastSpell(pTarget, SPELL_FROST_TOMB, true); + + DoScriptText(SAY_FROST_TOMB, me); + } } - } - FrostTombTimer = 15000; - } else FrostTombTimer -= diff; + FrostTombTimer = 15000; + } else FrostTombTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -struct mob_vrykul_skeletonAI : public ScriptedAI +}; +
class mob_vrykul_skeleton : public CreatureScript { - mob_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + mob_vrykul_skeleton() : CreatureScript("mob_vrykul_skeleton") { } - ScriptedInstance *pInstance; - uint32 Respawn_Time; - uint64 Target_Guid; - uint32 Decrepify_Timer; - - bool isDead; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Respawn_Time = 12000; - Decrepify_Timer = urand(10000,20000); - isDead = false; + return new mob_vrykul_skeletonAI (pCreature); } - void EnterCombat(Unit * /*who*/){} - void DamageTaken(Unit *done_by, uint32 &damage) + struct mob_vrykul_skeletonAI : public ScriptedAI { - if (done_by->GetGUID() == me->GetGUID()) - return; - - if (damage >= me->GetHealth()) + mob_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) { - PretendToDie(); - damage = 0; + pInstance = c->GetInstanceScript(); } - } - void PretendToDie() - { - isDead = true; - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - }; + InstanceScript *pInstance; + uint32 Respawn_Time; + uint64 Target_Guid; + uint32 Decrepify_Timer; - void Resurrect() - { - isDead = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_SCOURGE_RESSURRECTION, true); + bool isDead; - if (me->getVictim()) + void Reset() { - me->GetMotionMaster()->MoveChase(me->getVictim()); - me->AI()->AttackStart(me->getVictim()); + Respawn_Time = 12000; + Decrepify_Timer = urand(10000,20000); + isDead = false; } - else - me->GetMotionMaster()->Initialize(); - }; - void UpdateAI(const uint32 diff) - { - if (pInstance && pInstance->GetData(DATA_PRINCEKELESETH_EVENT) == IN_PROGRESS) + void EnterCombat(Unit * /*who*/){} + void DamageTaken(Unit *done_by, uint32 &damage) { - if (isDead) + if (done_by->GetGUID() == me->GetGUID()) + return; + + if (damage >= me->GetHealth()) { - if (Respawn_Time <= diff) - { - Resurrect(); - Respawn_Time = 12000; - } else Respawn_Time -= diff; + PretendToDie(); + damage = 0; } - else + } + + void PretendToDie() + { + isDead = true; + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + }; + + void Resurrect() + { + isDead = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_SCOURGE_RESSURRECTION, true); + + if (me->getVictim()) { - if (!UpdateVictim()) - return; + me->GetMotionMaster()->MoveChase(me->getVictim()); + me->AI()->AttackStart(me->getVictim()); + } + else + me->GetMotionMaster()->Initialize(); + }; - if (Decrepify_Timer <= diff) + void UpdateAI(const uint32 diff) + { + if (pInstance && pInstance->GetData(DATA_PRINCEKELESETH_EVENT) == IN_PROGRESS) + { + if (isDead) + { + if (Respawn_Time <= diff) + { + Resurrect(); + Respawn_Time = 12000; + } else Respawn_Time -= diff; + } + else { - DoCast(me->getVictim(), SPELL_DECREPIFY); - Decrepify_Timer = 30000; - } else Decrepify_Timer -= diff; + if (!UpdateVictim()) + return; + + if (Decrepify_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DECREPIFY); + Decrepify_Timer = 30000; + } else Decrepify_Timer -= diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } + }else + { + if (me->isAlive()) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - }else - { - if (me->isAlive()) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + }; - } }; -CreatureAI* GetAI_mob_frost_tomb(Creature* pCreature) -{ - return new mob_frost_tombAI(pCreature); -} -CreatureAI* GetAI_boss_keleseth(Creature* pCreature) -{ - return new boss_kelesethAI (pCreature); -} -CreatureAI* GetAI_mob_vrykul_skeleton(Creature* pCreature) -{ - return new mob_vrykul_skeletonAI (pCreature); -} void AddSC_boss_keleseth() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_keleseth"; - newscript->GetAI = &GetAI_boss_keleseth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frost_tomb"; - newscript->GetAI = &GetAI_mob_frost_tomb; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_vrykul_skeleton"; - newscript->GetAI = &GetAI_mob_vrykul_skeleton; - newscript->RegisterSelf(); + new boss_keleseth(); + new mob_frost_tomb(); + new mob_vrykul_skeleton(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index 02fc594b74a..8e3299e4571 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -56,333 +56,338 @@ enum eEnums SPELL_SUMMON_DALRONN_GHOST = 48612, MOB_DALRONN_GHOST = 27389 }; - -struct boss_skarvald_the_constructorAI : public ScriptedAI +
class boss_skarvald_the_constructor : public CreatureScript { - boss_skarvald_the_constructorAI(Creature *c) : ScriptedAI(c) +public: + boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_skarvald_the_constructorAI (pCreature); } - ScriptedInstance* pInstance; + struct boss_skarvald_the_constructorAI : public ScriptedAI + { + boss_skarvald_the_constructorAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - bool ghost; - uint32 Charge_Timer; - uint32 StoneStrike_Timer; - uint32 Response_Timer; - uint32 Check_Timer; - bool Dalronn_isDead; + InstanceScript* pInstance; - void Reset() - { - Charge_Timer = 5000; - StoneStrike_Timer = 10000; - Dalronn_isDead = false; - Check_Timer = 5000; + bool ghost; + uint32 Charge_Timer; + uint32 StoneStrike_Timer; + uint32 Response_Timer; + uint32 Check_Timer; + bool Dalronn_isDead; - ghost = (me->GetEntry() == MOB_SKARVALD_GHOST); - if (!ghost && pInstance) + void Reset() { - Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->isDead()) - CAST_CRE(dalronn)->Respawn(); + Charge_Timer = 5000; + StoneStrike_Timer = 10000; + Dalronn_isDead = false; + Check_Timer = 5000; + + ghost = (me->GetEntry() == MOB_SKARVALD_GHOST); + if (!ghost && pInstance) + { + Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); + if (dalronn && dalronn->isDead()) + CAST_CRE(dalronn)->Respawn(); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + } } - } - void EnterCombat(Unit * who) - { - if (!ghost && pInstance) + void EnterCombat(Unit * who) { - DoScriptText(YELL_SKARVALD_AGGRO,me); + if (!ghost && pInstance) + { + DoScriptText(YELL_SKARVALD_AGGRO,me); - Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->isAlive() && !dalronn->getVictim()) - dalronn->getThreatManager().addThreat(who,0.0f); + Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); + if (dalronn && dalronn->isAlive() && !dalronn->getVictim()) + dalronn->getThreatManager().addThreat(who,0.0f); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + } } - } - void JustDied(Unit* Killer) - { - if (!ghost && pInstance) + void JustDied(Unit* Killer) { - Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); - if (dalronn) + if (!ghost && pInstance) { - if (dalronn->isDead()) + Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); + if (dalronn) { - DoScriptText(YELL_SKARVALD_DAL_DIED,me); - - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); - } - else - { - DoScriptText(YELL_SKARVALD_SKA_DIEDFIRST,me); + if (dalronn->isDead()) + { + DoScriptText(YELL_SKARVALD_DAL_DIED,me); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); - Creature* temp = me->SummonCreature(MOB_SKARVALD_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); - if (temp) + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); + } + else { - temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(Killer); + DoScriptText(YELL_SKARVALD_SKA_DIEDFIRST,me); + + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); + Creature* temp = me->SummonCreature(MOB_SKARVALD_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); + if (temp) + { + temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + temp->AI()->AttackStart(Killer); + } } } } } - } - void KilledUnit(Unit * /*victim*/) - { - if (!ghost) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(YELL_SKARVALD_KILL,me); + if (!ghost) + { + DoScriptText(YELL_SKARVALD_KILL,me); + } } - } - void UpdateAI(const uint32 diff) - { - if (ghost) + void UpdateAI(const uint32 diff) { - if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + if (ghost) + { + if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (!ghost) - { - if (Check_Timer) - if (Check_Timer <= diff) - { - Check_Timer = 5000; - Unit* dalronn = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_DALRONN) : 0); - if (dalronn && dalronn->isDead()) - { - Dalronn_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; - } - } else Check_Timer -= diff; - - if (Response_Timer) - if (Dalronn_isDead) - if (Response_Timer <= diff) + if (!ghost) + { + if (Check_Timer) + if (Check_Timer <= diff) { - DoScriptText(YELL_SKARVALD_DAL_DIEDFIRST,me); + Check_Timer = 5000; + Unit* dalronn = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_DALRONN) : 0); + if (dalronn && dalronn->isDead()) + { + Dalronn_isDead = true; + Response_Timer = 2000; + Check_Timer = 0; + } + } else Check_Timer -= diff; + + if (Response_Timer) + if (Dalronn_isDead) + if (Response_Timer <= diff) + { + DoScriptText(YELL_SKARVALD_DAL_DIEDFIRST,me); + + Response_Timer = 0; + } else Response_Timer -= diff; + } - Response_Timer = 0; - } else Response_Timer -= diff; - } + if (Charge_Timer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CHARGE); + Charge_Timer = 5000+rand()%5000; + } else Charge_Timer -= diff; - if (Charge_Timer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CHARGE); - Charge_Timer = 5000+rand()%5000; - } else Charge_Timer -= diff; + if (StoneStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STONE_STRIKE); + StoneStrike_Timer = 5000+rand()%5000; + } else StoneStrike_Timer -= diff; - if (StoneStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_STONE_STRIKE); - StoneStrike_Timer = 5000+rand()%5000; - } else StoneStrike_Timer -= diff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_skarvald_the_constructor(Creature* pCreature) +
class boss_dalronn_the_controller : public CreatureScript { - return new boss_skarvald_the_constructorAI (pCreature); -} +public: + boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { } -struct boss_dalronn_the_controllerAI : public ScriptedAI -{ - boss_dalronn_the_controllerAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_dalronn_the_controllerAI (pCreature); } - ScriptedInstance* pInstance; + struct boss_dalronn_the_controllerAI : public ScriptedAI + { + boss_dalronn_the_controllerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - bool ghost; - uint32 ShadowBolt_Timer; - uint32 Debilitate_Timer; - uint32 Summon_Timer; + InstanceScript* pInstance; - uint32 Response_Timer; - uint32 Check_Timer; - uint32 AggroYell_Timer; - bool Skarvald_isDead; + bool ghost; + uint32 ShadowBolt_Timer; + uint32 Debilitate_Timer; + uint32 Summon_Timer; - void Reset() - { - ShadowBolt_Timer = 1000; - Debilitate_Timer = 5000; - Summon_Timer = 10000; - Check_Timer = 5000; - Skarvald_isDead = false; - AggroYell_Timer = 0; - - ghost = me->GetEntry() == MOB_DALRONN_GHOST; - if (!ghost && pInstance) + uint32 Response_Timer; + uint32 Check_Timer; + uint32 AggroYell_Timer; + bool Skarvald_isDead; + + void Reset() { - Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->isDead()) - CAST_CRE(skarvald)->Respawn(); + ShadowBolt_Timer = 1000; + Debilitate_Timer = 5000; + Summon_Timer = 10000; + Check_Timer = 5000; + Skarvald_isDead = false; + AggroYell_Timer = 0; + + ghost = me->GetEntry() == MOB_DALRONN_GHOST; + if (!ghost && pInstance) + { + Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); + if (skarvald && skarvald->isDead()) + CAST_CRE(skarvald)->Respawn(); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + } } - } - void EnterCombat(Unit * who) - { - if (!ghost && pInstance) + void EnterCombat(Unit * who) { - Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->isAlive() && !skarvald->getVictim()) - skarvald->getThreatManager().addThreat(who,0.0f); + if (!ghost && pInstance) + { + Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); + if (skarvald && skarvald->isAlive() && !skarvald->getVictim()) + skarvald->getThreatManager().addThreat(who,0.0f); - AggroYell_Timer = 5000; + AggroYell_Timer = 5000; - if (pInstance) - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + if (pInstance) + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + } } - } - void JustDied(Unit* Killer) - { - if (!ghost && pInstance) + void JustDied(Unit* Killer) { - Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); - if (skarvald) - if (skarvald->isDead()) - { - DoScriptText(YELL_DALRONN_SKA_DIED,me); - - if (pInstance) - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); - } - else - { - DoScriptText(YELL_DALRONN_DAL_DIEDFIRST,me); + if (!ghost && pInstance) + { + Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); + if (skarvald) + if (skarvald->isDead()) + { + DoScriptText(YELL_DALRONN_SKA_DIED,me); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); - Creature* temp = me->SummonCreature(MOB_DALRONN_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); - if (temp) + if (pInstance) + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); + } + else { - temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(Killer); + DoScriptText(YELL_DALRONN_DAL_DIEDFIRST,me); + + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); + Creature* temp = me->SummonCreature(MOB_DALRONN_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); + if (temp) + { + temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + temp->AI()->AttackStart(Killer); + } } - } + } } - } - void KilledUnit(Unit * /*victim*/) - { - if (!ghost) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(YELL_DALRONN_KILL,me); + if (!ghost) + { + DoScriptText(YELL_DALRONN_KILL,me); + } } - } - void UpdateAI(const uint32 diff) - { - if (ghost) + void UpdateAI(const uint32 diff) { - if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - if (!UpdateVictim()) - return; - - if (AggroYell_Timer) - if (AggroYell_Timer <= diff) + if (ghost) { - DoScriptText(YELL_DALRONN_AGGRO,me); + if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } - AggroYell_Timer = 0; - } else AggroYell_Timer -= diff; + if (!UpdateVictim()) + return; - if (!ghost) - { - if (Check_Timer) - if (Check_Timer <= diff) + if (AggroYell_Timer) + if (AggroYell_Timer <= diff) { - Check_Timer = 5000; - Unit* skarvald = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SKARVALD) : 0); - if (skarvald && skarvald->isDead()) - { - Skarvald_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; - } - } else Check_Timer -= diff; + DoScriptText(YELL_DALRONN_AGGRO,me); - if (Response_Timer) - if (Skarvald_isDead) - if (Response_Timer <= diff) - { - DoScriptText(YELL_DALRONN_SKA_DIEDFIRST,me); + AggroYell_Timer = 0; + } else AggroYell_Timer -= diff; - Response_Timer = 0; - } else Response_Timer -= diff; - } - - if (ShadowBolt_Timer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (!ghost) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); - ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells + if (Check_Timer) + if (Check_Timer <= diff) + { + Check_Timer = 5000; + Unit* skarvald = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SKARVALD) : 0); + if (skarvald && skarvald->isDead()) + { + Skarvald_isDead = true; + Response_Timer = 2000; + Check_Timer = 0; + } + } else Check_Timer -= diff; + + if (Response_Timer) + if (Skarvald_isDead) + if (Response_Timer <= diff) + { + DoScriptText(YELL_DALRONN_SKA_DIEDFIRST,me); + + Response_Timer = 0; + } else Response_Timer -= diff; } - } else ShadowBolt_Timer -= diff; - if (Debilitate_Timer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (ShadowBolt_Timer <= diff) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); - Debilitate_Timer = 5000+rand()%5000; - } - } else Debilitate_Timer -= diff; + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); + ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells + } + } else ShadowBolt_Timer -= diff; - if (IsHeroic()) - if (Summon_Timer <= diff) + if (Debilitate_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { - DoCast(me, H_SPELL_SUMMON_SKELETONS); - Summon_Timer = (rand()%10000) + 20000; + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); + Debilitate_Timer = 5000+rand()%5000; } - } else Summon_Timer -= diff; + } else Debilitate_Timer -= diff; + + if (IsHeroic()) + if (Summon_Timer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, H_SPELL_SUMMON_SKELETONS); + Summon_Timer = (rand()%10000) + 20000; + } + } else Summon_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_dalronn_the_controller(Creature* pCreature) -{ - return new boss_dalronn_the_controllerAI (pCreature); -} void AddSC_boss_skarvald_dalronn() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_skarvald_the_constructor"; - newscript->GetAI = &GetAI_boss_skarvald_the_constructor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_dalronn_the_controller"; - newscript->GetAI = &GetAI_boss_dalronn_the_controller; - newscript->RegisterSelf(); + new boss_skarvald_the_constructor(); + new boss_dalronn_the_controller(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 1a45b18326c..4ad3076fb05 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -47,265 +47,268 @@ EndScriptData */ 1 - Skarvald Dalronn 2 - Ingvar the Plunderer */ - -struct instance_utgarde_keep : public ScriptedInstance +
class instance_utgarde_keep : public InstanceMapScript { - instance_utgarde_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 Keleseth; - uint64 Skarvald; - uint64 Dalronn; - uint64 Ingvar; - - uint64 forge_bellow[3]; - uint64 forge_fire[3]; - uint64 forge_anvil[3]; - uint64 portcullis[2]; +public: + instance_utgarde_keep() : InstanceMapScript("instance_utgarde_keep") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 forge_event[3]; - std::string str_data; - - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_utgarde_keep_InstanceMapScript(pMap); + } - Keleseth = 0; - Skarvald = 0; - Dalronn = 0; - Ingvar = 0; + struct instance_utgarde_keep_InstanceMapScript : public InstanceScript + { + instance_utgarde_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - for (uint8 i = 0; i < 3; ++i) - { - forge_bellow[i] = 0; - forge_fire[i] = 0; - forge_anvil[i] = 0; - forge_event[i] = NOT_STARTED; - } + uint64 Keleseth; + uint64 Skarvald; + uint64 Dalronn; + uint64 Ingvar; - portcullis[0] = 0; - portcullis[1] = 0; - } + uint64 forge_bellow[3]; + uint64 forge_fire[3]; + uint64 forge_anvil[3]; + uint64 portcullis[2]; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 forge_event[3]; + std::string str_data; - return false; - } + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + Keleseth = 0; + Skarvald = 0; + Dalronn = 0; + Ingvar = 0; - if (!players.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (uint8 i = 0; i < 3; ++i) { - if (Player* plr = itr->getSource()) - return plr; + forge_bellow[i] = 0; + forge_fire[i] = 0; + forge_anvil[i] = 0; + forge_event[i] = NOT_STARTED; } - } - sLog.outDebug("TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + portcullis[0] = 0; + portcullis[1] = 0; + } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + bool IsEncounterInProgress() const { - case 23953: Keleseth = pCreature->GetGUID(); break; - case 24201: Dalronn = pCreature->GetGUID(); break; - case 24200: Skarvald = pCreature->GetGUID(); break; - case 23954: Ingvar = pCreature->GetGUID(); break; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + Player* GetPlayerInMap() { - //door and object id - case ENTRY_BELLOW_1: forge_bellow[0] = pGo->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_BELLOW_2: forge_bellow[1] = pGo->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_BELLOW_3: forge_bellow[2] = pGo->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_FORGEFIRE_1: forge_fire[0] = pGo->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_FORGEFIRE_2: forge_fire[1] = pGo->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_FORGEFIRE_3: forge_fire[2] = pGo->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GLOWING_ANVIL_1: forge_anvil[0] = pGo->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GLOWING_ANVIL_2: forge_anvil[1] = pGo->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GLOWING_ANVIL_3: forge_anvil[2] = pGo->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GIANT_PORTCULLIS_1: portcullis[0] = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GIANT_PORTCULLIS_2: portcullis[1] = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + sLog.outDebug("TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); + return NULL; } - } - uint64 GetData64(uint32 identifier) - { - switch(identifier) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_PRINCEKELESETH: return Keleseth; - case DATA_DALRONN: return Dalronn; - case DATA_SKARVALD: return Skarvald; - case DATA_INGVAR: return Ingvar; + switch(pCreature->GetEntry()) + { + case 23953: Keleseth = pCreature->GetGUID(); break; + case 24201: Dalronn = pCreature->GetGUID(); break; + case 24200: Skarvald = pCreature->GetGUID(); break; + case 23954: Ingvar = pCreature->GetGUID(); break; + } } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_PRINCEKELESETH_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_SKARVALD_DALRONN_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_INGVAR_EVENT: - if (data == DONE) + switch(pGo->GetEntry()) { - HandleGameObject(portcullis[0], true); - HandleGameObject(portcullis[1], true); + //door and object id + case ENTRY_BELLOW_1: forge_bellow[0] = pGo->GetGUID(); + if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_BELLOW_2: forge_bellow[1] = pGo->GetGUID(); + if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_BELLOW_3: forge_bellow[2] = pGo->GetGUID(); + if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_FORGEFIRE_1: forge_fire[0] = pGo->GetGUID(); + if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_FORGEFIRE_2: forge_fire[1] = pGo->GetGUID(); + if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_FORGEFIRE_3: forge_fire[2] = pGo->GetGUID(); + if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GLOWING_ANVIL_1: forge_anvil[0] = pGo->GetGUID(); + if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GLOWING_ANVIL_2: forge_anvil[1] = pGo->GetGUID(); + if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GLOWING_ANVIL_3: forge_anvil[2] = pGo->GetGUID(); + if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GIANT_PORTCULLIS_1: portcullis[0] = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GIANT_PORTCULLIS_2: portcullis[1] = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; } - m_auiEncounter[2] = data; - break; - case EVENT_FORGE_1: - if (data == NOT_STARTED) - { - HandleGameObject(forge_bellow[0],false); - HandleGameObject(forge_fire[0],false); - HandleGameObject(forge_anvil[0],false); - }else + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) { - HandleGameObject(forge_bellow[0],true); - HandleGameObject(forge_fire[0],true); - HandleGameObject(forge_anvil[0],true); + case DATA_PRINCEKELESETH: return Keleseth; + case DATA_DALRONN: return Dalronn; + case DATA_SKARVALD: return Skarvald; + case DATA_INGVAR: return Ingvar; } - forge_event[0] = data; - break; - case EVENT_FORGE_2: - if (data == NOT_STARTED) - { - HandleGameObject(forge_bellow[1],false); - HandleGameObject(forge_fire[1],false); - HandleGameObject(forge_anvil[1],false); - }else + + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) { - HandleGameObject(forge_bellow[1],true); - HandleGameObject(forge_fire[1],true); - HandleGameObject(forge_anvil[1],true); + case DATA_PRINCEKELESETH_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_SKARVALD_DALRONN_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_INGVAR_EVENT: + if (data == DONE) + { + HandleGameObject(portcullis[0], true); + HandleGameObject(portcullis[1], true); + } + m_auiEncounter[2] = data; + break; + case EVENT_FORGE_1: + if (data == NOT_STARTED) + { + HandleGameObject(forge_bellow[0],false); + HandleGameObject(forge_fire[0],false); + HandleGameObject(forge_anvil[0],false); + }else + { + HandleGameObject(forge_bellow[0],true); + HandleGameObject(forge_fire[0],true); + HandleGameObject(forge_anvil[0],true); + } + forge_event[0] = data; + break; + case EVENT_FORGE_2: + if (data == NOT_STARTED) + { + HandleGameObject(forge_bellow[1],false); + HandleGameObject(forge_fire[1],false); + HandleGameObject(forge_anvil[1],false); + }else + { + HandleGameObject(forge_bellow[1],true); + HandleGameObject(forge_fire[1],true); + HandleGameObject(forge_anvil[1],true); + } + forge_event[1] = data; + break; + case EVENT_FORGE_3: + if (data == NOT_STARTED) + { + HandleGameObject(forge_bellow[2],false); + HandleGameObject(forge_fire[2],false); + HandleGameObject(forge_anvil[2],false); + }else + { + HandleGameObject(forge_bellow[2],true); + HandleGameObject(forge_fire[2],true); + HandleGameObject(forge_anvil[2],true); + } + forge_event[2] = data; + break; } - forge_event[1] = data; - break; - case EVENT_FORGE_3: - if (data == NOT_STARTED) - { - HandleGameObject(forge_bellow[2],false); - HandleGameObject(forge_fire[2],false); - HandleGameObject(forge_anvil[2],false); - }else + + if (data == DONE) { - HandleGameObject(forge_bellow[2],true); - HandleGameObject(forge_fire[2],true); - HandleGameObject(forge_anvil[2],true); + SaveToDB(); } - forge_event[2] = data; - break; } - if (data == DONE) + uint32 GetData(uint32 type) { - SaveToDB(); - } - } + switch(type) + { + case DATA_PRINCEKELESETH_EVENT: return m_auiEncounter[0]; + case DATA_SKARVALD_DALRONN_EVENT: return m_auiEncounter[1]; + case DATA_INGVAR_EVENT: return m_auiEncounter[2]; + } - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_PRINCEKELESETH_EVENT: return m_auiEncounter[0]; - case DATA_SKARVALD_DALRONN_EVENT: return m_auiEncounter[1]; - case DATA_INGVAR_EVENT: return m_auiEncounter[2]; + return 0; } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "U K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << forge_event[0] << " " << forge_event[1] << " " << forge_event[2]; + std::ostringstream saveStream; + saveStream << "U K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << forge_event[0] << " " << forge_event[1] << " " << forge_event[2]; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; - if (dataHead1 == 'U' && dataHead2 == 'K') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; + if (dataHead1 == 'U' && dataHead2 == 'K') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - forge_event[0] = data3; - forge_event[1] = data4; - forge_event[2] = data5; + forge_event[0] = data3; + forge_event[1] = data4; + forge_event[2] = data5; - } else OUT_LOAD_INST_DATA_FAIL; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_utgarde_keep(Map* pMap) -{ - return new instance_utgarde_keep(pMap); -} void AddSC_instance_utgarde_keep() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_utgarde_keep"; - newscript->GetInstanceData = &GetInstanceData_instance_utgarde_keep; - newscript->RegisterSelf(); + new instance_utgarde_keep(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index 4ee2059712d..6672d6691b5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -24,136 +24,138 @@ uint32 entry_search[3] = 186610, 186611 }; - -struct npc_dragonflayer_forge_masterAI : public ScriptedAI +
class npc_dragonflayer_forge_master : public CreatureScript { - npc_dragonflayer_forge_masterAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - fm_Type = 0; - } +public: + npc_dragonflayer_forge_master() : CreatureScript("npc_dragonflayer_forge_master") { } - ScriptedInstance* pInstance; - uint8 fm_Type; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); - CheckForge(); + return new npc_dragonflayer_forge_masterAI(pCreature); } - void CheckForge() + struct npc_dragonflayer_forge_masterAI : public ScriptedAI { - if (pInstance) + npc_dragonflayer_forge_masterAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + fm_Type = 0; + } + + InstanceScript* pInstance; + uint8 fm_Type; + + void Reset() + { + if (fm_Type == 0) fm_Type = GetForgeMasterType(); + CheckForge(); + } + + void CheckForge() { - switch(fm_Type) + if (pInstance) { - case 1: - pInstance->SetData(EVENT_FORGE_1,me->isAlive() ? NOT_STARTED : DONE); - break; - case 2: - pInstance->SetData(EVENT_FORGE_2,me->isAlive() ? NOT_STARTED : DONE); - break; - case 3: - pInstance->SetData(EVENT_FORGE_3,me->isAlive() ? NOT_STARTED : DONE); - break; + switch(fm_Type) + { + case 1: + pInstance->SetData(EVENT_FORGE_1,me->isAlive() ? NOT_STARTED : DONE); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,me->isAlive() ? NOT_STARTED : DONE); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,me->isAlive() ? NOT_STARTED : DONE); + break; + } } } - } - void JustDied(Unit * /*killer*/) - { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); - if (pInstance) + void JustDied(Unit * /*killer*/) { - switch(fm_Type) + if (fm_Type == 0) fm_Type = GetForgeMasterType(); + if (pInstance) { - case 1: - pInstance->SetData(EVENT_FORGE_1,DONE); - break; - case 2: - pInstance->SetData(EVENT_FORGE_2,DONE); - break; - case 3: - pInstance->SetData(EVENT_FORGE_3,DONE); - break; + switch(fm_Type) + { + case 1: + pInstance->SetData(EVENT_FORGE_1,DONE); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,DONE); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,DONE); + break; + } } } - } - void EnterCombat(Unit * /*who*/) - { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); - if (pInstance) + void EnterCombat(Unit * /*who*/) { - switch(fm_Type) + if (fm_Type == 0) fm_Type = GetForgeMasterType(); + if (pInstance) { - case 1: - pInstance->SetData(EVENT_FORGE_1,IN_PROGRESS); - break; - case 2: - pInstance->SetData(EVENT_FORGE_2,IN_PROGRESS); - break; - case 3: - pInstance->SetData(EVENT_FORGE_3,IN_PROGRESS); - break; + switch(fm_Type) + { + case 1: + pInstance->SetData(EVENT_FORGE_1,IN_PROGRESS); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,IN_PROGRESS); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,IN_PROGRESS); + break; + } } + me->SetUInt32Value(UNIT_NPC_EMOTESTATE ,EMOTE_ONESHOT_NONE); } - me->SetUInt32Value(UNIT_NPC_EMOTESTATE ,EMOTE_ONESHOT_NONE); - } - uint8 GetForgeMasterType() - { - float diff = 30.0f; - int near_f = 0; - - for (uint8 i = 0; i < 3 ; ++i) + uint8 GetForgeMasterType() { - GameObject* temp; - temp = me->FindNearestGameObject(entry_search[i],30); - if (temp) + float diff = 30.0f; + int near_f = 0; + + for (uint8 i = 0; i < 3 ; ++i) { - if (me->IsWithinDist(temp,diff,false)) + GameObject* temp; + temp = me->FindNearestGameObject(entry_search[i],30); + if (temp) { - near_f = i + 1; - diff = me->GetDistance2d(temp); + if (me->IsWithinDist(temp,diff,false)) + { + near_f = i + 1; + diff = me->GetDistance2d(temp); + } } } + + switch (near_f) + { + case 1: return 1; + case 2: return 2; + case 3: return 3; + default: return 0; + } } - switch (near_f) + void UpdateAI(const uint32 /*diff*/) { - case 1: return 1; - case 2: return 2; - case 3: return 3; - default: return 0; - } - } + if (fm_Type == 0) + fm_Type = GetForgeMasterType(); - void UpdateAI(const uint32 /*diff*/) - { - if (fm_Type == 0) - fm_Type = GetForgeMasterType(); + if (!UpdateVictim()) + return; - if (!UpdateVictim()) - return; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_dragonflayer_forge_master(Creature* pCreature) -{ - return new npc_dragonflayer_forge_masterAI(pCreature); -} void AddSC_utgarde_keep() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_dragonflayer_forge_master"; - newscript->GetAI = &GetAI_npc_dragonflayer_forge_master; - newscript->RegisterSelf(); + new npc_dragonflayer_forge_master(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index af20d156c15..94d6d46acaa 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -84,188 +84,195 @@ enum Phase PHASE_GORTOK_PALEHOOF, PHASE_NONE }; - -struct boss_palehoofAI : public ScriptedAI +
class boss_palehoof : public CreatureScript { - boss_palehoofAI(Creature *c) : ScriptedAI(c) +public: + boss_palehoof() : CreatureScript("boss_palehoof") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_palehoofAI (pCreature); } - uint32 uiArcingSmashTimer; - uint32 uiImpaleTimer; - uint32 uiWhiteringRoarTimer; - uint32 uiWaitingTimer; - Phase currentPhase; - uint8 AddCount; - bool DoneAdds[4]; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_palehoofAI : public ScriptedAI { - uiArcingSmashTimer = 15000; - uiImpaleTimer = 12000; - uiWhiteringRoarTimer = 10000; - - me->GetMotionMaster()->MoveTargetedHome(); + boss_palehoofAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - for (uint32 i=0;i<4;i++) - DoneAdds[i]=false; - AddCount=0; + uint32 uiArcingSmashTimer; + uint32 uiImpaleTimer; + uint32 uiWhiteringRoarTimer; + uint32 uiWaitingTimer; + Phase currentPhase; + uint8 AddCount; + bool DoneAdds[4]; - currentPhase=PHASE_NONE; + InstanceScript *pInstance; - if (pInstance) + void Reset() { - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); - - Creature* pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + uiArcingSmashTimer = 15000; + uiImpaleTimer = 12000; + uiWhiteringRoarTimer = 10000; - pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + me->GetMotionMaster()->MoveTargetedHome(); - pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + for (uint32 i=0;i<4;i++) + DoneAdds[i]=false; + AddCount=0; - pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + currentPhase=PHASE_NONE; - GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)); - if (pGo) + if (pInstance) { - pGo->SetGoState(GO_STATE_READY); - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - } - } - } + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + Creature* pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); - void AttackStart(Unit* who) - { - if (!who) - return; + pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); + + pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); + + pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)); + if (pGo) + { + pGo->SetGoState(GO_STATE_READY); + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + } + } - if (me->Attack(who, true)) + void EnterCombat(Unit* /*who*/) { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + DoScriptText(SAY_AGGRO, me); } - } - void UpdateAI(const uint32 diff) - { - if (currentPhase != PHASE_GORTOK_PALEHOOF) - return; - //Return since we have no target - if (!UpdateVictim()) - return; + void AttackStart(Unit* who) + { + if (!who) + return; - Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); - if (pTemp && pTemp->isAlive()) - pTemp->DisappearAndDie(); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (uiArcingSmashTimer <= diff) - { - DoCast(me, SPELL_ARCING_SMASH); - uiArcingSmashTimer = urand(13000,17000); - } else uiArcingSmashTimer -= diff; + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } - if (uiImpaleTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_IMPALE); - uiImpaleTimer = urand(8000,12000); - } else uiImpaleTimer -= diff; + if (currentPhase != PHASE_GORTOK_PALEHOOF) + return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiWhiteringRoarTimer <= diff) - { - DoCast(me, SPELL_WITHERING_ROAR); - uiWhiteringRoarTimer = urand(8000,12000); - } else uiWhiteringRoarTimer -= diff; + Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); + if (pTemp && pTemp->isAlive()) + pTemp->DisappearAndDie(); - DoMeleeAttackIfReady(); - } + if (uiArcingSmashTimer <= diff) + { + DoCast(me, SPELL_ARCING_SMASH); + uiArcingSmashTimer = urand(13000,17000); + } else uiArcingSmashTimer -= diff; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); - Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); - if (pTemp && pTemp->isAlive()) - pTemp->DisappearAndDie(); - } + if (uiImpaleTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_IMPALE); + uiImpaleTimer = urand(8000,12000); + } else uiImpaleTimer -= diff; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + if (uiWhiteringRoarTimer <= diff) + { + DoCast(me, SPELL_WITHERING_ROAR); + uiWhiteringRoarTimer = urand(8000,12000); + } else uiWhiteringRoarTimer -= diff; - void NextPhase() - { - if (currentPhase == PHASE_NONE) + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); + Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); + if (pTemp && pTemp->isAlive()) + pTemp->DisappearAndDie(); + } + + void KilledUnit(Unit * /*victim*/) { - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); - me->SummonCreature(MOB_STASIS_CONTROLLER,moveLocs[5].x,moveLocs[5].y,moveLocs[5].z,0,TEMPSUMMON_CORPSE_DESPAWN); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); } - Phase move = PHASE_NONE; - if (AddCount >= DUNGEON_MODE(2,4)) - move = PHASE_GORTOK_PALEHOOF; - else + + void NextPhase() { - //select random not yet defeated add - uint8 next = urand(0,3); - for (uint8 i=0; i < 16; i++) + if (currentPhase == PHASE_NONE) + { + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + me->SummonCreature(MOB_STASIS_CONTROLLER,moveLocs[5].x,moveLocs[5].y,moveLocs[5].z,0,TEMPSUMMON_CORPSE_DESPAWN); + } + Phase move = PHASE_NONE; + if (AddCount >= DUNGEON_MODE(2,4)) + move = PHASE_GORTOK_PALEHOOF; + else { - if (!DoneAdds[i%4] && next == 0) + //select random not yet defeated add + uint8 next = urand(0,3); + for (uint8 i=0; i < 16; i++) { - move = (Phase)(i%4); - break; - } else if (!DoneAdds[i%4] && next > 0) - --next; + if (!DoneAdds[i%4] && next == 0) + { + move = (Phase)(i%4); + break; + } else if (!DoneAdds[i%4] && next > 0) + --next; + } + ++AddCount; + DoneAdds[move] = true; + move = (Phase)(move%4); + } + //send orb to summon spot + Creature *pOrb = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); + if (pOrb && pOrb->isAlive()) + { + if (currentPhase == PHASE_NONE) + pOrb->CastSpell(me,SPELL_ORB_VISUAL,true); + pOrb->GetMotionMaster()->MovePoint(move,moveLocs[move].x,moveLocs[move].y,moveLocs[move].z); } - ++AddCount; - DoneAdds[move] = true; - move = (Phase)(move%4); + currentPhase = move; } - //send orb to summon spot - Creature *pOrb = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); - if (pOrb && pOrb->isAlive()) + + void JustReachedHome() { - if (currentPhase == PHASE_NONE) - pOrb->CastSpell(me,SPELL_ORB_VISUAL,true); - pOrb->GetMotionMaster()->MovePoint(move,moveLocs[move].x,moveLocs[move].y,moveLocs[move].z); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - currentPhase = move; - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_boss_palehoof(Creature* pCreature) -{ - return new boss_palehoofAI (pCreature); -} //ravenous furbolg's spells enum RavenousSpells @@ -275,103 +282,110 @@ enum RavenousSpells SPELL_CRAZED = 48139, SPELL_TERRIFYING_ROAR = 48144 }; - -struct mob_ravenous_furbolgAI : public ScriptedAI +
class mob_ravenous_furbolg : public CreatureScript { - mob_ravenous_furbolgAI(Creature *c) : ScriptedAI(c) +public: + mob_ravenous_furbolg() : CreatureScript("mob_ravenous_furbolg") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_ravenous_furbolgAI (pCreature); } - uint32 uiChainLightingTimer; - uint32 uiCrazedTimer; - uint32 uiTerrifyingRoarTimer; + struct mob_ravenous_furbolgAI : public ScriptedAI + { + mob_ravenous_furbolgAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance *pInstance; + uint32 uiChainLightingTimer; + uint32 uiCrazedTimer; + uint32 uiTerrifyingRoarTimer; - void Reset() - { - uiChainLightingTimer = 5000; - uiCrazedTimer = 10000; - uiTerrifyingRoarTimer = 15000; + InstanceScript *pInstance; - me->GetMotionMaster()->MoveTargetedHome(); + void Reset() + { + uiChainLightingTimer = 5000; + uiCrazedTimer = 10000; + uiTerrifyingRoarTimer = 15000; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); - } - } + me->GetMotionMaster()->MoveTargetedHome(); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } - if (uiChainLightingTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTING); - uiChainLightingTimer = 5000 + rand()%5000; - } else uiChainLightingTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiCrazedTimer <= diff) - { - DoCast(me, SPELL_CRAZED); - uiCrazedTimer = 8000 + rand()%4000; - } else uiCrazedTimer -= diff; + if (uiChainLightingTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTING); + uiChainLightingTimer = 5000 + rand()%5000; + } else uiChainLightingTimer -= diff; - if (uiTerrifyingRoarTimer <= diff) - { - DoCast(me, SPELL_TERRIFYING_ROAR); - uiTerrifyingRoarTimer = 10000 + rand()%10000; - } else uiTerrifyingRoarTimer -= diff; + if (uiCrazedTimer <= diff) + { + DoCast(me, SPELL_CRAZED); + uiCrazedTimer = 8000 + rand()%4000; + } else uiCrazedTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiTerrifyingRoarTimer <= diff) + { + DoCast(me, SPELL_TERRIFYING_ROAR); + uiTerrifyingRoarTimer = 10000 + rand()%10000; + } else uiTerrifyingRoarTimer -= diff; - void AttackStart(Unit* who) - { - if (!who) - return; + DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } - if (me->Attack(who, true)) + void JustDied(Unit* /*killer*/) { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + if (pInstance) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + } } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_mob_ravenous_furbolg(Creature* pCreature) -{ - return new mob_ravenous_furbolgAI (pCreature); -} //frenzied worgen's spells enum FrenziedSpells @@ -381,105 +395,112 @@ enum FrenziedSpells SPELL_ENRAGE_1 = 48138, SPELL_ENRAGE_2 = 48142 }; - -struct mob_frenzied_worgenAI : public ScriptedAI +
class mob_frenzied_worgen : public CreatureScript { - mob_frenzied_worgenAI(Creature *c) : ScriptedAI(c) +public: + mob_frenzied_worgen() : CreatureScript("mob_frenzied_worgen") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_frenzied_worgenAI (pCreature); } - uint32 uiMortalWoundTimer; - uint32 uiEnrage1Timer; - uint32 uiEnrage2Timer; + struct mob_frenzied_worgenAI : public ScriptedAI + { + mob_frenzied_worgenAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance *pInstance; + uint32 uiMortalWoundTimer; + uint32 uiEnrage1Timer; + uint32 uiEnrage2Timer; - void Reset() - { - uiMortalWoundTimer = 5000; - uiEnrage1Timer = 15000; - uiEnrage2Timer = 10000; + InstanceScript *pInstance; - me->GetMotionMaster()->MoveTargetedHome(); + void Reset() + { + uiMortalWoundTimer = 5000; + uiEnrage1Timer = 15000; + uiEnrage2Timer = 10000; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); - } - } + me->GetMotionMaster()->MoveTargetedHome(); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } - if (uiMortalWoundTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MORTAL_WOUND); - uiMortalWoundTimer = 3000 + rand()%4000; - } else uiMortalWoundTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiEnrage1Timer <= diff) - { - DoCast(me, SPELL_ENRAGE_1); - uiEnrage1Timer = 15000; - } else uiEnrage1Timer -= diff; + if (uiMortalWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_WOUND); + uiMortalWoundTimer = 3000 + rand()%4000; + } else uiMortalWoundTimer -= diff; - if (uiEnrage2Timer <= diff) - { - DoCast(me, SPELL_ENRAGE_2); - uiEnrage2Timer = 10000; - } else uiEnrage2Timer -= diff; + if (uiEnrage1Timer <= diff) + { + DoCast(me, SPELL_ENRAGE_1); + uiEnrage1Timer = 15000; + } else uiEnrage1Timer -= diff; - DoMeleeAttackIfReady(); - } + if (uiEnrage2Timer <= diff) + { + DoCast(me, SPELL_ENRAGE_2); + uiEnrage2Timer = 10000; + } else uiEnrage2Timer -= diff; - void AttackStart(Unit* who) - { - if (!who) - return; + DoMeleeAttackIfReady(); + } - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void AttackStart(Unit* who) + { + if (!who) + return; - if (me->Attack(who, true)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + if (pInstance) + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + if (pInstance) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance->GetData64(DATA_GORTOK_PALEHOOF)); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + } } - if (pInstance) - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance->GetData64(DATA_GORTOK_PALEHOOF)); - if (pPalehoof) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_mob_frenzied_worgen(Creature* pCreature) -{ - return new mob_frenzied_worgenAI (pCreature); -} //ferocious rhino's spells enum FerociousSpells @@ -490,104 +511,111 @@ enum FerociousSpells H_SPELL_GRIEVOUS_WOUND = 59263, SPELL_STOMP = 48131 }; - -struct mob_ferocious_rhinoAI : public ScriptedAI +
class mob_ferocious_rhino : public CreatureScript { - mob_ferocious_rhinoAI(Creature *c) : ScriptedAI(c) +public: + mob_ferocious_rhino() : CreatureScript("mob_ferocious_rhino") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_ferocious_rhinoAI (pCreature); } - uint32 uiStompTimer; - uint32 uiGoreTimer; - uint32 uiGrievousWoundTimer; + struct mob_ferocious_rhinoAI : public ScriptedAI + { + mob_ferocious_rhinoAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance *pInstance; + uint32 uiStompTimer; + uint32 uiGoreTimer; + uint32 uiGrievousWoundTimer; - void Reset() - { - uiStompTimer = 10000; - uiGoreTimer = 15000; - uiGrievousWoundTimer = 20000; + InstanceScript *pInstance; - me->GetMotionMaster()->MoveTargetedHome(); + void Reset() + { + uiStompTimer = 10000; + uiGoreTimer = 15000; + uiGrievousWoundTimer = 20000; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); - } - } + me->GetMotionMaster()->MoveTargetedHome(); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } - if (uiStompTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_STOMP); - uiStompTimer = 8000 + rand()%4000; - } else uiStompTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiGoreTimer <= diff) - { - DoCast(me->getVictim(), SPELL_GORE); - uiGoreTimer = 13000 + rand()%4000; - } else uiGoreTimer -= diff; + if (uiStompTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STOMP); + uiStompTimer = 8000 + rand()%4000; + } else uiStompTimer -= diff; - if (uiGrievousWoundTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_GRIEVOUS_WOUND); - uiGrievousWoundTimer = 18000 + rand()%4000; - } else uiGrievousWoundTimer -= diff; + if (uiGoreTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GORE); + uiGoreTimer = 13000 + rand()%4000; + } else uiGoreTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiGrievousWoundTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_GRIEVOUS_WOUND); + uiGrievousWoundTimer = 18000 + rand()%4000; + } else uiGrievousWoundTimer -= diff; - void AttackStart(Unit* who) - { - if (!who) - return; + DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (me->Attack(who, true)) + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } + + void JustDied(Unit* /*killer*/) { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + if (pInstance) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + } } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_mob_ferocious_rhino(Creature* pCreature) -{ - return new mob_ferocious_rhinoAI (pCreature); -} //massive jormungar's spells enum MassiveSpells @@ -603,245 +631,227 @@ enum MassiveAdds { CREATURE_JORMUNGAR_WORM = 27228 }; - -struct mob_massive_jormungarAI : public ScriptedAI +
class mob_massive_jormungar : public CreatureScript { - mob_massive_jormungarAI(Creature *c) : ScriptedAI(c) +public: + mob_massive_jormungar() : CreatureScript("mob_massive_jormungar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_massive_jormungarAI (pCreature); } - uint32 uiAcidSpitTimer; - uint32 uiAcidSplatterTimer; - uint32 uiPoisonBreathTimer; + struct mob_massive_jormungarAI : public ScriptedAI + { + mob_massive_jormungarAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance *pInstance; + uint32 uiAcidSpitTimer; + uint32 uiAcidSplatterTimer; + uint32 uiPoisonBreathTimer; - void Reset() - { - uiAcidSpitTimer = 3000; - uiAcidSplatterTimer = 12000; - uiPoisonBreathTimer = 10000; + InstanceScript *pInstance; - me->GetMotionMaster()->MoveTargetedHome(); + void Reset() + { + uiAcidSpitTimer = 3000; + uiAcidSplatterTimer = 12000; + uiPoisonBreathTimer = 10000; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); - } - } + me->GetMotionMaster()->MoveTargetedHome(); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } - if (uiAcidSpitTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_ACID_SPIT); - uiAcidSpitTimer = 2000 + rand()%2000; - } else uiAcidSpitTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiAcidSplatterTimer <= diff) - { - DoCast(me, SPELL_POISON_BREATH); - uiAcidSplatterTimer = 10000 + rand()%4000; - } else uiAcidSplatterTimer -= diff; + if (uiAcidSpitTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_ACID_SPIT); + uiAcidSpitTimer = 2000 + rand()%2000; + } else uiAcidSpitTimer -= diff; - if (uiPoisonBreathTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_POISON_BREATH); - uiPoisonBreathTimer = 8000 + rand()%4000; - } else uiPoisonBreathTimer -= diff; + if (uiAcidSplatterTimer <= diff) + { + DoCast(me, SPELL_POISON_BREATH); + uiAcidSplatterTimer = 10000 + rand()%4000; + } else uiAcidSplatterTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiPoisonBreathTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_POISON_BREATH); + uiPoisonBreathTimer = 8000 + rand()%4000; + } else uiPoisonBreathTimer -= diff; - void AttackStart(Unit* who) - { - if (!who) - return; + DoMeleeAttackIfReady(); + } - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } - if (me->Attack(who, true)) + void JustDied(Unit* /*killer*/) { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + if (pInstance) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI,pPalehoof->AI())->NextPhase(); + } } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoofAI,pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; - -CreatureAI* GetAI_mob_massive_jormungar(Creature* pCreature) +
class mob_palehoof_orb : public CreatureScript { - return new mob_massive_jormungarAI (pCreature); -} +public: + mob_palehoof_orb() : CreatureScript("mob_palehoof_orb") { } - -struct mob_palehoof_orbAI : public ScriptedAI -{ - mob_palehoof_orbAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_palehoof_orbAI (pCreature); } - ScriptedInstance *pInstance; - uint32 SummonTimer; - Phase currentPhase; - - void Reset() + struct mob_palehoof_orbAI : public ScriptedAI { - currentPhase=PHASE_NONE; - SummonTimer=5000; - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->RemoveAurasDueToSpell(SPELL_ORB_VISUAL); - me->SetSpeed(MOVE_FLIGHT , 0.5f); - } + mob_palehoof_orbAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void UpdateAI(const uint32 diff) - { - if (currentPhase == PHASE_NONE) - return; + InstanceScript *pInstance; + uint32 SummonTimer; + Phase currentPhase; - if (SummonTimer <= diff) + void Reset() { - if (currentPhase<5&¤tPhase >= 0) - { - Creature *pNext = NULL; - switch(currentPhase) - { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - } - - if (pNext) - { - pNext->RemoveAurasDueToSpell(SPELL_FREEZE); - pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - pNext->SetStandState(UNIT_STAND_STATE_STAND); - pNext->SetInCombatWithZone(); - pNext->Attack(pNext->SelectNearestTarget(100),true); - - } - currentPhase=PHASE_NONE; - } - } else SummonTimer-=diff; - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - if (id<0 || id>4) - return; - Creature *pNext = NULL; - switch(id) - { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - } - if (pNext) - DoCast(pNext, SPELL_ORB_CHANNEL, false); - currentPhase=(Phase)id; - SummonTimer=5000; - } -}; + currentPhase=PHASE_NONE; + SummonTimer=5000; + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + me->RemoveAurasDueToSpell(SPELL_ORB_VISUAL); + me->SetSpeed(MOVE_FLIGHT , 0.5f); + } -CreatureAI* GetAI_mob_palehoof_orb(Creature* pCreature) -{ - return new mob_palehoof_orbAI (pCreature); -} + void UpdateAI(const uint32 diff) + { + if (currentPhase == PHASE_NONE) + return; + if (SummonTimer <= diff) + { + if (currentPhase<5&¤tPhase >= 0) + { + Creature *pNext = NULL; + switch(currentPhase) + { + case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; + case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; + case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; + case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; + case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; + } + + if (pNext) + { + pNext->RemoveAurasDueToSpell(SPELL_FREEZE); + pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + pNext->SetStandState(UNIT_STAND_STATE_STAND); + pNext->SetInCombatWithZone(); + pNext->Attack(pNext->SelectNearestTarget(100),true); + + } + currentPhase=PHASE_NONE; + } + } else SummonTimer-=diff; + } + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + if (id<0 || id>4) + return; + Creature *pNext = NULL; + switch(id) + { + case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; + case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; + case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; + case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; + case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; + } + if (pNext) + DoCast(pNext, SPELL_ORB_CHANNEL, false); + currentPhase=(Phase)id; + SummonTimer=5000; + } + }; -bool GOHello_palehoof_sphere(Player * /*pPlayer*/, GameObject *pGO) +}; +
class go_palehoof_sphere : public GameObjectScript { - ScriptedInstance *pInstance = pGO->GetInstanceData(); +public: + go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - Creature *pPalehoof = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) + bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { - // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); + InstanceScript *pInstance = pGO->GetInstanceScript(); - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } - return true; -} + Creature *pPalehoof = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + { + // maybe these are hacks :( + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + } + return true; + } +}; void AddSC_boss_palehoof() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_palehoof"; - newscript->GetAI = &GetAI_boss_palehoof; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ravenous_furbolg"; - newscript->GetAI = &GetAI_mob_ravenous_furbolg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frenzied_worgen"; - newscript->GetAI = &GetAI_mob_frenzied_worgen; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ferocious_rhino"; - newscript->GetAI = &GetAI_mob_ferocious_rhino; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_massive_jormungar"; - newscript->GetAI = &GetAI_mob_massive_jormungar; - newscript->RegisterSelf(); - - - newscript = new Script; - newscript->Name = "mob_palehoof_orb"; - newscript->GetAI = &GetAI_mob_palehoof_orb; - newscript->RegisterSelf(); - - - newscript = new Script; - newscript->Name = "go_palehoof_sphere"; - newscript->pGOHello=&GOHello_palehoof_sphere; - newscript->RegisterSelf(); + new boss_palehoof(); + new mob_ravenous_furbolg(); + new mob_frenzied_worgen(); + new mob_ferocious_rhino(); + new mob_massive_jormungar(); + new mob_palehoof_orb(); + new go_palehoof_sphere(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index cd85de0dfcd..368b769885f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -155,323 +155,327 @@ enum eAchievments { ACHIEV_TIMED_START_EVENT = 17726, }; - -struct boss_skadiAI : public ScriptedAI +
class boss_skadi : public CreatureScript { - boss_skadiAI(Creature *c) : ScriptedAI(c), Summons(me) +public: + boss_skadi() : CreatureScript("boss_skadi") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = c->GetInstanceData(); + return new boss_skadiAI (pCreature); } - ScriptedInstance* m_pInstance; - SummonList Summons; - uint64 m_uiGraufGUID; - std::vector<uint64> triggersGUID; + struct boss_skadiAI : public ScriptedAI + { + boss_skadiAI(Creature *c) : ScriptedAI(c), Summons(me) + { + m_pInstance = c->GetInstanceScript(); + } - uint32 m_uiCrushTimer; - uint32 m_uiPoisonedSpearTimer; - uint32 m_uiWhirlwindTimer; - uint32 m_uiWaypointId; - uint32 m_uiMovementTimer; - uint32 m_uiMountTimer; - uint32 m_uiSummonTimer; - uint8 m_uiSpellHitCount; - bool m_bSaidEmote; + InstanceScript* m_pInstance; + SummonList Summons; + uint64 m_uiGraufGUID; + std::vector<uint64> triggersGUID; - eCombatPhase Phase; + uint32 m_uiCrushTimer; + uint32 m_uiPoisonedSpearTimer; + uint32 m_uiWhirlwindTimer; + uint32 m_uiWaypointId; + uint32 m_uiMovementTimer; + uint32 m_uiMountTimer; + uint32 m_uiSummonTimer; + uint8 m_uiSpellHitCount; + bool m_bSaidEmote; - void Reset() - { - triggersGUID.clear(); - - m_uiCrushTimer = 8000; - m_uiPoisonedSpearTimer = 10000; - m_uiWhirlwindTimer = 20000; - m_uiMountTimer = 3000; - m_uiWaypointId = 0; - m_bSaidEmote = false; - m_uiSpellHitCount = 0; - - Phase = SKADI; - - Summons.DespawnAll(); - me->SetSpeed(MOVE_FLIGHT, 3.0f); - if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) - me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); - if (m_pInstance) + eCombatPhase Phase; + + void Reset() { - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + triggersGUID.clear(); + + m_uiCrushTimer = 8000; + m_uiPoisonedSpearTimer = 10000; + m_uiWhirlwindTimer = 20000; + m_uiMountTimer = 3000; + m_uiWaypointId = 0; + m_bSaidEmote = false; + m_uiSpellHitCount = 0; + + Phase = SKADI; + + Summons.DespawnAll(); + me->SetSpeed(MOVE_FLIGHT, 3.0f); + if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) + me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); + if (m_pInstance) + { + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } } - } - void JustReachedHome() - { - me->SetFlying(false); - me->Unmount(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) - me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); - } + void JustReachedHome() + { + me->SetFlying(false); + me->Unmount(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) + me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); + } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - Phase = FLYING; + Phase = FLYING; - m_uiMovementTimer = 1000; - m_uiSummonTimer = 10000; - me->SetInCombatWithZone(); - if (m_pInstance) - { - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - m_uiMountTimer = 1000; - Summons.DespawnEntry(CREATURE_GRAUF); + m_uiMovementTimer = 1000; + m_uiSummonTimer = 10000; + me->SetInCombatWithZone(); + if (m_pInstance) + { + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + m_uiMountTimer = 1000; + Summons.DespawnEntry(CREATURE_GRAUF); + } } - } - void JustSummoned(Creature* pSummoned) - { - switch (pSummoned->GetEntry()) + void JustSummoned(Creature* pSummoned) { - case CREATURE_GRAUF: - m_uiGraufGUID = pSummoned->GetGUID(); - break; - case CREATURE_YMIRJAR_WARRIOR: - case CREATURE_YMIRJAR_WITCH_DOCTOR: - case CREATURE_YMIRJAR_HARPOONER: - pSummoned->setActive(true); - pSummoned->SetInCombatWithZone(); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - break; - case CREATURE_TRIGGER: - pSummoned->CastSpell((Unit*)NULL, SPELL_FREEZING_CLOUD, true); - pSummoned->ForcedDespawn(10*IN_MILLISECONDS); - break; + switch (pSummoned->GetEntry()) + { + case CREATURE_GRAUF: + m_uiGraufGUID = pSummoned->GetGUID(); + break; + case CREATURE_YMIRJAR_WARRIOR: + case CREATURE_YMIRJAR_WITCH_DOCTOR: + case CREATURE_YMIRJAR_HARPOONER: + pSummoned->setActive(true); + pSummoned->SetInCombatWithZone(); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); + break; + case CREATURE_TRIGGER: + pSummoned->CastSpell((Unit*)NULL, SPELL_FREEZING_CLOUD, true); + pSummoned->ForcedDespawn(10*IN_MILLISECONDS); + break; + } + Summons.Summon(pSummoned); } - Summons.Summon(pSummoned); - } - void SummonedCreatureDespawn(Creature* pSummoned) - { - if (pSummoned->GetEntry() == CREATURE_GRAUF) - m_uiGraufGUID = 0; - Summons.Despawn(pSummoned); - } + void SummonedCreatureDespawn(Creature* pSummoned) + { + if (pSummoned->GetEntry() == CREATURE_GRAUF) + m_uiGraufGUID = 0; + Summons.Despawn(pSummoned); + } - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_HARPOON_DAMAGE) + void SpellHit(Unit *caster, const SpellEntry *spell) { - m_uiSpellHitCount++; - if (m_uiSpellHitCount >= 5) + if (spell->Id == SPELL_HARPOON_DAMAGE) { - Phase = SKADI; - me->SetFlying(false); - me->Unmount(); - if(Creature* pGrauf = me->SummonCreature(CREATURE_GRAUF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS)) + m_uiSpellHitCount++; + if (m_uiSpellHitCount >= 5) { - pGrauf->GetMotionMaster()->MoveFall(0); - pGrauf->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); + Phase = SKADI; + me->SetFlying(false); + me->Unmount(); + if(Creature* pGrauf = me->SummonCreature(CREATURE_GRAUF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS)) + { + pGrauf->GetMotionMaster()->MoveFall(0); + pGrauf->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); + } + sLog.outBasic("[Skadi] Fly off"); + me->GetMotionMaster()->MoveJump(Location[4].GetPositionX(), Location[4].GetPositionY(), Location[4].GetPositionZ(), 5.0f, 10.0f); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + DoScriptText(SAY_DRAKE_DEATH, me); + m_uiCrushTimer = 8000; + m_uiPoisonedSpearTimer = 10000; + m_uiWhirlwindTimer = 20000; + me->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); } - sLog.outBasic("[Skadi] Fly off"); - me->GetMotionMaster()->MoveJump(Location[4].GetPositionX(), Location[4].GetPositionY(), Location[4].GetPositionZ(), 5.0f, 10.0f); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - DoScriptText(SAY_DRAKE_DEATH, me); - m_uiCrushTimer = 8000; - m_uiPoisonedSpearTimer = 10000; - m_uiWhirlwindTimer = 20000; - me->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); } } - } - void UpdateAI(const uint32 diff) - { - switch(Phase) + void UpdateAI(const uint32 diff) { - case FLYING: - if (!UpdateVictim()) - return; + switch(Phase) + { + case FLYING: + if (!UpdateVictim()) + return; - if (me->GetPositionX() >= 519) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (!m_bSaidEmote) + if (me->GetPositionX() >= 519) { - DoScriptText(EMOTE_RANGE, me); - m_bSaidEmote = true; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + if (!m_bSaidEmote) + { + DoScriptText(EMOTE_RANGE, me); + m_bSaidEmote = true; + } + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + m_bSaidEmote = false; } - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - m_bSaidEmote = false; - } - if (m_uiMountTimer && m_uiMountTimer <= diff) - { - me->Mount(DATA_MOUNT); - me->SetFlying(true); - m_uiMountTimer = 0; - } else m_uiMountTimer -= diff; + if (m_uiMountTimer && m_uiMountTimer <= diff) + { + me->Mount(DATA_MOUNT); + me->SetFlying(true); + m_uiMountTimer = 0; + } else m_uiMountTimer -= diff; - if (m_uiSummonTimer <= diff) - { - SpawnMobs(); - m_uiSummonTimer = 25000; - } else m_uiSummonTimer -= diff; + if (m_uiSummonTimer <= diff) + { + SpawnMobs(); + m_uiSummonTimer = 25000; + } else m_uiSummonTimer -= diff; - if (m_uiMovementTimer <= diff) - { - switch(m_uiWaypointId) + if (m_uiMovementTimer <= diff) { - case 0: - me->GetMotionMaster()->MovePoint(0, Location[1].GetPositionX(), Location[1].GetPositionY(), Location[1].GetPositionZ()); - m_uiMovementTimer = 5000; - break; - case 1: - me->GetMotionMaster()->MovePoint(0, Location[2].GetPositionX(), Location[2].GetPositionY(), Location[2].GetPositionZ()); - m_uiMovementTimer = 2000; - break; - case 2: - me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); - m_uiMovementTimer = 15000; - break; - case 3: - me->GetMotionMaster()->MovePoint(0, Location[69].GetPositionX(), Location[69].GetPositionY(), Location[69].GetPositionZ()); - DoScriptText(RAND(SAY_DRAKE_BREATH_1,SAY_DRAKE_BREATH_2), me); - DoScriptText(EMOTE_BREATH, me); - m_uiMovementTimer = 2500; - break; - case 4: - me->GetMotionMaster()->MovePoint(0, Location[70].GetPositionX(), Location[70].GetPositionY(), Location[70].GetPositionZ()); - m_uiMovementTimer = 2000; - SpawnTrigger(); - break; - case 5: - me->GetMotionMaster()->MovePoint(0, Location[71].GetPositionX(), Location[71].GetPositionY(), Location[71].GetPositionZ()); - m_uiMovementTimer = 3000; - break; - case 6: - me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); - m_uiWaypointId = 2; - m_uiMovementTimer = 15000; - break; - } - m_uiWaypointId++; - } else m_uiMovementTimer -= diff; - break; - case SKADI: - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_uiCrushTimer <= diff) - { - DoCastVictim(SPELL_CRUSH); - m_uiCrushTimer = 8000; - } else m_uiCrushTimer -= diff; + switch(m_uiWaypointId) + { + case 0: + me->GetMotionMaster()->MovePoint(0, Location[1].GetPositionX(), Location[1].GetPositionY(), Location[1].GetPositionZ()); + m_uiMovementTimer = 5000; + break; + case 1: + me->GetMotionMaster()->MovePoint(0, Location[2].GetPositionX(), Location[2].GetPositionY(), Location[2].GetPositionZ()); + m_uiMovementTimer = 2000; + break; + case 2: + me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); + m_uiMovementTimer = 15000; + break; + case 3: + me->GetMotionMaster()->MovePoint(0, Location[69].GetPositionX(), Location[69].GetPositionY(), Location[69].GetPositionZ()); + DoScriptText(RAND(SAY_DRAKE_BREATH_1,SAY_DRAKE_BREATH_2), me); + DoScriptText(EMOTE_BREATH, me); + m_uiMovementTimer = 2500; + break; + case 4: + me->GetMotionMaster()->MovePoint(0, Location[70].GetPositionX(), Location[70].GetPositionY(), Location[70].GetPositionZ()); + m_uiMovementTimer = 2000; + SpawnTrigger(); + break; + case 5: + me->GetMotionMaster()->MovePoint(0, Location[71].GetPositionX(), Location[71].GetPositionY(), Location[71].GetPositionZ()); + m_uiMovementTimer = 3000; + break; + case 6: + me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); + m_uiWaypointId = 2; + m_uiMovementTimer = 15000; + break; + } + m_uiWaypointId++; + } else m_uiMovementTimer -= diff; + break; + case SKADI: + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_uiCrushTimer <= diff) + { + DoCastVictim(SPELL_CRUSH); + m_uiCrushTimer = 8000; + } else m_uiCrushTimer -= diff; - if (m_uiPoisonedSpearTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_POISONED_SPEAR); - m_uiPoisonedSpearTimer = 10000; - } else m_uiPoisonedSpearTimer -= diff; + if (m_uiPoisonedSpearTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_POISONED_SPEAR); + m_uiPoisonedSpearTimer = 10000; + } else m_uiPoisonedSpearTimer -= diff; - if (m_uiWhirlwindTimer <= diff) - { - DoCastAOE(SPELL_WHIRLWIND); - m_uiWhirlwindTimer = 20000; - } else m_uiWhirlwindTimer -= diff; + if (m_uiWhirlwindTimer <= diff) + { + DoCastAOE(SPELL_WHIRLWIND); + m_uiWhirlwindTimer = 20000; + } else m_uiWhirlwindTimer -= diff; - DoMeleeAttackIfReady(); - break; + DoMeleeAttackIfReady(); + break; + } } - } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - Summons.DespawnAll(); - if (m_pInstance) - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); - } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + Summons.DespawnAll(); + if (m_pInstance) + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } - void SpawnMobs() - { - for (uint8 i = 0; i < DUNGEON_MODE(5,6); ++i) + void SpawnMobs() { - switch (urand(0,2)) + for (uint8 i = 0; i < DUNGEON_MODE(5,6); ++i) { - case 0: me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; - case 1: me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; - case 2: me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + switch (urand(0,2)) + { + case 0: me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + case 1: me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + case 2: me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + } } } - } - void SpawnTrigger() - { - uint8 iStart,iEnd; - switch (urand(0,1)) + void SpawnTrigger() { - case 0: - iStart = 8; - iEnd = 37; - break; - case 1: - iStart = 38; - iEnd = 68; - break; + uint8 iStart,iEnd; + switch (urand(0,1)) + { + case 0: + iStart = 8; + iEnd = 37; + break; + case 1: + iStart = 38; + iEnd = 68; + break; + } + for(uint32 i = iStart; i < iEnd; ++i) + me->SummonCreature(CREATURE_TRIGGER,Location[i]); } - for(uint32 i = iStart; i < iEnd; ++i) - me->SummonCreature(CREATURE_TRIGGER,Location[i]); - } -}; + }; -bool GOHello_go_harpoon_launcher(Player *pPlayer, GameObject *pGO) +}; +
class go_harpoon_launcher : public GameObjectScript { - ScriptedInstance* m_pInstance = pGO->GetInstanceData(); - if (!m_pInstance) return false; +public: + go_harpoon_launcher() : GameObjectScript("go_harpoon_launcher") { } - if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS))) + bool OnGossipHello(Player *pPlayer, GameObject *pGO) { - pPlayer->CastSpell(pSkadi,SPELL_RAPID_FIRE, true); + InstanceScript* m_pInstance = pGO->GetInstanceScript(); + if (!m_pInstance) return false; + + if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS))) + { + pPlayer->CastSpell(pSkadi,SPELL_RAPID_FIRE, true); + } + return false; } - return false; -} -CreatureAI* GetAI_boss_skadi(Creature* pCreature) -{ - return new boss_skadiAI (pCreature); -} +}; + void AddSC_boss_skadi() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_skadi"; - newscript->GetAI = &GetAI_boss_skadi; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_harpoon_launcher"; - newscript->pGOHello = &GOHello_go_harpoon_launcher; - newscript->RegisterSelf(); + new boss_skadi(); + new go_harpoon_launcher(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 2a785d70f39..b2784007319 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -83,327 +83,335 @@ static Position RitualChannelerPos[]= }; static Position ArthasPos = { 295.81, -366.16, 92.57, 1.58 }; static Position SvalaPos = { 296.632, -346.075, 90.6307, 1.58 }; - -struct boss_svalaAI : public ScriptedAI +
class boss_svala : public CreatureScript { - boss_svalaAI(Creature *c) : ScriptedAI(c) +public: + boss_svala() : CreatureScript("boss_svala") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_svalaAI (pCreature); } - uint32 uiIntroTimer; + struct boss_svalaAI : public ScriptedAI + { + boss_svalaAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint8 uiIntroPhase; + uint32 uiIntroTimer; - IntroPhase Phase; + uint8 uiIntroPhase; - TempSummon* pArthas; - uint64 uiArthasGUID; + IntroPhase Phase; - ScriptedInstance* pInstance; + TempSummon* pArthas; + uint64 uiArthasGUID; - void Reset() - { - Phase = IDLE; - uiIntroTimer = 1*IN_MILLISECONDS; - uiIntroPhase = 0; - uiArthasGUID = 0; + InstanceScript* pInstance; - if (pInstance) - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); - } + void Reset() + { + Phase = IDLE; + uiIntroTimer = 1*IN_MILLISECONDS; + uiIntroPhase = 0; + uiArthasGUID = 0; - void MoveInLineOfSight(Unit* pWho) - { - if (!pWho) - return; + if (pInstance) + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); + } - if (Phase == IDLE && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && me->IsWithinDistInMap(pWho, 40)) + void MoveInLineOfSight(Unit* pWho) { - Phase = INTRO; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (!pWho) + return; - if (Creature *pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) + if (Phase == IDLE && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && me->IsWithinDistInMap(pWho, 40)) { - pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5); - uiArthasGUID = pArthas->GetGUID(); + Phase = INTRO; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + if (Creature *pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5); + uiArthasGUID = pArthas->GetGUID(); + } } } - } - void AttackStart(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (Phase != INTRO) - return; + void AttackStart(Unit* /*who*/) {} - if (uiIntroTimer <= diff) + void UpdateAI(const uint32 diff) { - Creature *pArthas = Unit::GetCreature(*me, uiArthasGUID); - if (!pArthas) + if (Phase != INTRO) return; - switch (uiIntroPhase) + if (uiIntroTimer <= diff) { - case 0: - DoScriptText(SAY_DIALOG_WITH_ARTHAS_1, me); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 1: - DoScriptText(SAY_DIALOG_OF_ARTHAS_1, pArthas); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 2: - DoScriptText(SAY_DIALOG_WITH_ARTHAS_2, me); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 3: - DoScriptText(SAY_DIALOG_OF_ARTHAS_2, pArthas); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 4: - DoScriptText(SAY_DIALOG_WITH_ARTHAS_3, me); - DoCast(me, SPELL_SVALA_TRANSFORMING1); - ++uiIntroPhase; - uiIntroTimer = 2.8*IN_MILLISECONDS; - break; - case 5: - DoCast(me, SPELL_SVALA_TRANSFORMING2); - ++uiIntroPhase; - uiIntroTimer = 200; - break; - case 6: - if (Creature* pSvalaSorrowgrave = me->SummonCreature(CREATURE_SVALA_SORROWGRAVE, SvalaPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60*IN_MILLISECONDS)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(DATA_SVALA_DISPLAY_ID); - pArthas->ToTempSummon()->UnSummon(); - uiArthasGUID = 0; - Phase = FINISHED; - } - else - Reset(); - break; - } - } else uiIntroTimer -= diff; - } -}; + Creature *pArthas = Unit::GetCreature(*me, uiArthasGUID); + if (!pArthas) + return; -struct mob_ritual_channelerAI : public Scripted_NoMovementAI -{ - mob_ritual_channelerAI(Creature *c) :Scripted_NoMovementAI(c) - { - pInstance = c->GetInstanceData(); - } + switch (uiIntroPhase) + { + case 0: + DoScriptText(SAY_DIALOG_WITH_ARTHAS_1, me); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 1: + DoScriptText(SAY_DIALOG_OF_ARTHAS_1, pArthas); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 2: + DoScriptText(SAY_DIALOG_WITH_ARTHAS_2, me); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 3: + DoScriptText(SAY_DIALOG_OF_ARTHAS_2, pArthas); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 4: + DoScriptText(SAY_DIALOG_WITH_ARTHAS_3, me); + DoCast(me, SPELL_SVALA_TRANSFORMING1); + ++uiIntroPhase; + uiIntroTimer = 2.8*IN_MILLISECONDS; + break; + case 5: + DoCast(me, SPELL_SVALA_TRANSFORMING2); + ++uiIntroPhase; + uiIntroTimer = 200; + break; + case 6: + if (Creature* pSvalaSorrowgrave = me->SummonCreature(CREATURE_SVALA_SORROWGRAVE, SvalaPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60*IN_MILLISECONDS)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(DATA_SVALA_DISPLAY_ID); + pArthas->ToTempSummon()->UnSummon(); + uiArthasGUID = 0; + Phase = FINISHED; + } + else + Reset(); + break; + } + } else uiIntroTimer -= diff; + } + }; - ScriptedInstance* pInstance; +}; +
class mob_ritual_channeler : public CreatureScript +{ +public: + mob_ritual_channeler() : CreatureScript("mob_ritual_channeler") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, SPELL_SHADOWS_IN_THE_DARK); + return new mob_ritual_channelerAI(pCreature); } - // called by svala sorrowgrave to set guid of victim - void DoAction(uint32 /*action*/) + struct mob_ritual_channelerAI : public Scripted_NoMovementAI { - if (pInstance) - if (Unit *pVictim = me->GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER))) - DoCast(pVictim, SPELL_PARALYZE); - } + mob_ritual_channelerAI(Creature *c) :Scripted_NoMovementAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit* /*who*/) - { - } -}; + InstanceScript* pInstance; + + void Reset() + { + DoCast(me, SPELL_SHADOWS_IN_THE_DARK); + } -struct boss_svala_sorrowgraveAI : public ScriptedAI + // called by svala sorrowgrave to set guid of victim + void DoAction(uint32 /*action*/) + { + if (pInstance) + if (Unit *pVictim = me->GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER))) + DoCast(pVictim, SPELL_PARALYZE); + } + + void EnterCombat(Unit* /*who*/) + { + } + }; + +}; +
class boss_svala_sorrowgrave : public CreatureScript { - boss_svala_sorrowgraveAI(Creature *c) : ScriptedAI(c), summons(c) +public: + boss_svala_sorrowgrave() : CreatureScript("boss_svala_sorrowgrave") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_svala_sorrowgraveAI(pCreature); } - uint32 uiSinsterStrikeTimer; - uint32 uiCallFlamesTimer; - uint32 uiRitualOfSwordTimer; - uint32 uiSacrificeTimer; + struct boss_svala_sorrowgraveAI : public ScriptedAI + { + boss_svala_sorrowgraveAI(Creature *c) : ScriptedAI(c), summons(c) + { + pInstance = c->GetInstanceScript(); + } - CombatPhase Phase; + uint32 uiSinsterStrikeTimer; + uint32 uiCallFlamesTimer; + uint32 uiRitualOfSwordTimer; + uint32 uiSacrificeTimer; - SummonList summons; + CombatPhase Phase; - bool bSacrificed; + SummonList summons; - ScriptedInstance* pInstance; + bool bSacrificed; - void Reset() - { - uiSinsterStrikeTimer = 7*IN_MILLISECONDS; - uiCallFlamesTimer = 10*IN_MILLISECONDS; - uiRitualOfSwordTimer = 20*IN_MILLISECONDS; - uiSacrificeTimer = 8*IN_MILLISECONDS; + InstanceScript* pInstance; - bSacrificed = false; + void Reset() + { + uiSinsterStrikeTimer = 7*IN_MILLISECONDS; + uiCallFlamesTimer = 10*IN_MILLISECONDS; + uiRitualOfSwordTimer = 20*IN_MILLISECONDS; + uiSacrificeTimer = 8*IN_MILLISECONDS; - Phase = NORMAL; + bSacrificed = false; - DoTeleportTo(296.632, -346.075, 90.6307); - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + Phase = NORMAL; - summons.DespawnAll(); + DoTeleportTo(296.632, -346.075, 90.6307); + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - if (pInstance) - { - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); - pInstance->SetData64(DATA_SACRIFICED_PLAYER,0); - } - } + summons.DespawnAll(); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + if (pInstance) + { + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); + pInstance->SetData64(DATA_SACRIFICED_PLAYER,0); + } + } - if (pInstance) - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - void JustSummoned(Creature *summon) - { - summons.Summon(summon); - } + if (pInstance) + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); + } - void SummonedCreatureDespawn(Creature *summon) - { - summons.Despawn(summon); - } + void JustSummoned(Creature *summon) + { + summons.Summon(summon); + } - void UpdateAI(const uint32 diff) - { - if (Phase == NORMAL) + void SummonedCreatureDespawn(Creature *summon) { - //Return since we have no target - if (!UpdateVictim()) - return; + summons.Despawn(summon); + } - if (uiSinsterStrikeTimer <= diff) + void UpdateAI(const uint32 diff) + { + if (Phase == NORMAL) { - DoCast(me->getVictim(), SPELL_SINSTER_STRIKE); - uiSinsterStrikeTimer = urand(5*IN_MILLISECONDS,9*IN_MILLISECONDS); - } else uiSinsterStrikeTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiCallFlamesTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiSinsterStrikeTimer <= diff) { - DoCast(pTarget, SPELL_CALL_FLAMES); - uiCallFlamesTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); - } - } else uiCallFlamesTimer -= diff; + DoCast(me->getVictim(), SPELL_SINSTER_STRIKE); + uiSinsterStrikeTimer = urand(5*IN_MILLISECONDS,9*IN_MILLISECONDS); + } else uiSinsterStrikeTimer -= diff; - if (!bSacrificed) - if (uiRitualOfSwordTimer <= diff) + if (uiCallFlamesTimer <= diff) { - if (Unit* pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1,SAY_SACRIFICE_PLAYER_2,SAY_SACRIFICE_PLAYER_3,SAY_SACRIFICE_PLAYER_4,SAY_SACRIFICE_PLAYER_5),me); - DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD); - //Spell doesn't teleport - DoTeleportPlayer(pSacrificeTarget, 296.632, -346.075, 90.63, 4.6); - me->SetUnitMovementFlags(MOVEMENTFLAG_CAN_FLY); - DoTeleportTo(296.632, -346.075, 120.85); - Phase = SACRIFICING; - if (pInstance) - { - pInstance->SetData64(DATA_SACRIFICED_PLAYER,pSacrificeTarget->GetGUID()); + DoCast(pTarget, SPELL_CALL_FLAMES); + uiCallFlamesTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); + } + } else uiCallFlamesTimer -= diff; - for (uint8 i = 0; i < 3; ++i) - if (Creature* pSummon = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) - pSummon->AI()->DoAction(0); + if (!bSacrificed) + if (uiRitualOfSwordTimer <= diff) + { + if (Unit* pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1,SAY_SACRIFICE_PLAYER_2,SAY_SACRIFICE_PLAYER_3,SAY_SACRIFICE_PLAYER_4,SAY_SACRIFICE_PLAYER_5),me); + DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD); + //Spell doesn't teleport + DoTeleportPlayer(pSacrificeTarget, 296.632, -346.075, 90.63, 4.6); + me->SetUnitMovementFlags(MOVEMENTFLAG_CAN_FLY); + DoTeleportTo(296.632, -346.075, 120.85); + Phase = SACRIFICING; + if (pInstance) + { + pInstance->SetData64(DATA_SACRIFICED_PLAYER,pSacrificeTarget->GetGUID()); + + for (uint8 i = 0; i < 3; ++i) + if (Creature* pSummon = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) + pSummon->AI()->DoAction(0); + } + + bSacrificed = true; } + } else uiRitualOfSwordTimer -= diff; - bSacrificed = true; - } - } else uiRitualOfSwordTimer -= diff; - - DoMeleeAttackIfReady(); - } - else //SACRIFICING - { - if (uiSacrificeTimer <= diff) + DoMeleeAttackIfReady(); + } + else //SACRIFICING { - Unit* pSacrificeTarget = pInstance ? Unit::GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER)) : NULL; - if (pInstance && !summons.empty() && pSacrificeTarget && pSacrificeTarget->isAlive()) - me->Kill(pSacrificeTarget, false); // durability damage? - - //go down - Phase = NORMAL; - pSacrificeTarget = NULL; - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->GetMotionMaster()->MoveChase(pTarget); - - uiSacrificeTimer = 8*IN_MILLISECONDS; + if (uiSacrificeTimer <= diff) + { + Unit* pSacrificeTarget = pInstance ? Unit::GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER)) : NULL; + if (pInstance && !summons.empty() && pSacrificeTarget && pSacrificeTarget->isAlive()) + me->Kill(pSacrificeTarget, false); // durability damage? + + //go down + Phase = NORMAL; + pSacrificeTarget = NULL; + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->GetMotionMaster()->MoveChase(pTarget); + + uiSacrificeTimer = 8*IN_MILLISECONDS; + } + else uiSacrificeTimer -= diff; } - else uiSacrificeTimer -= diff; } - } - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } - void JustDied(Unit* pKiller) - { - if (pInstance) + void JustDied(Unit* pKiller) { - Creature* pSvala = Unit::GetCreature((*me), pInstance->GetData64(DATA_SVALA)); - if (pSvala && pSvala->isAlive()) - pKiller->Kill(pSvala); + if (pInstance) + { + Creature* pSvala = Unit::GetCreature((*me), pInstance->GetData64(DATA_SVALA)); + if (pSvala && pSvala->isAlive()) + pKiller->Kill(pSvala); - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, DONE); + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, DONE); + } + DoScriptText(SAY_DEATH, me); } - DoScriptText(SAY_DEATH, me); - } + }; + }; -CreatureAI* GetAI_boss_svala(Creature* pCreature) -{ - return new boss_svalaAI (pCreature); -} -CreatureAI* GetAI_mob_ritual_channeler(Creature* pCreature) -{ - return new mob_ritual_channelerAI(pCreature); -} -CreatureAI* GetAI_boss_svala_sorrowgrave(Creature* pCreature) -{ - return new boss_svala_sorrowgraveAI(pCreature); -} void AddSC_boss_svala() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_svala"; - newscript->GetAI = &GetAI_boss_svala; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ritual_channeler"; - newscript->GetAI = &GetAI_mob_ritual_channeler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_svala_sorrowgrave"; - newscript->GetAI = &GetAI_boss_svala_sorrowgrave; - newscript->RegisterSelf(); + new boss_svala(); + new mob_ritual_channeler(); + new boss_svala_sorrowgrave(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 62d297396ac..c3619379a74 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -96,289 +96,291 @@ static ActiveBoatStruct ActiveBot[4] = {CREATURE_RANULF_VISUAL, SAY_SUMMON_RANULF, 381.546, -314.362, 104.756, 370.841, -314.426, 107.995, 6.232}, {CREATURE_TORGYN_VISUAL, SAY_SUMMON_TORGYN, 404.310, -314.761, 104.756, 413.992, -314.703, 107.995, 3.157} }; - -struct boss_ymironAI : public ScriptedAI +
class boss_ymiron : public CreatureScript { - boss_ymironAI(Creature *c) : ScriptedAI(c) +public: + boss_ymiron() : CreatureScript("boss_ymiron") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_ymironAI(pCreature); + } + + struct boss_ymironAI : public ScriptedAI { - pInstance = c->GetInstanceData(); - srand(time(NULL)); - for (int i = 0; i < 4; ++i) - m_uiActiveOrder[i] = i; - for (int i = 0; i < 3; ++i) + boss_ymironAI(Creature *c) : ScriptedAI(c) { - int r = i + (rand()%(4-i)); - int temp = m_uiActiveOrder[i]; - m_uiActiveOrder[i] = m_uiActiveOrder[r]; - m_uiActiveOrder[r] = temp; + pInstance = c->GetInstanceScript(); + srand(time(NULL)); + for (int i = 0; i < 4; ++i) + m_uiActiveOrder[i] = i; + for (int i = 0; i < 3; ++i) + { + int r = i + (rand()%(4-i)); + int temp = m_uiActiveOrder[i]; + m_uiActiveOrder[i] = m_uiActiveOrder[r]; + m_uiActiveOrder[r] = temp; + } } - } - bool m_bIsWalking; - bool m_bIsPause; - bool m_bIsActiveWithBJORN; - bool m_bIsActiveWithHALDOR; - bool m_bIsActiveWithRANULF; - bool m_bIsActiveWithTORGYN; + bool m_bIsWalking; + bool m_bIsPause; + bool m_bIsActiveWithBJORN; + bool m_bIsActiveWithHALDOR; + bool m_bIsActiveWithRANULF; + bool m_bIsActiveWithTORGYN; - uint8 m_uiActiveOrder[4]; - uint8 m_uiActivedNumber; + uint8 m_uiActiveOrder[4]; + uint8 m_uiActivedNumber; - uint32 m_uiFetidRot_Timer; - uint32 m_uiBane_Timer; - uint32 m_uiDarkSlash_Timer; - uint32 m_uiAncestors_Vengeance_Timer; + uint32 m_uiFetidRot_Timer; + uint32 m_uiBane_Timer; + uint32 m_uiDarkSlash_Timer; + uint32 m_uiAncestors_Vengeance_Timer; - uint32 m_uiAbility_BJORN_Timer; - uint32 m_uiAbility_HALDOR_Timer; - uint32 m_uiAbility_RANULF_Timer; - uint32 m_uiAbility_TORGYN_Timer; + uint32 m_uiAbility_BJORN_Timer; + uint32 m_uiAbility_HALDOR_Timer; + uint32 m_uiAbility_RANULF_Timer; + uint32 m_uiAbility_TORGYN_Timer; - uint32 m_uiPause_Timer; - uint32 m_uiHealthAmountModifier; - uint32 m_uiHealthAmountMultipler; + uint32 m_uiPause_Timer; + uint32 m_uiHealthAmountModifier; + uint32 m_uiHealthAmountMultipler; - uint64 m_uiActivedCreatureGUID; - uint64 m_uiOrbGUID; + uint64 m_uiActivedCreatureGUID; + uint64 m_uiOrbGUID; - ScriptedInstance *pInstance; + InstanceScript *pInstance; - void Reset() - { - m_bIsPause = false; - m_bIsActiveWithBJORN = false; - m_bIsActiveWithHALDOR = false; - m_bIsActiveWithRANULF = false; - m_bIsActiveWithTORGYN = false; - - m_uiFetidRot_Timer = urand(8000,13000); - m_uiBane_Timer = urand(18000,23000); - m_uiDarkSlash_Timer = urand(28000,33000); - m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(60000,45000); - m_uiPause_Timer = 0; - - m_uiAbility_BJORN_Timer = 0; - m_uiAbility_HALDOR_Timer = 0; - m_uiAbility_RANULF_Timer = 0; - m_uiAbility_TORGYN_Timer = 0; - - m_uiActivedNumber = 0; - m_uiHealthAmountModifier = 1; - m_uiHealthAmountMultipler = DUNGEON_MODE(20,25); - - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - if (pInstance) - pInstance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); - } + void Reset() + { + m_bIsPause = false; + m_bIsActiveWithBJORN = false; + m_bIsActiveWithHALDOR = false; + m_bIsActiveWithRANULF = false; + m_bIsActiveWithTORGYN = false; + + m_uiFetidRot_Timer = urand(8000,13000); + m_uiBane_Timer = urand(18000,23000); + m_uiDarkSlash_Timer = urand(28000,33000); + m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(60000,45000); + m_uiPause_Timer = 0; + + m_uiAbility_BJORN_Timer = 0; + m_uiAbility_HALDOR_Timer = 0; + m_uiAbility_RANULF_Timer = 0; + m_uiAbility_TORGYN_Timer = 0; + + m_uiActivedNumber = 0; + m_uiHealthAmountModifier = 1; + m_uiHealthAmountMultipler = DUNGEON_MODE(20,25); + + DespawnBoatGhosts(m_uiActivedCreatureGUID); + DespawnBoatGhosts(m_uiOrbGUID); + + if (pInstance) + pInstance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); + } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - if (m_bIsWalking) + void UpdateAI(const uint32 diff) { - if (m_uiPause_Timer <= diff) + if (m_bIsWalking) { - DoScriptText(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].say, me); - DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit - if (Creature* pTemp = me->SummonCreature(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (m_uiPause_Timer <= diff) { - m_uiActivedCreatureGUID = pTemp->GetGUID(); - pTemp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - switch(m_uiActiveOrder[m_uiActivedNumber]) + DoScriptText(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].say, me); + DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit + if (Creature* pTemp = me->SummonCreature(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { - case 0: m_bIsActiveWithBJORN = true; break; - case 1: m_bIsActiveWithHALDOR = true; break; - case 2: m_bIsActiveWithRANULF = true; break; - case 3: m_bIsActiveWithTORGYN = true; break; + m_uiActivedCreatureGUID = pTemp->GetGUID(); + pTemp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + switch(m_uiActiveOrder[m_uiActivedNumber]) + { + case 0: m_bIsActiveWithBJORN = true; break; + case 1: m_bIsActiveWithHALDOR = true; break; + case 2: m_bIsActiveWithRANULF = true; break; + case 3: m_bIsActiveWithTORGYN = true; break; + } } - } - m_bIsPause = true; - m_bIsWalking = false; - m_uiPause_Timer = 3000; - } else m_uiPause_Timer -= diff; - return; - } - else if (m_bIsPause) - { - if (m_uiPause_Timer <= diff) + m_bIsPause = true; + m_bIsWalking = false; + m_uiPause_Timer = 3000; + } else m_uiPause_Timer -= diff; + return; + } + else if (m_bIsPause) { - m_uiAbility_BJORN_Timer = 5000; - m_uiAbility_HALDOR_Timer = 5000; - m_uiAbility_RANULF_Timer = 5000; - m_uiAbility_TORGYN_Timer = 5000; - - m_bIsPause = false; - m_uiPause_Timer = 0; - } else m_uiPause_Timer -= diff; - return; - } + if (m_uiPause_Timer <= diff) + { + m_uiAbility_BJORN_Timer = 5000; + m_uiAbility_HALDOR_Timer = 5000; + m_uiAbility_RANULF_Timer = 5000; + m_uiAbility_TORGYN_Timer = 5000; + + m_bIsPause = false; + m_uiPause_Timer = 0; + } else m_uiPause_Timer -= diff; + return; + } - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (!m_bIsPause) - { - // Normal spells ------------------------------------------------------------------------ - if (m_uiBane_Timer <= diff) + if (!m_bIsPause) { - DoCast(me, SPELL_BANE); - m_uiBane_Timer = urand(20000,25000); - } else m_uiBane_Timer -= diff; + // Normal spells ------------------------------------------------------------------------ + if (m_uiBane_Timer <= diff) + { + DoCast(me, SPELL_BANE); + m_uiBane_Timer = urand(20000,25000); + } else m_uiBane_Timer -= diff; - if (m_uiFetidRot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FETID_ROT); - m_uiFetidRot_Timer = urand(10000,15000); - } else m_uiFetidRot_Timer -= diff; + if (m_uiFetidRot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FETID_ROT); + m_uiFetidRot_Timer = urand(10000,15000); + } else m_uiFetidRot_Timer -= diff; - if (m_uiDarkSlash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DARK_SLASH); - m_uiDarkSlash_Timer = urand(30000,35000); - } else m_uiDarkSlash_Timer -= diff; + if (m_uiDarkSlash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DARK_SLASH); + m_uiDarkSlash_Timer = urand(30000,35000); + } else m_uiDarkSlash_Timer -= diff; - if (m_uiAncestors_Vengeance_Timer <= diff) - { - DoCast(me, SPELL_ANCESTORS_VENGEANCE); - m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(urand(60000,65000),urand(45000,50000)); - } else m_uiAncestors_Vengeance_Timer -= diff; + if (m_uiAncestors_Vengeance_Timer <= diff) + { + DoCast(me, SPELL_ANCESTORS_VENGEANCE); + m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(urand(60000,65000),urand(45000,50000)); + } else m_uiAncestors_Vengeance_Timer -= diff; - // Abilities ------------------------------------------------------------------------------ - if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff) - { - //DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control - if (Creature* pTemp = me->SummonCreature(CREATURE_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) + // Abilities ------------------------------------------------------------------------------ + if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff) { - pTemp->SetSpeed(MOVE_RUN, 0.4f); - pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->SetDisplayId(11686); - //pTemp->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiOrbGUID = pTemp->GetGUID(); - } - m_bIsActiveWithBJORN = false; // only one orb - } else m_uiAbility_BJORN_Timer -= diff; + //DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control + if (Creature* pTemp = me->SummonCreature(CREATURE_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) + { + pTemp->SetSpeed(MOVE_RUN, 0.4f); + pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->SetDisplayId(11686); + //pTemp->GetMotionMaster()->MoveChase(me->getVictim()); + m_uiOrbGUID = pTemp->GetGUID(); + } + m_bIsActiveWithBJORN = false; // only one orb + } else m_uiAbility_BJORN_Timer -= diff; - if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SPIRIT_STRIKE); - m_uiAbility_HALDOR_Timer = 5000; // overtime - } else m_uiAbility_HALDOR_Timer -= diff; + if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SPIRIT_STRIKE); + m_uiAbility_HALDOR_Timer = 5000; // overtime + } else m_uiAbility_HALDOR_Timer -= diff; - if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer <= diff) - { - DoCast(me, SPELL_SPIRIT_BURST); - m_uiAbility_RANULF_Timer = 10000; // overtime - } else m_uiAbility_RANULF_Timer -= diff; + if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer <= diff) + { + DoCast(me, SPELL_SPIRIT_BURST); + m_uiAbility_RANULF_Timer = 10000; // overtime + } else m_uiAbility_RANULF_Timer -= diff; - if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer <= diff) - { - float x,y,z; - x = me->GetPositionX()-5; - y = me->GetPositionY()-5; - z = me->GetPositionZ(); - for (uint8 i = 0; i < 4; ++i) + if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer <= diff) { - //DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control - if (Creature* pTemp = me->SummonCreature(CREATURE_AVENGING_SPIRIT, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + float x,y,z; + x = me->GetPositionX()-5; + y = me->GetPositionY()-5; + z = me->GetPositionZ(); + for (uint8 i = 0; i < 4; ++i) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + //DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control + if (Creature* pTemp = me->SummonCreature(CREATURE_AVENGING_SPIRIT, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { - pTemp->AddThreat(pTarget, 0.0f); - pTemp->AI()->AttackStart(pTarget); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + pTemp->AddThreat(pTarget, 0.0f); + pTemp->AI()->AttackStart(pTarget); + } } } - } - m_uiAbility_TORGYN_Timer = 15000; // overtime - } else m_uiAbility_TORGYN_Timer -= diff; + m_uiAbility_TORGYN_Timer = 15000; // overtime + } else m_uiAbility_TORGYN_Timer -= diff; - // Health check ----------------------------------------------------------------------------- - if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(m_uiHealthAmountMultipler * m_uiHealthAmountModifier))) - { - uint8 m_uiOrder = m_uiHealthAmountModifier - 1; - ++m_uiHealthAmountModifier; - - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - me->AttackStop(); - me->GetMotionMaster()->MovePoint(0, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveZ); - - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - m_bIsActiveWithBJORN = false; - m_bIsActiveWithHALDOR = false; - m_bIsActiveWithRANULF = false; - m_bIsActiveWithTORGYN = false; - - m_uiBane_Timer += 8000; - m_uiFetidRot_Timer += 8000; - m_uiDarkSlash_Timer += 8000; - m_uiAncestors_Vengeance_Timer += 8000; - - m_uiActivedNumber = m_uiOrder; - m_bIsWalking = true; - m_uiPause_Timer = 2000; - return; + // Health check ----------------------------------------------------------------------------- + if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(m_uiHealthAmountMultipler * m_uiHealthAmountModifier))) + { + uint8 m_uiOrder = m_uiHealthAmountModifier - 1; + ++m_uiHealthAmountModifier; + + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + me->AttackStop(); + me->GetMotionMaster()->MovePoint(0, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveZ); + + DespawnBoatGhosts(m_uiActivedCreatureGUID); + DespawnBoatGhosts(m_uiOrbGUID); + + m_bIsActiveWithBJORN = false; + m_bIsActiveWithHALDOR = false; + m_bIsActiveWithRANULF = false; + m_bIsActiveWithTORGYN = false; + + m_uiBane_Timer += 8000; + m_uiFetidRot_Timer += 8000; + m_uiDarkSlash_Timer += 8000; + m_uiAncestors_Vengeance_Timer += 8000; + + m_uiActivedNumber = m_uiOrder; + m_bIsWalking = true; + m_uiPause_Timer = 2000; + return; + } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); } - } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); + DespawnBoatGhosts(m_uiActivedCreatureGUID); + DespawnBoatGhosts(m_uiOrbGUID); - if (pInstance) - pInstance->SetData(DATA_KING_YMIRON_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_KING_YMIRON_EVENT, DONE); + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); + } - void DespawnBoatGhosts(uint64& m_uiCreatureGUID) - { - if (m_uiCreatureGUID) - if (Creature* pTemp = Unit::GetCreature(*me, m_uiCreatureGUID)) - pTemp->DisappearAndDie(); + void DespawnBoatGhosts(uint64& m_uiCreatureGUID) + { + if (m_uiCreatureGUID) + if (Creature* pTemp = Unit::GetCreature(*me, m_uiCreatureGUID)) + pTemp->DisappearAndDie(); + + m_uiCreatureGUID = 0; + } + }; - m_uiCreatureGUID = 0; - } }; -CreatureAI* GetAI_boss_ymiron(Creature* pCreature) -{ - return new boss_ymironAI(pCreature); -} void AddSC_boss_ymiron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ymiron"; - newscript->GetAI = &GetAI_boss_ymiron; - newscript->RegisterSelf(); + new boss_ymiron(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp index dbbd7b058f2..ae295dacc15 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp @@ -34,9 +34,9 @@ enum GameObjects ENTRY_GORK_PALEHOOF_SPHERE = 188593 }; -struct instance_pinnacle : public ScriptedInstance +struct instance_pinnacle : public InstanceScript { - instance_pinnacle(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_pinnacle(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 uiSvalaSorrowgrave; uint64 uiGortokPalehoof; @@ -242,17 +242,20 @@ struct instance_pinnacle : public ScriptedInstance OUT_LOAD_INST_DATA_COMPLETE; } }; - -InstanceData* GetInstanceData_instance_utgarde_pinnacle(Map* pMap) +
class instance_utgarde_pinnacle : public InstanceMapScript { - return new instance_pinnacle(pMap); -} +public: + instance_utgarde_pinnacle() : InstanceMapScript("instance_utgarde_pinnacle") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_pinnacle(pMap); + } + + +}; void AddSC_instance_utgarde_pinnacle() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_utgarde_pinnacle"; - newscript->GetInstanceData = &GetInstanceData_instance_utgarde_pinnacle; - newscript->RegisterSelf(); + new instance_utgarde_pinnacle(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp index 124a8f0b8b8..131b3b9080b 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp @@ -52,166 +52,171 @@ UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`= #define EVENT_ROCK_SHOWER 5 //set = 20s cd,unkown cd #define EVENT_SHIELD_CRUSH 6 //set = 30s cd #define EVENT_WHIRL 8 //set= 10s cd - -struct boss_archavonAI : public ScriptedAI +
class boss_archavon : public CreatureScript { - boss_archavonAI(Creature *c) : ScriptedAI(c) +public: + boss_archavon() : CreatureScript("boss_archavon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_archavonAI (pCreature); } - ScriptedInstance* pInstance; - EventMap events; - - void Reset() + struct boss_archavonAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_ARCHAVON_EVENT, NOT_STARTED); - } + boss_archavonAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void KilledUnit(Unit* /*Victim*/) {} + InstanceScript* pInstance; + EventMap events; - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ARCHAVON_EVENT, DONE); - } + void Reset() + { + events.Reset(); - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); - events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); - events.ScheduleEvent(EVENT_STOMP, 45000); - events.ScheduleEvent(EVENT_BERSERK, 300000); - - if (pInstance) - pInstance->SetData(DATA_ARCHAVON_EVENT, IN_PROGRESS); - } + if (pInstance) + pInstance->SetData(DATA_ARCHAVON_EVENT, NOT_STARTED); + } - // Below UpdateAI may need review/debug. - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void KilledUnit(Unit* /*Victim*/) {} - events.Update(diff); + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ARCHAVON_EVENT, DONE); + } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); + events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); + events.ScheduleEvent(EVENT_STOMP, 45000); + events.ScheduleEvent(EVENT_BERSERK, 300000); + + if (pInstance) + pInstance->SetData(DATA_ARCHAVON_EVENT, IN_PROGRESS); + } - while (uint32 eventId = events.ExecuteEvent()) + // Below UpdateAI may need review/debug. + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ROCK_SHARDS: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ROCK_SHARDS); - events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); - return; - case EVENT_CHOKING_CLOUD: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CRUSHING_LEAP, true); //10y~80y, ignore range - events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); - return; - case EVENT_STOMP: - DoCast(me->getVictim(), SPELL_STOMP); - events.ScheduleEvent(EVENT_IMPALE, 3000); - events.ScheduleEvent(EVENT_STOMP, 45000); - return; - case EVENT_IMPALE: - DoCast(me->getVictim(), SPELL_IMPALE); - return; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - DoScriptText(EMOTE_BERSERK, me); - return; + switch(eventId) + { + case EVENT_ROCK_SHARDS: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ROCK_SHARDS); + events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); + return; + case EVENT_CHOKING_CLOUD: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CRUSHING_LEAP, true); //10y~80y, ignore range + events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); + return; + case EVENT_STOMP: + DoCast(me->getVictim(), SPELL_STOMP); + events.ScheduleEvent(EVENT_IMPALE, 3000); + events.ScheduleEvent(EVENT_STOMP, 45000); + return; + case EVENT_IMPALE: + DoCast(me->getVictim(), SPELL_IMPALE); + return; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + DoScriptText(EMOTE_BERSERK, me); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; /*###### ## Mob Archavon Warder -######*/ -struct mob_archavon_warderAI : public ScriptedAI //npc 32353 +######*/
class mob_archavon_warder : public CreatureScript { - mob_archavon_warderAI(Creature *c) : ScriptedAI(c) {} +public: + mob_archavon_warder() : CreatureScript("mob_archavon_warder") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_archavon_warderAI(pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_archavon_warderAI : public ScriptedAI //npc 32353 { - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ROCK_SHOWER, 2000); - events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); - events.ScheduleEvent(EVENT_WHIRL, 7500); - } + mob_archavon_warderAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ROCK_SHOWER, 2000); + events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); + events.ScheduleEvent(EVENT_WHIRL, 7500); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ROCK_SHOWER: + switch(eventId) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ROCK_SHOWER); - events.ScheduleEvent(EVENT_ROCK_SHARDS, 6000); - return; + case EVENT_ROCK_SHOWER: + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ROCK_SHOWER); + events.ScheduleEvent(EVENT_ROCK_SHARDS, 6000); + return; + } + case EVENT_SHIELD_CRUSH: + DoCast(me->getVictim(), SPELL_SHIELD_CRUSH); + events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); + return; + case EVENT_WHIRL: + DoCast(me->getVictim(), SPELL_WHIRL); + events.ScheduleEvent(EVENT_WHIRL, 8000); + return; } - case EVENT_SHIELD_CRUSH: - DoCast(me->getVictim(), SPELL_SHIELD_CRUSH); - events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); - return; - case EVENT_WHIRL: - DoCast(me->getVictim(), SPELL_WHIRL); - events.ScheduleEvent(EVENT_WHIRL, 8000); - return; } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_mob_archavon_warder(Creature* pCreature) -{ - return new mob_archavon_warderAI(pCreature); -} -CreatureAI* GetAI_boss_archavon(Creature* pCreature) -{ - return new boss_archavonAI (pCreature); -} void AddSC_boss_archavon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_archavon"; - newscript->GetAI = &GetAI_boss_archavon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_archavon_warder"; - newscript->GetAI = &GetAI_mob_archavon_warder; - newscript->RegisterSelf(); + new boss_archavon(); + new mob_archavon_warder(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 6757d28a208..f9da757a34a 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -56,214 +56,219 @@ struct Position TempestMinions[MAX_TEMPEST_MINIONS] = /*###### ## Emalon the Storm Watcher -######*/ -struct boss_emalonAI : public BossAI +######*/
class boss_emalon : public CreatureScript { - boss_emalonAI(Creature *c) : BossAI(c, DATA_EMALON_EVENT) +public: + boss_emalon() : CreatureScript("boss_emalon") { } + + CreatureAI* GetAI(Creature *_Creature) { + return new boss_emalonAI (_Creature); } - void Reset() + struct boss_emalonAI : public BossAI { - _Reset(); + boss_emalonAI(Creature *c) : BossAI(c, DATA_EMALON_EVENT) + { + } - for (uint8 i = 0; i < MAX_TEMPEST_MINIONS; ++i) - me->SummonCreature(MOB_TEMPEST_MINION, TempestMinions[i], TEMPSUMMON_CORPSE_DESPAWN, 0); - } + void Reset() + { + _Reset(); - void JustSummoned(Creature *summoned) - { - BossAI::JustSummoned(summoned); + for (uint8 i = 0; i < MAX_TEMPEST_MINIONS; ++i) + me->SummonCreature(MOB_TEMPEST_MINION, TempestMinions[i], TEMPSUMMON_CORPSE_DESPAWN, 0); + } - if (me->getVictim() && summoned->AI()) - summoned->AI()->AttackStart(me->getVictim()); - } + void JustSummoned(Creature *summoned) + { + BossAI::JustSummoned(summoned); - void EnterCombat(Unit * who) - { - if (!summons.empty()) + if (me->getVictim() && summoned->AI()) + summoned->AI()->AttackStart(me->getVictim()); + } + + void EnterCombat(Unit * who) { - for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + if (!summons.empty()) { - Creature *minion = Unit::GetCreature(*me, *itr); - if (minion && minion->isAlive() && !minion->getVictim() && minion->AI()) - minion->AI()->AttackStart(who); + for (std::list<uint64>::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) + { + Creature *minion = Unit::GetCreature(*me, *itr); + if (minion && minion->isAlive() && !minion->getVictim() && minion->AI()) + minion->AI()->AttackStart(who); + } } - } - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 5000); - events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); - events.ScheduleEvent(EVENT_BERSERK, 360000); - events.ScheduleEvent(EVENT_OVERCHARGE, 45000); + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 5000); + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); + events.ScheduleEvent(EVENT_BERSERK, 360000); + events.ScheduleEvent(EVENT_OVERCHARGE, 45000); - _EnterCombat(); - } + _EnterCombat(); + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_CHAIN_LIGHTNING: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 25000); - break; - case EVENT_LIGHTNING_NOVA: - DoCastAOE(SPELL_LIGHTNING_NOVA, false); - events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); - break; - case EVENT_OVERCHARGE: - if (!summons.empty()) + switch(eventId) { - std::list<uint64>::const_iterator itr = summons.begin(); - std::advance(itr, urand(0, summons.size()-1)); - Creature *minion = Unit::GetCreature(*me, *itr); - if (minion && minion->isAlive()) + case EVENT_CHAIN_LIGHTNING: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 25000); + break; + case EVENT_LIGHTNING_NOVA: + DoCastAOE(SPELL_LIGHTNING_NOVA, false); + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); + break; + case EVENT_OVERCHARGE: + if (!summons.empty()) { - minion->CastSpell(me, SPELL_OVERCHARGED, true); - minion->SetHealth(minion->GetMaxHealth()); - DoScriptText(EMOTE_OVERCHARGE, me); - events.ScheduleEvent(EVENT_OVERCHARGE, 45000); + std::list<uint64>::const_iterator itr = summons.begin(); + std::advance(itr, urand(0, summons.size()-1)); + Creature *minion = Unit::GetCreature(*me, *itr); + if (minion && minion->isAlive()) + { + minion->CastSpell(me, SPELL_OVERCHARGED, true); + minion->SetHealth(minion->GetMaxHealth()); + DoScriptText(EMOTE_OVERCHARGE, me); + events.ScheduleEvent(EVENT_OVERCHARGE, 45000); + } } + break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + DoScriptText(EMOTE_BERSERK, me); + break; } - break; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - DoScriptText(EMOTE_BERSERK, me); - break; } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; /*###### ## Tempest Minion -######*/ -struct mob_tempest_minionAI : public ScriptedAI +######*/
class mob_tempest_minion : public CreatureScript { - mob_tempest_minionAI(Creature *c) : ScriptedAI(c) +public: + mob_tempest_minion() : CreatureScript("mob_tempest_minion") { } + + CreatureAI* GetAI(Creature *_Creature) { - pInstance = c->GetInstanceData(); + return new mob_tempest_minionAI (_Creature); } - ScriptedInstance* pInstance; + struct mob_tempest_minionAI : public ScriptedAI + { + mob_tempest_minionAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - EventMap events; + InstanceScript* pInstance; - uint32 uiOverchargedTimer; + EventMap events; - void Reset() - { - events.Reset(); + uint32 uiOverchargedTimer; - uiOverchargedTimer = 0; - } + void Reset() + { + events.Reset(); - void JustDied(Unit* /*Killer*/) - { - if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) + uiOverchargedTimer = 0; + } + + void JustDied(Unit* /*Killer*/) { - if (pEmalon->isAlive()) + if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) { - pEmalon->SummonCreature(MOB_TEMPEST_MINION, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoScriptText(EMOTE_MINION_RESPAWN, me); + if (pEmalon->isAlive()) + { + pEmalon->SummonCreature(MOB_TEMPEST_MINION, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoScriptText(EMOTE_MINION_RESPAWN, me); + } } } - } - void EnterCombat(Unit * who) - { - DoZoneInCombat(); - events.ScheduleEvent(EVENT_SHOCK, 20000); - - if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) + void EnterCombat(Unit * who) { - if (!pEmalon->getVictim() && pEmalon->AI()) - pEmalon->AI()->AttackStart(who); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_SHOCK, 20000); + + if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) + { + if (!pEmalon->getVictim() && pEmalon->AI()) + pEmalon->AI()->AttackStart(who); + } } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - if (Aura *overchargedAura = me->GetAura(SPELL_OVERCHARGED)) - { - if (overchargedAura->GetStackAmount() < 10) + if (Aura *overchargedAura = me->GetAura(SPELL_OVERCHARGED)) { - if (uiOverchargedTimer <= diff) + if (overchargedAura->GetStackAmount() < 10) { - DoCast(me, SPELL_OVERCHARGED); - uiOverchargedTimer = 2000; - } else uiOverchargedTimer -=diff; - } - else - { - if (overchargedAura->GetStackAmount() == 10) + if (uiOverchargedTimer <= diff) + { + DoCast(me, SPELL_OVERCHARGED); + uiOverchargedTimer = 2000; + } else uiOverchargedTimer -=diff; + } + else { - DoCast(me, SPELL_OVERCHARGED_BLAST); - me->ForcedDespawn(); - DoScriptText(EMOTE_MINION_RESPAWN, me); + if (overchargedAura->GetStackAmount() == 10) + { + DoCast(me, SPELL_OVERCHARGED_BLAST); + me->ForcedDespawn(); + DoScriptText(EMOTE_MINION_RESPAWN, me); + } } } - } - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHOCK: - DoCast(me->getVictim(), SPELL_SHOCK); - events.ScheduleEvent(EVENT_SHOCK, 20000); - return; + switch(eventId) + { + case EVENT_SHOCK: + DoCast(me->getVictim(), SPELL_SHOCK); + events.ScheduleEvent(EVENT_SHOCK, 20000); + return; + } } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_tempest_minion(Creature *_Creature) -{ - return new mob_tempest_minionAI (_Creature); -} -CreatureAI* GetAI_boss_emalon(Creature *_Creature) -{ - return new boss_emalonAI (_Creature); -} void AddSC_boss_emalon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_emalon"; - newscript->GetAI = &GetAI_boss_emalon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tempest_minion"; - newscript->GetAI = &GetAI_mob_tempest_minion; - newscript->RegisterSelf(); + new boss_emalon(); + new mob_tempest_minion(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index f8bc8295f21..27a723622a2 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -62,160 +62,165 @@ enum Spells SPELL_FW_METEOR_FISTS_B = 67331, SPELL_FW_METEOR_FISTS_B_H = 68160, }; - -struct boss_koralonAI : public ScriptedAI +
class boss_koralon : public CreatureScript { - boss_koralonAI(Creature *c) : ScriptedAI(c) +public: + boss_koralon() : CreatureScript("boss_koralon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_koralonAI (pCreature); } - ScriptedInstance *pInstance; - EventMap events; - - void Reset() + struct boss_koralonAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_KORALON_EVENT, NOT_STARTED); - } + boss_koralonAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void KilledUnit(Unit* /*Victim*/) {} + InstanceScript *pInstance; + EventMap events; - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_KORALON_EVENT, DONE); - } + void Reset() + { + events.Reset(); - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_KORALON_EVENT, NOT_STARTED); + } - DoCast(me, SPELL_BURNING_FURY); + void KilledUnit(Unit* /*Victim*/) {} - events.ScheduleEvent(EVENT_BURNING_FURY, 20000); // TODO check timer - events.ScheduleEvent(EVENT_BURNING_BREATH, 15000); // 1st after 15sec, then every 45sec - events.ScheduleEvent(EVENT_METEOR_FISTS_A, 75000); // 1st after 75sec, then every 45sec - events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); // TODO check timer + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_KORALON_EVENT, DONE); + } - if (pInstance) - pInstance->SetData(DATA_KORALON_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + DoCast(me, SPELL_BURNING_FURY); - events.Update(diff); + events.ScheduleEvent(EVENT_BURNING_FURY, 20000); // TODO check timer + events.ScheduleEvent(EVENT_BURNING_BREATH, 15000); // 1st after 15sec, then every 45sec + events.ScheduleEvent(EVENT_METEOR_FISTS_A, 75000); // 1st after 75sec, then every 45sec + events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); // TODO check timer - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (pInstance) + pInstance->SetData(DATA_KORALON_EVENT, IN_PROGRESS); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_BURNING_FURY: - DoCast(me, SPELL_BURNING_FURY); - events.ScheduleEvent(EVENT_BURNING_FURY, 20000); - return; - case EVENT_BURNING_BREATH: - DoCast(me, RAID_MODE(SPELL_BURNING_BREATH,SPELL_BURNING_BREATH_H)); - events.ScheduleEvent(EVENT_BURNING_BREATH, 45000); - return; - case EVENT_METEOR_FISTS_A: - DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_A,SPELL_METEOR_FISTS_A_H)); - events.ScheduleEvent(EVENT_METEOR_FISTS_B, 1500); - return; - case EVENT_METEOR_FISTS_B: - DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_B,SPELL_METEOR_FISTS_B_H)); - events.ScheduleEvent(EVENT_METEOR_FISTS_A, 45000); - return; - case EVENT_FLAME_CINDER_A: - DoCast(me, RAID_MODE(SPELL_FLAME_CINDER_A,SPELL_FLAME_CINDER_A_H)); - events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); - return; + switch(eventId) + { + case EVENT_BURNING_FURY: + DoCast(me, SPELL_BURNING_FURY); + events.ScheduleEvent(EVENT_BURNING_FURY, 20000); + return; + case EVENT_BURNING_BREATH: + DoCast(me, RAID_MODE(SPELL_BURNING_BREATH,SPELL_BURNING_BREATH_H)); + events.ScheduleEvent(EVENT_BURNING_BREATH, 45000); + return; + case EVENT_METEOR_FISTS_A: + DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_A,SPELL_METEOR_FISTS_A_H)); + events.ScheduleEvent(EVENT_METEOR_FISTS_B, 1500); + return; + case EVENT_METEOR_FISTS_B: + DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_B,SPELL_METEOR_FISTS_B_H)); + events.ScheduleEvent(EVENT_METEOR_FISTS_A, 45000); + return; + case EVENT_FLAME_CINDER_A: + DoCast(me, RAID_MODE(SPELL_FLAME_CINDER_A,SPELL_FLAME_CINDER_A_H)); + events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); + return; + } } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + }; + }; /*###### ## Mob Flame Warder -######*/ -struct mob_flame_warderAI : public ScriptedAI +######*/
class mob_flame_warder : public CreatureScript { - mob_flame_warderAI(Creature *c) : ScriptedAI(c) {} - - EventMap events; +public: + mob_flame_warder() : CreatureScript("mob_flame_warder") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_flame_warderAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_flame_warderAI : public ScriptedAI { - DoZoneInCombat(); + mob_flame_warderAI(Creature *c) : ScriptedAI(c) {} - events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 5000); - events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 10000); - } + EventMap events; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + events.Reset(); + } - events.Update(diff); + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + + events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 5000); + events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 10000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FW_LAVA_BIRST: - DoCast(me->getVictim(), RAID_MODE(SPELL_FW_LAVA_BIRST,SPELL_FW_LAVA_BIRST_H)); - events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 15000); - return; - case EVENT_FW_METEOR_FISTS_A: - DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_A,SPELL_FW_METEOR_FISTS_A_H)); - events.ScheduleEvent(EVENT_FW_METEOR_FISTS_B, 1500); - return; - case EVENT_FW_METEOR_FISTS_B: - DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_B,SPELL_FW_METEOR_FISTS_B_H)); - events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 20000); - return; + switch(eventId) + { + case EVENT_FW_LAVA_BIRST: + DoCast(me->getVictim(), RAID_MODE(SPELL_FW_LAVA_BIRST,SPELL_FW_LAVA_BIRST_H)); + events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 15000); + return; + case EVENT_FW_METEOR_FISTS_A: + DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_A,SPELL_FW_METEOR_FISTS_A_H)); + events.ScheduleEvent(EVENT_FW_METEOR_FISTS_B, 1500); + return; + case EVENT_FW_METEOR_FISTS_B: + DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_B,SPELL_FW_METEOR_FISTS_B_H)); + events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 20000); + return; + } } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_boss_koralon(Creature* pCreature) -{ - return new boss_koralonAI (pCreature); -} -CreatureAI* GetAI_mob_flame_warder(Creature* pCreature) -{ - return new mob_flame_warderAI (pCreature); -} void AddSC_boss_koralon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_koralon"; - newscript->GetAI = &GetAI_boss_koralon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_flame_warder"; - newscript->GetAI = &GetAI_mob_flame_warder; - newscript->RegisterSelf(); + new boss_koralon(); + new mob_flame_warder(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index eddf62700fe..97285286379 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -52,249 +52,260 @@ UPDATE `creature_template` SET `ScriptName`='mob_frozen_orb' WHERE `entry`='3845 // Mob Frozen Orb #define MOB_FROZEN_ORB 38456 // 1 in 10 mode and 3 in 25 mode - -struct boss_toravonAI : public ScriptedAI +
class boss_toravon : public CreatureScript { - boss_toravonAI(Creature *c) : ScriptedAI(c) +public: + boss_toravon() : CreatureScript("boss_toravon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_toravonAI (pCreature); } - ScriptedInstance *pInstance; - EventMap events; - - void Reset() + struct boss_toravonAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_TORAVON_EVENT, NOT_STARTED); - } + boss_toravonAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void KilledUnit(Unit* /*Victim*/) {} + InstanceScript *pInstance; + EventMap events; - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_TORAVON_EVENT, DONE); - } + void Reset() + { + events.Reset(); - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_TORAVON_EVENT, NOT_STARTED); + } - DoCast(me, SPELL_FROZEN_MALLET); + void KilledUnit(Unit* /*Victim*/) {} - events.ScheduleEvent(EVENT_FROZEN_ORB, 11000); - events.ScheduleEvent(EVENT_WHITEOUT, 13000); - events.ScheduleEvent(EVENT_FREEZING_GROUND, 15000); + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_TORAVON_EVENT, DONE); + } - if (pInstance) - pInstance->SetData(DATA_TORAVON_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + DoCast(me, SPELL_FROZEN_MALLET); - events.Update(diff); + events.ScheduleEvent(EVENT_FROZEN_ORB, 11000); + events.ScheduleEvent(EVENT_WHITEOUT, 13000); + events.ScheduleEvent(EVENT_FREEZING_GROUND, 15000); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (pInstance) + pInstance->SetData(DATA_TORAVON_EVENT, IN_PROGRESS); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FROZEN_ORB: - DoCast(me, SPELL_FROZEN_ORB); - events.ScheduleEvent(EVENT_FROZEN_ORB, 38000); - return; - case EVENT_WHITEOUT: - DoCast(me, SPELL_WHITEOUT); - events.ScheduleEvent(EVENT_WHITEOUT, 38000); - return; - case EVENT_FREEZING_GROUND: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FREEZING_GROUND); - events.ScheduleEvent(EVENT_FREEZING_GROUND, 20000); - return; + switch(eventId) + { + case EVENT_FROZEN_ORB: + DoCast(me, SPELL_FROZEN_ORB); + events.ScheduleEvent(EVENT_FROZEN_ORB, 38000); + return; + case EVENT_WHITEOUT: + DoCast(me, SPELL_WHITEOUT); + events.ScheduleEvent(EVENT_WHITEOUT, 38000); + return; + case EVENT_FREEZING_GROUND: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FREEZING_GROUND); + events.ScheduleEvent(EVENT_FREEZING_GROUND, 20000); + return; + } } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + }; + }; /*###### ## Mob Frost Warder -######*/ -struct mob_frost_warderAI : public ScriptedAI +######*/
class mob_frost_warder : public CreatureScript { - mob_frost_warderAI(Creature *c) : ScriptedAI(c) {} - - EventMap events; +public: + mob_frost_warder() : CreatureScript("mob_frost_warder") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_frost_warderAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_frost_warderAI : public ScriptedAI { - DoZoneInCombat(); + mob_frost_warderAI(Creature *c) : ScriptedAI(c) {} - DoCast(me, SPELL_FROZEN_MALLET); + EventMap events; - events.ScheduleEvent(EVENT_FROST_BLAST, 5000); - } + void Reset() + { + events.Reset(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); - events.Update(diff); + DoCast(me, SPELL_FROZEN_MALLET); + + events.ScheduleEvent(EVENT_FROST_BLAST, 5000); + } - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_FROST_BLAST: - DoCast(me->getVictim(), SPELL_FROST_BLAST); - events.ScheduleEvent(EVENT_FROST_BLAST, 20000); - return; + switch(eventId) + { + case EVENT_FROST_BLAST: + DoCast(me->getVictim(), SPELL_FROST_BLAST); + events.ScheduleEvent(EVENT_FROST_BLAST, 20000); + return; + } } + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + }; + }; /*###### ## Mob Frozen Orb -######*/ -struct mob_frozen_orbAI : public ScriptedAI +######*/
class mob_frozen_orb : public CreatureScript { - mob_frozen_orbAI(Creature *c) : ScriptedAI(c) {} - - bool done; - uint32 killtimer; +public: + mob_frozen_orb() : CreatureScript("mob_frozen_orb") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - done = false; - killtimer = 60000; // if after this time there is no victim -> destroy! + return new mob_frozen_orbAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_frozen_orbAI : public ScriptedAI { - DoZoneInCombat(); - } + mob_frozen_orbAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!done) + bool done; + uint32 killtimer; + + void Reset() { - DoCast(me, SPELL_FROZEN_ORB_AURA, true); - DoCast(me, SPELL_FROZEN_ORB_DMG, true); - done = true; + done = false; + killtimer = 60000; // if after this time there is no victim -> destroy! } - if (killtimer <= diff) + void EnterCombat(Unit * /*who*/) { - if (!UpdateVictim()) - me->ForcedDespawn(); - killtimer = 10000; + DoZoneInCombat(); } - else - killtimer -= diff; - } + + void UpdateAI(const uint32 diff) + { + if (!done) + { + DoCast(me, SPELL_FROZEN_ORB_AURA, true); + DoCast(me, SPELL_FROZEN_ORB_DMG, true); + done = true; + } + + if (killtimer <= diff) + { + if (!UpdateVictim()) + me->ForcedDespawn(); + killtimer = 10000; + } + else + killtimer -= diff; + } + }; + }; /*###### ## Mob Frozen Orb Stalker -######*/ -struct mob_frozen_orb_stalkerAI : public Scripted_NoMovementAI +######*/
class mob_frozen_orb_stalker : public CreatureScript { - mob_frozen_orb_stalkerAI(Creature* c) : Scripted_NoMovementAI(c) - { - c->SetVisibility(VISIBILITY_OFF); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - c->SetReactState(REACT_PASSIVE); +public: + mob_frozen_orb_stalker() : CreatureScript("mob_frozen_orb_stalker") { } - pInstance = c->GetInstanceData(); - spawned = false; + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_frozen_orb_stalkerAI (pCreature); } - ScriptedInstance *pInstance; - bool spawned; - - void UpdateAI(const uint32 /*diff*/) + struct mob_frozen_orb_stalkerAI : public Scripted_NoMovementAI { - if (spawned) - return; + mob_frozen_orb_stalkerAI(Creature* c) : Scripted_NoMovementAI(c) + { + c->SetVisibility(VISIBILITY_OFF); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + c->SetReactState(REACT_PASSIVE); - spawned = true; - if (!pInstance) - return; + pInstance = c->GetInstanceScript(); + spawned = false; + } - Unit* pToravon = me->GetCreature(*me, pInstance->GetData64(DATA_TORAVON)); - if (!pToravon) - return; + InstanceScript *pInstance; + bool spawned; - uint8 num_orbs = RAID_MODE(1, 3); - for (uint8 i=0; i<num_orbs; ++i) + void UpdateAI(const uint32 /*diff*/) { - Position pos; - me->GetNearPoint(pToravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f); - me->SetPosition(pos, true); - DoCast(me, SPELL_FROZEN_ORB_SUMMON); + if (spawned) + return; + + spawned = true; + if (!pInstance) + return; + + Unit* pToravon = me->GetCreature(*me, pInstance->GetData64(DATA_TORAVON)); + if (!pToravon) + return; + + uint8 num_orbs = RAID_MODE(1, 3); + for (uint8 i=0; i<num_orbs; ++i) + { + Position pos; + me->GetNearPoint(pToravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f); + me->SetPosition(pos, true); + DoCast(me, SPELL_FROZEN_ORB_SUMMON); + } } - } + }; + }; -CreatureAI* GetAI_boss_toravon(Creature* pCreature) -{ - return new boss_toravonAI (pCreature); -} -CreatureAI* GetAI_mob_frost_warder(Creature* pCreature) -{ - return new mob_frost_warderAI (pCreature); -} -CreatureAI* GetAI_mob_frozen_orb(Creature* pCreature) -{ - return new mob_frozen_orbAI (pCreature); -} -CreatureAI* GetAI_mob_frozen_orb_stalker(Creature* pCreature) -{ - return new mob_frozen_orb_stalkerAI (pCreature); -} void AddSC_boss_toravon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_toravon"; - newscript->GetAI = &GetAI_boss_toravon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frost_warder"; - newscript->GetAI = &GetAI_mob_frost_warder; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frozen_orb"; - newscript->GetAI = &GetAI_mob_frozen_orb; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frozen_orb_stalker"; - newscript->GetAI = &GetAI_mob_frozen_orb_stalker; - newscript->RegisterSelf(); + new boss_toravon(); + new mob_frost_warder(); + new mob_frozen_orb(); + new mob_frozen_orb_stalker(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index e7449acafb4..5478d632a70 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -26,135 +26,138 @@ 3 - Koralon the Flame Watcher event 4 - Toravon the Ice Watcher event */ - -struct instance_archavon : public ScriptedInstance +
class instance_archavon : public InstanceMapScript { - instance_archavon(Map *Map) : ScriptedInstance(Map) {}; - - uint32 uiEncounters[ENCOUNTERS]; +public: + instance_archavon() : InstanceMapScript("instance_archavon") { } - uint64 uiArchavon; - uint64 uiEmalon; - uint64 uiKoralon; - uint64 uiToravon; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* map) { - uiArchavon = 0; - uiEmalon = 0; - uiKoralon = 0; - uiToravon = 0; - - for (uint8 i = 0; i < ENCOUNTERS; i++) - uiEncounters[i] = NOT_STARTED; + return new instance_archavon_InstanceMapScript(map); } - bool IsEncounterInProgress() const + struct instance_archavon_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < ENCOUNTERS; i++) - if (uiEncounters[i] == IN_PROGRESS) - return true; + instance_archavon_InstanceMapScript(Map *Map) : InstanceScript(Map) {}; - return false; - } + uint32 uiEncounters[ENCOUNTERS]; - void OnCreatureCreate(Creature *creature, bool /*add*/) - { - switch(creature->GetEntry()) + uint64 uiArchavon; + uint64 uiEmalon; + uint64 uiKoralon; + uint64 uiToravon; + + void Initialize() { - case CREATURE_ARCHAVON: uiArchavon = creature->GetGUID(); break; - case CREATURE_EMALON: uiEmalon = creature->GetGUID(); break; - case CREATURE_KORALON: uiKoralon = creature->GetGUID(); break; - case CREATURE_TORAVON: uiToravon = creature->GetGUID(); break; + uiArchavon = 0; + uiEmalon = 0; + uiKoralon = 0; + uiToravon = 0; + + for (uint8 i = 0; i < ENCOUNTERS; i++) + uiEncounters[i] = NOT_STARTED; } - } - uint32 GetData(uint32 type) - { - switch(type) + bool IsEncounterInProgress() const { - case DATA_ARCHAVON_EVENT: return uiEncounters[0]; - case DATA_EMALON_EVENT: return uiEncounters[1]; - case DATA_KORALON_EVENT: return uiEncounters[2]; - case DATA_TORAVON_EVENT: return uiEncounters[3]; + for (uint8 i = 0; i < ENCOUNTERS; i++) + if (uiEncounters[i] == IN_PROGRESS) + return true; + + return false; } - return 0; - } - uint64 GetData64(uint32 identifier) - { - switch(identifier) + void OnCreatureCreate(Creature *creature, bool /*add*/) { - case DATA_ARCHAVON: return uiArchavon; - case DATA_EMALON: return uiEmalon; - case DATA_KORALON: return uiKoralon; - case DATA_TORAVON: return uiToravon; + switch(creature->GetEntry()) + { + case CREATURE_ARCHAVON: uiArchavon = creature->GetGUID(); break; + case CREATURE_EMALON: uiEmalon = creature->GetGUID(); break; + case CREATURE_KORALON: uiKoralon = creature->GetGUID(); break; + case CREATURE_TORAVON: uiToravon = creature->GetGUID(); break; + } } - return 0; - } - void SetData(uint32 type, uint32 data) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_ARCHAVON_EVENT: uiEncounters[0] = data; break; - case DATA_EMALON_EVENT: uiEncounters[1] = data; break; - case DATA_KORALON_EVENT: uiEncounters[2] = data; break; - case DATA_TORAVON_EVENT: uiEncounters[3] = data; break; + switch(type) + { + case DATA_ARCHAVON_EVENT: return uiEncounters[0]; + case DATA_EMALON_EVENT: return uiEncounters[1]; + case DATA_KORALON_EVENT: return uiEncounters[2]; + case DATA_TORAVON_EVENT: return uiEncounters[3]; + } + return 0; } - if (data == DONE) - SaveToDB(); - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << uiEncounters[0] << " " << uiEncounters[1] << " " << uiEncounters[2] << " " << uiEncounters[3]; - - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) + uint64 GetData64(uint32 identifier) { - OUT_SAVE_INST_DATA_COMPLETE; - return out; + switch(identifier) + { + case DATA_ARCHAVON: return uiArchavon; + case DATA_EMALON: return uiEmalon; + case DATA_KORALON: return uiKoralon; + case DATA_TORAVON: return uiToravon; + } + return 0; } - return NULL; - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_ARCHAVON_EVENT: uiEncounters[0] = data; break; + case DATA_EMALON_EVENT: uiEncounters[1] = data; break; + case DATA_KORALON_EVENT: uiEncounters[2] = data; break; + case DATA_TORAVON_EVENT: uiEncounters[3] = data; break; + } + + if (data == DONE) + SaveToDB(); + } - void Load(const char* in) - { - if (!in) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << uiEncounters[0] << " " << uiEncounters[1] << " " << uiEncounters[2] << " " << uiEncounters[3]; + + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + + return NULL; } - OUT_LOAD_INST_DATA(in); + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::istringstream stream(in); - stream >> uiEncounters[0] >> uiEncounters[1] >> uiEncounters[2] >> uiEncounters[3]; + OUT_LOAD_INST_DATA(in); - for (uint8 i = 0; i < ENCOUNTERS; ++i) - if (uiEncounters[i] == IN_PROGRESS) - uiEncounters[i] = NOT_STARTED; + std::istringstream stream(in); + stream >> uiEncounters[0] >> uiEncounters[1] >> uiEncounters[2] >> uiEncounters[3]; + + for (uint8 i = 0; i < ENCOUNTERS; ++i) + if (uiEncounters[i] == IN_PROGRESS) + uiEncounters[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_archavon(Map* map) -{ - return new instance_archavon(map); -} void AddSC_instance_archavon() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_archavon"; - newscript->GetInstanceData = &GetInstanceData_instance_archavon; - newscript->RegisterSelf(); + new instance_archavon(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 8e760ba00c6..937a0bcb3a2 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -44,118 +44,120 @@ enum Yells SAY_SPECIAL_ATTACK_1 = -1608008, SAY_SPECIAL_ATTACK_2 = -1608009 }; - -struct boss_cyanigosaAI : public ScriptedAI +
class boss_cyanigosa : public CreatureScript { - boss_cyanigosaAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_cyanigosa() : CreatureScript("boss_cyanigosa") { } - uint32 uiArcaneVacuumTimer; - uint32 uiBlizzardTimer; - uint32 uiManaDestructionTimer; - uint32 uiTailSweepTimer; - uint32 uiUncontrollableEnergyTimer; - - ScriptedInstance* pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiArcaneVacuumTimer = 10000; - uiBlizzardTimer = 15000; - uiManaDestructionTimer = 30000; - uiTailSweepTimer = 20000; - uiUncontrollableEnergyTimer = 25000; - if (pInstance) - pInstance->SetData(DATA_CYANIGOSA_EVENT, NOT_STARTED); + return new boss_cyanigosaAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_cyanigosaAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (pInstance && pInstance->GetData(DATA_REMOVE_NPC) == 1) + boss_cyanigosaAI(Creature *c) : ScriptedAI(c) { - me->ForcedDespawn(); - pInstance->SetData(DATA_REMOVE_NPC, 0); + pInstance = c->GetInstanceScript(); } - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 uiArcaneVacuumTimer; + uint32 uiBlizzardTimer; + uint32 uiManaDestructionTimer; + uint32 uiTailSweepTimer; + uint32 uiUncontrollableEnergyTimer; - if (uiArcaneVacuumTimer <= diff) - { - DoCast(SPELL_ARCANE_VACUUM); - uiArcaneVacuumTimer = 10000; - } else uiArcaneVacuumTimer -= diff; + InstanceScript* pInstance; - if (uiBlizzardTimer <= diff) + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BLIZZARD); + uiArcaneVacuumTimer = 10000; uiBlizzardTimer = 15000; - } else uiBlizzardTimer -= diff; + uiManaDestructionTimer = 30000; + uiTailSweepTimer = 20000; + uiUncontrollableEnergyTimer = 25000; + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, NOT_STARTED); + } - if (uiTailSweepTimer <= diff) + void EnterCombat(Unit* /*who*/) { - DoCast(SPELL_TAIL_SWEEP); - uiTailSweepTimer = 20000; - } else uiTailSweepTimer -= diff; + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); + } - if (uiUncontrollableEnergyTimer <= diff) + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCastVictim(SPELL_UNCONTROLLABLE_ENERGY); - uiUncontrollableEnergyTimer = 25000; - } else uiUncontrollableEnergyTimer -= diff; + if (pInstance && pInstance->GetData(DATA_REMOVE_NPC) == 1) + { + me->ForcedDespawn(); + pInstance->SetData(DATA_REMOVE_NPC, 0); + } + + //Return since we have no target + if (!UpdateVictim()) + return; - if (IsHeroic()) - if (uiManaDestructionTimer <= diff) + if (uiArcaneVacuumTimer <= diff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_MANA_DESTRUCTION); - uiManaDestructionTimer = 30000; - } else uiManaDestructionTimer -= diff; + DoCast(SPELL_ARCANE_VACUUM); + uiArcaneVacuumTimer = 10000; + } else uiArcaneVacuumTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiBlizzardTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BLIZZARD); + uiBlizzardTimer = 15000; + } else uiBlizzardTimer -= diff; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (uiTailSweepTimer <= diff) + { + DoCast(SPELL_TAIL_SWEEP); + uiTailSweepTimer = 20000; + } else uiTailSweepTimer -= diff; - if (pInstance) - pInstance->SetData(DATA_CYANIGOSA_EVENT, DONE); - } + if (uiUncontrollableEnergyTimer <= diff) + { + DoCastVictim(SPELL_UNCONTROLLABLE_ENERGY); + uiUncontrollableEnergyTimer = 25000; + } else uiUncontrollableEnergyTimer -= diff; + + if (IsHeroic()) + if (uiManaDestructionTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_MANA_DESTRUCTION); + uiManaDestructionTimer = 30000; + } else uiManaDestructionTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, DONE); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_cyanigosa(Creature* pCreature) -{ - return new boss_cyanigosaAI (pCreature); -} void AddSC_boss_cyanigosa() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_cyanigosa"; - newscript->GetAI = &GetAI_boss_cyanigosa; - newscript->RegisterSelf(); + new boss_cyanigosa(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index d25f87ca230..5a61a91eacc 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -42,207 +42,214 @@ enum Yells SAY_ADD_KILLED = -1608016, SAY_BOTH_ADDS_KILLED = -1608017 }; - -struct boss_erekemAI : public ScriptedAI +
class boss_erekem : public CreatureScript { - boss_erekemAI(Creature *c) : ScriptedAI(c) +public: + boss_erekem() : CreatureScript("boss_erekem") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_erekemAI (pCreature); } - uint32 uiBloodlustTimer; - uint32 uiChainHealTimer; - uint32 uiEarthShockTimer; - uint32 uiLightningBoltTimer; - uint32 uiEarthShieldTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_erekemAI : public ScriptedAI { - uiBloodlustTimer = 15000; - uiChainHealTimer = 0; - uiEarthShockTimer = urand(2000,8000); - uiLightningBoltTimer = urand(5000,10000); - uiEarthShieldTimer = 20000; - if (pInstance) + boss_erekemAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) - { - if (!pGuard1->isAlive()) - pGuard1->Respawn(); - } - if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) - { - if (!pGuard2->isAlive()) - pGuard2->Respawn(); - } - } + uint32 uiBloodlustTimer; + uint32 uiChainHealTimer; + uint32 uiEarthShockTimer; + uint32 uiLightningBoltTimer; + uint32 uiEarthShieldTimer; - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + InstanceScript* pInstance; - if (me->Attack(pWho, true)) + void Reset() { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + uiBloodlustTimer = 15000; + uiChainHealTimer = 0; + uiEarthShockTimer = urand(2000,8000); + uiLightningBoltTimer = urand(5000,10000); + uiEarthShieldTimer = 20000; + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) { - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - if (!pGuard1->getVictim() && pGuard1->AI()) - pGuard1->AI()->AttackStart(pWho); + if (!pGuard1->isAlive()) + pGuard1->Respawn(); } if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) { - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - if (!pGuard2->getVictim() && pGuard2->AI()) - pGuard2->AI()->AttackStart(pWho); + if (!pGuard2->isAlive()) + pGuard2->Respawn(); } } - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_EARTH_SHIELD); - if (pInstance) + void AttackStart(Unit* pWho) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_EREKEM_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //spam stormstrike in hc mode if spawns are dead - if (IsHeroic()) - { - if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) + if (me->Attack(pWho, true)) { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + + if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) + { + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + if (!pGuard1->getVictim() && pGuard1->AI()) + pGuard1->AI()->AttackStart(pWho); + } if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) { - if (!pGuard1->isAlive() && !pGuard2->isAlive()) - DoCast(me->getVictim(), SPELL_STORMSTRIKE); + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + if (!pGuard2->getVictim() && pGuard2->AI()) + pGuard2->AI()->AttackStart(pWho); } } } - if (uiEarthShieldTimer <= diff) + void EnterCombat(Unit* /*pWho*/) { + DoScriptText(SAY_AGGRO, me); DoCast(me, SPELL_EARTH_SHIELD); - uiEarthShieldTimer = 20000; - } else uiEarthShieldTimer -= diff; - if (uiChainHealTimer <= diff) - { - if (uint64 TargetGUID = GetChainHealTargetGUID()) + if (pInstance) { - if (Creature *pTarget = Unit::GetCreature(*me, TargetGUID)) - DoCast(pTarget, SPELL_CHAIN_HEAL); - - //If one of the adds is dead spawn heals faster - Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); - Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); - uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000; + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_EREKEM_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } - } else uiChainHealTimer -= diff; + } - if (uiBloodlustTimer <= diff) - { - DoCast(me, SPELL_BLOODLUST); - uiBloodlustTimer = urand(35000,45000); - } else uiBloodlustTimer -= diff; + void MoveInLineOfSight(Unit* /*who*/) {} - if (uiEarthShockTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_EARTH_SHOCK); - uiEarthShockTimer = urand(8000,13000); - } else uiEarthShockTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiLightningBoltTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_LIGHTNING_BOLT); - uiLightningBoltTimer = urand(18000,24000); - } else uiLightningBoltTimer -= diff; + //spam stormstrike in hc mode if spawns are dead + if (IsHeroic()) + { + if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) + { + if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) + { + if (!pGuard1->isAlive() && !pGuard2->isAlive()) + DoCast(me->getVictim(), SPELL_STORMSTRIKE); + } + } + } - DoMeleeAttackIfReady(); - } + if (uiEarthShieldTimer <= diff) + { + DoCast(me, SPELL_EARTH_SHIELD); + uiEarthShieldTimer = 20000; + } else uiEarthShieldTimer -= diff; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (uiChainHealTimer <= diff) + { + if (uint64 TargetGUID = GetChainHealTargetGUID()) + { + if (Creature *pTarget = Unit::GetCreature(*me, TargetGUID)) + DoCast(pTarget, SPELL_CHAIN_HEAL); - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + //If one of the adds is dead spawn heals faster + Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); + Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); + uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000; + } + } else uiChainHealTimer -= diff; + + if (uiBloodlustTimer <= diff) { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + DoCast(me, SPELL_BLOODLUST); + uiBloodlustTimer = urand(35000,45000); + } else uiBloodlustTimer -= diff; + + if (uiEarthShockTimer <= diff) + { + DoCast(me->getVictim(), SPELL_EARTH_SHOCK); + uiEarthShockTimer = urand(8000,13000); + } else uiEarthShockTimer -= diff; + + if (uiLightningBoltTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_LIGHTNING_BOLT); + uiLightningBoltTimer = urand(18000,24000); + } else uiLightningBoltTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } - uint64 GetChainHealTargetGUID() - { - if (HealthBelowPct(85)) - return me->GetGUID(); + uint64 GetChainHealTargetGUID() + { + if (HealthBelowPct(85)) + return me->GetGUID(); - Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); - if (pGuard1 && pGuard1->isAlive() && (pGuard1->GetHealth()*100 <= pGuard1->GetMaxHealth() * 75)) - return pGuard1->GetGUID(); + Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); + if (pGuard1 && pGuard1->isAlive() && (pGuard1->GetHealth()*100 <= pGuard1->GetMaxHealth() * 75)) + return pGuard1->GetGUID(); - Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); - if (pGuard2 && pGuard2->isAlive() && (pGuard2->GetHealth()*100 <= pGuard2->GetMaxHealth() * 75)) - return pGuard2->GetGUID(); + Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); + if (pGuard2 && pGuard2->isAlive() && (pGuard2->GetHealth()*100 <= pGuard2->GetMaxHealth() * 75)) + return pGuard2->GetGUID(); + + return 0; + } + }; - return 0; - } }; -CreatureAI* GetAI_boss_erekem(Creature* pCreature) -{ - return new boss_erekemAI (pCreature); -} enum GuardSpells { @@ -250,86 +257,84 @@ enum GuardSpells SPELL_HOWLING_SCREECH = 54462, SPELL_STRIKE = 14516 }; - -struct mob_erekem_guardAI : public ScriptedAI +
class mob_erekem_guard : public CreatureScript { - mob_erekem_guardAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiGushingWoundTimer; - uint32 uiHowlingScreechTimer; - uint32 uiStrikeTimer; - - ScriptedInstance* pInstance; +public: + mob_erekem_guard() : CreatureScript("mob_erekem_guard") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiStrikeTimer = urand(4000,8000); - uiHowlingScreechTimer = urand(8000,13000); - uiGushingWoundTimer = urand(1000,3000); + return new mob_erekem_guardAI (pCreature); } - void AttackStart(Unit* pWho) + struct mob_erekem_guardAI : public ScriptedAI { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) + mob_erekem_guardAI(Creature *c) : ScriptedAI(c) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + pInstance = c->GetInstanceScript(); } - } - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 uiGushingWoundTimer; + uint32 uiHowlingScreechTimer; + uint32 uiStrikeTimer; - DoMeleeAttackIfReady(); + InstanceScript* pInstance; - if (uiStrikeTimer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_STRIKE); uiStrikeTimer = urand(4000,8000); - } else uiStrikeTimer -= diff; + uiHowlingScreechTimer = urand(8000,13000); + uiGushingWoundTimer = urand(1000,3000); + } - if (uiHowlingScreechTimer <= diff) + void AttackStart(Unit* pWho) { - DoCast(me->getVictim(), SPELL_HOWLING_SCREECH); - uiHowlingScreechTimer = urand(8000,13000); - } else uiHowlingScreechTimer -= diff; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (uiGushingWoundTimer <= diff) + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_GUSHING_WOUND); - uiGushingWoundTimer = urand(7000,12000); - } else uiGushingWoundTimer -= diff; - } + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + + if (uiStrikeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STRIKE); + uiStrikeTimer = urand(4000,8000); + } else uiStrikeTimer -= diff; + + if (uiHowlingScreechTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HOWLING_SCREECH); + uiHowlingScreechTimer = urand(8000,13000); + } else uiHowlingScreechTimer -= diff; + + if (uiGushingWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GUSHING_WOUND); + uiGushingWoundTimer = urand(7000,12000); + } else uiGushingWoundTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_erekem_guard(Creature* pCreature) -{ - return new mob_erekem_guardAI (pCreature); -} void AddSC_boss_erekem() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_erekem"; - newscript->GetAI = &GetAI_boss_erekem; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_erekem_guard"; - newscript->GetAI = &GetAI_mob_erekem_guard; - newscript->RegisterSelf(); + new boss_erekem(); + new mob_erekem_guard(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index fe216d8db4e..f101c36cfb9 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -70,326 +70,331 @@ static Position SpawnLoc[MAX_SPAWN_LOC]= {1918.97, 850.645, 47.225, 4.136}, {1935.50, 796.224, 52.492, 4.224}, }; - -struct boss_ichoronAI : public ScriptedAI +
class boss_ichoron : public CreatureScript { - boss_ichoronAI(Creature* pCreature) : ScriptedAI(pCreature), m_waterElements(pCreature) +public: + boss_ichoron() : CreatureScript("boss_ichoron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_ichoronAI (pCreature); } - bool bIsExploded; - bool bIsFrenzy; - bool bAchievement; - - uint32 uiBubbleCheckerTimer; - uint32 uiWaterBoltVolleyTimer; + struct boss_ichoronAI : public ScriptedAI + { + boss_ichoronAI(Creature* pCreature) : ScriptedAI(pCreature), m_waterElements(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - ScriptedInstance* pInstance; + bool bIsExploded; + bool bIsFrenzy; + bool bAchievement; - SummonList m_waterElements; + uint32 uiBubbleCheckerTimer; + uint32 uiWaterBoltVolleyTimer; - void Reset() - { - bIsExploded = false; - bIsFrenzy = false; - bAchievement = true; - uiBubbleCheckerTimer = 1000; - uiWaterBoltVolleyTimer = urand(10000, 15000); + InstanceScript* pInstance; - me->SetVisibility(VISIBILITY_ON); - DespawnWaterElements(); + SummonList m_waterElements; - if (pInstance) + void Reset() { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); - } - } + bIsExploded = false; + bIsFrenzy = false; + bAchievement = true; + uiBubbleCheckerTimer = 1000; + uiWaterBoltVolleyTimer = urand(10000, 15000); - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); + me->SetVisibility(VISIBILITY_ON); + DespawnWaterElements(); - DoCast(me, SPELL_PROTECTIVE_BUBBLE); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } - if (pInstance) + void EnterCombat(Unit* /*pWho*/) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ICHORON_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } + DoScriptText(SAY_AGGRO, me); - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + DoCast(me, SPELL_PROTECTIVE_BUBBLE); - if (me->Attack(pWho, true)) - { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ICHORON_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - } - - void DoAction(const int32 param) - { - if (!me->isAlive()) - return; - switch(param) + void AttackStart(Unit* pWho) { - case ACTION_WATER_ELEMENT_HIT: - me->SetHealth(me->GetHealth() + me->GetMaxHealth() * 0.01); - - if (bIsExploded) - DoExplodeCompleted(); - - bAchievement = false; - break; - case ACTION_WATER_ELEMENT_KILLED: - uint32 damage = (me->GetMaxHealth()*3)/100; - me->SetHealth(me->GetHealth() - damage); - me->LowerPlayerDamageReq(damage); - break; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } } - } - void DespawnWaterElements() - { - m_waterElements.DespawnAll(); - } + void DoAction(const int32 param) + { + if (!me->isAlive()) + return; - // call when explode shall stop. - // either when "hit" by a bubble, or when there is no bubble left. - void DoExplodeCompleted() - { - bIsExploded = false; + switch(param) + { + case ACTION_WATER_ELEMENT_HIT: + me->SetHealth(me->GetHealth() + me->GetMaxHealth() * 0.01); - if (!HealthBelowPct(25)) - { - DoScriptText(SAY_BUBBLE, me); - DoCast(me, SPELL_PROTECTIVE_BUBBLE, true); + if (bIsExploded) + DoExplodeCompleted(); + + bAchievement = false; + break; + case ACTION_WATER_ELEMENT_KILLED: + uint32 damage = (me->GetMaxHealth()*3)/100; + me->SetHealth(me->GetHealth() - damage); + me->LowerPlayerDamageReq(damage); + break; + } } - me->SetVisibility(VISIBILITY_ON); - me->GetMotionMaster()->MoveChase(me->getVictim()); - } + void DespawnWaterElements() + { + m_waterElements.DespawnAll(); + } - void MoveInLineOfSight(Unit* /*pWho*/) {} + // call when explode shall stop. + // either when "hit" by a bubble, or when there is no bubble left. + void DoExplodeCompleted() + { + bIsExploded = false; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (!HealthBelowPct(25)) + { + DoScriptText(SAY_BUBBLE, me); + DoCast(me, SPELL_PROTECTIVE_BUBBLE, true); + } - if (!bIsFrenzy && HealthBelowPct(25) && !bIsExploded) - { - DoScriptText(SAY_ENRAGE, me); - DoCast(me, SPELL_FRENZY, true); - bIsFrenzy = true; + me->SetVisibility(VISIBILITY_ON); + me->GetMotionMaster()->MoveChase(me->getVictim()); } - if (!bIsFrenzy) + void MoveInLineOfSight(Unit* /*pWho*/) {} + + void UpdateAI(const uint32 uiDiff) { - if (uiBubbleCheckerTimer <= uiDiff) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bIsFrenzy && HealthBelowPct(25) && !bIsExploded) + { + DoScriptText(SAY_ENRAGE, me); + DoCast(me, SPELL_FRENZY, true); + bIsFrenzy = true; + } + + if (!bIsFrenzy) { - if (!bIsExploded) + if (uiBubbleCheckerTimer <= uiDiff) { - if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0)) + if (!bIsExploded) { - DoScriptText(SAY_SHATTER, me); - DoCast(me, SPELL_WATER_BLAST); - DoCast(me, SPELL_DRAINED); - bIsExploded = true; - me->AttackStop(); - me->SetVisibility(VISIBILITY_OFF); - for (uint8 i = 0; i < 10; i++) + if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0)) { - int tmp = urand(0, MAX_SPAWN_LOC-1); - me->SummonCreature(NPC_ICHOR_GLOBULE, SpawnLoc[tmp], TEMPSUMMON_CORPSE_DESPAWN); + DoScriptText(SAY_SHATTER, me); + DoCast(me, SPELL_WATER_BLAST); + DoCast(me, SPELL_DRAINED); + bIsExploded = true; + me->AttackStop(); + me->SetVisibility(VISIBILITY_OFF); + for (uint8 i = 0; i < 10; i++) + { + int tmp = urand(0, MAX_SPAWN_LOC-1); + me->SummonCreature(NPC_ICHOR_GLOBULE, SpawnLoc[tmp], TEMPSUMMON_CORPSE_DESPAWN); + } } } - } - else - { - bool bIsWaterElementsAlive = false; - if (!m_waterElements.empty()) + else { - for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - if (pTemp->isAlive()) - { - bIsWaterElementsAlive = true; - break; - } + bool bIsWaterElementsAlive = false; + if (!m_waterElements.empty()) + { + for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (pTemp->isAlive()) + { + bIsWaterElementsAlive = true; + break; + } + } + + if (!bIsWaterElementsAlive) + DoExplodeCompleted(); } + uiBubbleCheckerTimer = 1000; + } + else uiBubbleCheckerTimer -= uiDiff; + } - if (!bIsWaterElementsAlive) - DoExplodeCompleted(); + if (!bIsExploded) + { + if (uiWaterBoltVolleyTimer <= uiDiff) + { + DoCast(me, SPELL_WATER_BOLT_VOLLEY); + uiWaterBoltVolleyTimer = urand(10000, 15000); } - uiBubbleCheckerTimer = 1000; + else uiWaterBoltVolleyTimer -= uiDiff; + + DoMeleeAttackIfReady(); } - else uiBubbleCheckerTimer -= uiDiff; } - if (!bIsExploded) + void JustDied(Unit* /*killer*/) { - if (uiWaterBoltVolleyTimer <= uiDiff) + DoScriptText(SAY_DEATH, me); + + if (bIsExploded) { - DoCast(me, SPELL_WATER_BOLT_VOLLEY); - uiWaterBoltVolleyTimer = urand(10000, 15000); + bIsExploded = false; + me->SetVisibility(VISIBILITY_ON); } - else uiWaterBoltVolleyTimer -= uiDiff; - DoMeleeAttackIfReady(); - } - } + DespawnWaterElements(); - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + { + if (IsHeroic() && bAchievement) + pInstance->DoCompleteAchievement(ACHIEVEMENT_DEHYDRATION); - if (bIsExploded) - { - bIsExploded = false; - me->SetVisibility(VISIBILITY_ON); + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } } - DespawnWaterElements(); - - if (pInstance) + void JustSummoned(Creature* pSummoned) { - if (IsHeroic() && bAchievement) - pInstance->DoCompleteAchievement(ACHIEVEMENT_DEHYDRATION); - - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + if (pSummoned) { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); + pSummoned->SetSpeed(MOVE_RUN, 0.3f); + pSummoned->GetMotionMaster()->MoveFollow(me, 0, 0); + m_waterElements.push_back(pSummoned->GetGUID()); + pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); } } - } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned) + + void SummonedCreatureDespawn(Creature *pSummoned) { - pSummoned->SetSpeed(MOVE_RUN, 0.3f); - pSummoned->GetMotionMaster()->MoveFollow(me, 0, 0); - m_waterElements.push_back(pSummoned->GetGUID()); - pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); + if (pSummoned) + { + m_waterElements.remove(pSummoned->GetGUID()); + pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); + } } - } - - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned) + void KilledUnit(Unit * victim) { - m_waterElements.remove(pSummoned->GetGUID()); - pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - } + }; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_ichoron(Creature* pCreature) +
class mob_ichor_globule : public CreatureScript { - return new boss_ichoronAI (pCreature); -} +public: + mob_ichor_globule() : CreatureScript("mob_ichor_globule") { } -struct mob_ichor_globuleAI : public ScriptedAI -{ - mob_ichor_globuleAI(Creature* pCreature) : ScriptedAI(pCreature) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_ichor_globuleAI (pCreature); } - ScriptedInstance* pInstance; + struct mob_ichor_globuleAI : public ScriptedAI + { + mob_ichor_globuleAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - uint32 uiRangeCheck_Timer; + InstanceScript* pInstance; - void Reset() - { - uiRangeCheck_Timer = 1000; - } + uint32 uiRangeCheck_Timer; - void AttackStart(Unit* /*pWho*/) - { - return; - } + void Reset() + { + uiRangeCheck_Timer = 1000; + } - void UpdateAI(const uint32 uiDiff) - { - if (uiRangeCheck_Timer < uiDiff) + void AttackStart(Unit* /*pWho*/) { - if (pInstance) + return; + } + + void UpdateAI(const uint32 uiDiff) + { + if (uiRangeCheck_Timer < uiDiff) { - if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) + if (pInstance) { - if (me->IsWithinDist(pIchoron, 2.0f , false)) + if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) { - if (pIchoron->AI()) - pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_HIT); - me->ForcedDespawn(); + if (me->IsWithinDist(pIchoron, 2.0f , false)) + { + if (pIchoron->AI()) + pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_HIT); + me->ForcedDespawn(); + } } } + uiRangeCheck_Timer = 1000; } - uiRangeCheck_Timer = 1000; + else uiRangeCheck_Timer -= uiDiff; } - else uiRangeCheck_Timer -= uiDiff; - } - void JustDied(Unit* /*pKiller*/) - { - DoCast(me, SPELL_SPLASH); - if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) - if (pIchoron->AI()) - pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); - } + void JustDied(Unit* /*pKiller*/) + { + DoCast(me, SPELL_SPLASH); + if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) + if (pIchoron->AI()) + pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); + } + }; + }; -CreatureAI* GetAI_mob_ichor_globule(Creature* pCreature) -{ - return new mob_ichor_globuleAI (pCreature); -} void AddSC_boss_ichoron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ichoron"; - newscript->GetAI = &GetAI_boss_ichoron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ichor_globule"; - newscript->GetAI = &GetAI_mob_ichor_globule; - newscript->RegisterSelf(); + new boss_ichoron(); + new mob_ichor_globule(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index 7a86fedf849..2a41ac671a1 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -28,134 +28,136 @@ enum Spells SPELL_LAVA_BURN = 54249, H_SPELL_LAVA_BURN = 59594 }; - -struct boss_lavanthorAI : public ScriptedAI +
class boss_lavanthor : public CreatureScript { - boss_lavanthorAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_lavanthor() : CreatureScript("boss_lavanthor") { } - uint32 uiFireboltTimer; - uint32 uiFlameBreathTimer; - uint32 uiLavaBurnTimer; - uint32 uiCauterizingFlamesTimer; - - ScriptedInstance* pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiFireboltTimer = 1000; - uiFlameBreathTimer = 5000; - uiLavaBurnTimer = 10000; - uiCauterizingFlamesTimer = 3000; - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); - } + return new boss_lavanthorAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_lavanthorAI : public ScriptedAI { - if (pInstance) + boss_lavanthorAI(Creature *c) : ScriptedAI(c) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_LAVANTHOR_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + pInstance = c->GetInstanceScript(); } - } - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 uiFireboltTimer; + uint32 uiFlameBreathTimer; + uint32 uiLavaBurnTimer; + uint32 uiCauterizingFlamesTimer; + + InstanceScript* pInstance; - if (me->Attack(pWho, true)) + void Reset() { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + uiFireboltTimer = 1000; + uiFlameBreathTimer = 5000; + uiLavaBurnTimer = 10000; + uiCauterizingFlamesTimer = 3000; + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } } - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - if (uiFireboltTimer <= diff) + void EnterCombat(Unit* /*who*/) { - DoCast(me->getVictim(), SPELL_FIREBOLT); - uiFireboltTimer = urand(5000,13000); - } else uiFireboltTimer -= diff; + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_LAVANTHOR_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } - if (uiFlameBreathTimer <= diff) + void AttackStart(Unit* pWho) { - DoCast(me->getVictim(), SPELL_FLAME_BREATH); - uiFlameBreathTimer = urand(10000,15000); - } else uiFlameBreathTimer -= diff; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (uiLavaBurnTimer <= diff) - { - DoCast(me->getVictim(), SPELL_LAVA_BURN); - uiLavaBurnTimer = urand(15000,23000); + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } } - if (IsHeroic()) + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (uiCauterizingFlamesTimer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiFireboltTimer <= diff) { - DoCast(me->getVictim(), SPELL_CAUTERIZING_FLAMES); - uiCauterizingFlamesTimer = urand(10000,16000); - } else uiCauterizingFlamesTimer -= diff; - } + DoCast(me->getVictim(), SPELL_FIREBOLT); + uiFireboltTimer = urand(5000,13000); + } else uiFireboltTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiFlameBreathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAME_BREATH); + uiFlameBreathTimer = urand(10000,15000); + } else uiFlameBreathTimer -= diff; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + if (uiLavaBurnTimer <= diff) { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); + DoCast(me->getVictim(), SPELL_LAVA_BURN); + uiLavaBurnTimer = urand(15000,23000); } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + + if (IsHeroic()) { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); + if (uiCauterizingFlamesTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CAUTERIZING_FLAMES); + uiCauterizingFlamesTimer = urand(10000,16000); + } else uiCauterizingFlamesTimer -= diff; } + + DoMeleeAttackIfReady(); } - } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } + } + }; + }; -CreatureAI* GetAI_boss_lavanthor(Creature* pCreature) -{ - return new boss_lavanthorAI (pCreature); -} void AddSC_boss_lavanthor() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_lavanthor"; - newscript->GetAI = &GetAI_boss_lavanthor; - newscript->RegisterSelf(); + new boss_lavanthor(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 0abcbbf720c..ace7a7b2304 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -24,116 +24,118 @@ enum Spells SPELL_CORROSIVE_SALIVA = 54527, SPELL_OPTIC_LINK = 54396 }; - -struct boss_moraggAI : public ScriptedAI +
class boss_moragg : public CreatureScript { - boss_moraggAI(Creature *c) : ScriptedAI(c) +public: + boss_moragg() : CreatureScript("boss_moragg") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_moraggAI (pCreature); } - uint32 uiOpticLinkTimer; - uint32 uiCorrosiveSalivaTimer; + struct boss_moraggAI : public ScriptedAI + { + boss_moraggAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance* pInstance; + uint32 uiOpticLinkTimer; + uint32 uiCorrosiveSalivaTimer; - void Reset() - { - uiOpticLinkTimer = 10000; - uiCorrosiveSalivaTimer = 5000; + InstanceScript* pInstance; - if (pInstance) + void Reset() { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + uiOpticLinkTimer = 10000; + uiCorrosiveSalivaTimer = 5000; + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } } - } - void EnterCombat(Unit* /*who*/) - { - if (pInstance) + void EnterCombat(Unit* /*who*/) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MORAGG_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MORAGG_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - } - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) + void AttackStart(Unit* pWho) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); - } - } + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - void MoveInLineOfSight(Unit* /*who*/) {} + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void MoveInLineOfSight(Unit* /*who*/) {} - if (uiOpticLinkTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_OPTIC_LINK); - uiOpticLinkTimer = 15000; - } else uiOpticLinkTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiCorrosiveSalivaTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CORROSIVE_SALIVA); - uiCorrosiveSalivaTimer = 10000; - } else uiCorrosiveSalivaTimer -= diff; + if (uiOpticLinkTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_OPTIC_LINK); + uiOpticLinkTimer = 15000; + } else uiOpticLinkTimer -= diff; - DoMeleeAttackIfReady(); - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + if (uiCorrosiveSalivaTimer <= diff) { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + DoCast(me->getVictim(), SPELL_CORROSIVE_SALIVA); + uiCorrosiveSalivaTimer = 10000; + } else uiCorrosiveSalivaTimer -= diff; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) + { + if (pInstance) { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT,13); + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT,13); + } } } - } + }; + }; -CreatureAI* GetAI_boss_moragg(Creature* pCreature) -{ - return new boss_moraggAI (pCreature); -} void AddSC_boss_moragg() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_moragg"; - newscript->GetAI = &GetAI_boss_moragg; - newscript->RegisterSelf(); + new boss_moragg(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index 8fb3f200852..14ccba54392 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -56,246 +56,251 @@ enum Yells SAY_REPEAT_SUMMON_2 = -1608035, SAY_SUMMON_ENERGY = -1608036 }; - -struct boss_xevozzAI : public ScriptedAI +
class boss_xevozz : public CreatureScript { - boss_xevozzAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_xevozz() : CreatureScript("boss_xevozz") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_xevozzAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiSummonEtherealSphere_Timer; - uint32 uiArcaneBarrageVolley_Timer; - uint32 uiArcaneBuffet_Timer; - - void Reset() + struct boss_xevozzAI : public ScriptedAI { - if (pInstance) + boss_xevozzAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = pCreature->GetInstanceScript(); } - uiSummonEtherealSphere_Timer = urand(10000, 12000); - uiArcaneBarrageVolley_Timer = urand(20000, 22000); - uiArcaneBuffet_Timer = uiSummonEtherealSphere_Timer + urand(5000, 6000); - DespawnSphere(); - } - - void DespawnSphere() - { - std::list<Creature*> assistList; - GetCreatureListWithEntryInGrid(assistList,me, NPC_ETHEREAL_SPHERE ,150.0f); + InstanceScript* pInstance; - if (assistList.empty()) - return; + uint32 uiSummonEtherealSphere_Timer; + uint32 uiArcaneBarrageVolley_Timer; + uint32 uiArcaneBuffet_Timer; - for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + void Reset() { - if (Creature* pSphere = *iter) - pSphere->Kill(pSphere, false); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + + uiSummonEtherealSphere_Timer = urand(10000, 12000); + uiArcaneBarrageVolley_Timer = urand(20000, 22000); + uiArcaneBuffet_Timer = uiSummonEtherealSphere_Timer + urand(5000, 6000); + DespawnSphere(); } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->SetSpeed(MOVE_RUN, 0.5f); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + void DespawnSphere() { - pSummoned->AddThreat(pTarget, 0.00f); - pSummoned->AI()->AttackStart(pTarget); - } - } + std::list<Creature*> assistList; + GetCreatureListWithEntryInGrid(assistList,me, NPC_ETHEREAL_SPHERE ,150.0f); - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + if (assistList.empty()) + return; - if (me->Attack(pWho, true)) - { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + { + if (Creature* pSphere = *iter) + pSphere->Kill(pSphere, false); + } } - } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) + void JustSummoned(Creature* pSummoned) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_XEVOZZ_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + pSummoned->SetSpeed(MOVE_RUN, 0.5f); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + pSummoned->AddThreat(pTarget, 0.00f); + pSummoned->AI()->AttackStart(pTarget); + } } - } - - void MoveInLineOfSight(Unit* /*pWho*/) {} - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - if (uiArcaneBarrageVolley_Timer < uiDiff) + void AttackStart(Unit* pWho) { - DoCast(me, SPELL_ARCANE_BARRAGE_VOLLEY); - uiArcaneBarrageVolley_Timer = urand(20000, 22000); - } - else uiArcaneBarrageVolley_Timer -= uiDiff; + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (uiArcaneBuffet_Timer) - if (uiArcaneBuffet_Timer < uiDiff) + if (me->Attack(pWho, true)) { - DoCast(me->getVictim(), SPELL_ARCANE_BUFFET); - uiArcaneBuffet_Timer = 0; + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); } - else uiArcaneBuffet_Timer -= uiDiff; + } - if (uiSummonEtherealSphere_Timer < uiDiff) + void EnterCombat(Unit* /*pWho*/) { - DoScriptText(SAY_SPAWN, me); - DoCast(me, SPELL_SUMMON_ETHEREAL_SPHERE_1); - if (IsHeroic()) // extra one for heroic - me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000); - - uiSummonEtherealSphere_Timer = urand(45000, 47000); - uiArcaneBuffet_Timer = urand(5000, 6000); + DoScriptText(SAY_AGGRO, me); + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_XEVOZZ_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } } - else uiSummonEtherealSphere_Timer -= uiDiff; - DoMeleeAttackIfReady(); - } + void MoveInLineOfSight(Unit* /*pWho*/) {} - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiArcaneBarrageVolley_Timer < uiDiff) + { + DoCast(me, SPELL_ARCANE_BARRAGE_VOLLEY); + uiArcaneBarrageVolley_Timer = urand(20000, 22000); + } + else uiArcaneBarrageVolley_Timer -= uiDiff; - DespawnSphere(); + if (uiArcaneBuffet_Timer) + if (uiArcaneBuffet_Timer < uiDiff) + { + DoCast(me->getVictim(), SPELL_ARCANE_BUFFET); + uiArcaneBuffet_Timer = 0; + } + else uiArcaneBuffet_Timer -= uiDiff; - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + if (uiSummonEtherealSphere_Timer < uiDiff) { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); + DoScriptText(SAY_SPAWN, me); + DoCast(me, SPELL_SUMMON_ETHEREAL_SPHERE_1); + if (IsHeroic()) // extra one for heroic + me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000); + + uiSummonEtherealSphere_Timer = urand(45000, 47000); + uiArcaneBuffet_Timer = urand(5000, 6000); } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + else uiSummonEtherealSphere_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + + DespawnSphere(); + + if (pInstance) { - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); - pInstance->SetData(DATA_WAVE_COUNT, 13); + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } } } - } - void KilledUnit(Unit* pVictim) - { - if (pVictim == me) - return; + void KilledUnit(Unit* pVictim) + { + if (pVictim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_xevozz(Creature* pCreature) +
class mob_ethereal_sphere : public CreatureScript { - return new boss_xevozzAI (pCreature); -} +public: + mob_ethereal_sphere() : CreatureScript("mob_ethereal_sphere") { } -struct mob_ethereal_sphereAI : public ScriptedAI -{ - mob_ethereal_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_ethereal_sphereAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiSummonPlayers_Timer; - uint32 uiRangeCheck_Timer; - - void Reset() + struct mob_ethereal_sphereAI : public ScriptedAI { - uiSummonPlayers_Timer = urand(33000, 35000); - uiRangeCheck_Timer = 1000; - } + mob_ethereal_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (!me->HasAura(SPELL_POWER_BALL_VISUAL)) - DoCast(me, SPELL_POWER_BALL_VISUAL); + uint32 uiSummonPlayers_Timer; + uint32 uiRangeCheck_Timer; - if (uiRangeCheck_Timer < uiDiff) + void Reset() { - if (pInstance) - { - if (Creature* pXevozz = Unit::GetCreature(*me, pInstance->GetData64(DATA_XEVOZZ))) - { - float fDistance = me->GetDistance2d(pXevozz); - if (fDistance <= 3) - DoCast(pXevozz, SPELL_ARCANE_POWER); - else - DoCast(me, 35845); //Is it blizzlike? - } - } + uiSummonPlayers_Timer = urand(33000, 35000); uiRangeCheck_Timer = 1000; } - else uiRangeCheck_Timer -= uiDiff; - if (uiSummonPlayers_Timer < uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me, SPELL_SUMMON_PLAYERS); // not working right + //Return since we have no target + if (!UpdateVictim()) + return; - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (!me->HasAura(SPELL_POWER_BALL_VISUAL)) + DoCast(me, SPELL_POWER_BALL_VISUAL); - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource()->isAlive()) - DoTeleportPlayer(i->getSource(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), i->getSource()->GetOrientation()); + if (uiRangeCheck_Timer < uiDiff) + { + if (pInstance) + { + if (Creature* pXevozz = Unit::GetCreature(*me, pInstance->GetData64(DATA_XEVOZZ))) + { + float fDistance = me->GetDistance2d(pXevozz); + if (fDistance <= 3) + DoCast(pXevozz, SPELL_ARCANE_POWER); + else + DoCast(me, 35845); //Is it blizzlike? + } + } + uiRangeCheck_Timer = 1000; } + else uiRangeCheck_Timer -= uiDiff; - uiSummonPlayers_Timer = urand(33000, 35000); + if (uiSummonPlayers_Timer < uiDiff) + { + DoCast(me, SPELL_SUMMON_PLAYERS); // not working right + + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource()->isAlive()) + DoTeleportPlayer(i->getSource(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), i->getSource()->GetOrientation()); + } + + uiSummonPlayers_Timer = urand(33000, 35000); + } + else uiSummonPlayers_Timer -= uiDiff; } - else uiSummonPlayers_Timer -= uiDiff; - } + }; + }; -CreatureAI* GetAI_mob_ethereal_sphere(Creature* pCreature) -{ - return new mob_ethereal_sphereAI (pCreature); -} void AddSC_boss_xevozz() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_xevozz"; - newscript->GetAI = &GetAI_boss_xevozz; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ethereal_sphere"; - newscript->GetAI = &GetAI_mob_ethereal_sphere; - newscript->RegisterSelf(); + new boss_xevozz(); + new mob_ethereal_sphere(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index ebe703aae38..2ad81179266 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -46,143 +46,145 @@ enum Yells SAY_SHIELD = -1608043, SAY_WHISPER = -1608044 }; - -struct boss_zuramatAI : public ScriptedAI +
class boss_zuramat : public CreatureScript { - boss_zuramatAI(Creature *c) : ScriptedAI(c) +public: + boss_zuramat() : CreatureScript("boss_zuramat") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_zuramatAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 SpellVoidShiftTimer; - uint32 SpellSummonVoidTimer; - uint32 SpellShroudOfDarknessTimer; - - void Reset() + struct boss_zuramatAI : public ScriptedAI { - if (pInstance) + boss_zuramatAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - SpellShroudOfDarknessTimer = 22000; - SpellVoidShiftTimer = 15000; - SpellSummonVoidTimer = 12000; - } + InstanceScript* pInstance; - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 SpellVoidShiftTimer; + uint32 SpellSummonVoidTimer; + uint32 SpellShroudOfDarknessTimer; - if (me->Attack(pWho, true)) + void Reset() { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + + SpellShroudOfDarknessTimer = 22000; + SpellVoidShiftTimer = 15000; + SpellSummonVoidTimer = 12000; } - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) + void AttackStart(Unit* pWho) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ZURAMAT_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } } - } - void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ZURAMAT_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void MoveInLineOfSight(Unit* /*who*/) {} - if (SpellSummonVoidTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SUMMON_VOID_SENTRY, false); - SpellSummonVoidTimer = 20000; - } else SpellSummonVoidTimer -=diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (SpellVoidShiftTimer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_VOID_SHIFT); - SpellVoidShiftTimer = 20000; - } else SpellVoidShiftTimer -=diff; + if (SpellSummonVoidTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SUMMON_VOID_SENTRY, false); + SpellSummonVoidTimer = 20000; + } else SpellSummonVoidTimer -=diff; - if (SpellShroudOfDarknessTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHROUD_OF_DARKNESS); - SpellShroudOfDarknessTimer = 20000; - } else SpellShroudOfDarknessTimer -=diff; + if (SpellVoidShiftTimer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_VOID_SHIFT); + SpellVoidShiftTimer = 20000; + } else SpellVoidShiftTimer -=diff; - DoMeleeAttackIfReady(); - } + if (SpellShroudOfDarknessTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHROUD_OF_DARKNESS); + SpellShroudOfDarknessTimer = 20000; + } else SpellShroudOfDarknessTimer -=diff; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + DoMeleeAttackIfReady(); + } - if (pInstance) + void JustDied(Unit* /*killer*/) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + void JustSummoned(Creature* summon) + { + summon->AI()->AttackStart(me->getVictim()); + summon->AI()->DoCastAOE(SPELL_ZURAMAT_ADD_2); + summon->SetPhaseMask(17,true); + } + }; - void JustSummoned(Creature* summon) - { - summon->AI()->AttackStart(me->getVictim()); - summon->AI()->DoCastAOE(SPELL_ZURAMAT_ADD_2); - summon->SetPhaseMask(17,true); - } }; -CreatureAI* GetAI_boss_zuramat(Creature* pCreature) -{ - return new boss_zuramatAI (pCreature); -} void AddSC_boss_zuramat() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_zuramat"; - newscript->GetAI = &GetAI_boss_zuramat; - newscript->RegisterSelf(); + new boss_zuramat(); } diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 80051ace614..c0e7cfdbb88 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -102,709 +102,712 @@ enum Achievements { ACHIEV_DEFENSELESS = 1816 }; - -struct instance_violet_hold : public ScriptedInstance +
class instance_violet_hold : public InstanceMapScript { - instance_violet_hold(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 uiMoragg; - uint64 uiErekem; - uint64 uiErekemGuard[2]; - uint64 uiIchoron; - uint64 uiLavanthor; - uint64 uiXevozz; - uint64 uiZuramat; - uint64 uiCyanigosa; - uint64 uiSinclari; - - uint64 uiMoraggCell; - uint64 uiErekemCell; - uint64 uiErekemLeftGuardCell; - uint64 uiErekemRightGuardCell; - uint64 uiIchoronCell; - uint64 uiLavanthorCell; - uint64 uiXevozzCell; - uint64 uiZuramatCell; - uint64 uiMainDoor; - uint64 uiTeleportationPortal; - uint64 uiSaboteurPortal; - - uint64 uiActivationCrystal[3]; - - uint32 uiActivationTimer; - uint32 uiCyanigosaEventTimer; - uint32 uiDoorSpellTimer; - - std::set<uint64> trashMobs; // to kill with crystal - - uint8 uiWaveCount; - uint8 uiLocation; - uint8 uiFirstBoss; - uint8 uiSecondBoss; - uint8 uiRemoveNpc; - - uint8 uiDoorIntegrity; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - uint8 uiCountErekemGuards; - uint8 uiCountActivationCrystals; - uint8 uiCyanigosaEventPhase; - uint8 uiMainEventPhase; // SPECIAL: pre event animations, IN_PROGRESS: event itself - - bool bActive; - bool bWiped; - bool bIsDoorSpellCasted; - bool bCrystalActivated; - - std::list<uint8> NpcAtDoorCastingList; - - std::string str_data; - - void Initialize() +public: + instance_violet_hold() : InstanceMapScript("instance_violet_hold") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_violet_hold_InstanceMapScript(pMap); + } + + struct instance_violet_hold_InstanceMapScript : public InstanceScript { - uiMoragg = 0; - uiErekem = 0; - uiIchoron = 0; - uiLavanthor = 0; - uiXevozz = 0; - uiZuramat = 0; - uiCyanigosa = 0; - uiSinclari = 0; - - uiMoraggCell = 0; - uiErekemCell = 0; - uiErekemGuard[0] = 0; - uiErekemGuard[1] = 0; - uiIchoronCell = 0; - uiLavanthorCell = 0; - uiXevozzCell = 0; - uiZuramatCell = 0; - uiMainDoor = 0; - uiTeleportationPortal = 0; - uiSaboteurPortal = 0; - - trashMobs.clear(); + instance_violet_hold_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 uiMoragg; + uint64 uiErekem; + uint64 uiErekemGuard[2]; + uint64 uiIchoron; + uint64 uiLavanthor; + uint64 uiXevozz; + uint64 uiZuramat; + uint64 uiCyanigosa; + uint64 uiSinclari; + + uint64 uiMoraggCell; + uint64 uiErekemCell; + uint64 uiErekemLeftGuardCell; + uint64 uiErekemRightGuardCell; + uint64 uiIchoronCell; + uint64 uiLavanthorCell; + uint64 uiXevozzCell; + uint64 uiZuramatCell; + uint64 uiMainDoor; + uint64 uiTeleportationPortal; + uint64 uiSaboteurPortal; + + uint64 uiActivationCrystal[3]; + + uint32 uiActivationTimer; + uint32 uiCyanigosaEventTimer; + uint32 uiDoorSpellTimer; + + std::set<uint64> trashMobs; // to kill with crystal + + uint8 uiWaveCount; + uint8 uiLocation; + uint8 uiFirstBoss; + uint8 uiSecondBoss; + uint8 uiRemoveNpc; + + uint8 uiDoorIntegrity; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 uiCountErekemGuards; + uint8 uiCountActivationCrystals; + uint8 uiCyanigosaEventPhase; + uint8 uiMainEventPhase; // SPECIAL: pre event animations, IN_PROGRESS: event itself + + bool bActive; + bool bWiped; + bool bIsDoorSpellCasted; + bool bCrystalActivated; + + std::list<uint8> NpcAtDoorCastingList; + + std::string str_data; + + void Initialize() + { + uiMoragg = 0; + uiErekem = 0; + uiIchoron = 0; + uiLavanthor = 0; + uiXevozz = 0; + uiZuramat = 0; + uiCyanigosa = 0; + uiSinclari = 0; + + uiMoraggCell = 0; + uiErekemCell = 0; + uiErekemGuard[0] = 0; + uiErekemGuard[1] = 0; + uiIchoronCell = 0; + uiLavanthorCell = 0; + uiXevozzCell = 0; + uiZuramatCell = 0; + uiMainDoor = 0; + uiTeleportationPortal = 0; + uiSaboteurPortal = 0; + + trashMobs.clear(); - uiRemoveNpc = 0; + uiRemoveNpc = 0; - uiDoorIntegrity = 100; + uiDoorIntegrity = 100; - uiWaveCount = 0; - uiLocation = urand(0,5); - uiFirstBoss = 0; - uiSecondBoss = 0; - uiCountErekemGuards = 0; - uiCountActivationCrystals = 0; - uiCyanigosaEventPhase = 1; + uiWaveCount = 0; + uiLocation = urand(0,5); + uiFirstBoss = 0; + uiSecondBoss = 0; + uiCountErekemGuards = 0; + uiCountActivationCrystals = 0; + uiCyanigosaEventPhase = 1; - uiActivationTimer = 5000; - uiDoorSpellTimer = 2000; - uiCyanigosaEventTimer = 3*IN_MILLISECONDS; + uiActivationTimer = 5000; + uiDoorSpellTimer = 2000; + uiCyanigosaEventTimer = 3*IN_MILLISECONDS; - bActive = false; - bIsDoorSpellCasted = false; - bCrystalActivated = false; + bActive = false; + bIsDoorSpellCasted = false; + bCrystalActivated = false; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - return false; - } + return false; + } - void OnCreatureCreate(Creature* pCreature, bool add) - { - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool add) { - case CREATURE_XEVOZZ: - uiXevozz = pCreature->GetGUID(); - break; - case CREATURE_LAVANTHOR: - uiLavanthor = pCreature->GetGUID(); - break; - case CREATURE_ICHORON: - uiIchoron = pCreature->GetGUID(); - break; - case CREATURE_ZURAMAT: - uiZuramat = pCreature->GetGUID(); - break; - case CREATURE_EREKEM: - uiErekem = pCreature->GetGUID(); - break; - case CREATURE_EREKEM_GUARD: - if (uiCountErekemGuards < 2) - { - uiErekemGuard[uiCountErekemGuards++] = pCreature->GetGUID(); + switch(pCreature->GetEntry()) + { + case CREATURE_XEVOZZ: + uiXevozz = pCreature->GetGUID(); + break; + case CREATURE_LAVANTHOR: + uiLavanthor = pCreature->GetGUID(); + break; + case CREATURE_ICHORON: + uiIchoron = pCreature->GetGUID(); + break; + case CREATURE_ZURAMAT: + uiZuramat = pCreature->GetGUID(); + break; + case CREATURE_EREKEM: + uiErekem = pCreature->GetGUID(); + break; + case CREATURE_EREKEM_GUARD: + if (uiCountErekemGuards < 2) + { + uiErekemGuard[uiCountErekemGuards++] = pCreature->GetGUID(); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + } + break; + case CREATURE_MORAGG: + uiMoragg = pCreature->GetGUID(); + break; + case CREATURE_CYANIGOSA: + uiCyanigosa = pCreature->GetGUID(); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - } - break; - case CREATURE_MORAGG: - uiMoragg = pCreature->GetGUID(); - break; - case CREATURE_CYANIGOSA: - uiCyanigosa = pCreature->GetGUID(); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - break; - case CREATURE_SINCLARI: - uiSinclari = pCreature->GetGUID(); - break; - } + break; + case CREATURE_SINCLARI: + uiSinclari = pCreature->GetGUID(); + break; + } - if (add && (pCreature->GetGUID() == uiFirstBoss || pCreature->GetGUID() == uiSecondBoss)) - { - pCreature->AllLootRemovedFromCorpse(); - pCreature->RemoveLootMode(1); + if (add && (pCreature->GetGUID() == uiFirstBoss || pCreature->GetGUID() == uiSecondBoss)) + { + pCreature->AllLootRemovedFromCorpse(); + pCreature->RemoveLootMode(1); + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case GO_EREKEM_GUARD_1_DOOR: - uiErekemLeftGuardCell = pGo->GetGUID(); - break; - case GO_EREKEM_GUARD_2_DOOR: - uiErekemRightGuardCell = pGo->GetGUID(); - break; - case GO_EREKEM_DOOR: - uiErekemCell = pGo->GetGUID(); - break; - case GO_ZURAMAT_DOOR: - uiZuramatCell = pGo->GetGUID(); - break; - case GO_LAVANTHOR_DOOR: - uiLavanthorCell = pGo->GetGUID(); - break; - case GO_MORAGG_DOOR: - uiMoraggCell = pGo->GetGUID(); - break; - case GO_ICHORON_DOOR: - uiIchoronCell = pGo->GetGUID(); - break; - case GO_XEVOZZ_DOOR: - uiXevozzCell = pGo->GetGUID(); - break; - case GO_MAIN_DOOR: - uiMainDoor = pGo->GetGUID(); - break; - case GO_ACTIVATION_CRYSTAL: - if (uiCountActivationCrystals < 3) - uiActivationCrystal[uiCountActivationCrystals++] = pGo->GetGUID(); - break; + switch(pGo->GetEntry()) + { + case GO_EREKEM_GUARD_1_DOOR: + uiErekemLeftGuardCell = pGo->GetGUID(); + break; + case GO_EREKEM_GUARD_2_DOOR: + uiErekemRightGuardCell = pGo->GetGUID(); + break; + case GO_EREKEM_DOOR: + uiErekemCell = pGo->GetGUID(); + break; + case GO_ZURAMAT_DOOR: + uiZuramatCell = pGo->GetGUID(); + break; + case GO_LAVANTHOR_DOOR: + uiLavanthorCell = pGo->GetGUID(); + break; + case GO_MORAGG_DOOR: + uiMoraggCell = pGo->GetGUID(); + break; + case GO_ICHORON_DOOR: + uiIchoronCell = pGo->GetGUID(); + break; + case GO_XEVOZZ_DOOR: + uiXevozzCell = pGo->GetGUID(); + break; + case GO_MAIN_DOOR: + uiMainDoor = pGo->GetGUID(); + break; + case GO_ACTIVATION_CRYSTAL: + if (uiCountActivationCrystals < 3) + uiActivationCrystal[uiCountActivationCrystals++] = pGo->GetGUID(); + break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case DATA_1ST_BOSS_EVENT: - m_auiEncounter[0] = data; - if (data == DONE) - SaveToDB(); - break; - case DATA_2ND_BOSS_EVENT: - m_auiEncounter[1] = data; - if (data == DONE) - SaveToDB(); - break; - case DATA_CYANIGOSA_EVENT: - m_auiEncounter[2] = data; - if (data == DONE) - { - SaveToDB(); - uiMainEventPhase = DONE; - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - pMainDoor->SetGoState(GO_STATE_ACTIVE); - if (!bCrystalActivated && uiDoorIntegrity == 100) - DoCompleteAchievement(ACHIEV_DEFENSELESS); - } - break; - case DATA_WAVE_COUNT: - uiWaveCount = data; - bActive = true; - break; - case DATA_REMOVE_NPC: - uiRemoveNpc = data; - break; - case DATA_PORTAL_LOCATION: - uiLocation = (uint8)data; - break; - case DATA_DOOR_INTEGRITY: - uiDoorIntegrity = data; - DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, uiDoorIntegrity); - break; - case DATA_NPC_PRESENCE_AT_DOOR_ADD: - NpcAtDoorCastingList.push_back(data); - break; - case DATA_NPC_PRESENCE_AT_DOOR_REMOVE: - if(!NpcAtDoorCastingList.empty()) - NpcAtDoorCastingList.pop_back(); - break; - case DATA_MAIN_DOOR: - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - { - switch(data) + switch(type) + { + case DATA_1ST_BOSS_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + SaveToDB(); + break; + case DATA_2ND_BOSS_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) + SaveToDB(); + break; + case DATA_CYANIGOSA_EVENT: + m_auiEncounter[2] = data; + if (data == DONE) { - case GO_STATE_ACTIVE: + SaveToDB(); + uiMainEventPhase = DONE; + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_ACTIVE); + if (!bCrystalActivated && uiDoorIntegrity == 100) + DoCompleteAchievement(ACHIEV_DEFENSELESS); + } + break; + case DATA_WAVE_COUNT: + uiWaveCount = data; + bActive = true; + break; + case DATA_REMOVE_NPC: + uiRemoveNpc = data; + break; + case DATA_PORTAL_LOCATION: + uiLocation = (uint8)data; + break; + case DATA_DOOR_INTEGRITY: + uiDoorIntegrity = data; + DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, uiDoorIntegrity); + break; + case DATA_NPC_PRESENCE_AT_DOOR_ADD: + NpcAtDoorCastingList.push_back(data); + break; + case DATA_NPC_PRESENCE_AT_DOOR_REMOVE: + if(!NpcAtDoorCastingList.empty()) + NpcAtDoorCastingList.pop_back(); + break; + case DATA_MAIN_DOOR: + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) + { + switch(data) + { + case GO_STATE_ACTIVE: + pMainDoor->SetGoState(GO_STATE_ACTIVE); + break; + case GO_STATE_READY: + pMainDoor->SetGoState(GO_STATE_READY); + break; + case GO_STATE_ACTIVE_ALTERNATIVE: + pMainDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + break; + } + } + break; + case DATA_START_BOSS_ENCOUNTER: + switch(uiWaveCount) + { + case 6: + StartBossEncounter(uiFirstBoss); break; - case GO_STATE_READY: - pMainDoor->SetGoState(GO_STATE_READY); - break; - case GO_STATE_ACTIVE_ALTERNATIVE: - pMainDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + case 12: + StartBossEncounter(uiSecondBoss); break; } - } - break; - case DATA_START_BOSS_ENCOUNTER: - switch(uiWaveCount) - { - case 6: - StartBossEncounter(uiFirstBoss); - break; - case 12: - StartBossEncounter(uiSecondBoss); - break; - } - break; - case DATA_ACTIVATE_CRYSTAL: - ActivateCrystal(); - break; - case DATA_MAIN_EVENT_PHASE: - uiMainEventPhase = data; - if (data == IN_PROGRESS) // Start event - { - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - pMainDoor->SetGoState(GO_STATE_READY); - uiWaveCount = 1; - bActive = true; - uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. - } - break; + break; + case DATA_ACTIVATE_CRYSTAL: + ActivateCrystal(); + break; + case DATA_MAIN_EVENT_PHASE: + uiMainEventPhase = data; + if (data == IN_PROGRESS) // Start event + { + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) + pMainDoor->SetGoState(GO_STATE_READY); + uiWaveCount = 1; + bActive = true; + uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. + } + break; + } } - } - void SetData64(uint32 type, uint64 data) - { - switch(type) + void SetData64(uint32 type, uint64 data) { - case DATA_ADD_TRASH_MOB: - trashMobs.insert(data); - break; - case DATA_DEL_TRASH_MOB: - trashMobs.erase(data); - break; + switch(type) + { + case DATA_ADD_TRASH_MOB: + trashMobs.insert(data); + break; + case DATA_DEL_TRASH_MOB: + trashMobs.erase(data); + break; + } } - } - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_1ST_BOSS_EVENT: return m_auiEncounter[0]; - case DATA_2ND_BOSS_EVENT: return m_auiEncounter[1]; - case DATA_CYANIGOSA_EVENT: return m_auiEncounter[2]; - case DATA_WAVE_COUNT: return uiWaveCount; - case DATA_REMOVE_NPC: return uiRemoveNpc; - case DATA_PORTAL_LOCATION: return uiLocation; - case DATA_DOOR_INTEGRITY: return uiDoorIntegrity; - case DATA_NPC_PRESENCE_AT_DOOR: return NpcAtDoorCastingList.size(); - case DATA_FIRST_BOSS: return uiFirstBoss; - case DATA_SECOND_BOSS: return uiSecondBoss; - case DATA_MAIN_EVENT_PHASE: return uiMainEventPhase; - } - - return 0; - } + switch(type) + { + case DATA_1ST_BOSS_EVENT: return m_auiEncounter[0]; + case DATA_2ND_BOSS_EVENT: return m_auiEncounter[1]; + case DATA_CYANIGOSA_EVENT: return m_auiEncounter[2]; + case DATA_WAVE_COUNT: return uiWaveCount; + case DATA_REMOVE_NPC: return uiRemoveNpc; + case DATA_PORTAL_LOCATION: return uiLocation; + case DATA_DOOR_INTEGRITY: return uiDoorIntegrity; + case DATA_NPC_PRESENCE_AT_DOOR: return NpcAtDoorCastingList.size(); + case DATA_FIRST_BOSS: return uiFirstBoss; + case DATA_SECOND_BOSS: return uiSecondBoss; + case DATA_MAIN_EVENT_PHASE: return uiMainEventPhase; + } - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_MORAGG: return uiMoragg; - case DATA_EREKEM: return uiErekem; - case DATA_EREKEM_GUARD_1: return uiErekemGuard[0]; - case DATA_EREKEM_GUARD_2: return uiErekemGuard[1]; - case DATA_ICHORON: return uiIchoron; - case DATA_LAVANTHOR: return uiLavanthor; - case DATA_XEVOZZ: return uiXevozz; - case DATA_ZURAMAT: return uiZuramat; - case DATA_CYANIGOSA: return uiCyanigosa; - case DATA_MORAGG_CELL: return uiMoraggCell; - case DATA_EREKEM_CELL: return uiErekemCell; - case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell; - case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell; - case DATA_ICHORON_CELL: return uiIchoronCell; - case DATA_LAVANTHOR_CELL: return uiLavanthorCell; - case DATA_XEVOZZ_CELL: return uiXevozzCell; - case DATA_ZURAMAT_CELL: return uiZuramatCell; - case DATA_MAIN_DOOR: return uiMainDoor; - case DATA_SINCLARI: return uiSinclari; - case DATA_TELEPORTATION_PORTAL: return uiTeleportationPortal; - case DATA_SABOTEUR_PORTAL: return uiSaboteurPortal; + return 0; } - return 0; - } - - void SpawnPortal() - { - SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1,5))%6); - if (Creature *pSinclari = instance->GetCreature(uiSinclari)) - if(Creature *portal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[GetData(DATA_PORTAL_LOCATION)],TEMPSUMMON_CORPSE_DESPAWN)) - uiTeleportationPortal = portal->GetGUID(); - } + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MORAGG: return uiMoragg; + case DATA_EREKEM: return uiErekem; + case DATA_EREKEM_GUARD_1: return uiErekemGuard[0]; + case DATA_EREKEM_GUARD_2: return uiErekemGuard[1]; + case DATA_ICHORON: return uiIchoron; + case DATA_LAVANTHOR: return uiLavanthor; + case DATA_XEVOZZ: return uiXevozz; + case DATA_ZURAMAT: return uiZuramat; + case DATA_CYANIGOSA: return uiCyanigosa; + case DATA_MORAGG_CELL: return uiMoraggCell; + case DATA_EREKEM_CELL: return uiErekemCell; + case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell; + case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell; + case DATA_ICHORON_CELL: return uiIchoronCell; + case DATA_LAVANTHOR_CELL: return uiLavanthorCell; + case DATA_XEVOZZ_CELL: return uiXevozzCell; + case DATA_ZURAMAT_CELL: return uiZuramatCell; + case DATA_MAIN_DOOR: return uiMainDoor; + case DATA_SINCLARI: return uiSinclari; + case DATA_TELEPORTATION_PORTAL: return uiTeleportationPortal; + case DATA_SABOTEUR_PORTAL: return uiSaboteurPortal; + } - void StartBossEncounter(uint8 uiBoss, bool bForceRespawn = true) - { - Creature* pBoss = NULL; + return 0; + } - switch(uiBoss) + void SpawnPortal() { - case BOSS_MORAGG: - HandleGameObject(uiMoraggCell,bForceRespawn); - pBoss = instance->GetCreature(uiMoragg); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove1); - break; - case BOSS_EREKEM: - HandleGameObject(uiErekemCell, bForceRespawn); - HandleGameObject(uiErekemRightGuardCell, bForceRespawn); - HandleGameObject(uiErekemLeftGuardCell, bForceRespawn); - - pBoss = instance->GetCreature(uiErekem); - - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove2); - - if (Creature* pGuard1 = instance->GetCreature(uiErekemGuard[0])) - { - if (bForceRespawn) - pGuard1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - else - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); - } - - if (Creature* pGuard2 = instance->GetCreature(uiErekemGuard[1])) - { - if (bForceRespawn) - pGuard2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - else - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); - } - break; - case BOSS_ICHORON: - HandleGameObject(uiIchoronCell,bForceRespawn); - pBoss = instance->GetCreature(uiIchoron); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove3); - break; - case BOSS_LAVANTHOR: - HandleGameObject(uiLavanthorCell,bForceRespawn); - pBoss = instance->GetCreature(uiLavanthor); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove4); - break; - case BOSS_XEVOZZ: - HandleGameObject(uiXevozzCell,bForceRespawn); - pBoss = instance->GetCreature(uiXevozz); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove5); - break; - case BOSS_ZURAMAT: - HandleGameObject(uiZuramatCell,bForceRespawn); - pBoss = instance->GetCreature(uiZuramat); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove6); - break; + SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1,5))%6); + if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + if(Creature *portal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[GetData(DATA_PORTAL_LOCATION)],TEMPSUMMON_CORPSE_DESPAWN)) + uiTeleportationPortal = portal->GetGUID(); } - // generic boss state changes - if (pBoss) + void StartBossEncounter(uint8 uiBoss, bool bForceRespawn = true) { - pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pBoss->SetReactState(REACT_AGGRESSIVE); + Creature* pBoss = NULL; - if (!bForceRespawn) + switch(uiBoss) { - if (pBoss->isDead()) + case BOSS_MORAGG: + HandleGameObject(uiMoraggCell,bForceRespawn); + pBoss = instance->GetCreature(uiMoragg); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove1); + break; + case BOSS_EREKEM: + HandleGameObject(uiErekemCell, bForceRespawn); + HandleGameObject(uiErekemRightGuardCell, bForceRespawn); + HandleGameObject(uiErekemLeftGuardCell, bForceRespawn); + + pBoss = instance->GetCreature(uiErekem); + + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove2); + + if (Creature* pGuard1 = instance->GetCreature(uiErekemGuard[0])) + { + if (bForceRespawn) + pGuard1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + else + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); + } + + if (Creature* pGuard2 = instance->GetCreature(uiErekemGuard[1])) + { + if (bForceRespawn) + pGuard2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + else + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); + } + break; + case BOSS_ICHORON: + HandleGameObject(uiIchoronCell,bForceRespawn); + pBoss = instance->GetCreature(uiIchoron); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove3); + break; + case BOSS_LAVANTHOR: + HandleGameObject(uiLavanthorCell,bForceRespawn); + pBoss = instance->GetCreature(uiLavanthor); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove4); + break; + case BOSS_XEVOZZ: + HandleGameObject(uiXevozzCell,bForceRespawn); + pBoss = instance->GetCreature(uiXevozz); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove5); + break; + case BOSS_ZURAMAT: + HandleGameObject(uiZuramatCell,bForceRespawn); + pBoss = instance->GetCreature(uiZuramat); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove6); + break; + } + + // generic boss state changes + if (pBoss) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pBoss->SetReactState(REACT_AGGRESSIVE); + + if (!bForceRespawn) { - // respawn but avoid to be looted again - pBoss->Respawn(); - pBoss->RemoveLootMode(1); + if (pBoss->isDead()) + { + // respawn but avoid to be looted again + pBoss->Respawn(); + pBoss->RemoveLootMode(1); + } + pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + uiWaveCount = 0; } - pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - uiWaveCount = 0; } } - } - - void AddWave() - { - DoUpdateWorldState(WORLD_STATE_VH, 1); - DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount); - switch(uiWaveCount) + void AddWave() { - case 6: - if (uiFirstBoss == 0) - uiFirstBoss = urand(1,6); - if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + DoUpdateWorldState(WORLD_STATE_VH, 1); + DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount); + + switch(uiWaveCount) + { + case 6: + if (uiFirstBoss == 0) + uiFirstBoss = urand(1,6); + if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + { + if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) + uiSaboteurPortal = pPortal->GetGUID(); + if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) + pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); + } + break; + case 12: + if (uiSecondBoss == 0) + do + { + uiSecondBoss = urand(1,6); + } while (uiSecondBoss == uiFirstBoss); + if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + { + if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) + uiSaboteurPortal = pPortal->GetGUID(); + if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) + pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); + } + break; + case 18: { - if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) - uiSaboteurPortal = pPortal->GetGUID(); - if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) - pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); + Creature *pSinclari = instance->GetCreature(uiSinclari); + if (pSinclari) + pSinclari->SummonCreature(CREATURE_CYANIGOSA,CyanigosasSpawnLocation,TEMPSUMMON_DEAD_DESPAWN); + break; } - break; - case 12: - if (uiSecondBoss == 0) - do - { - uiSecondBoss = urand(1,6); - } while (uiSecondBoss == uiFirstBoss); - if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + case 1: { - if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) - uiSaboteurPortal = pPortal->GetGUID(); - if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) - pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) + pMainDoor->SetGoState(GO_STATE_READY); + DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); } - break; - case 18: - { - Creature *pSinclari = instance->GetCreature(uiSinclari); - if (pSinclari) - pSinclari->SummonCreature(CREATURE_CYANIGOSA,CyanigosasSpawnLocation,TEMPSUMMON_DEAD_DESPAWN); - break; + default: + SpawnPortal(); + break; } - case 1: - { - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - pMainDoor->SetGoState(GO_STATE_READY); - DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); - } - default: - SpawnPortal(); - break; } - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "V H " << (uint16)m_auiEncounter[0] - << " " << (uint16)m_auiEncounter[1] - << " " << (uint16)m_auiEncounter[2] - << " " << (uint16)uiFirstBoss - << " " << (uint16)uiSecondBoss; - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; - } + OUT_SAVE_INST_DATA; - OUT_LOAD_INST_DATA(in); + std::ostringstream saveStream; + saveStream << "V H " << (uint16)m_auiEncounter[0] + << " " << (uint16)m_auiEncounter[1] + << " " << (uint16)m_auiEncounter[2] + << " " << (uint16)uiFirstBoss + << " " << (uint16)uiSecondBoss; - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4; + str_data = saveStream.str(); - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - if (dataHead1 == 'V' && dataHead2 == 'H') + void Load(const char* in) { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA(in); - uiFirstBoss = data3; - uiSecondBoss = data4; - } else OUT_LOAD_INST_DATA_FAIL; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4; - OUT_LOAD_INST_DATA_COMPLETE; - } + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - bool CheckWipe() - { - Map::PlayerList const &players = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - Player* pPlayer = itr->getSource(); - if (pPlayer->isGameMaster()) - continue; + if (dataHead1 == 'V' && dataHead2 == 'H') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; - if (pPlayer->isAlive()) - return false; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - return true; - } + uiFirstBoss = data3; + uiSecondBoss = data4; + } else OUT_LOAD_INST_DATA_FAIL; - void Update(uint32 diff) - { - if (!instance->HavePlayers()) - return; + OUT_LOAD_INST_DATA_COMPLETE; + } - // portals should spawn if other portal is dead and doors are closed - if (bActive && uiMainEventPhase == IN_PROGRESS) + bool CheckWipe() { - if (uiActivationTimer < diff) + Map::PlayerList const &players = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - AddWave(); - bActive = false; - uiActivationTimer = 5000; - } else uiActivationTimer -= diff; + Player* pPlayer = itr->getSource(); + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + return false; + } + + return true; } - // if main event is in progress and players have wiped then reset instance - if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) + void Update(uint32 diff) { - SetData(DATA_REMOVE_NPC, 1); - StartBossEncounter(uiFirstBoss, false); - StartBossEncounter(uiSecondBoss, false); + if (!instance->HavePlayers()) + return; - SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); - SetData(DATA_WAVE_COUNT, 0); - uiMainEventPhase = NOT_STARTED; + // portals should spawn if other portal is dead and doors are closed + if (bActive && uiMainEventPhase == IN_PROGRESS) + { + if (uiActivationTimer < diff) + { + AddWave(); + bActive = false; + uiActivationTimer = 5000; + } else uiActivationTimer -= diff; + } - if (Creature* pSinclari = instance->GetCreature(uiSinclari)) + // if main event is in progress and players have wiped then reset instance + if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) { - pSinclari->SetVisibility(VISIBILITY_ON); + SetData(DATA_REMOVE_NPC, 1); + StartBossEncounter(uiFirstBoss, false); + StartBossEncounter(uiSecondBoss, false); - std::list<Creature*> GuardList; - pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) + SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); + SetData(DATA_WAVE_COUNT, 0); + uiMainEventPhase = NOT_STARTED; + + if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { - for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) + pSinclari->SetVisibility(VISIBILITY_ON); + + std::list<Creature*> GuardList; + pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) { - if (Creature* pGuard = *itr) + for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->SetVisibility(VISIBILITY_ON); - pGuard->SetReactState(REACT_AGGRESSIVE); - pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); + if (Creature* pGuard = *itr) + { + pGuard->SetVisibility(VISIBILITY_ON); + pGuard->SetReactState(REACT_AGGRESSIVE); + pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); + } } } + pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); + pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); } - pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); - pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); } - } - // Cyanigosa is spawned but not tranformed, prefight event - Creature *pCyanigosa = instance->GetCreature(uiCyanigosa); - if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) - { - if (uiCyanigosaEventTimer <= diff) + // Cyanigosa is spawned but not tranformed, prefight event + Creature *pCyanigosa = instance->GetCreature(uiCyanigosa); + if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) { - switch(uiCyanigosaEventPhase) + if (uiCyanigosaEventTimer <= diff) { - case 1: - pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); - DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); - uiCyanigosaEventTimer = 7*IN_MILLISECONDS; - ++uiCyanigosaEventPhase; - break; - case 2: - pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); - pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); - uiCyanigosaEventTimer = 7*IN_MILLISECONDS; - ++uiCyanigosaEventPhase; - break; - case 3: - pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); - pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); - pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pCyanigosa->SetReactState(REACT_AGGRESSIVE); - uiCyanigosaEventTimer = 2*IN_MILLISECONDS; - ++uiCyanigosaEventPhase; - break; - case 4: - uiCyanigosaEventPhase = 0; - break; - } - } else uiCyanigosaEventTimer -= diff; - } + switch(uiCyanigosaEventPhase) + { + case 1: + pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); + DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); + uiCyanigosaEventTimer = 7*IN_MILLISECONDS; + ++uiCyanigosaEventPhase; + break; + case 2: + pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); + pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); + uiCyanigosaEventTimer = 7*IN_MILLISECONDS; + ++uiCyanigosaEventPhase; + break; + case 3: + pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); + pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); + pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pCyanigosa->SetReactState(REACT_AGGRESSIVE); + uiCyanigosaEventTimer = 2*IN_MILLISECONDS; + ++uiCyanigosaEventPhase; + break; + case 4: + uiCyanigosaEventPhase = 0; + break; + } + } else uiCyanigosaEventTimer -= diff; + } - // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active - if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) - { - // if door integrity is > 0 then decrase it's integrity state - if(GetData(DATA_DOOR_INTEGRITY)) + // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active + if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) { - if(uiDoorSpellTimer < diff) + // if door integrity is > 0 then decrase it's integrity state + if(GetData(DATA_DOOR_INTEGRITY)) + { + if(uiDoorSpellTimer < diff) + { + SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); + uiDoorSpellTimer =2000; + } else uiDoorSpellTimer -= diff; + } + // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) + else { - SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); - uiDoorSpellTimer =2000; - } else uiDoorSpellTimer -= diff; + SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); + uiMainEventPhase = FAIL; + } } - // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) - else + } + + void ActivateCrystal() + { + // Kill all mobs registered with SetData64(ADD_TRASH_MOB) + // TODO: All visual, spells etc + for (std::set<uint64>::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) { - SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); - uiMainEventPhase = FAIL; + Creature* pCreature = instance->GetCreature(*itr); + if (pCreature && pCreature->isAlive()) + pCreature->CastSpell(pCreature,SPELL_ARCANE_LIGHTNING,true); // Who should cast the spell? } } - } - void ActivateCrystal() - { - // Kill all mobs registered with SetData64(ADD_TRASH_MOB) - // TODO: All visual, spells etc - for (std::set<uint64>::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) + void ProcessEvent(GameObject* pGO, uint32 uiEventId) { - Creature* pCreature = instance->GetCreature(*itr); - if (pCreature && pCreature->isAlive()) - pCreature->CastSpell(pCreature,SPELL_ARCANE_LIGHTNING,true); // Who should cast the spell? - } + switch(uiEventId) + { + case EVENT_ACTIVATE_CRYSTAL: + bCrystalActivated = true; // Activation by player's will throw event signal + ActivateCrystal(); + break; + } } - void ProcessEvent(GameObject* pGO, uint32 uiEventId) - { - switch(uiEventId) - { - case EVENT_ACTIVATE_CRYSTAL: - bCrystalActivated = true; // Activation by player's will throw event signal - ActivateCrystal(); - break; - } -} +}; }; -InstanceData* GetInstanceData_instance_violet_hold(Map* pMap) -{ - return new instance_violet_hold(pMap); -} void AddSC_instance_violet_hold() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_violet_hold"; - newscript->GetInstanceData = &GetInstanceData_instance_violet_hold; - newscript->RegisterSelf(); + new instance_violet_hold(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 47d649b9e9b..59547c7ca5c 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -247,412 +247,434 @@ const float SaboteurFinalPos6[5][3] = const Position MovePosition = {1806.955566, 803.851807, 44.363323}; const Position playerTeleportPosition = {1830.531006, 803.939758, 44.340508, 6.281611}; const Position sinclariOutsidePosition = {1817.315674, 804.060608, 44.363998}; - -struct npc_sinclariAI : public ScriptedAI +
class npc_sinclari_vh : public CreatureScript { - npc_sinclariAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_sinclari_vh() : CreatureScript("npc_sinclari_vh") { } + + bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pInstance = pCreature->GetInstanceData(); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_sinclari_vh::npc_sinclariAI, (pCreature->AI()))->uiPhase = 1; + if (InstanceScript *pInstance = pCreature->GetInstanceScript()) + pInstance->SetData(DATA_MAIN_EVENT_PHASE,SPECIAL); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->NearTeleportTo(playerTeleportPosition.GetPositionX(),playerTeleportPosition.GetPositionY(),playerTeleportPosition.GetPositionZ(),playerTeleportPosition.GetOrientation(),true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - ScriptedInstance* pInstance; + bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) + { + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + switch (pInstance->GetData(DATA_MAIN_EVENT_PHASE)) + { + case NOT_STARTED: + case FAIL: // Allow to start event if not started or wiped + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); + break; + case IN_PROGRESS: // Allow to teleport inside if event is in progress + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_I_WANT_IN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); + break; + default: + pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID()); + } + } + return true; + } - uint8 uiPhase; - uint32 uiTimer; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_sinclariAI(pCreature); + } - void Reset() + struct npc_sinclariAI : public ScriptedAI { - uiPhase = 0; - uiTimer = 0; + npc_sinclariAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; - me->SetReactState(REACT_AGGRESSIVE); + uint8 uiPhase; + uint32 uiTimer; - std::list<Creature*> GuardList; - me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) + void Reset() { - for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) + uiPhase = 0; + uiTimer = 0; + + me->SetReactState(REACT_AGGRESSIVE); + + std::list<Creature*> GuardList; + me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) { - if (Creature* pGuard = *itr) + for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->DisappearAndDie(); - pGuard->Respawn(); - pGuard->SetVisibility(VISIBILITY_ON); - pGuard->SetReactState(REACT_AGGRESSIVE); + if (Creature* pGuard = *itr) + { + pGuard->DisappearAndDie(); + pGuard->Respawn(); + pGuard->SetVisibility(VISIBILITY_ON); + pGuard->SetReactState(REACT_AGGRESSIVE); + } } } } - } - - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); - if (uiPhase) + void UpdateAI(const uint32 uiDiff) { - if (uiTimer <= uiDiff) + ScriptedAI::UpdateAI(uiDiff); + + if (uiPhase) { - switch(uiPhase) + if (uiTimer <= uiDiff) { - case 1: - DoScriptText(SAY_SINCLARI_1, me); - uiTimer = 4000; - uiPhase = 2; - break; - case 2: + switch(uiPhase) { - std::list<Creature*> GuardList; - me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) - for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) - { - if (Creature* pGuard = *itr) + case 1: + DoScriptText(SAY_SINCLARI_1, me); + uiTimer = 4000; + uiPhase = 2; + break; + case 2: + { + std::list<Creature*> GuardList; + me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) + for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pGuard->GetMotionMaster()->MovePoint(0, MovePosition); + if (Creature* pGuard = *itr) + { + pGuard->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pGuard->GetMotionMaster()->MovePoint(0, MovePosition); + } } - } - uiTimer = 6000; - uiPhase = 3; - break; - } - case 3: - { - std::list<Creature*> GuardList; - me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) - for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) - { - if (Creature* pGuard = *itr) + uiTimer = 6000; + uiPhase = 3; + break; + } + case 3: + { + std::list<Creature*> GuardList; + me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) + for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->SetVisibility(VISIBILITY_OFF); - pGuard->SetReactState(REACT_PASSIVE); + if (Creature* pGuard = *itr) + { + pGuard->SetVisibility(VISIBILITY_OFF); + pGuard->SetReactState(REACT_PASSIVE); + } } - } - uiTimer = 2000; - uiPhase = 4; - break; + uiTimer = 2000; + uiPhase = 4; + break; + } + case 4: + me->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition); + uiTimer = 4000; + uiPhase = 5; + break; + case 5: + if (pInstance) + pInstance->SetData(DATA_MAIN_EVENT_PHASE,IN_PROGRESS); + me->SetReactState(REACT_PASSIVE); + uiTimer = 0; + uiPhase = 0; + break; } - case 4: - me->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition); - uiTimer = 4000; - uiPhase = 5; - break; - case 5: - if (pInstance) - pInstance->SetData(DATA_MAIN_EVENT_PHASE,IN_PROGRESS); - me->SetReactState(REACT_PASSIVE); - uiTimer = 0; - uiPhase = 0; - break; } + else uiTimer -= uiDiff; } - else uiTimer -= uiDiff; - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_sinclari(Creature* pCreature) -{ - return new npc_sinclariAI(pCreature); -} -bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) -{ - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - switch (pInstance->GetData(DATA_MAIN_EVENT_PHASE)) - { - case NOT_STARTED: - case FAIL: // Allow to start event if not started or wiped - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); - break; - case IN_PROGRESS: // Allow to teleport inside if event is in progress - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_I_WANT_IN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); - break; - default: - pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID()); - } - } - return true; -} -bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) +
class mob_azure_saboteur : public CreatureScript { - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_sinclariAI, (pCreature->AI()))->uiPhase = 1; - if (ScriptedInstance *pInstance = pCreature->GetInstanceData()) - pInstance->SetData(DATA_MAIN_EVENT_PHASE,SPECIAL); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->NearTeleportTo(playerTeleportPosition.GetPositionX(),playerTeleportPosition.GetPositionY(),playerTeleportPosition.GetPositionZ(),playerTeleportPosition.GetOrientation(),true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - return true; -} +public: + mob_azure_saboteur() : CreatureScript("mob_azure_saboteur") { } -struct mob_azure_saboteurAI : public npc_escortAI -{ - mob_azure_saboteurAI(Creature *c):npc_escortAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - bHasGotMovingPoints = false; - uiBoss = 0; - Reset(); + return new mob_azure_saboteurAI (pCreature); } - ScriptedInstance* pInstance; - bool bHasGotMovingPoints; - uint32 uiBoss; - - void Reset() + struct mob_azure_saboteurAI : public npc_escortAI { - if (pInstance && !uiBoss) - uiBoss = pInstance->GetData(DATA_WAVE_COUNT) == 6 ? pInstance->GetData(DATA_FIRST_BOSS) : pInstance->GetData(DATA_SECOND_BOSS); - } + mob_azure_saboteurAI(Creature *c):npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + bHasGotMovingPoints = false; + uiBoss = 0; + Reset(); + } - void WaypointReached(uint32 uiWPointId) - { - switch(uiBoss) + InstanceScript* pInstance; + bool bHasGotMovingPoints; + uint32 uiBoss; + + void Reset() { - case 1: - if(uiWPointId == 2) - FinishPointReached(); - break; - case 2: - if(uiWPointId == 2) - FinishPointReached(); - break; - case 3: - if(uiWPointId == 1) - FinishPointReached(); - break; - case 4: - if(uiWPointId == 0) - FinishPointReached(); - break; - case 5: - if(uiWPointId == 0) - FinishPointReached(); - break; - case 6: - if(uiWPointId == 4) - FinishPointReached(); - break; + if (pInstance && !uiBoss) + uiBoss = pInstance->GetData(DATA_WAVE_COUNT) == 6 ? pInstance->GetData(DATA_FIRST_BOSS) : pInstance->GetData(DATA_SECOND_BOSS); } - } - - void UpdateAI(const uint32 diff) - { - if (pInstance && pInstance->GetData(DATA_MAIN_EVENT_PHASE != IN_PROGRESS)) - me->CastStop(); - - npc_escortAI::UpdateAI(diff); - if(!bHasGotMovingPoints) + void WaypointReached(uint32 uiWPointId) { - bHasGotMovingPoints = true; switch(uiBoss) { case 1: - for(int i=0;i<3;i++) - AddWaypoint(i,SaboteurFinalPos1[i][0],SaboteurFinalPos1[i][1],SaboteurFinalPos1[i][2],0); - me->SetHomePosition(SaboteurFinalPos1[2][0],SaboteurFinalPos1[2][1],SaboteurFinalPos1[2][2],4.762346); + if(uiWPointId == 2) + FinishPointReached(); break; case 2: - for(int i=0;i<3;i++) - AddWaypoint(i,SaboteurFinalPos2[i][0],SaboteurFinalPos2[i][1],SaboteurFinalPos2[i][2],0); - me->SetHomePosition(SaboteurFinalPos2[2][0],SaboteurFinalPos2[2][1],SaboteurFinalPos2[2][2],1.862674); + if(uiWPointId == 2) + FinishPointReached(); break; case 3: - for(int i=0;i<2;i++) - AddWaypoint(i,SaboteurFinalPos3[i][0],SaboteurFinalPos3[i][1],SaboteurFinalPos3[i][2],0); - me->SetHomePosition(SaboteurFinalPos3[1][0],SaboteurFinalPos3[1][1],SaboteurFinalPos3[1][2],5.500638); + if(uiWPointId == 1) + FinishPointReached(); break; case 4: - AddWaypoint(0,SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],0); - me->SetHomePosition(SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],3.991108); + if(uiWPointId == 0) + FinishPointReached(); break; case 5: - AddWaypoint(0,SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],0); - me->SetHomePosition(SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],1.100841); + if(uiWPointId == 0) + FinishPointReached(); break; case 6: - for(int i=0;i<5;i++) - AddWaypoint(i,SaboteurFinalPos6[i][0],SaboteurFinalPos6[i][1],SaboteurFinalPos6[i][2],0); - me->SetHomePosition(SaboteurFinalPos6[4][0],SaboteurFinalPos6[4][1],SaboteurFinalPos6[4][2],0.983031); + if(uiWPointId == 4) + FinishPointReached(); break; } + } + + void UpdateAI(const uint32 diff) + { + if (pInstance && pInstance->GetData(DATA_MAIN_EVENT_PHASE != IN_PROGRESS)) + me->CastStop(); + + npc_escortAI::UpdateAI(diff); - SetDespawnAtEnd(false); - Start(true,true); + if(!bHasGotMovingPoints) + { + bHasGotMovingPoints = true; + switch(uiBoss) + { + case 1: + for(int i=0;i<3;i++) + AddWaypoint(i,SaboteurFinalPos1[i][0],SaboteurFinalPos1[i][1],SaboteurFinalPos1[i][2],0); + me->SetHomePosition(SaboteurFinalPos1[2][0],SaboteurFinalPos1[2][1],SaboteurFinalPos1[2][2],4.762346); + break; + case 2: + for(int i=0;i<3;i++) + AddWaypoint(i,SaboteurFinalPos2[i][0],SaboteurFinalPos2[i][1],SaboteurFinalPos2[i][2],0); + me->SetHomePosition(SaboteurFinalPos2[2][0],SaboteurFinalPos2[2][1],SaboteurFinalPos2[2][2],1.862674); + break; + case 3: + for(int i=0;i<2;i++) + AddWaypoint(i,SaboteurFinalPos3[i][0],SaboteurFinalPos3[i][1],SaboteurFinalPos3[i][2],0); + me->SetHomePosition(SaboteurFinalPos3[1][0],SaboteurFinalPos3[1][1],SaboteurFinalPos3[1][2],5.500638); + break; + case 4: + AddWaypoint(0,SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],0); + me->SetHomePosition(SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],3.991108); + break; + case 5: + AddWaypoint(0,SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],0); + me->SetHomePosition(SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],1.100841); + break; + case 6: + for(int i=0;i<5;i++) + AddWaypoint(i,SaboteurFinalPos6[i][0],SaboteurFinalPos6[i][1],SaboteurFinalPos6[i][2],0); + me->SetHomePosition(SaboteurFinalPos6[4][0],SaboteurFinalPos6[4][1],SaboteurFinalPos6[4][2],0.983031); + break; + } + + SetDespawnAtEnd(false); + Start(true,true); + } } - } - void FinishPointReached() - { - me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); - me->DisappearAndDie(); - Creature* pSaboPort = Unit::GetCreature((*me),pInstance->GetData64(DATA_SABOTEUR_PORTAL)); - if (pSaboPort) - pSaboPort->DisappearAndDie(); - pInstance->SetData(DATA_START_BOSS_ENCOUNTER, 1); - } + void FinishPointReached() + { + me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); + me->DisappearAndDie(); + Creature* pSaboPort = Unit::GetCreature((*me),pInstance->GetData64(DATA_SABOTEUR_PORTAL)); + if (pSaboPort) + pSaboPort->DisappearAndDie(); + pInstance->SetData(DATA_START_BOSS_ENCOUNTER, 1); + } + }; + }; -CreatureAI* GetAI_mob_azure_saboteur(Creature* pCreature) +
class npc_teleportation_portal_vh : public CreatureScript { - return new mob_azure_saboteurAI (pCreature); -} +public: + npc_teleportation_portal_vh() : CreatureScript("npc_teleportation_portal_vh") { } -struct npc_teleportation_portalAI : public ScriptedAI -{ - npc_teleportation_portalAI(Creature *c) : ScriptedAI(c), listOfMobs(me) + CreatureAI* GetAI_npc_teleportation_portal(Creature *pCreature) { - pInstance = c->GetInstanceData(); - uiTypeOfMobsPortal = urand(0,1); // 0 - elite mobs 1 - portal guardian or portal keeper with regular mobs - bPortalGuardianOrKeeperOrEliteSpawn = false; + return new npc_teleportation_portalAI(pCreature); } - uint32 uiSpawnTimer; - bool bPortalGuardianOrKeeperOrEliteSpawn; - uint8 uiTypeOfMobsPortal; - - SummonList listOfMobs; - - ScriptedInstance *pInstance; - - void Reset() + struct npc_teleportation_portalAI : public ScriptedAI { - uiSpawnTimer = 10000; - bPortalGuardianOrKeeperOrEliteSpawn = false; - } + npc_teleportation_portalAI(Creature *c) : ScriptedAI(c), listOfMobs(me) + { + pInstance = c->GetInstanceScript(); + uiTypeOfMobsPortal = urand(0,1); // 0 - elite mobs 1 - portal guardian or portal keeper with regular mobs + bPortalGuardianOrKeeperOrEliteSpawn = false; + } - void EnterCombat(Unit * /*who*/) {} + uint32 uiSpawnTimer; + bool bPortalGuardianOrKeeperOrEliteSpawn; + uint8 uiTypeOfMobsPortal; - void MoveInLineOfSight(Unit * /*who*/) {} + SummonList listOfMobs; - void UpdateAI(const uint32 diff) - { - if (!pInstance) //Massive usage of pInstance, global check - return; - - if (pInstance->GetData(DATA_REMOVE_NPC) == 1) + InstanceScript *pInstance; + + void Reset() { - me->ForcedDespawn(); - pInstance->SetData(DATA_REMOVE_NPC, 0); + uiSpawnTimer = 10000; + bPortalGuardianOrKeeperOrEliteSpawn = false; } - uint8 uiWaveCount = pInstance->GetData(DATA_WAVE_COUNT); - if ((uiWaveCount == 6) || (uiWaveCount == 12)) //Don't spawn mobs on boss encounters - return; + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit * /*who*/) {} - switch(uiTypeOfMobsPortal) + void UpdateAI(const uint32 diff) { - // spawn elite mobs and then set portals visibility to make it look like it dissapeard - case 0: - if (!bPortalGuardianOrKeeperOrEliteSpawn) - { - if (uiSpawnTimer <= diff) + if (!pInstance) //Massive usage of pInstance, global check + return; + + if (pInstance->GetData(DATA_REMOVE_NPC) == 1) + { + me->ForcedDespawn(); + pInstance->SetData(DATA_REMOVE_NPC, 0); + } + + uint8 uiWaveCount = pInstance->GetData(DATA_WAVE_COUNT); + if ((uiWaveCount == 6) || (uiWaveCount == 12)) //Don't spawn mobs on boss encounters + return; + + switch(uiTypeOfMobsPortal) + { + // spawn elite mobs and then set portals visibility to make it look like it dissapeard + case 0: + if (!bPortalGuardianOrKeeperOrEliteSpawn) { - bPortalGuardianOrKeeperOrEliteSpawn = true; - uint8 k = uiWaveCount < 12 ? 2 : 3; - for (uint8 i = 0; i < k; ++i) + if (uiSpawnTimer <= diff) { - uint32 entry = RAND(CREATURE_AZURE_CAPTAIN,CREATURE_AZURE_RAIDER,CREATURE_AZURE_STALKER,CREATURE_AZURE_SORCEROR); - DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); - } - me->SetVisibility(VISIBILITY_OFF); - } else uiSpawnTimer -= diff; - } - else - { - // if all spawned elites have died kill portal - if (listOfMobs.empty()) - { - me->Kill(me, false); - me->RemoveCorpse(); + bPortalGuardianOrKeeperOrEliteSpawn = true; + uint8 k = uiWaveCount < 12 ? 2 : 3; + for (uint8 i = 0; i < k; ++i) + { + uint32 entry = RAND(CREATURE_AZURE_CAPTAIN,CREATURE_AZURE_RAIDER,CREATURE_AZURE_STALKER,CREATURE_AZURE_SORCEROR); + DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + } + me->SetVisibility(VISIBILITY_OFF); + } else uiSpawnTimer -= diff; } - } - break; - // spawn portal guardian or portal keeper with regular mobs - case 1: - if (uiSpawnTimer <= diff) - { - if (bPortalGuardianOrKeeperOrEliteSpawn) + else { - uint8 k = pInstance->GetData(DATA_WAVE_COUNT) < 12 ? 3 : 4; - for (uint8 i = 0; i < k; ++i) + // if all spawned elites have died kill portal + if (listOfMobs.empty()) { - uint32 entry = RAND(CREATURE_AZURE_INVADER_1,CREATURE_AZURE_INVADER_2,CREATURE_AZURE_SPELLBREAKER_1,CREATURE_AZURE_SPELLBREAKER_2,CREATURE_AZURE_MAGE_SLAYER_1,CREATURE_AZURE_MAGE_SLAYER_2,CREATURE_AZURE_BINDER_1,CREATURE_AZURE_BINDER_2); - DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + me->Kill(me, false); + me->RemoveCorpse(); } } - else + break; + // spawn portal guardian or portal keeper with regular mobs + case 1: + if (uiSpawnTimer <= diff) + { + if (bPortalGuardianOrKeeperOrEliteSpawn) + { + uint8 k = pInstance->GetData(DATA_WAVE_COUNT) < 12 ? 3 : 4; + for (uint8 i = 0; i < k; ++i) + { + uint32 entry = RAND(CREATURE_AZURE_INVADER_1,CREATURE_AZURE_INVADER_2,CREATURE_AZURE_SPELLBREAKER_1,CREATURE_AZURE_SPELLBREAKER_2,CREATURE_AZURE_MAGE_SLAYER_1,CREATURE_AZURE_MAGE_SLAYER_2,CREATURE_AZURE_BINDER_1,CREATURE_AZURE_BINDER_2); + DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + } + } + else + { + bPortalGuardianOrKeeperOrEliteSpawn = true; + uint32 entry = RAND(CREATURE_PORTAL_GUARDIAN, CREATURE_PORTAL_KEEPER); + if (Creature *pPortalKeeper = DoSummon(entry, me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN)) + me->CastSpell(pPortalKeeper, SPELL_PORTAL_CHANNEL, false); + } + uiSpawnTimer = SPAWN_TIME; + } else uiSpawnTimer -= diff; + + if (bPortalGuardianOrKeeperOrEliteSpawn && !me->IsNonMeleeSpellCasted(false)) { - bPortalGuardianOrKeeperOrEliteSpawn = true; - uint32 entry = RAND(CREATURE_PORTAL_GUARDIAN, CREATURE_PORTAL_KEEPER); - if (Creature *pPortalKeeper = DoSummon(entry, me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN)) - me->CastSpell(pPortalKeeper, SPELL_PORTAL_CHANNEL, false); + me->Kill(me, false); + me->RemoveCorpse(); } - uiSpawnTimer = SPAWN_TIME; - } else uiSpawnTimer -= diff; + break; + } + } - if (bPortalGuardianOrKeeperOrEliteSpawn && !me->IsNonMeleeSpellCasted(false)) - { - me->Kill(me, false); - me->RemoveCorpse(); - } - break; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_WAVE_COUNT,pInstance->GetData(DATA_WAVE_COUNT)+1); } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_WAVE_COUNT,pInstance->GetData(DATA_WAVE_COUNT)+1); - } + void JustSummoned(Creature *pSummoned) + { + listOfMobs.Summon(pSummoned); + if (pSummoned) + pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); + } - void JustSummoned(Creature *pSummoned) - { - listOfMobs.Summon(pSummoned); - if (pSummoned) - pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); - } + void SummonedMobDied(Creature *pSummoned) + { + listOfMobs.Despawn(pSummoned); + if (pSummoned) + pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); + } + }; - void SummonedMobDied(Creature *pSummoned) - { - listOfMobs.Despawn(pSummoned); - if (pSummoned) - pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); - } }; -CreatureAI* GetAI_npc_teleportation_portal(Creature *pCreature) -{ - return new npc_teleportation_portalAI(pCreature); -} - struct violet_hold_trashAI : public npc_escortAI { violet_hold_trashAI(Creature *c):npc_escortAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bHasGotMovingPoints = false; if (pInstance) portalLocationID = pInstance->GetData(DATA_PORTAL_LOCATION); @@ -660,7 +682,7 @@ struct violet_hold_trashAI : public npc_escortAI } public: - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool bHasGotMovingPoints; uint32 portalLocationID; uint32 secondPortalRouteID; @@ -756,7 +778,7 @@ struct violet_hold_trashAI : public npc_escortAI void JustDied(Unit *unit) { if (Creature* portal = Unit::GetCreature((*me),pInstance->GetData64(DATA_TELEPORTATION_PORTAL))) - CAST_AI(npc_teleportation_portalAI,portal->AI())->SummonedMobDied(me); + CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI,portal->AI())->SummonedMobDied(me); if (pInstance) pInstance->SetData(DATA_NPC_PRESENCE_AT_DOOR_REMOVE,1); } @@ -770,532 +792,530 @@ struct violet_hold_trashAI : public npc_escortAI } }; - -struct mob_azure_invaderAI : public violet_hold_trashAI +
class mob_azure_invader : public CreatureScript { - mob_azure_invaderAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + mob_azure_invader() : CreatureScript("mob_azure_invader") { } - uint32 uiCleaveTimer; - uint32 uiImpaleTimer; - uint32 uiBrutalStrikeTimer; - uint32 uiSunderArmorTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiCleaveTimer = 5000; - uiImpaleTimer = 4000; - uiBrutalStrikeTimer = 5000; - uiSunderArmorTimer = 4000; + return new mob_azure_invaderAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_azure_invaderAI : public violet_hold_trashAI { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + mob_azure_invaderAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (!UpdateVictim()) - return; + uint32 uiCleaveTimer; + uint32 uiImpaleTimer; + uint32 uiBrutalStrikeTimer; + uint32 uiSunderArmorTimer; - if (me->GetEntry() == CREATURE_AZURE_INVADER_1) + void Reset() { - if (uiCleaveTimer <= diff) - { - DoCast(me->getVictim(),SPELL_CLEAVE); - uiCleaveTimer = 5000; - } else uiCleaveTimer -= diff; - - if (uiImpaleTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_IMPALE); - uiImpaleTimer = 4000; - } else uiImpaleTimer -= diff; + uiCleaveTimer = 5000; + uiImpaleTimer = 4000; + uiBrutalStrikeTimer = 5000; + uiSunderArmorTimer = 4000; } - if (me->GetEntry() == CREATURE_AZURE_INVADER_2) + void UpdateAI(const uint32 diff) { - if (uiBrutalStrikeTimer <= diff) + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_INVADER_1) { - DoCast(me->getVictim(),SPELL_BRUTAL_STRIKE); - uiBrutalStrikeTimer = 5000; - } else uiBrutalStrikeTimer -= diff; + if (uiCleaveTimer <= diff) + { + DoCast(me->getVictim(),SPELL_CLEAVE); + uiCleaveTimer = 5000; + } else uiCleaveTimer -= diff; + + if (uiImpaleTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_IMPALE); + uiImpaleTimer = 4000; + } else uiImpaleTimer -= diff; + } - if (uiSunderArmorTimer <= diff) + if (me->GetEntry() == CREATURE_AZURE_INVADER_2) { - DoCast(me->getVictim(),SPELL_SUNDER_ARMOR); - uiSunderArmorTimer = urand(8000,10000); - } else uiSunderArmorTimer -= diff; + if (uiBrutalStrikeTimer <= diff) + { + DoCast(me->getVictim(),SPELL_BRUTAL_STRIKE); + uiBrutalStrikeTimer = 5000; + } else uiBrutalStrikeTimer -= diff; + + if (uiSunderArmorTimer <= diff) + { + DoCast(me->getVictim(),SPELL_SUNDER_ARMOR); + uiSunderArmorTimer = urand(8000,10000); + } else uiSunderArmorTimer -= diff; + + DoMeleeAttackIfReady(); + } DoMeleeAttackIfReady(); } - - DoMeleeAttackIfReady(); - } + }; }; - -struct mob_azure_spellbreakerAI : public violet_hold_trashAI +
class mob_azure_binder : public CreatureScript { - mob_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiArcaneBlastTimer; - uint32 uiSlowTimer; - uint32 uiChainsOfIceTimer; - uint32 uiConeOfColdTimer; +public: + mob_azure_binder() : CreatureScript("mob_azure_binder") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiArcaneBlastTimer = 5000; - uiSlowTimer = 4000; - uiChainsOfIceTimer = 5000; - uiConeOfColdTimer = 4000; + return new mob_azure_binderAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_azure_binderAI : public violet_hold_trashAI { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + mob_azure_binderAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (!UpdateVictim()) - return; + uint32 uiArcaneExplosionTimer; + uint32 uiArcainBarrageTimer; + uint32 uiFrostNovaTimer; + uint32 uiFrostboltTimer; - if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_1) + void Reset() { - if (uiArcaneBlastTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BLAST,H_SPELL_ARCANE_BLAST)); - uiArcaneBlastTimer = 6000; - } else uiArcaneBlastTimer -= diff; - - if (uiSlowTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_SLOW); - uiSlowTimer = 5000; - } else uiSlowTimer -= diff; + uiArcaneExplosionTimer = 5000; + uiArcainBarrageTimer = 4000; + uiFrostNovaTimer = 5000; + uiFrostboltTimer = 4000; } - if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_2) + void UpdateAI(const uint32 diff) { - if (uiChainsOfIceTimer <= diff) + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_BINDER_1) { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_CHAINS_OF_ICE); - uiChainsOfIceTimer = 7000; - } else uiChainsOfIceTimer -= diff; + if (uiArcaneExplosionTimer <= diff) + { + DoCast(DUNGEON_MODE(SPELL_ARCANE_EXPLOSION,H_SPELL_ARCANE_EXPLOSION)); + uiArcaneExplosionTimer = 5000; + } else uiArcaneExplosionTimer -= diff; + + if (uiArcainBarrageTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BARRAGE,H_SPELL_ARCANE_BARRAGE)); + uiArcainBarrageTimer = 6000; + } else uiArcainBarrageTimer -= diff; + } - if (uiConeOfColdTimer <= diff) + if (me->GetEntry() == CREATURE_AZURE_BINDER_2) { - DoCast(DUNGEON_MODE(SPELL_CONE_OF_COLD,H_SPELL_CONE_OF_COLD)); - uiConeOfColdTimer = 5000; - } else uiConeOfColdTimer -= diff; + if (uiFrostNovaTimer <= diff) + { + DoCast(DUNGEON_MODE(SPELL_FROST_NOVA,H_SPELL_FROST_NOVA)); + uiFrostNovaTimer = 5000; + } else uiFrostNovaTimer -= diff; + + if (uiFrostboltTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,DUNGEON_MODE(SPELL_FROSTBOLT,H_SPELL_FROSTBOLT)); + uiFrostboltTimer = 6000; + } else uiFrostboltTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_azure_binderAI : public violet_hold_trashAI +
class mob_azure_mage_slayer : public CreatureScript { - mob_azure_binderAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiArcaneExplosionTimer; - uint32 uiArcainBarrageTimer; - uint32 uiFrostNovaTimer; - uint32 uiFrostboltTimer; +public: + mob_azure_mage_slayer() : CreatureScript("mob_azure_mage_slayer") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiArcaneExplosionTimer = 5000; - uiArcainBarrageTimer = 4000; - uiFrostNovaTimer = 5000; - uiFrostboltTimer = 4000; + return new mob_azure_mage_slayerAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_azure_mage_slayerAI : public violet_hold_trashAI { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + mob_azure_mage_slayerAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (!UpdateVictim()) - return; + uint32 uiArcaneEmpowermentTimer; + uint32 uiSpellLockTimer; - if (me->GetEntry() == CREATURE_AZURE_BINDER_1) + void Reset() { - if (uiArcaneExplosionTimer <= diff) - { - DoCast(DUNGEON_MODE(SPELL_ARCANE_EXPLOSION,H_SPELL_ARCANE_EXPLOSION)); - uiArcaneExplosionTimer = 5000; - } else uiArcaneExplosionTimer -= diff; - - if (uiArcainBarrageTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BARRAGE,H_SPELL_ARCANE_BARRAGE)); - uiArcainBarrageTimer = 6000; - } else uiArcainBarrageTimer -= diff; + uiArcaneEmpowermentTimer = 5000; + uiSpellLockTimer = 5000; } - if (me->GetEntry() == CREATURE_AZURE_BINDER_2) + void UpdateAI(const uint32 diff) { - if (uiFrostNovaTimer <= diff) + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_1) { - DoCast(DUNGEON_MODE(SPELL_FROST_NOVA,H_SPELL_FROST_NOVA)); - uiFrostNovaTimer = 5000; - } else uiFrostNovaTimer -= diff; + if (uiArcaneEmpowermentTimer <= diff) + { + DoCast(me,SPELL_ARCANE_EMPOWERMENT); + uiArcaneEmpowermentTimer = 14000; + } else uiArcaneEmpowermentTimer -= diff; + } - if (uiFrostboltTimer <= diff) + if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_2) { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_FROSTBOLT,H_SPELL_FROSTBOLT)); - uiFrostboltTimer = 6000; - } else uiFrostboltTimer -= diff; + if (uiSpellLockTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_SPELL_LOCK); + uiSpellLockTimer = 9000; + } else uiSpellLockTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_azure_mage_slayerAI : public violet_hold_trashAI +
class mob_azure_raider : public CreatureScript { - mob_azure_mage_slayerAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiArcaneEmpowermentTimer; - uint32 uiSpellLockTimer; +public: + mob_azure_raider() : CreatureScript("mob_azure_raider") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiArcaneEmpowermentTimer = 5000; - uiSpellLockTimer = 5000; + return new mob_azure_raiderAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_azure_raiderAI : public violet_hold_trashAI { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + mob_azure_raiderAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (!UpdateVictim()) - return; + uint32 uiConcussionBlowTimer; + uint32 uiMagicReflectionTimer; - if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_1) + void Reset() { - if (uiArcaneEmpowermentTimer <= diff) - { - DoCast(me,SPELL_ARCANE_EMPOWERMENT); - uiArcaneEmpowermentTimer = 14000; - } else uiArcaneEmpowermentTimer -= diff; + uiConcussionBlowTimer = 5000; + uiMagicReflectionTimer = 8000; } - if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_2) + void UpdateAI(const uint32 diff) { - if (uiSpellLockTimer <= diff) + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (uiConcussionBlowTimer <= diff) { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_SPELL_LOCK); - uiSpellLockTimer = 9000; - } else uiSpellLockTimer -= diff; + DoCast(me->getVictim(),SPELL_CONCUSSION_BLOW); + uiConcussionBlowTimer = 5000; + } else uiConcussionBlowTimer -= diff; + + if (uiMagicReflectionTimer <= diff) + { + DoCast(SPELL_MAGIC_REFLECTION); + uiMagicReflectionTimer = urand(10000,15000); + } else uiMagicReflectionTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct mob_azure_captainAI : public violet_hold_trashAI +
class mob_azure_stalker : public CreatureScript { - mob_azure_captainAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + mob_azure_stalker() : CreatureScript("mob_azure_stalker") { } - uint32 uiMortalStrikeTimer; - uint32 uiWhirlwindTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiMortalStrikeTimer = 5000; - uiWhirlwindTimer = 8000; + return new mob_azure_stalkerAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_azure_stalkerAI : public violet_hold_trashAI { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (uiMortalStrikeTimer <= diff) + mob_azure_stalkerAI(Creature *c) : violet_hold_trashAI(c) { - DoCast(me->getVictim(),SPELL_MORTAL_STRIKE); - uiMortalStrikeTimer = 5000; - } else uiMortalStrikeTimer -= diff; + pInstance = c->GetInstanceScript(); + } + uint32 uiBackstabTimer; + uint32 uiTacticalBlinkTimer; + bool TacticalBlinkCasted; - if (uiWhirlwindTimer <= diff) + void Reset() { - DoCast(me,SPELL_WHIRLWIND_OF_STEEL); - uiWhirlwindTimer = 8000; - } else uiWhirlwindTimer -= diff; + uiBackstabTimer = 1300; + uiTacticalBlinkTimer = 8000; + TacticalBlinkCasted =false; + } - DoMeleeAttackIfReady(); - } -}; + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); -struct mob_azure_sorcerorAI : public violet_hold_trashAI -{ - mob_azure_sorcerorAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } + if (!UpdateVictim()) + return; - uint32 uiArcaneStreamTimer; - uint32 uiArcaneStreamTimerStartingValueHolder; - uint32 uiManaDetonationTimer; + if (!TacticalBlinkCasted) + { + if (uiTacticalBlinkTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true); + if (pTarget) + DoCast(pTarget,SPELL_TACTICAL_BLINK); + uiTacticalBlinkTimer = 6000; + TacticalBlinkCasted = true; + } else uiTacticalBlinkTimer -= diff; + } - void Reset() - { - uiArcaneStreamTimer = 4000; - uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; - uiManaDetonationTimer = 5000; - } + else + { + if (uiBackstabTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 10, true); + DoCast(pTarget,SPELL_BACKSTAB); + TacticalBlinkCasted = false; + uiBackstabTimer =1300; + } else uiBackstabTimer -= diff; + } - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + DoMeleeAttackIfReady(); + } + }; - if (!UpdateVictim()) - return; +}; - if (uiArcaneStreamTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_STREAM,H_SPELL_ARCANE_STREAM)); - uiArcaneStreamTimer = urand(0,5000)+5000; - uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; - } else uiArcaneStreamTimer -= diff; +class mob_azure_spellbreaker : public CreatureScript +{ +public: + mob_azure_spellbreaker() : CreatureScript("mob_azure_spellbreaker") { } - if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2) + struct mob_azure_spellbreakerAI : public violet_hold_trashAI + { + mob_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) { - DoCast(DUNGEON_MODE(SPELL_MANA_DETONATION,H_SPELL_MANA_DETONATION)); - uiManaDetonationTimer = urand(2000,6000); - } else uiManaDetonationTimer -= diff; + pInstance = c->GetInstanceScript(); + } - DoMeleeAttackIfReady(); - } -}; + uint32 uiArcaneBlastTimer; + uint32 uiSlowTimer; + uint32 uiChainsOfIceTimer; + uint32 uiConeOfColdTimer; -struct mob_azure_raiderAI : public violet_hold_trashAI -{ - mob_azure_raiderAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } + void Reset() + { + uiArcaneBlastTimer = 5000; + uiSlowTimer = 4000; + uiChainsOfIceTimer = 5000; + uiConeOfColdTimer = 4000; + } - uint32 uiConcussionBlowTimer; - uint32 uiMagicReflectionTimer; + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); - void Reset() - { - uiConcussionBlowTimer = 5000; - uiMagicReflectionTimer = 8000; - } + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_1) + { + if (uiArcaneBlastTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BLAST,H_SPELL_ARCANE_BLAST)); + uiArcaneBlastTimer = 6000; + } else uiArcaneBlastTimer -= diff; - if (!UpdateVictim()) - return; + if (uiSlowTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_SLOW); + uiSlowTimer = 5000; + } else uiSlowTimer -= diff; + } - if (uiConcussionBlowTimer <= diff) - { - DoCast(me->getVictim(),SPELL_CONCUSSION_BLOW); - uiConcussionBlowTimer = 5000; - } else uiConcussionBlowTimer -= diff; + if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_2) + { + if (uiChainsOfIceTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_CHAINS_OF_ICE); + uiChainsOfIceTimer = 7000; + } else uiChainsOfIceTimer -= diff; - if (uiMagicReflectionTimer <= diff) - { - DoCast(SPELL_MAGIC_REFLECTION); - uiMagicReflectionTimer = urand(10000,15000); - } else uiMagicReflectionTimer -= diff; + if (uiConeOfColdTimer <= diff) + { + DoCast(DUNGEON_MODE(SPELL_CONE_OF_COLD,H_SPELL_CONE_OF_COLD)); + uiConeOfColdTimer = 5000; + } else uiConeOfColdTimer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + DoMeleeAttackIfReady(); + } + }; -struct mob_azure_stalkerAI : public violet_hold_trashAI -{ - mob_azure_stalkerAI(Creature *c) : violet_hold_trashAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_azure_spellbreakerAI (pCreature); } - uint32 uiBackstabTimer; - uint32 uiTacticalBlinkTimer; - bool TacticalBlinkCasted; +};
class mob_azure_captain : public CreatureScript +{ +public: + mob_azure_captain() : CreatureScript("mob_azure_captain") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiBackstabTimer = 1300; - uiTacticalBlinkTimer = 8000; - TacticalBlinkCasted =false; + return new mob_azure_captainAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_azure_captainAI : public violet_hold_trashAI { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); + mob_azure_captainAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (!UpdateVictim()) - return; + uint32 uiMortalStrikeTimer; + uint32 uiWhirlwindTimer; - if (!TacticalBlinkCasted) + void Reset() { - if (uiTacticalBlinkTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true); - if (pTarget) - DoCast(pTarget,SPELL_TACTICAL_BLINK); - uiTacticalBlinkTimer = 6000; - TacticalBlinkCasted = true; - } else uiTacticalBlinkTimer -= diff; + uiMortalStrikeTimer = 5000; + uiWhirlwindTimer = 8000; } - else + void UpdateAI(const uint32 diff) { - if (uiBackstabTimer <= diff) + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (uiMortalStrikeTimer <= diff) { - Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 10, true); - DoCast(pTarget,SPELL_BACKSTAB); - TacticalBlinkCasted = false; - uiBackstabTimer =1300; - } else uiBackstabTimer -= diff; + DoCast(me->getVictim(),SPELL_MORTAL_STRIKE); + uiMortalStrikeTimer = 5000; + } else uiMortalStrikeTimer -= diff; + + if (uiWhirlwindTimer <= diff) + { + DoCast(me,SPELL_WHIRLWIND_OF_STEEL); + uiWhirlwindTimer = 8000; + } else uiWhirlwindTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; +
class mob_azure_sorceror : public CreatureScript +{ +public: + mob_azure_sorceror() : CreatureScript("mob_azure_sorceror") { } + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_sorcerorAI (pCreature); + } -CreatureAI* GetAI_mob_azure_invader(Creature* pCreature) -{ - return new mob_azure_invaderAI (pCreature); -} + struct mob_azure_sorcerorAI : public violet_hold_trashAI + { + mob_azure_sorcerorAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } -CreatureAI* GetAI_mob_azure_spellbreaker(Creature* pCreature) -{ - return new mob_azure_spellbreakerAI (pCreature); -} + uint32 uiArcaneStreamTimer; + uint32 uiArcaneStreamTimerStartingValueHolder; + uint32 uiManaDetonationTimer; -CreatureAI* GetAI_mob_azure_binder(Creature* pCreature) -{ - return new mob_azure_binderAI (pCreature); -} + void Reset() + { + uiArcaneStreamTimer = 4000; + uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; + uiManaDetonationTimer = 5000; + } -CreatureAI* GetAI_mob_azure_mage_slayer(Creature* pCreature) -{ - return new mob_azure_mage_slayerAI (pCreature); -} + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); -CreatureAI* GetAI_mob_azure_captain(Creature* pCreature) -{ - return new mob_azure_captainAI (pCreature); -} + if (!UpdateVictim()) + return; -CreatureAI* GetAI_mob_azure_sorceror(Creature* pCreature) -{ - return new mob_azure_sorcerorAI (pCreature); -} + if (uiArcaneStreamTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_STREAM,H_SPELL_ARCANE_STREAM)); + uiArcaneStreamTimer = urand(0,5000)+5000; + uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; + } else uiArcaneStreamTimer -= diff; -CreatureAI* GetAI_mob_azure_raider(Creature* pCreature) -{ - return new mob_azure_raiderAI (pCreature); -} + if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2) + { + DoCast(DUNGEON_MODE(SPELL_MANA_DETONATION,H_SPELL_MANA_DETONATION)); + uiManaDetonationTimer = urand(2000,6000); + } else uiManaDetonationTimer -= diff; -CreatureAI* GetAI_mob_azure_stalker(Creature* pCreature) -{ - return new mob_azure_stalkerAI (pCreature); -} + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_violet_hold() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_sinclari_vh"; - newscript->GetAI = &GetAI_npc_sinclari; - newscript->pGossipHello = &GossipHello_npc_sinclari; - newscript->pGossipSelect = &GossipSelect_npc_sinclari; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_teleportation_portal_vh"; - newscript->GetAI = &GetAI_npc_teleportation_portal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_invader"; - newscript->GetAI = &GetAI_mob_azure_invader; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_spellbreaker"; - newscript->GetAI = &GetAI_mob_azure_invader; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_binder"; - newscript->GetAI = &GetAI_mob_azure_binder; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_mage_slayer"; - newscript->GetAI = &GetAI_mob_azure_mage_slayer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_captain"; - newscript->GetAI = &GetAI_mob_azure_captain; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_sorceror"; - newscript->GetAI = &GetAI_mob_azure_sorceror; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_raider"; - newscript->GetAI = &GetAI_mob_azure_raider; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_stalker"; - newscript->GetAI = &GetAI_mob_azure_stalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_saboteur"; - newscript->GetAI = &GetAI_mob_azure_saboteur; - newscript->RegisterSelf(); + new npc_sinclari_vh(); + new npc_teleportation_portal_vh(); + new mob_azure_invader(); + new mob_azure_spellbreaker(); + new mob_azure_binder(); + new mob_azure_mage_slayer(); + new mob_azure_captain(); + new mob_azure_sorceror(); + new mob_azure_raider(); + new mob_azure_stalker(); + new mob_azure_saboteur(); } diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index d405c1e15af..a0357b2af8d 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -802,7 +802,7 @@ public: pGo->UseDoorOrButton(20); } - if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbrAI, pCreature->AI())) + if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbr::npc_lurgglbrAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); switch (pPlayer->GetTeam()) @@ -2126,7 +2126,7 @@ public: (me->HasAura(SPELL_AURA_NOTSOBIG_1) || me->HasAura(SPELL_AURA_NOTSOBIG_2) || me->HasAura(SPELL_AURA_NOTSOBIG_3) || me->HasAura(SPELL_AURA_NOTSOBIG_4))) { - Quest const* qInfo = objmgr.GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); if (qInfo) CAST_PLR(pKiller)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0],0); } diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index e9224e6365c..2b849cc3d12 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -252,7 +252,7 @@ public: if (quest->GetQuestId() == QUEST_A_RIGHTEOUS_SERMON) { DoScriptText(SAY_WP_0, pCreature, pPlayer); - if (npc_escortAI* pEscortAI = CAST_AI(npc_inquisitor_hallardAI, pCreature->AI())) + if (npc_escortAI* pEscortAI = CAST_AI(npc_inquisitor_hallard::npc_inquisitor_hallardAI, pCreature->AI())) { pEscortAI->Start(true, false, pPlayer->GetGUID(), 0, true); pCreature->GetMotionMaster()->MovePoint(0, 3801.543, -679.350, 213.75); diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 03bd63f6284..fcf0775f0c8 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -318,7 +318,7 @@ public: Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } - if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI()))) + if (npc_escortAI* pEscortAI = CAST_AI(npc_emily::npc_emilyAI, (pCreature->AI()))) pEscortAI->Start(true, false, pPlayer->GetGUID()); } return true; diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 5c846d71760..cd175d20797 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -430,7 +430,7 @@ public: { if (pQuest->GetQuestId() == QUEST_DISASTER) { - if (npc_engineer_heliceAI* pEscortAI = CAST_AI(npc_engineer_heliceAI, pCreature->AI())) + if (npc_engineer_heliceAI* pEscortAI = CAST_AI(npc_engineer_helice::npc_engineer_heliceAI, pCreature->AI())) { pCreature->GetMotionMaster()->MoveJumpTo(0, 0.4, 0.4); pCreature->setFaction(113); diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index aa6d7e9d9f2..715ec52d2e7 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -470,7 +470,7 @@ public: bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblinAI, pCreature->AI()); + npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblin::npc_injured_goblinAI, pCreature->AI()); if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index a11b886d65f..8d9cccd473c 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -1362,7 +1362,7 @@ public: { pPlayer->CLOSE_GOSSIP_MENU(); pCreature->CastSpell(pPlayer, SPELL_QUEST_CREDIT, true); - CAST_AI(npc_crusade_recruitAI, (pCreature->AI()))->m_uiPhase = 1; + CAST_AI(npc_crusade_recruit::npc_crusade_recruitAI, (pCreature->AI()))->m_uiPhase = 1; pCreature->SetInFront(pPlayer); pCreature->SendMovementFlagUpdate(); } |
