2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
#include "dZMCommon.h"
|
|
|
|
#include "Zone.h"
|
|
|
|
#include "Spawner.h"
|
|
|
|
#include <map>
|
|
|
|
|
2023-01-01 12:51:22 +00:00
|
|
|
class WorldConfig;
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
class dZoneManager {
|
|
|
|
public:
|
|
|
|
enum class dZoneNotifier {
|
|
|
|
SpawnedObjectDestroyed,
|
|
|
|
SpawnedChildObjectDestroyed, //Used for when an object (like a stromling) needs to notify the spawner to respawn a new enemy.
|
|
|
|
ReloadZone, //Forces the server and all connects clients to reload the map
|
|
|
|
UserJoined,
|
|
|
|
UserMoved,
|
|
|
|
PrintAllGameObjects, //Using this is a BAD idea in production
|
|
|
|
InvalidNotifier
|
|
|
|
};
|
|
|
|
|
2023-01-01 12:51:22 +00:00
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Reads the WorldConfig from the CDClientDatabase into memory
|
|
|
|
*/
|
|
|
|
void LoadWorldConfig();
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
public:
|
|
|
|
void Initialize(const LWOZONEID& zoneID);
|
|
|
|
~dZoneManager();
|
|
|
|
|
|
|
|
Zone* GetZone(); //Gets a pointer to the currently loaded zone.
|
|
|
|
void LoadZone(const LWOZONEID& zoneID); //Discard the current zone (if any) and loads a new zone.
|
|
|
|
void NotifyZone(const dZoneNotifier& notifier, const LWOOBJID& objectID); //Notifies the zone of a certain event or command.
|
|
|
|
void AddSpawner(LWOOBJID id, Spawner* spawner);
|
|
|
|
LWOZONEID GetZoneID() const;
|
|
|
|
LWOOBJID MakeSpawner(SpawnerInfo info);
|
|
|
|
Spawner* GetSpawner(LWOOBJID id);
|
|
|
|
void RemoveSpawner(LWOOBJID id);
|
|
|
|
std::vector<Spawner*> GetSpawnersByName(std::string spawnerName);
|
|
|
|
std::vector<Spawner*> GetSpawnersInGroup(std::string group);
|
|
|
|
void Update(float deltaTime);
|
|
|
|
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
|
2022-02-05 12:27:24 +00:00
|
|
|
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
|
2023-11-14 13:02:17 +00:00
|
|
|
bool GetDisableSaveLocation() { return m_DisableSaveLocation; }
|
|
|
|
bool GetMountsAllowed() { return m_MountsAllowed; }
|
|
|
|
bool GetPetsAllowed() { return m_PetsAllowed; }
|
2023-12-14 07:33:49 +00:00
|
|
|
float GetPetFollowRadius();
|
2022-07-31 03:56:21 +00:00
|
|
|
uint32_t GetUniqueMissionIdStartingValue();
|
2023-05-08 09:38:08 +00:00
|
|
|
bool CheckIfAccessibleZone(LWOMAPID zoneID);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-01-01 12:51:22 +00:00
|
|
|
// The world config should not be modified by a caller.
|
|
|
|
const WorldConfig* GetWorldConfig() {
|
|
|
|
if (!m_WorldConfig) LoadWorldConfig();
|
|
|
|
return m_WorldConfig;
|
|
|
|
};
|
2022-07-28 13:39:57 +00:00
|
|
|
|
2023-01-01 12:51:22 +00:00
|
|
|
private:
|
2022-07-31 03:56:21 +00:00
|
|
|
/**
|
|
|
|
* The starting unique mission ID.
|
|
|
|
*/
|
|
|
|
uint32_t m_UniqueMissionIdStart = 0;
|
|
|
|
|
2023-01-01 12:51:22 +00:00
|
|
|
Zone* m_pZone = nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
LWOZONEID m_ZoneID;
|
2023-11-14 13:02:17 +00:00
|
|
|
bool m_PlayerLoseCoinsOnDeath = false;
|
|
|
|
bool m_DisableSaveLocation = false;
|
|
|
|
bool m_MountsAllowed = true;
|
|
|
|
bool m_PetsAllowed = true;
|
2022-07-28 13:39:57 +00:00
|
|
|
std::map<LWOOBJID, Spawner*> m_Spawners;
|
2023-01-01 12:51:22 +00:00
|
|
|
WorldConfig* m_WorldConfig = nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-01-01 12:51:22 +00:00
|
|
|
Entity* m_ZoneControlObject = nullptr;
|
2021-12-05 17:54:36 +00:00
|
|
|
};
|