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>
This commit is contained in:
Benjamin Jackson
2025-04-26 14:31:30 -04:00
committed by GitHub
parent d23e61b721
commit da55f05cfc
73 changed files with 1828 additions and 1789 deletions

View File

@@ -22,6 +22,7 @@
#include "ScriptedCreature.h"
#include "Transport.h"
#include "WorldPacket.h"
#include "WorldStateDefines.h"
#include "WorldStatePackets.h"
#include "ulduar.h"
@@ -173,8 +174,8 @@ public:
void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override
{
packet.Worldstates.reserve(2);
packet.Worldstates.emplace_back(WORLD_STATE_ALGALON_TIMER_ENABLED, (m_algalonTimer && m_algalonTimer <= 60) ? 1 : 0);
packet.Worldstates.emplace_back(WORLD_STATE_ALGALON_DESPAWN_TIMER, std::min<int32>(m_algalonTimer, 60));
packet.Worldstates.emplace_back(WORLD_STATE_ULDUAR_ALGALON_TIMER_ENABLED, (m_algalonTimer && m_algalonTimer <= 60) ? 1 : 0);
packet.Worldstates.emplace_back(WORLD_STATE_ULDUAR_ALGALON_DESPAWN_TIMER, std::min<int32>(m_algalonTimer, 60));
}
void OnPlayerEnter(Player* player) override
@@ -769,15 +770,15 @@ public:
SaveToDB();
return;
case DATA_DESPAWN_ALGALON:
DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, 60);
DoUpdateWorldState(WORLD_STATE_ULDUAR_ALGALON_TIMER_ENABLED, 1);
DoUpdateWorldState(WORLD_STATE_ULDUAR_ALGALON_DESPAWN_TIMER, 60);
m_algalonTimer = 60;
_events.RescheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 1min);
SaveToDB();
return;
case DATA_ALGALON_SUMMON_STATE:
case DATA_ALGALON_DEFEATED:
DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0);
DoUpdateWorldState(WORLD_STATE_ULDUAR_ALGALON_TIMER_ENABLED, 0);
m_algalonTimer = (type == DATA_ALGALON_DEFEATED ? TIMER_ALGALON_DEFEATED : TIMER_ALGALON_SUMMONED);
_events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER);
SaveToDB();
@@ -1148,8 +1149,8 @@ public:
if (m_algalonTimer && m_algalonTimer <= 60 && GetData(TYPE_ALGALON) != DONE)
{
DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, m_algalonTimer);
DoUpdateWorldState(WORLD_STATE_ULDUAR_ALGALON_TIMER_ENABLED, 1);
DoUpdateWorldState(WORLD_STATE_ULDUAR_ALGALON_DESPAWN_TIMER, m_algalonTimer);
}
data >> C_of_Ulduar_MASK;
@@ -1190,7 +1191,7 @@ public:
}
SaveToDB();
DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, --m_algalonTimer);
DoUpdateWorldState(WORLD_STATE_ULDUAR_ALGALON_DESPAWN_TIMER, --m_algalonTimer);
if (m_algalonTimer)
{
_events.Repeat(1min);

View File

@@ -276,10 +276,6 @@ enum UlduarMisc
ACTION_TOWER_OF_FLAMES_DESTROYED = 3,
ACTION_TOWER_OF_LIFE_DESTROYED = 4,
// Algalon the Observer
WORLD_STATE_ALGALON_DESPAWN_TIMER = 4131,
WORLD_STATE_ALGALON_TIMER_ENABLED = 4132,
EVENT_UPDATE_ALGALON_TIMER = 1,
ACTION_FEEDS_ON_TEARS_FAILED = 0,
ACTION_INIT_ALGALON = 1,