mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Code] PathManager Global to Singleton Cleanup (#4924)
This commit is contained in:
parent
e846bb86b6
commit
df86ad371b
@ -41,7 +41,6 @@
|
|||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ int main(int argc, char **argv)
|
|||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
LogInfo("Client Files Export Utility");
|
LogInfo("Client Files Export Utility");
|
||||||
if (!EQEmuConfig::LoadConfig()) {
|
if (!EQEmuConfig::LoadConfig()) {
|
||||||
@ -100,7 +99,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
@ -136,7 +135,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
void ExportSpells(SharedDatabase* db)
|
void ExportSpells(SharedDatabase* db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/spells_us.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/spells_us.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/spells_us.txt to write, skipping.");
|
LogError("Unable to open export/spells_us.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
@ -155,7 +154,7 @@ void ExportSpells(SharedDatabase* db)
|
|||||||
|
|
||||||
void ExportSkillCaps(SharedDatabase* db)
|
void ExportSkillCaps(SharedDatabase* db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
@ -174,7 +173,7 @@ void ExportSkillCaps(SharedDatabase* db)
|
|||||||
|
|
||||||
void ExportBaseData(SharedDatabase *db)
|
void ExportBaseData(SharedDatabase *db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/BaseData.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/BaseData.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/BaseData.txt to write, skipping.");
|
LogError("Unable to open export/BaseData.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
@ -193,7 +192,7 @@ void ExportBaseData(SharedDatabase *db)
|
|||||||
|
|
||||||
void ExportDBStrings(SharedDatabase *db)
|
void ExportDBStrings(SharedDatabase *db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
|
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -35,7 +35,6 @@
|
|||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
|
|
||||||
@ -49,7 +48,7 @@ int main(int argc, char **argv) {
|
|||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
LogInfo("Client Files Import Utility");
|
LogInfo("Client Files Import Utility");
|
||||||
if(!EQEmuConfig::LoadConfig()) {
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
@ -93,7 +92,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
@ -138,7 +137,7 @@ bool IsStringField(int i) {
|
|||||||
|
|
||||||
void ImportSpells(SharedDatabase *db) {
|
void ImportSpells(SharedDatabase *db) {
|
||||||
LogInfo("Importing Spells");
|
LogInfo("Importing Spells");
|
||||||
std::string file = fmt::format("{}/import/spells_us.txt", path.GetServerPath());
|
std::string file = fmt::format("{}/import/spells_us.txt", PathManager::Instance()->GetServerPath());
|
||||||
FILE *f = fopen(file.c_str(), "r");
|
FILE *f = fopen(file.c_str(), "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
LogError("Unable to open {} to read, skipping.", file);
|
LogError("Unable to open {} to read, skipping.", file);
|
||||||
@ -228,7 +227,7 @@ void ImportSpells(SharedDatabase *db) {
|
|||||||
void ImportSkillCaps(SharedDatabase *db) {
|
void ImportSkillCaps(SharedDatabase *db) {
|
||||||
LogInfo("Importing Skill Caps");
|
LogInfo("Importing Skill Caps");
|
||||||
|
|
||||||
std::string file = fmt::format("{}/import/SkillCaps.txt", path.GetServerPath());
|
std::string file = fmt::format("{}/import/SkillCaps.txt", PathManager::Instance()->GetServerPath());
|
||||||
FILE *f = fopen(file.c_str(), "r");
|
FILE *f = fopen(file.c_str(), "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
LogError("Unable to open {} to read, skipping.", file);
|
LogError("Unable to open {} to read, skipping.", file);
|
||||||
@ -265,7 +264,7 @@ void ImportBaseData(SharedDatabase *db)
|
|||||||
{
|
{
|
||||||
LogInfo("Importing Base Data");
|
LogInfo("Importing Base Data");
|
||||||
|
|
||||||
const std::string& file_name = fmt::format("{}/import/BaseData.txt", path.GetServerPath());
|
const std::string& file_name = fmt::format("{}/import/BaseData.txt", PathManager::Instance()->GetServerPath());
|
||||||
|
|
||||||
const auto& file_contents = File::GetContents(file_name);
|
const auto& file_contents = File::GetContents(file_name);
|
||||||
if (!file_contents.error.empty()) {
|
if (!file_contents.error.empty()) {
|
||||||
@ -305,7 +304,7 @@ void ImportBaseData(SharedDatabase *db)
|
|||||||
void ImportDBStrings(SharedDatabase *db) {
|
void ImportDBStrings(SharedDatabase *db) {
|
||||||
LogInfo("Importing DB Strings");
|
LogInfo("Importing DB Strings");
|
||||||
|
|
||||||
std::string file = fmt::format("{}/import/dbstr_us.txt", path.GetServerPath());
|
std::string file = fmt::format("{}/import/dbstr_us.txt", PathManager::Instance()->GetServerPath());
|
||||||
FILE *f = fopen(file.c_str(), "r");
|
FILE *f = fopen(file.c_str(), "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
LogError("Unable to open {} to read, skipping.", file);
|
LogError("Unable to open {} to read, skipping.", file);
|
||||||
|
|||||||
@ -436,11 +436,11 @@ void EQEmuConfig::CheckUcsConfigConversion()
|
|||||||
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
||||||
|
|
||||||
std::string config_file_path = std::filesystem::path{
|
std::string config_file_path = std::filesystem::path{
|
||||||
path.GetServerPath() + "/eqemu_config.json"
|
PathManager::Instance()->GetServerPath() + "/eqemu_config.json"
|
||||||
}.string();
|
}.string();
|
||||||
|
|
||||||
std::string config_file_bak_path = std::filesystem::path{
|
std::string config_file_bak_path = std::filesystem::path{
|
||||||
path.GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
PathManager::Instance()->GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||||
}.string();
|
}.string();
|
||||||
|
|
||||||
// copy eqemu_config.json to eqemu_config.json.bak
|
// copy eqemu_config.json to eqemu_config.json.bak
|
||||||
|
|||||||
@ -191,7 +191,7 @@ class EQEmuConfig
|
|||||||
|
|
||||||
std::string file = fmt::format(
|
std::string file = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
(file_path.empty() ? path.GetServerPath() : file_path),
|
(file_path.empty() ? PathManager::Instance()->GetServerPath() : file_path),
|
||||||
EQEmuConfig::ConfigFile
|
EQEmuConfig::ConfigFile
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -537,9 +537,9 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
|||||||
{
|
{
|
||||||
EQEmuLogSys::CloseFileLogs();
|
EQEmuLogSys::CloseFileLogs();
|
||||||
|
|
||||||
if (!File::Exists(path.GetLogPath())) {
|
if (!File::Exists(PathManager::Instance()->GetLogPath())) {
|
||||||
LogInfo("Logs directory not found, creating [{}]", path.GetLogPath());
|
LogInfo("Logs directory not found, creating [{}]", PathManager::Instance()->GetLogPath());
|
||||||
File::Makedir(path.GetLogPath());
|
File::Makedir(PathManager::Instance()->GetLogPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -55,7 +55,7 @@ namespace EQ {
|
|||||||
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::string final_name = fmt::format("{}/{}.lock", path.GetSharedMemoryPath(), name);
|
std::string final_name = fmt::format("{}/{}.lock", PathManager::Instance()->GetSharedMemoryPath(), name);
|
||||||
|
|
||||||
#ifdef __DARWIN
|
#ifdef __DARWIN
|
||||||
#if __DARWIN_C_LEVEL < 200809L
|
#if __DARWIN_C_LEVEL < 200809L
|
||||||
|
|||||||
@ -78,7 +78,7 @@ namespace RoF
|
|||||||
{
|
{
|
||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
|
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
//TODO: figure out how to support shared memory with multiple patches...
|
//TODO: figure out how to support shared memory with multiple patches...
|
||||||
@ -117,7 +117,7 @@ namespace RoF
|
|||||||
//we need to go to every stream and replace it's manager.
|
//we need to go to every stream and replace it's manager.
|
||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -81,7 +81,7 @@ namespace RoF2
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
|
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
|
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
//TODO: figure out how to support shared memory with multiple patches...
|
//TODO: figure out how to support shared memory with multiple patches...
|
||||||
@ -123,7 +123,7 @@ namespace RoF2
|
|||||||
//we need to go to every stream and replace it's manager.
|
//we need to go to every stream and replace it's manager.
|
||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -72,7 +72,7 @@ namespace SoD
|
|||||||
{
|
{
|
||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
//TODO: figure out how to support shared memory with multiple patches...
|
//TODO: figure out how to support shared memory with multiple patches...
|
||||||
opcodes = new RegularOpcodeManager();
|
opcodes = new RegularOpcodeManager();
|
||||||
@ -113,7 +113,7 @@ namespace SoD
|
|||||||
//we need to go to every stream and replace it's manager.
|
//we need to go to every stream and replace it's manager.
|
||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace SoF
|
|||||||
{
|
{
|
||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
//TODO: figure out how to support shared memory with multiple patches...
|
//TODO: figure out how to support shared memory with multiple patches...
|
||||||
opcodes = new RegularOpcodeManager();
|
opcodes = new RegularOpcodeManager();
|
||||||
@ -110,7 +110,7 @@ namespace SoF
|
|||||||
//we need to go to every stream and replace it's manager.
|
//we need to go to every stream and replace it's manager.
|
||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -73,7 +73,7 @@ namespace Titanium
|
|||||||
auto Config = EQEmuConfig::get();
|
auto Config = EQEmuConfig::get();
|
||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
//TODO: figure out how to support shared memory with multiple patches...
|
//TODO: figure out how to support shared memory with multiple patches...
|
||||||
opcodes = new RegularOpcodeManager();
|
opcodes = new RegularOpcodeManager();
|
||||||
@ -114,7 +114,7 @@ namespace Titanium
|
|||||||
//we need to go to every stream and replace it's manager.
|
//we need to go to every stream and replace it's manager.
|
||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -76,7 +76,7 @@ namespace UF
|
|||||||
{
|
{
|
||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
//TODO: figure out how to support shared memory with multiple patches...
|
//TODO: figure out how to support shared memory with multiple patches...
|
||||||
opcodes = new RegularOpcodeManager();
|
opcodes = new RegularOpcodeManager();
|
||||||
@ -117,7 +117,7 @@ namespace UF
|
|||||||
//we need to go to every stream and replace it's manager.
|
//we need to go to every stream and replace it's manager.
|
||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
void PathManager::LoadPaths()
|
void PathManager::Init()
|
||||||
{
|
{
|
||||||
m_server_path = File::FindEqemuConfigPath();
|
m_server_path = File::FindEqemuConfigPath();
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,13 @@
|
|||||||
|
|
||||||
class PathManager {
|
class PathManager {
|
||||||
public:
|
public:
|
||||||
void LoadPaths();
|
void Init();
|
||||||
|
|
||||||
|
static PathManager *Instance()
|
||||||
|
{
|
||||||
|
static PathManager instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] const std::string &GetLogPath() const;
|
[[nodiscard]] const std::string &GetLogPath() const;
|
||||||
[[nodiscard]] const std::string &GetLuaModsPath() const;
|
[[nodiscard]] const std::string &GetLuaModsPath() const;
|
||||||
@ -38,6 +44,4 @@ private:
|
|||||||
std::string m_shared_memory_path;
|
std::string m_shared_memory_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PathManager path;
|
|
||||||
|
|
||||||
#endif //EQEMU_PATH_MANAGER_H
|
#endif //EQEMU_PATH_MANAGER_H
|
||||||
|
|||||||
@ -974,7 +974,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
|||||||
const auto Config = EQEmuConfig::get();
|
const auto Config = EQEmuConfig::get();
|
||||||
EQ::IPCMutex mutex("items");
|
EQ::IPCMutex mutex("items");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("items"));
|
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("items"));
|
||||||
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||||
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
|
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
|
||||||
mutex.Unlock();
|
mutex.Unlock();
|
||||||
@ -1665,7 +1665,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
|||||||
EQ::IPCMutex mutex("spells");
|
EQ::IPCMutex mutex("spells");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("spells"));
|
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("spells"));
|
||||||
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||||
LogInfo("Loading [{}]", file_name);
|
LogInfo("Loading [{}]", file_name);
|
||||||
*records = *static_cast<uint32*>(spells_mmf->Get());
|
*records = *static_cast<uint32*>(spells_mmf->Get());
|
||||||
|
|||||||
@ -34,7 +34,6 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
PathManager path;
|
|
||||||
|
|
||||||
bool RunLoops = false;
|
bool RunLoops = false;
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ int main(int argc, char *argv[]) {
|
|||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
std::string launcher_name;
|
std::string launcher_name;
|
||||||
if(argc == 2) {
|
if(argc == 2) {
|
||||||
|
|||||||
@ -94,7 +94,7 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
std::string opcodes_path = fmt::format(
|
std::string opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetOpcodePath(),
|
PathManager::Instance()->GetOpcodePath(),
|
||||||
"login_opcodes.conf"
|
"login_opcodes.conf"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetOpcodePath(),
|
PathManager::Instance()->GetOpcodePath(),
|
||||||
"login_opcodes_sod.conf"
|
"login_opcodes_sod.conf"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetOpcodePath(),
|
PathManager::Instance()->GetOpcodePath(),
|
||||||
"login_opcodes_larion.conf"
|
"login_opcodes_larion.conf"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
LoginServer server;
|
LoginServer server;
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
bool run_server = true;
|
bool run_server = true;
|
||||||
PathManager path;
|
|
||||||
Database database;
|
Database database;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
@ -52,7 +51,7 @@ void LoadDatabaseConnection()
|
|||||||
void LoadServerConfig()
|
void LoadServerConfig()
|
||||||
{
|
{
|
||||||
server.config = EQ::JsonConfigFile::Load(
|
server.config = EQ::JsonConfigFile::Load(
|
||||||
fmt::format("{}/login.json", path.GetServerPath())
|
fmt::format("{}/login.json", PathManager::Instance()->GetServerPath())
|
||||||
);
|
);
|
||||||
LogInfo("Config System Init");
|
LogInfo("Config System Init");
|
||||||
|
|
||||||
@ -162,7 +161,7 @@ int main(int argc, char **argv)
|
|||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
// command handler
|
// command handler
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
|||||||
@ -31,7 +31,6 @@ std::string WorldShortName;
|
|||||||
const queryservconfig *Config;
|
const queryservconfig *Config;
|
||||||
WorldServer *worldserver = 0;
|
WorldServer *worldserver = 0;
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
PathManager path;
|
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
ZSList zs_list;
|
ZSList zs_list;
|
||||||
@ -50,7 +49,7 @@ int main()
|
|||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
Timer LFGuildExpireTimer(60000);
|
Timer LFGuildExpireTimer(60000);
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
LogInfo("Starting EQEmu QueryServ");
|
LogInfo("Starting EQEmu QueryServ");
|
||||||
if (!queryservconfig::LoadConfig()) {
|
if (!queryservconfig::LoadConfig()) {
|
||||||
@ -86,7 +85,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@
|
|||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ int main(int argc, char **argv)
|
|||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
LogInfo("Shared Memory Loader Program");
|
LogInfo("Shared Memory Loader Program");
|
||||||
if (!EQEmuConfig::LoadConfig()) {
|
if (!EQEmuConfig::LoadConfig()) {
|
||||||
@ -127,7 +126,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
|
|||||||
@ -35,13 +35,12 @@
|
|||||||
|
|
||||||
const EQEmuConfig *Config;
|
const EQEmuConfig *Config;
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
PathManager path;
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
||||||
Config = EQEmuConfig::get();
|
Config = EQEmuConfig::get();
|
||||||
|
|||||||
@ -482,7 +482,7 @@ Clientlist::Clientlist(int ChatPort) {
|
|||||||
const ucsconfig *Config = ucsconfig::get();
|
const ucsconfig *Config = ucsconfig::get();
|
||||||
|
|
||||||
|
|
||||||
std::string opcodes_file = fmt::format("{}/{}", path.GetServerPath(), Config->MailOpCodesFile);
|
std::string opcodes_file = fmt::format("{}/{}", PathManager::Instance()->GetServerPath(), Config->MailOpCodesFile);
|
||||||
|
|
||||||
LogInfo("Loading [{}]", opcodes_file);
|
LogInfo("Loading [{}]", opcodes_file);
|
||||||
if (!ChatOpMgr->LoadOpcodes(opcodes_file.c_str()))
|
if (!ChatOpMgr->LoadOpcodes(opcodes_file.c_str()))
|
||||||
|
|||||||
@ -48,7 +48,6 @@ EQEmuLogSys LogSys;
|
|||||||
UCSDatabase database;
|
UCSDatabase database;
|
||||||
WorldServer *worldserver = nullptr;
|
WorldServer *worldserver = nullptr;
|
||||||
DiscordManager discord_manager;
|
DiscordManager discord_manager;
|
||||||
PathManager path;
|
|
||||||
ZoneStore zone_store;
|
ZoneStore zone_store;
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ int main() {
|
|||||||
LogSys.LoadLogSettingsDefaults();
|
LogSys.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
// Check every minute for unused channels we can delete
|
// Check every minute for unused channels we can delete
|
||||||
//
|
//
|
||||||
@ -140,7 +139,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
|
|||||||
@ -111,7 +111,6 @@ const WorldConfig *Config;
|
|||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
WebInterfaceList web_interface;
|
WebInterfaceList web_interface;
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
EvolvingItemsManager evolving_items_manager;
|
EvolvingItemsManager evolving_items_manager;
|
||||||
|
|
||||||
@ -142,7 +141,7 @@ int main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
if (!WorldBoot::LoadServerConfig()) {
|
if (!WorldBoot::LoadServerConfig()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -84,7 +84,7 @@ bool WorldBoot::HandleCommandInput(int argc, char **argv)
|
|||||||
// command handler
|
// command handler
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
LogSys.SilenceConsoleLogging();
|
LogSys.SilenceConsoleLogging();
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
WorldConfig::LoadConfig();
|
WorldConfig::LoadConfig();
|
||||||
LoadDatabaseConnections();
|
LoadDatabaseConnections();
|
||||||
RuleManager::Instance()->LoadRules(&database, "default", false);
|
RuleManager::Instance()->LoadRules(&database, "default", false);
|
||||||
@ -234,7 +234,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// logging system init
|
// logging system init
|
||||||
auto logging = LogSys.SetDatabase(&database)
|
auto logging = LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings();
|
->LoadLogDatabaseSettings();
|
||||||
|
|
||||||
LogSys.SetDiscordHandler(&WorldBoot::DiscordWebhookMessageHandler);
|
LogSys.SetDiscordHandler(&WorldBoot::DiscordWebhookMessageHandler);
|
||||||
|
|||||||
@ -138,7 +138,7 @@ void Embperl::DoInit()
|
|||||||
LogQuests("Warning [{}]: [{}]", Config->PluginPlFile, e);
|
LogQuests("Warning [{}]: [{}]", Config->PluginPlFile, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetPluginPaths()) {
|
for (auto & dir : PathManager::Instance()->GetPluginPaths()) {
|
||||||
try {
|
try {
|
||||||
//should probably read the directory in c, instead, so that
|
//should probably read the directory in c, instead, so that
|
||||||
//I can echo filenames as I do it, but c'mon... I'm lazy and this 1 line reads in all the plugins
|
//I can echo filenames as I do it, but c'mon... I'm lazy and this 1 line reads in all the plugins
|
||||||
|
|||||||
@ -1070,7 +1070,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
std::string module_path = lua_tostring(L, -1);
|
std::string module_path = lua_tostring(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
for (const auto& dir : path.GetLuaModulePaths()) {
|
for (const auto& dir : PathManager::Instance()->GetLuaModulePaths()) {
|
||||||
module_path += fmt::format(";{}/?.lua", dir);
|
module_path += fmt::format(";{}/?.lua", dir);
|
||||||
module_path += fmt::format(";{}/?/init.lua", dir);
|
module_path += fmt::format(";{}/?/init.lua", dir);
|
||||||
module_path += fmt::format(";{}/share/lua/{}/?.lua", dir, lua_version);
|
module_path += fmt::format(";{}/share/lua/{}/?.lua", dir, lua_version);
|
||||||
@ -1086,7 +1086,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
module_path = lua_tostring(L, -1);
|
module_path = lua_tostring(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
for (const auto& dir : path.GetLuaModulePaths()) {
|
for (const auto& dir : PathManager::Instance()->GetLuaModulePaths()) {
|
||||||
module_path += fmt::format(";{}/?{}", dir, libext);
|
module_path += fmt::format(";{}/?{}", dir, libext);
|
||||||
module_path += fmt::format(";{}/lib/lua/{}/?{}", dir, lua_version, libext);
|
module_path += fmt::format(";{}/lib/lua/{}/?{}", dir, lua_version, libext);
|
||||||
}
|
}
|
||||||
@ -1098,7 +1098,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
MapFunctions(L);
|
MapFunctions(L);
|
||||||
|
|
||||||
// load init
|
// load init
|
||||||
for (auto& dir : path.GetQuestPaths()) {
|
for (auto& dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
std::string filename = fmt::format("{}/{}/script_init.lua", dir, QUEST_GLOBAL_DIRECTORY);
|
std::string filename = fmt::format("{}/{}/script_init.lua", dir, QUEST_GLOBAL_DIRECTORY);
|
||||||
|
|
||||||
FILE* f = fopen(filename.c_str(), "r");
|
FILE* f = fopen(filename.c_str(), "r");
|
||||||
@ -1114,7 +1114,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
|
|
||||||
//zone init - always loads after global
|
//zone init - always loads after global
|
||||||
if (zone) {
|
if (zone) {
|
||||||
for (auto& dir : path.GetQuestPaths()) {
|
for (auto& dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
std::string zone_script = fmt::format(
|
std::string zone_script = fmt::format(
|
||||||
"{}/{}/script_init_v{}.lua",
|
"{}/{}/script_init_v{}.lua",
|
||||||
dir,
|
dir,
|
||||||
@ -1147,7 +1147,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *load_order = fopen(fmt::format("{}/load_order.txt", path.GetLuaModsPath()).c_str(), "r");
|
FILE *load_order = fopen(fmt::format("{}/load_order.txt", PathManager::Instance()->GetLuaModsPath()).c_str(), "r");
|
||||||
if (load_order) {
|
if (load_order) {
|
||||||
char file_name[256] = { 0 };
|
char file_name[256] = { 0 };
|
||||||
while (fgets(file_name, 256, load_order) != nullptr) {
|
while (fgets(file_name, 256, load_order) != nullptr) {
|
||||||
@ -1159,7 +1159,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadScript(fmt::format("{}/{}", path.GetLuaModsPath(), std::string(file_name)), file_name);
|
LoadScript(fmt::format("{}/{}", PathManager::Instance()->GetLuaModsPath(), std::string(file_name)), file_name);
|
||||||
mods_.emplace_back(L, this, file_name);
|
mods_.emplace_back(L, this, file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,6 @@ QuestParserCollection *parse = 0;
|
|||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
ZoneEventScheduler event_scheduler;
|
ZoneEventScheduler event_scheduler;
|
||||||
WorldContentService content_service;
|
WorldContentService content_service;
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
PlayerEventLogs player_event_logs;
|
||||||
DatabaseUpdate database_update;
|
DatabaseUpdate database_update;
|
||||||
SkillCaps skill_caps;
|
SkillCaps skill_caps;
|
||||||
@ -137,7 +136,7 @@ int main(int argc, char **argv)
|
|||||||
LogSys.SilenceConsoleLogging();
|
LogSys.SilenceConsoleLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
#ifdef USE_MAP_MMFS
|
#ifdef USE_MAP_MMFS
|
||||||
if (argc == 3 && strcasecmp(argv[1], "convert_map") == 0) {
|
if (argc == 3 && strcasecmp(argv[1], "convert_map") == 0) {
|
||||||
@ -305,7 +304,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
LogSys.SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings(ZoneCLI::RanTestCommand(argc, argv))
|
->LoadLogDatabaseSettings(ZoneCLI::RanTestCommand(argc, argv))
|
||||||
->SetGMSayHandler(&Zone::GMSayHookCallBackProcess)
|
->SetGMSayHandler(&Zone::GMSayHookCallBackProcess)
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
@ -752,7 +751,7 @@ bool CheckForCompatibleQuestPlugins()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (const auto &[directory, flag]: directories) {
|
for (const auto &[directory, flag]: directories) {
|
||||||
std::string dir_path = path.GetServerPath() + "/" + directory;
|
std::string dir_path = PathManager::Instance()->GetServerPath() + "/" + directory;
|
||||||
if (!File::Exists(dir_path)) { continue; }
|
if (!File::Exists(dir_path)) { continue; }
|
||||||
|
|
||||||
for (const auto &file: fs::directory_iterator(dir_path)) {
|
for (const auto &file: fs::directory_iterator(dir_path)) {
|
||||||
|
|||||||
@ -271,7 +271,7 @@ bool Map::DoCollisionCheck(glm::vec3 myloc, glm::vec3 oloc, glm::vec3 &outnorm,
|
|||||||
|
|
||||||
Map *Map::LoadMapFile(std::string file) {
|
Map *Map::LoadMapFile(std::string file) {
|
||||||
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
||||||
std::string filename = fmt::format("{}/base/{}.map", path.GetMapsPath(), file);
|
std::string filename = fmt::format("{}/base/{}.map", PathManager::Instance()->GetMapsPath(), file);
|
||||||
|
|
||||||
LogInfo("Attempting to load Map File [{}]", filename.c_str());
|
LogInfo("Attempting to load Map File [{}]", filename.c_str());
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
IPathfinder *IPathfinder::Load(const std::string &zone) {
|
IPathfinder *IPathfinder::Load(const std::string &zone) {
|
||||||
struct stat statbuffer;
|
struct stat statbuffer;
|
||||||
std::string navmesh_path = fmt::format("{}/maps/nav/{}.nav", path.GetServerPath(), zone);
|
std::string navmesh_path = fmt::format("{}/maps/nav/{}.nav", PathManager::Instance()->GetServerPath(), zone);
|
||||||
if (stat(navmesh_path.c_str(), &statbuffer) == 0) {
|
if (stat(navmesh_path.c_str(), &statbuffer) == 0) {
|
||||||
return new PathfinderNavmesh(navmesh_path);
|
return new PathfinderNavmesh(navmesh_path);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -939,7 +939,7 @@ QuestInterface* QuestParserCollection::GetQIByNPCQuest(uint32 npc_id, std::strin
|
|||||||
|
|
||||||
Strings::FindReplace(npc_name, "`", "-");
|
Strings::FindReplace(npc_name, "`", "-");
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& npc_id_and_name = fmt::format(
|
const std::string& npc_id_and_name = fmt::format(
|
||||||
"{}_{}",
|
"{}_{}",
|
||||||
npc_name,
|
npc_name,
|
||||||
@ -1007,7 +1007,7 @@ QuestInterface* QuestParserCollection::GetQIByPlayerQuest(std::string& filename)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& global_path = fmt::format(
|
const std::string& global_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
dir,
|
dir,
|
||||||
@ -1062,7 +1062,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalNPCQuest(std::string& filena
|
|||||||
|
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
for (auto* e: _load_precedence) {
|
for (auto* e: _load_precedence) {
|
||||||
file_name = fmt::format(
|
file_name = fmt::format(
|
||||||
"{}/{}/global_npc.{}",
|
"{}/{}/global_npc.{}",
|
||||||
@ -1088,7 +1088,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalPlayerQuest(std::string& fil
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
for (auto* e: _load_precedence) {
|
for (auto* e: _load_precedence) {
|
||||||
file_name = fmt::format(
|
file_name = fmt::format(
|
||||||
"{}/{}/global_player.{}",
|
"{}/{}/global_player.{}",
|
||||||
@ -1113,7 +1113,7 @@ QuestInterface* QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& global_path = fmt::format(
|
const std::string& global_path = fmt::format(
|
||||||
"{}/{}/spells",
|
"{}/{}/spells",
|
||||||
dir,
|
dir,
|
||||||
@ -1167,7 +1167,7 @@ QuestInterface* QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& global_path = fmt::format(
|
const std::string& global_path = fmt::format(
|
||||||
"{}/{}/items",
|
"{}/{}/items",
|
||||||
dir,
|
dir,
|
||||||
@ -1221,7 +1221,7 @@ QuestInterface* QuestParserCollection::GetQIByEncounterQuest(std::string encount
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& global_path = fmt::format(
|
const std::string& global_path = fmt::format(
|
||||||
"{}/{}/encounters",
|
"{}/{}/encounters",
|
||||||
dir,
|
dir,
|
||||||
@ -1273,7 +1273,7 @@ QuestInterface* QuestParserCollection::GetQIByBotQuest(std::string& filename)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& global_path = fmt::format(
|
const std::string& global_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
dir,
|
dir,
|
||||||
@ -1327,7 +1327,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalBotQuest(std::string& filena
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
for (auto* e: _load_precedence) {
|
for (auto* e: _load_precedence) {
|
||||||
file_name = fmt::format(
|
file_name = fmt::format(
|
||||||
"{}/{}/global_bot.{}",
|
"{}/{}/global_bot.{}",
|
||||||
@ -1352,7 +1352,7 @@ QuestInterface* QuestParserCollection::GetQIByMercQuest(std::string& filename)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
const std::string& global_path = fmt::format(
|
const std::string& global_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
dir,
|
dir,
|
||||||
@ -1406,7 +1406,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalMercQuest(std::string& filen
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string file_name;
|
std::string file_name;
|
||||||
for (auto & dir : path.GetQuestPaths()) {
|
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||||
for (auto* e: _load_precedence) {
|
for (auto* e: _load_precedence) {
|
||||||
file_name = fmt::format(
|
file_name = fmt::format(
|
||||||
"{}/{}/global_merc.{}",
|
"{}/{}/global_merc.{}",
|
||||||
|
|||||||
@ -200,7 +200,7 @@ void QuestManager::summonitem(uint32 itemid, int16 charges) {
|
|||||||
|
|
||||||
void QuestManager::write(const char *file, const char *str) {
|
void QuestManager::write(const char *file, const char *str) {
|
||||||
FILE * pFile;
|
FILE * pFile;
|
||||||
pFile = fopen (fmt::format("{}/{}", path.GetServerPath(), file).c_str(), "a");
|
pFile = fopen (fmt::format("{}/{}", PathManager::Instance()->GetServerPath(), file).c_str(), "a");
|
||||||
if(!pFile)
|
if(!pFile)
|
||||||
return;
|
return;
|
||||||
fprintf(pFile, "%s\n", str);
|
fprintf(pFile, "%s\n", str);
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
|
WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
|
||||||
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
|
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
|
||||||
|
|
||||||
std::string file_path = fmt::format("{}/water/{}.wtr", path.GetMapsPath(), zone_name);
|
std::string file_path = fmt::format("{}/water/{}.wtr", PathManager::Instance()->GetMapsPath(), zone_name);
|
||||||
LogDebug("Attempting to load water map with path [{}]", file_path.c_str());
|
LogDebug("Attempting to load water map with path [{}]", file_path.c_str());
|
||||||
FILE *f = fopen(file_path.c_str(), "rb");
|
FILE *f = fopen(file_path.c_str(), "rb");
|
||||||
if(f) {
|
if(f) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user