mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 02:08:20 +00:00
feat: use more zoneTable options (#1273)
* feat: use more zoneTable options Allow setting framrate for the zone Allow setting if pets are allowed in the zone Allow setting if mounts are allowed in a zone Allow disabling saving location to a zone * address feedback
This commit is contained in:
parent
79ff6e7ee4
commit
8a9883c224
@ -31,7 +31,7 @@ void CDZoneTableTable::LoadValuesFromDatabase() {
|
|||||||
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
|
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
|
||||||
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
||||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
||||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
|
entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", "");
|
||||||
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
|
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
|
||||||
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
|
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
|
||||||
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
|
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
|
||||||
@ -40,10 +40,10 @@ void CDZoneTableTable::LoadValuesFromDatabase() {
|
|||||||
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
|
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
|
||||||
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
|
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
|
||||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
|
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
|
||||||
UNUSED(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
|
entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false;
|
||||||
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
|
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
|
||||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||||
UNUSED(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
|
entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false;
|
||||||
|
|
||||||
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
||||||
tableData.nextRow();
|
tableData.nextRow();
|
||||||
|
@ -18,7 +18,7 @@ struct CDZoneTable {
|
|||||||
float smashableMaxDistance; //!< The maximum smashable distance?
|
float smashableMaxDistance; //!< The maximum smashable distance?
|
||||||
UNUSED(std::string mixerProgram); //!< ???
|
UNUSED(std::string mixerProgram); //!< ???
|
||||||
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate
|
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate
|
||||||
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate
|
std::string serverPhysicsFramerate; //!< The server physics framerate
|
||||||
unsigned int zoneControlTemplate; //!< The Zone Control template
|
unsigned int zoneControlTemplate; //!< The Zone Control template
|
||||||
unsigned int widthInChunks; //!< The width of the world in chunks
|
unsigned int widthInChunks; //!< The width of the world in chunks
|
||||||
unsigned int heightInChunks; //!< The height of the world in chunks
|
unsigned int heightInChunks; //!< The height of the world in chunks
|
||||||
@ -27,10 +27,10 @@ struct CDZoneTable {
|
|||||||
float fZoneWeight; //!< ???
|
float fZoneWeight; //!< ???
|
||||||
UNUSED(std::string thumbnail); //!< The thumbnail of the world
|
UNUSED(std::string thumbnail); //!< The thumbnail of the world
|
||||||
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
|
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
|
||||||
UNUSED(bool disableSaveLoc); //!< Disables the saving location?
|
bool disableSaveLoc; //!< Disables the saving location?
|
||||||
float teamRadius; //!< ???
|
float teamRadius; //!< ???
|
||||||
UNUSED(std::string gate_version); //!< The gate version
|
UNUSED(std::string gate_version); //!< The gate version
|
||||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
bool mountsAllowed; //!< Whether or not mounts are allowed
|
||||||
};
|
};
|
||||||
|
|
||||||
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
|
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
|
||||||
|
@ -314,7 +314,7 @@ void Character::SaveXMLToDatabase() {
|
|||||||
|
|
||||||
auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID();
|
auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID();
|
||||||
// lzid garbage, binary concat of zoneID, zoneInstance and zoneClone
|
// lzid garbage, binary concat of zoneID, zoneInstance and zoneClone
|
||||||
if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0) {
|
if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0 && !Game::zoneManager->GetDisableSaveLocation()) {
|
||||||
uint64_t lzidConcat = zoneInfo.GetCloneID();
|
uint64_t lzidConcat = zoneInfo.GetCloneID();
|
||||||
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetInstanceID());
|
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetInstanceID());
|
||||||
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetMapID());
|
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetMapID());
|
||||||
|
@ -187,7 +187,7 @@ void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
|
|
||||||
auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID();
|
auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID();
|
||||||
|
|
||||||
if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0) {
|
if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0 && !Game::zoneManager->GetDisableSaveLocation()) {
|
||||||
character->SetAttribute("lzx", m_Position.x);
|
character->SetAttribute("lzx", m_Position.x);
|
||||||
character->SetAttribute("lzy", m_Position.y);
|
character->SetAttribute("lzy", m_Position.y);
|
||||||
character->SetAttribute("lzz", m_Position.z);
|
character->SetAttribute("lzz", m_Position.z);
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include "eObjectBits.h"
|
#include "eObjectBits.h"
|
||||||
#include "eReplicaComponentType.h"
|
#include "eReplicaComponentType.h"
|
||||||
#include "eUseItemResponse.h"
|
#include "eUseItemResponse.h"
|
||||||
|
#include "dZoneManager.h"
|
||||||
|
#include "ChatPackets.h"
|
||||||
|
|
||||||
#include "CDBrickIDTableTable.h"
|
#include "CDBrickIDTableTable.h"
|
||||||
#include "CDObjectSkillsTable.h"
|
#include "CDObjectSkillsTable.h"
|
||||||
@ -292,13 +294,20 @@ void Item::UseNonEquip(Item* item) {
|
|||||||
|
|
||||||
const auto type = static_cast<eItemType>(info->itemType);
|
const auto type = static_cast<eItemType>(info->itemType);
|
||||||
if (type == eItemType::MOUNT) {
|
if (type == eItemType::MOUNT) {
|
||||||
|
if (Game::zoneManager->GetMountsAllowed()){
|
||||||
playerInventoryComponent->HandlePossession(this);
|
playerInventoryComponent->HandlePossession(this);
|
||||||
// TODO Check if mounts are allowed to be spawned
|
} else {
|
||||||
} else if (type == eItemType::PET_INVENTORY_ITEM && subKey != LWOOBJID_EMPTY) {
|
ChatPackets::SendSystemMessage(playerEntity->GetSystemAddress(), u"Mounts are not allowed in this zone");
|
||||||
|
}
|
||||||
|
} else if (type == eItemType::PET_INVENTORY_ITEM && subKey != LWOOBJID_EMPTY ) {
|
||||||
|
if (Game::zoneManager->GetPetsAllowed()){
|
||||||
const auto& databasePet = playerInventoryComponent->GetDatabasePet(subKey);
|
const auto& databasePet = playerInventoryComponent->GetDatabasePet(subKey);
|
||||||
if (databasePet.lot != LOT_NULL) {
|
if (databasePet.lot != LOT_NULL) {
|
||||||
playerInventoryComponent->SpawnPet(this);
|
playerInventoryComponent->SpawnPet(this);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ChatPackets::SendSystemMessage(playerEntity->GetSystemAddress(), u"Pets are not allowed in this zone");
|
||||||
|
}
|
||||||
// This precondition response is taken care of in SpawnPet().
|
// This precondition response is taken care of in SpawnPet().
|
||||||
} else {
|
} else {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "PerformanceManager.h"
|
#include "PerformanceManager.h"
|
||||||
|
#include "CDZoneTableTable.h"
|
||||||
|
#include "CDClientManager.h"
|
||||||
#include "UserManager.h"
|
#include "UserManager.h"
|
||||||
|
|
||||||
#define SOCIAL { lowFrameDelta }
|
#define SOCIAL { lowFrameDelta }
|
||||||
@ -68,11 +69,30 @@ std::map<LWOMAPID, PerformanceProfile> PerformanceManager::m_Profiles = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void PerformanceManager::SelectProfile(LWOMAPID mapID) {
|
void PerformanceManager::SelectProfile(LWOMAPID mapID) {
|
||||||
const auto pair = m_Profiles.find(mapID);
|
// Try to get it from zoneTable
|
||||||
|
CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable<CDZoneTableTable>();
|
||||||
|
if (zoneTable) {
|
||||||
|
const CDZoneTable* zone = zoneTable->Query(mapID);
|
||||||
|
if (zone) {
|
||||||
|
if (zone->serverPhysicsFramerate == "high"){
|
||||||
|
m_CurrentProfile = { highFrameDelta };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (zone->serverPhysicsFramerate == "medium"){
|
||||||
|
m_CurrentProfile = { mediumFrameDelta };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (zone->serverPhysicsFramerate == "low"){
|
||||||
|
m_CurrentProfile = { lowFrameDelta };
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to hardcoded list and defaults
|
||||||
|
const auto pair = m_Profiles.find(mapID);
|
||||||
if (pair == m_Profiles.end()) {
|
if (pair == m_Profiles.end()) {
|
||||||
m_CurrentProfile = m_DefaultProfile;
|
m_CurrentProfile = m_DefaultProfile;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
|||||||
Game::entityManager->SetGhostDistanceMax(max + min);
|
Game::entityManager->SetGhostDistanceMax(max + min);
|
||||||
Game::entityManager->SetGhostDistanceMin(max);
|
Game::entityManager->SetGhostDistanceMin(max);
|
||||||
m_PlayerLoseCoinsOnDeath = zone->PlayerLoseCoinsOnDeath;
|
m_PlayerLoseCoinsOnDeath = zone->PlayerLoseCoinsOnDeath;
|
||||||
|
m_DisableSaveLocation = zone->disableSaveLoc;
|
||||||
|
m_MountsAllowed = zone->mountsAllowed;
|
||||||
|
m_PetsAllowed = zone->petsAllowed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@ public:
|
|||||||
void Update(float deltaTime);
|
void Update(float deltaTime);
|
||||||
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
|
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
|
||||||
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
|
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
|
||||||
|
bool GetDisableSaveLocation() { return m_DisableSaveLocation; }
|
||||||
|
bool GetMountsAllowed() { return m_MountsAllowed; }
|
||||||
|
bool GetPetsAllowed() { return m_PetsAllowed; }
|
||||||
uint32_t GetUniqueMissionIdStartingValue();
|
uint32_t GetUniqueMissionIdStartingValue();
|
||||||
bool CheckIfAccessibleZone(LWOMAPID zoneID);
|
bool CheckIfAccessibleZone(LWOMAPID zoneID);
|
||||||
|
|
||||||
@ -58,7 +61,10 @@ private:
|
|||||||
|
|
||||||
Zone* m_pZone = nullptr;
|
Zone* m_pZone = nullptr;
|
||||||
LWOZONEID m_ZoneID;
|
LWOZONEID m_ZoneID;
|
||||||
bool m_PlayerLoseCoinsOnDeath; //Do players drop coins in this zone when smashed
|
bool m_PlayerLoseCoinsOnDeath = false;
|
||||||
|
bool m_DisableSaveLocation = false;
|
||||||
|
bool m_MountsAllowed = true;
|
||||||
|
bool m_PetsAllowed = true;
|
||||||
std::map<LWOOBJID, Spawner*> m_Spawners;
|
std::map<LWOOBJID, Spawner*> m_Spawners;
|
||||||
WorldConfig* m_WorldConfig = nullptr;
|
WorldConfig* m_WorldConfig = nullptr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user