mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-05 08:23:52 +00:00
PathManager refactor, fixes "CheckinHandle"
This commit is contained in:
parent
e0cb925231
commit
f3c5ad1aea
@ -117,7 +117,7 @@ ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile quests --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@cd build/bin && git clone https://gitlab.com/TheGrandLibrary/projecteq/projecteqquests.git quests
|
||||
@cd build/bin && git clone https://github.com/ProjectEQ/projecteqquests.git quests
|
||||
|
||||
# Runs tests
|
||||
.PHONY: test
|
||||
@ -207,7 +207,7 @@ inject-mariadb:
|
||||
-sudo mariadb -e "CREATE USER IF NOT EXISTS 'peq'@'127.0.0.1' IDENTIFIED BY 'peqpass';"
|
||||
-sudo mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'peq'@'127.0.0.1';"
|
||||
ifeq (,$(wildcard .devcontainer/base/db/db.sql.zip))
|
||||
@echo ".devcontainer/base/db.sql.zip not found. Downloading latest database from https://db.eqemu.dev/latest ..."
|
||||
@echo ".devcontainer/base/db.sql.zip not found. Downloading latest database from https://db.eqemu.dev/"
|
||||
wget -nc https://db.eqemu.dev/latest -O .devcontainer/base/db/db.sql.zip
|
||||
-cd .devcontainer/base/db && unzip db.sql.zip
|
||||
endif
|
||||
|
||||
@ -6,14 +6,9 @@
|
||||
"dockerfile": "Dockerfile.debian.dev"
|
||||
},
|
||||
"appPort": [
|
||||
"5998:5998/udp",
|
||||
"7000:7000/udp",
|
||||
"7001:7001/udp",
|
||||
"7002:7002/udp",
|
||||
"7003:7003/udp",
|
||||
"7004:7004/udp",
|
||||
"7005:7005/udp",
|
||||
"9000:9000/udp",
|
||||
"5998-5999:5998-5999/udp", // loginserver
|
||||
"7000-7374:7000-7374/udp", //zone
|
||||
"9000:9000/udp", // world
|
||||
"9001:9001/udp"
|
||||
],
|
||||
"forwardPorts": [
|
||||
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -114,7 +114,10 @@
|
||||
"charconv": "cpp",
|
||||
"format": "cpp",
|
||||
"ranges": "cpp",
|
||||
"span": "cpp"
|
||||
"span": "cpp",
|
||||
"shared_mutex": "cpp",
|
||||
"stdfloat": "cpp",
|
||||
"text_encoding": "cpp"
|
||||
},
|
||||
"cmake.statusbar.advanced": {
|
||||
"kit": {
|
||||
|
||||
@ -38,6 +38,13 @@
|
||||
#include "../../common/skill_caps.h"
|
||||
#include "../../common/evolving_items.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
ZoneStore zone_store;
|
||||
PathManager path;
|
||||
PlayerEventLogs player_event_logs;
|
||||
EvolvingItemsManager evolving_items_manager;
|
||||
|
||||
void ExportSpells(SharedDatabase *db);
|
||||
void ExportSkillCaps(SharedDatabase *db);
|
||||
void ExportBaseData(SharedDatabase *db);
|
||||
@ -49,7 +56,7 @@ int main(int argc, char **argv)
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
LogInfo("Client Files Export Utility");
|
||||
if (!EQEmuConfig::LoadConfig()) {
|
||||
@ -93,7 +100,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings()
|
||||
->StartFileLogs();
|
||||
|
||||
@ -129,7 +136,7 @@ int main(int argc, char **argv)
|
||||
|
||||
void ExportSpells(SharedDatabase* db)
|
||||
{
|
||||
std::ofstream file(fmt::format("{}/export/spells_us.txt", PathManager::Instance()->GetServerPath()));
|
||||
std::ofstream file(fmt::format("{}/export/spells_us.txt", path.GetServerPath()));
|
||||
if (!file || !file.is_open()) {
|
||||
LogError("Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
@ -148,7 +155,7 @@ void ExportSpells(SharedDatabase* db)
|
||||
|
||||
void ExportSkillCaps(SharedDatabase* db)
|
||||
{
|
||||
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", PathManager::Instance()->GetServerPath()));
|
||||
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", path.GetServerPath()));
|
||||
if (!file || !file.is_open()) {
|
||||
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
@ -167,7 +174,7 @@ void ExportSkillCaps(SharedDatabase* db)
|
||||
|
||||
void ExportBaseData(SharedDatabase *db)
|
||||
{
|
||||
std::ofstream file(fmt::format("{}/export/BaseData.txt", PathManager::Instance()->GetServerPath()));
|
||||
std::ofstream file(fmt::format("{}/export/BaseData.txt", path.GetServerPath()));
|
||||
if (!file || !file.is_open()) {
|
||||
LogError("Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
@ -186,7 +193,7 @@ void ExportBaseData(SharedDatabase *db)
|
||||
|
||||
void ExportDBStrings(SharedDatabase *db)
|
||||
{
|
||||
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", PathManager::Instance()->GetServerPath()));
|
||||
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", path.GetServerPath()));
|
||||
if (!file || !file.is_open()) {
|
||||
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
|
||||
return;
|
||||
|
||||
@ -32,6 +32,13 @@
|
||||
#include "../../common/events/player_event_logs.h"
|
||||
#include "../../common/evolving_items.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
ZoneStore zone_store;
|
||||
PathManager path;
|
||||
PlayerEventLogs player_event_logs;
|
||||
EvolvingItemsManager evolving_items_manager;
|
||||
|
||||
void ImportSpells(SharedDatabase *db);
|
||||
void ImportSkillCaps(SharedDatabase *db);
|
||||
void ImportBaseData(SharedDatabase *db);
|
||||
@ -42,7 +49,7 @@ int main(int argc, char **argv) {
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
LogInfo("Client Files Import Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
@ -86,7 +93,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings()
|
||||
->StartFileLogs();
|
||||
|
||||
@ -131,7 +138,7 @@ bool IsStringField(int i) {
|
||||
|
||||
void ImportSpells(SharedDatabase *db) {
|
||||
LogInfo("Importing Spells");
|
||||
std::string file = fmt::format("{}/import/spells_us.txt", PathManager::Instance()->GetServerPath());
|
||||
std::string file = fmt::format("{}/import/spells_us.txt", path.GetServerPath());
|
||||
FILE *f = fopen(file.c_str(), "r");
|
||||
if(!f) {
|
||||
LogError("Unable to open {} to read, skipping.", file);
|
||||
@ -221,7 +228,7 @@ void ImportSpells(SharedDatabase *db) {
|
||||
void ImportSkillCaps(SharedDatabase *db) {
|
||||
LogInfo("Importing Skill Caps");
|
||||
|
||||
std::string file = fmt::format("{}/import/SkillCaps.txt", PathManager::Instance()->GetServerPath());
|
||||
std::string file = fmt::format("{}/import/SkillCaps.txt", path.GetServerPath());
|
||||
FILE *f = fopen(file.c_str(), "r");
|
||||
if(!f) {
|
||||
LogError("Unable to open {} to read, skipping.", file);
|
||||
@ -258,7 +265,7 @@ void ImportBaseData(SharedDatabase *db)
|
||||
{
|
||||
LogInfo("Importing Base Data");
|
||||
|
||||
const std::string& file_name = fmt::format("{}/import/BaseData.txt", PathManager::Instance()->GetServerPath());
|
||||
const std::string& file_name = fmt::format("{}/import/BaseData.txt", path.GetServerPath());
|
||||
|
||||
const auto& file_contents = File::GetContents(file_name);
|
||||
if (!file_contents.error.empty()) {
|
||||
@ -298,7 +305,7 @@ void ImportBaseData(SharedDatabase *db)
|
||||
void ImportDBStrings(SharedDatabase *db) {
|
||||
LogInfo("Importing DB Strings");
|
||||
|
||||
std::string file = fmt::format("{}/import/dbstr_us.txt", PathManager::Instance()->GetServerPath());
|
||||
std::string file = fmt::format("{}/import/dbstr_us.txt", path.GetServerPath());
|
||||
FILE *f = fopen(file.c_str(), "r");
|
||||
if(!f) {
|
||||
LogError("Unable to open {} to read, skipping.", file);
|
||||
|
||||
@ -177,21 +177,6 @@ void EQEmuConfig::parse_config()
|
||||
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||
|
||||
auto load_paths = [&](const std::string& key, std::vector<std::string>& target) {
|
||||
const auto& paths = _root["server"]["directories"][key];
|
||||
if (paths.isArray()) {
|
||||
for (const auto& dir : paths) {
|
||||
if (dir.isString()) {
|
||||
target.push_back(dir.asString());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
load_paths("quest_paths", m_quest_directories);
|
||||
load_paths("plugin_paths", m_plugin_directories);
|
||||
load_paths("lua_module_paths", m_lua_module_directories);
|
||||
|
||||
/**
|
||||
* Logs
|
||||
*/
|
||||
@ -436,11 +421,11 @@ void EQEmuConfig::CheckUcsConfigConversion()
|
||||
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
||||
|
||||
std::string config_file_path = std::filesystem::path{
|
||||
PathManager::Instance()->GetServerPath() + "/eqemu_config.json"
|
||||
path.GetServerPath() + "/eqemu_config.json"
|
||||
}.string();
|
||||
|
||||
std::string config_file_bak_path = std::filesystem::path{
|
||||
PathManager::Instance()->GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||
path.GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||
}.string();
|
||||
|
||||
// copy eqemu_config.json to eqemu_config.json.bak
|
||||
@ -504,4 +489,4 @@ void EQEmuConfig::CheckUcsConfigConversion()
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,22 +120,6 @@ class EQEmuConfig
|
||||
const std::string &GetUCSHost() const;
|
||||
uint16 GetUCSPort() const;
|
||||
|
||||
std::vector<std::string> GetQuestDirectories() const
|
||||
{
|
||||
return m_quest_directories;
|
||||
}
|
||||
|
||||
std::vector<std::string> GetPluginsDirectories() const
|
||||
{
|
||||
return m_plugin_directories;
|
||||
}
|
||||
|
||||
std::vector<std::string> GetLuaModuleDirectories() const
|
||||
{
|
||||
return m_lua_module_directories;
|
||||
}
|
||||
|
||||
|
||||
// uint16 DynamicCount;
|
||||
|
||||
// map<string,uint16> StaticZones;
|
||||
@ -149,11 +133,6 @@ class EQEmuConfig
|
||||
Json::Value _root;
|
||||
static std::string ConfigFile;
|
||||
|
||||
std::vector<std::string> m_quest_directories = {};
|
||||
std::vector<std::string> m_plugin_directories = {};
|
||||
std::vector<std::string> m_lua_module_directories = {};
|
||||
|
||||
protected:
|
||||
void parse_config();
|
||||
|
||||
EQEmuConfig()
|
||||
@ -191,7 +170,7 @@ class EQEmuConfig
|
||||
|
||||
std::string file = fmt::format(
|
||||
"{}/{}",
|
||||
(file_path.empty() ? PathManager::Instance()->GetServerPath() : file_path),
|
||||
(file_path.empty() ? path.GetServerPath() : file_path),
|
||||
EQEmuConfig::ConfigFile
|
||||
);
|
||||
|
||||
@ -211,4 +190,4 @@ class EQEmuConfig
|
||||
void CheckUcsConfigConversion();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -537,9 +537,9 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
||||
{
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
|
||||
if (!File::Exists(PathManager::Instance()->GetLogPath())) {
|
||||
LogInfo("Logs directory not found, creating [{}]", PathManager::Instance()->GetLogPath());
|
||||
File::Makedir(PathManager::Instance()->GetLogPath());
|
||||
if (!File::Exists(path.GetLogPath())) {
|
||||
LogInfo("Logs directory not found, creating [{}]", path.GetLogPath());
|
||||
File::Makedir(path.GetLogPath());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -656,7 +656,7 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
||||
// If we go through this whole loop and nothing is set to any debug level, there
|
||||
// is no point to create a file or keep anything open
|
||||
if (log_settings[c.log_category_id].log_to_file > 0) {
|
||||
m_file_logs_enabled = true;
|
||||
EQEmuLogSys::Instance()->m_file_logs_enabled = true;
|
||||
}
|
||||
|
||||
db_categories.emplace_back(c.log_category_id);
|
||||
@ -682,33 +682,14 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
||||
if (is_missing_in_database && !is_deprecated_category) {
|
||||
LogInfo("Automatically adding new log category [{}] ({})", Logs::LogCategoryName[i], i);
|
||||
|
||||
auto e = LogsysCategoriesRepository::NewEntity();
|
||||
e.log_category_id = i;
|
||||
e.log_category_description = Strings::Escape(Logs::LogCategoryName[i]);
|
||||
e.log_to_console = log_settings[i].log_to_console;
|
||||
e.log_to_gmsay = log_settings[i].log_to_gmsay;
|
||||
e.log_to_file = log_settings[i].log_to_file;
|
||||
e.log_to_discord = log_settings[i].log_to_discord;
|
||||
db_categories_to_add.emplace_back(e);
|
||||
}
|
||||
|
||||
// look to see if the category name is different in the database
|
||||
auto it = std::find_if(
|
||||
categories.begin(),
|
||||
categories.end(),
|
||||
[i](const auto &c) { return c.log_category_id == i; }
|
||||
);
|
||||
if (it != categories.end()) {
|
||||
if (it->log_category_description != Logs::LogCategoryName[i]) {
|
||||
LogInfo(
|
||||
"Updating log category [{}] ({}) to new name [{}]",
|
||||
it->log_category_description,
|
||||
i,
|
||||
Logs::LogCategoryName[i]
|
||||
);
|
||||
it->log_category_description = Logs::LogCategoryName[i];
|
||||
LogsysCategoriesRepository::ReplaceOne(*m_database, *it);
|
||||
}
|
||||
auto new_category = LogsysCategoriesRepository::NewEntity();
|
||||
new_category.log_category_id = i;
|
||||
new_category.log_category_description = Strings::Escape(Logs::LogCategoryName[i]);
|
||||
new_category.log_to_console = log_settings[i].log_to_console;
|
||||
new_category.log_to_gmsay = log_settings[i].log_to_gmsay;
|
||||
new_category.log_to_file = log_settings[i].log_to_file;
|
||||
new_category.log_to_discord = log_settings[i].log_to_discord;
|
||||
db_categories_to_add.emplace_back(new_category);
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,4 +839,4 @@ void EQEmuLogSys::EnableMySQLErrorLogs()
|
||||
log_settings[Logs::MySQLError].log_to_file = 1;
|
||||
log_settings[Logs::MySQLError].log_to_console = 1;
|
||||
log_settings[Logs::MySQLError].log_to_gmsay = 1;
|
||||
}
|
||||
}
|
||||
@ -55,7 +55,7 @@ namespace EQ {
|
||||
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
||||
}
|
||||
#else
|
||||
std::string final_name = fmt::format("{}/{}.lock", PathManager::Instance()->GetSharedMemoryPath(), name);
|
||||
std::string final_name = fmt::format("{}/{}.lock", path.GetSharedMemoryPath(), name);
|
||||
|
||||
#ifdef __DARWIN
|
||||
#if __DARWIN_C_LEVEL < 200809L
|
||||
|
||||
@ -78,7 +78,7 @@ namespace RoF
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
|
||||
//load up the opcode manager.
|
||||
//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.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@ -81,7 +81,7 @@ namespace RoF2
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
|
||||
//load up the opcode manager.
|
||||
//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.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
@ -180,7 +180,7 @@ namespace RoF2
|
||||
}
|
||||
|
||||
eq->class_entry_count = emu->class_entry_count;
|
||||
for (uint32 i = 0; i < emu->class_entry_count; ++i) // 15
|
||||
for (uint32 i = 0; i < emu->class_entry_count; ++i) // 16
|
||||
{
|
||||
OUT(membership_classes[i].purchase_id);
|
||||
OUT(membership_classes[i].bitwise_entry);
|
||||
|
||||
@ -72,7 +72,7 @@ namespace SoD
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@ -113,7 +113,7 @@ namespace SoD
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@ -71,7 +71,7 @@ namespace SoF
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@ -110,7 +110,7 @@ namespace SoF
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@ -73,7 +73,7 @@ namespace Titanium
|
||||
auto Config = EQEmuConfig::get();
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@ -114,7 +114,7 @@ namespace Titanium
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@ -76,7 +76,7 @@ namespace UF
|
||||
{
|
||||
//create our opcode manager if we havent already
|
||||
if (opcodes == nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
//load up the opcode manager.
|
||||
//TODO: figure out how to support shared memory with multiple patches...
|
||||
opcodes = new RegularOpcodeManager();
|
||||
@ -117,7 +117,7 @@ namespace UF
|
||||
//we need to go to every stream and replace it's manager.
|
||||
|
||||
if (opcodes != nullptr) {
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", PathManager::Instance()->GetPatchPath(), name);
|
||||
std::string opfile = fmt::format("{}/patch_{}.conf", path.GetPatchPath(), name);
|
||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||
LogNetcode("[OPCODES] Error reloading opcodes file [{}] for patch [{}]", opfile.c_str(), name);
|
||||
return;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
void PathManager::Init()
|
||||
void PathManager::LoadPaths()
|
||||
{
|
||||
m_server_path = File::FindEqemuConfigPath();
|
||||
|
||||
@ -48,23 +48,10 @@ void PathManager::Init()
|
||||
return dir;
|
||||
};
|
||||
|
||||
auto load_many_paths_fallback = [&](const std::vector<std::string>& dirs, const std::string& fallback, std::vector<std::string>& target) {
|
||||
target.clear();
|
||||
if (!dirs.empty()) {
|
||||
for (const auto& path : dirs) {
|
||||
target.push_back(resolve_path(path));
|
||||
}
|
||||
} else {
|
||||
target.push_back(resolve_path(fallback));
|
||||
}
|
||||
};
|
||||
|
||||
load_many_paths_fallback(c->GetQuestDirectories(), c->QuestDir, m_quests_paths);
|
||||
load_many_paths_fallback(c->GetPluginsDirectories(), c->PluginDir, m_plugin_paths);
|
||||
load_many_paths_fallback(c->GetLuaModuleDirectories(), c->LuaModuleDir, m_lua_module_paths);
|
||||
|
||||
// resolve all paths
|
||||
m_maps_path = resolve_path(c->MapDir, {"maps", "Maps"});
|
||||
m_quests_path = resolve_path(c->QuestDir);
|
||||
m_plugins_path = resolve_path(c->PluginDir);
|
||||
m_lua_modules_path = resolve_path(c->LuaModuleDir);
|
||||
m_lua_mods_path = resolve_path("mods");
|
||||
m_patch_path = resolve_path(c->PatchDir);
|
||||
m_opcode_path = resolve_path(c->OpcodeDir);
|
||||
@ -75,10 +62,13 @@ void PathManager::Init()
|
||||
std::vector<std::pair<std::string, std::string>> paths = {
|
||||
{"server", m_server_path},
|
||||
{"logs", m_log_path},
|
||||
{"maps", m_maps_path},
|
||||
{"lua mods", m_lua_mods_path},
|
||||
{"lua_modules", m_lua_modules_path},
|
||||
{"maps", m_maps_path},
|
||||
{"patches", m_patch_path},
|
||||
{"opcode", m_opcode_path},
|
||||
{"plugins", m_plugins_path},
|
||||
{"quests", m_quests_path},
|
||||
{"shared_memory", m_shared_memory_path}
|
||||
};
|
||||
|
||||
@ -93,17 +83,6 @@ void PathManager::Init()
|
||||
LogInfo("{:>{}} > [{:<{}}]", name, name_width, in_path, path_width);
|
||||
}
|
||||
}
|
||||
|
||||
auto log_paths = [&](const std::string& label, const std::vector<std::string>& paths) {
|
||||
if (!paths.empty()) {
|
||||
LogInfo("{:>{}} > [{:<{}}]", label, name_width - 1, Strings::Join(paths, ";"), path_width);
|
||||
}
|
||||
};
|
||||
|
||||
log_paths("quests", m_quests_paths);
|
||||
log_paths("plugins", m_plugin_paths);
|
||||
log_paths("lua_modules", m_lua_module_paths);
|
||||
|
||||
LogInfo("{}", Strings::Repeat("-", break_length));
|
||||
}
|
||||
|
||||
@ -117,26 +96,21 @@ const std::string &PathManager::GetMapsPath() const
|
||||
return m_maps_path;
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetQuestsPath() const
|
||||
{
|
||||
return m_quests_path;
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetPluginsPath() const
|
||||
{
|
||||
return m_plugins_path;
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetSharedMemoryPath() const
|
||||
{
|
||||
return m_shared_memory_path;
|
||||
}
|
||||
|
||||
std::vector<std::string> PathManager::GetQuestPaths() const
|
||||
{
|
||||
return m_quests_paths;
|
||||
}
|
||||
|
||||
std::vector<std::string> PathManager::GetPluginPaths() const
|
||||
{
|
||||
return m_plugin_paths;
|
||||
}
|
||||
|
||||
std::vector<std::string> PathManager::GetLuaModulePaths() const
|
||||
{
|
||||
return m_lua_module_paths;
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetLogPath() const
|
||||
{
|
||||
return m_log_path;
|
||||
@ -152,7 +126,12 @@ const std::string &PathManager::GetOpcodePath() const
|
||||
return m_opcode_path;
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetLuaModulesPath() const
|
||||
{
|
||||
return m_lua_modules_path;
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetLuaModsPath() const
|
||||
{
|
||||
return m_lua_mods_path;
|
||||
}
|
||||
}
|
||||
@ -3,17 +3,10 @@
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class PathManager {
|
||||
public:
|
||||
void Init();
|
||||
|
||||
static PathManager *Instance()
|
||||
{
|
||||
static PathManager instance;
|
||||
return &instance;
|
||||
}
|
||||
void LoadPaths();
|
||||
|
||||
[[nodiscard]] const std::string &GetLogPath() const;
|
||||
[[nodiscard]] const std::string &GetLuaModsPath() const;
|
||||
@ -21,27 +14,24 @@ public:
|
||||
[[nodiscard]] const std::string &GetMapsPath() const;
|
||||
[[nodiscard]] const std::string &GetPatchPath() const;
|
||||
[[nodiscard]] const std::string &GetOpcodePath() const;
|
||||
[[nodiscard]] const std::string &GetPluginsPath() const;
|
||||
[[nodiscard]] const std::string &GetQuestsPath() const;
|
||||
[[nodiscard]] const std::string &GetServerPath() const;
|
||||
[[nodiscard]] const std::string &GetSharedMemoryPath() const;
|
||||
[[nodiscard]] std::vector<std::string> GetQuestPaths() const;
|
||||
[[nodiscard]] std::vector<std::string> GetPluginPaths() const;
|
||||
[[nodiscard]] std::vector<std::string> GetLuaModulePaths() const;
|
||||
|
||||
private:
|
||||
std::string m_log_path;
|
||||
std::string m_lua_mods_path;
|
||||
std::string m_maps_path;
|
||||
std::string m_patch_path;
|
||||
std::string m_opcode_path;
|
||||
std::string m_quests_path;
|
||||
std::vector<std::string> m_quests_paths;
|
||||
std::vector<std::string> m_plugin_paths;
|
||||
std::vector<std::string> m_lua_module_paths;
|
||||
|
||||
|
||||
private:
|
||||
std::string m_server_path;
|
||||
std::string m_shared_memory_path;
|
||||
std::string m_log_path;
|
||||
std::string m_lua_mods_path;
|
||||
std::string m_lua_modules_path;
|
||||
std::string m_maps_path;
|
||||
std::string m_patch_path;
|
||||
std::string m_opcode_path;
|
||||
std::string m_plugins_path;
|
||||
std::string m_quests_path;
|
||||
std::string m_server_path;
|
||||
std::string m_shared_memory_path;
|
||||
};
|
||||
|
||||
#endif //EQEMU_PATH_MANAGER_H
|
||||
extern PathManager path;
|
||||
|
||||
#endif //EQEMU_PATH_MANAGER_H
|
||||
@ -916,7 +916,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
const auto Config = EQEmuConfig::get();
|
||||
EQ::IPCMutex mutex("items");
|
||||
mutex.Lock();
|
||||
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("items"));
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("items"));
|
||||
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());
|
||||
mutex.Unlock();
|
||||
@ -1650,7 +1650,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
||||
EQ::IPCMutex mutex("spells");
|
||||
mutex.Lock();
|
||||
|
||||
std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("spells"));
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("spells"));
|
||||
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
LogInfo("Loading [{}]", file_name);
|
||||
*records = *static_cast<uint32*>(spells_mmf->Get());
|
||||
@ -1757,8 +1757,22 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].environment_type=Strings::ToInt(row[102]);
|
||||
sp[tempid].time_of_day=Strings::ToInt(row[103]);
|
||||
|
||||
for(y=0; y < Class::PLAYER_CLASS_COUNT;y++)
|
||||
sp[tempid].classes[y]=Strings::ToInt(row[104+y]);
|
||||
sp[tempid].classes[1] = Strings::ToInt(row[104]);
|
||||
sp[tempid].classes[2] = Strings::ToInt(row[105]);
|
||||
sp[tempid].classes[3] = Strings::ToInt(row[106]);
|
||||
sp[tempid].classes[4] = Strings::ToInt(row[107]);
|
||||
sp[tempid].classes[5] = Strings::ToInt(row[108]);
|
||||
sp[tempid].classes[6] = Strings::ToInt(row[109]);
|
||||
sp[tempid].classes[7] = Strings::ToInt(row[110]);
|
||||
sp[tempid].classes[8] = Strings::ToInt(row[111]);
|
||||
sp[tempid].classes[9] = Strings::ToInt(row[112]);
|
||||
sp[tempid].classes[10] = Strings::ToInt(row[113]);
|
||||
sp[tempid].classes[11] = Strings::ToInt(row[114]);
|
||||
sp[tempid].classes[12] = Strings::ToInt(row[115]);
|
||||
sp[tempid].classes[13] = Strings::ToInt(row[116]);
|
||||
sp[tempid].classes[14] = Strings::ToInt(row[117]);
|
||||
sp[tempid].classes[15] = Strings::ToInt(row[118]);
|
||||
sp[tempid].classes[16] = Strings::ToInt(row[119]);
|
||||
|
||||
sp[tempid].casting_animation=Strings::ToInt(row[120]);
|
||||
sp[tempid].spell_affect_index=Strings::ToInt(row[123]);
|
||||
@ -1838,6 +1852,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].min_range = Strings::ToFloat(row[231]);
|
||||
sp[tempid].no_remove = Strings::ToBool(row[232]);
|
||||
sp[tempid].damage_shield_type = 0;
|
||||
sp[tempid].class17 = Strings::ToInt(row[237]);
|
||||
}
|
||||
|
||||
LoadDamageShieldTypes(sp);
|
||||
|
||||
@ -33,6 +33,9 @@
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
PathManager path;
|
||||
|
||||
bool RunLoops = false;
|
||||
|
||||
void CatchSignal(int sig_num);
|
||||
@ -42,7 +45,7 @@ int main(int argc, char *argv[]) {
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
std::string launcher_name;
|
||||
if(argc == 2) {
|
||||
|
||||
@ -8,6 +8,8 @@ extern bool run_server;
|
||||
#include "../common/path_manager.h"
|
||||
#include "../common/file.h"
|
||||
|
||||
PathManager path;
|
||||
|
||||
void CheckTitaniumOpcodeFile(const std::string &path)
|
||||
{
|
||||
if (File::Exists(path)) {
|
||||
@ -94,7 +96,7 @@ ClientManager::ClientManager()
|
||||
|
||||
std::string opcodes_path = fmt::format(
|
||||
"{}/{}",
|
||||
PathManager::Instance()->GetOpcodePath(),
|
||||
path.GetOpcodePath(),
|
||||
"login_opcodes.conf"
|
||||
);
|
||||
|
||||
@ -131,7 +133,7 @@ ClientManager::ClientManager()
|
||||
|
||||
opcodes_path = fmt::format(
|
||||
"{}/{}",
|
||||
PathManager::Instance()->GetOpcodePath(),
|
||||
path.GetOpcodePath(),
|
||||
"login_opcodes_sod.conf"
|
||||
);
|
||||
|
||||
@ -169,7 +171,7 @@ ClientManager::ClientManager()
|
||||
|
||||
opcodes_path = fmt::format(
|
||||
"{}/{}",
|
||||
PathManager::Instance()->GetOpcodePath(),
|
||||
path.GetOpcodePath(),
|
||||
"login_opcodes_larion.conf"
|
||||
);
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ void LoadDatabaseConnection()
|
||||
void LoadServerConfig()
|
||||
{
|
||||
server.config = EQ::JsonConfigFile::Load(
|
||||
fmt::format("{}/login.json", PathManager::Instance()->GetServerPath())
|
||||
fmt::format("{}/login.json", path.GetServerPath())
|
||||
);
|
||||
LogInfo("Config System Init");
|
||||
|
||||
@ -158,7 +158,7 @@ int main(int argc, char **argv)
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
}
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
// command handler
|
||||
if (argc > 1) {
|
||||
|
||||
@ -20,15 +20,23 @@
|
||||
#include "../common/net/console_server.h"
|
||||
#include "../queryserv/zonelist.h"
|
||||
#include "../queryserv/zoneserver.h"
|
||||
#include "../common/discord/discord_manager.h"
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
|
||||
QSDatabase qs_database;
|
||||
Database database;
|
||||
LFGuildManager lfguildmanager;
|
||||
std::string WorldShortName;
|
||||
const queryservconfig *Config;
|
||||
WorldServer *worldserver = 0;
|
||||
EQEmuLogSys LogSys;
|
||||
PathManager path;
|
||||
ZoneStore zone_store;
|
||||
PlayerEventLogs player_event_logs;
|
||||
ZSList zs_list;
|
||||
uint32 numzones = 0;
|
||||
DiscordManager discord_manager;
|
||||
|
||||
void CatchSignal(int sig_num)
|
||||
{
|
||||
@ -42,7 +50,7 @@ int main()
|
||||
set_exception_handler();
|
||||
Timer LFGuildExpireTimer(60000);
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
LogInfo("Starting EQEmu QueryServ");
|
||||
if (!queryservconfig::LoadConfig()) {
|
||||
@ -78,7 +86,7 @@ int main()
|
||||
}
|
||||
|
||||
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings()
|
||||
->StartFileLogs();
|
||||
|
||||
|
||||
@ -35,6 +35,13 @@
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/evolving_items.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
ZoneStore zone_store;
|
||||
PathManager path;
|
||||
PlayerEventLogs player_event_logs;
|
||||
EvolvingItemsManager evolving_items_manager;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <direct.h>
|
||||
#else
|
||||
@ -77,7 +84,7 @@ int main(int argc, char **argv)
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
LogInfo("Shared Memory Loader Program");
|
||||
if (!EQEmuConfig::LoadConfig()) {
|
||||
@ -120,7 +127,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings()
|
||||
->StartFileLogs();
|
||||
|
||||
|
||||
@ -34,12 +34,14 @@
|
||||
#include "task_state_test.h"
|
||||
|
||||
const EQEmuConfig *Config;
|
||||
EQEmuLogSys LogSys;
|
||||
PathManager path;
|
||||
|
||||
int main()
|
||||
{
|
||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
||||
Config = EQEmuConfig::get();
|
||||
@ -63,4 +65,4 @@ int main()
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -42,6 +42,8 @@ extern Clientlist *g_Clientlist;
|
||||
extern uint32 ChatMessagesSent;
|
||||
extern uint32 MailMessagesSent;
|
||||
|
||||
PathManager path;
|
||||
|
||||
int LookupCommand(const char *ChatCommand) {
|
||||
|
||||
if (!ChatCommand) return -1;
|
||||
@ -482,7 +484,7 @@ Clientlist::Clientlist(int ChatPort) {
|
||||
const ucsconfig *Config = ucsconfig::get();
|
||||
|
||||
|
||||
std::string opcodes_file = fmt::format("{}/{}", PathManager::Instance()->GetServerPath(), Config->MailOpCodesFile);
|
||||
std::string opcodes_file = fmt::format("{}/{}", path.GetServerPath(), Config->MailOpCodesFile);
|
||||
|
||||
LogInfo("Loading [{}]", opcodes_file);
|
||||
if (!ChatOpMgr->LoadOpcodes(opcodes_file.c_str()))
|
||||
|
||||
@ -102,7 +102,7 @@ int main() {
|
||||
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
// Check every minute for unused channels we can delete
|
||||
//
|
||||
@ -136,7 +136,7 @@ int main() {
|
||||
|
||||
EQEmuLogSys::Instance()
|
||||
->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings()
|
||||
->StartFileLogs();
|
||||
|
||||
|
||||
@ -91,12 +91,29 @@
|
||||
#include "../common/repositories/character_parcels_repository.h"
|
||||
#include "../common/ip_util.h"
|
||||
|
||||
SkillCaps skill_caps;
|
||||
ZoneStore zone_store;
|
||||
ClientList client_list;
|
||||
GroupLFPList LFPGroupList;
|
||||
ZSList zoneserver_list;
|
||||
LoginServerList loginserverlist;
|
||||
UCSConnection UCSLink;
|
||||
QueryServConnection QSLink;
|
||||
LauncherList launcher_list;
|
||||
AdventureManager adventure_manager;
|
||||
WorldEventScheduler event_scheduler;
|
||||
SharedTaskManager shared_task_manager;
|
||||
EQ::Random emu_random;
|
||||
volatile bool RunLoops = true;
|
||||
uint32 numclients = 0;
|
||||
uint32 numzones = 0;
|
||||
const WorldConfig *Config;
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
WebInterfaceList web_interface;
|
||||
PathManager path;
|
||||
PlayerEventLogs player_event_logs;
|
||||
EvolvingItemsManager evolving_items_manager;
|
||||
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
@ -125,7 +142,7 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
if (!WorldBoot::LoadServerConfig()) {
|
||||
return 0;
|
||||
|
||||
@ -83,7 +83,7 @@ bool WorldBoot::HandleCommandInput(int argc, char **argv)
|
||||
// command handler
|
||||
if (argc > 1) {
|
||||
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
WorldConfig::LoadConfig();
|
||||
LoadDatabaseConnections();
|
||||
RuleManager::Instance()->LoadRules(&database, "default", false);
|
||||
@ -227,7 +227,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
{
|
||||
// logging system init
|
||||
auto logging = EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings();
|
||||
|
||||
EQEmuLogSys::Instance()->SetDiscordHandler(&WorldBoot::DiscordWebhookMessageHandler);
|
||||
|
||||
@ -137,28 +137,25 @@ void Embperl::DoInit()
|
||||
catch (std::string& e) {
|
||||
LogQuests("Warning [{}]: [{}]", Config->PluginPlFile, e);
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetPluginPaths()) {
|
||||
try {
|
||||
//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
|
||||
const std::string& perl_command = (
|
||||
"if(opendir(D,'" +
|
||||
dir +
|
||||
"')) { "
|
||||
" my @d = readdir(D);"
|
||||
" closedir(D);"
|
||||
" foreach(@d){ "
|
||||
" main::eval_file('plugin','" +
|
||||
dir +
|
||||
"/'.$_)if/\\.pl$/;"
|
||||
" }"
|
||||
"}");
|
||||
eval_pv(perl_command.c_str(), FALSE);
|
||||
}
|
||||
catch (std::string& e) {
|
||||
LogQuests("Warning [{}]", e);
|
||||
}
|
||||
try {
|
||||
//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
|
||||
const std::string& perl_command = (
|
||||
"if(opendir(D,'" +
|
||||
path.GetPluginsPath() +
|
||||
"')) { "
|
||||
" my @d = readdir(D);"
|
||||
" closedir(D);"
|
||||
" foreach(@d){ "
|
||||
" main::eval_file('plugin','" +
|
||||
path.GetPluginsPath() +
|
||||
"/'.$_)if/\\.pl$/;"
|
||||
" }"
|
||||
"}");
|
||||
eval_pv(perl_command.c_str(), FALSE);
|
||||
}
|
||||
catch (std::string& e) {
|
||||
LogQuests("Warning [{}]", e);
|
||||
}
|
||||
#endif //EMBPERL_PLUGIN
|
||||
}
|
||||
|
||||
@ -1127,7 +1127,7 @@ void LuaParser::ReloadQuests() {
|
||||
std::string module_path = lua_tostring(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
for (const auto& dir : PathManager::Instance()->GetLuaModulePaths()) {
|
||||
for (const auto& dir : path.GetLuaModulesPath()) {
|
||||
module_path += fmt::format(";{}/?.lua", dir);
|
||||
module_path += fmt::format(";{}/?/init.lua", dir);
|
||||
module_path += fmt::format(";{}/share/lua/{}/?.lua", dir, lua_version);
|
||||
@ -1143,7 +1143,7 @@ void LuaParser::ReloadQuests() {
|
||||
module_path = lua_tostring(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
for (const auto& dir : PathManager::Instance()->GetLuaModulePaths()) {
|
||||
for (const auto& dir : path.GetLuaModulesPath()) {
|
||||
module_path += fmt::format(";{}/?{}", dir, libext);
|
||||
module_path += fmt::format(";{}/lib/lua/{}/?{}", dir, lua_version, libext);
|
||||
}
|
||||
@ -1155,7 +1155,7 @@ void LuaParser::ReloadQuests() {
|
||||
MapFunctions(L);
|
||||
|
||||
// load init
|
||||
for (auto& dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto& dir : path.GetQuestsPath()) {
|
||||
std::string filename = fmt::format("{}/{}/script_init.lua", dir, QUEST_GLOBAL_DIRECTORY);
|
||||
|
||||
FILE* f = fopen(filename.c_str(), "r");
|
||||
@ -1171,7 +1171,7 @@ void LuaParser::ReloadQuests() {
|
||||
|
||||
//zone init - always loads after global
|
||||
if (zone) {
|
||||
for (auto& dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto& dir : path.GetQuestsPath()) {
|
||||
std::string zone_script = fmt::format(
|
||||
"{}/{}/script_init_v{}.lua",
|
||||
dir,
|
||||
@ -1204,7 +1204,7 @@ void LuaParser::ReloadQuests() {
|
||||
}
|
||||
}
|
||||
|
||||
FILE *load_order = fopen(fmt::format("{}/load_order.txt", PathManager::Instance()->GetLuaModsPath()).c_str(), "r");
|
||||
FILE *load_order = fopen(fmt::format("{}/load_order.txt", path.GetLuaModsPath()).c_str(), "r");
|
||||
if (load_order) {
|
||||
char file_name[256] = { 0 };
|
||||
while (fgets(file_name, 256, load_order) != nullptr) {
|
||||
@ -1216,7 +1216,7 @@ void LuaParser::ReloadQuests() {
|
||||
}
|
||||
}
|
||||
|
||||
LoadScript(fmt::format("{}/{}", PathManager::Instance()->GetLuaModsPath(), std::string(file_name)), file_name);
|
||||
LoadScript(fmt::format("{}/{}", path.GetLuaModsPath(), std::string(file_name)), file_name);
|
||||
mods_.emplace_back(L, this, file_name);
|
||||
}
|
||||
|
||||
|
||||
@ -88,10 +88,12 @@ extern volatile bool is_zone_loaded;
|
||||
#include "../common/path_manager.h"
|
||||
#include "../common/database/database_update.h"
|
||||
#include "../common/skill_caps.h"
|
||||
#include "zone_event_scheduler.h"
|
||||
#include "zone_cli.h"
|
||||
|
||||
EntityList entity_list;
|
||||
WorldServer worldserver;
|
||||
ZoneStore zone_store;
|
||||
uint32 numclients = 0;
|
||||
char errorname[32];
|
||||
extern Zone *zone;
|
||||
@ -99,8 +101,17 @@ extern Zone *zone;
|
||||
npcDecayTimes_Struct npcCorpseDecayTimes[100];
|
||||
TitleManager title_manager;
|
||||
QueryServ *QServ = 0;
|
||||
TaskManager *taskmanager = 0;
|
||||
NpcScaleManager *npc_scale_manager;
|
||||
QuestParserCollection *parse = 0;
|
||||
EQEmuLogSys LogSys;
|
||||
ZoneEventScheduler event_scheduler;
|
||||
WorldContentService content_service;
|
||||
PathManager path;
|
||||
PlayerEventLogs player_event_logs;
|
||||
DatabaseUpdate database_update;
|
||||
SkillCaps skill_caps;
|
||||
EvolvingItemsManager evolving_items_manager;
|
||||
|
||||
const SPDat_Spell_Struct* spells;
|
||||
int32 SPDAT_RECORDS = -1;
|
||||
@ -126,7 +137,7 @@ int main(int argc, char **argv)
|
||||
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||
}
|
||||
|
||||
PathManager::Instance()->Init();
|
||||
path.LoadPaths();
|
||||
|
||||
#ifdef USE_MAP_MMFS
|
||||
if (argc == 3 && strcasecmp(argv[1], "convert_map") == 0) {
|
||||
@ -293,8 +304,8 @@ int main(int argc, char **argv)
|
||||
ZoneCLI::CommandHandler(argc, argv);
|
||||
}
|
||||
|
||||
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||
LogSys.SetDatabase(&database)
|
||||
->SetLogPath(path.GetLogPath())
|
||||
->LoadLogDatabaseSettings(ZoneCLI::RanTestCommand(argc, argv))
|
||||
->SetGMSayHandler(&Zone::GMSayHookCallBackProcess)
|
||||
->StartFileLogs();
|
||||
@ -732,7 +743,7 @@ bool CheckForCompatibleQuestPlugins()
|
||||
{
|
||||
const std::vector<std::pair<std::string, bool *>> directories = {
|
||||
{"lua_modules", nullptr},
|
||||
{"plugins", nullptr}
|
||||
{"plugins", nullptr}
|
||||
};
|
||||
|
||||
bool lua_found = false;
|
||||
@ -740,7 +751,15 @@ bool CheckForCompatibleQuestPlugins()
|
||||
|
||||
try {
|
||||
for (const auto &[directory, flag]: directories) {
|
||||
std::string dir_path = PathManager::Instance()->GetServerPath() + "/" + directory;
|
||||
|
||||
auto dir_path = path.GetLuaModulesPath();
|
||||
if (directory == "plugins") {
|
||||
dir_path = path.GetPluginsPath();
|
||||
}
|
||||
if (dir_path == "") {
|
||||
dir_path = path.GetServerPath() + "/" + directory;
|
||||
}
|
||||
|
||||
if (!File::Exists(dir_path)) { continue; }
|
||||
|
||||
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) {
|
||||
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
||||
std::string filename = fmt::format("{}/base/{}.map", PathManager::Instance()->GetMapsPath(), file);
|
||||
std::string filename = fmt::format("{}/base/{}.map", path.GetMapsPath(), file);
|
||||
|
||||
LogInfo("Attempting to load Map File [{}]", filename.c_str());
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
IPathfinder *IPathfinder::Load(const std::string &zone) {
|
||||
struct stat statbuffer;
|
||||
std::string navmesh_path = fmt::format("{}/maps/nav/{}.nav", PathManager::Instance()->GetServerPath(), zone);
|
||||
std::string navmesh_path = fmt::format("{}/maps/nav/{}.nav", path.GetServerPath(), zone);
|
||||
if (stat(navmesh_path.c_str(), &statbuffer) == 0) {
|
||||
return new PathfinderNavmesh(navmesh_path);
|
||||
}
|
||||
|
||||
@ -1064,7 +1064,7 @@ QuestInterface* QuestParserCollection::GetQIByNPCQuest(uint32 npc_id, std::strin
|
||||
|
||||
Strings::FindReplace(npc_name, "`", "-");
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& npc_id_and_name = fmt::format(
|
||||
"{}_{}",
|
||||
npc_name,
|
||||
@ -1132,7 +1132,7 @@ QuestInterface* QuestParserCollection::GetQIByPlayerQuest(std::string& filename)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}",
|
||||
dir,
|
||||
@ -1187,7 +1187,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalNPCQuest(std::string& filena
|
||||
|
||||
std::string file_name;
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
for (auto* e: _load_precedence) {
|
||||
file_name = fmt::format(
|
||||
"{}/{}/global_npc.{}",
|
||||
@ -1213,7 +1213,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalPlayerQuest(std::string& fil
|
||||
}
|
||||
|
||||
std::string file_name;
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
for (auto* e: _load_precedence) {
|
||||
file_name = fmt::format(
|
||||
"{}/{}/global_player.{}",
|
||||
@ -1238,7 +1238,7 @@ QuestInterface* QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}/spells",
|
||||
dir,
|
||||
@ -1292,7 +1292,7 @@ QuestInterface* QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}/items",
|
||||
dir,
|
||||
@ -1346,7 +1346,7 @@ QuestInterface* QuestParserCollection::GetQIByEncounterQuest(std::string encount
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}/encounters",
|
||||
dir,
|
||||
@ -1398,7 +1398,7 @@ QuestInterface* QuestParserCollection::GetQIByBotQuest(std::string& filename)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}",
|
||||
dir,
|
||||
@ -1452,7 +1452,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalBotQuest(std::string& filena
|
||||
}
|
||||
|
||||
std::string file_name;
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
for (auto* e: _load_precedence) {
|
||||
file_name = fmt::format(
|
||||
"{}/{}/global_bot.{}",
|
||||
@ -1477,7 +1477,7 @@ QuestInterface* QuestParserCollection::GetQIByMercQuest(std::string& filename)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}",
|
||||
dir,
|
||||
@ -1531,7 +1531,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalMercQuest(std::string& filen
|
||||
}
|
||||
|
||||
std::string file_name;
|
||||
for (auto & dir : PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto & dir : path.GetQuestsPath()) {
|
||||
for (auto* e: _load_precedence) {
|
||||
file_name = fmt::format(
|
||||
"{}/{}/global_merc.{}",
|
||||
@ -1557,7 +1557,7 @@ QuestInterface* QuestParserCollection::GetQIByZoneQuest(std::string& filename)
|
||||
}
|
||||
|
||||
std::string file_name;
|
||||
for (auto& dir: PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto& dir: path.GetQuestsPath()) {
|
||||
const std::string& global_path = fmt::format(
|
||||
"{}/{}",
|
||||
dir,
|
||||
@ -1611,7 +1611,7 @@ QuestInterface* QuestParserCollection::GetQIByGlobalZoneQuest(std::string& filen
|
||||
|
||||
std::string file_name;
|
||||
|
||||
for (auto& dir: PathManager::Instance()->GetQuestPaths()) {
|
||||
for (auto& dir: path.GetQuestsPath()) {
|
||||
for (auto* e: _load_precedence) {
|
||||
file_name = fmt::format(
|
||||
"{}/{}/global_zone.{}",
|
||||
|
||||
@ -198,7 +198,7 @@ void QuestManager::summonitem(uint32 itemid, int16 charges) {
|
||||
|
||||
void QuestManager::write(const char *file, const char *str) {
|
||||
FILE * pFile;
|
||||
pFile = fopen (fmt::format("{}/{}", PathManager::Instance()->GetServerPath(), file).c_str(), "a");
|
||||
pFile = fopen (fmt::format("{}/{}", path.GetServerPath(), file).c_str(), "a");
|
||||
if(!pFile)
|
||||
return;
|
||||
fprintf(pFile, "%s\n", str);
|
||||
@ -1352,7 +1352,6 @@ void QuestManager::permaclass(int class_id) {
|
||||
|
||||
initiator->SetBaseClass(class_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick("Base class change by QuestManager");
|
||||
}
|
||||
|
||||
void QuestManager::permarace(int race_id) {
|
||||
@ -1364,7 +1363,6 @@ void QuestManager::permarace(int race_id) {
|
||||
|
||||
initiator->SetBaseRace(race_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick("Base race change by QuestManager");
|
||||
}
|
||||
|
||||
void QuestManager::permagender(int gender_id) {
|
||||
@ -1376,7 +1374,6 @@ void QuestManager::permagender(int gender_id) {
|
||||
|
||||
initiator->SetBaseGender(gender_id);
|
||||
initiator->Save(2);
|
||||
initiator->Kick("Base gender change by QuestManager");
|
||||
}
|
||||
|
||||
uint16 QuestManager::scribespells(uint8 max_level, uint8 min_level) {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
|
||||
std::transform(zone_name.begin(), zone_name.end(), zone_name.begin(), ::tolower);
|
||||
|
||||
std::string file_path = fmt::format("{}/water/{}.wtr", PathManager::Instance()->GetMapsPath(), zone_name);
|
||||
std::string file_path = fmt::format("{}/water/{}.wtr", path.GetMapsPath(), zone_name);
|
||||
LogDebug("Attempting to load water map with path [{}]", file_path.c_str());
|
||||
FILE *f = fopen(file_path.c_str(), "rb");
|
||||
if(f) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user