diff options
author | MitchesD <majklprofik@seznam.cz> | 2013-11-06 21:42:22 +0100 |
---|---|---|
committer | MitchesD <majklprofik@seznam.cz> | 2013-11-13 18:02:16 +0100 |
commit | 5b7b03fc16900b506b8a2ef9cc47e18a763501a2 (patch) | |
tree | 8d813c4ad5e6ccac8bd2b462f24950d0fbfd5173 | |
parent | df5a012f14a78eead3cecfbf13fdc80cb4f00203 (diff) |
Scripts/SunwellPlateau: reworked InstanceScript and applied codestyle
8 files changed, 831 insertions, 904 deletions
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index f1aa47df8f8..539bfb7831f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -44,7 +44,7 @@ enum Quotes YELL_MADR_INTRO = 1, YELL_MADR_ICE_BLOCK = 2, YELL_MADR_TRAP = 3, - YELL_MADR_DEATH = 4, + YELL_MADR_DEATH = 4 }; enum Spells @@ -61,18 +61,11 @@ enum Spells SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 }; -#define FELMYST 25038 - class boss_brutallus : public CreatureScript { public: boss_brutallus() : CreatureScript("boss_brutallus") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_brutallusAI(creature); - } - struct boss_brutallusAI : public ScriptedAI { boss_brutallusAI(Creature* creature) : ScriptedAI(creature) @@ -112,16 +105,14 @@ public: DoCast(me, SPELL_DUAL_WIELD, true); - if (instance) - instance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_BRUTALLUS, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE { Talk(YELL_AGGRO); - if (instance) - instance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_BRUTALLUS, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -133,13 +124,10 @@ public: { Talk(YELL_DEATH); - if (instance) - { - instance->SetData(DATA_BRUTALLUS_EVENT, DONE); - float x, y, z; - me->GetPosition(x, y, z); - me->SummonCreature(FELMYST, x, y, z+30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); - } + instance->SetBossState(DATA_BRUTALLUS, DONE); + float x, y, z; + me->GetPosition(x, y, z); + me->SummonCreature(NPC_FELMYST, x, y, z + 30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); } void EnterEvadeMode() OVERRIDE @@ -152,8 +140,8 @@ public: { if (!Intro || IsIntro) return; - Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0); - if (Madrigosa) + + if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA)) { Madrigosa->Respawn(); Madrigosa->setActive(true); @@ -166,7 +154,7 @@ public: } else { - //Madrigosa not found, end intro + // Madrigosa not found, end intro TC_LOG_ERROR("scripts", "Madrigosa was not found"); EndIntro(); } @@ -188,7 +176,7 @@ public: void DoIntro() { - Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0); + Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0); if (!Madrigosa) return; @@ -265,15 +253,16 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!me->IsValidAttackTarget(who)) return; - if (instance && Intro) - instance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); + + if (Intro) + instance->SetBossState(DATA_BRUTALLUS, SPECIAL); if (Intro && !IsIntro) StartIntro(); + if (!Intro) ScriptedAI::MoveInLineOfSight(who); } @@ -290,15 +279,17 @@ public: { if (IntroFrostBoltTimer <= diff) { - if (Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0)) + if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA)) { Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); IntroFrostBoltTimer = 2000; } } else IntroFrostBoltTimer -= diff; } + if (!UpdateVictim()) return; + DoMeleeAttackIfReady(); } @@ -341,6 +332,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_brutallusAI>(creature); + } }; void AddSC_boss_brutallus() diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 692f9ae5440..280b4c27770 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -15,12 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Eredar_Twins -SD%Complete: 100 -SDComment: -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "sunwell_plateau.h" @@ -48,35 +42,35 @@ enum Quotes YELL_ALY_DEAD = 6, YELL_SISTER_SACROLASH_DEAD = 7, YELL_CANFLAGRATION = 8, - YELL_BERSERK = 9, + YELL_BERSERK = 9 }; enum Spells { //Lady Sacrolash spells - SPELL_DARK_TOUCHED = 45347, - SPELL_SHADOW_BLADES = 45248, //10 secs - SPELL_DARK_STRIKE = 45271, - SPELL_SHADOW_NOVA = 45329, //30-35 secs - SPELL_CONFOUNDING_BLOW = 45256, //25 secs + SPELL_DARK_TOUCHED = 45347, + SPELL_SHADOW_BLADES = 45248, //10 secs + SPELL_DARK_STRIKE = 45271, + SPELL_SHADOW_NOVA = 45329, //30-35 secs + SPELL_CONFOUNDING_BLOW = 45256, //25 secs //Shadow Image spells - SPELL_SHADOW_FURY = 45270, - SPELL_IMAGE_VISUAL = 45263, + SPELL_SHADOW_FURY = 45270, + SPELL_IMAGE_VISUAL = 45263, //Misc spells - SPELL_ENRAGE = 46587, - SPELL_EMPOWER = 45366, - SPELL_DARK_FLAME = 45345, + SPELL_ENRAGE = 46587, + SPELL_EMPOWER = 45366, + SPELL_DARK_FLAME = 45345, //Grand Warlock Alythess spells - SPELL_PYROGENICS = 45230, //15secs - SPELL_FLAME_TOUCHED = 45348, - SPELL_CONFLAGRATION = 45342, //30-35 secs - SPELL_BLAZE = 45235, //on main target every 3 secs - SPELL_FLAME_SEAR = 46771, - SPELL_BLAZE_SUMMON = 45236, //187366 GO - SPELL_BLAZE_BURN = 45246 + SPELL_PYROGENICS = 45230, //15secs + SPELL_FLAME_TOUCHED = 45348, + SPELL_CONFLAGRATION = 45342, //30-35 secs + SPELL_BLAZE = 45235, //on main target every 3 secs + SPELL_FLAME_SEAR = 46771, + SPELL_BLAZE_SUMMON = 45236, //187366 GO + SPELL_BLAZE_BURN = 45246 }; class boss_sacrolash : public CreatureScript @@ -84,11 +78,6 @@ class boss_sacrolash : public CreatureScript public: boss_sacrolash() : CreatureScript("boss_sacrolash") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_sacrolashAI(creature); - }; - struct boss_sacrolashAI : public ScriptedAI { boss_sacrolashAI(Creature* creature) : ScriptedAI(creature) @@ -112,15 +101,12 @@ public: { Enraged = false; - if (instance) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS))) { - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ALYTHESS))) - { - if (temp->isDead()) - temp->Respawn(); - else if (temp->GetVictim()) - me->getThreatManager().addThreat(temp->GetVictim(), 0.0f); - } + if (temp->isDead()) + temp->Respawn(); + else if (temp->GetVictim()) + me->getThreatManager().addThreat(temp->GetVictim(), 0.0f); } if (!me->IsInCombat()) @@ -131,27 +117,21 @@ public: ShadowimageTimer = 20000; ConflagrationTimer = 30000; EnrageTimer = 360000; - SisterDeath = false; } - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_EREDAR_TWINS, NOT_STARTED); } void EnterCombat(Unit* who) OVERRIDE { DoZoneInCombat(); - if (instance) - { - Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)); - if (temp && temp->IsAlive() && !temp->GetVictim()) - temp->AI()->AttackStart(who); - } + Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)); + if (temp && temp->IsAlive() && !temp->GetVictim()) + temp->AI()->AttackStart(who); - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_EREDAR_TWINS, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -167,8 +147,7 @@ public: { Talk(YELL_SAC_DEAD); - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + instance->SetBossState(DATA_EREDAR_TWINS, DONE); } else me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); @@ -178,15 +157,15 @@ public: { switch (spell->Id) { - case SPELL_SHADOW_BLADES: - case SPELL_SHADOW_NOVA: - case SPELL_CONFOUNDING_BLOW: - case SPELL_SHADOW_FURY: - HandleTouchedSpells(target, SPELL_DARK_TOUCHED); - break; - case SPELL_CONFLAGRATION: - HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); - break; + case SPELL_SHADOW_BLADES: + case SPELL_SHADOW_NOVA: + case SPELL_CONFOUNDING_BLOW: + case SPELL_SHADOW_FURY: + HandleTouchedSpells(target, SPELL_DARK_TOUCHED); + break; + case SPELL_CONFLAGRATION: + HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); + break; } } @@ -194,26 +173,26 @@ public: { switch (TouchedType) { - case SPELL_FLAME_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_DARK_TOUCHED)) + case SPELL_FLAME_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_FLAME_TOUCHED, true); - } - break; - case SPELL_DARK_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_FLAME_TOUCHED)) + if (target->HasAura(SPELL_DARK_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } else target->CastSpell(target, SPELL_FLAME_TOUCHED, true); + } + break; + case SPELL_DARK_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } - break; + if (target->HasAura(SPELL_FLAME_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } + break; } } @@ -223,8 +202,7 @@ public: { if (instance) { - Unit* Temp = NULL; - Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); + Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); if (Temp && Temp->isDead()) { Talk(YELL_SISTER_ALYTHESS_DEAD); @@ -245,9 +223,7 @@ public: if (!me->IsNonMeleeSpellCasted(false)) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CONFLAGRATION); ConflagrationTimer = 30000+(rand()%5000); } @@ -259,8 +235,7 @@ public: { if (!me->IsNonMeleeSpellCasted(false)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_SHADOW_NOVA); @@ -279,9 +254,7 @@ public: { if (!me->IsNonMeleeSpellCasted(false)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CONFOUNDING_BLOW); ConfoundingblowTimer = 20000 + (rand()%5000); } @@ -297,7 +270,7 @@ public: temp = DoSpawnCreature(NPC_SHADOW_IMAGE, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 10000); if (temp && target) { - temp->AddThreat(target, 1000000);//don't change target(healers) + temp->AddThreat(target, 1000000); //don't change target(healers) temp->AI()->AttackStart(target); } } @@ -333,6 +306,11 @@ public: } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_sacrolashAI>(creature); + }; }; class boss_alythess : public CreatureScript @@ -340,11 +318,6 @@ class boss_alythess : public CreatureScript public: boss_alythess() : CreatureScript("boss_alythess") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_alythessAI(creature); - }; - struct boss_alythessAI : public ScriptedAI { boss_alythessAI(Creature* creature) : ScriptedAI(creature) @@ -376,7 +349,7 @@ public: if (instance) { - if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(DATA_SACROLASH))) + if (Creature* temp = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_SACROLASH))) { if (temp->isDead()) temp->Respawn(); @@ -398,23 +371,18 @@ public: SisterDeath = false; } - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_EREDAR_TWINS, NOT_STARTED); } void EnterCombat(Unit* who) OVERRIDE { DoZoneInCombat(); - if (instance) - { - Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); - if (temp && temp->IsAlive() && !temp->GetVictim()) - temp->AI()->AttackStart(who); - } + Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); + if (temp && temp->IsAlive() && !temp->GetVictim()) + temp->AI()->AttackStart(who); - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_EREDAR_TWINS, IN_PROGRESS); } void AttackStart(Unit* who) OVERRIDE @@ -424,7 +392,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!who || me->GetVictim()) return; @@ -441,17 +408,13 @@ public: } } else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30)) - { IntroStepCounter = 0; - } } void KilledUnit(Unit* /*victim*/) OVERRIDE { if (rand()%4 == 0) - { Talk(YELL_ALY_KILL); - } } void JustDied(Unit* /*killer*/) OVERRIDE @@ -459,9 +422,7 @@ public: if (SisterDeath) { Talk(YELL_ALY_DEAD); - - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + instance->SetBossState(DATA_EREDAR_TWINS, DONE); } else me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); @@ -471,16 +432,16 @@ public: { switch (spell->Id) { - case SPELL_BLAZE: - target->CastSpell(target, SPELL_BLAZE_SUMMON, true); - break; - case SPELL_CONFLAGRATION: - case SPELL_FLAME_SEAR: - HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); - break; - case SPELL_SHADOW_NOVA: - HandleTouchedSpells(target, SPELL_DARK_TOUCHED); - break; + case SPELL_BLAZE: + target->CastSpell(target, SPELL_BLAZE_SUMMON, true); + break; + case SPELL_CONFLAGRATION: + case SPELL_FLAME_SEAR: + HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); + break; + case SPELL_SHADOW_NOVA: + HandleTouchedSpells(target, SPELL_DARK_TOUCHED); + break; } } @@ -488,58 +449,68 @@ public: { switch (TouchedType) { - case SPELL_FLAME_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_DARK_TOUCHED)) - { - target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - }else + case SPELL_FLAME_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->CastSpell(target, SPELL_FLAME_TOUCHED, true); + if (target->HasAura(SPELL_DARK_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } + else + target->CastSpell(target, SPELL_FLAME_TOUCHED, true); } - } - break; - case SPELL_DARK_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_FLAME_TOUCHED)) + break; + case SPELL_DARK_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } - break; + if (target->HasAura(SPELL_FLAME_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } + else + target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } + break; } } uint32 IntroStep(uint32 step) { - Creature* Sacrolash = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_SACROLASH) : 0); + Creature* Sacrolash = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); switch (step) { - case 0: return 0; - case 1: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_1); - return 1000; - case 2: Talk(YELL_INTRO_ALY_2); return 1000; - case 3: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_3); - return 2000; - case 4: Talk(YELL_INTRO_ALY_4); return 1000; - case 5: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_5); - return 2000; - case 6: Talk(YELL_INTRO_ALY_6); return 1000; - case 7: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_7); - return 3000; - case 8: Talk(YELL_INTRO_ALY_8); return 900000; + case 0: + return 0; + case 1: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_1); + return 1000; + case 2: + Talk(YELL_INTRO_ALY_2); + return 1000; + case 3: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_3); + return 2000; + case 4: + Talk(YELL_INTRO_ALY_4); + return 1000; + case 5: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_5); + return 2000; + case 6: + Talk(YELL_INTRO_ALY_6); + return 1000; + case 7: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_7); + return 3000; + case 8: + Talk(YELL_INTRO_ALY_8); + return 900000; } return 10000; } @@ -556,30 +527,23 @@ public: if (!SisterDeath) { - if (instance) + Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); + if (Temp && Temp->isDead()) { - Unit* Temp = NULL; - Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); - if (Temp && Temp->isDead()) - { - Talk(YELL_SISTER_SACROLASH_DEAD); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; - } + Talk(YELL_SISTER_SACROLASH_DEAD); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; } } if (!me->GetVictim()) { - if (instance) + Creature* sisiter = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_SACROLASH)); + if (sisiter && !sisiter->isDead() && sisiter->GetVictim()) { - Creature* sisiter = Unit::GetCreature((*me), instance->GetData64(DATA_SACROLASH)); - if (sisiter && !sisiter->isDead() && sisiter->GetVictim()) - { - me->AddThreat(sisiter->GetVictim(), 0.0f); - DoStartNoMovement(sisiter->GetVictim()); - me->Attack(sisiter->GetVictim(), false); - } + me->AddThreat(sisiter->GetVictim(), 0.0f); + DoStartNoMovement(sisiter->GetVictim()); + me->Attack(sisiter->GetVictim(), false); } } @@ -592,9 +556,7 @@ public: { if (!me->IsNonMeleeSpellCasted(false)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_NOVA); ShadownovaTimer= 30000+(rand()%5000); } @@ -607,8 +569,7 @@ public: if (!me->IsNonMeleeSpellCasted(false)) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_CONFLAGRATION); ConflagrationTimer = 30000+(rand()%5000); @@ -661,6 +622,11 @@ public: } else EnrageTimer -= diff; } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_alythessAI>(creature); + }; }; class npc_shadow_image : public CreatureScript @@ -689,23 +655,23 @@ public: KillTimer = 15000; } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void SpellHitTarget(Unit* target, const SpellInfo* spell) OVERRIDE { switch (spell->Id) { - case SPELL_SHADOW_FURY: - case SPELL_DARK_STRIKE: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_FLAME_TOUCHED)) + case SPELL_SHADOW_FURY: + case SPELL_DARK_STRIKE: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } - break; + if (target->HasAura(SPELL_FLAME_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } + break; } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 561ba361f26..ca5dcf5360e 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -81,14 +81,14 @@ enum Spells //Other SPELL_BERSERK = 45078, SPELL_CLOUD_VISUAL = 45212, - SPELL_CLOUD_SUMMON = 45884, + SPELL_CLOUD_SUMMON = 45884 }; enum PhaseFelmyst { PHASE_NONE, PHASE_GROUND, - PHASE_FLIGHT, + PHASE_FLIGHT }; enum EventFelmyst @@ -104,7 +104,7 @@ enum EventFelmyst EVENT_FLIGHT_SEQUENCE, EVENT_SUMMON_DEAD, - EVENT_SUMMON_FOG, + EVENT_SUMMON_FOG }; class boss_felmyst : public CreatureScript @@ -112,11 +112,6 @@ class boss_felmyst : public CreatureScript public: boss_felmyst() : CreatureScript("boss_felmyst") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_felmystAI(creature); - } - struct boss_felmystAI : public ScriptedAI { boss_felmystAI(Creature* creature) : ScriptedAI(creature) @@ -148,8 +143,7 @@ public: DespawnSummons(NPC_VAPOR_TRAIL); me->setActive(false); - if (instance) - instance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); + instance->SetBossState(DATA_FELMYST, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -162,8 +156,7 @@ public: DoCast(me, AURA_NOXIOUS_FUMES, true); EnterPhase(PHASE_GROUND); - if (instance) - instance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_FELMYST, IN_PROGRESS); } void AttackStart(Unit* who) OVERRIDE @@ -173,7 +166,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (phase != PHASE_FLIGHT) ScriptedAI::MoveInLineOfSight(who); @@ -193,8 +185,7 @@ public: { Talk(YELL_DEATH); - if (instance) - instance->SetData(DATA_FELMYST_EVENT, DONE); + instance->SetBossState(DATA_FELMYST, DONE); } void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE @@ -246,26 +237,26 @@ public: { switch (NextPhase) { - case PHASE_GROUND: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - me->StopMoving(); - me->SetSpeed(MOVE_RUN, 2.0f); - - events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); - events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); - events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); - events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_FLIGHT, 60000); - break; - case PHASE_FLIGHT: - me->SetDisableGravity(true); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); - uiFlightCount = 0; - uiBreathCount = 0; - break; - default: - break; + case PHASE_GROUND: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + me->StopMoving(); + me->SetSpeed(MOVE_RUN, 2.0f); + + events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); + events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); + events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); + events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_FLIGHT, 60000); + break; + case PHASE_FLIGHT: + me->SetDisableGravity(true); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); + uiFlightCount = 0; + uiBreathCount = 0; + break; + default: + break; } phase = NextPhase; } @@ -274,133 +265,131 @@ public: { switch (uiFlightCount) { - case 0: - //me->AttackStop(); - me->GetMotionMaster()->Clear(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->StopMoving(); - Talk(YELL_TAKEOFF); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); - break; - case 1: - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); - break; - case 2: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!target) - target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!target) + case 0: + //me->AttackStop(); + me->GetMotionMaster()->Clear(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->StopMoving(); + Talk(YELL_TAKEOFF); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); + break; + case 1: + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); + break; + case 2: { - EnterEvadeMode(); - return; + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!target) + target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + + if (!target) + { + EnterEvadeMode(); + return; + } + + if (Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) + { + Vapor->AI()->AttackStart(target); + me->InterruptNonMeleeSpells(false); + DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug + Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; } - - Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (Vapor) + case 3: { - Vapor->AI()->AttackStart(target); - me->InterruptNonMeleeSpells(false); - DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug - Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + DespawnSummons(NPC_VAPOR_TRAIL); + //DoCast(me, SPELL_VAPOR_SELECT); need core support + + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!target) + target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + + if (!target) + { + EnterEvadeMode(); + return; + } + + //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support + if (Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) + { + if (pVapor->AI()) + pVapor->AI()->AttackStart(target); + me->InterruptNonMeleeSpells(false); + DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug + pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 3: - { - DespawnSummons(NPC_VAPOR_TRAIL); - //DoCast(me, SPELL_VAPOR_SELECT); need core support - - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!target) - target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!target) + case 4: + DespawnSummons(NPC_VAPOR_TRAIL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + break; + case 5: { - EnterEvadeMode(); - return; + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!target) + target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + + if (!target) + { + EnterEvadeMode(); + return; + } + + breathX = target->GetPositionX(); + breathY = target->GetPositionY(); + float x, y, z; + target->GetContactPoint(me, x, y, z, 70); + me->GetMotionMaster()->MovePoint(0, x, y, z+10); + break; } - - //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support - Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (pVapor) + case 6: + me->SetOrientation(me->GetAngle(breathX, breathY)); + me->StopMoving(); + //DoTextEmote("takes a deep breath.", NULL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; + case 7: { - if (pVapor->AI()) - pVapor->AI()->AttackStart(target); - me->InterruptNonMeleeSpells(false); - DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug - pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + DoCast(me, SPELL_FOG_BREATH, true); + float x, y, z; + me->GetPosition(x, y, z); + x = 2 * breathX - x; + y = 2 * breathY - y; + me->GetMotionMaster()->MovePoint(0, x, y, z); + events.ScheduleEvent(EVENT_SUMMON_FOG, 1); + break; } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 4: - DespawnSummons(NPC_VAPOR_TRAIL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - break; - case 5: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!target) - target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!target) - { - EnterEvadeMode(); - return; - } - - breathX = target->GetPositionX(); - breathY = target->GetPositionY(); - float x, y, z; - target->GetContactPoint(me, x, y, z, 70); - me->GetMotionMaster()->MovePoint(0, x, y, z+10); - break; - } - case 6: - me->SetOrientation(me->GetAngle(breathX, breathY)); - me->StopMoving(); - //DoTextEmote("takes a deep breath.", NULL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - case 7: - { - DoCast(me, SPELL_FOG_BREATH, true); - float x, y, z; - me->GetPosition(x, y, z); - x = 2 * breathX - x; - y = 2 * breathY - y; - me->GetMotionMaster()->MovePoint(0, x, y, z); - events.ScheduleEvent(EVENT_SUMMON_FOG, 1); - break; - } - case 8: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - ++uiBreathCount; - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - if (uiBreathCount < 3) - uiFlightCount = 4; - break; - case 9: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO)) - DoStartMovement(target); - else - { - EnterEvadeMode(); - return; - } - break; - case 10: - me->SetDisableGravity(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - EnterPhase(PHASE_GROUND); - AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); - break; + case 8: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + ++uiBreathCount; + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + if (uiBreathCount < 3) + uiFlightCount = 4; + break; + case 9: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO)) + DoStartMovement(target); + else + { + EnterEvadeMode(); + return; + } + break; + case 10: + me->SetDisableGravity(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + EnterPhase(PHASE_GROUND); + AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); + break; } ++uiFlightCount; } @@ -512,6 +501,11 @@ public: } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_felmystAI>(creature); + } }; class npc_felmyst_vapor : public CreatureScript @@ -531,12 +525,14 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetSpeed(MOVE_RUN, 0.8f); } + void Reset() OVERRIDE { } void EnterCombat(Unit* /*who*/) OVERRIDE { DoZoneInCombat(); //DoCast(me, SPELL_VAPOR_FORCE, true); core bug } + void UpdateAI(uint32 /*diff*/) OVERRIDE { if (!me->GetVictim()) @@ -565,6 +561,7 @@ public: me->SetTarget(me->GetGUID()); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01f); // core bug } + void Reset() OVERRIDE { } void EnterCombat(Unit* /*who*/) OVERRIDE { } void AttackStart(Unit* /*who*/) OVERRIDE { } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 9cd929981bf..2a2574ea256 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -44,7 +44,7 @@ enum Yells SAY_GOOD_AGGRO = 0, SAY_GOOD_NEAR_DEATH = 1, - SAY_GOOD_NEAR_DEATH2 = 2, + SAY_GOOD_NEAR_DEATH2 = 2 }; enum Spells @@ -76,20 +76,20 @@ enum Spells enum SWPActions { DO_ENRAGE = 1, - DO_BANISH = 2, + DO_BANISH = 2 }; #define GO_FAILED "You are unable to use this currently." #define EMOTE_UNABLE_TO_FIND "is unable to find Kalecgos" -#define FLY_X 1679 -#define FLY_Y 900 -#define FLY_Z 82 +#define FLY_X 1679 +#define FLY_Y 900 +#define FLY_Z 82 -#define CENTER_X 1705 -#define CENTER_Y 930 -#define RADIUS 30 +#define CENTER_X 1705 +#define CENTER_Y 930 +#define RADIUS 30 #define DRAGON_REALM_Z 53.079f #define DEMON_REALM_Z -74.558f @@ -103,11 +103,6 @@ class boss_kalecgos : public CreatureScript public: boss_kalecgos() : CreatureScript("boss_kalecgos") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_kalecgosAI(creature); - } - struct boss_kalecgosAI : public ScriptedAI { boss_kalecgosAI(Creature* creature) : ScriptedAI(creature) @@ -141,13 +136,10 @@ public: void Reset() OVERRIDE { - if (instance) - { - SathGUID = instance->GetData64(DATA_SATHROVARR); - instance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); - } + SathGUID = instance->GetData64(DATA_SATHROVARR); + instance->SetBossState(DATA_KALECGOS, NOT_STARTED); - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) Sath->AI()->EnterEvadeMode(); me->setFaction(14); @@ -158,7 +150,7 @@ public: me->SetVisible(true); me->SetStandState(UNIT_STAND_STATE_SLEEP); } - me->SetFullHealth();//dunno why it does not resets health at evade.. + me->SetFullHealth(); //dunno why it does not resets health at evade.. ArcaneBuffetTimer = 8000; FrostBreathTimer = 15000; WildMagicTimer = 10000; @@ -234,6 +226,7 @@ public: } else ResetTimer -= diff; return; } + if (!UpdateVictim()) return; @@ -246,13 +239,13 @@ public: } if (HealthBelowPct(10) && !isEnraged) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) Sath->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } if (!isBanished && HealthBelowPct(1)) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) { if (Sath->HasAura(SPELL_BANISH)) { @@ -317,6 +310,7 @@ public: SpectralBlastTimer = 1000; return; } + std::list<Unit*>::const_iterator i = targetList.begin(); advance(i, rand()%targetList.size()); if ((*i)) @@ -331,7 +325,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (bJustReset)//boss is invisible, don't attack return; @@ -356,8 +349,7 @@ public: Talk(SAY_EVIL_AGGRO); DoZoneInCombat(); - if (instance) - instance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_KALECGOS, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -396,21 +388,21 @@ public: { switch (TalkSequence) { - case 1: - me->setFaction(35); - TalkTimer = 1000; - break; - case 2: - Talk(SAY_GOOD_PLRWIN); - TalkTimer = 10000; - break; - case 3: - me->SetDisableGravity(true); - me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); - TalkTimer = 600000; - break; - default: - break; + case 1: + me->setFaction(35); + TalkTimer = 1000; + break; + case 2: + Talk(SAY_GOOD_PLRWIN); + TalkTimer = 10000; + break; + case 3: + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); + TalkTimer = 600000; + break; + default: + break; } } @@ -418,23 +410,28 @@ public: { switch (TalkSequence) { - case 1: - Talk(SAY_EVIL_ENRAGE); - TalkTimer = 3000; - break; - case 2: - me->SetDisableGravity(true); - me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); - TalkTimer = 15000; - break; - case 3: - EnterEvadeMode(); - break; - default: - break; + case 1: + Talk(SAY_EVIL_ENRAGE); + TalkTimer = 3000; + break; + case 2: + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); + TalkTimer = 15000; + break; + case 3: + EnterEvadeMode(); + break; + default: + break; } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_kalecgosAI>(creature); + } }; class boss_kalec : public CreatureScript @@ -490,6 +487,7 @@ public: { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) return; @@ -497,26 +495,26 @@ public: { switch (YellSequence) { - case 0: - Talk(SAY_GOOD_AGGRO); - ++YellSequence; - break; - case 1: - if (HealthBelowPct(50)) - { - Talk(SAY_GOOD_NEAR_DEATH); + case 0: + Talk(SAY_GOOD_AGGRO); ++YellSequence; - } - break; - case 2: - if (HealthBelowPct(10)) - { - Talk(SAY_GOOD_NEAR_DEATH2); - ++YellSequence; - } - break; - default: - break; + break; + case 1: + if (HealthBelowPct(50)) + { + Talk(SAY_GOOD_NEAR_DEATH); + ++YellSequence; + } + break; + case 2: + if (HealthBelowPct(10)) + { + Talk(SAY_GOOD_NEAR_DEATH2); + ++YellSequence; + } + break; + default: + break; } YellTimer = 5000; } @@ -610,11 +608,11 @@ public: if (instance) { KalecgosGUID = instance->GetData64(DATA_KALECGOS_DRAGON); - instance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_KALECGOS, NOT_STARTED); } if (KalecGUID) { - if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID)) + if (Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID)) Kalec->setDeathState(JUST_DIED); KalecGUID = 0; } @@ -654,7 +652,7 @@ public: if (target->GetGUID() == KalecGUID) { TeleportAllPlayersBack(); - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; @@ -670,14 +668,14 @@ public: Talk(SAY_SATH_DEATH); me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); TeleportAllPlayersBack(); - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; } if (instance) - instance->SetData(DATA_KALECGOS_EVENT, DONE); + instance->SetBossState(DATA_KALECGOS, DONE); } void TeleportAllPlayersBack() @@ -716,27 +714,28 @@ public: { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) return; if (CheckTimer <= diff) { - Creature* Kalec = Unit::GetCreature(*me, KalecGUID); + Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID); if (!Kalec || !Kalec->IsAlive()) { - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->EnterEvadeMode(); return; } if (HealthBelowPct(10) && !isEnraged) { - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } - Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID); + Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID); if (Kalecgos && !Kalecgos->IsInCombat()) { me->AI()->EnterEvadeMode(); @@ -778,7 +777,8 @@ public: if (ShadowBoltTimer <= diff) { - if (!(rand()%5))Talk(SAY_SATH_SPELL1); + if (!(rand()%5)) + Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); } else ShadowBoltTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index f1c0fd9cc83..b3982200a10 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -60,7 +60,7 @@ enum Yells SAY_ANVEENA_IMPRISONED = 0, SAY_ANVEENA_LOST = 1, SAY_ANVEENA_KALEC = 2, - SAY_ANVEENA_GOODBYE = 3, + SAY_ANVEENA_GOODBYE = 3 }; /*** Spells used during the encounter ***/ @@ -156,7 +156,7 @@ enum Phase PHASE_NORMAL = 2, // Kil'Jaeden emerges from the sunwell PHASE_DARKNESS = 3, // At 85%, he gains few abilities; Kalecgos joins the fight PHASE_ARMAGEDDON = 4, // At 55%, he gains even more abilities - PHASE_SACRIFICE = 5, // At 25%, Anveena sacrifices herself into the Sunwell; at this point he becomes enraged and has *significally* shorter cooldowns. + PHASE_SACRIFICE = 5 // At 25%, Anveena sacrifices herself into the Sunwell; at this point he becomes enraged and has *significally* shorter cooldowns. }; //Timers @@ -185,7 +185,7 @@ Position DeceiverLocations[3]= { {1682.045f, 631.299f, 5.936f, 0.0f}, {1684.099f, 618.848f, 0.589f, 0.0f}, - {1694.170f, 612.272f, 1.416f, 0.0f}, + {1694.170f, 612.272f, 1.416f, 0.0f} }; // Locations, where Shield Orbs will spawn @@ -225,7 +225,7 @@ static Speech Speeches[]= {SAY_KJ_PHASE5, DATA_KILJAEDEN, 5500}, // use in End sequence? - {SAY_KALECGOS_GOODBYE, DATA_KALECGOS_KJ, 12000}, + {SAY_KALECGOS_GOODBYE, DATA_KALECGOS_KJ, 12000} }; //AI for Kalecgos @@ -271,13 +271,13 @@ public: switch (index) { case 0: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); case 1: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); case 2: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); case 3: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); } return NULL; @@ -368,11 +368,11 @@ public: if (go->GetUInt32Value(GAMEOBJECT_FACTION) == 35) { InstanceScript* instance = go->GetInstanceScript(); - player->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); + player->SummonCreature(NPC_POWER_OF_THE_BLUE_DRAGONFLIGHT, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); go->SetUInt32Value(GAMEOBJECT_FACTION, 0); - if (Creature* pKalec = Unit::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ))) CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); go->Refresh(); @@ -425,7 +425,7 @@ public: phase = PHASE_DECEIVERS; if (instance) - if (Creature* pKalecKJ = Unit::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); deceiverDeathCount = 0; bSummonedDeceivers = false; @@ -438,15 +438,15 @@ public: { switch (summoned->GetEntry()) { - case CREATURE_HAND_OF_THE_DECEIVER: + case NPC_HAND_OF_THE_DECEIVER: summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); break; - case CREATURE_ANVEENA: + case NPC_ANVEENA: summoned->SetDisableGravity(true); summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); break; - case CREATURE_KILJAEDEN: + case NPC_KILJAEDEN: summoned->CastSpell(summoned, SPELL_REBIRTH, false); summoned->AddThreat(me->GetVictim(), 1.0f); break; @@ -458,7 +458,7 @@ public: { if (uiRandomSayTimer < diff) { - if (instance && instance->GetData(DATA_MURU_EVENT) != DONE && instance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) + if (instance && instance->GetBossState(DATA_MURU) != DONE && instance->GetBossState(DATA_KILJAEDEN) == NOT_STARTED) Talk(SAY_KJ_OFFCOMBAT); uiRandomSayTimer = 30000; } else uiRandomSayTimer -= diff; @@ -466,9 +466,9 @@ public: if (!bSummonedDeceivers) { for (uint8 i = 0; i < 3; ++i) - me->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); + me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); - DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); + DoSpawnCreature(NPC_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); DoCast(me, SPELL_ANVEENA_ENERGY_DRAIN); bSummonedDeceivers = true; } @@ -477,7 +477,7 @@ public: { me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); phase = PHASE_NORMAL; - DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + DoSpawnCreature(NPC_KILJAEDEN, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); } } }; @@ -489,11 +489,6 @@ class boss_kiljaeden : public CreatureScript public: boss_kiljaeden() : CreatureScript("boss_kiljaeden") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_kiljaedenAI(creature); - } - struct boss_kiljaedenAI : public ScriptedAI { boss_kiljaedenAI(Creature* creature) : ScriptedAI(creature), summons(me) @@ -559,11 +554,9 @@ public: OrbActivated = false; SpeechBegins = true; - if (instance) - { - if (Creature* pKalec = Unit::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) - pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - } + if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); ChangeTimers(false, 0); summons.DespawnAll(); @@ -590,7 +583,7 @@ public: void JustSummoned(Creature* summoned) OVERRIDE { - if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) + if (summoned->GetEntry() == NPC_ARMAGEDDON_TARGET) { summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -607,9 +600,7 @@ public: { Talk(SAY_KJ_DEATH); summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_KILJAEDEN_EVENT, DONE); + instance->SetBossState(DATA_KILJAEDEN, DONE); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -624,11 +615,8 @@ public: summons.DespawnAll(); // Reset the controller - if (instance) - { - if (Creature* pControl = Unit::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); - } + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -657,7 +645,7 @@ public: { float x, y, z; target->GetPosition(x, y, z); - if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (Creature* pSinisterReflection = me->SummonCreature(NPC_SINISTER_REFLECTION, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) { pSinisterReflection->SetDisplayId(target->GetDisplayId()); pSinisterReflection->AI()->AttackStart(target); @@ -709,15 +697,12 @@ public: if (Speeches[speechCount].timer < SpeechTimer) { SpeechTimer = 0; - if (instance) - { - if (Creature* speechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) - speechCreature->AI()->Talk(Speeches[speechCount].textid); - if (speechCount == 12) - if (Creature* pAnveena = Unit::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) - pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); - // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds - } + if (Creature* speechCreature = ObjectAccessor::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) + speechCreature->AI()->Talk(Speeches[speechCount].textid); + if (speechCount == 12) + if (Creature* pAnveena = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) + pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); + // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds if (speechCount == speechPhaseEnd) TimerIsDeactivated[TIMER_SPEECH]=true; speechCount++; @@ -769,7 +754,7 @@ public: float sx, sy; sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]); sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]); - me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + me->SummonCreature(NPC_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown Timer[TIMER_SOUL_FLAY] = 2000; @@ -814,19 +799,18 @@ public: } break; case TIMER_ORBS_EMPOWER: //Phase 3 - if (instance) - if (Creature* pKalec = Unit::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + { + switch (Phase) { - switch (Phase) - { case PHASE_SACRIFICE: CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); break; default: CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); break; - } } + } OrbActivated = true; TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; break; @@ -841,7 +825,7 @@ public: { float x, y, z; target->GetPosition(x, y, z); - me->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_ARMAGEDDON_TARGET, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); } Timer[TIMER_ARMAGEDDON] = 2000; // No, I'm not kidding break; @@ -893,6 +877,11 @@ public: } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_kiljaedenAI>(creature); + } }; //AI for Hand of the Deceiver @@ -901,11 +890,6 @@ class npc_hand_of_the_deceiver : public CreatureScript public: npc_hand_of_the_deceiver() : CreatureScript("npc_hand_of_the_deceiver") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_hand_of_the_deceiverAI(creature); - } - struct npc_hand_of_the_deceiverAI : public ScriptedAI { npc_hand_of_the_deceiverAI(Creature* creature) : ScriptedAI(creature) @@ -923,8 +907,7 @@ public: /// @todo Timers! ShadowBoltVolleyTimer = urand(8000, 14000); // So they don't all cast it in the same moment. FelfirePortalTimer = 20000; - if (instance) - instance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); + instance->SetBossState(DATA_KILJAEDEN, NOT_STARTED); } void JustSummoned(Creature* summoned) OVERRIDE @@ -935,12 +918,10 @@ public: void EnterCombat(Unit* who) OVERRIDE { - if (instance) - { - instance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); - if (Creature* pControl = Unit::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - pControl->AddThreat(who, 1.0f); - } + instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS); + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + pControl->AddThreat(who, 1.0f); + me->InterruptNonMeleeSpells(true); } @@ -949,7 +930,7 @@ public: if (!instance) return; - if (Creature* pControl = Unit::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) ++(CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); } @@ -977,7 +958,7 @@ public: // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. if (FelfirePortalTimer <= diff) { - if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + if (Creature* pPortal = DoSpawnCreature(NPC_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) { ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) @@ -993,6 +974,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<npc_hand_of_the_deceiverAI>(creature); + } }; //AI for Felfire Portal @@ -1034,7 +1020,7 @@ public: if (uiSpawnFiendTimer <= diff) { - if (Creature* pFiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + if (Creature* pFiend = DoSpawnCreature(NPC_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) pFiend->AddThreat(SelectTarget(SELECT_TARGET_RANDOM, 0), 100000.0f); uiSpawnFiendTimer = urand(4000, 8000); } else uiSpawnFiendTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index e36310f85b1..b91f2fadfc3 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -30,55 +30,56 @@ SDComment: all sounds, black hole effect triggers to often (46228) // Muru & Entropius's spells enum Spells { - SPELL_ENRAGE = 26662, + SPELL_ENRAGE = 26662, // Muru's spells SPELL_NEGATIVE_ENERGY = 46009, //(this trigger 46008) - SPELL_DARKNESS = 45999, - SPELL_OPEN_ALL_PORTALS = 46177, + SPELL_DARKNESS = 45999, + SPELL_OPEN_ALL_PORTALS = 46177, SPELL_OPEN_PORTAL = 45977, - SPELL_OPEN_PORTAL_2 = 45976, - SPELL_SUMMON_BERSERKER = 46037, - SPELL_SUMNON_FURY_MAGE = 46038, - SPELL_SUMMON_VOID_SENTINEL = 45988, - SPELL_SUMMON_ENTROPIUS = 46217, + SPELL_OPEN_PORTAL_2 = 45976, + SPELL_SUMMON_BERSERKER = 46037, + SPELL_SUMNON_FURY_MAGE = 46038, + SPELL_SUMMON_VOID_SENTINEL = 45988, + SPELL_SUMMON_ENTROPIUS = 46217, // Entropius's spells - SPELL_DARKNESS_E = 46269, - SPELL_BLACKHOLE = 46282, - SPELL_NEGATIVE_ENERGY_E = 46284, + SPELL_DARKNESS_E = 46269, + SPELL_BLACKHOLE = 46282, + SPELL_NEGATIVE_ENERGY_E = 46284, SPELL_ENTROPIUS_SPAWN = 46223, // Shadowsword Berserker's spells - SPELL_FLURRY = 46160, - SPELL_DUAL_WIELD = 29651, + SPELL_FLURRY = 46160, + SPELL_DUAL_WIELD = 29651, // Shadowsword Fury Mage's spells - SPELL_FEL_FIREBALL = 46101, - SPELL_SPELL_FURY = 46102, + SPELL_FEL_FIREBALL = 46101, + SPELL_SPELL_FURY = 46102, // Void Sentinel's spells - SPELL_SHADOW_PULSE = 46087, - SPELL_VOID_BLAST = 46161, + SPELL_SHADOW_PULSE = 46087, + SPELL_VOID_BLAST = 46161, // Void Spawn's spells - SPELL_SHADOW_BOLT_VOLLEY = 46082, + SPELL_SHADOW_BOLT_VOLLEY = 46082, //Dark Fiend Spells - SPELL_DARKFIEND_AOE = 45944, - SPELL_DARKFIEND_VISUAL = 45936, - SPELL_DARKFIEND_SKIN = 45934, + SPELL_DARKFIEND_AOE = 45944, + SPELL_DARKFIEND_VISUAL = 45936, + SPELL_DARKFIEND_SKIN = 45934, //Black Hole Spells SPELL_BLACKHOLE_SPAWN = 46242, - SPELL_BLACKHOLE_GROW = 46228 + SPELL_BLACKHOLE_GROW = 46228 }; -enum BossTimers{ - TIMER_DARKNESS = 0, - TIMER_HUMANOIDES = 1, - TIMER_PHASE = 2, - TIMER_SENTINEL = 3 +enum BossTimers +{ + TIMER_DARKNESS = 0, + TIMER_HUMANOIDES = 1, + TIMER_PHASE = 2, + TIMER_SENTINEL = 3 }; float DarkFiends[8][4] = @@ -88,32 +89,28 @@ float DarkFiends[8][4] = {1801.98f, 633.62f, 69.74f, 5.71f}, {1830.88f, 629.99f, 69.73f, 3.52f}, {1800.38f, 621.41f, 69.74f, 0.22f}, - {1808.3f, 612.45f, 69.73f, 1.02f}, - {1823.9f, 639.69f, 69.74f, 4.12f}, + {1808.3f, 612.45f, 69.73f, 1.02f}, + {1823.9f, 639.69f, 69.74f, 4.12f}, {1811.85f, 640.46f, 69.73f, 4.97f} }; float Humanoides[6][5] = { - {CREATURE_FURY_MAGE, 1780.16f, 666.83f, 71.19f, 5.21f}, - {CREATURE_FURY_MAGE, 1847.93f, 600.30f, 71.30f, 2.57f}, - {CREATURE_BERSERKER, 1779.97f, 660.64f, 71.19f, 5.28f}, - {CREATURE_BERSERKER, 1786.2f, 661.01f, 71.19f, 4.51f}, - {CREATURE_BERSERKER, 1845.17f, 602.63f, 71.28f, 2.43f}, - {CREATURE_BERSERKER, 1842.91f, 599.93f, 71.23f, 2.44f} + {NPC_FURY_MAGE, 1780.16f, 666.83f, 71.19f, 5.21f}, + {NPC_FURY_MAGE, 1847.93f, 600.30f, 71.30f, 2.57f}, + {NPC_BERSERKER, 1779.97f, 660.64f, 71.19f, 5.28f}, + {NPC_BERSERKER, 1786.2f, 661.01f, 71.19f, 4.51f}, + {NPC_BERSERKER, 1845.17f, 602.63f, 71.28f, 2.43f}, + {NPC_BERSERKER, 1842.91f, 599.93f, 71.23f, 2.44f} }; uint32 EnrageTimer = 600000; + class boss_entropius : public CreatureScript { public: boss_entropius() : CreatureScript("boss_entropius") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_entropiusAI(creature); - } - struct boss_entropiusAI : public ScriptedAI { boss_entropiusAI(Creature* creature) : ScriptedAI(creature), Summons(me) @@ -133,8 +130,7 @@ public: Summons.DespawnAll(); - if (instance) - instance->SetData(DATA_MURU_EVENT, NOT_STARTED); + instance->SetBossState(DATA_MURU, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -142,22 +138,21 @@ public: DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); DoCast(me, SPELL_ENTROPIUS_SPAWN, false); - if (instance) - instance->SetData(DATA_MURU_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_MURU, IN_PROGRESS); } void JustSummoned(Creature* summoned) OVERRIDE { switch (summoned->GetEntry()) { - case CREATURE_DARK_FIENDS: + case NPC_DARK_FIENDS: summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); break; - case CREATURE_DARKNESS: + case NPC_DARKNESS: summoned->AddUnitState(UNIT_STATE_STUNNED); float x, y, z, o; summoned->GetHomePosition(x, y, z, o); - me->SummonCreature(CREATURE_DARK_FIENDS, x, y, z, o, TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SummonCreature(NPC_DARK_FIENDS, x, y, z, o, TEMPSUMMON_CORPSE_DESPAWN, 0); break; } summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)); @@ -167,9 +162,7 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { Summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_MURU_EVENT, DONE); + instance->SetBossState(DATA_MURU, DONE); } void UpdateAI(uint32 diff) OVERRIDE @@ -201,6 +194,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_entropiusAI>(creature); + } }; class boss_muru : public CreatureScript @@ -208,11 +206,6 @@ class boss_muru : public CreatureScript public: boss_muru() : CreatureScript("boss_muru") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_muruAI(creature); - } - struct boss_muruAI : public ScriptedAI { boss_muruAI(Creature* creature) : ScriptedAI(creature), Summons(creature) @@ -244,17 +237,13 @@ public: me->SetVisible(true); Summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_MURU_EVENT, NOT_STARTED); + instance->SetBossState(DATA_MURU, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE { DoCastAOE(SPELL_NEGATIVE_ENERGY, false); - - if (instance) - instance->SetData(DATA_MURU_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_MURU, IN_PROGRESS); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE @@ -275,10 +264,10 @@ public: { switch (summoned->GetEntry()) { - case BOSS_ENTROPIUS: + case NPC_ENTROPIUS: me->SetVisible(false); break; - case CREATURE_DARK_FIENDS: + case NPC_DARK_FIENDS: summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); break; } @@ -295,9 +284,7 @@ public: { if (Timer[TIMER_PHASE] <= diff) { - if (!instance) - return; - switch (instance->GetData(DATA_MURU_EVENT)) + switch (instance->GetBossState(DATA_MURU)) { case NOT_STARTED: Reset(); @@ -334,7 +321,7 @@ public: { DarkFiend = false; for (uint8 j = 0; j < 8; ++j) - me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SummonCreature(NPC_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_DARKNESS] = 42000; } break; @@ -358,14 +345,21 @@ public: } } - //Timer + // Timer for (uint8 i = 0; i < 4; ++i) { - if (i != TIMER_PHASE)Timer[i] -= diff; - else if (Phase == 2) Timer[i] -= diff; + if (i != TIMER_PHASE) + Timer[i] -= diff; + else if (Phase == 2) + Timer[i] -= diff; } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_muruAI>(creature); + } }; class npc_muru_portal : public CreatureScript @@ -438,7 +432,7 @@ public: { if (!SummonSentinel) { - if (InAction && instance && instance->GetData(DATA_MURU_EVENT) == NOT_STARTED) + if (InAction && instance && instance->GetBossState(DATA_MURU) == NOT_STARTED) Reset(); return; } @@ -525,7 +519,7 @@ public: struct npc_void_sentinelAI : public ScriptedAI { - npc_void_sentinelAI(Creature* creature) : ScriptedAI(creature){ } + npc_void_sentinelAI(Creature* creature) : ScriptedAI(creature) { } uint32 PulseTimer; uint32 VoidBlastTimer; @@ -543,7 +537,7 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + me->SummonCreature(NPC_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); } void UpdateAI(uint32 diff) OVERRIDE diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 0f23cd67ab3..89b48fedee6 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,19 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Instance_Sunwell_Plateau -SD%Complete: 25 -SDComment: VERIFY SCRIPT -SDCategory: Sunwell_Plateau -EndScriptData */ - #include "ScriptMgr.h" #include "InstanceScript.h" -#include "sunwell_plateau.h" #include "Player.h" - -#define MAX_ENCOUNTER 6 +#include "sunwell_plateau.h" /* Sunwell Plateau: 0 - Kalecgos and Sathrovarr @@ -39,268 +29,256 @@ EndScriptData */ 5 - Kil'Jaeden */ -class instance_sunwell_plateau : public InstanceMapScript +DoorData const doorData[] = { -public: - instance_sunwell_plateau() : InstanceMapScript("instance_sunwell_plateau", 580) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_sunwell_plateau_InstanceMapScript(map); - } - - struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript - { - instance_sunwell_plateau_InstanceMapScript(Map* map) : InstanceScript(map) { } - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - /** Creatures **/ - uint64 Kalecgos_Dragon; - uint64 Kalecgos_Human; - uint64 Sathrovarr; - uint64 Brutallus; - uint64 Madrigosa; - uint64 Felmyst; - uint64 Alythess; - uint64 Sacrolash; - uint64 Muru; - uint64 KilJaeden; - uint64 KilJaedenController; - uint64 Anveena; - uint64 KalecgosKJ; - uint32 SpectralPlayers; - - /** GameObjects **/ - uint64 ForceField; // Kalecgos Encounter - uint64 KalecgosWall[2]; - uint64 FireBarrier; // Felmysts Encounter - uint64 MurusGate[2]; // Murus Encounter + { GO_FIRE_BARRIER, DATA_FELMYST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_MURUS_GATE_1, DATA_MURU, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_MURUS_GATE_2, DATA_MURU, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_BOSS_COLLISION_1, DATA_KALECGOS, DOOR_TYPE_DOOR, BOUNDARY_NONE }, + { GO_BOSS_COLLISION_2, DATA_KALECGOS, DOOR_TYPE_DOOR, BOUNDARY_NONE }, + { GO_FORCE_FIELD, DATA_KALECGOS, DOOR_TYPE_DOOR, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END +}; - /*** Misc ***/ - uint32 SpectralRealmTimer; - std::vector<uint64> SpectralRealmList; +class instance_sunwell_plateau : public InstanceMapScript +{ + public: + instance_sunwell_plateau() : InstanceMapScript(SunwellPlateauScriptName, 580) { } - void Initialize() OVERRIDE + struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - /*** Creatures ***/ - Kalecgos_Dragon = 0; - Kalecgos_Human = 0; - Sathrovarr = 0; - Brutallus = 0; - Madrigosa = 0; - Felmyst = 0; - Alythess = 0; - Sacrolash = 0; - Muru = 0; - KilJaeden = 0; - KilJaedenController = 0; - Anveena = 0; - KalecgosKJ = 0; - SpectralPlayers = 0; + instance_sunwell_plateau_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - /*** GameObjects ***/ - ForceField = 0; - FireBarrier = 0; - MurusGate[0] = 0; - MurusGate[1] = 0; - KalecgosWall[0] = 0; - KalecgosWall[1] = 0; + KalecgosDragonGUID = 0; + KalecgosHumanGUID = 0; + SathrovarrGUID = 0; + BrutallusGUID = 0; + MadrigosaGUID = 0; + FelmystGUID = 0; + AlythessGUID = 0; + SacrolashGUID = 0; + MuruGUID = 0; + KilJaedenGUID = 0; + KilJaedenControllerGUID = 0; + AnveenaGUID = 0; + KalecgosKjGUID = 0; + SpectralPlayers = 0; - /*** Misc ***/ - SpectralRealmTimer = 5000; - } + SpectralRealmTimer = 5000; + } - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + Player const* GetPlayerInMap() const + { + Map::PlayerList const& players = instance->GetPlayers(); - return false; - } + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* player = itr->GetSource(); + if (player && !player->HasAura(45839, 0)) + return player; + } + } + else + TC_LOG_DEBUG("scripts", "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - Player const* GetPlayerInMap() const - { - Map::PlayerList const& players = instance->GetPlayers(); + return NULL; + } - if (!players.isEmpty()) + void OnCreatureCreate(Creature* creature) OVERRIDE { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + switch (creature->GetEntry()) { - Player* player = itr->GetSource(); - if (player && !player->HasAura(45839, 0)) - return player; + case NPC_KALECGOS: + KalecgosDragonGUID = creature->GetGUID(); + break; + case NPC_KALEC: + KalecgosHumanGUID = creature->GetGUID(); + break; + case NPC_SATHROVARR: + SathrovarrGUID = creature->GetGUID(); + break; + case NPC_BRUTALLUS: + BrutallusGUID = creature->GetGUID(); + break; + case NPC_MADRIGOSA: + MadrigosaGUID = creature->GetGUID(); + break; + case NPC_FELMYST: + FelmystGUID = creature->GetGUID(); + break; + case NPC_GRAND_WARLOCK_ALYTHESS: + AlythessGUID = creature->GetGUID(); + break; + case NPC_LADY_SACROLASH: + SacrolashGUID = creature->GetGUID(); + break; + case NPC_MURU: + MuruGUID = creature->GetGUID(); + break; + case NPC_KILJAEDEN: + KilJaedenGUID = creature->GetGUID(); + break; + case NPC_KILJAEDEN_CONTROLLER: + KilJaedenControllerGUID = creature->GetGUID(); + break; + case NPC_ANVEENA: + AnveenaGUID = creature->GetGUID(); + break; + case NPC_KALECGOS_KJ: + KalecgosKjGUID = creature->GetGUID(); + break; + default: + break; } } - else - TC_LOG_DEBUG("scripts", "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - - return NULL; - } - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void OnGameObjectCreate(GameObject* go) OVERRIDE { - case 24850: Kalecgos_Dragon = creature->GetGUID(); break; - case 24891: Kalecgos_Human = creature->GetGUID(); break; - case 24892: Sathrovarr = creature->GetGUID(); break; - case 24882: Brutallus = creature->GetGUID(); break; - case 24895: Madrigosa = creature->GetGUID(); break; - case 25038: Felmyst = creature->GetGUID(); break; - case 25166: Alythess = creature->GetGUID(); break; - case 25165: Sacrolash = creature->GetGUID(); break; - case 25741: Muru = creature->GetGUID(); break; - case 25315: KilJaeden = creature->GetGUID(); break; - case 25608: KilJaedenController = creature->GetGUID(); break; - case 26046: Anveena = creature->GetGUID(); break; - case 25319: KalecgosKJ = creature->GetGUID(); break; + switch (go->GetEntry()) + { + case GO_FORCE_FIELD: + case GO_BOSS_COLLISION_1: + case GO_BOSS_COLLISION_2: + case GO_FIRE_BARRIER: + case GO_MURUS_GATE_1: + case GO_MURUS_GATE_2: + AddDoor(go, true); + break; + default: + break; + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void OnGameObjectRemove(GameObject* go) OVERRIDE { - case 188421: ForceField = go->GetGUID(); break; - case 188523: KalecgosWall[0] = go->GetGUID(); break; - case 188524: KalecgosWall[0] = go->GetGUID(); break; - case 188075: - if (m_auiEncounter[2] == DONE) - HandleGameObject(0, true, go); - FireBarrier = go->GetGUID(); - break; - case 187990: MurusGate[0] = go->GetGUID(); break; - case 188118: - if (m_auiEncounter[4] == DONE) - HandleGameObject(0, true, go); - MurusGate[1]= go->GetGUID(); - break; + switch (go->GetEntry()) + { + case GO_FIRE_BARRIER: + case GO_MURUS_GATE_1: + case GO_MURUS_GATE_2: + case GO_BOSS_COLLISION_1: + case GO_BOSS_COLLISION_2: + case GO_FORCE_FIELD: + AddDoor(go, false); + break; + default: + break; + } } - } - uint32 GetData(uint32 id) const OVERRIDE - { - switch (id) + uint64 GetData64(uint32 id) const OVERRIDE { - case DATA_KALECGOS_EVENT: return m_auiEncounter[0]; - case DATA_BRUTALLUS_EVENT: return m_auiEncounter[1]; - case DATA_FELMYST_EVENT: return m_auiEncounter[2]; - case DATA_EREDAR_TWINS_EVENT: return m_auiEncounter[3]; - case DATA_MURU_EVENT: return m_auiEncounter[4]; - case DATA_KILJAEDEN_EVENT: return m_auiEncounter[5]; + switch (id) + { + case DATA_KALECGOS_DRAGON: + return KalecgosDragonGUID; + case DATA_KALECGOS_HUMAN: + return KalecgosHumanGUID; + case DATA_SATHROVARR: + return SathrovarrGUID; + case DATA_BRUTALLUS: + return BrutallusGUID; + case DATA_MADRIGOSA: + return MadrigosaGUID; + case DATA_FELMYST: + return FelmystGUID; + case DATA_ALYTHESS: + return AlythessGUID; + case DATA_SACROLASH: + return SacrolashGUID; + case DATA_MURU: + return MuruGUID; + case DATA_KILJAEDEN: + return KilJaedenGUID; + case DATA_KILJAEDEN_CONTROLLER: + return KilJaedenControllerGUID; + case DATA_ANVEENA: + return AnveenaGUID; + case DATA_KALECGOS_KJ: + return KalecgosKjGUID; + case DATA_PLAYER_GUID: + { + Player const* target = GetPlayerInMap(); + return target ? target->GetGUID() : 0; + } + default: + break; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 id) const OVERRIDE - { - switch (id) + std::string GetSaveData() OVERRIDE { - case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; - case DATA_KALECGOS_HUMAN: return Kalecgos_Human; - case DATA_SATHROVARR: return Sathrovarr; - case DATA_GO_FORCEFIELD: return ForceField; - case DATA_BRUTALLUS: return Brutallus; - case DATA_MADRIGOSA: return Madrigosa; - case DATA_FELMYST: return Felmyst; - case DATA_ALYTHESS: return Alythess; - case DATA_SACROLASH: return Sacrolash; - case DATA_MURU: return Muru; - case DATA_KILJAEDEN: return KilJaeden; - case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; - case DATA_ANVEENA: return Anveena; - case DATA_KALECGOS_KJ: return KalecgosKJ; - case DATA_PLAYER_GUID: - Player const* target = GetPlayerInMap(); - return target ? target->GetGUID() : 0; + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "S P " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - return 0; - } - void SetData(uint32 id, uint32 data) OVERRIDE - { - switch (id) + void Load(char const* str) OVERRIDE { - case DATA_KALECGOS_EVENT: - { - if (data == NOT_STARTED || data == DONE) - { - HandleGameObject(ForceField, true); - HandleGameObject(KalecgosWall[0], true); - HandleGameObject(KalecgosWall[1], true); - } - else if (data == IN_PROGRESS) - { - HandleGameObject(ForceField, false); - HandleGameObject(KalecgosWall[0], false); - HandleGameObject(KalecgosWall[1], false); - } - m_auiEncounter[0] = data; - } - break; - case DATA_BRUTALLUS_EVENT: m_auiEncounter[1] = data; break; - case DATA_FELMYST_EVENT: - if (data == DONE) - HandleGameObject(FireBarrier, true); - m_auiEncounter[2] = data; break; - case DATA_EREDAR_TWINS_EVENT: m_auiEncounter[3] = data; break; - case DATA_MURU_EVENT: - switch (data) + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(str); + + char dataHead1, dataHead2; + + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; + + if (dataHead1 == 'S' && dataHead2 == 'P') + { + for (uint32 i = 0; i < EncounterCount; ++i) { - case DONE: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], true); - break; - case IN_PROGRESS: - HandleGameObject(MurusGate[0], false); - HandleGameObject(MurusGate[1], false); - break; - case NOT_STARTED: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], false); - break; + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); } - m_auiEncounter[4] = data; break; - case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; - } + } + else + OUT_LOAD_INST_DATA_FAIL; - if (data == DONE) - SaveToDB(); - } + OUT_LOAD_INST_DATA_COMPLETE; + } - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' - << m_auiEncounter[4] << ' ' << m_auiEncounter[5]; + protected: + uint64 KalecgosDragonGUID; + uint64 KalecgosHumanGUID; + uint64 SathrovarrGUID; + uint64 BrutallusGUID; + uint64 MadrigosaGUID; + uint64 FelmystGUID; + uint64 AlythessGUID; + uint64 SacrolashGUID; + uint64 MuruGUID; + uint64 KilJaedenGUID; + uint64 KilJaedenControllerGUID; + uint64 AnveenaGUID; + uint64 KalecgosKjGUID; + uint32 SpectralPlayers; - OUT_SAVE_INST_DATA_COMPLETE; - return stream.str(); - } + uint32 SpectralRealmTimer; + std::vector<uint64> SpectralRealmList; + }; - void Load(char const* in) OVERRIDE + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; + return new instance_sunwell_plateau_InstanceMapScript(map); } - }; }; void AddSC_instance_sunwell_plateau() diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h index 343720dbdb1..d2025a7b2b9 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,94 +15,105 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef DEF_SUNWELLPLATEAU_H -#define DEF_SUNWELLPLATEAU_H +#ifndef SUNWELL_PLATEAU_H +#define SUNWELL_PLATEAU_H -/*** Encounters ***/ -enum Data -{ - DATA_KALECGOS_EVENT, - DATA_BRUTALLUS_EVENT, - DATA_FELMYST_EVENT, - DATA_EREDAR_TWINS_EVENT, - DATA_MURU_EVENT, - DATA_KILJAEDEN_EVENT, -}; +#define SunwellPlateauScriptName "instance_sunwell_plateau" + +uint32 const EncounterCount = 6; -enum Data64 +enum DataTypes { - /*** Creatures ***/ + // Encounter States/Boss GUIDs + DATA_KALECGOS = 0, + DATA_BRUTALLUS = 1, + DATA_FELMYST = 2, + DATA_EREDAR_TWINS = 3, + DATA_MURU = 4, + DATA_KILJAEDEN = 5, + DATA_KALECGOS_DRAGON, DATA_KALECGOS_HUMAN, DATA_SATHROVARR, - DATA_BRUTALLUS, DATA_MADRIGOSA, - DATA_FELMYST, DATA_ALYTHESS, DATA_SACROLASH, - DATA_MURU, - DATA_KILJAEDEN, DATA_KILJAEDEN_CONTROLLER, DATA_ANVEENA, DATA_KALECGOS_KJ, - /*** GameObjects ***/ - DATA_GO_FORCEFIELD, + // GameObject GUIDs DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1, DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2, DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3, DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4, - /*** Misc ***/ - DATA_PLAYER_GUID, + // Misc + DATA_PLAYER_GUID }; -enum Creatures +enum CreatureIds { - BOSS_MURU = 25741, - BOSS_ENTROPIUS = 25840, - NPC_KALECGOS = 24850, - NPC_KALEC = 24891, - NPC_SATHROVARR = 24892, + NPC_MURU = 25741, + NPC_ENTROPIUS = 25840, + NPC_KALECGOS = 24850, + NPC_KALEC = 24891, + NPC_SATHROVARR = 24892, + NPC_BRUTALLUS = 24882, + NPC_MADRIGOSA = 24895, + NPC_FELMYST = 25038, - NPC_DEAD = 25268, - NPC_FLIGHT_LEFT = 25357, - NPC_FLIGHT_RIGHT = 25358, - NPC_DEATH_CLOUD = 25703, - NPC_VAPOR = 25265, - NPC_VAPOR_TRAIL = 25267, + NPC_DEAD = 25268, + NPC_FLIGHT_LEFT = 25357, + NPC_FLIGHT_RIGHT = 25358, + NPC_DEATH_CLOUD = 25703, + NPC_VAPOR = 25265, + NPC_VAPOR_TRAIL = 25267, - NPC_GRAND_WARLOCK_ALYTHESS = 25166, - NPC_SHADOW_IMAGE = 25214, - NPC_LADY_SACROLASH = 25165, + NPC_GRAND_WARLOCK_ALYTHESS = 25166, + NPC_SHADOW_IMAGE = 25214, + NPC_LADY_SACROLASH = 25165, - CREATURE_ANVEENA = 26046, // Embodiment of the Sunwell - CREATURE_KALECGOS = 25319, // Helps the raid throughout the fight - CREATURE_PROPHET = 26246, // Outro - CREATURE_KILJAEDEN = 25315, // Give it to 'em KJ! - CREATURE_HAND_OF_THE_DECEIVER = 25588, // Adds found before KJ emerges - CREATURE_FELFIRE_PORTAL = 25603, // Portal spawned be Hand of the Deceivers - CREATURE_VOLATILE_FELFIRE_FIEND = 25598, // Fiends spawned by the above portal - CREATURE_ARMAGEDDON_TARGET = 25735, // This mob casts meteor on itself.. I think - CREATURE_SHIELD_ORB = 25502, // Shield orbs circle the room raining shadow bolts on raid - CREATURE_THE_CORE_OF_ENTROPIUS = 26262, // Used in the ending cinematic? - CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT = 25653, // NPC that players possess when using the Orb of the Blue Dragonflight - CREATURE_SPIKE_TARGET1 = 30598, // Should summon these under Shadow Spike Channel on targets place - CREATURE_SPIKE_TARGET2 = 30614, - CREATURE_SINISTER_REFLECTION = 25708, // Sinister Relection spawnd on Phase swichtes + NPC_ANVEENA = 26046, // Embodiment of the Sunwell + NPC_KALECGOS_KJ = 25319, // Helps the raid throughout the fight + NPC_PROPHET = 26246, // Outro + NPC_KILJAEDEN = 25315, // Give it to 'em KJ! + NPC_KILJAEDEN_CONTROLLER = 25608, + NPC_HAND_OF_THE_DECEIVER = 25588, // Adds found before KJ emerges + NPC_FELFIRE_PORTAL = 25603, // Portal spawned be Hand of the Deceivers + NPC_VOLATILE_FELFIRE_FIEND = 25598, // Fiends spawned by the above portal + NPC_ARMAGEDDON_TARGET = 25735, // This mob casts meteor on itself.. I think + NPC_SHIELD_ORB = 25502, // Shield orbs circle the room raining shadow bolts on raid + NPC_THE_CORE_OF_ENTROPIUS = 26262, // Used in the ending cinematic? + NPC_POWER_OF_THE_BLUE_DRAGONFLIGHT = 25653, // NPC that players possess when using the Orb of the Blue Dragonflight + NPC_SPIKE_TARGET1 = 30598, // Should summon these under Shadow Spike Channel on targets place + NPC_SPIKE_TARGET2 = 30614, + NPC_SINISTER_REFLECTION = 25708, // Sinister Relection spawnd on Phase swichtes - CREATURE_DARKNESS = 25879, - CREATURE_DARK_FIENDS = 25744, - CREATURE_BERSERKER = 25798, - CREATURE_FURY_MAGE = 25799, - CREATURE_VOID_SENTINEL = 25772, - CREATURE_VOID_SPAWN = 25824, - CREATURE_BLACK_HOLE = 25855, + NPC_DARKNESS = 25879, + NPC_DARK_FIENDS = 25744, + NPC_BERSERKER = 25798, + NPC_FURY_MAGE = 25799, + NPC_VOID_SENTINEL = 25772, + NPC_VOID_SPAWN = 25824, + NPC_BLACK_HOLE = 25855 }; -enum GameObjects +enum GameObjectIds { - GAMEOBJECT_ORB_OF_THE_BLUE_DRAGONFLIGHT = 188415, + GO_ORB_OF_THE_BLUE_DRAGONFLIGHT = 188415, + GO_FORCE_FIELD = 188421, + GO_BOSS_COLLISION_1 = 188523, + GO_BOSS_COLLISION_2 = 188524, + GO_FIRE_BARRIER = 188075, + GO_MURUS_GATE_1 = 187990, + GO_MURUS_GATE_2 = 188118 }; -#endif +template<class AI> +AI* GetSunwellPlateauAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, SunwellPlateauScriptName); +} + +#endif // SUNWELL_PLATEAU_H |