mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-09 01:38: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);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
|
||||
entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", "");
|
||||
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
|
||||
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
|
||||
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
|
||||
@ -40,10 +40,10 @@ void CDZoneTableTable::LoadValuesFromDatabase() {
|
||||
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
|
||||
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
|
||||
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);
|
||||
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));
|
||||
tableData.nextRow();
|
||||
|
@ -18,7 +18,7 @@ struct CDZoneTable {
|
||||
float smashableMaxDistance; //!< The maximum smashable distance?
|
||||
UNUSED(std::string mixerProgram); //!< ???
|
||||
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 widthInChunks; //!< The width of the world in chunks
|
||||
unsigned int heightInChunks; //!< The height of the world in chunks
|
||||
@ -27,10 +27,10 @@ struct CDZoneTable {
|
||||
float fZoneWeight; //!< ???
|
||||
UNUSED(std::string thumbnail); //!< The thumbnail of the world
|
||||
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; //!< ???
|
||||
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> {
|
||||
|
@ -314,7 +314,7 @@ void Character::SaveXMLToDatabase() {
|
||||
|
||||
auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID();
|
||||
// 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();
|
||||
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetInstanceID());
|
||||
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetMapID());
|
||||
|
@ -187,7 +187,7 @@ void ControllablePhysicsComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
||||
|
||||
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("lzy", m_Position.y);
|
||||
character->SetAttribute("lzz", m_Position.z);
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "eObjectBits.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eUseItemResponse.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "ChatPackets.h"
|
||||
|
||||
#include "CDBrickIDTableTable.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
@ -292,12 +294,19 @@ void Item::UseNonEquip(Item* item) {
|
||||
|
||||
const auto type = static_cast<eItemType>(info->itemType);
|
||||
if (type == eItemType::MOUNT) {
|
||||
playerInventoryComponent->HandlePossession(this);
|
||||
// TODO Check if mounts are allowed to be spawned
|
||||
} else if (type == eItemType::PET_INVENTORY_ITEM && subKey != LWOOBJID_EMPTY) {
|
||||
const auto& databasePet = playerInventoryComponent->GetDatabasePet(subKey);
|
||||
if (databasePet.lot != LOT_NULL) {
|
||||
playerInventoryComponent->SpawnPet(this);
|
||||
if (Game::zoneManager->GetMountsAllowed()){
|
||||
playerInventoryComponent->HandlePossession(this);
|
||||
} else {
|
||||
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);
|
||||
if (databasePet.lot != LOT_NULL) {
|
||||
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().
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "PerformanceManager.h"
|
||||
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "UserManager.h"
|
||||
|
||||
#define SOCIAL { lowFrameDelta }
|
||||
@ -68,11 +69,30 @@ std::map<LWOMAPID, PerformanceProfile> PerformanceManager::m_Profiles = {
|
||||
};
|
||||
|
||||
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()) {
|
||||
m_CurrentProfile = m_DefaultProfile;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,9 @@ void dZoneManager::Initialize(const LWOZONEID& zoneID) {
|
||||
Game::entityManager->SetGhostDistanceMax(max + min);
|
||||
Game::entityManager->SetGhostDistanceMin(max);
|
||||
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);
|
||||
Entity* GetZoneControlObject() { return m_ZoneControlObject; }
|
||||
bool GetPlayerLoseCoinOnDeath() { return m_PlayerLoseCoinsOnDeath; }
|
||||
bool GetDisableSaveLocation() { return m_DisableSaveLocation; }
|
||||
bool GetMountsAllowed() { return m_MountsAllowed; }
|
||||
bool GetPetsAllowed() { return m_PetsAllowed; }
|
||||
uint32_t GetUniqueMissionIdStartingValue();
|
||||
bool CheckIfAccessibleZone(LWOMAPID zoneID);
|
||||
|
||||
@ -58,7 +61,10 @@ private:
|
||||
|
||||
Zone* m_pZone = nullptr;
|
||||
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;
|
||||
WorldConfig* m_WorldConfig = nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user