aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp161
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp153
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp59
3 files changed, 163 insertions, 210 deletions
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
index 9cfe56fb275..9853b98487e 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
@@ -21,9 +21,7 @@
enum Spells
{
SPELL_MAGIC_PULL = 51336,
- SPELL_MAGIC_PULL_EFFECT = 50770,
SPELL_THUNDERING_STOMP = 50774,
- SPELL_THUNDERING_STOMP_H = 59370,
SPELL_UNSTABLE_SPHERE_PASSIVE = 50756,
SPELL_UNSTABLE_SPHERE_PULSE = 50757,
SPELL_UNSTABLE_SPHERE_TIMER = 50758,
@@ -47,132 +45,112 @@ enum Yells
SAY_STOMP_3 = -1578011
};
-enum
+enum DrakosAchievement
{
ACHIEV_TIMED_START_EVENT = 18153,
};
+enum DrakosEvents
+{
+ EVENT_MAGIC_PULL = 1,
+ EVENT_STOMP,
+ EVENT_BOMB_SUMMON
+};
+
class boss_drakos : public CreatureScript
{
public:
boss_drakos() : CreatureScript("boss_drakos") { }
- CreatureAI* GetAI(Creature* pCreature) const
+ CreatureAI* GetAI(Creature* creature) const
{
- return new boss_drakosAI (pCreature);
+ return new boss_drakosAI (creature);
}
- struct boss_drakosAI : public ScriptedAI
+ struct boss_drakosAI : public BossAI
{
- boss_drakosAI(Creature* pCreature) : ScriptedAI(pCreature), lSummons(me)
- {
- pInstance = pCreature->GetInstanceScript();
- }
-
- uint32 uiMagicPullTimer;
- uint32 uiStompTimer;
- uint32 uiBombSummonTimer;
-
- bool bPostPull;
-
- InstanceScript* pInstance;
- SummonList lSummons;
+ boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS_EVENT) {}
void Reset()
{
- lSummons.DespawnAll();
- uiMagicPullTimer = 15000;
- uiStompTimer = 17000;
- uiBombSummonTimer = 2000;
+ _Reset();
- bPostPull = false;
+ events.ScheduleEvent(EVENT_MAGIC_PULL,15000);
+ events.ScheduleEvent(EVENT_STOMP,17000);
+ events.ScheduleEvent(EVENT_BOMB_SUMMON,2000);
- if (pInstance)
- pInstance->SetData(DATA_DRAKOS_EVENT, NOT_STARTED);
+ postPull = false;
}
void EnterCombat(Unit* /*who*/)
{
+ _EnterCombat();
DoScriptText(SAY_AGGRO, me);
-
- if (pInstance)
- pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS);
}
- void JustSummoned(Creature* pSummon)
- {
- lSummons.Summon(pSummon);
- }
-
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 diff)
{
//Return since we have no target
if (!UpdateVictim())
return;
- if (uiBombSummonTimer <= uiDiff)
- {
- Position pPosition;
- me->GetPosition(&pPosition);
-
- if (bPostPull)
- {
- for (uint8 uiI = 0; uiI >= 3; uiI++)
- {
- me->GetRandomNearPosition(pPosition, float(urand(0,10)));
- me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition);
- }
- }
- else
- {
- me->GetRandomNearPosition(pPosition, float(urand(0,10)));
- me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition);
- }
-
- uiBombSummonTimer = 2000;
- } else uiBombSummonTimer -= uiDiff;
-
- if (uiMagicPullTimer <= uiDiff)
- {
- DoCast(SPELL_MAGIC_PULL);
-
- bPostPull = true;
+ events.Update(diff);
- uiMagicPullTimer = 15000;
- } else uiMagicPullTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STAT_CASTING))
+ return;
- if (uiStompTimer <= uiDiff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), me);
- DoCast(SPELL_THUNDERING_STOMP);
- uiStompTimer = 17000;
- } else uiStompTimer -= uiDiff;
+ switch (eventId)
+ {
+ case EVENT_BOMB_SUMMON:
+ {
+ Position pPosition;
+ me->GetPosition(&pPosition);
+
+ for (uint8 i = 0; i <= (postPull ? 3 : 0); i++)
+ {
+ me->GetRandomNearPosition(pPosition, float(urand(0,10)));
+ me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition);
+ }
+ }
+ events.ScheduleEvent(EVENT_BOMB_SUMMON,2000);
+ break;
+ case EVENT_MAGIC_PULL:
+ DoCast(SPELL_MAGIC_PULL);
+ postPull = true;
+ events.ScheduleEvent(EVENT_MAGIC_PULL,15000);
+ break;
+ case EVENT_STOMP:
+ DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), me);
+ DoCast(SPELL_THUNDERING_STOMP);
+ events.ScheduleEvent(EVENT_STOMP,17000);
+ break;
+ }
+ }
DoMeleeAttackIfReady();
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ _JustDied();
- if (pInstance)
- {
- pInstance->SetData(DATA_DRAKOS_EVENT, DONE);
- // start achievement timer (kill Eregos within 20 min)
- pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
- }
+ DoScriptText(SAY_DEATH, me);
- lSummons.DespawnAll();
+ // start achievement timer (kill Eregos within 20 min)
+ instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
+
void KilledUnit(Unit* /*victim*/)
{
DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me);
}
+ private:
+ bool postPull;
};
-
};
-
class npc_unstable_sphere : public CreatureScript
{
public:
@@ -185,10 +163,7 @@ public:
struct npc_unstable_sphereAI : public ScriptedAI
{
- npc_unstable_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) {}
-
- uint32 uiPulseTimer;
- uint32 uiDeathTimer;
+ npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) {}
void Reset()
{
@@ -198,27 +173,29 @@ public:
me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me);
me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me);
- uiPulseTimer = 3000;
- uiDeathTimer = 19000;
+ pulseTimer = 3000;
+ deathTimer = 19000;
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (uiPulseTimer <= uiDiff)
+ if (pulseTimer <= diff)
{
DoCast(SPELL_UNSTABLE_SPHERE_PULSE);
- uiPulseTimer = 3*IN_MILLISECONDS;
- } else uiPulseTimer -= uiDiff;
+ pulseTimer = 3*IN_MILLISECONDS;
+ } else pulseTimer -= diff;
- if (uiDeathTimer <= uiDiff)
+ if (deathTimer <= diff)
me->DisappearAndDie();
- else uiDeathTimer -= uiDiff;
+ else deathTimer -= diff;
}
+ private:
+ uint32 pulseTimer;
+ uint32 deathTimer;
};
};
-
void AddSC_boss_drakos()
{
new boss_drakos();
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index c8880ceb3f7..df7954cf1f9 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -66,7 +66,7 @@ enum eCreature
struct Summons
{
- uint32 uiEntry[4];
+ uint32 entry[4];
};
static Summons Group[]=
@@ -96,68 +96,47 @@ public:
return new boss_uromAI (pCreature);
}
- struct boss_uromAI : public ScriptedAI
+ struct boss_uromAI : public BossAI
{
- boss_uromAI(Creature* pCreature) : ScriptedAI(pCreature)
- {
- pInstance = pCreature->GetInstanceScript();
- }
-
- InstanceScript* pInstance;
-
- float x,y;
-
- bool bCanCast;
- bool bCanGoBack;
-
- uint8 uiGroup[3];
-
- uint32 uiTeleportTimer;
- uint32 uiArcaneExplosionTimer;
- uint32 uiCastArcaneExplosionTimer;
- uint32 uiFrostBombTimer;
- uint32 uiTimeBombTimer;
+ boss_uromAI(Creature* creature) : BossAI(creature,DATA_UROM_EVENT) {}
void Reset()
{
- if (pInstance && pInstance->GetData(DATA_VAROS_EVENT) != DONE)
+ if (instance->GetBossState(DATA_VAROS_EVENT) != DONE)
DoCast(SPELL_ARCANE_SHIELD);
- if (pInstance)
- pInstance->SetData(DATA_UROM_EVENT, NOT_STARTED);
+ _Reset();
- if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) == 0)
+ if (instance->GetData(DATA_UROM_PLATAFORM) == 0)
{
- uiGroup[0] = 0;
- uiGroup[1] = 0;
- uiGroup[2] = 0;
+ for (uint8 i = 0; i < 3; i++)
+ group[i] = 0;
}
x = 0.0f;
y = 0.0f;
- bCanCast = false;
- bCanGoBack = false;
+ canCast = false;
+ canGoBack = false;
me->GetMotionMaster()->MoveIdle();
- uiTeleportTimer = urand(30000,35000);
- uiArcaneExplosionTimer = 9000;
- uiCastArcaneExplosionTimer = 2000;
- uiFrostBombTimer = urand(5000,8000);
- uiTimeBombTimer = urand(20000,25000);
+ teleportTimer = urand(30000,35000);
+ arcaneExplosionTimer = 9000;
+ castArcaneExplosionTimer = 2000;
+ frostBombTimer = urand(5000,8000);
+ timeBombTimer = urand(20000,25000);
}
void EnterCombat(Unit* /*pWho*/)
{
- if (pInstance)
- pInstance->SetData(DATA_UROM_EVENT, IN_PROGRESS);
+ _EnterCombat();
SetGroups();
SummonGroups();
CastTeleport();
- if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) != 3)
- pInstance->SetData(DATA_UROM_PLATAFORM,pInstance->GetData(DATA_UROM_PLATAFORM)+1);
+ if (instance->GetData(DATA_UROM_PLATAFORM) != 3)
+ instance->SetData(DATA_UROM_PLATAFORM,instance->GetData(DATA_UROM_PLATAFORM)+1);
}
void AttackStart(Unit* pWho)
@@ -184,20 +163,19 @@ public:
void SetGroups()
{
- if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) != 0)
+ if (!instance || instance->GetData(DATA_UROM_PLATAFORM) != 0)
return;
- while (uiGroup[0] == uiGroup[1] || uiGroup[0] == uiGroup[2] || uiGroup[1] == uiGroup[2])
+ while (group[0] == group[1] || group[0] == group[2] || group[1] == group[2])
{
- uiGroup[0] = urand(0,2);
- uiGroup[1] = urand(0,2);
- uiGroup[2] = urand(0,2);
+ for (uint8 i = 0; i < 3; i++)
+ group[i] = urand(0,2);
}
}
- void SetPosition(uint8 uiI)
+ void SetPosition(uint8 i)
{
- switch(uiI)
+ switch(i)
{
case 0:
x = me->GetPositionX() + 4;
@@ -222,23 +200,23 @@ public:
void SummonGroups()
{
- if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2)
+ if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2)
return;
- for (uint8 uiI = 0; uiI < 4 ; uiI++)
+ for (uint8 i = 0; i < 4 ; i++)
{
- SetPosition(uiI);
- me->SummonCreature(Group[uiGroup[pInstance->GetData(DATA_UROM_PLATAFORM)]].uiEntry[uiI],x,y,me->GetPositionZ(),me->GetOrientation());
+ SetPosition(i);
+ me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i],x,y,me->GetPositionZ(),me->GetOrientation());
}
}
void CastTeleport()
{
- if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2)
+ if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2)
return;
- DoScriptText(SayAggro[pInstance->GetData(DATA_UROM_PLATAFORM)],me);
- DoCast(TeleportSpells[pInstance->GetData(DATA_UROM_PLATAFORM)]);
+ DoScriptText(SayAggro[instance->GetData(DATA_UROM_PLATAFORM)],me);
+ DoCast(TeleportSpells[instance->GetData(DATA_UROM_PLATAFORM)]);
}
void UpdateAI(const uint32 uiDiff)
@@ -247,33 +225,33 @@ public:
if (!UpdateVictim())
return;
- if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2)
+ if (!instance || instance->GetData(DATA_UROM_PLATAFORM) < 2)
return;
- if (uiTeleportTimer <= uiDiff)
+ if (teleportTimer <= uiDiff)
{
me->InterruptNonMeleeSpells(false);
DoScriptText(SAY_TELEPORT,me);
me->GetMotionMaster()->MoveIdle();
DoCast(SPELL_TELEPORT);
- uiTeleportTimer = urand(30000,35000);
+ teleportTimer = urand(30000,35000);
- } else uiTeleportTimer -= uiDiff;
+ } else teleportTimer -= uiDiff;
- if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION))
+ if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION))
{
- if (uiCastArcaneExplosionTimer <= uiDiff)
+ if (castArcaneExplosionTimer <= uiDiff)
{
- bCanCast = false;
- bCanGoBack = true;
+ canCast = false;
+ canGoBack = true;
DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
- uiCastArcaneExplosionTimer = 2000;
- }else uiCastArcaneExplosionTimer -= uiDiff;
+ castArcaneExplosionTimer = 2000;
+ }else castArcaneExplosionTimer -= uiDiff;
}
- if (bCanGoBack)
+ if (canGoBack)
{
- if (uiArcaneExplosionTimer <= uiDiff)
+ if (arcaneExplosionTimer <= uiDiff)
{
Position pPos;
me->getVictim()->GetPosition(&pPos);
@@ -282,27 +260,27 @@ public:
me->GetMotionMaster()->MoveChase(me->getVictim(),0,0);
me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);
- bCanCast = false;
- bCanGoBack = false;
- uiArcaneExplosionTimer = 9000;
- } else uiArcaneExplosionTimer -= uiDiff;
+ canCast = false;
+ canGoBack = false;
+ arcaneExplosionTimer = 9000;
+ } else arcaneExplosionTimer -= uiDiff;
}
if (!me->IsNonMeleeSpellCasted(false, true, true))
{
- if (uiFrostBombTimer <= uiDiff)
+ if (frostBombTimer <= uiDiff)
{
DoCastVictim(SPELL_FROSTBOMB);
- uiFrostBombTimer = urand(5000,8000);
- } else uiFrostBombTimer -= uiDiff;
+ frostBombTimer = urand(5000,8000);
+ } else frostBombTimer -= uiDiff;
- if (uiTimeBombTimer <= uiDiff)
+ if (timeBombTimer <= uiDiff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(pUnit,SPELL_TIME_BOMB);
- uiTimeBombTimer = urand(20000,25000);
- } else uiTimeBombTimer -= uiDiff;
+ timeBombTimer = urand(20000,25000);
+ } else timeBombTimer -= uiDiff;
}
DoMeleeAttackIfReady();
@@ -310,13 +288,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- if (pInstance)
- pInstance->SetData(DATA_UROM_EVENT, DONE);
- }
-
- void JustSummoned(Creature* pSummon)
- {
- pSummon->SetInCombatWithZone();
+ _JustDied();
}
void LeaveCombat()
@@ -344,16 +316,27 @@ public:
break;
case SPELL_TELEPORT:
me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting
- bCanCast = true;
+ canCast = true;
break;
default:
break;
}
}
- };
+ private:
+ float x,y;
-};
+ bool canCast;
+ bool canGoBack;
+ uint8 group[3];
+
+ uint32 teleportTimer;
+ uint32 arcaneExplosionTimer;
+ uint32 castArcaneExplosionTimer;
+ uint32 frostBombTimer;
+ uint32 timeBombTimer;
+ };
+};
void AddSC_boss_urom()
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index 790d961788b..0ff54fedab2 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -42,6 +42,8 @@ public:
void Initialize()
{
+ SetBossNumber(MAX_ENCOUNTER);
+
drakosGUID = 0;
varosGUID = 0;
uromGUID = 0;
@@ -109,7 +111,6 @@ public:
if (nearestDragon)
nearestDragon->AI()->DoAction(ACTION_CALL_DRAGON_EVENT);
-
}
void OnCreatureCreate(Creature* creature)
@@ -151,13 +152,15 @@ public:
}
}
- void SetData(uint32 type, uint32 data)
+ bool SetBossState(uint32 type, EncounterState state)
{
- switch(type)
+ if (!InstanceScript::SetBossState(type, state))
+ return false;
+
+ switch (type)
{
case DATA_DRAKOS_EVENT:
- encounter[0] = data;
- if (data == DONE)
+ if (state == DONE)
{
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW,1);
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT,centrifugueConstructCounter);
@@ -165,34 +168,26 @@ public:
}
break;
case DATA_VAROS_EVENT:
- encounter[1] = data;
- if (encounter[1] == DONE)
+ if (state == DONE)
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW,0);
break;
- case DATA_UROM_EVENT:
- encounter[2] = data;
- break;
- case DATA_EREGOS_EVENT:
- encounter[3] = data;
- break;
+ }
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ switch(type)
+ {
case DATA_UROM_PLATAFORM:
platformUrom = data;
break;
}
-
- if (type <= DATA_EREGOS_EVENT)
- if (data == DONE)
- SaveToDB();
}
uint32 GetData(uint32 type)
{
switch(type)
{
- case DATA_DRAKOS_EVENT: return encounter[0];
- case DATA_VAROS_EVENT: return encounter[1];
- case DATA_UROM_EVENT: return encounter[2];
- case DATA_EREGOS_EVENT: return encounter[3];
case DATA_UROM_PLATAFORM: return platformUrom;
}
@@ -229,7 +224,7 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
- saveStream << "T O " << encounter[0] << " " << encounter[1] << " " << encounter[2] << " " << encounter[3];
+ saveStream << "T O " << GetBossSaveData();
str_data = saveStream.str();
@@ -248,22 +243,21 @@ public:
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
- uint16 data0, data1, data2, data3;
+
std::istringstream loadStream(in);
- loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3;
+ loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'T' && dataHead2 == 'O')
{
- encounter[0] = data0;
- encounter[1] = data1;
- encounter[2] = data2;
- encounter[3] = data3;
-
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
- if (encounter[i] == IN_PROGRESS)
- encounter[i] = NOT_STARTED;
-
+ {
+ uint32 tmpState;
+ loadStream >> tmpState;
+ if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
+ tmpState = NOT_STARTED;
+ SetBossState(i, EncounterState(tmpState));
+ }
} else OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
@@ -277,7 +271,6 @@ public:
uint8 platformUrom;
uint8 centrifugueConstructCounter;
- uint16 encounter[MAX_ENCOUNTER];
std::string str_data;
std::list<uint64> gameObjectList;