diff options
| author | Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> | 2025-04-26 14:31:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-26 19:31:30 +0100 |
| commit | da55f05cfc2db9bb49a37cd0b3697bbda565856a (patch) | |
| tree | 7623c618953a3b4de41730e1bc04239b89832b6f /src/server/scripts/Kalimdor | |
| parent | d23e61b7219d7bae1aea36a63b860372c9f00173 (diff) | |
refactor(Core/WorldState): Initial addition of world state definition file. (#21875)
Many world states had their enums from script's header and hardcoded values to their respective header file (WorldStateDefines.h)
Co-authored-by: Jelle Meeus <sogladev@gmail.com>
Diffstat (limited to 'src/server/scripts/Kalimdor')
9 files changed, 44 insertions, 63 deletions
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h index 54ba1eab30..f18773262f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h @@ -51,13 +51,6 @@ enum DataTypes DATA_BOSS_WAVE = 27 }; -enum HyjalWorldStateIds -{ - WORLD_STATE_WAVES = 2842, - WORLD_STATE_ENEMY = 2453, - WORLD_STATE_ENEMYCOUNT = 2454 -}; - enum HyjalCreaturesIds { // Trash Mobs summoned in waves diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 51b66ae147..e28cb85d1f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -19,6 +19,7 @@ #include "InstanceMapScript.h" #include "InstanceScript.h" #include "Player.h" +#include "WorldStateDefines.h" #include "hyjal.h" /* Battle of Mount Hyjal encounters: @@ -193,7 +194,7 @@ public: { if (_currentWave == 0 && _initialWaves) creature->SetReputationRewardDisabled(true); - DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, ++_trash); // Update the instance wave count on new trash spawn + DoUpdateWorldState(WORLD_STATE_HYJAL_ENEMY_COUNT, ++_trash); // Update the instance wave count on new trash spawn _encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe } break; @@ -231,7 +232,7 @@ public: { if (_bossWave != TO_BE_DECIDED) { - DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, --_trash); // Update the instance wave count on new trash death + DoUpdateWorldState(WORLD_STATE_HYJAL_ENEMY_COUNT, --_trash); // Update the instance wave count on new trash death _encounterNPCs.erase(creature->GetGUID()); // Used for despawning on wipe if (_trash == 0) // It can reach negatives if trash spawned after a retreat are killed, it shouldn't affect anything. Also happens on retail @@ -406,7 +407,7 @@ public: if (_bossWave != TO_BE_DECIDED) { - DoUpdateWorldState(WORLD_STATE_WAVES, 0); + DoUpdateWorldState(WORLD_STATE_HYJAL_WAVES, 0); scheduler.Schedule(30s, [this](TaskContext context) { if (IsEncounterInProgress()) @@ -491,9 +492,9 @@ public: _trash = 0; _bossWave = TO_BE_DECIDED; _retreat = 0; - DoUpdateWorldState(WORLD_STATE_WAVES, _currentWave); - DoUpdateWorldState(WORLD_STATE_ENEMY, _trash); - DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, _trash); + DoUpdateWorldState(WORLD_STATE_HYJAL_WAVES, _currentWave); + DoUpdateWorldState(WORLD_STATE_HYJAL_ENEMY, _trash); + DoUpdateWorldState(WORLD_STATE_HYJAL_ENEMY_COUNT, _trash); break; } @@ -548,8 +549,8 @@ public: context.Repeat(timerptr[_currentWave]); if (++_currentWave < maxWaves && _bossWave != TO_BE_DECIDED) { - DoUpdateWorldState(WORLD_STATE_WAVES, _currentWave); - DoUpdateWorldState(WORLD_STATE_ENEMY, 1); + DoUpdateWorldState(WORLD_STATE_HYJAL_WAVES, _currentWave); + DoUpdateWorldState(WORLD_STATE_HYJAL_ENEMY, 1); } context.SetGroup(CONTEXT_GROUP_WAVES); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 98b8839ed4..511a6c0205 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -23,6 +23,7 @@ #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" #include "SpellInfo.h" +#include "WorldStateDefines.h" enum Says { @@ -924,7 +925,7 @@ public: break; case EVENT_ACTION_PHASE2+9: if (pInstance) - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 0); + pInstance->DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT, 0); Talk(SAY_PHASE210); eventInRun = false; @@ -1274,7 +1275,7 @@ void npc_arthas::npc_arthasAI::ReorderInstance(uint32 data) else // if (data == COS_PROGRESS_KILLED_SALRAMM) { if (pInstance) - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 10); + pInstance->DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT, 10); DoAction(ACTION_KILLED_SALRAMM); } break; @@ -1331,7 +1332,7 @@ void npc_arthas::npc_arthasAI::SendNextWave(uint32 entry) else SummonNextWave(); - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, waveGroupId + 1); + pInstance->DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT, waveGroupId + 1); } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h index 28d7a36dd2..cbf8b8b132 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h @@ -73,15 +73,6 @@ enum GameObjects GO_PLAGUED_CRATE = 190095, }; -enum WorldStatesCoT -{ - WORLDSTATE_SHOW_CRATES = 3479, - WORLDSTATE_CRATES_REVEALED = 3480, - WORLDSTATE_WAVE_COUNT = 3504, - WORLDSTATE_TIME_GUARDIAN = 3931, - WORLDSTATE_TIME_GUARDIAN_SHOW = 3932, -}; - enum CrateSpells { SPELL_CRATES_CREDIT = 58109, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index 8d8d7eb23d..700b69eaf4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -22,6 +22,7 @@ #include "ScriptedCreature.h" #include "SpellInfo.h" #include "TemporarySummon.h" +#include "WorldStateDefines.h" #include "WorldStatePackets.h" #include "culling_of_stratholme.h" @@ -57,11 +58,11 @@ public: void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { packet.Worldstates.reserve(5); - packet.Worldstates.emplace_back(WORLDSTATE_SHOW_CRATES, 0); - packet.Worldstates.emplace_back(WORLDSTATE_CRATES_REVEALED, _crateCount); - packet.Worldstates.emplace_back(WORLDSTATE_WAVE_COUNT, 0); - packet.Worldstates.emplace_back(WORLDSTATE_TIME_GUARDIAN, 25); - packet.Worldstates.emplace_back(WORLDSTATE_TIME_GUARDIAN_SHOW, 0); + packet.Worldstates.emplace_back(WORLD_STATE_CULLING_OF_STRATHOLME_SHOW_CRATES, 0); + packet.Worldstates.emplace_back(WORLD_STATE_CULLING_OF_STRATHOLME_CRATES_REVEALED, _crateCount); + packet.Worldstates.emplace_back(WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT, 0); + packet.Worldstates.emplace_back(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN, 25); + packet.Worldstates.emplace_back(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN_SHOW, 0); } void OnPlayerEnter(Player* plr) override @@ -112,13 +113,13 @@ public: switch (type) { case DATA_SHOW_CRATES: - DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, data); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_SHOW_CRATES, data); return; case DATA_SHOW_INFINITE_TIMER: if (!instance->IsHeroic() || !_guardianTimer) return; - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, data); - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, uint32(_guardianTimer / (MINUTE * IN_MILLISECONDS))); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN_SHOW, data); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN, uint32(_guardianTimer / (MINUTE * IN_MILLISECONDS))); if (data == 0) { _guardianTimer = 0; @@ -128,10 +129,10 @@ public: instance->SummonCreature(NPC_INFINITE, EventPos[EVENT_SRC_CORRUPTOR]); return; case DATA_START_WAVES: - DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 1); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_WAVE_COUNT, 1); if (instance->IsHeroic()) { - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, true); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN_SHOW, true); _guardianTimer = 26 * MINUTE * IN_MILLISECONDS; if (!_infiniteGUID) instance->SummonCreature(NPC_INFINITE, EventPos[EVENT_SRC_CORRUPTOR]); @@ -151,7 +152,7 @@ public: SetData(DATA_ARTHAS_EVENT, COS_PROGRESS_CRATES_FOUND); } - DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_CRATES_REVEALED, _crateCount); return; case DATA_ARTHAS_EVENT: // Start Event @@ -256,7 +257,7 @@ public: if (divAfter == 0) { _guardianTimer = 0; - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, 0); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN_SHOW, 0); // Inform infinite we run out of time if (instance->IsHeroic() && _infiniteGUID) @@ -270,7 +271,7 @@ public: else if (divAfter == 1) ChromieWhisper(2); - DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, divAfter); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_TIME_GUARDIAN, divAfter); SaveToDB(); } } @@ -290,7 +291,7 @@ public: ChromieWhisper(0); // hide crates count - DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, 0); + DoUpdateWorldState(WORLD_STATE_CULLING_OF_STRATHOLME_SHOW_CRATES, 0); _showCrateTimer = 0; _encounterState = COS_PROGRESS_CRATES_FOUND; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index fdbd0b4f74..95df719872 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -19,6 +19,7 @@ #include "InstanceMapScript.h" #include "InstanceScript.h" #include "Player.h" +#include "WorldStateDefines.h" #include "old_hillsbrad.h" static Position const instancePositions[INSTANCE_POSITIONS_COUNT] = @@ -70,7 +71,7 @@ public: CleanupInstance(); if (_encounterProgress < ENCOUNTER_PROGRESS_BARRELS) - player->SendUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, _barrelCount); + player->SendUpdateWorldState(WORLD_STATE_OLD_HILLSBRAD_BARRELS_PLANTED, _barrelCount); } void CleanupInstance() @@ -153,7 +154,7 @@ public: if (_barrelCount >= 5 || _encounterProgress > ENCOUNTER_PROGRESS_NONE) return; - DoUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, ++_barrelCount); + DoUpdateWorldState(WORLD_STATE_OLD_HILLSBRAD_BARRELS_PLANTED, ++_barrelCount); if (_barrelCount == 5) { _events.ScheduleEvent(EVENT_INITIAL_BARRELS_FLAME, 4000); @@ -237,7 +238,7 @@ public: orc->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); SetData(DATA_ESCORT_PROGRESS, ENCOUNTER_PROGRESS_BARRELS); - DoUpdateWorldState(WORLD_STATE_BARRELS_PLANTED, 0); + DoUpdateWorldState(WORLD_STATE_OLD_HILLSBRAD_BARRELS_PLANTED, 0); break; } case EVENT_SUMMON_LIEUTENANT: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h index 57a692b1a8..ce3de8590e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h @@ -69,7 +69,6 @@ enum GobjectIds enum MiscIds { - WORLD_STATE_BARRELS_PLANTED = 2436, SKARLOC_MOUNT_MODEL = 18223, ENCOUNTER_PROGRESS_NONE = 0, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index 1551eefbdb..78a0dbbdc4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -18,6 +18,7 @@ #include "InstanceMapScript.h" #include "InstanceScript.h" #include "Player.h" +#include "WorldStateDefines.h" #include "the_black_morass.h" const Position PortalLocation[4] = @@ -180,9 +181,9 @@ public: CleanupInstance(); } - player->SendUpdateWorldState(WORLD_STATE_BM, _eventStatus); - player->SendUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); - player->SendUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); + player->SendUpdateWorldState(WORLD_STATE_BLACK_MORASS, _eventStatus); + player->SendUpdateWorldState(WORLD_STATE_BLACK_MORASS_SHIELD, _shieldPercent); + player->SendUpdateWorldState(WORLD_STATE_BLACK_MORASS_RIFT, _currentRift); } void ScheduleNextPortal(Milliseconds time, Position lastPosition) @@ -219,7 +220,7 @@ public: _availableRiftPositions.remove(spawnPos); - DoUpdateWorldState(WORLD_STATE_BM_RIFT, ++_currentRift); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS_RIFT, ++_currentRift); instance->SummonCreature(NPC_TIME_RIFT, spawnPos); @@ -318,9 +319,9 @@ public: { _eventStatus = EVENT_IN_PROGRESS; - DoUpdateWorldState(WORLD_STATE_BM, _eventStatus); - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); - DoUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS, _eventStatus); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS_SHIELD, _shieldPercent); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS_RIFT, _currentRift); ScheduleNextPortal(3s, Position(0.0f, 0.0f, 0.0f, 0.0f)); @@ -339,7 +340,7 @@ public: _shieldPercent = 0; } - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS_SHIELD, _shieldPercent); if (!_shieldPercent) { @@ -421,9 +422,9 @@ public: { CleanupInstance(); - DoUpdateWorldState(WORLD_STATE_BM, _eventStatus); - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, _shieldPercent); - DoUpdateWorldState(WORLD_STATE_BM_RIFT, _currentRift); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS, _eventStatus); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS_SHIELD, _shieldPercent); + DoUpdateWorldState(WORLD_STATE_BLACK_MORASS_RIFT, _currentRift); }); }); }); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h index 0eac0cb3f0..e162b7f77e 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.h @@ -40,13 +40,6 @@ enum DataTypes DATA_RIFT_NUMBER = 14 }; -enum WorldStateIds -{ - WORLD_STATE_BM = 2541, - WORLD_STATE_BM_SHIELD = 2540, - WORLD_STATE_BM_RIFT = 2784 -}; - enum EventStatus { EVENT_PREPARE = 0, |
