mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Implement CDZoneTable PlayerLoseCoinsOnDeath (#251)
* Implement ZoneTable PlayerLoseCoinsOnDeath - Adds a check on death if the character should drop coins in the current zone * Refactored PlayerLoseCoinOnDeath into dZoneManager * Coin death drops use LootGenerator * Refactored again with use of CDZoneTableTable * Remove duplicate CDZone call during initialization
This commit is contained in:
@@ -26,19 +26,20 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
|
||||
LOT zoneControlTemplate = 2365;
|
||||
|
||||
std::stringstream query;
|
||||
auto result = CDClientDatabase::ExecuteQuery("SELECT zoneControlTemplate, ghostdistance_min, ghostdistance FROM ZoneTable WHERE zoneID = " + std::to_string(zoneID.GetMapID()));
|
||||
CDZoneTableTable* zoneTable = CDClientManager::Instance()->GetTable<CDZoneTableTable>("ZoneTable");
|
||||
if (zoneTable != nullptr){
|
||||
const CDZoneTable* zone = zoneTable->Query(zoneID.GetMapID());
|
||||
|
||||
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(min);
|
||||
m_PlayerLoseCoinsOnDeath = zone->PlayerLoseCoinsOnDeath;
|
||||
}
|
||||
}
|
||||
|
||||
result.finalize();
|
||||
|
||||
Game::logger->Log("dZoneManager", "Creating zone control object %i\n", zoneControlTemplate);
|
||||
|
||||
// Create ZoneControl object
|
||||
|
@@ -42,6 +42,7 @@ public:
|
||||
std::vector<Spawner*> GetSpawnersInGroup(std::string group);
|
||||
void Update(float deltaTime);
|
||||
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
|
||||
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -57,6 +58,7 @@ private:
|
||||
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