aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp6
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp13
-rwxr-xr-xsrc/server/game/Scripting/ScriptLoader.cpp2
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp13
-rwxr-xr-xsrc/server/game/Spells/SpellScript.cpp2
-rwxr-xr-xsrc/server/game/Spells/SpellScript.h2
-rw-r--r--src/server/scripts/CMakeLists.txt1
-rw-r--r--src/server/scripts/Northrend/CMakeLists.txt2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp376
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp1374
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp270
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h229
12 files changed, 1807 insertions, 483 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index a7b57c7323c..ed89041ff66 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -796,10 +796,12 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
//! Need to be called after LoadCreaturesAddon - MOVEMENTFLAG_HOVER is set there
if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER))
+ {
z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
- //! Relocate again with updated Z coord
- Relocate(x, y, z, ang);
+ //! Relocate again with updated Z coord
+ Relocate(x, y, z, ang);
+ }
uint32 displayID = GetNativeDisplayId();
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 141902fbbdc..7c70fe9358e 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -9217,6 +9217,9 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 4100: // The Culling of Stratholme
NumberOfFields = 13;
break;
+ case 4273: // Ulduar
+ NumberOfFields = 10;
+ break;
default:
NumberOfFields = 12;
break;
@@ -9761,6 +9764,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW
}
break;
+ // Ulduar
+ case 4273:
+ if (instance && mapid == 603)
+ instance->FillInitialWorldStates(data);
+ else
+ {
+ data << uint32(4132) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES
+ data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED
+ }
+ break;
default:
data << uint32(0x914) << uint32(0x0); // 7
data << uint32(0x913) << uint32(0x0); // 8
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 76c3f1c073c..476b0082617 100755
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -425,6 +425,7 @@ void AddSC_ulduar_teleporter();
void AddSC_boss_mimiron();
void AddSC_boss_hodir();
void AddSC_boss_freya();
+void AddSC_boss_algalon_the_observer();
void AddSC_instance_ulduar();
void AddSC_boss_keleseth(); //Utgarde Keep
void AddSC_boss_skarvald_dalronn();
@@ -1129,6 +1130,7 @@ void AddNorthrendScripts()
AddSC_boss_mimiron();
AddSC_boss_hodir();
AddSC_boss_freya();
+ AddSC_boss_algalon_the_observer();
AddSC_instance_ulduar();
AddSC_boss_keleseth(); //Utgarde Keep
AddSC_boss_skarvald_dalronn();
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 05431ef0a16..3de87790be9 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -3298,6 +3298,19 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY;
spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY;
break;
+ case 62301: // Cosmic Smash (Algalon the Observer)
+ spellInfo->MaxAffectedTargets = 1;
+ break;
+ case 64598: // Cosmic Smash (Algalon the Observer)
+ spellInfo->MaxAffectedTargets = 3;
+ break;
+ case 62293: // Cosmic Smash (Algalon the Observer)
+ spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_CASTER;
+ break;
+ case 62311: // Cosmic Smash (Algalon the Observer)
+ case 64596: // Cosmic Smash (Algalon the Observer)
+ spellInfo->rangeIndex = 6; // 100yd
+ break;
// ENDOF ULDUAR SPELLS
//
// TRIAL OF THE CRUSADER SPELLS
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index df1640df1b7..44a2dd4dedb 100755
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -403,7 +403,7 @@ GameObject* SpellScript::GetHitGObj()
return m_spell->gameObjTarget;
}
-WorldLocation const* SpellScript::GetHitDest()
+WorldLocation* SpellScript::GetHitDest()
{
if (!IsInEffectHook())
{
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index e84a56c8dbb..26393040a1e 100755
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -325,7 +325,7 @@ class SpellScript : public _SpellScript
// returns: target of current effect if it was GameObject otherwise NULL
GameObject* GetHitGObj();
// returns: destination of current effect
- WorldLocation const* GetHitDest();
+ WorldLocation* GetHitDest();
// setter/getter for for damage done by spell to target of spell hit
// returns damage calculated before hit, and real dmg done after hit
int32 GetHitDamage();
diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt
index f0136b065e8..792fdeb3e7b 100644
--- a/src/server/scripts/CMakeLists.txt
+++ b/src/server/scripts/CMakeLists.txt
@@ -119,6 +119,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Maps
${CMAKE_SOURCE_DIR}/src/server/game/Movement
${CMAKE_SOURCE_DIR}/src/server/game/Movement/MovementGenerators
+ ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline
${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints
${CMAKE_SOURCE_DIR}/src/server/game/Opcodes
${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP
diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
index 31aa924365d..3502e7fb104 100644
--- a/src/server/scripts/Northrend/CMakeLists.txt
+++ b/src/server/scripts/Northrend/CMakeLists.txt
@@ -22,7 +22,7 @@ set(scripts_STAT_SRCS
Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
Northrend/Ulduar/Ulduar/boss_thorim.cpp
Northrend/Ulduar/Ulduar/boss_ignis.cpp
- Northrend/Ulduar/Ulduar/boss_algalon.cpp
+ Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
Northrend/Ulduar/Ulduar/instance_ulduar.cpp
Northrend/Ulduar/Ulduar/boss_auriaya.cpp
Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp
deleted file mode 100644
index 2dd13e7ce07..00000000000
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "ulduar.h"
-
-#define GAMEOBJECT_GIVE_OF_THE_OBSERVER 194821
-
-enum Spells
-{
- SPELL_ASCEND = 64487,
- SPELL_BERSERK = 47008,
- SPELL_BIG_BANG = 64443,
- H_SPELL_BIG_BANG = 64584,
- SPELL_COSMIC_SMASH = 62301,
- H_SPELL_COSMIC_SMASH = 64598,
- SPELL_PHASE_PUNCH = 64412,
- SPELL_QUANTUM_STRIKE = 64395,
- H_SPELL_QUANTUM_STRIKE = 64592,
- SPELL_BLACK_HOLE_EXPLOSION = 64122,
- SPELL_ARCANE_BARAGE = 64599,
- H_SPELL_ARCANE_BARAGE = 64607
-};
-
-enum Creatures
-{
- CREATURE_COLLAPSING_STAR = 32955,
- CREATURE_BLACK_HOLE = 32953,
- CREATURE_LIVING_CONSTELLATION = 33052,
- CREATURE_DARK_MATTER = 33089
-};
-
-enum Yells
-{
- SAY_AGGRO = -1603000,
- SAY_SLAY_1 = -1603001,
- SAY_SLAY_2 = -1603002,
- SAY_ENGADED_FOR_FIRTS_TIME = -1603003,
- SAY_PHASE_2 = -1603004,
- SAY_SUMMON_COLLAPSING_STAR = -1603005,
- SAY_DEATH_1 = -1603006,
- SAY_DEATH_2 = -1603007,
- SAY_DEATH_3 = -1603008,
- SAY_DEATH_4 = -1603009,
- SAY_DEATH_5 = -1603010,
- SAY_BERSERK = -1603011,
- SAY_BIG_BANG_1 = -1603012,
- SAY_BIG_BANG_2 = -1603013,
- SAY_TIMER_1 = -1603014,
- SAY_TIMER_2 = -1603015,
- SAY_TIMER_3 = -1603016,
- SAY_SUMMON_1 = -1603017,
- SAY_SUMMON_2 = -1603018,
- SAY_SUMMON_3 = -1603019,
-};
-
-class boss_algalon : public CreatureScript
-{
-public:
- boss_algalon() : CreatureScript("boss_algalon") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return GetUlduarAI<boss_algalonAI>(creature);
- }
-
- struct boss_algalonAI : public ScriptedAI
- {
- boss_algalonAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- Summon = false; // not in reset. intro speech done only once.
- }
-
- InstanceScript* instance;
-
- 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)
- {
- if (Summon)
- {
- 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 (instance)
- instance->SetData(BOSS_ALGALON, IN_PROGRESS);
- }
-
- void KilledUnit(Unit* /*victim*/)
- {
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
- }
-
- void Reset()
- {
- Phase = 1;
-
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (instance)
- instance->SetData(BOSS_ALGALON, NOT_STARTED);
-
- BlackHoleGUID = 0;
-
- uiPhase_timer = 0;
- Ascend_Timer = 480000; //8 minutes
- QuantumStrike_Timer = urand(4000, 14000);
- 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;
- }
-
- void JumpToNextStep(uint32 uiTimer)
- {
- uiPhase_timer = uiTimer;
- ++uiStep;
- }
-
- void DespawnCollapsingStar()
- {
- if (m_lCollapsingStarGUIDList.empty())
- return;
-
- for (std::list<uint64>::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr)
- {
- if (Creature* temp = Unit::GetCreature(*me, *itr))
- {
- if (temp->isAlive())
- temp->DespawnOrUnsummon();
- }
- }
- m_lCollapsingStarGUIDList.clear();
- }
-
- void JustSummoned(Creature* summoned)
- {
- if (summoned->GetEntry() == CREATURE_COLLAPSING_STAR)
- {
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (me->getVictim())
- summoned->AI()->AttackStart(target ? target : me->getVictim());
- m_lCollapsingStarGUIDList.push_back(summoned->GetGUID());
- }
- }
-
- void SummonCollapsingStar(Unit* target)
- {
- DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me);
- me->SummonCreature(CREATURE_COLLAPSING_STAR, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100000);
- me->SummonCreature(CREATURE_BLACK_HOLE, target->GetPositionX()+15.0f, target->GetPositionY()+15.0f, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 27000);
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- if (Phase == 1 && HealthBelowPct(20))
- {
- Phase = 2;
- DoScriptText(SAY_PHASE_2, me);
- }
-
- if (HealthBelowPct(2))
- {
- me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667f, -295.101166f, 417.321381f, 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 (instance)
- instance->SetData(BOSS_ALGALON, DONE);
-
- return;
- }
-
- if (Phase == 1)
- {
- 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;
-
- 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;
-
- if (Ascend_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_ASCEND, true);
-
- Ascend_Timer = 480000;
- } else Ascend_Timer -= diff;
-
- if (PhasePunch_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_PHASE_PUNCH, true);
-
- PhasePunch_Timer = 8000;
- } else PhasePunch_Timer -= diff;
-
- if (CosmicSmash_Timer <= diff)
- {
- DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH, H_SPELL_COSMIC_SMASH), true);
-
- CosmicSmash_Timer = urand(30000, 60000);
- } else CosmicSmash_Timer -= diff;
-
- if (Berserk_Timer <= diff)
- {
- DoScriptText(SAY_BERSERK, me);
- DoCast(me->getVictim(), SPELL_BERSERK, true);
-
- Berserk_Timer = 360000;
- } else Berserk_Timer -= diff;
-
- DoMeleeAttackIfReady();
-
- EnterEvadeIfOutOfCombatArea(diff);
- }
-
- if (Phase == 2)
- {
- if (Enrage)
- {
- if (Ascend_Timer <= diff)
- {
- DoCast(me, SPELL_ASCEND);
- DoScriptText(SAY_BERSERK, me);
- Ascend_Timer = urand(360000, 365000);
- Enrage = false;
- } else Ascend_Timer -= diff;
- }
- }
-
- DoMeleeAttackIfReady();
- }
- };
-
-};
-
-//Collapsing Star
-class mob_collapsing_star : public CreatureScript
-{
-public:
- mob_collapsing_star() : CreatureScript("mob_collapsing_star") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_collapsing_starAI(creature);
- }
-
- struct mob_collapsing_starAI : public ScriptedAI
- {
- mob_collapsing_starAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- }
-
- InstanceScript* instance;
-
- uint32 BlackHoleExplosion_Timer;
-
- void Reset()
- {
- BlackHoleExplosion_Timer = 0;
- }
-
- 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;
- }
- };
-
-};
-
-void AddSC_boss_Algalon()
-{
- new boss_algalon();
- new mob_collapsing_star();
-}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
new file mode 100644
index 00000000000..4465fc08792
--- /dev/null
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -0,0 +1,1374 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ObjectMgr.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GameObjectAI.h"
+#include "MapManager.h"
+#include "MoveSplineInit.h"
+#include "ulduar.h"
+
+enum Texts
+{
+ SAY_BRANN_ALGALON_INTRO_1 = 0,
+ SAY_BRANN_ALGALON_INTRO_2 = 1,
+ SAY_BRANN_ALGALON_OUTRO = 2,
+
+ SAY_ALGALON_INTRO_1 = 0,
+ SAY_ALGALON_INTRO_2 = 1,
+ SAY_ALGALON_INTRO_3 = 2,
+ SAY_ALGALON_START_TIMER = 3,
+ SAY_ALGALON_AGGRO = 4,
+ SAY_ALGALON_COLLAPSING_STAR = 5,
+ EMOTE_ALGALON_COLLAPSING_STAR = 6,
+ SAY_ALGALON_BIG_BANG = 7,
+ EMOTE_ALGALON_BIG_BANG = 8,
+ SAY_ALGALON_ASCEND = 9,
+ EMOTE_ALGALON_COSMIC_SMASH = 10,
+ SAY_ALGALON_PHASE_TWO = 11,
+ SAY_ALGALON_OUTRO_1 = 12,
+ SAY_ALGALON_OUTRO_2 = 13,
+ SAY_ALGALON_OUTRO_3 = 14,
+ SAY_ALGALON_OUTRO_4 = 15,
+ SAY_ALGALON_OUTRO_5 = 16,
+ SAY_ALGALON_DESPAWN_1 = 17,
+ SAY_ALGALON_DESPAWN_2 = 18,
+ SAY_ALGALON_DESPAWN_3 = 19,
+ SAY_ALGALON_KILL = 20,
+};
+
+enum Spells
+{
+ // Algalon the Observer
+ SPELL_ARRIVAL = 64997,
+ SPELL_RIDE_THE_LIGHTNING = 64986,
+ SPELL_SUMMON_AZEROTH = 64994,
+ SPELL_REORIGINATION = 64996,
+ SPELL_SUPERMASSIVE_FAIL = 65311,
+ SPELL_QUANTUM_STRIKE = 64395,
+ SPELL_PHASE_PUNCH = 64412,
+ SPELL_BIG_BANG = 64443,
+ SPELL_ASCEND_TO_THE_HEAVENS = 64487,
+ SPELL_COSMIC_SMASH = 62301,
+ SPELL_COSMIC_SMASH_TRIGGERED = 62304,
+ SPELL_COSMIC_SMASH_VISUAL_STATE = 62300,
+ SPELL_SELF_STUN = 65256,
+ SPELL_KILL_CREDIT = 65184,
+ SPELL_TELEPORT = 62940,
+
+ // Algalon Stalker
+ SPELL_TRIGGER_3_ADDS = 62266, // Triggers Living Constellation
+
+ // Living Constellation
+ SPELL_ARCANE_BARRAGE = 64599,
+
+ // Collapsing Star
+ SPELL_COLLAPSE = 62018,
+ SPELL_BLACK_HOLE_SPAWN_VISUAL = 62003,
+ SPELL_SUMMON_BLACK_HOLE = 62189,
+
+ // Black Hole
+ SPELL_BLACK_HOLE_TRIGGER = 62185,
+ SPELL_CONSTELLATION_PHASE_TRIGGER = 65508,
+ SPELL_CONSTELLATION_PHASE_EFFECT = 65509,
+ SPELL_BLACK_HOLE_EXPLOSION = 64122,
+ SPELL_SUMMON_VOID_ZONE_VISUAL = 64470,
+ SPELL_VOID_ZONE_VISUAL = 64469,
+ SPELL_BLACK_HOLE_CREDIT = 65312,
+
+ // Worm Hole
+ SPELL_WORM_HOLE_TRIGGER = 65251,
+ SPELL_SUMMON_UNLEASHED_DARK_MATTER = 64450,
+};
+
+uint32 const PhasePunchAlphaId[5] = {64435, 64434, 64428, 64421, 64417};
+
+enum Events
+{
+ // Celestial Planetarium Access
+ EVENT_DESPAWN_CONSOLE = 1,
+
+ // Brann Bronzebeard
+ EVENT_BRANN_MOVE_INTRO = 2,
+ EVENT_SUMMON_ALGALON = 3,
+ EVENT_BRANN_OUTRO_1 = 4,
+ EVENT_BRANN_OUTRO_2 = 5,
+
+ // Algalon the Observer
+ EVENT_INTRO_1 = 6,
+ EVENT_INTRO_2 = 7,
+ EVENT_INTRO_3 = 8,
+ EVENT_INTRO_FINISH = 9,
+ EVENT_START_COMBAT = 10,
+ EVENT_INTRO_TIMER_DONE = 11,
+ EVENT_QUANTUM_STRIKE = 12,
+ EVENT_PHASE_PUNCH = 13,
+ EVENT_SUMMON_COLLAPSING_STAR = 14,
+ EVENT_BIG_BANG = 15,
+ EVENT_RESUME_UPDATING = 16,
+ EVENT_ASCEND_TO_THE_HEAVENS = 17,
+ EVENT_EVADE = 18,
+ EVENT_COSMIC_SMASH = 19,
+ EVENT_UNLOCK_YELL = 20,
+ EVENT_OUTRO_START = 21,
+ EVENT_OUTRO_1 = 22,
+ EVENT_OUTRO_2 = 23,
+ EVENT_OUTRO_3 = 24,
+ EVENT_OUTRO_4 = 25,
+ EVENT_OUTRO_5 = 26,
+ EVENT_OUTRO_6 = 27,
+ EVENT_OUTRO_7 = 28,
+ EVENT_OUTRO_8 = 29,
+ EVENT_OUTRO_9 = 30,
+ EVENT_OUTRO_10 = 31,
+ EVENT_OUTRO_11 = 32,
+ EVENT_OUTRO_12 = 33,
+ EVENT_OUTRO_13 = 34,
+ EVENT_OUTRO_14 = 35,
+ EVENT_DESPAWN_ALGALON_1 = 36,
+ EVENT_DESPAWN_ALGALON_2 = 37,
+ EVENT_DESPAWN_ALGALON_3 = 38,
+
+ // Living Constellation
+ EVENT_ARCANE_BARRAGE = 39,
+};
+
+enum Actions
+{
+ ACTION_START_INTRO = 0,
+ ACTION_FINISH_INTRO = 1,
+ ACTION_ACTIVATE_STAR = 2,
+ ACTION_BIG_BANG = 3,
+ ACTION_ASCEND = 4,
+ ACTION_OUTRO = 5,
+};
+
+enum Points
+{
+ POINT_BRANN_INTRO = 0,
+ MAX_BRANN_WAYPOINTS_INTRO = 10,
+ POINT_BRANN_OUTRO = 10,
+ POINT_BRANN_OUTRO_END = 11,
+
+ POINT_ALGALON_LAND = 1,
+ POINT_ALGALON_OUTRO = 2,
+};
+
+enum EncounterPhases
+{
+ PHASE_NORMAL = 0,
+ PHASE_ROLE_PLAY = 1,
+ PHASE_BIG_BANG = 2,
+
+ PHASE_MASK_NO_UPDATE = (1 << PHASE_ROLE_PLAY) | (1 << PHASE_BIG_BANG),
+ PHASE_MASK_NO_CAST_CHECK = 1 << PHASE_ROLE_PLAY,
+};
+
+enum AchievmentInfo
+{
+ EVENT_ID_SUPERMASSIVE_START = 21697,
+ DATA_HAS_FED_ON_TEARS = 30043005,
+};
+
+
+Position const BrannIntroSpawnPos = {1676.277f, -162.5308f, 427.3326f, 3.235537f};
+Position const BrannIntroWaypoint[MAX_BRANN_WAYPOINTS_INTRO] =
+{
+ {1642.482f, -164.0812f, 427.2602f, 0.0f},
+ {1635.000f, -169.5145f, 427.2523f, 0.0f},
+ {1632.814f, -173.9334f, 427.2621f, 0.0f},
+ {1632.676f, -190.5927f, 425.8831f, 0.0f},
+ {1631.497f, -214.2221f, 418.1152f, 0.0f},
+ {1624.717f, -224.6876f, 418.1152f, 0.0f},
+ {1631.497f, -214.2221f, 418.1152f, 0.0f},
+ {1632.676f, -190.5927f, 425.8831f, 0.0f},
+ {1632.814f, -173.9334f, 427.2621f, 0.0f},
+ {1635.000f, -169.5145f, 427.2523f, 0.0f},
+};
+Position const AlgalonSummonPos = {1632.531f, -304.8516f, 450.1123f, 1.530165f};
+Position const AlgalonLandPos = {1632.668f, -302.7656f, 417.3211f, 1.530165f};
+
+#define LIVING_CONSTELLATION_COUNT 11
+Position const ConstellationPos[LIVING_CONSTELLATION_COUNT] =
+{
+ {1625.208f, -267.2771f, 446.4296f, 5.044002f},
+ {1658.279f, -262.5490f, 441.9073f, 4.188790f},
+ {1678.677f, -276.3280f, 427.7531f, 3.979351f},
+ {1593.389f, -299.4325f, 432.4636f, 6.073746f},
+ {1685.613f, -300.1219f, 443.2366f, 3.385939f},
+ {1591.706f, -263.8201f, 441.4153f, 5.253441f},
+ {1668.317f, -324.7676f, 457.9394f, 3.211406f},
+ {1592.242f, -325.5323f, 446.9508f, 0.226893f},
+ {1635.821f, -363.3442f, 424.3459f, 1.466077f},
+ {1672.188f, -357.2484f, 436.7337f, 2.338741f},
+ {1615.800f, -348.0065f, 442.9586f, 1.134464f},
+};
+
+#define COLLAPSING_STAR_COUNT 4
+Position const CollapsingStarPos[COLLAPSING_STAR_COUNT] =
+{
+ {1649.438f, -319.8127f, 418.3941f, 1.082104f},
+ {1647.005f, -288.6790f, 417.3955f, 3.490659f},
+ {1622.451f, -321.1563f, 417.6188f, 4.677482f},
+ {1615.060f, -291.6816f, 417.7796f, 3.490659f},
+};
+Position const AlgalonOutroPos = {1633.64f, -317.78f, 417.3211f, 0.0f};
+Position const BrannOutroPos[3] =
+{
+ {1632.023f, -243.7434f, 417.9118f, 0.0f},
+ {1631.986f, -297.7831f, 417.3210f, 0.0f},
+ {1633.832f, -216.2948f, 417.0463f, 0.0f},
+};
+
+class ActivateLivingConstellation : public BasicEvent
+{
+ public:
+ ActivateLivingConstellation(Unit* owner) : _owner(owner), _instance(owner->GetInstanceScript())
+ {
+ }
+
+ bool Execute(uint64 execTime, uint32 /*diff*/)
+ {
+ if (!_instance || _instance->GetBossState(BOSS_ALGALON) != IN_PROGRESS)
+ return true; // delete event
+
+ _owner->CastSpell((Unit*)NULL, SPELL_TRIGGER_3_ADDS, TRIGGERED_FULL_MASK);
+ _owner->m_Events.AddEvent(this, execTime + urand(45000, 50000));
+ return false;
+ }
+
+ private:
+ Unit* _owner;
+ InstanceScript* _instance;
+};
+
+class CosmicSmashDamageEvent : public BasicEvent
+{
+ public:
+ CosmicSmashDamageEvent(Unit* caster) : _caster(caster)
+ {
+ }
+
+ bool Execute(uint64 /*execTime*/, uint32 /*diff*/)
+ {
+ _caster->CastSpell((Unit*)NULL, SPELL_COSMIC_SMASH_TRIGGERED, TRIGGERED_FULL_MASK);
+ return true;
+ }
+
+ private:
+ Unit* _caster;
+};
+
+class SummonUnleashedDarkMatter : public BasicEvent
+{
+ public:
+ SummonUnleashedDarkMatter(Unit* caster) : _caster(caster)
+ {
+ }
+
+ bool Execute(uint64 execTime, uint32 /*diff*/)
+ {
+ _caster->CastSpell((Unit*)NULL, SPELL_SUMMON_UNLEASHED_DARK_MATTER, TRIGGERED_FULL_MASK);
+ _caster->m_Events.AddEvent(this, execTime + 30000);
+ return false;
+ }
+
+ private:
+ Unit* _caster;
+};
+
+class boss_algalon_the_observer : public CreatureScript
+{
+ public:
+ boss_algalon_the_observer() : CreatureScript("boss_algalon_the_observer") {}
+
+ struct boss_algalon_the_observerAI : public BossAI
+ {
+ boss_algalon_the_observerAI(Creature* creature) : BossAI(creature, BOSS_ALGALON)
+ {
+ _firstPull = true;
+ _fedOnTears = false;
+ }
+
+ void Reset()
+ {
+ _Reset();
+ me->SetReactState(REACT_PASSIVE);
+ _phaseTwo = false;
+ _fightWon = false;
+ _hasYelled = false;
+ }
+
+ void KilledUnit(Unit* victim)
+ {
+ if (victim->GetTypeId() == TYPEID_UNIT)
+ {
+ _fedOnTears = true;
+ if (!_hasYelled)
+ {
+ _hasYelled = true;
+ events.ScheduleEvent(EVENT_UNLOCK_YELL, 1000);
+ Talk(SAY_ALGALON_KILL);
+ }
+ }
+ }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_START_INTRO:
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS_2, 0x20);
+ me->SetDisableGravity(true);
+ DoCast(me, SPELL_ARRIVAL, true);
+ DoCast(me, SPELL_RIDE_THE_LIGHTNING, true);
+ me->GetMotionMaster()->MovePoint(POINT_ALGALON_LAND, AlgalonLandPos);
+ me->SetHomePosition(AlgalonLandPos);
+ Movement::MoveSplineInit init(*me);
+ init.MoveTo(AlgalonLandPos.GetPositionX(), AlgalonLandPos.GetPositionY(), AlgalonLandPos.GetPositionZ());
+ init.SetOrientationFixed(true);
+ init.Launch();
+ events.Reset();
+ events.SetPhase(PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_1, 5000, 0, PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_2, 15000, 0, PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_3, 23000, 0, PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_INTRO_FINISH, 36000, 0, PHASE_ROLE_PLAY);
+ break;
+ }
+ case ACTION_ASCEND:
+ events.SetPhase(PHASE_BIG_BANG);
+ events.CancelEvent(EVENT_RESUME_UPDATING);
+ events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1500);
+ break;
+ case EVENT_DESPAWN_ALGALON:
+ events.Reset();
+ events.SetPhase(PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 1);
+ events.ScheduleEvent(EVENT_DESPAWN_ALGALON_1, 5000);
+ events.ScheduleEvent(EVENT_DESPAWN_ALGALON_2, 17000);
+ events.ScheduleEvent(EVENT_DESPAWN_ALGALON_3, 26000);
+ me->DespawnOrUnsummon(34000);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
+ break;
+ case ACTION_INIT_ALGALON:
+ _firstPull = false;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ break;;
+ }
+ }
+
+ uint32 GetData(uint32 type)
+ {
+ return type == DATA_HAS_FED_ON_TEARS ? _fedOnTears : 1;
+ }
+
+ void EnterCombat(Unit* /*target*/)
+ {
+ uint32 introDelay = 0;
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
+ events.Reset();
+ events.SetPhase(PHASE_ROLE_PLAY);
+
+ if (!_firstPull)
+ {
+ Talk(SAY_ALGALON_AGGRO);
+ _EnterCombat();
+ introDelay = 8000;
+ }
+ else
+ {
+ _firstPull = false;
+ Talk(SAY_ALGALON_START_TIMER);
+ if (Creature* brann = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRANN_BRONZEBEARD_ALG)))
+ brann->AI()->DoAction(ACTION_FINISH_INTRO);
+
+ me->setActive(true);
+ DoZoneInCombat();
+ introDelay = 26000;
+ summons.DespawnEntry(NPC_AZEROTH);
+ instance->SetData(EVENT_DESPAWN_ALGALON, 0);
+ events.ScheduleEvent(EVENT_START_COMBAT, 18000);
+ }
+
+ events.ScheduleEvent(EVENT_INTRO_TIMER_DONE, introDelay);
+ events.ScheduleEvent(EVENT_QUANTUM_STRIKE, 3500 + introDelay);
+ events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500 + introDelay);
+ events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 18000 + introDelay);
+ events.ScheduleEvent(EVENT_BIG_BANG, 90000 + introDelay);
+ events.ScheduleEvent(EVENT_ASCEND_TO_THE_HEAVENS, 360000 + introDelay);
+ events.ScheduleEvent(EVENT_COSMIC_SMASH, 25000 + introDelay);
+
+ std::list<Creature*> stalkers;
+ me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f);
+ for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
+ (*itr)->m_Events.KillAllEvents(true);
+ }
+
+ void MovementInform(uint32 movementType, uint32 pointId)
+ {
+ if (movementType != POINT_MOTION_TYPE)
+ return;
+
+ if (pointId == POINT_ALGALON_LAND)
+ me->SetDisableGravity(false);
+ else if (pointId == POINT_ALGALON_OUTRO)
+ {
+ me->SetFacingTo(1.605703f);
+ events.ScheduleEvent(EVENT_OUTRO_3, 1200);
+ events.ScheduleEvent(EVENT_OUTRO_4, 2400);
+ events.ScheduleEvent(EVENT_OUTRO_5, 8500);
+ events.ScheduleEvent(EVENT_OUTRO_6, 15500);
+ events.ScheduleEvent(EVENT_OUTRO_7, 55500);
+ events.ScheduleEvent(EVENT_OUTRO_8, 73500);
+ events.ScheduleEvent(EVENT_OUTRO_9, 85500);
+ events.ScheduleEvent(EVENT_OUTRO_10, 108500);
+ events.ScheduleEvent(EVENT_OUTRO_11, 123500);
+ }
+ }
+
+ void JustSummoned(Creature* summon)
+ {
+ summons.Summon(summon);
+ switch (summon->GetEntry())
+ {
+ case NPC_AZEROTH:
+ DoCastAOE(SPELL_REORIGINATION, true);
+ break;
+ case NPC_COLLAPSING_STAR:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->GetMotionMaster()->MoveRandom(20.0f);
+ summon->CastSpell(summon, SPELL_COLLAPSE, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_BLACK_HOLE:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell(summon, SPELL_CONSTELLATION_PHASE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_EXPLOSION);
+ summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER:
+ summon->CastSpell(summon, SPELL_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_01:
+ summon->CastSpell(summon, SPELL_COSMIC_SMASH_VISUAL_STATE, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_02:
+ summon->m_Events.AddEvent(new CosmicSmashDamageEvent(summon), summon->m_Events.CalculateTime(3250));
+ break;
+ case NPC_WORM_HOLE:
+ summon->SetReactState(REACT_PASSIVE);
+ summon->CastSpell(summon, SPELL_WORM_HOLE_TRIGGER, TRIGGERED_FULL_MASK);
+ summon->CastSpell(summon, SPELL_SUMMON_VOID_ZONE_VISUAL, TRIGGERED_FULL_MASK);
+ break;
+ case NPC_UNLEASHED_DARK_MATTER:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ if (summon->Attack(target, true))
+ summon->GetMotionMaster()->MoveChase(target);
+ break;
+ }
+ }
+
+ void EnterEvadeMode()
+ {
+ instance->SetBossState(BOSS_ALGALON, FAIL);
+ BossAI::EnterEvadeMode();
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetSheath(SHEATH_STATE_UNARMED);
+ }
+
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (_fightWon)
+ {
+ damage = 0;
+ return;
+ }
+
+ if (!_phaseTwo && me->HealthBelowPctDamaged(20, damage))
+ {
+ _phaseTwo = true;
+ Talk(SAY_ALGALON_PHASE_TWO);
+ summons.DespawnEntry(NPC_LIVING_CONSTELLATION);
+ summons.DespawnEntry(NPC_COLLAPSING_STAR);
+ summons.DespawnEntry(NPC_BLACK_HOLE);
+ summons.DespawnEntry(NPC_ALGALON_VOID_ZONE_VISUAL_STALKER);
+ events.CancelEvent(EVENT_SUMMON_COLLAPSING_STAR);
+ std::list<Creature*> stalkers;
+ me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f);
+ for (std::list<Creature*>::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr)
+ (*itr)->m_Events.KillAllEvents(true);
+ for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i)
+ if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN))
+ wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000));
+ }
+ else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
+ {
+ _fightWon = true;
+ damage = 0;
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
+ me->setFaction(35);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_SELF_STUN);
+ events.Reset();
+ summons.DespawnAll();
+ events.SetPhase(PHASE_ROLE_PLAY);
+ events.ScheduleEvent(EVENT_OUTRO_START, 1500);
+ events.ScheduleEvent(EVENT_OUTRO_1, 7200);
+ events.ScheduleEvent(EVENT_OUTRO_2, 8700);
+ }
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if ((!(events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim()) || !CheckInRoom())
+ return;
+
+ events.Update(diff);
+
+ if (!(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK))
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_INTRO_1:
+ me->RemoveAurasDueToSpell(SPELL_RIDE_THE_LIGHTNING);
+ Talk(SAY_ALGALON_INTRO_1);
+ break;
+ case EVENT_INTRO_2:
+ DoCastAOE(SPELL_SUMMON_AZEROTH, true);
+ Talk(SAY_ALGALON_INTRO_2);
+ break;
+ case EVENT_INTRO_3:
+ Talk(SAY_ALGALON_INTRO_3);
+ break;
+ case EVENT_INTRO_FINISH:
+ events.Reset();
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ break;
+ case EVENT_START_COMBAT:
+ instance->SetBossState(BOSS_ALGALON, IN_PROGRESS);
+ break;
+ case EVENT_INTRO_TIMER_DONE:
+ {
+ events.SetPhase(PHASE_NORMAL);
+ me->SetSheath(SHEATH_STATE_MELEE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC);
+ me->SetReactState(REACT_DEFENSIVE);
+ DoCastAOE(SPELL_SUPERMASSIVE_FAIL, true);
+ //! Workaround for Creature::_IsTargetAcceptable returning false
+ //! for creatures that start combat in REACT_PASSIVE and UNIT_FLAG_NOT_SELECTABLE
+ //! causing them to immediately evade
+ if (!me->getThreatManager().isThreatListEmpty())
+ AttackStart(me->getThreatManager().getHostilTarget());
+ for (uint32 i = 0; i < LIVING_CONSTELLATION_COUNT; ++i)
+ if (Creature* summon = DoSummon(NPC_LIVING_CONSTELLATION, ConstellationPos[i], 0, TEMPSUMMON_DEAD_DESPAWN))
+ summon->SetReactState(REACT_PASSIVE);
+
+ std::list<Creature*> stalkers;
+ me->GetCreatureListWithEntryInGrid(stalkers, NPC_ALGALON_STALKER, 200.0f);
+ if (!stalkers.empty())
+ {
+ Unit* stalker = Trinity::Containers::SelectRandomContainerElement(stalkers);
+ stalker->m_Events.AddEvent(new ActivateLivingConstellation(stalker), stalker->m_Events.CalculateTime(urand(45000, 50000)));
+ }
+ break;
+ }
+ case EVENT_QUANTUM_STRIKE:
+ DoCastVictim(SPELL_QUANTUM_STRIKE);
+ events.ScheduleEvent(EVENT_QUANTUM_STRIKE, urand(3000, 5000));
+ break;
+ case EVENT_PHASE_PUNCH:
+ DoCastVictim(SPELL_PHASE_PUNCH);
+ events.ScheduleEvent(EVENT_PHASE_PUNCH, 15500);
+ break;
+ case EVENT_SUMMON_COLLAPSING_STAR:
+ Talk(SAY_ALGALON_COLLAPSING_STAR);
+ Talk(EMOTE_ALGALON_COLLAPSING_STAR);
+ for (uint32 i = 0; i < COLLAPSING_STAR_COUNT; ++i)
+ me->SummonCreature(NPC_COLLAPSING_STAR, CollapsingStarPos[i], TEMPSUMMON_CORPSE_DESPAWN);
+ events.ScheduleEvent(EVENT_SUMMON_COLLAPSING_STAR, 60000);
+ break;
+ case EVENT_BIG_BANG:
+ {
+ Talk(SAY_ALGALON_BIG_BANG);
+ Talk(EMOTE_ALGALON_BIG_BANG);
+ events.SetPhase(PHASE_BIG_BANG);
+ std::list<Creature*> constellations;
+ me->GetCreatureListWithEntryInGrid(constellations, NPC_LIVING_CONSTELLATION, 200.0f);
+ for (std::list<Creature*>::iterator itr = constellations.begin(); itr != constellations.end(); ++itr)
+ (*itr)->AI()->DoAction(ACTION_BIG_BANG);
+ DoCastAOE(SPELL_BIG_BANG);
+ events.ScheduleEvent(EVENT_BIG_BANG, 90500);
+ events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500);
+ break;
+ }
+ case EVENT_RESUME_UPDATING:
+ events.SetPhase(0);
+ break;
+ case EVENT_ASCEND_TO_THE_HEAVENS:
+ Talk(SAY_ALGALON_ASCEND);
+ DoCastAOE(SPELL_ASCEND_TO_THE_HEAVENS);
+ events.ScheduleEvent(EVENT_EVADE, 2500);
+ break;
+ case EVENT_EVADE:
+ EnterEvadeMode();
+ break;
+ case EVENT_COSMIC_SMASH:
+ Talk(EMOTE_ALGALON_COSMIC_SMASH);
+ DoCastAOE(SPELL_COSMIC_SMASH);
+ events.ScheduleEvent(EVENT_COSMIC_SMASH, 25500);
+ break;
+ case EVENT_UNLOCK_YELL:
+ _hasYelled = false;
+ break;
+ case EVENT_OUTRO_START:
+ instance->SetBossState(BOSS_ALGALON, DONE);
+ break;
+ case EVENT_OUTRO_1:
+ me->RemoveAllAuras();
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME);
+ break;
+ case EVENT_OUTRO_2:
+ _EnterEvadeMode();
+ me->AddUnitState(UNIT_STATE_EVADE);
+ me->GetMotionMaster()->MovePoint(POINT_ALGALON_OUTRO, AlgalonOutroPos);
+ break;
+ case EVENT_OUTRO_3:
+ DoCastAOE(SPELL_KILL_CREDIT);
+ break;
+ case EVENT_OUTRO_4:
+ DoCastAOE(SPELL_SUPERMASSIVE_FAIL);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ break;
+ case EVENT_OUTRO_5:
+ if (Creature* brann = DoSummon(NPC_BRANN_BRONZBEARD_ALG, BrannOutroPos[0], 131500, TEMPSUMMON_TIMED_DESPAWN))
+ brann->AI()->DoAction(ACTION_OUTRO);
+ break;
+ case EVENT_OUTRO_6:
+ Talk(SAY_ALGALON_OUTRO_1);
+ me->SetStandState(UNIT_STAND_STATE_KNEEL);
+ break;
+ case EVENT_OUTRO_7:
+ Talk(SAY_ALGALON_OUTRO_2);
+ break;
+ case EVENT_OUTRO_8:
+ Talk(SAY_ALGALON_OUTRO_3);
+ break;
+ case EVENT_OUTRO_9:
+ Talk(SAY_ALGALON_OUTRO_4);
+ break;
+ case EVENT_OUTRO_10:
+ Talk(SAY_ALGALON_OUTRO_5);
+ break;
+ case EVENT_OUTRO_11:
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ DoCast(me, SPELL_TELEPORT);
+ me->DespawnOrUnsummon(1500);
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ bool _firstPull;
+ bool _fedOnTears;
+ bool _phaseTwo;
+ bool _fightWon;
+ bool _hasYelled;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<boss_algalon_the_observerAI>(creature);
+ }
+};
+
+class npc_living_constellation : public CreatureScript
+{
+ public:
+ npc_living_constellation() : CreatureScript("npc_living_constellation") { }
+
+ struct npc_living_constellationAI : public CreatureAI
+ {
+ npc_living_constellationAI(Creature* creature) : CreatureAI(creature)
+ {
+ }
+
+ void Reset()
+ {
+ _events.Reset();
+ _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500);
+ _isActive = false;
+ }
+
+ uint32 GetData(uint32 /*type*/)
+ {
+ return _isActive ? 1 : 0;
+ }
+
+ void DoAction(int32 const action)
+ {
+ if (action != ACTION_ACTIVATE_STAR)
+ return;
+
+ switch (action)
+ {
+ case ACTION_ACTIVATE_STAR:
+ if (Creature* algalon = me->FindNearestCreature(NPC_ALGALON, 200.0f))
+ {
+ if (Unit* target = algalon->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(algalon)))
+ {
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ AttackStart(target);
+ DoZoneInCombat();
+ _isActive = true;
+ }
+ }
+ break;
+ case ACTION_BIG_BANG:
+ _events.SetPhase(PHASE_BIG_BANG);
+ _events.DelayEvents(9500);
+ _events.ScheduleEvent(EVENT_RESUME_UPDATING, 9500);
+ break;
+ }
+ }
+
+ void SpellHit(Unit* caster, SpellInfo const* spell)
+ {
+ if (spell->Id != SPELL_CONSTELLATION_PHASE_EFFECT || caster->GetTypeId() != TYPEID_UNIT)
+ return;
+
+ me->DespawnOrUnsummon(1);
+ if (InstanceScript* instance = me->GetInstanceScript())
+ instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_ID_SUPERMASSIVE_START);
+ caster->CastSpell((Unit*)NULL, SPELL_BLACK_HOLE_CREDIT, TRIGGERED_FULL_MASK);
+ caster->ToCreature()->DespawnOrUnsummon(1);
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!(_events.GetPhaseMask() & PHASE_MASK_NO_UPDATE) && !UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_ARCANE_BARRAGE:
+ DoCastAOE(SPELL_ARCANE_BARRAGE);
+ _events.ScheduleEvent(EVENT_ARCANE_BARRAGE, 2500);
+ break;
+ case EVENT_RESUME_UPDATING:
+ _events.SetPhase(0);
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ bool _isActive;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<npc_living_constellationAI>(creature);
+ }
+};
+
+class npc_collapsing_star : public CreatureScript
+{
+ public:
+ npc_collapsing_star() : CreatureScript("npc_collapsing_star") { }
+
+ struct npc_collapsing_starAI : public PassiveAI
+ {
+ npc_collapsing_starAI(Creature* creature) : PassiveAI(creature)
+ {
+ _dying = false;
+ }
+
+ void JustSummoned(Creature* summon)
+ {
+ if (summon->GetEntry() != NPC_BLACK_HOLE)
+ return;
+
+ if (TempSummon* summ = me->ToTempSummon())
+ if (Creature* algalon = ObjectAccessor::GetCreature(*me, summ->GetSummonerGUID()))
+ algalon->AI()->JustSummoned(summon);
+
+ me->DespawnOrUnsummon(1);
+ }
+
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (_dying)
+ {
+ damage = 0;
+ return;
+ }
+
+ if (damage >= me->GetHealth())
+ {
+ _dying = true;
+ damage = 0;
+ DoCast(me, SPELL_BLACK_HOLE_SPAWN_VISUAL, true);
+ DoCast(me, SPELL_SUMMON_BLACK_HOLE, true);
+ }
+ }
+
+ bool _dying;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<npc_collapsing_starAI>(creature);
+ }
+};
+
+class npc_brann_bronzebeard_algalon : public CreatureScript
+{
+ public:
+ npc_brann_bronzebeard_algalon() : CreatureScript("npc_brann_bronzebeard_algalon") { }
+
+ struct npc_brann_bronzebeard_algalonAI : public CreatureAI
+ {
+ npc_brann_bronzebeard_algalonAI(Creature* creature) : CreatureAI(creature)
+ {
+ }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_START_INTRO:
+ _currentPoint = 0;
+ _events.Reset();
+ me->SetWalk(false);
+ _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
+ break;
+ case ACTION_FINISH_INTRO:
+ Talk(SAY_BRANN_ALGALON_INTRO_2);
+ _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
+ break;
+ case ACTION_OUTRO:
+ me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO, BrannOutroPos[1]);
+ _events.ScheduleEvent(EVENT_BRANN_OUTRO_1, 89500);
+ _events.ScheduleEvent(EVENT_BRANN_OUTRO_2, 116500);
+ break;
+ }
+ }
+
+ void MovementInform(uint32 movementType, uint32 pointId)
+ {
+ if (movementType != POINT_MOTION_TYPE)
+ return;
+
+ uint32 delay = 1;
+ _currentPoint = pointId + 1;
+ switch (pointId)
+ {
+ case 2:
+ delay = 8000;
+ me->SetWalk(true);
+ break;
+ case 5:
+ me->SetWalk(false);
+ Talk(SAY_BRANN_ALGALON_INTRO_1);
+ _events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500);
+ return;
+ case 9:
+ me->DespawnOrUnsummon(1);
+ return;
+ case POINT_BRANN_OUTRO:
+ case POINT_BRANN_OUTRO_END:
+ return;
+ }
+
+ _events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay);
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ UpdateVictim();
+
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_BRANN_MOVE_INTRO:
+ if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO)
+ me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]);
+ break;
+ case EVENT_SUMMON_ALGALON:
+ if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos))
+ algalon->AI()->DoAction(ACTION_START_INTRO);
+ break;
+ case EVENT_BRANN_OUTRO_1:
+ Talk(SAY_BRANN_ALGALON_OUTRO);
+ break;
+ case EVENT_BRANN_OUTRO_2:
+ me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO_END, BrannOutroPos[2]);
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ uint32 _currentPoint;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<npc_brann_bronzebeard_algalonAI>(creature);
+ }
+};
+
+class go_celestial_planetarium_access : public GameObjectScript
+{
+ public:
+ go_celestial_planetarium_access() : GameObjectScript("go_celestial_planetarium_access") {}
+
+ struct go_celestial_planetarium_accessAI : public GameObjectAI
+ {
+ go_celestial_planetarium_accessAI(GameObject* go) : GameObjectAI(go)
+ {
+ }
+
+ bool GossipHello(Player* player)
+ {
+ bool hasKey = true;
+ if (LockEntry const* lock = sLockStore.LookupEntry(go->GetGOInfo()->goober.lockId))
+ {
+ hasKey = false;
+ for (uint32 i = 0; i < MAX_LOCK_CASE; ++i)
+ {
+ if (!lock->Index[i])
+ continue;
+
+ if (player->HasItemCount(lock->Index[i], 1))
+ {
+ hasKey = true;
+ break;
+ }
+ }
+ }
+
+ if (!hasKey)
+ return false;
+
+ // Start Algalon event
+ go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ _events.ScheduleEvent(EVENT_DESPAWN_CONSOLE, 5000);
+ if (Creature* brann = go->SummonCreature(NPC_BRANN_BRONZBEARD_ALG, BrannIntroSpawnPos))
+ brann->AI()->DoAction(ACTION_START_INTRO);
+
+ if (InstanceScript* instance = go->GetInstanceScript())
+ {
+ instance->SetData(DATA_ALGALON_SUMMON_STATE, 1);
+ if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_01)))
+ sigil->SetGoState(GO_STATE_ACTIVE);
+
+ if (GameObject* sigil = ObjectAccessor::GetGameObject(*go, instance->GetData64(DATA_SIGILDOOR_02)))
+ sigil->SetGoState(GO_STATE_ACTIVE);
+ }
+
+ return false;
+ }
+
+ void UpdateAI(uint32 diff)
+ {
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_DESPAWN_CONSOLE:
+ go->Delete();
+ break;
+ }
+ }
+ }
+
+ EventMap _events;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const
+ {
+ return GetUlduarAI<go_celestial_planetarium_accessAI>(go);
+ }
+};
+
+class spell_algalon_phase_punch : public SpellScriptLoader
+{
+ public:
+ spell_algalon_phase_punch() : SpellScriptLoader("spell_algalon_phase_punch") { }
+
+ class spell_algalon_phase_punch_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_algalon_phase_punch_AuraScript);
+
+ void HandlePeriodic(AuraEffect const* aurEff)
+ {
+ PreventDefaultAction();
+ if (GetStackAmount() != 1)
+ GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 2]);
+ GetTarget()->CastSpell(GetTarget(), PhasePunchAlphaId[GetStackAmount() - 1], TRIGGERED_FULL_MASK);
+ if (GetStackAmount() == 5)
+ Remove(AURA_REMOVE_BY_DEFAULT);
+ }
+
+ void OnRemove(AuraEffect const*, AuraEffectHandleModes)
+ {
+ if (GetStackAmount() != 5)
+ GetTarget()->RemoveAurasDueToSpell(PhasePunchAlphaId[GetStackAmount() - 1]);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_phase_punch_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ OnEffectRemove += AuraEffectRemoveFn(spell_algalon_phase_punch_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_algalon_phase_punch_AuraScript();
+ }
+};
+
+class NotVictimFilter
+{
+ public:
+ NotVictimFilter(Unit* caster) : _victim(caster->getVictim())
+ {
+ }
+
+ bool operator()(Unit* target)
+ {
+ return target != _victim;
+ }
+
+ private:
+ Unit* _victim;
+};
+
+class spell_algalon_arcane_barrage : public SpellScriptLoader
+{
+ public:
+ spell_algalon_arcane_barrage() : SpellScriptLoader("spell_algalon_arcane_barrage") { }
+
+ class spell_algalon_arcane_barrage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_arcane_barrage_SpellScript);
+
+ void SelectTarget(std::list<Unit*>& targets)
+ {
+ targets.remove_if(NotVictimFilter(GetCaster()));
+ }
+
+ void Register()
+ {
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_arcane_barrage_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_arcane_barrage_SpellScript();
+ }
+};
+
+class ActiveConstellationFilter
+{
+ public:
+ bool operator()(Unit* target) const
+ {
+ return target->GetAI()->GetData(0);
+ }
+};
+
+class spell_algalon_trigger_3_adds : public SpellScriptLoader
+{
+ public:
+ spell_algalon_trigger_3_adds() : SpellScriptLoader("spell_algalon_trigger_3_adds") { }
+
+ class spell_algalon_trigger_3_adds_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_trigger_3_adds_SpellScript);
+
+ void SelectTarget(std::list<Unit*>& targets)
+ {
+ targets.remove_if(ActiveConstellationFilter());
+ }
+
+ void HandleDummy(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ Creature* target = GetHitCreature();
+ if (!target)
+ return;
+
+ target->AI()->DoAction(ACTION_ACTIVATE_STAR);
+ }
+
+ void Register()
+ {
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_trigger_3_adds_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_trigger_3_adds_SpellScript();
+ }
+};
+
+class spell_algalon_collapse : public SpellScriptLoader
+{
+ public:
+ spell_algalon_collapse() : SpellScriptLoader("spell_algalon_collapse") { }
+
+ class spell_algalon_collapse_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_algalon_collapse_AuraScript);
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ PreventDefaultAction();
+ GetTarget()->DealDamage(GetTarget(), GetTarget()->CountPctFromMaxHealth(1), NULL, NODAMAGE);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_collapse_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_algalon_collapse_AuraScript();
+ }
+};
+
+class spell_algalon_big_bang : public SpellScriptLoader
+{
+ public:
+ spell_algalon_big_bang() : SpellScriptLoader("spell_algalon_big_bang") { }
+
+ class spell_algalon_big_bang_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_big_bang_SpellScript);
+
+ bool Load()
+ {
+ _targetCount = 0;
+ return true;
+ }
+
+ void CountTargets(std::list<Unit*>& targets)
+ {
+ _targetCount = targets.size();
+ }
+
+ void CheckTargets()
+ {
+ if (!_targetCount)
+ GetCaster()->GetAI()->DoAction(ACTION_ASCEND);
+ }
+
+ void Register()
+ {
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_algalon_big_bang_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ AfterCast += SpellCastFn(spell_algalon_big_bang_SpellScript::CheckTargets);
+ }
+
+ uint32 _targetCount;
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_big_bang_SpellScript();
+ }
+};
+
+class spell_algalon_remove_phase : public SpellScriptLoader
+{
+ public:
+ spell_algalon_remove_phase() : SpellScriptLoader("spell_algalon_remove_phase") { }
+
+ class spell_algalon_remove_phase_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_algalon_remove_phase_AuraScript);
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ PreventDefaultAction();
+ GetTarget()->RemoveAurasByType(SPELL_AURA_PHASE);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_algalon_remove_phase_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_algalon_remove_phase_AuraScript();
+ }
+};
+
+class spell_algalon_cosmic_smash : public SpellScriptLoader
+{
+ public:
+ spell_algalon_cosmic_smash() : SpellScriptLoader("spell_algalon_cosmic_smash") { }
+
+ class spell_algalon_cosmic_smash_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_cosmic_smash_SpellScript);
+
+ void ModDestHeight(SpellEffIndex /*effIndex*/)
+ {
+ Position offset = {0.0f, 0.0f, 65.0f, 0.0f};
+ const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset);
+ GetHitDest()->RelocateOffset(offset);
+ }
+
+ void Register()
+ {
+ OnEffectLaunch += SpellEffectFn(spell_algalon_cosmic_smash_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_cosmic_smash_SpellScript();
+ }
+};
+
+class spell_algalon_cosmic_smash_damage : public SpellScriptLoader
+{
+ public:
+ spell_algalon_cosmic_smash_damage() : SpellScriptLoader("spell_algalon_cosmic_smash_damage") { }
+
+ class spell_algalon_cosmic_smash_damage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_cosmic_smash_damage_SpellScript);
+
+ void RecalculateDamage()
+ {
+ if (!GetTargetDest() || !GetHitUnit())
+ return;
+
+ float distance = GetHitUnit()->GetDistance2d(GetTargetDest()->GetPositionX(), GetTargetDest()->GetPositionY());
+ if (distance > 6.0f)
+ SetHitDamage(int32(float(GetHitDamage()) / distance) * 2);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_algalon_cosmic_smash_damage_SpellScript::RecalculateDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_cosmic_smash_damage_SpellScript();
+ }
+};
+
+class spell_algalon_supermassive_fail : public SpellScriptLoader
+{
+ public:
+ spell_algalon_supermassive_fail() : SpellScriptLoader("spell_algalon_supermassive_fail") { }
+
+ class spell_algalon_supermassive_fail_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_algalon_supermassive_fail_SpellScript);
+
+ void RecalculateDamage()
+ {
+ if (!GetHitPlayer())
+ return;
+
+ GetHitPlayer()->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_algalon_supermassive_fail_SpellScript::RecalculateDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_algalon_supermassive_fail_SpellScript();
+ }
+};
+
+class achievement_he_feeds_on_your_tears : public AchievementCriteriaScript
+{
+ public:
+ achievement_he_feeds_on_your_tears() : AchievementCriteriaScript("achievement_he_feeds_on_your_tears") { }
+
+ bool OnCheck(Player* /*source*/, Unit* target)
+ {
+ return !target->GetAI()->GetData(DATA_HAS_FED_ON_TEARS);
+ }
+};
+
+void AddSC_boss_algalon_the_observer()
+{
+ new boss_algalon_the_observer();
+ new npc_living_constellation();
+ new npc_collapsing_star();
+ new npc_brann_bronzebeard_algalon();
+ new go_celestial_planetarium_access();
+ new spell_algalon_phase_punch();
+ new spell_algalon_arcane_barrage();
+ new spell_algalon_trigger_3_adds();
+ new spell_algalon_collapse();
+ new spell_algalon_big_bang();
+ new spell_algalon_remove_phase();
+ new spell_algalon_cosmic_smash();
+ new spell_algalon_cosmic_smash_damage();
+ new spell_algalon_supermassive_fail();
+ new achievement_he_feeds_on_your_tears();
+}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 22858cf69e5..654d763ddbc 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -22,9 +22,14 @@
static DoorData const doorData[] =
{
- { GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S },
- { GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S },
- { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE },
+ {GO_LEVIATHAN_DOOR, BOSS_LEVIATHAN, DOOR_TYPE_ROOM, BOUNDARY_S },
+ {GO_XT_002_DOOR, BOSS_XT002, DOOR_TYPE_ROOM, BOUNDARY_S },
+ {GO_DOODAD_UL_SIGILDOOR_03, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_W },
+ {GO_DOODAD_UL_UNIVERSEFLOOR_01, BOSS_ALGALON, DOOR_TYPE_ROOM, BOUNDARY_NONE },
+ {GO_DOODAD_UL_UNIVERSEFLOOR_02, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE },
+ {GO_DOODAD_UL_UNIVERSEGLOBE01, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE },
+ {GO_DOODAD_UL_ULDUAR_TRAPDOOR_03, BOSS_ALGALON, DOOR_TYPE_SPAWN_HOLE, BOUNDARY_NONE },
+ {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE },
};
class instance_ulduar : public InstanceMapScript
@@ -36,7 +41,6 @@ class instance_ulduar : public InstanceMapScript
{
instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { }
- uint32 Encounter[MAX_ENCOUNTER];
std::string m_strInstData;
// Creatures
@@ -72,6 +76,12 @@ class instance_ulduar : public InstanceMapScript
uint64 HodirDoorGUID;
uint64 HodirIceDoorGUID;
uint64 ArchivumDoorGUID;
+ uint64 AlgalonSigilDoorGUID[3];
+ uint64 AlgalonFloorGUID[2];
+ uint64 AlgalonUniverseGUID;
+ uint64 AlgalonTrapdoorGUID;
+ uint64 BrannBronzebeardAlgGUID;
+ uint64 GiftOfTheObserverGUID;
// Miscellaneous
uint32 TeamInInstance;
@@ -111,35 +121,49 @@ class instance_ulduar : public InstanceMapScript
HodirDoorGUID = 0;
HodirIceDoorGUID = 0;
ArchivumDoorGUID = 0;
+ AlgalonUniverseGUID = 0;
+ AlgalonTrapdoorGUID = 0;
+ BrannBronzebeardAlgGUID = 0;
+ GiftOfTheObserverGUID = 0;
+ _algalonTimer = 61;
+ _maxArmorItemLevel = 0;
+ _maxWeaponItemLevel = 0;
TeamInInstance = 0;
HodirRareCacheData = 0;
ColossusData = 0;
elderCount = 0;
conSpeedAtory = false;
Unbroken = true;
+ _summonAlgalon = false;
- memset(Encounter, 0, sizeof(Encounter));
+ memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID));
+ memset(AlgalonFloorGUID, 0, sizeof(AlgalonFloorGUID));
memset(XTToyPileGUIDs, 0, sizeof(XTToyPileGUIDs));
memset(AssemblyGUIDs, 0, sizeof(AssemblyGUIDs));
memset(RazorHarpoonGUIDs, 0, sizeof(RazorHarpoonGUIDs));
memset(KeeperGUIDs, 0, sizeof(KeeperGUIDs));
}
- bool IsEncounterInProgress() const
+ void FillInitialWorldStates(WorldPacket& packet)
{
- for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- {
- if (Encounter[i] == IN_PROGRESS)
- return true;
- }
-
- return false;
+ packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(_algalonTimer && _algalonTimer <= 60);
+ packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min<uint32>(_algalonTimer, 60));
}
void OnPlayerEnter(Player* player)
{
if (!TeamInInstance)
TeamInInstance = player->GetTeam();
+
+ if (_summonAlgalon)
+ {
+ _summonAlgalon = false;
+ TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
+ if (_algalonTimer && _algalonTimer <= 60)
+ algalon->AI()->DoAction(ACTION_INIT_ALGALON);
+ else
+ algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ }
}
void OnCreatureCreate(Creature* creature)
@@ -267,9 +291,32 @@ class instance_ulduar : public InstanceMapScript
if (TeamInInstance == HORDE)
creature->UpdateEntry(NPC_BATTLE_PRIEST_GINA, HORDE);
break;
+ case NPC_BRANN_BRONZBEARD_ALG:
+ BrannBronzebeardAlgGUID = creature->GetGUID();
+ break;
+ //! These creatures are summoned by something else than Algalon
+ //! but need to be controlled/despawned by him - so they need to be
+ //! registered in his summon list
+ case NPC_ALGALON_VOID_ZONE_VISUAL_STALKER:
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_01:
+ case NPC_ALGALON_STALKER_ASTEROID_TARGET_02:
+ case NPC_UNLEASHED_DARK_MATTER:
+ if (Creature* algalon = instance->GetCreature(AlgalonGUID))
+ algalon->AI()->JustSummoned(creature);
+ break;
}
+ }
- }
+ void OnCreatureRemove(Creature* creature)
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_BRANN_BRONZBEARD_ALG:
+ if (BrannBronzebeardAlgGUID == creature->GetGUID())
+ BrannBronzebeardAlgGUID = 0;
+ break;
+ }
+ }
void OnGameObjectCreate(GameObject* gameObject)
{
@@ -340,6 +387,45 @@ class instance_ulduar : public InstanceMapScript
if (GetBossState(BOSS_ASSEMBLY_OF_IRON) != DONE)
HandleGameObject(ArchivumDoorGUID, false);
break;
+ case GO_CELESTIAL_PLANETARIUM_ACCESS_10:
+ case GO_CELESTIAL_PLANETARIUM_ACCESS_25:
+ if (_algalonSummoned)
+ gameObject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ break;
+ case GO_DOODAD_UL_SIGILDOOR_01:
+ AlgalonSigilDoorGUID[0] = gameObject->GetGUID();
+ if (_algalonSummoned)
+ gameObject->SetGoState(GO_STATE_ACTIVE);
+ break;
+ case GO_DOODAD_UL_SIGILDOOR_02:
+ AlgalonSigilDoorGUID[1] = gameObject->GetGUID();
+ if (_algalonSummoned)
+ gameObject->SetGoState(GO_STATE_ACTIVE);
+ break;
+ case GO_DOODAD_UL_SIGILDOOR_03:
+ AlgalonSigilDoorGUID[2] = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_UNIVERSEFLOOR_01:
+ AlgalonFloorGUID[0] = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_UNIVERSEFLOOR_02:
+ AlgalonFloorGUID[1] = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_UNIVERSEGLOBE01:
+ AlgalonUniverseGUID = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03:
+ AlgalonTrapdoorGUID = gameObject->GetGUID();
+ AddDoor(gameObject, true);
+ break;
+ case GO_GIFT_OF_THE_OBSERVER_10:
+ case GO_GIFT_OF_THE_OBSERVER_25:
+ GiftOfTheObserverGUID = gameObject->GetGUID();
+ break;
}
}
@@ -348,10 +434,14 @@ class instance_ulduar : public InstanceMapScript
switch (gameObject->GetEntry())
{
case GO_LEVIATHAN_DOOR:
- AddDoor(gameObject, false);
- break;
case GO_XT_002_DOOR:
+ case GO_DOODAD_UL_SIGILDOOR_03:
+ case GO_DOODAD_UL_UNIVERSEFLOOR_01:
+ case GO_DOODAD_UL_UNIVERSEFLOOR_02:
+ case GO_DOODAD_UL_UNIVERSEGLOBE01:
+ case GO_DOODAD_UL_ULDUAR_TRAPDOOR_03:
AddDoor(gameObject, false);
+ break;
default:
break;
}
@@ -389,6 +479,7 @@ class instance_ulduar : public InstanceMapScript
// Flame Leviathan's Tower Event triggers
Creature* FlameLeviathan = instance->GetCreature(LeviathanGUID);
if (FlameLeviathan && FlameLeviathan->isAlive()) // No leviathan, no event triggering ;)
+ {
switch (eventId)
{
case EVENT_TOWER_OF_STORM_DESTROYED:
@@ -404,6 +495,7 @@ class instance_ulduar : public InstanceMapScript
FlameLeviathan->AI()->DoAction(ACTION_TOWER_OF_LIFE_DESTROYED);
break;
}
+ }
}
@@ -464,6 +556,52 @@ class instance_ulduar : public InstanceMapScript
if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID))
gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
break;
+ case BOSS_ALGALON:
+ if (state == DONE)
+ {
+ _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER);
+ _events.CancelEvent(EVENT_DESPAWN_ALGALON);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0);
+ _algalonTimer = 61;
+ if (GameObject* gameObject = instance->GetGameObject(GiftOfTheObserverGUID))
+ gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
+ // get item level (recheck weapons)
+ Map::PlayerList const& players = instance->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (Player* player = itr->getSource())
+ for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot)
+ if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
+ _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
+ }
+ else if (state == IN_PROGRESS)
+ {
+ // get item level (armor cannot be swapped in combat)
+ Map::PlayerList const& players = instance->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ {
+ if (Player* player = itr->getSource())
+ {
+ for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
+ {
+ if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY)
+ continue;
+
+ if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ {
+ if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED)
+ {
+ if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
+ _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
+ }
+ else if (item->GetTemplate()->ItemLevel > _maxArmorItemLevel)
+ _maxArmorItemLevel = item->GetTemplate()->ItemLevel;
+ }
+ }
+ }
+ }
+ }
+ break;
}
return true;
@@ -496,6 +634,16 @@ class instance_ulduar : public InstanceMapScript
case DATA_UNBROKEN:
Unbroken = bool(data);
break;
+ case EVENT_DESPAWN_ALGALON:
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60);
+ _algalonTimer = 60;
+ _events.ScheduleEvent(EVENT_DESPAWN_ALGALON, 3600000);
+ _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
+ break;
+ case DATA_ALGALON_SUMMON_STATE:
+ _algalonSummoned = true;
+ break;
default:
break;
}
@@ -570,6 +718,22 @@ class instance_ulduar : public InstanceMapScript
return KeeperGUIDs[1];
case BOSS_STONEBARK:
return KeeperGUIDs[2];
+ case DATA_SIGILDOOR_01:
+ return AlgalonSigilDoorGUID[0];
+ case DATA_SIGILDOOR_02:
+ return AlgalonSigilDoorGUID[1];
+ case DATA_SIGILDOOR_03:
+ return AlgalonSigilDoorGUID[2];
+ case DATA_UNIVERSE_FLOOR_01:
+ return AlgalonFloorGUID[0];
+ case DATA_UNIVERSE_FLOOR_02:
+ return AlgalonFloorGUID[1];
+ case DATA_UNIVERSE_GLOBE:
+ return AlgalonUniverseGUID;
+ case DATA_ALGALON_TRAPDOOR:
+ return AlgalonTrapdoorGUID;
+ case DATA_BRANN_BRONZEBEARD_ALG:
+ return BrannBronzebeardAlgGUID;
}
return 0;
@@ -592,12 +756,23 @@ class instance_ulduar : public InstanceMapScript
return 0;
}
+ bool CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* , Unit const* /* = NULL */, uint32 /* = 0 */)
+ {
+ switch (criteriaId)
+ {
+ case CRITERIA_HERALD_OF_TITANS:
+ return _maxArmorItemLevel <= MAX_HERALD_ARMOR_ITEMLEVEL && _maxWeaponItemLevel <= MAX_HERALD_WEAPON_ITEMLEVEL;
+ }
+
+ return false;
+ }
+
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
- saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS);
+ saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << (_algalonSummoned ? 1 : 0);
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
@@ -627,15 +802,68 @@ class instance_ulduar : public InstanceMapScript
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
- if (i == DATA_COLOSSUS)
- SetData(i, tmpState);
- else
- SetBossState(i, EncounterState(tmpState));
+ SetBossState(i, EncounterState(tmpState));
+ }
+
+ uint32 tempState;
+ loadStream >> tempState;
+ if (tempState == IN_PROGRESS || tempState > SPECIAL)
+ tempState = NOT_STARTED;
+ SetData(DATA_COLOSSUS, tempState);
+
+ loadStream >> _algalonTimer;
+ loadStream >> tempState;
+ _algalonSummoned = tempState != 0;
+ if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE)
+ {
+ _summonAlgalon = true;
+ if (_algalonTimer && _algalonTimer <= 60)
+ {
+ _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
+ DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer);
+ }
}
}
OUT_LOAD_INST_DATA_COMPLETE;
}
+
+ void Update(uint32 diff)
+ {
+ if (_events.Empty())
+ return;
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_UPDATE_ALGALON_TIMER:
+ SaveToDB();
+ DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, --_algalonTimer);
+ if (_algalonTimer)
+ _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
+ else
+ {
+ DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0);
+ _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER);
+ if (Creature* algalon = instance->GetCreature(AlgalonGUID))
+ algalon->AI()->DoAction(EVENT_DESPAWN_ALGALON);
+ }
+ break;
+ }
+ }
+ }
+
+ private:
+ EventMap _events;
+ uint32 _algalonTimer;
+ bool _summonAlgalon;
+ bool _algalonSummoned;
+ uint32 _maxArmorItemLevel;
+ uint32 _maxWeaponItemLevel;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index a31954b8a16..d3b4684772f 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -18,9 +18,12 @@
#ifndef DEF_ULDUAR_H
#define DEF_ULDUAR_H
-#include "ObjectMgr.h"
+#include "Creature.h"
+#include "GameObject.h"
#define UlduarScriptName "instance_ulduar"
+extern Position const AlgalonLandPos;
+
enum UlduarBosses
{
MAX_ENCOUNTER = 20,
@@ -50,98 +53,124 @@ enum UlduarBosses
enum UlduarNPCs
{
// General
- NPC_LEVIATHAN = 33113,
- NPC_SALVAGED_DEMOLISHER = 33109,
- NPC_SALVAGED_SIEGE_ENGINE = 33060,
- NPC_IGNIS = 33118,
- NPC_RAZORSCALE = 33186,
- NPC_RAZORSCALE_CONTROLLER = 33233,
- NPC_STEELFORGED_DEFFENDER = 33236,
- NPC_EXPEDITION_COMMANDER = 33210,
- NPC_XT002 = 33293,
- NPC_XT_TOY_PILE = 33337,
- NPC_STEELBREAKER = 32867,
- NPC_MOLGEIM = 32927,
- NPC_BRUNDIR = 32857,
- NPC_KOLOGARN = 32930,
- NPC_FOCUSED_EYEBEAM = 33632,
- NPC_FOCUSED_EYEBEAM_RIGHT = 33802,
- NPC_LEFT_ARM = 32933,
- NPC_RIGHT_ARM = 32934,
- NPC_RUBBLE = 33768,
- NPC_AURIAYA = 33515,
- NPC_MIMIRON = 33350,
- NPC_HODIR = 32845,
- NPC_THORIM = 32865,
- NPC_FREYA = 32906,
- NPC_VEZAX = 33271,
- NPC_YOGGSARON = 33288,
- NPC_ALGALON = 32871,
+ NPC_LEVIATHAN = 33113,
+ NPC_SALVAGED_DEMOLISHER = 33109,
+ NPC_SALVAGED_SIEGE_ENGINE = 33060,
+ NPC_IGNIS = 33118,
+ NPC_RAZORSCALE = 33186,
+ NPC_RAZORSCALE_CONTROLLER = 33233,
+ NPC_STEELFORGED_DEFFENDER = 33236,
+ NPC_EXPEDITION_COMMANDER = 33210,
+ NPC_XT002 = 33293,
+ NPC_XT_TOY_PILE = 33337,
+ NPC_STEELBREAKER = 32867,
+ NPC_MOLGEIM = 32927,
+ NPC_BRUNDIR = 32857,
+ NPC_KOLOGARN = 32930,
+ NPC_FOCUSED_EYEBEAM = 33632,
+ NPC_FOCUSED_EYEBEAM_RIGHT = 33802,
+ NPC_LEFT_ARM = 32933,
+ NPC_RIGHT_ARM = 32934,
+ NPC_RUBBLE = 33768,
+ NPC_AURIAYA = 33515,
+ NPC_MIMIRON = 33350,
+ NPC_HODIR = 32845,
+ NPC_THORIM = 32865,
+ NPC_FREYA = 32906,
+ NPC_VEZAX = 33271,
+ NPC_YOGGSARON = 33288,
+ NPC_ALGALON = 32871,
// Mimiron
- NPC_LEVIATHAN_MKII = 33432,
- NPC_VX_001 = 33651,
- NPC_AERIAL_COMMAND_UNIT = 33670,
+ NPC_LEVIATHAN_MKII = 33432,
+ NPC_VX_001 = 33651,
+ NPC_AERIAL_COMMAND_UNIT = 33670,
// Freya's Keepers
- NPC_IRONBRANCH = 32913,
- NPC_BRIGHTLEAF = 32915,
- NPC_STONEBARK = 32914,
+ NPC_IRONBRANCH = 32913,
+ NPC_BRIGHTLEAF = 32915,
+ NPC_STONEBARK = 32914,
// Hodir's Helper NPCs
- NPC_TOR_GREYCLOUD = 32941,
- NPC_KAR_GREYCLOUD = 33333,
- NPC_EIVI_NIGHTFEATHER = 33325,
- NPC_ELLIE_NIGHTFEATHER = 32901,
- NPC_SPIRITWALKER_TARA = 33332,
- NPC_SPIRITWALKER_YONA = 32950,
- NPC_ELEMENTALIST_MAHFUUN = 33328,
- NPC_ELEMENTALIST_AVUUN = 32900,
- NPC_AMIRA_BLAZEWEAVER = 33331,
- NPC_VEESHA_BLAZEWEAVER = 32946,
- NPC_MISSY_FLAMECUFFS = 32893,
- NPC_SISSY_FLAMECUFFS = 33327,
- NPC_BATTLE_PRIEST_ELIZA = 32948,
- NPC_BATTLE_PRIEST_GINA = 33330,
- NPC_FIELD_MEDIC_PENNY = 32897,
- NPC_FIELD_MEDIC_JESSI = 33326,
+ NPC_TOR_GREYCLOUD = 32941,
+ NPC_KAR_GREYCLOUD = 33333,
+ NPC_EIVI_NIGHTFEATHER = 33325,
+ NPC_ELLIE_NIGHTFEATHER = 32901,
+ NPC_SPIRITWALKER_TARA = 33332,
+ NPC_SPIRITWALKER_YONA = 32950,
+ NPC_ELEMENTALIST_MAHFUUN = 33328,
+ NPC_ELEMENTALIST_AVUUN = 32900,
+ NPC_AMIRA_BLAZEWEAVER = 33331,
+ NPC_VEESHA_BLAZEWEAVER = 32946,
+ NPC_MISSY_FLAMECUFFS = 32893,
+ NPC_SISSY_FLAMECUFFS = 33327,
+ NPC_BATTLE_PRIEST_ELIZA = 32948,
+ NPC_BATTLE_PRIEST_GINA = 33330,
+ NPC_FIELD_MEDIC_PENNY = 32897,
+ NPC_FIELD_MEDIC_JESSI = 33326,
// Freya's trash NPCs
- NPC_CORRUPTED_SERVITOR = 33354,
- NPC_MISGUIDED_NYMPH = 33355,
- NPC_GUARDIAN_LASHER = 33430,
- NPC_FOREST_SWARMER = 33431,
- NPC_MANGROVE_ENT = 33525,
- NPC_IRONROOT_LASHER = 33526,
- NPC_NATURES_BLADE = 33527,
- NPC_GUARDIAN_OF_LIFE = 33528,
+ NPC_CORRUPTED_SERVITOR = 33354,
+ NPC_MISGUIDED_NYMPH = 33355,
+ NPC_GUARDIAN_LASHER = 33430,
+ NPC_FOREST_SWARMER = 33431,
+ NPC_MANGROVE_ENT = 33525,
+ NPC_IRONROOT_LASHER = 33526,
+ NPC_NATURES_BLADE = 33527,
+ NPC_GUARDIAN_OF_LIFE = 33528,
+
+ // Algalon the Observer
+ NPC_BRANN_BRONZBEARD_ALG = 34064,
+ NPC_AZEROTH = 34246,
+ NPC_LIVING_CONSTELLATION = 33052,
+ NPC_ALGALON_STALKER = 33086,
+ NPC_COLLAPSING_STAR = 32955,
+ NPC_BLACK_HOLE = 32953,
+ NPC_WORM_HOLE = 34099,
+ NPC_ALGALON_VOID_ZONE_VISUAL_STALKER = 34100,
+ NPC_ALGALON_STALKER_ASTEROID_TARGET_01 = 33104,
+ NPC_ALGALON_STALKER_ASTEROID_TARGET_02 = 33105,
+ NPC_UNLEASHED_DARK_MATTER = 34097,
};
enum UlduarGameObjects
{
- GO_KOLOGARN_CHEST_HERO = 195047,
- GO_KOLOGARN_CHEST = 195046,
- GO_KOLOGARN_BRIDGE = 194232,
- GO_KOLOGARN_DOOR = 194553,
- GO_THORIM_CHEST_HERO = 194315,
- GO_THORIM_CHEST = 194314,
- GO_HODIR_RARE_CACHE_OF_WINTER = 194200,
- GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201,
- GO_HODIR_CHEST_HERO = 194308,
- GO_HODIR_CHEST = 194307,
- GO_LEVIATHAN_DOOR = 194905,
- GO_LEVIATHAN_GATE = 194630,
- GO_XT_002_DOOR = 194631,
- GO_VEZAX_DOOR = 194750,
- GO_MOLE_MACHINE = 194316,
- GO_RAZOR_HARPOON_1 = 194542,
- GO_RAZOR_HARPOON_2 = 194541,
- GO_RAZOR_HARPOON_3 = 194543,
- GO_RAZOR_HARPOON_4 = 194519,
- GO_RAZOR_BROKEN_HARPOON = 194565,
- GO_HODIR_DOOR = 194634,
- GO_HODIR_ICE_DOOR = 194441,
- GO_ARCHIVUM_DOOR = 194556,
+ GO_KOLOGARN_CHEST_HERO = 195047,
+ GO_KOLOGARN_CHEST = 195046,
+ GO_KOLOGARN_BRIDGE = 194232,
+ GO_KOLOGARN_DOOR = 194553,
+ GO_THORIM_CHEST_HERO = 194315,
+ GO_THORIM_CHEST = 194314,
+ GO_HODIR_RARE_CACHE_OF_WINTER = 194200,
+ GO_HODIR_RARE_CACHE_OF_WINTER_HERO = 194201,
+ GO_HODIR_CHEST_HERO = 194308,
+ GO_HODIR_CHEST = 194307,
+ GO_LEVIATHAN_DOOR = 194905,
+ GO_LEVIATHAN_GATE = 194630,
+ GO_XT_002_DOOR = 194631,
+ GO_VEZAX_DOOR = 194750,
+ GO_MOLE_MACHINE = 194316,
+ GO_RAZOR_HARPOON_1 = 194542,
+ GO_RAZOR_HARPOON_2 = 194541,
+ GO_RAZOR_HARPOON_3 = 194543,
+ GO_RAZOR_HARPOON_4 = 194519,
+ GO_RAZOR_BROKEN_HARPOON = 194565,
+ GO_HODIR_DOOR = 194634,
+ GO_HODIR_ICE_DOOR = 194441,
+ GO_ARCHIVUM_DOOR = 194556,
+
+ // Algalon the Observer
+ GO_CELESTIAL_PLANETARIUM_ACCESS_10 = 194628,
+ GO_CELESTIAL_PLANETARIUM_ACCESS_25 = 194752,
+ GO_DOODAD_UL_SIGILDOOR_01 = 194767,
+ GO_DOODAD_UL_SIGILDOOR_02 = 194911,
+ GO_DOODAD_UL_SIGILDOOR_03 = 194910,
+ GO_DOODAD_UL_UNIVERSEFLOOR_01 = 194715,
+ GO_DOODAD_UL_UNIVERSEFLOOR_02 = 194716,
+ GO_DOODAD_UL_UNIVERSEGLOBE01 = 194148,
+ GO_DOODAD_UL_ULDUAR_TRAPDOOR_03 = 194253,
+ GO_GIFT_OF_THE_OBSERVER_10 = 194821,
+ GO_GIFT_OF_THE_OBSERVER_25 = 194822,
};
enum LeviathanData
@@ -161,6 +190,7 @@ enum UlduarAchievementCriteriaIds
{
CRITERIA_CON_SPEED_ATORY = 21597,
CRITERIA_DISARMED = 21687,
+ CRITERIA_HERALD_OF_TITANS = 10678,
};
enum UlduarData
@@ -180,12 +210,38 @@ enum UlduarData
// Hodir
DATA_HODIR_RARE_CACHE,
+
+ // Algalon the Observer
+ DATA_ALGALON_SUMMON_STATE,
+ DATA_SIGILDOOR_01,
+ DATA_SIGILDOOR_02,
+ DATA_SIGILDOOR_03,
+ DATA_UNIVERSE_FLOOR_01,
+ DATA_UNIVERSE_FLOOR_02,
+ DATA_UNIVERSE_GLOBE,
+ DATA_ALGALON_TRAPDOOR,
+ DATA_BRANN_BRONZEBEARD_ALG,
+};
+
+enum UlduarWorldStates
+{
+ WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131,
+ WORLD_STATE_ALGALON_TIMER_ENABLED = 4132,
};
enum UlduarAchievementData
{
// FL Achievement boolean
DATA_UNBROKEN = 29052906, // 2905, 2906 are achievement IDs,
+ MAX_HERALD_ARMOR_ITEMLEVEL = 226,
+ MAX_HERALD_WEAPON_ITEMLEVEL = 232,
+};
+
+enum UlduarEvents
+{
+ EVENT_DESPAWN_ALGALON = 1,
+ EVENT_UPDATE_ALGALON_TIMER = 2,
+ ACTION_INIT_ALGALON = 6,
};
template<class AI>
@@ -199,6 +255,17 @@ CreatureAI* GetUlduarAI(Creature* creature)
return NULL;
}
+template<class AI>
+GameObjectAI* GetUlduarAI(GameObject* go)
+{
+ if (InstanceMap* instance = go->GetMap()->ToInstanceMap())
+ if (instance->GetInstanceScript())
+ if (instance->GetScriptId() == sObjectMgr->GetScriptId(UlduarScriptName))
+ return new AI(go);
+
+ return NULL;
+}
+
class PlayerOrPetCheck
{
public: