mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Merge branch 'main' into main
This commit is contained in:
@@ -26,22 +26,20 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
|
||||
LOT zoneControlTemplate = 2365;
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT zoneControlTemplate, ghostdistance_min, ghostdistance FROM ZoneTable WHERE zoneID = ?;");
|
||||
query.bind(1, (int) zoneID.GetMapID());
|
||||
CDZoneTableTable* zoneTable = CDClientManager::Instance()->GetTable<CDZoneTableTable>("ZoneTable");
|
||||
if (zoneTable != nullptr){
|
||||
const CDZoneTable* zone = zoneTable->Query(zoneID.GetMapID());
|
||||
|
||||
auto result = query.execQuery();
|
||||
|
||||
if (!result.eof()) {
|
||||
zoneControlTemplate = result.getIntField("zoneControlTemplate", 2365);
|
||||
const auto min = result.getIntField("ghostdistance_min", 100);
|
||||
const auto max = result.getIntField("ghostdistance", 100);
|
||||
EntityManager::Instance()->SetGhostDistanceMax(max + min);
|
||||
EntityManager::Instance()->SetGhostDistanceMin(max);
|
||||
if (zone != nullptr) {
|
||||
zoneControlTemplate = zone->zoneControlTemplate != -1 ? zone->zoneControlTemplate : 2365;
|
||||
const auto min = zone->ghostdistance_min != -1.0f ? zone->ghostdistance_min : 100;
|
||||
const auto max = zone->ghostdistance != -1.0f ? zone->ghostdistance : 100;
|
||||
EntityManager::Instance()->SetGhostDistanceMax(max + min);
|
||||
EntityManager::Instance()->SetGhostDistanceMin(max);
|
||||
m_PlayerLoseCoinsOnDeath = zone->PlayerLoseCoinsOnDeath;
|
||||
}
|
||||
}
|
||||
|
||||
result.finalize();
|
||||
|
||||
Game::logger->Log("dZoneManager", "Creating zone control object %i\n", zoneControlTemplate);
|
||||
|
||||
// Create ZoneControl object
|
||||
@@ -121,6 +119,24 @@ LWOZONEID dZoneManager::GetZoneID() const
|
||||
return m_ZoneID;
|
||||
}
|
||||
|
||||
uint32_t dZoneManager::GetMaxLevel() {
|
||||
if (m_MaxLevel == 0) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT LevelCap FROM WorldConfig WHERE WorldConfigID = 1 LIMIT 1;");
|
||||
m_MaxLevel = tableData.getIntField(0, -1);
|
||||
tableData.finalize();
|
||||
}
|
||||
return m_MaxLevel;
|
||||
}
|
||||
|
||||
int32_t dZoneManager::GetLevelCapCurrencyConversion() {
|
||||
if (m_CurrencyConversionRate == 0) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT LevelCapCurrencyConversion FROM WorldConfig WHERE WorldConfigID = 1 LIMIT 1;");
|
||||
m_CurrencyConversionRate = tableData.getIntField(0, -1);
|
||||
tableData.finalize();
|
||||
}
|
||||
return m_CurrencyConversionRate;
|
||||
}
|
||||
|
||||
void dZoneManager::Update(float deltaTime) {
|
||||
for (auto spawner : m_Spawners) {
|
||||
spawner.second->Update(deltaTime);
|
||||
|
@@ -33,6 +33,8 @@ public:
|
||||
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;
|
||||
uint32_t GetMaxLevel();
|
||||
int32_t GetLevelCapCurrencyConversion();
|
||||
LWOOBJID MakeSpawner(SpawnerInfo info);
|
||||
Spawner* GetSpawner(LWOOBJID id);
|
||||
void RemoveSpawner(LWOOBJID id);
|
||||
@@ -40,11 +42,23 @@ public:
|
||||
std::vector<Spawner*> GetSpawnersInGroup(std::string group);
|
||||
void Update(float deltaTime);
|
||||
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
|
||||
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* The maximum level of the world.
|
||||
*/
|
||||
uint32_t m_MaxLevel = 0;
|
||||
|
||||
/**
|
||||
* The ratio of LEGO Score to currency when the character has hit the max level.
|
||||
*/
|
||||
int32_t m_CurrencyConversionRate = 0;
|
||||
|
||||
static dZoneManager* m_Address; //Singleton
|
||||
Zone* m_pZone;
|
||||
LWOZONEID m_ZoneID;
|
||||
bool m_PlayerLoseCoinsOnDeath; //Do players drop coins in this zone when smashed
|
||||
std::map<LWOOBJID, Spawner*> m_Spawners;
|
||||
|
||||
Entity* m_ZoneControlObject;
|
||||
|
Reference in New Issue
Block a user