Merge branch 'main' into pr/1107

This commit is contained in:
David Markowitz 2023-07-21 19:40:30 -07:00
commit 34392932b3
59 changed files with 194 additions and 211 deletions

View File

@ -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;
}

View File

@ -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<uint32_t>(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();

View File

@ -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<CDZoneTableTable>();
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<std::string>(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];

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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++;
}

View File

@ -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);

View File

@ -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<uint64_t>(coinsTotal * coinPercentageToLose), minCoinsToLose);
coinsToLose = std::min(maxCoinsToLose, coinsToLose);

View File

@ -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);
}
}

View File

@ -26,7 +26,7 @@ std::unordered_map<AchievementCacheKey, std::vector<uint32_t>> MissionComponent:
//! Initializer
MissionComponent::MissionComponent(Entity* parent) : Component(parent) {
m_LastUsedMissionOrderUID = dZoneManager::Instance()->GetUniqueMissionIdStartingValue();
m_LastUsedMissionOrderUID = Game::zoneManager->GetUniqueMissionIdStartingValue();
}
//! Destructor

View File

@ -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) {

View File

@ -236,7 +236,7 @@ void PetComponent::OnUse(Entity* originator) {
return;
}
auto& bricks = BrickDatabase::Instance()->GetBricks(buildFile);
const auto& bricks = BrickDatabase::GetBricks(buildFile);
if (bricks.empty()) {
ChatPackets::SendSystemMessage(originator->GetSystemAddress(), u"Failed to load the puzzle minigame for this pet.");

View File

@ -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<NiPoint3> 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<LWOOBJID>(u"modelBehaviors", 0);
auto userModelID = new LDFData<LWOOBJID>(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);

View File

@ -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");

View File

@ -50,7 +50,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<CDActivitiesTable>();
@ -106,7 +106,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);
@ -373,8 +373,12 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, int32_t bu
data->collectedRewards = true;
// Calculate the score, different loot depending on player count
const auto score = m_LoadedPlayers * 10 + data->finished;
auto playersRating = m_LoadedPlayers;
if(m_LoadedPlayers == 1 && m_SoloRacing) {
playersRating *= 2;
}
const auto score = playersRating * 10 + data->finished;
LootGenerator::Instance().GiveActivityLoot(player, m_Parent, m_ActivityID, score);
// Giving rewards
@ -393,11 +397,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) {
@ -649,11 +653,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();
@ -722,7 +726,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) {

View File

@ -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*>(player)->SendToZone(dZoneManager::Instance()->GetZone()->GetWorldID()); // Gets them out of this stuck state
static_cast<Player*>(player)->SendToZone(Game::zoneManager->GetZone()->GetWorldID()); // Gets them out of this stuck state
return false;
}*/

View File

@ -26,7 +26,7 @@ TriggerComponent::TriggerComponent(Entity* parent, const std::string triggerInfo
uint32_t triggerID;
GeneralUtils::TryParse<uint32_t>(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();
}
}

View File

@ -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;
}

View File

