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/World | |
| 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/World')
| -rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 440738f96c..95b7608a57 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -34,6 +34,7 @@ #include "TaskScheduler.h" #include "WaypointMgr.h" #include "World.h" +#include "WorldStateDefines.h" /// @todo: this import is not necessary for compilation and marked as unused by the IDE // however, for some reasons removing it would cause a damn linking issue @@ -186,17 +187,6 @@ public: } }; -/* - * Stranglethorn Vale Fishing Extravaganza World States - */ -enum FishingExtravaganzaWorldStates -{ - STV_FISHING_PREV_WIN_TIME = 197, - STV_FISHING_HAS_WINNER = 198, - STV_FISHING_ANNOUNCE_EVENT_BEGIN = 199, - STV_FISHING_ANNOUNCE_POOLS_DESPAN = 200 -}; - enum RiggleBassbait { RIGGLE_SAY_START = 0, @@ -222,13 +212,13 @@ public: npc_riggle_bassbaitAI(Creature* c) : ScriptedAI(c) { m_uiTimer = 0; - auto prevWinTime = sWorld->getWorldState(STV_FISHING_PREV_WIN_TIME); + auto prevWinTime = sWorld->getWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_PREV_WIN_TIME); if (GameTime::GetGameTime().count() - prevWinTime > DAY) { // reset all after 1 day - sWorld->setWorldState(STV_FISHING_ANNOUNCE_EVENT_BEGIN, 1); - sWorld->setWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN, 0); - sWorld->setWorldState(STV_FISHING_HAS_WINNER, 0); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_EVENT_BEGIN, 1); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_POOLS_DESPAWN, 0); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_HAS_WINNER, 0); } } @@ -236,16 +226,16 @@ public: void CheckTournamentState() const { - if (sGameEventMgr->IsActiveEvent(EVENT_FISHING_TURN_INS) && !sWorld->getWorldState(STV_FISHING_HAS_WINNER)) + if (sGameEventMgr->IsActiveEvent(EVENT_FISHING_TURN_INS) && !sWorld->getWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_HAS_WINNER)) { if (!me->IsQuestGiver()) { me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); } - if (sWorld->getWorldState(STV_FISHING_ANNOUNCE_EVENT_BEGIN)) + if (sWorld->getWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_EVENT_BEGIN)) { me->AI()->Talk(RIGGLE_SAY_START); - sWorld->setWorldState(STV_FISHING_ANNOUNCE_EVENT_BEGIN, 0); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_EVENT_BEGIN, 0); } } else @@ -258,14 +248,14 @@ public: if (sGameEventMgr->IsActiveEvent(EVENT_FISHING_POOLS)) { // enable announcement: when pools despawn - sWorld->setWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN, 1); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_POOLS_DESPAWN, 1); } else { - if (sWorld->getWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN)) + if (sWorld->getWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_POOLS_DESPAWN)) { me->AI()->Talk(RIGGLE_SAY_POOLS_END); - sWorld->setWorldState(STV_FISHING_ANNOUNCE_POOLS_DESPAN, 0); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_ANNOUNCE_POOLS_DESPAWN, 0); } } } @@ -291,7 +281,7 @@ public: player->PrepareQuestMenu(creature->GetGUID()); } - if (sWorld->getWorldState(STV_FISHING_HAS_WINNER)) + if (sWorld->getWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_HAS_WINNER)) { SendGossipMenuFor(player, GOSSIP_EVENT_OVER, creature->GetGUID()); } @@ -308,8 +298,8 @@ public: { creature->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); creature->AI()->Talk(RIGGLE_SAY_WINNER, player); - sWorld->setWorldState(STV_FISHING_PREV_WIN_TIME, GameTime::GetGameTime().count()); - sWorld->setWorldState(STV_FISHING_HAS_WINNER, 1); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_PREV_WIN_TIME, GameTime::GetGameTime().count()); + sWorld->setWorldState(WORLD_STATE_STRANGLETHORN_VALE_FISHING_HAS_WINNER, 1); } return true; } |
