mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Config File Update Initial Update
This commit is contained in:
+9
-7
@@ -173,25 +173,27 @@ void Embperl::DoInit() {
|
||||
Log.Out(Logs::General, Logs::Quests, "Loading perlemb plugins.");
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
//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
|
||||
eval_pv(
|
||||
"if(opendir(D,'plugins')) { "
|
||||
std::string perl_command =
|
||||
"if(opendir(D,'" + Config->PluginDir +"')) { "
|
||||
" my @d = readdir(D);"
|
||||
" closedir(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)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@ Eglin
|
||||
|
||||
#ifdef EMBPERL
|
||||
|
||||
#include "zone_config.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#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 xs_init(pTHX);
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
class Embperl
|
||||
{
|
||||
private:
|
||||
|
||||
+8
-4
@@ -33,6 +33,7 @@
|
||||
#include "lua_general.h"
|
||||
#include "questmgr.h"
|
||||
#include "zone.h"
|
||||
#include "zone_config.h"
|
||||
#include "lua_parser.h"
|
||||
#include "lua_encounter.h"
|
||||
|
||||
@@ -851,7 +852,7 @@ void LuaParser::ReloadQuests() {
|
||||
lua_getglobal(L, "package");
|
||||
lua_getfield(L, -1, "path");
|
||||
std::string module_path = lua_tostring(L,-1);
|
||||
module_path += ";./lua_modules/?.lua";
|
||||
module_path += ";./" + Config->LuaModuleDir + "/?.lua";
|
||||
lua_pop(L, 1);
|
||||
lua_pushstring(L, module_path.c_str());
|
||||
lua_setfield(L, -2, "path");
|
||||
@@ -860,7 +861,8 @@ void LuaParser::ReloadQuests() {
|
||||
MapFunctions(L);
|
||||
|
||||
//load init
|
||||
std::string path = "quests/";
|
||||
std::string path = Config->QuestDir;
|
||||
path += "/";
|
||||
path += QUEST_GLOBAL_DIRECTORY;
|
||||
path += "/script_init.lua";
|
||||
|
||||
@@ -876,7 +878,8 @@ void LuaParser::ReloadQuests() {
|
||||
|
||||
//zone init - always loads after global
|
||||
if(zone) {
|
||||
std::string zone_script = "quests/";
|
||||
std::string zone_script = Config->QuestDir;
|
||||
zone_script += "/";
|
||||
zone_script += zone->GetShortName();
|
||||
zone_script += "/script_init_v";
|
||||
zone_script += std::to_string(zone->GetInstanceVersion());
|
||||
@@ -893,7 +896,8 @@ void LuaParser::ReloadQuests() {
|
||||
return;
|
||||
}
|
||||
|
||||
zone_script = "quests/";
|
||||
zone_script = Config->QuestDir;
|
||||
zone_script += "/";
|
||||
zone_script += zone->GetShortName();
|
||||
zone_script += "/script_init.lua";
|
||||
f = fopen(zone_script.c_str(), "r");
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#include "zone_config.h"
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
|
||||
struct lua_State;
|
||||
class ItemInst;
|
||||
class Client;
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ bool Map::CheckLoS(glm::vec3 myloc, glm::vec3 oloc) const {
|
||||
}
|
||||
|
||||
Map *Map::LoadMapFile(std::string file) {
|
||||
std::string filename = MAP_DIR;
|
||||
std::string filename = Config->MapDir;
|
||||
filename += "/";
|
||||
std::transform(file.begin(), file.end(), file.begin(), ::tolower);
|
||||
filename += file;
|
||||
|
||||
@@ -25,8 +25,12 @@
|
||||
#include "position.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "zone_config.h"
|
||||
|
||||
#define BEST_Z_INVALID -99999
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
|
||||
class Map
|
||||
{
|
||||
public:
|
||||
|
||||
+3
-3
@@ -104,9 +104,9 @@ QueryServ *QServ = 0;
|
||||
TaskManager *taskmanager = 0;
|
||||
QuestParserCollection *parse = 0;
|
||||
EQEmuLogSys Log;
|
||||
|
||||
const SPDat_Spell_Struct* spells;
|
||||
int32 SPDAT_RECORDS = -1;
|
||||
const ZoneConfig *Config;
|
||||
|
||||
void Shutdown();
|
||||
extern void MapOpcodes();
|
||||
@@ -123,7 +123,7 @@ int main(int argc, char** argv) {
|
||||
Log.Out(Logs::General, Logs::Error, "Loading server configuration failed.");
|
||||
return 1;
|
||||
}
|
||||
const ZoneConfig *Config = ZoneConfig::get();
|
||||
Config = ZoneConfig::get();
|
||||
|
||||
const char *zone_name;
|
||||
uint32 instance_id = 0;
|
||||
@@ -195,7 +195,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
worldserver.SetPassword(Config->SharedKey.c_str());
|
||||
|
||||
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Connecting to MySQL...");
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ PathManager* PathManager::LoadPathFile(const char* ZoneName)
|
||||
|
||||
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")))
|
||||
{
|
||||
|
||||
+3
-1
@@ -2,9 +2,11 @@
|
||||
#define PATHING_H
|
||||
|
||||
#include "map.h"
|
||||
|
||||
#include "zone_config.h"
|
||||
#include <deque>
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
|
||||
class Client;
|
||||
class Mob;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "quest_interface.h"
|
||||
#include "zone.h"
|
||||
#include "questmgr.h"
|
||||
#include "zone_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -459,7 +460,7 @@ int QuestParserCollection::EventEncounter(QuestEventID evt, std::string encounte
|
||||
|
||||
QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string &filename) {
|
||||
//first look for /quests/zone/npcid.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/";
|
||||
filename += itoa(npcid);
|
||||
@@ -502,7 +503,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
||||
}
|
||||
}
|
||||
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/";
|
||||
filename += npc_name;
|
||||
@@ -524,7 +525,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
||||
}
|
||||
|
||||
//third look for /quests/global/npcid.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/";
|
||||
filename += itoa(npcid);
|
||||
@@ -545,7 +546,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
||||
}
|
||||
|
||||
//fourth look for /quests/global/npcname.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/";
|
||||
filename += npc_name;
|
||||
@@ -566,7 +567,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
||||
}
|
||||
|
||||
//fifth look for /quests/zone/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/";
|
||||
filename += "default";
|
||||
@@ -587,7 +588,7 @@ QuestInterface *QuestParserCollection::GetQIByNPCQuest(uint32 npcid, std::string
|
||||
}
|
||||
|
||||
//last look for /quests/global/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/";
|
||||
filename += "default";
|
||||
@@ -615,7 +616,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
||||
return nullptr;
|
||||
|
||||
//first look for /quests/zone/player_v[instance_version].ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/";
|
||||
filename += "player_v";
|
||||
@@ -640,7 +641,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
||||
}
|
||||
|
||||
//second look for /quests/zone/player.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/";
|
||||
filename += "player";
|
||||
@@ -662,7 +663,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
||||
}
|
||||
|
||||
//third look for /quests/global/player.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/";
|
||||
filename += "player";
|
||||
@@ -687,7 +688,7 @@ QuestInterface *QuestParserCollection::GetQIByPlayerQuest(std::string &filename)
|
||||
|
||||
QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filename) {
|
||||
// simply look for /quests/global/global_npc.ext
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/";
|
||||
filename += "global_npc";
|
||||
@@ -715,7 +716,7 @@ QuestInterface *QuestParserCollection::GetQIByGlobalNPCQuest(std::string &filena
|
||||
|
||||
QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &filename) {
|
||||
//first look for /quests/global/player.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/";
|
||||
filename += "global_player";
|
||||
@@ -743,7 +744,7 @@ QuestInterface *QuestParserCollection::GetQIByGlobalPlayerQuest(std::string &fil
|
||||
|
||||
QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::string &filename) {
|
||||
//first look for /quests/zone/spells/spell_id.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/spells/";
|
||||
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)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/spells/";
|
||||
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)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/spells/default";
|
||||
|
||||
@@ -810,7 +811,7 @@ QuestInterface *QuestParserCollection::GetQIBySpellQuest(uint32 spell_id, std::s
|
||||
}
|
||||
|
||||
//last look for /quests/global/spells/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
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) {
|
||||
//first look for /quests/zone/items/item_script.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/items/";
|
||||
filename += item_script;
|
||||
@@ -859,7 +860,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
}
|
||||
|
||||
//second look for /quests/global/items/item_script.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/items/";
|
||||
filename += item_script;
|
||||
@@ -881,7 +882,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
}
|
||||
|
||||
//third look for /quests/zone/items/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/items/default";
|
||||
|
||||
@@ -902,7 +903,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
}
|
||||
|
||||
//last look for /quests/global/items/default.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/items/default";
|
||||
|
||||
@@ -927,7 +928,7 @@ QuestInterface *QuestParserCollection::GetQIByItemQuest(std::string item_script,
|
||||
|
||||
QuestInterface *QuestParserCollection::GetQIByEncounterQuest(std::string encounter_name, std::string &filename) {
|
||||
//first look for /quests/zone/encounters/encounter_name.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += zone->GetShortName();
|
||||
filename += "/encounters/";
|
||||
filename += encounter_name;
|
||||
@@ -951,7 +952,7 @@ QuestInterface *QuestParserCollection::GetQIByEncounterQuest(std::string encount
|
||||
}
|
||||
|
||||
//second look for /quests/global/encounters/encounter_name.ext (precedence)
|
||||
filename = "quests/";
|
||||
filename = Config->QuestDir;
|
||||
filename += QUEST_GLOBAL_DIRECTORY;
|
||||
filename += "/encounters/";
|
||||
filename += encounter_name;
|
||||
@@ -1077,4 +1078,4 @@ void QuestParserCollection::LoadPerlEventExportSettings(PerlEventExportSettings*
|
||||
perl_event_export_settings[event_id].event_variables = atoi(row[6]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,12 +34,15 @@
|
||||
|
||||
#include "quest_interface.h"
|
||||
|
||||
#include "zone_config.h"
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#define QuestFailedToLoad 0xFFFFFFFF
|
||||
#define QuestUnloaded 0x00
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
class Client;
|
||||
class ItemInst;
|
||||
class Mob;
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
|
||||
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");
|
||||
if(f) {
|
||||
char magic[10];
|
||||
@@ -57,4 +57,4 @@ WaterMap* WaterMap::LoadWaterMapfile(std::string zone_name) {
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
|
||||
#include "../common/types.h"
|
||||
#include "position.h"
|
||||
#include "zone_config.h"
|
||||
#include <string>
|
||||
|
||||
extern const ZoneConfig *Config;
|
||||
|
||||
enum WaterRegionType {
|
||||
RegionTypeUnsupported = -2,
|
||||
|
||||
Reference in New Issue
Block a user