mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
Merge pull request #521 from 9thsector/ConfigFileUpdate
Config file update(take2)
This commit is contained in:
commit
b4ee5c8515
@ -27,6 +27,7 @@
|
|||||||
#include "../../common/rulesys.h"
|
#include "../../common/rulesys.h"
|
||||||
#include "../../common/string_util.h"
|
#include "../../common/string_util.h"
|
||||||
|
|
||||||
|
const EQEmuConfig *Config;
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
|
||||||
void ExportSpells(SharedDatabase *db);
|
void ExportSpells(SharedDatabase *db);
|
||||||
@ -45,12 +46,12 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EQEmuConfig *config = EQEmuConfig::get();
|
Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
"database connection");
|
"database connection");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "../../common/rulesys.h"
|
#include "../../common/rulesys.h"
|
||||||
#include "../../common/string_util.h"
|
#include "../../common/string_util.h"
|
||||||
|
|
||||||
|
const EQEmuConfig *Config;
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
|
||||||
void ImportSpells(SharedDatabase *db);
|
void ImportSpells(SharedDatabase *db);
|
||||||
@ -43,12 +44,12 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EQEmuConfig *config = EQEmuConfig::get();
|
Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
"database connection");
|
"database connection");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -254,6 +254,10 @@ void EQEmuConfig::do_files(TiXmlElement *ele)
|
|||||||
if (text) {
|
if (text) {
|
||||||
OpCodesFile = text;
|
OpCodesFile = text;
|
||||||
}
|
}
|
||||||
|
text = ParseTextBlock(ele, "plugin.pl", true);
|
||||||
|
if (text) {
|
||||||
|
PluginPlFile = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
||||||
@ -262,14 +266,45 @@ void EQEmuConfig::do_directories(TiXmlElement *ele)
|
|||||||
text = ParseTextBlock(ele, "maps", true);
|
text = ParseTextBlock(ele, "maps", true);
|
||||||
if (text) {
|
if (text) {
|
||||||
MapDir = text;
|
MapDir = text;
|
||||||
|
if ( MapDir.back() != '/' )
|
||||||
|
MapDir += '/';
|
||||||
}
|
}
|
||||||
text = ParseTextBlock(ele, "quests", true);
|
text = ParseTextBlock(ele, "quests", true);
|
||||||
if (text) {
|
if (text) {
|
||||||
QuestDir = text;
|
QuestDir = text;
|
||||||
|
if ( QuestDir.back() != '/' )
|
||||||
|
QuestDir += '/';
|
||||||
}
|
}
|
||||||
text = ParseTextBlock(ele, "plugins", true);
|
text = ParseTextBlock(ele, "plugins", true);
|
||||||
if (text) {
|
if (text) {
|
||||||
PluginDir = text;
|
PluginDir = text;
|
||||||
|
if ( PluginDir.back() != '/' )
|
||||||
|
PluginDir += '/';
|
||||||
|
}
|
||||||
|
text = ParseTextBlock(ele, "lua_modules", true);
|
||||||
|
if (text) {
|
||||||
|
LuaModuleDir = text;
|
||||||
|
if ( LuaModuleDir.back() != '/' )
|
||||||
|
LuaModuleDir += '/';
|
||||||
|
}
|
||||||
|
text = ParseTextBlock(ele, "patches", true);
|
||||||
|
if (text) {
|
||||||
|
PatchDir = text;
|
||||||
|
if ( PatchDir.back() != '/' )
|
||||||
|
PatchDir += '/';
|
||||||
|
}
|
||||||
|
text = ParseTextBlock(ele, "shared_memory", true);
|
||||||
|
if (text) {
|
||||||
|
SharedMemDir = text;
|
||||||
|
if ( SharedMemDir.back() != '/' )
|
||||||
|
SharedMemDir += '/';
|
||||||
|
}
|
||||||
|
//Not Fully Implemented yet LogDir
|
||||||
|
text = ParseTextBlock(ele, "logs", true);
|
||||||
|
if (text) {
|
||||||
|
LogDir = text;
|
||||||
|
if ( LogDir.back() != '/' )
|
||||||
|
LogDir += '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,6 +439,9 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
|||||||
if (var_name == "OpCodesFile") {
|
if (var_name == "OpCodesFile") {
|
||||||
return (OpCodesFile);
|
return (OpCodesFile);
|
||||||
}
|
}
|
||||||
|
if (var_name == "PluginPlFile") {
|
||||||
|
return (PluginPlFile);
|
||||||
|
}
|
||||||
if (var_name == "MapDir") {
|
if (var_name == "MapDir") {
|
||||||
return (MapDir);
|
return (MapDir);
|
||||||
}
|
}
|
||||||
@ -413,6 +451,18 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
|||||||
if (var_name == "PluginDir") {
|
if (var_name == "PluginDir") {
|
||||||
return (PluginDir);
|
return (PluginDir);
|
||||||
}
|
}
|
||||||
|
if (var_name == "LuaModuleDir") {
|
||||||
|
return (LuaModuleDir);
|
||||||
|
}
|
||||||
|
if (var_name == "PatchDir") {
|
||||||
|
return (PatchDir);
|
||||||
|
}
|
||||||
|
if (var_name == "SharedMemDir") {
|
||||||
|
return (SharedMemDir);
|
||||||
|
}
|
||||||
|
if (var_name == "LogDir") {
|
||||||
|
return (LogDir);
|
||||||
|
}
|
||||||
if (var_name == "LogPrefix") {
|
if (var_name == "LogPrefix") {
|
||||||
return (LogPrefix);
|
return (LogPrefix);
|
||||||
}
|
}
|
||||||
@ -468,9 +518,14 @@ void EQEmuConfig::Dump() const
|
|||||||
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
|
std::cout << "QSDatabasePort = " << QSDatabasePort << std::endl;
|
||||||
std::cout << "SpellsFile = " << SpellsFile << std::endl;
|
std::cout << "SpellsFile = " << SpellsFile << std::endl;
|
||||||
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
|
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
|
||||||
|
std::cout << "PluginPlFile = " << PluginPlFile << std::endl;
|
||||||
std::cout << "MapDir = " << MapDir << std::endl;
|
std::cout << "MapDir = " << MapDir << std::endl;
|
||||||
std::cout << "QuestDir = " << QuestDir << std::endl;
|
std::cout << "QuestDir = " << QuestDir << std::endl;
|
||||||
std::cout << "PluginDir = " << PluginDir << std::endl;
|
std::cout << "PluginDir = " << PluginDir << std::endl;
|
||||||
|
std::cout << "LuaModuleDir = " << LuaModuleDir << std::endl;
|
||||||
|
std::cout << "PatchDir = " << PatchDir << std::endl;
|
||||||
|
std::cout << "SharedMemDir = " << SharedMemDir << std::endl;
|
||||||
|
std::cout << "LogDir = " << LogDir << std::endl;
|
||||||
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
|
std::cout << "ZonePortLow = " << ZonePortLow << std::endl;
|
||||||
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
|
std::cout << "ZonePortHigh = " << ZonePortHigh << std::endl;
|
||||||
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
std::cout << "DefaultStatus = " << (int)DefaultStatus << std::endl;
|
||||||
|
|||||||
@ -79,11 +79,16 @@ class EQEmuConfig : public XMLParser
|
|||||||
// From <files/>
|
// From <files/>
|
||||||
std::string SpellsFile;
|
std::string SpellsFile;
|
||||||
std::string OpCodesFile;
|
std::string OpCodesFile;
|
||||||
|
std::string PluginPlFile;
|
||||||
|
|
||||||
// From <directories/>
|
// From <directories/>
|
||||||
std::string MapDir;
|
std::string MapDir;
|
||||||
std::string QuestDir;
|
std::string QuestDir;
|
||||||
std::string PluginDir;
|
std::string PluginDir;
|
||||||
|
std::string LuaModuleDir;
|
||||||
|
std::string PatchDir;
|
||||||
|
std::string SharedMemDir;
|
||||||
|
std::string LogDir;
|
||||||
|
|
||||||
// From <launcher/>
|
// From <launcher/>
|
||||||
std::string LogPrefix;
|
std::string LogPrefix;
|
||||||
@ -153,10 +158,16 @@ class EQEmuConfig : public XMLParser
|
|||||||
// Files
|
// Files
|
||||||
SpellsFile = "spells_us.txt";
|
SpellsFile = "spells_us.txt";
|
||||||
OpCodesFile = "opcodes.conf";
|
OpCodesFile = "opcodes.conf";
|
||||||
|
PluginPlFile = "plugin.pl";
|
||||||
// Dirs
|
// Dirs
|
||||||
MapDir = "Maps";
|
MapDir = "Maps/";
|
||||||
QuestDir = "quests";
|
QuestDir = "quests/";
|
||||||
PluginDir = "plugins";
|
PluginDir = "plugins/";
|
||||||
|
LuaModuleDir = "lua_modules/";
|
||||||
|
PatchDir = "./";
|
||||||
|
SharedMemDir = "shared/";
|
||||||
|
LogDir = "logs/";
|
||||||
|
|
||||||
// Launcher
|
// Launcher
|
||||||
LogPrefix = "logs/zone-";
|
LogPrefix = "logs/zone-";
|
||||||
LogSuffix = ".log";
|
LogSuffix = ".log";
|
||||||
|
|||||||
22
common/eqemu_config_extern.h
Normal file
22
common/eqemu_config_extern.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/* EQEMu: Everquest Server Emulator
|
||||||
|
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.org)
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||||
|
are required to give you total support for your newly bought product;
|
||||||
|
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "eqemu_exception.h"
|
#include "eqemu_exception.h"
|
||||||
|
#include "eqemu_config_extern.h"
|
||||||
|
|
||||||
namespace EQEmu {
|
namespace EQEmu {
|
||||||
struct IPCMutex::Implementation {
|
struct IPCMutex::Implementation {
|
||||||
@ -41,7 +41,7 @@ namespace EQEmu {
|
|||||||
IPCMutex::IPCMutex(std::string name) : locked_(false) {
|
IPCMutex::IPCMutex(std::string name) : locked_(false) {
|
||||||
imp_ = new Implementation;
|
imp_ = new Implementation;
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
std::string final_name = "EQEmuMutex_";
|
std::string final_name = Config->SharedMemDir + "EQEmuMutex_";
|
||||||
final_name += name;
|
final_name += name;
|
||||||
|
|
||||||
imp_->mut_ = CreateMutex(nullptr,
|
imp_->mut_ = CreateMutex(nullptr,
|
||||||
@ -52,7 +52,7 @@ namespace EQEmu {
|
|||||||
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::string final_name = name;
|
std::string final_name = Config->SharedMemDir + name;
|
||||||
final_name += ".lock";
|
final_name += ".lock";
|
||||||
|
|
||||||
#ifdef __DARWIN
|
#ifdef __DARWIN
|
||||||
|
|||||||
@ -67,7 +67,8 @@ namespace RoF
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -111,7 +112,8 @@ namespace RoF
|
|||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define COMMON_ROF_H
|
#define COMMON_ROF_H
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|||||||
@ -67,7 +67,8 @@ namespace RoF2
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -111,7 +112,8 @@ namespace RoF2
|
|||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define COMMON_ROF2_H
|
#define COMMON_ROF2_H
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|||||||
@ -63,7 +63,8 @@ namespace SoD
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -107,7 +108,8 @@ namespace SoD
|
|||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define COMMON_SOD_H
|
#define COMMON_SOD_H
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|||||||
@ -63,7 +63,8 @@ namespace SoF
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -107,7 +108,8 @@ namespace SoF
|
|||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define COMMON_SOF_H
|
#define COMMON_SOF_H
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|||||||
@ -16,7 +16,8 @@ static Strategy struct_strategy;
|
|||||||
void Register(EQStreamIdentifier &into) {
|
void Register(EQStreamIdentifier &into) {
|
||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if(opcodes == NULL) {
|
if(opcodes == NULL) {
|
||||||
string opfile = "patch_";
|
string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -51,7 +52,8 @@ void Reload() {
|
|||||||
|
|
||||||
if(opcodes != NULL) {
|
if(opcodes != NULL) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
string opfile = "patch_";
|
string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if(!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if(!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#define TEMPLATE_H_
|
#define TEMPLATE_H_
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
#include "../string_util.h"
|
#include "../string_util.h"
|
||||||
#include "../item.h"
|
#include "../item.h"
|
||||||
#include "titanium_structs.h"
|
#include "titanium_structs.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +62,8 @@ namespace Titanium
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -105,7 +107,8 @@ namespace Titanium
|
|||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define COMMON_TITANIUM_H
|
#define COMMON_TITANIUM_H
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|||||||
@ -63,7 +63,8 @@ namespace UF
|
|||||||
//create our opcode manager if we havent already
|
//create our opcode manager if we havent already
|
||||||
if (opcodes == nullptr) {
|
if (opcodes == nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
//load up the opcode manager.
|
//load up the opcode manager.
|
||||||
@ -107,7 +108,8 @@ namespace UF
|
|||||||
|
|
||||||
if (opcodes != nullptr) {
|
if (opcodes != nullptr) {
|
||||||
//TODO: get this file name from the config file
|
//TODO: get this file name from the config file
|
||||||
std::string opfile = "patch_";
|
std::string opfile = Config->PatchDir;
|
||||||
|
opfile += "patch_";
|
||||||
opfile += name;
|
opfile += name;
|
||||||
opfile += ".conf";
|
opfile += ".conf";
|
||||||
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
#define COMMON_UF_H
|
#define COMMON_UF_H
|
||||||
|
|
||||||
#include "../struct_strategy.h"
|
#include "../struct_strategy.h"
|
||||||
|
#include "../eqemu_config_extern.h"
|
||||||
|
|
||||||
|
|
||||||
class EQStreamIdentifier;
|
class EQStreamIdentifier;
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
#include "mysql.h"
|
#include "mysql.h"
|
||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "shareddb.h"
|
#include "shareddb.h"
|
||||||
|
#include "eqemu_config_extern.h"
|
||||||
#include "string_util.h"
|
#include "string_util.h"
|
||||||
|
|
||||||
SharedDatabase::SharedDatabase()
|
SharedDatabase::SharedDatabase()
|
||||||
@ -812,7 +813,7 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
|||||||
try {
|
try {
|
||||||
EQEmu::IPCMutex mutex("items");
|
EQEmu::IPCMutex mutex("items");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("items");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
|
||||||
items_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
items_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
||||||
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>>(new EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
|
items_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>>(new EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
|
||||||
mutex.Unlock();
|
mutex.Unlock();
|
||||||
@ -1235,7 +1236,7 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
|
|||||||
try {
|
try {
|
||||||
EQEmu::IPCMutex mutex("faction");
|
EQEmu::IPCMutex mutex("faction");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("faction");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("faction");
|
||||||
faction_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
faction_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
||||||
faction_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>>(new EQEmu::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size()));
|
faction_hash = std::unique_ptr<EQEmu::FixedMemoryHashSet<NPCFactionList>>(new EQEmu::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size()));
|
||||||
mutex.Unlock();
|
mutex.Unlock();
|
||||||
@ -1386,7 +1387,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
|
|||||||
try {
|
try {
|
||||||
EQEmu::IPCMutex mutex("skill_caps");
|
EQEmu::IPCMutex mutex("skill_caps");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("skill_caps");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
|
||||||
skill_caps_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
skill_caps_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
||||||
mutex.Unlock();
|
mutex.Unlock();
|
||||||
} catch(std::exception &ex) {
|
} catch(std::exception &ex) {
|
||||||
@ -1542,7 +1543,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
|||||||
EQEmu::IPCMutex mutex("spells");
|
EQEmu::IPCMutex mutex("spells");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("spells");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
|
||||||
spells_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
spells_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
||||||
*records = *reinterpret_cast<uint32*>(spells_mmf->Get());
|
*records = *reinterpret_cast<uint32*>(spells_mmf->Get());
|
||||||
*sp = reinterpret_cast<const SPDat_Spell_Struct*>((char*)spells_mmf->Get() + 4);
|
*sp = reinterpret_cast<const SPDat_Spell_Struct*>((char*)spells_mmf->Get() + 4);
|
||||||
@ -1745,7 +1746,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
|
|||||||
EQEmu::IPCMutex mutex("base_data");
|
EQEmu::IPCMutex mutex("base_data");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("base_data");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
|
||||||
base_data_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
base_data_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name));
|
||||||
mutex.Unlock();
|
mutex.Unlock();
|
||||||
} catch(std::exception& ex) {
|
} catch(std::exception& ex) {
|
||||||
@ -1983,12 +1984,12 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
|
|||||||
try {
|
try {
|
||||||
EQEmu::IPCMutex mutex("loot");
|
EQEmu::IPCMutex mutex("loot");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
std::string file_name_lt = std::string("shared/") + prefix + std::string("loot_table");
|
std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table");
|
||||||
loot_table_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name_lt));
|
loot_table_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name_lt));
|
||||||
loot_table_hash = std::unique_ptr<EQEmu::FixedMemoryVariableHashSet<LootTable_Struct>>(new EQEmu::FixedMemoryVariableHashSet<LootTable_Struct>(
|
loot_table_hash = std::unique_ptr<EQEmu::FixedMemoryVariableHashSet<LootTable_Struct>>(new EQEmu::FixedMemoryVariableHashSet<LootTable_Struct>(
|
||||||
reinterpret_cast<uint8*>(loot_table_mmf->Get()),
|
reinterpret_cast<uint8*>(loot_table_mmf->Get()),
|
||||||
loot_table_mmf->Size()));
|
loot_table_mmf->Size()));
|
||||||
std::string file_name_ld = std::string("shared/") + prefix + std::string("loot_drop");
|
std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop");
|
||||||
loot_drop_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name_ld));
|
loot_drop_mmf = std::unique_ptr<EQEmu::MemoryMappedFile>(new EQEmu::MemoryMappedFile(file_name_ld));
|
||||||
loot_drop_hash = std::unique_ptr<EQEmu::FixedMemoryVariableHashSet<LootDrop_Struct>>(new EQEmu::FixedMemoryVariableHashSet<LootDrop_Struct>(
|
loot_drop_hash = std::unique_ptr<EQEmu::FixedMemoryVariableHashSet<LootDrop_Struct>>(new EQEmu::FixedMemoryVariableHashSet<LootDrop_Struct>(
|
||||||
reinterpret_cast<uint8*>(loot_drop_mmf->Get()),
|
reinterpret_cast<uint8*>(loot_drop_mmf->Get()),
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
const EQEmuConfig *Config;
|
||||||
|
|
||||||
bool RunLoops = false;
|
bool RunLoops = false;
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ int main(int argc, char *argv[]) {
|
|||||||
Log.Out(Logs::Detail, Logs::Launcher, "Loading server configuration failed.");
|
Log.Out(Logs::Detail, Logs::Launcher, "Loading server configuration failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const EQEmuConfig *Config = EQEmuConfig::get();
|
Config = EQEmuConfig::get();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup nice signal handlers
|
* Setup nice signal handlers
|
||||||
|
|||||||
@ -33,7 +33,7 @@ void LoadBaseData(SharedDatabase *database, const std::string &prefix) {
|
|||||||
|
|
||||||
uint32 size = records * 16 * sizeof(BaseDataStruct);
|
uint32 size = records * 16 * sizeof(BaseDataStruct);
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("base_data");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
|
||||||
EQEmu::MemoryMappedFile mmf(file_name, size);
|
EQEmu::MemoryMappedFile mmf(file_name, size);
|
||||||
mmf.ZeroFile();
|
mmf.ZeroFile();
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,10 @@
|
|||||||
#define __EQEMU_SHARED_MEMORY_BASE_DATA_H
|
#define __EQEMU_SHARED_MEMORY_BASE_DATA_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class SharedDatabase;
|
class SharedDatabase;
|
||||||
void LoadBaseData(SharedDatabase *database, const std::string &prefix);
|
void LoadBaseData(SharedDatabase *database, const std::string &prefix);
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ void LoadItems(SharedDatabase *database, const std::string &prefix) {
|
|||||||
|
|
||||||
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>::estimated_size(items, max_item));
|
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<EQEmu::Item_Struct>::estimated_size(items, max_item));
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("items");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
|
||||||
EQEmu::MemoryMappedFile mmf(file_name, size);
|
EQEmu::MemoryMappedFile mmf(file_name, size);
|
||||||
mmf.ZeroFile();
|
mmf.ZeroFile();
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,9 @@
|
|||||||
#define __EQEMU_SHARED_MEMORY_ITEMS_H
|
#define __EQEMU_SHARED_MEMORY_ITEMS_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class SharedDatabase;
|
class SharedDatabase;
|
||||||
void LoadItems(SharedDatabase *database, const std::string &prefix);
|
void LoadItems(SharedDatabase *database, const std::string &prefix);
|
||||||
|
|||||||
@ -44,8 +44,8 @@ void LoadLoot(SharedDatabase *database, const std::string &prefix) {
|
|||||||
(loot_drop_count * sizeof(LootDrop_Struct)) + //loot table headers
|
(loot_drop_count * sizeof(LootDrop_Struct)) + //loot table headers
|
||||||
(loot_drop_entries_count * sizeof(LootDropEntries_Struct)); //number of loot table entries
|
(loot_drop_entries_count * sizeof(LootDropEntries_Struct)); //number of loot table entries
|
||||||
|
|
||||||
std::string file_name_lt = std::string("shared/") + prefix + std::string("loot_table");
|
std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table");
|
||||||
std::string file_name_ld = std::string("shared/") + prefix + std::string("loot_drop");
|
std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop");
|
||||||
|
|
||||||
EQEmu::MemoryMappedFile mmf_loot_table(file_name_lt, loot_table_size);
|
EQEmu::MemoryMappedFile mmf_loot_table(file_name_lt, loot_table_size);
|
||||||
EQEmu::MemoryMappedFile mmf_loot_drop(file_name_ld, loot_drop_size);
|
EQEmu::MemoryMappedFile mmf_loot_drop(file_name_ld, loot_drop_size);
|
||||||
|
|||||||
@ -20,6 +20,9 @@
|
|||||||
#define __EQEMU_SHARED_MEMORY_LOOT_H
|
#define __EQEMU_SHARED_MEMORY_LOOT_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class SharedDatabase;
|
class SharedDatabase;
|
||||||
void LoadLoot(SharedDatabase *database, const std::string &prefix);
|
void LoadLoot(SharedDatabase *database, const std::string &prefix);
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include "base_data.h"
|
#include "base_data.h"
|
||||||
|
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
const EQEmuConfig *Config;
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
||||||
Log.LoadLogSettingsDefaults();
|
Log.LoadLogSettingsDefaults();
|
||||||
@ -47,12 +47,12 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EQEmuConfig *config = EQEmuConfig::get();
|
Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||||
"database connection");
|
"database connection");
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ void LoadFactions(SharedDatabase *database, const std::string &prefix) {
|
|||||||
|
|
||||||
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<NPCFactionList>::estimated_size(lists, max_list));
|
uint32 size = static_cast<uint32>(EQEmu::FixedMemoryHashSet<NPCFactionList>::estimated_size(lists, max_list));
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("faction");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("faction");
|
||||||
EQEmu::MemoryMappedFile mmf(file_name, size);
|
EQEmu::MemoryMappedFile mmf(file_name, size);
|
||||||
mmf.ZeroFile();
|
mmf.ZeroFile();
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,9 @@
|
|||||||
#define __EQEMU_SHARED_MEMORY_NPC_FACTION_H
|
#define __EQEMU_SHARED_MEMORY_NPC_FACTION_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class SharedDatabase;
|
class SharedDatabase;
|
||||||
void LoadFactions(SharedDatabase *database, const std::string &prefix);
|
void LoadFactions(SharedDatabase *database, const std::string &prefix);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ void LoadSkillCaps(SharedDatabase *database, const std::string &prefix) {
|
|||||||
uint32 level_count = HARD_LEVEL_CAP + 1;
|
uint32 level_count = HARD_LEVEL_CAP + 1;
|
||||||
uint32 size = (class_count * skill_count * level_count * sizeof(uint16));
|
uint32 size = (class_count * skill_count * level_count * sizeof(uint16));
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("skill_caps");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
|
||||||
EQEmu::MemoryMappedFile mmf(file_name, size);
|
EQEmu::MemoryMappedFile mmf(file_name, size);
|
||||||
mmf.ZeroFile();
|
mmf.ZeroFile();
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,9 @@
|
|||||||
#define __EQEMU_SHARED_MEMORY_SKILL_CAPS_H
|
#define __EQEMU_SHARED_MEMORY_SKILL_CAPS_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class SharedDatabase;
|
class SharedDatabase;
|
||||||
void LoadSkillCaps(SharedDatabase *database, const std::string &prefix);
|
void LoadSkillCaps(SharedDatabase *database, const std::string &prefix);
|
||||||
|
|||||||
@ -34,7 +34,7 @@ void LoadSpells(SharedDatabase *database, const std::string &prefix) {
|
|||||||
|
|
||||||
uint32 size = records * sizeof(SPDat_Spell_Struct) + sizeof(uint32);
|
uint32 size = records * sizeof(SPDat_Spell_Struct) + sizeof(uint32);
|
||||||
|
|
||||||
std::string file_name = std::string("shared/") + prefix + std::string("spells");
|
std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
|
||||||
EQEmu::MemoryMappedFile mmf(file_name, size);
|
EQEmu::MemoryMappedFile mmf(file_name, size);
|
||||||
mmf.ZeroFile();
|
mmf.ZeroFile();
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,9 @@
|
|||||||
#define __EQEMU_SHARED_MEMORY_SPELLS_H
|
#define __EQEMU_SHARED_MEMORY_SPELLS_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class SharedDatabase;
|
class SharedDatabase;
|
||||||
void LoadSpells(SharedDatabase *database, const std::string &prefix);
|
void LoadSpells(SharedDatabase *database, const std::string &prefix);
|
||||||
|
|||||||
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
#include "cppunit/cpptest.h"
|
#include "cppunit/cpptest.h"
|
||||||
#include "../common/ipc_mutex.h"
|
#include "../common/ipc_mutex.h"
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
extern const EQEmuConfig *Config;
|
||||||
|
|
||||||
class IPCMutexTest : public Test::Suite {
|
class IPCMutexTest : public Test::Suite {
|
||||||
typedef void(IPCMutexTest::*TestFunction)(void);
|
typedef void(IPCMutexTest::*TestFunction)(void);
|
||||||
|
|||||||
@ -29,8 +29,13 @@
|
|||||||
#include "string_util_test.h"
|
#include "string_util_test.h"
|
||||||
#include "data_verification_test.h"
|
#include "data_verification_test.h"
|
||||||
#include "skills_util_test.h"
|
#include "skills_util_test.h"
|
||||||
|
#include "../common/eqemu_config.h"
|
||||||
|
|
||||||
|
const EQEmuConfig *Config;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
auto ConfigLoadResult = EQEmuConfig::LoadConfig();
|
||||||
|
Config = EQEmuConfig::get();
|
||||||
try {
|
try {
|
||||||
std::ofstream outfile("test_output.txt");
|
std::ofstream outfile("test_output.txt");
|
||||||
std::unique_ptr<Test::Output> output(new Test::TextOutput(Test::TextOutput::Verbose, outfile));
|
std::unique_ptr<Test::Output> output(new Test::TextOutput(Test::TextOutput::Verbose, outfile));
|
||||||
|
|||||||
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
<!-- Launcher Configuration -->
|
<!-- Launcher Configuration -->
|
||||||
<launcher>
|
<launcher>
|
||||||
<!-- <logprefix>logs/zone-</logprefix> -->
|
<!-- <logprefix>zone-</logprefix> -->
|
||||||
<!-- <logsuffix>.log</logsuffix> -->
|
<!-- <logsuffix>.log</logsuffix> -->
|
||||||
<!-- <exe>zone.exe or ./zone</exe> -->
|
<!-- <exe>zone.exe or ./zone</exe> -->
|
||||||
<!-- <timers restart="10000" reterminate="10000"> -->
|
<!-- <timers restart="10000" reterminate="10000"> -->
|
||||||
@ -80,11 +80,16 @@
|
|||||||
<!-- <opcodes>opcodes.conf</opcodes> -->
|
<!-- <opcodes>opcodes.conf</opcodes> -->
|
||||||
<!-- <logsettings>log.ini</logsettings> -->
|
<!-- <logsettings>log.ini</logsettings> -->
|
||||||
<!-- <eqtime>eqtime.cfg</eqtime> -->
|
<!-- <eqtime>eqtime.cfg</eqtime> -->
|
||||||
|
<!-- <plugin.pl>plugin.pl</plugin.pl> -->
|
||||||
</files>
|
</files>
|
||||||
<!-- Directory locations. Defaults shown -->
|
<!-- Directory locations. Defaults shown -->
|
||||||
<directories>
|
<directories>
|
||||||
<!-- <maps>Maps</maps> -->
|
<!-- <maps>Maps/</maps> -->
|
||||||
<!-- <quests>quests</quests> -->
|
<!-- <quests>quests/</quests> -->
|
||||||
<!-- <plugins>plugins</plugins> -->
|
<!-- <plugins>plugins/</plugins> -->
|
||||||
|
<!-- <lua_modules>lua_modules/</lua_modules> -->
|
||||||
|
<!-- <patches>./</patches> -->
|
||||||
|
<!-- <shared_memory>shared/</shared_memory> -->
|
||||||
|
<!-- <logs>logs/</logs> -->
|
||||||
</directories>
|
</directories>
|
||||||
</server>
|
</server>
|
||||||
|
|||||||
@ -104,7 +104,7 @@ volatile bool RunLoops = true;
|
|||||||
uint32 numclients = 0;
|
uint32 numclients = 0;
|
||||||
uint32 numzones = 0;
|
uint32 numzones = 0;
|
||||||
bool holdzones = false;
|
bool holdzones = false;
|
||||||
|
const WorldConfig *Config;
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
|
||||||
extern ConsoleList console_list;
|
extern ConsoleList console_list;
|
||||||
@ -135,7 +135,7 @@ int main(int argc, char** argv) {
|
|||||||
Log.Out(Logs::General, Logs::World_Server, "Loading server configuration failed.");
|
Log.Out(Logs::General, Logs::World_Server, "Loading server configuration failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const WorldConfig *Config=WorldConfig::get();
|
Config=WorldConfig::get();
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
|
Log.Out(Logs::General, Logs::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
|
||||||
|
|
||||||
|
|||||||
@ -173,25 +173,27 @@ void Embperl::DoInit() {
|
|||||||
Log.Out(Logs::General, Logs::Quests, "Loading perlemb plugins.");
|
Log.Out(Logs::General, Logs::Quests, "Loading perlemb plugins.");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
eval_pv("main::eval_file('plugin', 'plugin.pl');", FALSE);
|
std::string perl_command;
|
||||||
|
perl_command = "main::eval_file('plugin', '" + Config->PluginPlFile + "');";
|
||||||
|
eval_pv(perl_command.c_str(), FALSE);
|
||||||
}
|
}
|
||||||
catch(const char *err)
|
catch(const char *err)
|
||||||
{
|
{
|
||||||
Log.Out(Logs::General, Logs::Quests, "Warning - plugin.pl: %s", err);
|
Log.Out(Logs::General, Logs::Quests, "Warning - %s: %s", Config->PluginPlFile.c_str(), err);
|
||||||
}
|
}
|
||||||
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
|
||||||
eval_pv(
|
std::string perl_command =
|
||||||
"if(opendir(D,'plugins')) { "
|
"if(opendir(D,'" + Config->PluginDir +"')) { "
|
||||||
" my @d = readdir(D);"
|
" my @d = readdir(D);"
|
||||||
" closedir(D);"
|
" closedir(D);"
|
||||||
" foreach(@d){ "
|
" foreach(@d){ "
|
||||||
" main::eval_file('plugin','plugins/'.$_)if/\\.pl$/;"
|
" main::eval_file('plugin','" + Config->PluginDir + "/'.$_)if/\\.pl$/;"
|
||||||
" }"
|
" }"
|
||||||
"}"
|
"}";
|
||||||
,FALSE);
|
eval_pv(perl_command.c_str(),FALSE);
|
||||||
}
|
}
|
||||||
catch(const char *err)
|
catch(const char *err)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,6 +10,8 @@ Eglin
|
|||||||
|
|
||||||
#ifdef EMBPERL
|
#ifdef EMBPERL
|
||||||
|
|
||||||
|
#include "zone_config.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -57,6 +59,7 @@ extern "C" { //the perl headers dont do this for us...
|
|||||||
EXTERN_C void boot_DynaLoader(pTHX_ CV* cv);
|
EXTERN_C void boot_DynaLoader(pTHX_ CV* cv);
|
||||||
EXTERN_C void xs_init(pTHX);
|
EXTERN_C void xs_init(pTHX);
|
||||||
|
|
||||||
|
extern const ZoneConfig *Config;
|
||||||
class Embperl
|
class Embperl
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
#include "lua_general.h"
|
#include "lua_general.h"
|
||||||
#include "questmgr.h"
|
#include "questmgr.h"
|
||||||
#include "zone.h"
|
#include "zone.h"
|
||||||
|
#include "zone_config.h"
|
||||||
#include "lua_parser.h"
|
#include "lua_parser.h"
|
||||||
#include "lua_encounter.h"
|
#include "lua_encounter.h"
|
||||||
|
|
||||||
@ -851,7 +852,7 @@ void LuaParser::ReloadQuests() {
|
|||||||
lua_getglobal(L, "package");
|
lua_getglobal(L, "package");
|
||||||
lua_getfield(L, -1, "path");
|
lua_getfield(L, -1, "path");
|
||||||
std::string module_path = lua_tostring(L,-1);
|
std::string module_path = lua_tostring(L,-1);
|
||||||
module_path += ";./lua_modules/?.lua";
|
module_path += ";./" + Config->LuaModuleDir + "/?.lua";
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_pushstring(L, module_path.c_str());
|
lua_pushstring(L, module_path.c_str());
|
||||||
lua_setfield(L, -2, "path");
|
lua_setfield(L, -2, "path");
|
||||||
@ -860,7 +861,8 @@ void LuaParser::ReloadQuests() {
|
|||||||
MapFunctions(L);
|
MapFunctions(L);
|
||||||
|
|
||||||
//load init
|
//load init
|
||||||
std::string path = "quests/";
|
std::string path = Config->QuestDir;
|
||||||
|
path += "/";
|
||||||
path += QUEST_GLOBAL_DIRECTORY;
|
path += QUEST_GLOBAL_DIRECTORY;
|
||||||
path += "/script_init.lua";
|
path += "/script_init.lua";
|
||||||
|
|
||||||
@ -876,7 +878,8 @@ void LuaParser::ReloadQuests() {
|
|||||||
|
|
||||||
//zone init - always loads after global
|
//zone init - always loads after global
|
||||||
if(zone) {
|
if(zone) {
|
||||||
std::string zone_script = "quests/";
|
std::string zone_script = Config->QuestDir;
|
||||||
|
zone_script += "/";
|
||||||
zone_script += zone->GetShortName();
|
zone_script += zone->GetShortName();
|
||||||
zone_script += "/script_init_v";
|
zone_script += "/script_init_v";
|
||||||
zone_script += std::to_string(zone->GetInstanceVersion());
|
zone_script += std::to_string(zone->GetInstanceVersion());
|
||||||
@ -893,7 +896,8 @@ void LuaParser::ReloadQuests() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zone_script = "quests/";
|
zone_script = Config->QuestDir;
|
||||||
|
zone_script += "/";
|
||||||
zone_script += zone->GetShortName();
|
zone_script += zone->GetShortName();
|
||||||
zone_script += "/script_init.lua";
|
zone_script += "/script_init.lua";
|
||||||
f = fopen(zone_script.c_str(), "r");
|
f = fopen(zone_script.c_str(), "r");
|
||||||
|
|||||||
@ -8,6 +8,10 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include "zone_config.h"
|
||||||
|
|
||||||
|
extern const ZoneConfig *Config;
|
||||||
|
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
class ItemInst;
|
class ItemInst;
|
||||||
class Client;
|
class Client;
|
||||||
|
|||||||
@ -227,7 +227,7 @@ bool Map::CheckLoS(glm::vec3 myloc, glm::vec3 oloc) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map *Map::LoadMapFile(std::string file) {
|
Map *Map::LoadMapFile(std::string file) {
|
||||||
std::string filename = MAP_DIR;
|
std::string filename = Config->MapDir;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
||||||
filename += file;
|
filename += file;
|
||||||
|
|||||||
@ -25,8 +25,12 @@
|
|||||||
#include "position.h"
|
#include "position.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "zone_config.h"
|
||||||
|
|
||||||
#define BEST_Z_INVALID -99999
|
#define BEST_Z_INVALID -99999
|
||||||
|
|
||||||
|
extern const ZoneConfig *Config;
|
||||||
|
|
||||||
class Map
|
class Map
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -104,9 +104,9 @@ QueryServ *QServ = 0;
|
|||||||
TaskManager *taskmanager = 0;
|
TaskManager *taskmanager = 0;
|
||||||
QuestParserCollection *parse = 0;
|
QuestParserCollection *parse = 0;
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
|
||||||
const SPDat_Spell_Struct* spells;
|
const SPDat_Spell_Struct* spells;
|
||||||
int32 SPDAT_RECORDS = -1;
|
int32 SPDAT_RECORDS = -1;
|
||||||
|
const ZoneConfig *Config;
|
||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
extern void MapOpcodes();
|
extern void MapOpcodes();
|
||||||
@ -123,7 +123,7 @@ int main(int argc, char** argv) {
|
|||||||
Log.Out(Logs::General, Logs::Error, "Loading server configuration failed.");
|
Log.Out(Logs::General, Logs::Error, "Loading server configuration failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const ZoneConfig *Config = ZoneConfig::get();
|
Config = ZoneConfig::get();
|
||||||
|
|
||||||
const char *zone_name;
|
const char *zone_name;
|
||||||
uint32 instance_id = 0;
|
uint32 instance_id = 0;
|
||||||
@ -195,7 +195,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
worldserver.SetPassword(Config->SharedKey.c_str());
|
worldserver.SetPassword(Config->SharedKey.c_str());
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
|
Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
|
||||||
if (!database.Connect(
|
if (!database.Connect(
|
||||||
Config->DatabaseHost.c_str(),
|
Config->DatabaseHost.c_str(),
|
||||||
|
|||||||
@ -52,7 +52,7 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName)
|
|||||||
|
|
||||||
strlwr(LowerCaseZoneName);
|
strlwr(LowerCaseZoneName);
|
||||||
|
|
||||||
snprintf(ZonePathFileName, 250, MAP_DIR "/%s.path", LowerCaseZoneName);
|
snprintf(ZonePathFileName, 250, "%s/%s.path", Config->MapDir.c_str(),LowerCaseZoneName);
|
||||||
|
|
||||||
if((PathFile = fopen(ZonePathFileName, "rb")))
|
if((PathFile = fopen(ZonePathFileName, "rb")))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
#define PATHING_H
|
#define PATHING_H
|
||||||
|
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
#include "zone_config.h"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
extern const ZoneConfig *Config;
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
class Mob;
|
class Mob;
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#include "quest_interface.h"
|
#include "quest_interface.h"
|
||||||
#include "zone.h"
|
#include "zone.h"
|
||||||
#include "questmgr.h"
|
#include "questmgr.h"
|
||||||
|
#include "zone_config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -459,7 +460,7 @@ int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounte
|
|||||||
|
|
||||||
QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string &filename) {
|
QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string &filename) {
|
||||||
//first look for /quests/zone/npcid.ext (precedence)
|
//first look for /quests/zone/npcid.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += itoa(npcid);
|
filename += itoa(npcid);
|
||||||
@ -502,7 +503,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += npc_name;
|
filename += npc_name;
|
||||||
@ -524,7 +525,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
//third look for /quests/global/npcid.ext (precedence)
|
//third look for /quests/global/npcid.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += itoa(npcid);
|
filename += itoa(npcid);
|
||||||
@ -545,7 +546,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
//fourth look for /quests/global/npcname.ext (precedence)
|
//fourth look for /quests/global/npcname.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += npc_name;
|
filename += npc_name;
|
||||||
@ -566,7 +567,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
//fifth look for /quests/zone/default.ext (precedence)
|
//fifth look for /quests/zone/default.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "default";
|
filename += "default";
|
||||||
@ -587,7 +588,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
//last look for /quests/global/default.ext (precedence)
|
//last look for /quests/global/default.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "default";
|
filename += "default";
|
||||||
@ -615,7 +616,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
//first look for /quests/zone/player_v[instance_version].ext (precedence)
|
//first look for /quests/zone/player_v[instance_version].ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "player_v";
|
filename += "player_v";
|
||||||
@ -640,7 +641,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//second look for /quests/zone/player.ext (precedence)
|
//second look for /quests/zone/player.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "player";
|
filename += "player";
|
||||||
@ -662,7 +663,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//third look for /quests/global/player.ext (precedence)
|
//third look for /quests/global/player.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "player";
|
filename += "player";
|
||||||
@ -687,7 +688,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
|||||||
|
|
||||||
QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filename) {
|
QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filename) {
|
||||||
// simply look for /quests/global/global_npc.ext
|
// simply look for /quests/global/global_npc.ext
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "global_npc";
|
filename += "global_npc";
|
||||||
@ -715,7 +716,7 @@ QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filena
|
|||||||
|
|
||||||
QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &filename) {
|
QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &filename) {
|
||||||
//first look for /quests/global/player.ext (precedence)
|
//first look for /quests/global/player.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/";
|
filename += "/";
|
||||||
filename += "global_player";
|
filename += "global_player";
|
||||||
@ -743,7 +744,7 @@ QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &fil
|
|||||||
|
|
||||||
QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::string &filename) {
|
QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::string &filename) {
|
||||||
//first look for /quests/zone/spells/spell_id.ext (precedence)
|
//first look for /quests/zone/spells/spell_id.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/spells/";
|
filename += "/spells/";
|
||||||
filename += itoa(spell_id);
|
filename += itoa(spell_id);
|
||||||
@ -767,7 +768,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
//second look for /quests/global/spells/spell_id.ext (precedence)
|
//second look for /quests/global/spells/spell_id.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/spells/";
|
filename += "/spells/";
|
||||||
filename += itoa(spell_id);
|
filename += itoa(spell_id);
|
||||||
@ -789,7 +790,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
//third look for /quests/zone/spells/default.ext (precedence)
|
//third look for /quests/zone/spells/default.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/spells/default";
|
filename += "/spells/default";
|
||||||
|
|
||||||
@ -810,7 +811,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
//last look for /quests/global/spells/default.ext (precedence)
|
//last look for /quests/global/spells/default.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/spells/default";
|
filename += "/spells/default";
|
||||||
|
|
||||||
@ -835,7 +836,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
|||||||
|
|
||||||
QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, std::string &filename) {
|
QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script, std::string &filename) {
|
||||||
//first look for /quests/zone/items/item_script.ext (precedence)
|
//first look for /quests/zone/items/item_script.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/items/";
|
filename += "/items/";
|
||||||
filename += item_script;
|
filename += item_script;
|
||||||
@ -859,7 +860,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//second look for /quests/global/items/item_script.ext (precedence)
|
//second look for /quests/global/items/item_script.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/items/";
|
filename += "/items/";
|
||||||
filename += item_script;
|
filename += item_script;
|
||||||
@ -881,7 +882,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//third look for /quests/zone/items/default.ext (precedence)
|
//third look for /quests/zone/items/default.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/items/default";
|
filename += "/items/default";
|
||||||
|
|
||||||
@ -902,7 +903,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//last look for /quests/global/items/default.ext (precedence)
|
//last look for /quests/global/items/default.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/items/default";
|
filename += "/items/default";
|
||||||
|
|
||||||
@ -927,7 +928,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
|||||||
|
|
||||||
QuestInterface *QuestParserCollection::GetQIByEncounterQuest(std::string encounter_name, std::string &filename) {
|
QuestInterface *QuestParserCollection::GetQIByEncounterQuest(std::string encounter_name, std::string &filename) {
|
||||||
//first look for /quests/zone/encounters/encounter_name.ext (precedence)
|
//first look for /quests/zone/encounters/encounter_name.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += zone->GetShortName();
|
filename += zone->GetShortName();
|
||||||
filename += "/encounters/";
|
filename += "/encounters/";
|
||||||
filename += encounter_name;
|
filename += encounter_name;
|
||||||
@ -951,7 +952,7 @@ QuestInterface *QuestParserCollection::GetQIByEncounterQuest(std::string encount
|
|||||||
}
|
}
|
||||||
|
|
||||||
//second look for /quests/global/encounters/encounter_name.ext (precedence)
|
//second look for /quests/global/encounters/encounter_name.ext (precedence)
|
||||||
filename = "quests/";
|
filename = Config->QuestDir;
|
||||||
filename += QUEST_GLOBAL_DIRECTORY;
|
filename += QUEST_GLOBAL_DIRECTORY;
|
||||||
filename += "/encounters/";
|
filename += "/encounters/";
|
||||||
filename += encounter_name;
|
filename += encounter_name;
|
||||||
@ -1077,4 +1078,4 @@ void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings*
|
|||||||
perl_event_export_settings[event_id].event_variables = atoi(row[6]);
|
perl_event_export_settings[event_id].event_variables = atoi(row[6]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,12 +34,15 @@
|
|||||||
|
|
||||||
#include "quest_interface.h"
|
#include "quest_interface.h"
|
||||||
|
|
||||||
|
#include "zone_config.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#define QuestFailedToLoad 0xFFFFFFFF
|
#define QuestFailedToLoad 0xFFFFFFFF
|
||||||
#define QuestUnloaded 0x00
|
#define QuestUnloaded 0x00
|
||||||
|
|
||||||
|
extern const ZoneConfig *Config;
|
||||||
class Client;
|
class Client;
|
||||||
class ItemInst;
|
class ItemInst;
|
||||||
class Mob;
|
class Mob;
|
||||||
|
|||||||
@ -12,7 +12,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 = MAP_DIR + std::string("/") + zone_name + std::string(".wtr");
|
std::string file_path = Config->MapDir + zone_name + std::string(".wtr");
|
||||||
FILE *f = fopen(file_path.c_str(), "rb");
|
FILE *f = fopen(file_path.c_str(), "rb");
|
||||||
if(f) {
|
if(f) {
|
||||||
char magic[10];
|
char magic[10];
|
||||||
@ -57,4 +57,4 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
#include "../common/types.h"
|
#include "../common/types.h"
|
||||||
#include "position.h"
|
#include "position.h"
|
||||||
|
#include "zone_config.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
extern const ZoneConfig *Config;
|
||||||
|
|
||||||
enum WaterRegionType {
|
enum WaterRegionType {
|
||||||
RegionTypeUnsupported = -2,
|
RegionTypeUnsupported = -2,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user