aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcrom <malcromdev@gmail.com>2013-07-10 14:09:32 -0230
committerMalcrom <malcromdev@gmail.com>2013-07-10 14:09:32 -0230
commitf44f004dc5c9b99be3b2f3af43baa027e5de6fea (patch)
tree89ef92e418484f36ec0f15063946898faef879ad
parent4fe0f1339e804d9f392911b8bab1695d0bb1eaad (diff)
Core/Scripting: Fixup Onyxia Script to use events.
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp304
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp186
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h35
3 files changed, 267 insertions, 258 deletions
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 16912a3c7d5..afcbf1f0046 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -40,7 +40,6 @@ enum Yells
SAY_KILL = 1,
SAY_PHASE_2_TRANS = 2,
SAY_PHASE_3_TRANS = 3,
-
// Emote
EMOTE_BREATH = 4
};
@@ -75,6 +74,20 @@ enum Spells
SPELL_BELLOWING_ROAR = 18431
};
+enum Events
+{
+ EVENT_BELLOWING_ROAR = 1,
+ EVENT_FLAME_BREATH = 2,
+ EVENT_TAIL_SWEEP = 3,
+ EVENT_CLEAVE = 4,
+ EVENT_WING_BUFFET = 5,
+ EVENT_DEEP_BREATH = 6,
+ EVENT_MOVEMENT = 7,
+ EVENT_FIREBALL = 8,
+ EVENT_LAIR_GUARD = 9,
+ EVENT_WHELP_SPAWN = 10
+};
+
struct OnyxMove
{
uint8 LocId;
@@ -113,73 +126,28 @@ class boss_onyxia : public CreatureScript
public:
boss_onyxia() : CreatureScript("boss_onyxia") { }
- CreatureAI* GetAI(Creature* creature) const OVERRIDE
- {
- return new boss_onyxiaAI(creature);
- }
-
- struct boss_onyxiaAI : public ScriptedAI
+ struct boss_onyxiaAI : public BossAI
{
- boss_onyxiaAI(Creature* creature) : ScriptedAI(creature), Summons(me)
+ boss_onyxiaAI(Creature* creature) : BossAI(creature, DATA_ONYXIA), Summons(me)
{
- instance = creature->GetInstanceScript();
Reset();
}
- InstanceScript* instance;
- SummonList Summons;
-
- uint32 Phase;
-
- uint32 FlameBreathTimer;
- uint32 CleaveTimer;
- uint32 TailSweepTimer;
- uint32 WingBuffetTimer;
-
- uint8 MovePoint;
- uint32 MovementTimer;
- OnyxMove* PointData;
-
- uint32 FireballTimer;
- uint32 WhelpTimer;
- uint32 LairGuardTimer;
- uint32 DeepBreathTimer;
-
- uint32 BellowingRoarTimer;
-
- uint8 SummonWhelpCount;
- bool IsMoving;
-
void Reset() OVERRIDE
{
if (!IsCombatMovementAllowed())
SetCombatMovement(true);
Phase = PHASE_START;
-
- FlameBreathTimer = urand(10000, 20000);
- TailSweepTimer = urand(15000, 20000);
- CleaveTimer = urand(2000, 5000);
- WingBuffetTimer = urand(10000, 20000);
-
MovePoint = urand(0, 5);
- MovementTimer = 14000;
PointData = GetMoveData();
-
- FireballTimer = 15000;
- WhelpTimer = 60000;
- LairGuardTimer = 60000;
- DeepBreathTimer = 85000;
-
- BellowingRoarTimer = 30000;
-
Summons.DespawnAll();
SummonWhelpCount = 0;
IsMoving = false;
if (instance)
{
- instance->SetData(DATA_ONYXIA, NOT_STARTED);
+ instance->SetBossState(DATA_ONYXIA, NOT_STARTED);
instance->SetData(DATA_ONYXIA_PHASE, Phase);
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
@@ -190,9 +158,14 @@ public:
Talk(SAY_AGGRO);
me->SetInCombatWithZone();
+ events.ScheduleEvent(EVENT_FLAME_BREATH, urand (10000, 20000));
+ events.ScheduleEvent(EVENT_TAIL_SWEEP, urand (15000, 20000));
+ events.ScheduleEvent(EVENT_CLEAVE, urand (2000, 5000));
+ events.ScheduleEvent(EVENT_WING_BUFFET, urand (10000, 20000));
+
if (instance)
{
- instance->SetData(DATA_ONYXIA, IN_PROGRESS);
+ instance->SetBossState(DATA_ONYXIA, IN_PROGRESS);
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
}
@@ -200,7 +173,7 @@ public:
void JustDied(Unit* /*killer*/) OVERRIDE
{
if (instance)
- instance->SetData(DATA_ONYXIA, DONE);
+ instance->SetBossState(DATA_ONYXIA, DONE);
Summons.DespawnAll();
}
@@ -266,7 +239,7 @@ public:
break;
case 9:
me->GetMotionMaster()->MoveChase(me->GetVictim());
- BellowingRoarTimer = 1000;
+ events.ScheduleEvent(EVENT_BELLOWING_ROAR, 1000);
break;
case 10:
me->SetCanFly(true);
@@ -275,17 +248,15 @@ public:
Talk(SAY_PHASE_2_TRANS);
if (instance)
instance->SetData(DATA_ONYXIA_PHASE, Phase);
- WhelpTimer = 5000;
- LairGuardTimer = 15000;
+ events.ScheduleEvent(EVENT_WHELP_SPAWN, 5000);
+ events.ScheduleEvent(EVENT_LAIR_GUARD, 15000);
break;
case 11:
if (PointData)
me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ);
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveIdle();
-
break;
-
default:
IsMoving = false;
break;
@@ -341,7 +312,7 @@ public:
MovePoint = iTemp;
}
- void UpdateAI(uint32 Diff) OVERRIDE
+ void UpdateAI(uint32 diff) OVERRIDE
{
if (!UpdateVictim())
return;
@@ -356,60 +327,55 @@ public:
{
SetCombatMovement(false);
Phase = PHASE_BREATH;
+ events.ScheduleEvent(EVENT_DEEP_BREATH, 85000);
+ events.ScheduleEvent(EVENT_MOVEMENT, 14000);
+ events.ScheduleEvent(EVENT_FIREBALL, 15000);
+ events.ScheduleEvent(EVENT_LAIR_GUARD, 60000);
+ events.ScheduleEvent(EVENT_WHELP_SPAWN, 60000);
me->GetMotionMaster()->MovePoint(10, Phase2Location);
return;
}
}
- else
- {
- if (BellowingRoarTimer <= Diff)
- {
- DoCastVictim(SPELL_BELLOWING_ROAR);
- // Eruption
- GameObject* Floor = NULL;
- Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15);
- Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check);
- me->VisitNearbyGridObject(30, searcher);
- if (instance && Floor)
- instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID());
- BellowingRoarTimer = 30000;
- }
- else
- BellowingRoarTimer -= Diff;
- }
-
- if (FlameBreathTimer <= Diff)
- {
- DoCastVictim(SPELL_FLAME_BREATH);
- FlameBreathTimer = urand(10000, 20000);
- }
- else
- FlameBreathTimer -= Diff;
-
- if (TailSweepTimer <= Diff)
- {
- DoCastAOE(SPELL_TAIL_SWEEP);
- TailSweepTimer = urand(15000, 20000);
- }
- else
- TailSweepTimer -= Diff;
- if (CleaveTimer <= Diff)
- {
- DoCastVictim(SPELL_CLEAVE);
- CleaveTimer = urand(2000, 5000);
- }
- else
- CleaveTimer -= Diff;
+ events.Update(diff);
- if (WingBuffetTimer <= Diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- DoCastVictim(SPELL_WING_BUFFET);
- WingBuffetTimer = urand(15000, 30000);
+ switch (eventId)
+ {
+ case EVENT_BELLOWING_ROAR: // Phase PHASE_END
+ {
+ DoCastVictim(SPELL_BELLOWING_ROAR);
+ // Eruption
+ GameObject* Floor = NULL;
+ Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15);
+ Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, Floor, check);
+ me->VisitNearbyGridObject(30, searcher);
+ if (instance && Floor)
+ instance->SetData64(DATA_FLOOR_ERUPTION_GUID, Floor->GetGUID());
+ events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000);
+ break;
+ }
+ case EVENT_FLAME_BREATH: // Phase PHASE_START and PHASE_END
+ DoCastVictim(SPELL_FLAME_BREATH);
+ events.ScheduleEvent(EVENT_FLAME_BREATH, urand (10000, 20000));
+ break;
+ case EVENT_TAIL_SWEEP: // Phase PHASE_START and PHASE_END
+ DoCastAOE(SPELL_TAIL_SWEEP);
+ events.ScheduleEvent(EVENT_TAIL_SWEEP, urand (15000, 20000));
+ break;
+ case EVENT_CLEAVE: // Phase PHASE_START and PHASE_END
+ DoCastVictim(SPELL_CLEAVE);
+ events.ScheduleEvent(EVENT_CLEAVE, urand (2000, 5000));
+ break;
+ case EVENT_WING_BUFFET: // Phase PHASE_START and PHASE_END
+ DoCastVictim(SPELL_WING_BUFFET);
+ events.ScheduleEvent(EVENT_WING_BUFFET, urand (15000, 30000));
+ break;
+ default:
+ break;
+ }
}
- else
- WingBuffetTimer -= Diff;
-
DoMeleeAttackIfReady();
}
else
@@ -418,88 +384,92 @@ public:
{
Phase = PHASE_END;
if (instance)
- instance->SetData(DATA_ONYXIA_PHASE, Phase);
+ instance->SetData(DATA_ONYXIA_PHASE, PHASE_END);
Talk(SAY_PHASE_3_TRANS);
SetCombatMovement(true);
me->SetCanFly(false);
IsMoving = false;
me->GetMotionMaster()->MovePoint(9, me->GetHomePosition());
+ events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000);
return;
}
- if (DeepBreathTimer <= Diff)
- {
- if (!IsMoving)
- {
- if (me->IsNonMeleeSpellCasted(false))
- me->InterruptNonMeleeSpells(false);
-
- Talk(EMOTE_BREATH);
- DoCast(me, PointData->SpellId);
- DeepBreathTimer = 70000;
- }
- }
- else
- DeepBreathTimer -= Diff;
-
- if (MovementTimer <= Diff)
- {
- if (!IsMoving)
- {
- SetNextRandomPoint();
- PointData = GetMoveData();
-
- if (!PointData)
- return;
-
- me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ);
- IsMoving = true;
- MovementTimer = 25000;
- }
- }
- else
- MovementTimer -= Diff;
-
- if (FireballTimer <= Diff)
- {
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_FIREBALL);
-
- FireballTimer = 8000;
- }
- }
- else
- FireballTimer -= Diff;
+ events.Update(diff);
- if (LairGuardTimer <= Diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- me->SummonCreature(NPC_LAIRGUARD, SpawnLocations[2], TEMPSUMMON_CORPSE_DESPAWN);
- LairGuardTimer = 30000;
- }
- else
- LairGuardTimer -= Diff;
-
- if (WhelpTimer <= Diff)
- {
- me->SummonCreature(NPC_WHELP, SpawnLocations[0], TEMPSUMMON_CORPSE_DESPAWN);
- me->SummonCreature(NPC_WHELP, SpawnLocations[1], TEMPSUMMON_CORPSE_DESPAWN);
- if (SummonWhelpCount >= RAID_MODE(20, 40))
+ switch (eventId)
{
- SummonWhelpCount = 0;
- WhelpTimer = 90000;
+ case EVENT_DEEP_BREATH: // Phase PHASE_BREATH
+ if (!IsMoving)
+ {
+ if (me->IsNonMeleeSpellCasted(false))
+ me->InterruptNonMeleeSpells(false);
+
+ Talk(EMOTE_BREATH);
+ DoCast(me, PointData->SpellId);
+ events.ScheduleEvent(EVENT_DEEP_BREATH, 70000);
+ }
+ break;
+ case EVENT_MOVEMENT: // Phase PHASE_BREATH
+ if (!IsMoving)
+ {
+ SetNextRandomPoint();
+ PointData = GetMoveData();
+
+ if (!PointData)
+ return;
+
+ me->GetMotionMaster()->MovePoint(PointData->LocId, PointData->fX, PointData->fY, PointData->fZ);
+ IsMoving = true;
+ events.ScheduleEvent(EVENT_MOVEMENT, 25000);
+ }
+ break;
+ case EVENT_FIREBALL: // Phase PHASE_BREATH
+ if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
+ {
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_FIREBALL);
+
+ events.ScheduleEvent(EVENT_FIREBALL, 8000);
+ }
+ break;
+ case EVENT_LAIR_GUARD: // Phase PHASE_BREATH
+ me->SummonCreature(NPC_LAIRGUARD, SpawnLocations[2], TEMPSUMMON_CORPSE_DESPAWN);
+ events.ScheduleEvent(EVENT_LAIR_GUARD, 30000);
+ break;
+ case EVENT_WHELP_SPAWN: // Phase PHASE_BREATH
+ me->SummonCreature(NPC_WHELP, SpawnLocations[0], TEMPSUMMON_CORPSE_DESPAWN);
+ me->SummonCreature(NPC_WHELP, SpawnLocations[1], TEMPSUMMON_CORPSE_DESPAWN);
+ if (SummonWhelpCount >= RAID_MODE(20, 40))
+ {
+ SummonWhelpCount = 0;
+ events.ScheduleEvent(EVENT_WHELP_SPAWN, 90000);
+ }
+ else
+ events.ScheduleEvent(EVENT_WHELP_SPAWN, 500);
+ break;
+ default:
+ break;
}
- else
- WhelpTimer = 500;
}
- else
- WhelpTimer -= Diff;
}
}
+
+ private:
+ SummonList Summons;
+ OnyxMove* PointData;
+ uint8 Phase;
+ uint8 MovePoint;
+ uint8 SummonWhelpCount;
+ bool IsMoving;
};
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
+ {
+ return new boss_onyxiaAI(creature);
+ }
};
void AddSC_boss_onyxia()
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
index 6ae8a2ef709..ccbb4846270 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
@@ -47,30 +47,18 @@ public:
//Eruption is a BFS graph problem
//One map to remember all floor, one map to keep floor that still need to erupt and one queue to know what needs to be removed
- std::map<uint64, uint32> FloorEruptionGUID[2];
- std::queue<uint64> FloorEruptionGUIDQueue;
-
- uint64 OnyxiasGUID;
- uint32 OnyxiaLiftoffTimer;
- uint32 ManyWhelpsCounter;
- uint32 EruptTimer;
-
- uint8 Encounter[MAX_ENCOUNTER];
-
- bool AchievManyWhelpsHandleIt;
- bool AchievSheDeepBreathMore;
void Initialize()
{
- memset(&Encounter, 0, sizeof(Encounter));
+ SetBossNumber(EncounterCount);
- OnyxiasGUID = 0;
- OnyxiaLiftoffTimer = 0;
- ManyWhelpsCounter = 0;
- AchievManyWhelpsHandleIt = false;
- AchievSheDeepBreathMore = true;
+ onyxiaGUID = 0;
+ onyxiaLiftoffTimer = 0;
+ manyWhelpsCounter = 0;
+ eruptTimer = 0;
- EruptTimer = 0;
+ achievManyWhelpsHandleIt = false;
+ achievSheDeepBreathMore = true;
}
void OnCreatureCreate(Creature* creature)
@@ -78,7 +66,7 @@ public:
switch (creature->GetEntry())
{
case NPC_ONYXIA:
- OnyxiasGUID = creature->GetGUID();
+ onyxiaGUID = creature->GetGUID();
break;
}
}
@@ -99,7 +87,7 @@ public:
if (Creature* temp = go->SummonCreature(NPC_WHELP, goPos, TEMPSUMMON_CORPSE_DESPAWN))
{
temp->SetInCombatWithZone();
- ++ManyWhelpsCounter;
+ ++manyWhelpsCounter;
}
break;
}
@@ -116,18 +104,18 @@ public:
void FloorEruption(uint64 floorEruptedGUID)
{
- if (GameObject* pFloorEruption = instance->GetGameObject(floorEruptedGUID))
+ if (GameObject* floorEruption = instance->GetGameObject(floorEruptedGUID))
{
//THIS GOB IS A TRAP - What shall i do? =(
//Cast it spell? Copyed Heigan method
- pFloorEruption->SendCustomAnim(pFloorEruption->GetGoAnimProgress());
- pFloorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
+ floorEruption->SendCustomAnim(floorEruption->GetGoAnimProgress());
+ floorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId
//Get all immediatly nearby floors
std::list<GameObject*> nearFloorList;
- Trinity::GameObjectInRangeCheck check(pFloorEruption->GetPositionX(), pFloorEruption->GetPositionY(), pFloorEruption->GetPositionZ(), 15);
- Trinity::GameObjectListSearcher<Trinity::GameObjectInRangeCheck> searcher(pFloorEruption, nearFloorList, check);
- pFloorEruption->VisitNearbyGridObject(999, searcher);
+ Trinity::GameObjectInRangeCheck check(floorEruption->GetPositionX(), floorEruption->GetPositionY(), floorEruption->GetPositionZ(), 15);
+ Trinity::GameObjectListSearcher<Trinity::GameObjectInRangeCheck> searcher(floorEruption, nearFloorList, check);
+ floorEruption->VisitNearbyGridObject(999, searcher);
//remove all that are not present on FloorEruptionGUID[1] and update treeLen on each GUID
for (std::list<GameObject*>::const_iterator itr = nearFloorList.begin(); itr != nearFloorList.end(); ++itr)
{
@@ -145,88 +133,84 @@ public:
FloorEruptionGUID[1].erase(floorEruptedGUID);
}
- void SetData(uint32 Type, uint32 Data) OVERRIDE
+ bool SetBossState(uint32 type, EncounterState state)
{
- switch (Type)
+ if (!InstanceScript::SetBossState(type, state))
+ return false;
+
+ switch (type)
{
case DATA_ONYXIA:
- Encounter[0] = Data;
- if (Data == IN_PROGRESS)
- SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS);
+ if (state == IN_PROGRESS)
+ SetBossState(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS);
break;
+ }
+ return true;
+ }
+
+ void SetData(uint32 type, uint32 data) OVERRIDE
+ {
+ switch (type)
+ {
case DATA_ONYXIA_PHASE:
- if (Data == PHASE_BREATH) //Used to mark the liftoff phase
+ if (data == PHASE_BREATH) //Used to mark the liftoff phase
{
- AchievManyWhelpsHandleIt = false;
- ManyWhelpsCounter = 0;
- OnyxiaLiftoffTimer = 10*IN_MILLISECONDS;
+ achievManyWhelpsHandleIt = false;
+ manyWhelpsCounter = 0;
+ onyxiaLiftoffTimer = 10000;
}
break;
case DATA_SHE_DEEP_BREATH_MORE:
- if (Data == IN_PROGRESS)
+ if (data == IN_PROGRESS)
{
- AchievSheDeepBreathMore = true;
+ achievSheDeepBreathMore = true;
}
- else if (Data == FAIL)
+ else if (data == FAIL)
{
- AchievSheDeepBreathMore = false;
+ achievSheDeepBreathMore = false;
}
break;
}
-
- if (Type < MAX_ENCOUNTER && Data == DONE)
- SaveToDB();
}
- void SetData64(uint32 Type, uint64 Data) OVERRIDE
+ void SetData64(uint32 type, uint64 data) OVERRIDE
{
- switch (Type)
+ switch (type)
{
case DATA_FLOOR_ERUPTION_GUID:
FloorEruptionGUID[1] = FloorEruptionGUID[0];
- FloorEruptionGUIDQueue.push(Data);
- EruptTimer = 2500;
+ FloorEruptionGUIDQueue.push(data);
+ eruptTimer = 2500;
break;
}
}
- uint32 GetData(uint32 Type) const OVERRIDE
+ uint64 GetData64(uint32 data) const OVERRIDE
{
- switch (Type)
+ switch (data)
{
- case DATA_ONYXIA:
- return Encounter[0];
- }
-
- return 0;
- }
-
- uint64 GetData64(uint32 Data) const OVERRIDE
- {
- switch (Data)
- {
- case DATA_ONYXIA_GUID:
- return OnyxiasGUID;
+ case NPC_ONYXIA:
+ return onyxiaGUID;
}
return 0;
}
- void Update(uint32 Diff)
+ void Update(uint32 diff)
{
- if (GetData(DATA_ONYXIA) == IN_PROGRESS)
+ if (GetBossState(DATA_ONYXIA) == IN_PROGRESS)
{
- if (OnyxiaLiftoffTimer && OnyxiaLiftoffTimer <= Diff)
+ if (onyxiaLiftoffTimer && onyxiaLiftoffTimer <= diff)
{
- OnyxiaLiftoffTimer = 0;
- if (ManyWhelpsCounter >= 50)
- AchievManyWhelpsHandleIt = true;
- } else OnyxiaLiftoffTimer -= Diff;
+ onyxiaLiftoffTimer = 0;
+ if (manyWhelpsCounter >= 50)
+ achievManyWhelpsHandleIt = true;
+ } else onyxiaLiftoffTimer -= diff;
}
if (!FloorEruptionGUIDQueue.empty())
{
- if (EruptTimer <= Diff)
+ if (eruptTimer <= diff)
{
uint32 treeHeight = 0;
do
@@ -235,10 +219,10 @@ public:
FloorEruption(FloorEruptionGUIDQueue.front());
FloorEruptionGUIDQueue.pop();
} while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight);
- EruptTimer = 1000;
+ eruptTimer = 1000;
}
else
- EruptTimer -= Diff;
+ eruptTimer -= diff;
}
}
@@ -248,15 +232,67 @@ public:
{
case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s
case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s
- return AchievManyWhelpsHandleIt;
+ return achievManyWhelpsHandleIt;
case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath
case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath
- return AchievSheDeepBreathMore;
+ return achievSheDeepBreathMore;
}
return false;
}
- };
+ std::string GetSaveData()
+ {
+ OUT_SAVE_INST_DATA;
+
+ std::ostringstream saveStream;
+ saveStream << "O L " << GetBossSaveData();
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return saveStream.str();
+ }
+
+ void Load(const char* strIn)
+ {
+ if (!strIn)
+ {
+ OUT_LOAD_INST_DATA_FAIL;
+ return;
+ }
+
+ OUT_LOAD_INST_DATA(strIn);
+
+ char dataHead1, dataHead2;
+
+ std::istringstream loadStream(strIn);
+ loadStream >> dataHead1 >> dataHead2;
+
+ if (dataHead1 == 'O' && dataHead2 == 'L')
+ {
+ for (uint8 i = 0; i < EncounterCount; ++i)
+ {
+ 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;
+ }
+
+ protected:
+ std::map<uint64, uint32> FloorEruptionGUID[2];
+ std::queue<uint64> FloorEruptionGUIDQueue;
+ uint64 onyxiaGUID;
+ uint32 onyxiaLiftoffTimer;
+ uint32 manyWhelpsCounter;
+ uint32 eruptTimer;
+ bool achievManyWhelpsHandleIt;
+ bool achievSheDeepBreathMore;
+ };
};
void AddSC_instance_onyxias_lair()
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
index 91faf6dedb0..bf5010e4658 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h
@@ -18,28 +18,24 @@
#ifndef DEF_ONYXIAS_LAIR_H
#define DEF_ONYXIAS_LAIR_H
-enum Data64
+uint32 const EncounterCount = 1;
+
+enum DataTypes
{
- DATA_ONYXIA_GUID,
- DATA_FLOOR_ERUPTION_GUID
+ DATA_ONYXIA = 0,
};
-enum InstanceData
+enum Data32
{
- DATA_ONYXIA,
- MAX_ENCOUNTER,
-
- DATA_ONYXIA_PHASE,
- DATA_SHE_DEEP_BREATH_MORE,
- DATA_MANY_WHELPS_COUNT
+ DATA_ONYXIA_PHASE = 0,
+ DATA_SHE_DEEP_BREATH_MORE = 1,
+ DATA_MANY_WHELPS_COUNT = 2
};
-enum Creatures
+enum Data64
{
- NPC_WHELP = 11262,
- NPC_LAIRGUARD = 36561,
-
- NPC_ONYXIA = 10184
+ DATA_ONYXIA_GUID = 0,
+ DATA_FLOOR_ERUPTION_GUID = 1
};
enum OnyxiaPhases
@@ -49,7 +45,14 @@ enum OnyxiaPhases
PHASE_END = 3
};
-enum GameObjects
+enum CreatureIds
+{
+ NPC_WHELP = 11262,
+ NPC_LAIRGUARD = 36561,
+ NPC_ONYXIA = 10184
+};
+
+enum GameObjectIds
{
GO_WHELP_SPAWNER = 176510,
GO_WHELP_EGG = 176511