From 3e3148e9102c067173b3f4b0c1eded3dde55c780 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:55:33 -0700 Subject: [PATCH] Move dZoneManager to game namespace (#1143) * convert zone manager to game namespace * Destroy logger last --- dCommon/Game.h | 2 ++ dGame/Character.cpp | 6 ++--- dGame/Entity.cpp | 14 +++++------ dGame/EntityManager.cpp | 4 ++-- dGame/Player.cpp | 2 +- dGame/dBehaviors/PropertyTeleportBehavior.cpp | 4 ++-- dGame/dComponents/CharacterComponent.cpp | 4 ++-- .../ControllablePhysicsComponent.cpp | 2 +- dGame/dComponents/DestroyableComponent.cpp | 8 +++---- dGame/dComponents/InventoryComponent.cpp | 2 +- dGame/dComponents/MissionComponent.cpp | 2 +- dGame/dComponents/MovingPlatformComponent.cpp | 2 +- .../PropertyManagementComponent.cpp | 24 +++++++++---------- dGame/dComponents/PropertyVendorComponent.cpp | 2 +- dGame/dComponents/RacingControlComponent.cpp | 18 +++++++------- .../dComponents/ScriptedActivityComponent.cpp | 4 ++-- dGame/dComponents/TriggerComponent.cpp | 10 ++++---- dGame/dGameMessages/GameMessageHandler.cpp | 2 +- dGame/dGameMessages/GameMessages.cpp | 18 +++++++------- dGame/dMission/Mission.cpp | 6 ++--- dGame/dMission/MissionTask.cpp | 2 +- dGame/dUtilities/Mail.cpp | 4 ++-- dGame/dUtilities/SlashCommandHandler.cpp | 18 +++++++------- dNet/WorldPackets.cpp | 2 +- .../Enemy/AG/BossSpiderQueenEnemyServer.cpp | 4 ++-- .../02_server/Map/AM/AmDropshipComputer.cpp | 6 ++--- .../02_server/Map/FV/ImgBrickConsoleQB.cpp | 16 ++++++------- .../Map/FV/Racing/RaceMaelstromGeiser.cpp | 2 +- .../02_server/Map/General/PetDigServer.cpp | 8 +++---- dScripts/02_server/Map/NS/NsLegoClubDoor.cpp | 2 +- dScripts/02_server/Map/NS/NsLupTeleport.cpp | 2 +- .../Map/Property/AG_Small/ZoneAgProperty.cpp | 8 +++---- .../02_server/Map/njhub/CavePrisonCage.cpp | 2 +- dScripts/02_server/Map/njhub/Lieutenant.cpp | 2 +- .../02_server/Map/njhub/MonCoreNookDoors.cpp | 2 +- .../boss_instance/NjMonastryBossInstance.cpp | 14 +++++------ .../General/MinigameTreasureChestServer.cpp | 4 ++-- dScripts/BasePropertyServer.cpp | 18 +++++++------- dScripts/BaseRandomServer.cpp | 2 +- dScripts/BaseSurvivalServer.cpp | 10 ++++---- dScripts/BaseWavesGenericEnemy.cpp | 2 +- dScripts/BaseWavesServer.cpp | 4 ++-- dScripts/ai/ACT/ActVehicleDeathTrigger.cpp | 2 +- dScripts/ai/FV/FvBrickPuzzleServer.cpp | 6 ++--- dScripts/ai/FV/FvFacilityBrick.cpp | 6 ++--- dScripts/ai/GF/GfJailWalls.cpp | 8 +++---- dScripts/ai/GF/TriggerAmbush.cpp | 4 ++-- .../ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp | 4 ++-- dScripts/ai/PROPERTY/AgPropguards.cpp | 2 +- dWorldServer/WorldServer.cpp | 17 +++++++------ dZoneManager/Level.cpp | 8 +++---- dZoneManager/Spawner.cpp | 4 ++-- dZoneManager/Zone.cpp | 2 +- dZoneManager/dZoneManager.cpp | 2 -- dZoneManager/dZoneManager.h | 9 ------- 55 files changed, 169 insertions(+), 175 deletions(-) diff --git a/dCommon/Game.h b/dCommon/Game.h index f099734a..09ac6f6e 100644 --- a/dCommon/Game.h +++ b/dCommon/Game.h @@ -11,6 +11,7 @@ class RakPeerInterface; class AssetManager; struct SystemAddress; class EntityManager; +class dZoneManager; namespace Game { extern dLogger* logger; @@ -24,4 +25,5 @@ namespace Game { extern SystemAddress chatSysAddr; extern bool shouldShutdown; extern EntityManager* entityManager; + extern dZoneManager* zoneManager; } diff --git a/dGame/Character.cpp b/dGame/Character.cpp index aa734271..c5602bf2 100644 --- a/dGame/Character.cpp +++ b/dGame/Character.cpp @@ -241,7 +241,7 @@ void Character::DoQuickXMLDataParse() { //To try and fix the AG landing into: if (m_ZoneID == 1000 && Game::server->GetZoneID() == 1100) { //sneakily insert our position: - auto pos = dZoneManager::Instance()->GetZone()->GetSpawnPos(); + auto pos = Game::zoneManager->GetZone()->GetSpawnPos(); character->SetAttribute("lzx", pos.x); character->SetAttribute("lzy", pos.y); character->SetAttribute("lzz", pos.z); @@ -296,7 +296,7 @@ void Character::UnlockEmote(int emoteID) { void Character::SetBuildMode(bool buildMode) { m_BuildMode = buildMode; - auto* controller = dZoneManager::Instance()->GetZoneControlObject(); + auto* controller = Game::zoneManager->GetZoneControlObject(); controller->OnFireEventServerSide(m_OurEntity, buildMode ? "OnBuildModeEnter" : "OnBuildModeLeave"); } @@ -312,7 +312,7 @@ void Character::SaveXMLToDatabase() { character->SetAttribute("gm", static_cast(m_GMLevel)); character->SetAttribute("cc", m_Coins); - auto zoneInfo = dZoneManager::Instance()->GetZone()->GetZoneID(); + auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID(); // lzid garbage, binary concat of zoneID, zoneInstance and zoneClone if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0) { uint64_t lzidConcat = zoneInfo.GetCloneID(); diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index adf26c78..998541ad 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -267,13 +267,13 @@ void Entity::Initialize() { if (m_Character->HasBeenToWorld(mapID) && targetSceneName.empty()) { pos = m_Character->GetRespawnPoint(mapID); - rot = dZoneManager::Instance()->GetZone()->GetSpawnRot(); + rot = Game::zoneManager->GetZone()->GetSpawnRot(); } else if (targetScene != nullptr) { pos = targetScene->GetPosition(); rot = targetScene->GetRotation(); } else { - pos = dZoneManager::Instance()->GetZone()->GetSpawnPos(); - rot = dZoneManager::Instance()->GetZone()->GetSpawnRot(); + pos = Game::zoneManager->GetZone()->GetSpawnPos(); + rot = Game::zoneManager->GetZone()->GetSpawnRot(); } controllablePhysics->SetPosition(pos); @@ -505,7 +505,7 @@ void Entity::Initialize() { // ZoneControl script if (m_TemplateID == 2365) { CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable(); - const auto zoneID = dZoneManager::Instance()->GetZoneID(); + const auto zoneID = Game::zoneManager->GetZoneID(); const CDZoneTable* zoneData = zoneTable->Query(zoneID.GetMapID()); if (zoneData != nullptr) { @@ -691,7 +691,7 @@ void Entity::Initialize() { } std::string pathName = GetVarAsString(u"attached_path"); - const Path* path = dZoneManager::Instance()->GetZone()->GetPath(pathName); + const Path* path = Game::zoneManager->GetZone()->GetPath(pathName); //Check to see if we have an attached path and add the appropiate component to handle it: if (path){ @@ -1544,14 +1544,14 @@ void Entity::Kill(Entity* murderer) { const auto& grpNameQBShowBricks = GetVar(u"grpNameQBShowBricks"); if (!grpNameQBShowBricks.empty()) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(grpNameQBShowBricks); + auto spawners = Game::zoneManager->GetSpawnersByName(grpNameQBShowBricks); Spawner* spawner = nullptr; if (!spawners.empty()) { spawner = spawners[0]; } else { - spawners = dZoneManager::Instance()->GetSpawnersInGroup(grpNameQBShowBricks); + spawners = Game::zoneManager->GetSpawnersInGroup(grpNameQBShowBricks); if (!spawners.empty()) { spawner = spawners[0]; diff --git a/dGame/EntityManager.cpp b/dGame/EntityManager.cpp index e0baa61a..28b5f526 100644 --- a/dGame/EntityManager.cpp +++ b/dGame/EntityManager.cpp @@ -60,7 +60,7 @@ void EntityManager::Initialize() { m_GhostingEnabled = std::find( m_GhostingExcludedZones.begin(), m_GhostingExcludedZones.end(), - dZoneManager::Instance()->GetZoneID().GetMapID() + Game::zoneManager->GetZoneID().GetMapID() ) == m_GhostingExcludedZones.end(); // grab hardcore mode settings and load them with sane defaults @@ -75,7 +75,7 @@ void EntityManager::Initialize() { // If cloneID is not zero, then hardcore mode is disabled // aka minigames and props - if (dZoneManager::Instance()->GetZoneID().GetCloneID() != 0) m_HardcoreMode = false; + if (Game::zoneManager->GetZoneID().GetCloneID() != 0) m_HardcoreMode = false; } Entity* EntityManager::CreateEntity(EntityInfo info, User* user, Entity* parentEntity, const bool controller, const LWOOBJID explicitId) { diff --git a/dGame/Player.cpp b/dGame/Player.cpp index 55881dca..48b983aa 100644 --- a/dGame/Player.cpp +++ b/dGame/Player.cpp @@ -62,7 +62,7 @@ void Player::SetSystemAddress(const SystemAddress& value) { void Player::SetRespawnPos(const NiPoint3 position) { m_respawnPos = position; - m_Character->SetRespawnPoint(dZoneManager::Instance()->GetZone()->GetWorldID(), position); + m_Character->SetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID(), position); } void Player::SetRespawnRot(const NiQuaternion rotation) { diff --git a/dGame/dBehaviors/PropertyTeleportBehavior.cpp b/dGame/dBehaviors/PropertyTeleportBehavior.cpp index c49c821d..309fc929 100644 --- a/dGame/dBehaviors/PropertyTeleportBehavior.cpp +++ b/dGame/dBehaviors/PropertyTeleportBehavior.cpp @@ -23,11 +23,11 @@ void PropertyTeleportBehavior::Handle(BehaviorContext* context, RakNet::BitStrea LWOMAPID targetMapId = m_MapId; LWOCLONEID targetCloneId = character->GetPropertyCloneID(); - if (dZoneManager::Instance()->GetZoneID().GetCloneID() == character->GetPropertyCloneID()) { + if (Game::zoneManager->GetZoneID().GetCloneID() == character->GetPropertyCloneID()) { targetMapId = character->GetLastNonInstanceZoneID(); targetCloneId = 0; } else { - character->SetLastNonInstanceZoneID(dZoneManager::Instance()->GetZoneID().GetMapID()); + character->SetLastNonInstanceZoneID(Game::zoneManager->GetZoneID().GetMapID()); } ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, targetMapId, targetCloneId, false, [objId](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index 32fe564c..10a4e9db 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -419,7 +419,7 @@ void CharacterComponent::TrackMissionCompletion(bool isAchievement) { // Achievements are tracked separately for the zone if (isAchievement) { - const auto mapID = dZoneManager::Instance()->GetZoneID().GetMapID(); + const auto mapID = Game::zoneManager->GetZoneID().GetMapID(); GetZoneStatisticsForMap(mapID).m_AchievementsCollected++; } } @@ -480,7 +480,7 @@ void CharacterComponent::TrackArmorDelta(int32_t armor) { void CharacterComponent::TrackRebuildComplete() { UpdatePlayerStatistic(QuickBuildsCompleted); - const auto mapID = dZoneManager::Instance()->GetZoneID().GetMapID(); + const auto mapID = Game::zoneManager->GetZoneID().GetMapID(); GetZoneStatisticsForMap(mapID).m_QuickBuildsCompleted++; } diff --git a/dGame/dComponents/ControllablePhysicsComponent.cpp b/dGame/dComponents/ControllablePhysicsComponent.cpp index 2d5d6209..a658ccd7 100644 --- a/dGame/dComponents/ControllablePhysicsComponent.cpp +++ b/dGame/dComponents/ControllablePhysicsComponent.cpp @@ -194,7 +194,7 @@ void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) { return; } - auto zoneInfo = dZoneManager::Instance()->GetZone()->GetZoneID(); + auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID(); if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0) { character->SetAttribute("lzx", m_Position.x); diff --git a/dGame/dComponents/DestroyableComponent.cpp b/dGame/dComponents/DestroyableComponent.cpp index 11b5895a..4c726bad 100644 --- a/dGame/dComponents/DestroyableComponent.cpp +++ b/dGame/dComponents/DestroyableComponent.cpp @@ -779,13 +779,13 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType } } else { //Check if this zone allows coin drops - if (dZoneManager::Instance()->GetPlayerLoseCoinOnDeath()) { + if (Game::zoneManager->GetPlayerLoseCoinOnDeath()) { auto* character = m_Parent->GetCharacter(); uint64_t coinsTotal = character->GetCoins(); - const uint64_t minCoinsToLose = dZoneManager::Instance()->GetWorldConfig()->coinsLostOnDeathMin; + const uint64_t minCoinsToLose = Game::zoneManager->GetWorldConfig()->coinsLostOnDeathMin; if (coinsTotal >= minCoinsToLose) { - const uint64_t maxCoinsToLose = dZoneManager::Instance()->GetWorldConfig()->coinsLostOnDeathMax; - const float coinPercentageToLose = dZoneManager::Instance()->GetWorldConfig()->coinsLostOnDeathPercent; + const uint64_t maxCoinsToLose = Game::zoneManager->GetWorldConfig()->coinsLostOnDeathMax; + const float coinPercentageToLose = Game::zoneManager->GetWorldConfig()->coinsLostOnDeathPercent; uint64_t coinsToLose = std::max(static_cast(coinsTotal * coinPercentageToLose), minCoinsToLose); coinsToLose = std::min(maxCoinsToLose, coinsToLose); diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index be1edb27..66b47e52 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -922,7 +922,7 @@ void InventoryComponent::UnEquipItem(Item* item) { // Trigger property event if (PropertyManagementComponent::Instance() != nullptr && item->GetCount() > 0 && Inventory::FindInventoryTypeForLot(item->GetLot()) == MODELS) { PropertyManagementComponent::Instance()->GetParent()->OnZonePropertyModelRemovedWhileEquipped(m_Parent); - dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyModelRemovedWhileEquipped(m_Parent); + Game::zoneManager->GetZoneControlObject()->OnZonePropertyModelRemovedWhileEquipped(m_Parent); } } diff --git a/dGame/dComponents/MissionComponent.cpp b/dGame/dComponents/MissionComponent.cpp index 8f61c1aa..40411902 100644 --- a/dGame/dComponents/MissionComponent.cpp +++ b/dGame/dComponents/MissionComponent.cpp @@ -26,7 +26,7 @@ std::unordered_map> MissionComponent: //! Initializer MissionComponent::MissionComponent(Entity* parent) : Component(parent) { - m_LastUsedMissionOrderUID = dZoneManager::Instance()->GetUniqueMissionIdStartingValue(); + m_LastUsedMissionOrderUID = Game::zoneManager->GetUniqueMissionIdStartingValue(); } //! Destructor diff --git a/dGame/dComponents/MovingPlatformComponent.cpp b/dGame/dComponents/MovingPlatformComponent.cpp index 3b3acb72..f4dcdbe9 100644 --- a/dGame/dComponents/MovingPlatformComponent.cpp +++ b/dGame/dComponents/MovingPlatformComponent.cpp @@ -59,7 +59,7 @@ MovingPlatformComponent::MovingPlatformComponent(Entity* parent, const std::stri m_MoverSubComponentType = eMoverSubComponentType::mover; m_MoverSubComponent = new MoverSubComponent(m_Parent->GetDefaultPosition()); m_PathName = GeneralUtils::ASCIIToUTF16(pathName); - m_Path = dZoneManager::Instance()->GetZone()->GetPath(pathName); + m_Path = Game::zoneManager->GetZone()->GetPath(pathName); m_NoAutoStart = false; if (m_Path == nullptr) { diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index 25d7fb80..c8937c35 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -38,7 +38,7 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo instance = this; - const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID(); + const auto& worldId = Game::zoneManager->GetZone()->GetZoneID(); const auto zoneId = worldId.GetMapID(); const auto cloneId = worldId.GetCloneID(); @@ -98,7 +98,7 @@ void PropertyManagementComponent::SetOwner(Entity* value) { } std::vector PropertyManagementComponent::GetPaths() const { - const auto zoneId = dZoneManager::Instance()->GetZone()->GetWorldID(); + const auto zoneId = Game::zoneManager->GetZone()->GetWorldID(); auto query = CDClientDatabase::CreatePreppedStmt( "SELECT path FROM PropertyTemplate WHERE mapID = ?;"); @@ -192,7 +192,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) { auto character = entity->GetCharacter(); if (!character) return false; - auto* zone = dZoneManager::Instance()->GetZone(); + auto* zone = Game::zoneManager->GetZone(); const auto& worldId = zone->GetZoneID(); const auto propertyZoneId = worldId.GetMapID(); @@ -240,7 +240,7 @@ bool PropertyManagementComponent::Claim(const LWOOBJID playerId) { return false; } - auto* zoneControlObject = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneControlObject = Game::zoneManager->GetZoneControlObject(); for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControlObject)) { script->OnZonePropertyRented(zoneControlObject, entity); } @@ -376,9 +376,9 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N info.spawnerID = persistentId; GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT); - const auto spawnerId = dZoneManager::Instance()->MakeSpawner(info); + const auto spawnerId = Game::zoneManager->MakeSpawner(info); - auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId); + auto* spawner = Game::zoneManager->GetSpawner(spawnerId); auto ldfModelBehavior = new LDFData(u"modelBehaviors", 0); auto userModelID = new LDFData(u"userModelID", info.spawnerID); @@ -433,7 +433,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet const auto spawnerId = index->second; - auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId); + auto* spawner = Game::zoneManager->GetSpawner(spawnerId); models.erase(id); @@ -496,7 +496,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3::ZERO, LWOOBJID_EMPTY, 16, NiQuaternion::IDENTITY); if (spawner != nullptr) { - dZoneManager::Instance()->RemoveSpawner(spawner->m_Info.spawnerID); + Game::zoneManager->RemoveSpawner(spawner->m_Info.spawnerID); } else { model->Smash(LWOOBJID_EMPTY, eKillType::SILENT); } @@ -549,7 +549,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet GameMessages::SendPlaceModelResponse(entity->GetObjectID(), entity->GetSystemAddress(), NiPoint3::ZERO, LWOOBJID_EMPTY, 16, NiQuaternion::IDENTITY); if (spawner != nullptr) { - dZoneManager::Instance()->RemoveSpawner(spawner->m_Info.spawnerID); + Game::zoneManager->RemoveSpawner(spawner->m_Info.spawnerID); } else { model->Smash(LWOOBJID_EMPTY, eKillType::SILENT); } @@ -652,9 +652,9 @@ void PropertyManagementComponent::Load() { node->config = settings; - const auto spawnerId = dZoneManager::Instance()->MakeSpawner(info); + const auto spawnerId = Game::zoneManager->MakeSpawner(info); - auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId); + auto* spawner = Game::zoneManager->GetSpawner(spawnerId); auto* model = spawner->Spawn(); @@ -786,7 +786,7 @@ void PropertyManagementComponent::OnQueryPropertyData(Entity* originator, const author = m_Parent->GetObjectID(); } - const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID(); + const auto& worldId = Game::zoneManager->GetZone()->GetZoneID(); const auto zoneId = worldId.GetMapID(); Game::logger->Log("Properties", "Getting property info for %d", zoneId); diff --git a/dGame/dComponents/PropertyVendorComponent.cpp b/dGame/dComponents/PropertyVendorComponent.cpp index ed89bfc7..cff4995c 100644 --- a/dGame/dComponents/PropertyVendorComponent.cpp +++ b/dGame/dComponents/PropertyVendorComponent.cpp @@ -43,7 +43,7 @@ void PropertyVendorComponent::OnBuyFromVendor(Entity* originator, const bool con GameMessages::SendPropertyRentalResponse(m_Parent->GetObjectID(), 0, 0, 0, 0, originator->GetSystemAddress()); - auto* controller = dZoneManager::Instance()->GetZoneControlObject(); + auto* controller = Game::zoneManager->GetZoneControlObject(); controller->OnFireEventServerSide(m_Parent, "propertyRented"); diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index 8dd23e53..d669049d 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -49,7 +49,7 @@ RacingControlComponent::RacingControlComponent(Entity* parent) m_MainWorld = 1200; const auto worldID = Game::server->GetZoneID(); - if (dZoneManager::Instance()->CheckIfAccessibleZone((worldID/10)*10)) m_MainWorld = (worldID/10)*10; + if (Game::zoneManager->CheckIfAccessibleZone((worldID/10)*10)) m_MainWorld = (worldID/10)*10; m_ActivityID = 42; CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable(); @@ -105,7 +105,7 @@ void RacingControlComponent::LoadPlayerVehicle(Entity* player, // Calculate the vehicle's starting position. - auto* path = dZoneManager::Instance()->GetZone()->GetPath( + auto* path = Game::zoneManager->GetZone()->GetPath( GeneralUtils::UTF16ToWTF8(m_PathName)); auto spawnPointEntities = Game::entityManager->GetEntitiesByLOT(4843); @@ -394,11 +394,11 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu if (m_SoloRacing || m_LoadedPlayers > 2) { missionComponent->Progress(eMissionTaskType::RACING, data->finished, (LWOOBJID)eRacingTaskParam::FINISH_WITH_PLACEMENT); // Finish in 1st place on a race if (data->finished == 1) { - missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. - missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::WIN_RACE_IN_WORLD); // Finished first place in specific world. + missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. + missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::WIN_RACE_IN_WORLD); // Finished first place in specific world. } if (data->finished == m_LoadedPlayers) { - missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::LAST_PLACE_FINISH); // Finished first place in specific world. + missionComponent->Progress(eMissionTaskType::RACING, Game::zoneManager->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::LAST_PLACE_FINISH); // Finished first place in specific world. } } } else if ((id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") && button == m_ActivityExitConfirm) { @@ -650,11 +650,11 @@ void RacingControlComponent::Update(float deltaTime) { } // Spawn imagination pickups - auto* minSpawner = dZoneManager::Instance()->GetSpawnersByName( + auto* minSpawner = Game::zoneManager->GetSpawnersByName( "ImaginationSpawn_Min")[0]; - auto* medSpawner = dZoneManager::Instance()->GetSpawnersByName( + auto* medSpawner = Game::zoneManager->GetSpawnersByName( "ImaginationSpawn_Med")[0]; - auto* maxSpawner = dZoneManager::Instance()->GetSpawnersByName( + auto* maxSpawner = Game::zoneManager->GetSpawnersByName( "ImaginationSpawn_Max")[0]; minSpawner->Activate(); @@ -723,7 +723,7 @@ void RacingControlComponent::Update(float deltaTime) { } // Race routines - auto* path = dZoneManager::Instance()->GetZone()->GetPath( + auto* path = Game::zoneManager->GetZone()->GetPath( GeneralUtils::UTF16ToWTF8(m_PathName)); for (auto& player : m_RacingPlayers) { diff --git a/dGame/dComponents/ScriptedActivityComponent.cpp b/dGame/dComponents/ScriptedActivityComponent.cpp index 2bf788c3..23c65ae1 100644 --- a/dGame/dComponents/ScriptedActivityComponent.cpp +++ b/dGame/dComponents/ScriptedActivityComponent.cpp @@ -149,7 +149,7 @@ void ScriptedActivityComponent::PlayerJoinLobby(Entity* player) { auto* character = player->GetCharacter(); if (character != nullptr) - character->SetLastNonInstanceZoneID(dZoneManager::Instance()->GetZone()->GetWorldID()); + character->SetLastNonInstanceZoneID(Game::zoneManager->GetZone()->GetWorldID()); for (Lobby* lobby : m_Queue) { if (lobby->players.size() < m_ActivityInfo.maxTeamSize || m_ActivityInfo.maxTeamSize == 1 && lobby->players.size() < m_ActivityInfo.maxTeams) { @@ -310,7 +310,7 @@ bool ScriptedActivityComponent::IsValidActivity(Entity* player) { } ChatPackets::SendSystemMessage(player->GetSystemAddress(), u"Sorry, this activity is not ready."); - static_cast(player)->SendToZone(dZoneManager::Instance()->GetZone()->GetWorldID()); // Gets them out of this stuck state + static_cast(player)->SendToZone(Game::zoneManager->GetZone()->GetWorldID()); // Gets them out of this stuck state return false; }*/ diff --git a/dGame/dComponents/TriggerComponent.cpp b/dGame/dComponents/TriggerComponent.cpp index 963bfe8f..ab52c4e5 100644 --- a/dGame/dComponents/TriggerComponent.cpp +++ b/dGame/dComponents/TriggerComponent.cpp @@ -26,7 +26,7 @@ TriggerComponent::TriggerComponent(Entity* parent, const std::string triggerInfo uint32_t triggerID; GeneralUtils::TryParse(tokens.at(1), triggerID); - m_Trigger = dZoneManager::Instance()->GetZone()->GetTrigger(sceneID, triggerID); + m_Trigger = Game::zoneManager->GetZone()->GetTrigger(sceneID, triggerID); if (!m_Trigger) m_Trigger = new LUTriggers::Trigger(); } @@ -409,25 +409,25 @@ void TriggerComponent::HandleSetPhysicsVolumeStatus(Entity* targetEntity, std::s } void TriggerComponent::HandleActivateSpawnerNetwork(std::string args){ - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(args)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(args)) { if (spawner) spawner->Activate(); } } void TriggerComponent::HandleDeactivateSpawnerNetwork(std::string args){ - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(args)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(args)) { if (spawner) spawner->Deactivate(); } } void TriggerComponent::HandleResetSpawnerNetwork(std::string args){ - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(args)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(args)) { if (spawner) spawner->Reset(); } } void TriggerComponent::HandleDestroySpawnerNetworkObjects(std::string args){ - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(args)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(args)) { if (spawner) spawner->DestroyAllEntities(); } } diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index ddb7d6f3..83005b6f 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -170,7 +170,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System // After we've done our thing, tell the client they're ready GameMessages::SendPlayerReady(entity, sysAddr); - GameMessages::SendPlayerReady(dZoneManager::Instance()->GetZoneControlObject(), sysAddr); + GameMessages::SendPlayerReady(Game::zoneManager->GetZoneControlObject(), sysAddr); break; } diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 390699e4..05f47844 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -2355,13 +2355,13 @@ void GameMessages::HandleStartBuildingWithItem(RakNet::BitStream* inStream, Enti void GameMessages::HandlePropertyEditorBegin(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { PropertyManagementComponent::Instance()->OnStartBuilding(); - dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyEditBegin(); + Game::zoneManager->GetZoneControlObject()->OnZonePropertyEditBegin(); } void GameMessages::HandlePropertyEditorEnd(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { PropertyManagementComponent::Instance()->OnFinishBuilding(); - dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyEditEnd(); + Game::zoneManager->GetZoneControlObject()->OnZonePropertyEditEnd(); } void GameMessages::HandlePropertyContentsFromClient(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { @@ -2373,7 +2373,7 @@ void GameMessages::HandlePropertyContentsFromClient(RakNet::BitStream* inStream, } void GameMessages::HandlePropertyModelEquipped(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { - dZoneManager::Instance()->GetZoneControlObject()->OnZonePropertyModelEquipped(); + Game::zoneManager->GetZoneControlObject()->OnZonePropertyModelEquipped(); } void GameMessages::HandlePlacePropertyModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { @@ -2599,7 +2599,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT); //We need to get the propertyID: (stolen from Wincent's propertyManagementComp) - const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID(); + const auto& worldId = Game::zoneManager->GetZone()->GetZoneID(); const auto zoneId = worldId.GetMapID(); const auto cloneId = worldId.GetCloneID(); @@ -4137,7 +4137,7 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity* return; } - auto* racingControlComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent(); + auto* racingControlComponent = Game::zoneManager->GetZoneControlObject()->GetComponent(); if (racingControlComponent == nullptr) { return; @@ -4185,7 +4185,7 @@ void GameMessages::HandleRequestDie(RakNet::BitStream* inStream, Entity* entity, inStream->Read(lootOwnerID); } - auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneController = Game::zoneManager->GetZoneControlObject(); auto* racingControlComponent = zoneController->GetComponent(); @@ -4228,7 +4228,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre return; } - auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneController = Game::zoneManager->GetZoneControlObject(); auto* racingControlComponent = zoneController->GetComponent(); @@ -4258,7 +4258,7 @@ void GameMessages::HandleUpdatePropertyPerformanceCost(RakNet::BitStream* inStre if (performanceCost == 0.0f) return; - auto zone = dZoneManager::Instance()->GetZone(); + auto zone = Game::zoneManager->GetZone(); const auto& worldId = zone->GetZoneID(); const auto cloneId = worldId.GetCloneID(); const auto zoneId = worldId.GetMapID(); @@ -4990,7 +4990,7 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity } if (mapId == 0) { - mapId = dZoneManager::Instance()->GetZoneID().GetMapID(); // Fallback to sending the player back to the same zone. + mapId = Game::zoneManager->GetZoneID().GetMapID(); // Fallback to sending the player back to the same zone. } Game::logger->Log("FireEventServerSide", "Player %llu has requested zone transfer to (%i, %i).", sender->GetObjectID(), (int)mapId, (int)cloneId); diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index bd5c67e9..34641335 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -34,7 +34,7 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { m_Timestamp = 0; - m_UniqueMissionID = dZoneManager::Instance()->GetUniqueMissionIdStartingValue(); + m_UniqueMissionID = Game::zoneManager->GetUniqueMissionIdStartingValue(); m_Reward = 0; @@ -443,9 +443,9 @@ void Mission::YieldRewards() { int32_t coinsToSend = 0; if (info->LegoScore > 0) { eLootSourceType lootSource = info->isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT; - if (levelComponent->GetLevel() >= dZoneManager::Instance()->GetWorldConfig()->levelCap) { + if (levelComponent->GetLevel() >= Game::zoneManager->GetWorldConfig()->levelCap) { // Since the character is at the level cap we reward them with coins instead of UScore. - coinsToSend += info->LegoScore * dZoneManager::Instance()->GetWorldConfig()->levelCapCurrencyConversion; + coinsToSend += info->LegoScore * Game::zoneManager->GetWorldConfig()->levelCapCurrencyConversion; } else { characterComponent->SetUScore(characterComponent->GetUScore() + info->LegoScore); GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), info->LegoScore, lootSource); diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 95e97a53..6bc12b72 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -391,7 +391,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& // The meaning of associate can be found in eRacingTaskParam.h if (parameters.empty()) break; - if (!InAllTargets(dZoneManager::Instance()->GetZone()->GetWorldID()) && !(parameters[0] == 4 || parameters[0] == 5) && !InAllTargets(value)) break; + if (!InAllTargets(Game::zoneManager->GetZone()->GetWorldID()) && !(parameters[0] == 4 || parameters[0] == 5) && !InAllTargets(value)) break; if (parameters[0] != associate) break; diff --git a/dGame/dUtilities/Mail.cpp b/dGame/dUtilities/Mail.cpp index 5dc55765..d33af6dc 100644 --- a/dGame/dUtilities/Mail.cpp +++ b/dGame/dUtilities/Mail.cpp @@ -195,7 +195,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd uint32_t itemID = static_cast(attachmentID); LOT itemLOT = 0; //Inventory::InventoryType itemType; - int mailCost = dZoneManager::Instance()->GetWorldConfig()->mailBaseFee; + int mailCost = Game::zoneManager->GetWorldConfig()->mailBaseFee; int stackSize = 0; auto inv = static_cast(entity->GetComponent(eReplicaComponentType::INVENTORY)); Item* item = nullptr; @@ -203,7 +203,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd if (itemID > 0 && attachmentCount > 0 && inv) { item = inv->FindItemById(attachmentID); if (item) { - mailCost += (item->GetInfo().baseValue * dZoneManager::Instance()->GetWorldConfig()->mailPercentAttachmentFee); + mailCost += (item->GetInfo().baseValue * Game::zoneManager->GetWorldConfig()->mailPercentAttachmentFee); stackSize = item->GetCount(); itemLOT = item->GetLot(); } else { diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index e0a69e02..d35beba8 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -272,7 +272,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "leave-zone") { - const auto currentZone = dZoneManager::Instance()->GetZone()->GetZoneID().GetMapID(); + const auto currentZone = Game::zoneManager->GetZone()->GetZoneID().GetMapID(); LWOMAPID newZone = 0; if (currentZone % 100 == 0) { @@ -282,7 +282,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit newZone = (currentZone / 100) * 100; } // If new zone would be inaccessible, then default to Avant Gardens. - if (!dZoneManager::Instance()->CheckIfAccessibleZone(newZone)) newZone = 1100; + if (!Game::zoneManager->CheckIfAccessibleZone(newZone)) newZone = 1100; ChatPackets::SendSystemMessage(sysAddr, u"Leaving zone..."); @@ -336,7 +336,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "resurrect") { - ScriptedActivityComponent* scriptedActivityComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent(); + ScriptedActivityComponent* scriptedActivityComponent = Game::zoneManager->GetZoneControlObject()->GetComponent(); if (scriptedActivityComponent) { // check if user is in activity world and if so, they can't resurrect ChatPackets::SendSystemMessage(sysAddr, u"You cannot resurrect in an activity world."); @@ -351,7 +351,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "instanceinfo") { - const auto zoneId = dZoneManager::Instance()->GetZone()->GetZoneID(); + const auto zoneId = Game::zoneManager->GetZone()->GetZoneID(); ChatPackets::SendSystemMessage(sysAddr, u"Map: " + (GeneralUtils::to_u16string(zoneId.GetMapID())) + u"\nClone: " + (GeneralUtils::to_u16string(zoneId.GetCloneID())) + u"\nInstance: " + (GeneralUtils::to_u16string(zoneId.GetInstanceID()))); } @@ -1541,7 +1541,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit const auto objid = entity->GetObjectID(); - if (force || dZoneManager::Instance()->CheckIfAccessibleZone(reqZone)) { // to prevent tomfoolery + if (force || Game::zoneManager->CheckIfAccessibleZone(reqZone)) { // to prevent tomfoolery ZoneInstanceManager::Instance()->RequestZoneTransfer(Game::server, reqZone, cloneId, false, [objid](bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, std::string serverIP, uint16_t serverPort) { @@ -1645,13 +1645,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "activatespawner" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(args[0]); + auto spawners = Game::zoneManager->GetSpawnersByName(args[0]); for (auto* spawner : spawners) { spawner->Activate(); } - spawners = dZoneManager::Instance()->GetSpawnersInGroup(args[0]); + spawners = Game::zoneManager->GetSpawnersInGroup(args[0]); for (auto* spawner : spawners) { spawner->Activate(); @@ -1685,13 +1685,13 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } if (chatCommand == "triggerspawner" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER && args.size() >= 1) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(args[0]); + auto spawners = Game::zoneManager->GetSpawnersByName(args[0]); for (auto* spawner : spawners) { spawner->Spawn(); } - spawners = dZoneManager::Instance()->GetSpawnersInGroup(args[0]); + spawners = Game::zoneManager->GetSpawnersInGroup(args[0]); for (auto* spawner : spawners) { spawner->Spawn(); diff --git a/dNet/WorldPackets.cpp b/dNet/WorldPackets.cpp index 5fce14d3..35c985eb 100644 --- a/dNet/WorldPackets.cpp +++ b/dNet/WorldPackets.cpp @@ -19,7 +19,7 @@ void WorldPackets::SendLoadStaticZone(const SystemAddress& sysAddr, float x, flo RakNet::BitStream bitStream; PacketUtils::WriteHeader(bitStream, eConnectionType::CLIENT, eClientMessageType::LOAD_STATIC_ZONE); - auto zone = dZoneManager::Instance()->GetZone()->GetZoneID(); + auto zone = Game::zoneManager->GetZone()->GetZoneID(); bitStream.Write(static_cast(zone.GetMapID())); bitStream.Write(static_cast(zone.GetInstanceID())); //bitStream.Write(static_cast(zone.GetCloneID())); diff --git a/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp b/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp index ada8223a..8d092078 100644 --- a/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp +++ b/dScripts/02_server/Enemy/AG/BossSpiderQueenEnemyServer.cpp @@ -52,7 +52,7 @@ void BossSpiderQueenEnemyServer::OnStartup(Entity* self) { } void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) { - if (dZoneManager::Instance()->GetZoneID().GetMapID() == instanceZoneID) { + if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID) { auto* missionComponent = killer->GetComponent(); if (missionComponent == nullptr) return; @@ -276,7 +276,7 @@ void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) { auto index = 0u; for (const auto& rofGroup : ROFTargetGroupIDTable) { - const auto spawners = dZoneManager::Instance()->GetSpawnersInGroup(rofGroup); + const auto spawners = Game::zoneManager->GetSpawnersInGroup(rofGroup); std::vector spawned; diff --git a/dScripts/02_server/Map/AM/AmDropshipComputer.cpp b/dScripts/02_server/Map/AM/AmDropshipComputer.cpp index f23fa93f..1ee2aba3 100644 --- a/dScripts/02_server/Map/AM/AmDropshipComputer.cpp +++ b/dScripts/02_server/Map/AM/AmDropshipComputer.cpp @@ -42,7 +42,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) { const auto nextPipeNum = pipeNum + 1; - const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup); + const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup); if (!samePipeSpawners.empty()) { samePipeSpawners[0]->SoftReset(); @@ -53,7 +53,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) { if (killer != nullptr && killer->IsPlayer()) { const auto nextPipe = pipeGroup + std::to_string(nextPipeNum); - const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe); + const auto nextPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe); if (!nextPipeSpawners.empty()) { nextPipeSpawners[0]->Activate(); @@ -61,7 +61,7 @@ void AmDropshipComputer::OnDie(Entity* self, Entity* killer) { } else { const auto nextPipe = pipeGroup + "1"; - const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe); + const auto firstPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe); if (!firstPipeSpawners.empty()) { firstPipeSpawners[0]->Activate(); diff --git a/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp b/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp index ec86b0fa..cf065ad6 100644 --- a/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp +++ b/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp @@ -93,13 +93,13 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) { } void ImgBrickConsoleQB::SpawnBrick(Entity* self) { - const auto netDevil = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug"); + const auto netDevil = Game::zoneManager->GetSpawnersByName("MaelstromBug"); if (!netDevil.empty()) { netDevil[0]->Reset(); netDevil[0]->Deactivate(); } - const auto brick = dZoneManager::Instance()->GetSpawnersByName("Imagination"); + const auto brick = Game::zoneManager->GetSpawnersByName("Imagination"); if (!brick.empty()) { brick[0]->Activate(); } @@ -117,7 +117,7 @@ void ImgBrickConsoleQB::SmashCanister(Entity* self) { canister->Smash(canister->GetObjectID(), eKillType::VIOLENT); } - const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister"); + const auto canister = Game::zoneManager->GetSpawnersByName("BrickCanister"); if (!canister.empty()) { canister[0]->Reset(); canister[0]->Deactivate(); @@ -195,29 +195,29 @@ void ImgBrickConsoleQB::OnDie(Entity* self, Entity* killer) { const auto firstPipe = pipeGroup + "1"; - const auto samePipeSpawner = dZoneManager::Instance()->GetSpawnersByName(myGroup); + const auto samePipeSpawner = Game::zoneManager->GetSpawnersByName(myGroup); if (!samePipeSpawner.empty()) { samePipeSpawner[0]->Reset(); samePipeSpawner[0]->Deactivate(); } - const auto firstPipeSpawner = dZoneManager::Instance()->GetSpawnersByName(firstPipe); + const auto firstPipeSpawner = Game::zoneManager->GetSpawnersByName(firstPipe); if (!firstPipeSpawner.empty()) { firstPipeSpawner[0]->Activate(); } - const auto netdevil = dZoneManager::Instance()->GetSpawnersByName("Imagination"); + const auto netdevil = Game::zoneManager->GetSpawnersByName("Imagination"); if (!netdevil.empty()) { netdevil[0]->Reset(); netdevil[0]->Deactivate(); } - const auto brick = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug"); + const auto brick = Game::zoneManager->GetSpawnersByName("MaelstromBug"); if (!brick.empty()) { brick[0]->Activate(); } - const auto canister = dZoneManager::Instance()->GetSpawnersByName("BrickCanister"); + const auto canister = Game::zoneManager->GetSpawnersByName("BrickCanister"); if (!canister.empty()) { canister[0]->Activate(); } diff --git a/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp b/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp index c607c0fc..48d1b255 100644 --- a/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp +++ b/dScripts/02_server/Map/FV/Racing/RaceMaelstromGeiser.cpp @@ -57,7 +57,7 @@ void RaceMaelstromGeiser::OnProximityUpdate(Entity* self, Entity* entering, std: GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0); - auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneController = Game::zoneManager->GetZoneControlObject(); auto* racingControlComponent = zoneController->GetComponent(); diff --git a/dScripts/02_server/Map/General/PetDigServer.cpp b/dScripts/02_server/Map/General/PetDigServer.cpp index e1bedc5e..0ea78e4f 100644 --- a/dScripts/02_server/Map/General/PetDigServer.cpp +++ b/dScripts/02_server/Map/General/PetDigServer.cpp @@ -48,8 +48,8 @@ void PetDigServer::OnStartup(Entity* self) { // Reset any bouncers that might've been created by the previous dig if (digInfo.bouncer) { auto bounceNumber = GeneralUtils::UTF16ToWTF8(self->GetVar(u"BouncerNumber")); - auto bouncerSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncer" + bounceNumber); - auto switchSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncerSwitch" + bounceNumber); + auto bouncerSpawners = Game::zoneManager->GetSpawnersByName("PetBouncer" + bounceNumber); + auto switchSpawners = Game::zoneManager->GetSpawnersByName("PetBouncerSwitch" + bounceNumber); for (auto* bouncerSpawner : bouncerSpawners) { for (auto* bouncer : bouncerSpawner->m_Info.nodes) @@ -142,8 +142,8 @@ void PetDigServer::HandleXBuildDig(const Entity* self, Entity* owner, Entity* pe void PetDigServer::HandleBouncerDig(const Entity* self, const Entity* owner) { auto bounceNumber = GeneralUtils::UTF16ToWTF8(self->GetVar(u"BouncerNumber")); - auto bouncerSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncer" + bounceNumber); - auto switchSpawners = dZoneManager::Instance()->GetSpawnersByName("PetBouncerSwitch" + bounceNumber); + auto bouncerSpawners = Game::zoneManager->GetSpawnersByName("PetBouncer" + bounceNumber); + auto switchSpawners = Game::zoneManager->GetSpawnersByName("PetBouncerSwitch" + bounceNumber); for (auto* bouncerSpawner : bouncerSpawners) { bouncerSpawner->Activate(); diff --git a/dScripts/02_server/Map/NS/NsLegoClubDoor.cpp b/dScripts/02_server/Map/NS/NsLegoClubDoor.cpp index d7ee5fed..35d4735c 100644 --- a/dScripts/02_server/Map/NS/NsLegoClubDoor.cpp +++ b/dScripts/02_server/Map/NS/NsLegoClubDoor.cpp @@ -4,7 +4,7 @@ #include "Amf3.h" void NsLegoClubDoor::OnStartup(Entity* self) { - self->SetVar(u"currentZone", (int32_t)dZoneManager::Instance()->GetZoneID().GetMapID()); + self->SetVar(u"currentZone", (int32_t)Game::zoneManager->GetZoneID().GetMapID()); self->SetVar(u"choiceZone", m_ChoiceZoneID); self->SetVar(u"teleportAnim", m_TeleportAnim); self->SetVar(u"teleportString", m_TeleportString); diff --git a/dScripts/02_server/Map/NS/NsLupTeleport.cpp b/dScripts/02_server/Map/NS/NsLupTeleport.cpp index 74f8ace1..c75143fc 100644 --- a/dScripts/02_server/Map/NS/NsLupTeleport.cpp +++ b/dScripts/02_server/Map/NS/NsLupTeleport.cpp @@ -4,7 +4,7 @@ #include "Amf3.h" void NsLupTeleport::OnStartup(Entity* self) { - self->SetVar(u"currentZone", (int32_t)dZoneManager::Instance()->GetZoneID().GetMapID()); + self->SetVar(u"currentZone", (int32_t)Game::zoneManager->GetZoneID().GetMapID()); self->SetVar(u"choiceZone", m_ChoiceZoneID); self->SetVar(u"teleportAnim", m_TeleportAnim); self->SetVar(u"teleportString", m_TeleportString); diff --git a/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp b/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp index 31086cf4..6f2f6d36 100644 --- a/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp +++ b/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp @@ -61,7 +61,7 @@ void ZoneAgProperty::OnPlayerLoaded(Entity* self, Entity* player) { self->SetVar(u"numberOfPlayers", numberOfPlayers + 1); } - if (dZoneManager::Instance()->GetZone()->GetZoneID().GetMapID() == 1102) { + if (Game::zoneManager->GetZone()->GetZoneID().GetMapID() == 1102) { GameMessages::SendPlay2DAmbientSound(player, GUIDMaelstrom); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"maelstromSkyOn", 0, 0, LWOOBJID_EMPTY, "", player->GetSystemAddress()); @@ -93,7 +93,7 @@ void ZoneAgProperty::OnZoneLoadedInfo(Entity* self) { void ZoneAgProperty::LoadInstance(Entity* self) { SetGameVariables(self); - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(self->GetVar(InstancerSpawner))) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(self->GetVar(InstancerSpawner))) { for (auto* spawnerNode : spawner->m_Info.nodes) { spawnerNode->config.push_back( new LDFData(u"custom_script_server", @@ -180,7 +180,7 @@ void ZoneAgProperty::StartMaelstrom(Entity* self, Entity* player) { } uint32_t ZoneAgProperty::RetrieveSpawnerId(Entity* self, const std::string& spawner) { - auto spawnerIDs = dZoneManager::Instance()->GetSpawnersByName(spawner); + auto spawnerIDs = Game::zoneManager->GetSpawnersByName(spawner); if (spawnerIDs.empty()) return 0; @@ -193,7 +193,7 @@ void ZoneAgProperty::OnTimerDone(Entity* self, std::string timerName) { void ZoneAgProperty::BaseTimerDone(Entity* self, const std::string& timerName) { if (timerName == "GuardFlyAway") { - const auto zoneId = dZoneManager::Instance()->GetZone()->GetWorldID(); + const auto zoneId = Game::zoneManager->GetZone()->GetWorldID(); if (zoneId != 1150) return; diff --git a/dScripts/02_server/Map/njhub/CavePrisonCage.cpp b/dScripts/02_server/Map/njhub/CavePrisonCage.cpp index ecd6a9e2..9bd89067 100644 --- a/dScripts/02_server/Map/njhub/CavePrisonCage.cpp +++ b/dScripts/02_server/Map/njhub/CavePrisonCage.cpp @@ -13,7 +13,7 @@ void CavePrisonCage::OnStartup(Entity* self) { return; } - auto* spawner = dZoneManager::Instance()->GetSpawnersByName("PrisonCounterweight_0" + GeneralUtils::UTF16ToWTF8(myNum))[0]; + auto* spawner = Game::zoneManager->GetSpawnersByName("PrisonCounterweight_0" + GeneralUtils::UTF16ToWTF8(myNum))[0]; self->SetVar(u"CWSpawner", spawner); diff --git a/dScripts/02_server/Map/njhub/Lieutenant.cpp b/dScripts/02_server/Map/njhub/Lieutenant.cpp index d3b0fc1f..74f0e215 100644 --- a/dScripts/02_server/Map/njhub/Lieutenant.cpp +++ b/dScripts/02_server/Map/njhub/Lieutenant.cpp @@ -31,7 +31,7 @@ void Lieutenant::OnDie(Entity* self, Entity* killer) { return; } - const auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName); + const auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName); if (spawners.empty()) { return; diff --git a/dScripts/02_server/Map/njhub/MonCoreNookDoors.cpp b/dScripts/02_server/Map/njhub/MonCoreNookDoors.cpp index dc759c50..a6db5064 100644 --- a/dScripts/02_server/Map/njhub/MonCoreNookDoors.cpp +++ b/dScripts/02_server/Map/njhub/MonCoreNookDoors.cpp @@ -12,7 +12,7 @@ void MonCoreNookDoors::SpawnDoor(Entity* self) { return; } - const auto spawners = dZoneManager::Instance()->GetSpawnersByName("MonCoreNookDoor0" + doorNum); + const auto spawners = Game::zoneManager->GetSpawnersByName("MonCoreNookDoor0" + doorNum); if (spawners.empty()) { return; diff --git a/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp b/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp index 459d3e25..d31f7b17 100644 --- a/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp +++ b/dScripts/02_server/Map/njhub/boss_instance/NjMonastryBossInstance.cpp @@ -22,7 +22,7 @@ void NjMonastryBossInstance::OnStartup(Entity* self) { // Add a notification request for all the spawned entities, corresponds to notifySpawnedObjectLoaded for (const auto& spawnerName : spawnerNames) { - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) { spawner->AddEntitySpawnedCallback([self, this](Entity* entity) { const auto lot = entity->GetLOT(); switch (lot) { @@ -153,7 +153,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string } } } else if (timerName == SpawnCounterWeightTimer) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(CounterweightSpawner); + auto spawners = Game::zoneManager->GetSpawnersByName(CounterweightSpawner); if (!spawners.empty()) { // Spawn the counter weight at a specific waypoint, there's one for each round auto* spawner = spawners.front(); @@ -173,7 +173,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0, LWOOBJID_EMPTY, BottomFrakSpawn, UNASSIGNED_SYSTEM_ADDRESS); } else if (timerName == SpawnLowerFrakjawTimer) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(LowerFrakjawSpawner); + auto spawners = Game::zoneManager->GetSpawnersByName(LowerFrakjawSpawner); if (!spawners.empty()) { auto* spawner = spawners.front(); spawner->Activate(); @@ -182,7 +182,7 @@ void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0, LWOOBJID_EMPTY, FireRailSpawn, UNASSIGNED_SYSTEM_ADDRESS); - auto spawners = dZoneManager::Instance()->GetSpawnersByName(FireRailSpawner); + auto spawners = Game::zoneManager->GetSpawnersByName(FireRailSpawner); if (!spawners.empty()) { auto* spawner = spawners.front(); spawner->Activate(); @@ -210,7 +210,7 @@ void NjMonastryBossInstance::StartFight(Entity* self) { self->SetVar(FightStartedVariable, true); // Activate the frakjaw spawner - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(LedgeFrakjawSpawner)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(LedgeFrakjawSpawner)) { spawner->Activate(); } } @@ -455,7 +455,7 @@ void NjMonastryBossInstance::LowerFrakjaw(Entity* self, Entity* frakjaw) { } void NjMonastryBossInstance::SpawnOnNetwork(Entity* self, const LOT& toSpawn, const uint32_t& numberToSpawn, const std::string& spawnerName) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName); + auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName); if (spawners.empty() || numberToSpawn <= 0) return; @@ -485,7 +485,7 @@ void NjMonastryBossInstance::FightOver(Entity* self) { // Remove all the enemies from the battlefield for (auto i = 1; i < 5; i++) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(BaseEnemiesSpawner + std::to_string(i)); + auto spawners = Game::zoneManager->GetSpawnersByName(BaseEnemiesSpawner + std::to_string(i)); if (!spawners.empty()) { auto* spawner = spawners.front(); spawner->Deactivate(); diff --git a/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp b/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp index 83f8b30d..e06ed1d9 100644 --- a/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp +++ b/dScripts/02_server/Minigame/General/MinigameTreasureChestServer.cpp @@ -40,7 +40,7 @@ void MinigameTreasureChestServer::OnUse(Entity* self, Entity* user) { sac->PlayerRemove(user->GetObjectID()); - auto* zoneControl = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneControl = Game::zoneManager->GetZoneControlObject(); if (zoneControl != nullptr) { zoneControl->OnFireEventServerSide(self, "Survival_Update", 0); } @@ -56,7 +56,7 @@ uint32_t MinigameTreasureChestServer::CalculateActivityRating(Entity* self, LWOO void MinigameTreasureChestServer::OnStartup(Entity* self) { // BONS treasure chest thinks it's on FV, causing it to start a lobby - if (dZoneManager::Instance()->GetZoneID().GetMapID() == 1204) { + if (Game::zoneManager->GetZoneID().GetMapID() == 1204) { auto* sac = self->GetComponent(); if (sac != nullptr) { sac->SetInstanceMapID(1204); diff --git a/dScripts/BasePropertyServer.cpp b/dScripts/BasePropertyServer.cpp index 579ae87a..fe20b09d 100644 --- a/dScripts/BasePropertyServer.cpp +++ b/dScripts/BasePropertyServer.cpp @@ -92,7 +92,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) { Game::entityManager->DestructEntity(plaque); } - const auto& mapID = dZoneManager::Instance()->GetZone()->GetZoneID(); + const auto& mapID = Game::zoneManager->GetZone()->GetZoneID(); if (propertyOwner > 0) { auto* missionComponent = player->GetComponent(); @@ -278,31 +278,31 @@ void BasePropertyServer::RequestDie(Entity* self, Entity* other) { } void BasePropertyServer::ActivateSpawner(const std::string& spawnerName) { - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) { spawner->Activate(); } } void BasePropertyServer::DeactivateSpawner(const std::string& spawnerName) { - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) { spawner->Deactivate(); } } void BasePropertyServer::TriggerSpawner(const std::string& spawnerName) { - for (auto* spawner : dZoneManager::Instance()->GetSpawnersInGroup(spawnerName)) { + for (auto* spawner : Game::zoneManager->GetSpawnersInGroup(spawnerName)) { spawner->Spawn(); } } void BasePropertyServer::ResetSpawner(const std::string& spawnerName) { - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) { spawner->Reset(); } } void BasePropertyServer::DestroySpawner(const std::string& spawnerName) { - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName(spawnerName)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName(spawnerName)) { if (!spawner) return; spawner->DestroyAllEntities(); spawner->Deactivate(); @@ -322,10 +322,10 @@ void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerNam } else if (timerName == StartQuickbuildTimer) { HandleQuickBuildTimer(self); } else if (timerName == "GuardFlyAway") { - const auto zoneId = dZoneManager::Instance()->GetZone()->GetWorldID(); + const auto zoneId = Game::zoneManager->GetZone()->GetWorldID(); // No guard for the spider instance fight - if (dZoneManager::Instance()->GetZoneID().GetMapID() == 1150) + if (Game::zoneManager->GetZoneID().GetMapID() == 1150) return; const auto entities = Game::entityManager->GetEntitiesInGroup(self->GetVar(GuardGroup)); @@ -366,7 +366,7 @@ void BasePropertyServer::BaseTimerDone(Entity* self, const std::string& timerNam self->AddTimer(TurnSkyOffTimer, 1.5f); self->AddTimer(KillFXObjectTimer, 8.0f); } else if (timerName == TurnSkyOffTimer) { - auto* controller = dZoneManager::Instance()->GetZoneControlObject(); + auto* controller = Game::zoneManager->GetZoneControlObject(); GameMessages::SendNotifyClientObject(controller->GetObjectID(), u"SkyOff", 0, 0, LWOOBJID_EMPTY, "", UNASSIGNED_SYSTEM_ADDRESS); } else if (timerName == KillStrombiesTimer) { diff --git a/dScripts/BaseRandomServer.cpp b/dScripts/BaseRandomServer.cpp index 8cc4f993..293fb79a 100644 --- a/dScripts/BaseRandomServer.cpp +++ b/dScripts/BaseRandomServer.cpp @@ -52,7 +52,7 @@ void BaseRandomServer::SpawnSection(Entity* self, const std::string& sectionName } void BaseRandomServer::SetSpawnerNetwork(Entity* self, const std::string& spawnerName, int32_t spawnNum, LOT spawnLOT) { - const auto& spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName); + const auto& spawners = Game::zoneManager->GetSpawnersByName(spawnerName); if (spawnLOT == 11217 && spawnNum > 1) { spawnNum = 1; diff --git a/dScripts/BaseSurvivalServer.cpp b/dScripts/BaseSurvivalServer.cpp index 3e32c24b..8859dc02 100644 --- a/dScripts/BaseSurvivalServer.cpp +++ b/dScripts/BaseSurvivalServer.cpp @@ -399,7 +399,7 @@ void BaseSurvivalServer::SpawnerReset(SpawnerNetworkCollection& spawnerNetworkCo for (auto& spawner : spawnerNetworkCollection.networks) { for (auto& spawnerName : spawner.names) { - auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName + spawner.number); + auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName + spawner.number); if (!spawners.empty()) { auto* spawnerObject = spawners.at(0); @@ -428,7 +428,7 @@ void BaseSurvivalServer::SpawnerUpdate(Entity* self, SpawnerNetworkCollection& s // If we want to spawn something specific now if (amount != 0) { auto spawnerNetwork = spawnerNetworkCollection.networks.at(0); - auto possibleSpawners = dZoneManager::Instance()->GetSpawnersByName(spawnerNetwork.names.at(0) + spawnerNetwork.number); + auto possibleSpawners = Game::zoneManager->GetSpawnersByName(spawnerNetwork.names.at(0) + spawnerNetwork.number); if (!possibleSpawners.empty()) { SpawnNow(possibleSpawners.at(0), amount); return; @@ -444,7 +444,7 @@ void BaseSurvivalServer::SpawnerUpdate(Entity* self, SpawnerNetworkCollection& s const auto& name = spawnerNetwork.names.at(i); const auto& toSpawn = newSet.at(i); - auto possibleSpawners = dZoneManager::Instance()->GetSpawnersByName(name + spawnerNetwork.number); + auto possibleSpawners = Game::zoneManager->GetSpawnersByName(name + spawnerNetwork.number); if (!possibleSpawners.empty()) { SpawnNow(possibleSpawners.front(), toSpawn); } @@ -495,7 +495,7 @@ SpawnerNetwork BaseSurvivalServer::GetRandomSpawner(SpawnerNetworkCollection& sp void BaseSurvivalServer::ActivateSpawnerNetwork(SpawnerNetworkCollection& spawnerNetworkCollection) { for (auto& spawner : spawnerNetworkCollection.networks) { for (const auto& spawnerName : spawner.names) { - auto possibleSpawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName + spawner.number); + auto possibleSpawners = Game::zoneManager->GetSpawnersByName(spawnerName + spawner.number); if (!possibleSpawners.empty()) { auto* spawnerObject = possibleSpawners.at(0); spawnerObject->Activate(); @@ -509,7 +509,7 @@ void BaseSurvivalServer::UpdateMobLots(SpawnerNetworkCollection& spawnerNetworkC for (auto& spawner : spawnerNetworkCollection.networks) { for (auto& spawnerName : spawner.names) { if (!spawnerName.empty()) { - auto spawnerObjects = dZoneManager::Instance()->GetSpawnersByName(spawnerName + spawner.number); + auto spawnerObjects = Game::zoneManager->GetSpawnersByName(spawnerName + spawner.number); if (!spawnerObjects.empty()) { auto splitName = GeneralUtils::SplitString(spawnerName, '_'); auto cleanName = splitName.size() > 1 ? splitName.at(1) : splitName.at(0); diff --git a/dScripts/BaseWavesGenericEnemy.cpp b/dScripts/BaseWavesGenericEnemy.cpp index 3270e2d8..1e66bfeb 100644 --- a/dScripts/BaseWavesGenericEnemy.cpp +++ b/dScripts/BaseWavesGenericEnemy.cpp @@ -6,7 +6,7 @@ void BaseWavesGenericEnemy::OnStartup(Entity* self) { } void BaseWavesGenericEnemy::OnDie(Entity* self, Entity* killer) { - auto* zoneControlObject = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneControlObject = Game::zoneManager->GetZoneControlObject(); if (zoneControlObject != nullptr) { zoneControlObject->OnFireEventServerSide(killer, "Survival_Update", GetPoints()); } diff --git a/dScripts/BaseWavesServer.cpp b/dScripts/BaseWavesServer.cpp index fcaa548e..4add13e6 100644 --- a/dScripts/BaseWavesServer.cpp +++ b/dScripts/BaseWavesServer.cpp @@ -392,7 +392,7 @@ void BaseWavesServer::GameWon(Entity* self) { // Done void BaseWavesServer::SpawnNow(const std::string& spawnerName, uint32_t amount, LOT spawnLot) { - const auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName); + const auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName); for (auto* spawner : spawners) { if (spawnLot != LOT_NULL) { spawner->SetSpawnLot(spawnLot); @@ -581,7 +581,7 @@ void BaseWavesServer::UpdateMissionForAllPlayers(Entity* self, uint32_t missionI void BaseWavesServer::ClearSpawners() { for (const auto& spawnerName : spawners) { - const auto spawnerObjects = dZoneManager::Instance()->GetSpawnersByName(spawnerName); + const auto spawnerObjects = Game::zoneManager->GetSpawnersByName(spawnerName); for (auto* spawnerObject : spawnerObjects) { spawnerObject->Reset(); diff --git a/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp b/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp index 595da4db..90333063 100644 --- a/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp +++ b/dScripts/ai/ACT/ActVehicleDeathTrigger.cpp @@ -42,7 +42,7 @@ void ActVehicleDeathTrigger::OnCollisionPhantom(Entity* self, Entity* target) { GameMessages::SendDie(vehicle, self->GetObjectID(), LWOOBJID_EMPTY, true, eKillType::VIOLENT, u"", 0, 0, 0, true, false, 0); - auto* zoneController = dZoneManager::Instance()->GetZoneControlObject(); + auto* zoneController = Game::zoneManager->GetZoneControlObject(); auto* racingControlComponent = zoneController->GetComponent(); diff --git a/dScripts/ai/FV/FvBrickPuzzleServer.cpp b/dScripts/ai/FV/FvBrickPuzzleServer.cpp index 887b9a4d..ce12d76e 100644 --- a/dScripts/ai/FV/FvBrickPuzzleServer.cpp +++ b/dScripts/ai/FV/FvBrickPuzzleServer.cpp @@ -29,7 +29,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) { const auto nextPipeNum = pipeNum + 1; - const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup); + const auto samePipeSpawners = Game::zoneManager->GetSpawnersByName(myGroup); if (!samePipeSpawners.empty()) { samePipeSpawners[0]->SoftReset(); @@ -40,7 +40,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) { if (killer != nullptr && killer->IsPlayer()) { const auto nextPipe = pipeGroup + std::to_string(nextPipeNum); - const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe); + const auto nextPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe); if (!nextPipeSpawners.empty()) { nextPipeSpawners[0]->Activate(); @@ -48,7 +48,7 @@ void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) { } else { const auto nextPipe = pipeGroup + "1"; - const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe); + const auto firstPipeSpawners = Game::zoneManager->GetSpawnersByName(nextPipe); if (!firstPipeSpawners.empty()) { firstPipeSpawners[0]->Activate(); diff --git a/dScripts/ai/FV/FvFacilityBrick.cpp b/dScripts/ai/FV/FvFacilityBrick.cpp index d1014ed6..26c07647 100644 --- a/dScripts/ai/FV/FvFacilityBrick.cpp +++ b/dScripts/ai/FV/FvFacilityBrick.cpp @@ -9,9 +9,9 @@ void FvFacilityBrick::OnStartup(Entity* self) { } void FvFacilityBrick::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { - auto* brickSpawner = dZoneManager::Instance()->GetSpawnersByName("ImaginationBrick")[0]; - auto* bugSpawner = dZoneManager::Instance()->GetSpawnersByName("MaelstromBug")[0]; - auto* canisterSpawner = dZoneManager::Instance()->GetSpawnersByName("BrickCanister")[0]; + auto* brickSpawner = Game::zoneManager->GetSpawnersByName("ImaginationBrick")[0]; + auto* bugSpawner = Game::zoneManager->GetSpawnersByName("MaelstromBug")[0]; + auto* canisterSpawner = Game::zoneManager->GetSpawnersByName("BrickCanister")[0]; if (name == "ConsoleLeftUp") { GameMessages::SendStopFXEffect(self, true, "LeftPipeOff"); diff --git a/dScripts/ai/GF/GfJailWalls.cpp b/dScripts/ai/GF/GfJailWalls.cpp index 1835faa2..1efca1cf 100644 --- a/dScripts/ai/GF/GfJailWalls.cpp +++ b/dScripts/ai/GF/GfJailWalls.cpp @@ -6,11 +6,11 @@ void GfJailWalls::OnRebuildComplete(Entity* self, Entity* target) { const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar(u"Wall")); - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("Jail0" + wall)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) { spawner->Deactivate(); } - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("JailCaptain0" + wall)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) { spawner->Deactivate(); } } @@ -20,11 +20,11 @@ void GfJailWalls::OnRebuildNotifyState(Entity* self, eRebuildState state) { const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar(u"Wall")); - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("Jail0" + wall)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName("Jail0" + wall)) { spawner->Activate(); } - for (auto* spawner : dZoneManager::Instance()->GetSpawnersByName("JailCaptain0" + wall)) { + for (auto* spawner : Game::zoneManager->GetSpawnersByName("JailCaptain0" + wall)) { spawner->Activate(); } } diff --git a/dScripts/ai/GF/TriggerAmbush.cpp b/dScripts/ai/GF/TriggerAmbush.cpp index 726b45d7..7ac329ea 100644 --- a/dScripts/ai/GF/TriggerAmbush.cpp +++ b/dScripts/ai/GF/TriggerAmbush.cpp @@ -13,7 +13,7 @@ void TriggerAmbush::OnProximityUpdate(Entity* self, Entity* entering, std::strin self->SetVar(u"triggered", true); - const auto spawners = dZoneManager::Instance()->GetSpawnersByName("Ambush"); + const auto spawners = Game::zoneManager->GetSpawnersByName("Ambush"); for (auto* spawner : spawners) { spawner->Activate(); @@ -27,7 +27,7 @@ void TriggerAmbush::OnTimerDone(Entity* self, std::string timerName) { self->SetVar(u"triggered", false); - const auto spawners = dZoneManager::Instance()->GetSpawnersByName("Ambush"); + const auto spawners = Game::zoneManager->GetSpawnersByName("Ambush"); for (auto* spawner : spawners) { spawner->Reset(); diff --git a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp index 4121bfdf..435f0927 100644 --- a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp +++ b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp @@ -142,7 +142,7 @@ void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button if (identifier == u"Scoreboardinfo") { GameMessages::SendDisplayMessageBox(player->GetObjectID(), true, - dZoneManager::Instance()->GetZoneControlObject()->GetObjectID(), + Game::zoneManager->GetZoneControlObject()->GetObjectID(), u"Shooting_Gallery_Retry", 2, u"Retry?", u"", player->GetSystemAddress()); } else { @@ -262,7 +262,7 @@ void SGCannon::OnActivityTimerDone(Entity* self, const std::string& name) { } const auto& toSpawn = activeSpawns.at(spawnNumber); const auto pathIndex = GeneralUtils::GenerateRandomNumber(0, toSpawn.spawnPaths.size() - 1); - const auto* path = dZoneManager::Instance()->GetZone()->GetPath(toSpawn.spawnPaths.at(pathIndex)); + const auto* path = Game::zoneManager->GetZone()->GetPath(toSpawn.spawnPaths.at(pathIndex)); if (!path) { Game::logger->Log("SGCannon", "Path %s at index %i is null", toSpawn.spawnPaths.at(pathIndex).c_str(), pathIndex); return; diff --git a/dScripts/ai/PROPERTY/AgPropguards.cpp b/dScripts/ai/PROPERTY/AgPropguards.cpp index 60a153a6..c514031a 100644 --- a/dScripts/ai/PROPERTY/AgPropguards.cpp +++ b/dScripts/ai/PROPERTY/AgPropguards.cpp @@ -29,7 +29,7 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission if (spawnerName.empty()) spawnerName = "Guard"; - auto spawners = dZoneManager::Instance()->GetSpawnersByName(spawnerName); + auto spawners = Game::zoneManager->GetSpawnersByName(spawnerName); for (auto* spawner : spawners) { spawner->Deactivate(); } diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 44796224..f07c17e3 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -85,6 +85,7 @@ namespace Game { SystemAddress chatSysAddr; bool shouldShutdown = false; EntityManager* entityManager = nullptr; + dZoneManager* zoneManager = nullptr; } // namespace Game bool chatDisabled = false; @@ -254,10 +255,11 @@ int main(int argc, char** argv) { PerformanceManager::SelectProfile(zoneID); Game::entityManager = new EntityManager(); + Game::zoneManager = new dZoneManager(); //Load our level: if (zoneID != 0) { dpWorld::Instance().Initialize(zoneID); - dZoneManager::Instance()->Initialize(LWOZONEID(zoneID, instanceID, cloneID)); + Game::zoneManager->Initialize(LWOZONEID(zoneID, instanceID, cloneID)); g_CloneID = cloneID; // pre calculate the FDB checksum @@ -399,7 +401,7 @@ int main(int argc, char** argv) { Metrics::EndMeasurement(MetricVariable::Ghosting); Metrics::StartMeasurement(MetricVariable::UpdateSpawners); - dZoneManager::Instance()->Update(deltaTime); + Game::zoneManager->Update(deltaTime); Metrics::EndMeasurement(MetricVariable::UpdateSpawners); } @@ -776,7 +778,7 @@ void HandlePacket(Packet* packet) { //Create our user and send them in: UserManager::Instance()->CreateUser(it->second.sysAddr, username, userHash); - auto zone = dZoneManager::Instance()->GetZone(); + auto zone = Game::zoneManager->GetZone(); if (zone) { float x = 0.0f; float y = 0.0f; @@ -1015,7 +1017,7 @@ void HandlePacket(Packet* packet) { WorldPackets::SendCreateCharacter(packet->systemAddress, player, c->GetXMLData(), username, c->GetGMLevel()); WorldPackets::SendServerState(packet->systemAddress); - const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(dZoneManager::Instance()->GetZone()->GetWorldID()); + const auto respawnPoint = player->GetCharacter()->GetRespawnPoint(Game::zoneManager->GetZone()->GetWorldID()); Game::entityManager->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS, true); @@ -1065,7 +1067,7 @@ void HandlePacket(Packet* packet) { //Tell the player to generate BBB models, if any: if (g_CloneID != 0) { - const auto& worldId = dZoneManager::Instance()->GetZone()->GetZoneID(); + const auto& worldId = Game::zoneManager->GetZone()->GetZoneID(); const auto zoneId = Game::server->GetZoneID(); const auto cloneId = g_CloneID; @@ -1175,7 +1177,7 @@ void HandlePacket(Packet* packet) { bitStream.Write(playerName[i]); } - auto zone = dZoneManager::Instance()->GetZone()->GetZoneID(); + auto zone = Game::zoneManager->GetZone()->GetZoneID(); bitStream.Write(zone.GetMapID()); bitStream.Write(zone.GetInstanceID()); bitStream.Write(zone.GetCloneID()); @@ -1332,10 +1334,11 @@ void FinalizeShutdown() { Metrics::Clear(); Database::Destroy("WorldServer"); if (Game::chatFilter) delete Game::chatFilter; + if (Game::zoneManager) delete Game::zoneManager; if (Game::server) delete Game::server; - if (Game::logger) delete Game::logger; if (Game::config) delete Game::config; if (Game::entityManager) delete Game::entityManager; + if (Game::logger) delete Game::logger; worldShutdownSequenceComplete = true; diff --git a/dZoneManager/Level.cpp b/dZoneManager/Level.cpp index 3a1cbb45..7d248588 100644 --- a/dZoneManager/Level.cpp +++ b/dZoneManager/Level.cpp @@ -179,8 +179,8 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) { //This is a little bit of a bodge, but because the alpha client (HF) doesn't store the //spawn position / rotation like the later versions do, we need to check the LOT for the spawn pos & set it. if (obj.lot == LOT_MARKER_PLAYER_START) { - dZoneManager::Instance()->GetZone()->SetSpawnPos(obj.position); - dZoneManager::Instance()->GetZone()->SetSpawnRot(obj.rotation); + Game::zoneManager->GetZone()->SetSpawnPos(obj.position); + Game::zoneManager->GetZone()->SetSpawnRot(obj.rotation); } std::u16string ldfString = u""; @@ -297,7 +297,7 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) { } } Spawner* spawner = new Spawner(spawnInfo); - dZoneManager::Instance()->AddSpawner(obj.id, spawner); + Game::zoneManager->AddSpawner(obj.id, spawner); } else { //Regular object EntityInfo info; info.spawnerID = 0; @@ -328,7 +328,7 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) { if (!clientOnly) { // We should never have more than 1 zone control object - const auto zoneControlObject = dZoneManager::Instance()->GetZoneControlObject(); + const auto zoneControlObject = Game::zoneManager->GetZoneControlObject(); if (zoneControlObject != nullptr && info.lot == zoneControlObject->GetLOT()) goto deleteSettings; diff --git a/dZoneManager/Spawner.cpp b/dZoneManager/Spawner.cpp index bf01103d..bd1970c6 100644 --- a/dZoneManager/Spawner.cpp +++ b/dZoneManager/Spawner.cpp @@ -47,8 +47,8 @@ Spawner::Spawner(const SpawnerInfo info) { if (m_Info.spawnOnSmashGroupName != "") { std::vector spawnSmashEntities = Game::entityManager->GetEntitiesInGroup(m_Info.spawnOnSmashGroupName); - std::vector spawnSmashSpawners = dZoneManager::Instance()->GetSpawnersInGroup(m_Info.spawnOnSmashGroupName); - std::vector spawnSmashSpawnersN = dZoneManager::Instance()->GetSpawnersByName(m_Info.spawnOnSmashGroupName); + std::vector spawnSmashSpawners = Game::zoneManager->GetSpawnersInGroup(m_Info.spawnOnSmashGroupName); + std::vector spawnSmashSpawnersN = Game::zoneManager->GetSpawnersByName(m_Info.spawnOnSmashGroupName); for (Entity* ssEntity : spawnSmashEntities) { m_SpawnSmashFoundGroup = true; ssEntity->AddDieCallback([=]() { diff --git a/dZoneManager/Zone.cpp b/dZoneManager/Zone.cpp index 28d3f0c8..7343bb59 100644 --- a/dZoneManager/Zone.cpp +++ b/dZoneManager/Zone.cpp @@ -149,7 +149,7 @@ void Zone::LoadZoneIntoMemory() { info.activeOnLoad = path.spawner.spawnerNetActive; info.isNetwork = true; Spawner* spawner = new Spawner(info); - dZoneManager::Instance()->AddSpawner(info.spawnerID, spawner); + Game::zoneManager->AddSpawner(info.spawnerID, spawner); } } diff --git a/dZoneManager/dZoneManager.cpp b/dZoneManager/dZoneManager.cpp index 960726a2..51f6e640 100644 --- a/dZoneManager/dZoneManager.cpp +++ b/dZoneManager/dZoneManager.cpp @@ -17,8 +17,6 @@ #include "../dWorldServer/ObjectIDManager.h" -dZoneManager* dZoneManager::m_Address = nullptr; - void dZoneManager::Initialize(const LWOZONEID& zoneID) { Game::logger->Log("dZoneManager", "Preparing zone: %i/%i/%i", zoneID.GetMapID(), zoneID.GetInstanceID(), zoneID.GetCloneID()); diff --git a/dZoneManager/dZoneManager.h b/dZoneManager/dZoneManager.h index 3086e6d7..1e08b008 100644 --- a/dZoneManager/dZoneManager.h +++ b/dZoneManager/dZoneManager.h @@ -25,14 +25,6 @@ private: void LoadWorldConfig(); public: - static dZoneManager* Instance() { - if (!m_Address) { - m_Address = new dZoneManager(); - } - - return m_Address; - } - void Initialize(const LWOZONEID& zoneID); ~dZoneManager(); @@ -64,7 +56,6 @@ private: */ uint32_t m_UniqueMissionIdStart = 0; - static dZoneManager* m_Address; //Singleton Zone* m_pZone = nullptr; LWOZONEID m_ZoneID; bool m_PlayerLoseCoinsOnDeath; //Do players drop coins in this zone when smashed