@ -2340,13 +2340,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) {
@ -2358,7 +2358,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) {
@ -2584,7 +2584,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();
@ -3456,7 +3456,7 @@ void GameMessages::SendNotifyTamingModelLoadedOnServer(LWOOBJID objectId, const
SEND_PACKET;
}
void GameMessages::SendNotifyPetTamingPuzzleSelected(LWOOBJID objectId, std::vector<Brick>& bricks, const SystemAddress& sysAddr) {
void GameMessages::SendNotifyPetTamingPuzzleSelected(LWOOBJID objectId, const std::vector<Brick>& bricks, const SystemAddress& sysAddr) {
CBITSTREAM;
CMSGHEADER;
@ -4122,7 +4122,7 @@ void GameMessages::HandleRacingClientReady(RakNet::BitStream* inStream, Entity*
return;
}
auto* racingControlComponent = dZoneManager::Instance()->GetZoneControlObject()->GetComponent<RacingControlComponent>();
auto* racingControlComponent = Game::zoneManager->GetZoneControlObject()->GetComponent<RacingControlComponent>();
if (racingControlComponent == nullptr) {
return;
@ -4170,7 +4170,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<RacingControlComponent>();
@ -4213,7 +4213,7 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre
return;
}
auto* zoneController = dZoneManager::Instance()->GetZoneControlObject();
auto* zoneController = Game::zoneManager->GetZoneControlObject();
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
@ -4243,7 +4243,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();
@ -4975,7 +4975,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);

View File

@ -364,7 +364,7 @@ namespace GameMessages {
//Pets:
void SendNotifyPetTamingMinigame(LWOOBJID objectId, LWOOBJID petId, LWOOBJID playerTamingId, bool bForceTeleport, ePetTamingNotifyType notifyType, NiPoint3 petsDestPos, NiPoint3 telePos, NiQuaternion teleRot, const SystemAddress& sysAddr);
void SendNotifyPetTamingPuzzleSelected(LWOOBJID objectId, std::vector<Brick>& bricks, const SystemAddress& sysAddr);
void SendNotifyPetTamingPuzzleSelected(LWOOBJID objectId, const std::vector<Brick>& bricks, const SystemAddress& sysAddr);
void SendNotifyTamingModelLoadedOnServer(LWOOBJID objectId, const SystemAddress& sysAddr);

View File

@ -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);

View File

@ -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;

View File

@ -5,14 +5,12 @@
#include "Game.h"
#include "AssetManager.h"
#include "tinyxml2.h"
#include "Brick.h"
std::vector<Brick> BrickDatabase::emptyCache{};
BrickDatabase* BrickDatabase::m_Address = nullptr;
const BrickList& BrickDatabase::GetBricks(const LxfmlPath& lxfmlPath) {
static std::unordered_map<LxfmlPath, BrickList> m_Cache;
static const BrickList emptyCache;
BrickDatabase::BrickDatabase() = default;
BrickDatabase::~BrickDatabase() = default;
std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
const auto cached = m_Cache.find(lxfmlPath);
if (cached != m_Cache.end()) {
@ -45,7 +43,7 @@ std::vector<Brick>& BrickDatabase::GetBricks(const std::string& lxfmlPath) {
return emptyCache;
}
std::vector<Brick> parts;
BrickList parts;
auto* lxfml = doc->FirstChildElement("LXFML");
auto* bricks = lxfml->FirstChildElement("Bricks");

View File

@ -1,29 +1,16 @@
#ifndef __BRICKDATABASE__H__
#define __BRICKDATABASE__H__
#pragma once
#include "Entity.h"
class BrickDatabase
{
public:
static BrickDatabase* Instance() {
if (m_Address == nullptr) {
m_Address = new BrickDatabase();
}
class Brick;
using BrickList = std::vector<Brick>;
using LxfmlPath = std::string;
return m_Address;
}
std::vector<Brick>& GetBricks(const std::string& lxfmlPath);
explicit BrickDatabase();
~BrickDatabase();
private:
std::unordered_map<std::string, std::vector<Brick>> m_Cache;
static std::vector<Brick> emptyCache;
static BrickDatabase* m_Address; //For singleton method
/* data */
namespace BrickDatabase {
const BrickList& GetBricks(const LxfmlPath& lxfmlPath);
};
#endif //!__BRICKDATABASE__H__

View File

@ -195,7 +195,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd
uint32_t itemID = static_cast<uint32_t>(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<InventoryComponent*>(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 {

View File

@ -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* scriptedActivityComponent = Game::zoneManager->GetZoneControlObject()->GetComponent<ScriptedActivityComponent>();
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())));
}
@ -1443,7 +1443,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
}
if ((chatCommand == "freemoney" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) && args.size() == 1) {
int32_t money;
int64_t money;
if (!GeneralUtils::TryParse(args[0], money)) {
ChatPackets::SendSystemMessage(sysAddr, u"Invalid money.");
@ -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();

View File

@ -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<uint16_t>(zone.GetMapID()));
bitStream.Write(static_cast<uint16_t>(zone.GetInstanceID()));
//bitStream.Write(static_cast<uint32_t>(zone.GetCloneID()));

View File

@ -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<MissionComponent>();
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<LWOOBJID> spawned;

View File

@ -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();

View File

@ -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();
}

View File

@ -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<RacingControlComponent>();

View File

@ -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<std::u16string>(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<std::u16string>(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();

View File

@ -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);

View File

@ -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);

View File

@ -61,7 +61,7 @@ void ZoneAgProperty::OnPlayerLoaded(Entity* self, Entity* player) {
self->SetVar<int32_t>(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<std::string>(InstancerSpawner))) {
for (auto* spawner : Game::zoneManager->GetSpawnersByName(self->GetVar<std::string>(InstancerSpawner))) {
for (auto* spawnerNode : spawner->m_Info.nodes) {
spawnerNode->config.push_back(
new LDFData<std::string>(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;

View File

@ -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<Spawner*>(u"CWSpawner", spawner);

View File

@ -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;

View File

@ -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;

View File

@ -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<bool>(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();

View File

@ -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<ScriptedActivityComponent>();
if (sac != nullptr) {
sac->SetInstanceMapID(1204);

View File

@ -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<MissionComponent>();
@ -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<std::string>(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) {

View File

@ -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;

View File

@ -402,7 +402,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);
@ -431,7 +431,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;
@ -447,7 +447,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);
}
@ -498,7 +498,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();
@ -512,7 +512,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);

View File

@ -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());
}

View File

@ -393,7 +393,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);
@ -582,7 +582,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();

View File

@ -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<RacingControlComponent>();

View File

@ -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();

View File

@ -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");

View File

@ -6,11 +6,11 @@
void GfJailWalls::OnRebuildComplete(Entity* self, Entity* target) {
const auto wall = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(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<std::u16string>(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();
}
}

View File

@ -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();

View File

@ -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<float_t>(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;

View File

@ -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();
}

View File

@ -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;

View File

@ -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;

View File

@ -47,8 +47,8 @@ Spawner::Spawner(const SpawnerInfo info) {
if (m_Info.spawnOnSmashGroupName != "") {
std::vector<Entity*> spawnSmashEntities = Game::entityManager->GetEntitiesInGroup(m_Info.spawnOnSmashGroupName);
std::vector<Spawner*> spawnSmashSpawners = dZoneManager::Instance()->GetSpawnersInGroup(m_Info.spawnOnSmashGroupName);
std::vector<Spawner*> spawnSmashSpawnersN = dZoneManager::Instance()->GetSpawnersByName(m_Info.spawnOnSmashGroupName);
std::vector<Spawner*> spawnSmashSpawners = Game::zoneManager->GetSpawnersInGroup(m_Info.spawnOnSmashGroupName);
std::vector<Spawner*> spawnSmashSpawnersN = Game::zoneManager->GetSpawnersByName(m_Info.spawnOnSmashGroupName);
for (Entity* ssEntity : spawnSmashEntities) {
m_SpawnSmashFoundGroup = true;
ssEntity->AddDieCallback([=]() {

View File

@ -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);
}
}

View File

@ -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());

View File

@ -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