Convert world debugging _log to logger.LogDebugType

This commit is contained in:
Akkadius 2015-01-12 22:28:16 -06:00
parent bc02d7c31a
commit 6e11baf308
17 changed files with 164 additions and 164 deletions

View File

@ -83,7 +83,7 @@ int main() {
Config->QSDatabasePassword.c_str(),
Config->QSDatabaseDB.c_str(),
Config->QSDatabasePort)) {
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection.");
return 1;
}

View File

@ -104,14 +104,14 @@ int main() {
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection.");
return 1;
}
char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
_log(WORLD__INIT, "Loading rule set '%s'", tmp);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
_log(UCS__ERROR, "Failed to load ruleset '%s', falling back to defaults.", tmp);
}

View File

@ -1519,7 +1519,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
if (!cc)
return false;
_log(WORLD__CLIENT, "Validating char creation info...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Validating char creation info...");
RaceClassCombos class_combo;
bool found = false;
@ -1536,7 +1536,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
}
if (!found) {
_log(WORLD__CLIENT_ERR, "Could not find class/race/deity/start_zone combination");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find class/race/deity/start_zone combination");
return false;
}
@ -1553,7 +1553,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
}
if (!found) {
_log(WORLD__CLIENT_ERR, "Could not find starting stats for selected character combo, cannot verify stats");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not find starting stats for selected character combo, cannot verify stats");
return false;
}
@ -1566,37 +1566,37 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
allocation.DefaultPointAllocation[6];
if (cc->STR > allocation.BaseStats[0] + max_stats || cc->STR < allocation.BaseStats[0]) {
_log(WORLD__CLIENT_ERR, "Strength out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Strength out of range");
return false;
}
if (cc->DEX > allocation.BaseStats[1] + max_stats || cc->DEX < allocation.BaseStats[1]) {
_log(WORLD__CLIENT_ERR, "Dexterity out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Dexterity out of range");
return false;
}
if (cc->AGI > allocation.BaseStats[2] + max_stats || cc->AGI < allocation.BaseStats[2]) {
_log(WORLD__CLIENT_ERR, "Agility out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Agility out of range");
return false;
}
if (cc->STA > allocation.BaseStats[3] + max_stats || cc->STA < allocation.BaseStats[3]) {
_log(WORLD__CLIENT_ERR, "Stamina out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Stamina out of range");
return false;
}
if (cc->INT > allocation.BaseStats[4] + max_stats || cc->INT < allocation.BaseStats[4]) {
_log(WORLD__CLIENT_ERR, "Intelligence out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Intelligence out of range");
return false;
}
if (cc->WIS > allocation.BaseStats[5] + max_stats || cc->WIS < allocation.BaseStats[5]) {
_log(WORLD__CLIENT_ERR, "Wisdom out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Wisdom out of range");
return false;
}
if (cc->CHA > allocation.BaseStats[6] + max_stats || cc->CHA < allocation.BaseStats[6]) {
_log(WORLD__CLIENT_ERR, "Charisma out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Charisma out of range");
return false;
}
@ -1609,7 +1609,7 @@ bool CheckCharCreateInfoSoF(CharCreate_Struct *cc)
current_stats += cc->WIS - allocation.BaseStats[5];
current_stats += cc->CHA - allocation.BaseStats[6];
if (current_stats > max_stats) {
_log(WORLD__CLIENT_ERR, "Current Stats > Maximum Stats");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Current Stats > Maximum Stats");
return false;
}
@ -1690,7 +1690,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
if (!cc)
return false;
_log(WORLD__CLIENT,"Validating char creation info...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Validating char creation info...");
classtemp = cc->class_ - 1;
racetemp = cc->race - 1;
@ -1703,16 +1703,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
// if out of range looking it up in the table would crash stuff
// so we return from these
if (classtemp >= PLAYER_CLASS_COUNT) {
_log(WORLD__CLIENT_ERR," class is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," class is out of range");
return false;
}
if (racetemp >= _TABLE_RACES) {
_log(WORLD__CLIENT_ERR," race is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," race is out of range");
return false;
}
if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs?
_log(WORLD__CLIENT_ERR," invalid race/class combination");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," invalid race/class combination");
// we return from this one, since if it's an invalid combination our table
// doesn't have meaningful values for the stats
return false;
@ -1740,43 +1740,43 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
// that are messed up not just the first hit
if (bTOTAL + stat_points != cTOTAL) {
_log(WORLD__CLIENT_ERR," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat points total doesn't match expected value: expecting %d got %d", bTOTAL + stat_points, cTOTAL);
Charerrors++;
}
if (cc->STR > bSTR + stat_points || cc->STR < bSTR) {
_log(WORLD__CLIENT_ERR," stat STR is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STR is out of range");
Charerrors++;
}
if (cc->STA > bSTA + stat_points || cc->STA < bSTA) {
_log(WORLD__CLIENT_ERR," stat STA is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat STA is out of range");
Charerrors++;
}
if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) {
_log(WORLD__CLIENT_ERR," stat AGI is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat AGI is out of range");
Charerrors++;
}
if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) {
_log(WORLD__CLIENT_ERR," stat DEX is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat DEX is out of range");
Charerrors++;
}
if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) {
_log(WORLD__CLIENT_ERR," stat WIS is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat WIS is out of range");
Charerrors++;
}
if (cc->INT > bINT + stat_points || cc->INT < bINT) {
_log(WORLD__CLIENT_ERR," stat INT is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat INT is out of range");
Charerrors++;
}
if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) {
_log(WORLD__CLIENT_ERR," stat CHA is out of range");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," stat CHA is out of range");
Charerrors++;
}
/*TODO: Check for deity/class/race.. it'd be nice, but probably of any real use to hack(faction, deity based items are all I can think of)
I am NOT writing those tables - kathgar*/
_log(WORLD__CLIENT,"Found %d errors in character creation request", Charerrors);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found %d errors in character creation request", Charerrors);
return Charerrors == 0;
}

View File

@ -267,7 +267,7 @@ bool ClientListEntry::CheckAuth(uint32 iLSID, const char* iKey) {
int16 tmpStatus = WorldConfig::get()->DefaultStatus;
paccountid = database.CreateAccount(plsname, 0, tmpStatus, LSID());
if (!paccountid) {
_log(WORLD__CLIENTLIST_ERR,"Error adding local account for LS login: '%s', duplicate name?" ,plsname);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Error adding local account for LS login: '%s', duplicate name?" ,plsname);
return false;
}
strn0cpy(paccountname, plsname, sizeof(paccountname));

View File

@ -56,7 +56,7 @@ void ClientList::Process() {
if (!iterator.GetData()->Process()) {
struct in_addr in;
in.s_addr = iterator.GetData()->GetIP();
_log(WORLD__CLIENTLIST,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing client from %s:%d", inet_ntoa(in), iterator.GetData()->GetPort());
//the client destructor should take care of this.
// iterator.GetData()->Free();
iterator.RemoveCurrent();
@ -425,7 +425,7 @@ ClientListEntry* ClientList::CheckAuth(const char* iName, const char* iPassword)
}
int16 tmpadmin;
//_log(WORLD__ZONELIST,"Login with '%s' and '%s'", iName, iPassword);
//logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login with '%s' and '%s'", iName, iPassword);
uint32 accid = database.CheckLogin(iName, iPassword, &tmpadmin);
if (accid) {
@ -447,7 +447,7 @@ void ClientList::SendOnlineGuildMembers(uint32 FromID, uint32 GuildID)
if(!from)
{
_log(WORLD__CLIENT_ERR,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Invalid client. FromID=%i GuildID=%i", FromID, GuildID);
return;
}
@ -751,7 +751,7 @@ void ClientList::SendWhoAll(uint32 fromid,const char* to, int16 admin, Who_All_S
safe_delete(output);
}
catch(...){
_log(WORLD__ZONELIST_ERR,"Unknown error in world's SendWhoAll (probably mem error), ignoring...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendWhoAll (probably mem error), ignoring...");
return;
}
}
@ -895,7 +895,7 @@ void ClientList::SendFriendsWho(ServerFriendsWho_Struct *FriendsWho, WorldTCPCon
safe_delete(pack2);
}
catch(...){
_log(WORLD__ZONELIST_ERR,"Unknown error in world's SendFriendsWho (probably mem error), ignoring...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unknown error in world's SendFriendsWho (probably mem error), ignoring...");
return;
}
}
@ -1130,7 +1130,7 @@ Client* ClientList::FindByAccountID(uint32 account_id) {
iterator.Reset();
while(iterator.MoreElements()) {
_log(WORLD__CLIENTLIST, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByAccountID(%p) iterator.GetData()[%p]", this, account_id, iterator.GetData());
if (iterator.GetData()->GetAccountID() == account_id) {
Client* tmp = iterator.GetData();
return tmp;
@ -1145,7 +1145,7 @@ Client* ClientList::FindByName(char* charname) {
iterator.Reset();
while(iterator.MoreElements()) {
_log(WORLD__CLIENTLIST, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "ClientList[0x%08x]::FindByName(\"%s\") iterator.GetData()[%p]", this, charname, iterator.GetData());
if (iterator.GetData()->GetCharName() == charname) {
Client* tmp = iterator.GetData();
return tmp;

View File

@ -88,7 +88,7 @@ void Console::Die() {
state = CONSOLE_STATE_CLOSED;
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"Removing console from %s:%d",inet_ntoa(in),GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console from %s:%d",inet_ntoa(in),GetPort());
tcpc->Disconnect();
}
@ -219,7 +219,7 @@ bool Console::Process() {
if (!tcpc->Connected()) {
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing console (!tcpc->Connected) from %s:%d",inet_ntoa(in),GetPort());
return false;
}
//if we have not gotten the special markers after this timer, send login prompt
@ -234,7 +234,7 @@ bool Console::Process() {
SendMessage(1, "Timeout, disconnecting...");
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__CONSOLE,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP connection timeout from %s:%d",inet_ntoa(in),GetPort());
return false;
}
@ -243,29 +243,29 @@ bool Console::Process() {
in.s_addr = GetIP();
if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeZone) {
auto zs = new ZoneServer(tcpc);
_log(WORLD__CONSOLE,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New zoneserver #%d from %s:%d", zs->GetID(), inet_ntoa(in), GetPort());
zoneserver_list.Add(zs);
numzones++;
tcpc = 0;
} else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeLauncher) {
_log(WORLD__CONSOLE,"New launcher from %s:%d", inet_ntoa(in), GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New launcher from %s:%d", inet_ntoa(in), GetPort());
launcher_list.Add(tcpc);
tcpc = 0;
}
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeUCS)
{
_log(WORLD__CONSOLE,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New UCS Connection from %s:%d", inet_ntoa(in), GetPort());
UCSLink.SetConnection(tcpc);
tcpc = 0;
}
else if(tcpc->GetPacketMode() == EmuTCPConnection::packetModeQueryServ)
{
_log(WORLD__CONSOLE,"New QS Connection from %s:%d", inet_ntoa(in), GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"New QS Connection from %s:%d", inet_ntoa(in), GetPort());
QSLink.SetConnection(tcpc);
tcpc = 0;
}
else {
_log(WORLD__CONSOLE,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Unsupported packet mode from %s:%d", inet_ntoa(in), GetPort());
}
return false;
}
@ -422,7 +422,7 @@ void Console::ProcessCommand(const char* command) {
state = CONSOLE_STATE_CLOSED;
return;
}
_log(WORLD__CONSOLE,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP console authenticated: Username=%s, Admin=%d",paccountname,admin);
SendMessage(1, 0);
SendMessage(2, "Login accepted.");
state = CONSOLE_STATE_CONNECTED;
@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) {
break;
}
case CONSOLE_STATE_CONNECTED: {
_log(WORLD__CONSOLE,"TCP command: %s: \"%s\"",paccountname,command);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"TCP command: %s: \"%s\"",paccountname,command);
Seperator sep(command);
if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) {
SendMessage(1, " whoami");
@ -719,7 +719,7 @@ void Console::ProcessCommand(const char* command) {
tmpname[0] = '*';
strcpy(&tmpname[1], paccountname);
_log(WORLD__CONSOLE,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Console ZoneBootup: %s, %s, %s",tmpname,sep.arg[2],sep.arg[1]);
zoneserver_list.SOPZoneBootup(tmpname, atoi(sep.arg[1]), sep.arg[2], (bool) (strcasecmp(sep.arg[3], "static") == 0));
}
}
@ -803,7 +803,7 @@ void Console::ProcessCommand(const char* command) {
#endif
RunLoops = true;
SendMessage(1, " Login Server Reconnect manually restarted by Console");
_log(WORLD__CONSOLE,"Login Server Reconnect manually restarted by Console");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Console");
}
else if (strcasecmp(sep.arg[0], "zonelock") == 0 && admin >= consoleZoneStatus) {
if (strcasecmp(sep.arg[1], "list") == 0) {

View File

@ -75,11 +75,11 @@ EQW::EQW() {
void EQW::AppendOutput(const char *str) {
m_outputBuffer += str;
// _log(WORLD__EQW, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length());
// logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Append %d chars, yeilding result of length %d", strlen(str), m_outputBuffer.length());
}
const std::string &EQW::GetOutput() const {
// _log(WORLD__EQW, "Getting, length %d", m_outputBuffer.length());
// logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Getting, length %d", m_outputBuffer.length());
return(m_outputBuffer);
}
@ -269,7 +269,7 @@ void EQW::LSReconnect() {
pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr);
#endif
RunLoops = true;
_log(WORLD__CONSOLE,"Login Server Reconnect manually restarted by Web Tool");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Login Server Reconnect manually restarted by Web Tool");
}
/*EQLConfig * EQW::FindLauncher(Const_char *zone_ref) {

View File

@ -139,11 +139,11 @@ bool EQWHTTPHandler::CheckAuth() const {
int16 status = 0;
uint32 acctid = database.CheckLogin(m_username.c_str(), m_password.c_str(), &status);
if(acctid == 0) {
_log(WORLD__HTTP_ERR, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login autentication failed for %s with '%s'", m_username.c_str(), m_password.c_str());
return(false);
}
if(status < httpLoginStatus) {
_log(WORLD__HTTP_ERR, "Login of %s failed: status too low.", m_username.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login of %s failed: status too low.", m_username.c_str());
return(false);
}
@ -278,29 +278,29 @@ void EQWHTTPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP
}
void EQWHTTPServer::Stop() {
_log(WORLD__HTTP, "Requesting that HTTP Service stop.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requesting that HTTP Service stop.");
m_running = false;
Close();
}
bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
if(m_running) {
_log(WORLD__HTTP_ERR, "HTTP Service is already running on port %d", m_port);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Service is already running on port %d", m_port);
return(false);
}
//load up our nice mime types
if(!EQWHTTPHandler::LoadMimeTypes(mime_file)) {
_log(WORLD__HTTP_ERR, "Failed to load mime types from '%s'", mime_file);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load mime types from '%s'", mime_file);
return(false);
} else {
_log(WORLD__HTTP, "Loaded mime types from %s", mime_file);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded mime types from %s", mime_file);
}
//fire up the server thread
char errbuf[TCPServer_ErrorBufferSize];
if(!Open(port, errbuf)) {
_log(WORLD__HTTP_ERR, "Unable to bind to port %d for HTTP service: %s", port, errbuf);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to bind to port %d for HTTP service: %s", port, errbuf);
return(false);
}
@ -320,12 +320,12 @@ bool EQWHTTPServer::Start(uint16 port, const char *mime_file) {
/*
void EQWHTTPServer::Run() {
_log(WORLD__HTTP, "HTTP Processing thread started on port %d", m_port);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread started on port %d", m_port);
do {
#warning DELETE THIS IF YOU DONT USE IT
Sleep(10);
} while(m_running);
_log(WORLD__HTTP, "HTTP Processing thread terminating on port %d", m_port);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP Processing thread terminating on port %d", m_port);
}
ThreadReturnType EQWHTTPServer::ThreadProc(void *data) {

View File

@ -65,7 +65,7 @@ EQWParser::EQWParser() {
my_perl = perl_alloc();
_empty_sv = newSV(0);
if(!my_perl)
_log(WORLD__PERL_ERR, "Error: perl_alloc failed!");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: perl_alloc failed!");
else
DoInit();
}
@ -182,10 +182,10 @@ void EQWParser::DoInit() {
#ifdef EMBPERL_PLUGIN
_log(WORLD__PERL, "Loading worldui perl plugins.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading worldui perl plugins.");
std::string err;
if(!eval_file("world", "worldui.pl", err)) {
_log(WORLD__PERL_ERR, "Warning - world.pl: %s", err.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning - world.pl: %s", err.c_str());
}
eval_pv(

View File

@ -79,7 +79,7 @@ bool LauncherLink::Process() {
else {
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__LAUNCH_ERR, "Launcher authorization failed.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
@ -90,7 +90,7 @@ bool LauncherLink::Process() {
else {
struct in_addr in;
in.s_addr = GetIP();
_log(WORLD__LAUNCH_ERR, "Launcher authorization failed.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher authorization failed.");
auto pack = new ServerPacket(ServerOP_ZAAuthFailed);
SendPacket(pack);
delete pack;
@ -100,7 +100,7 @@ bool LauncherLink::Process() {
}
else
{
_log(WORLD__LAUNCH,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
authenticated = true;
}
delete pack;
@ -114,25 +114,25 @@ bool LauncherLink::Process() {
break;
}
case ServerOP_ZAAuth: {
_log(WORLD__LAUNCH, "Got authentication from %s when they are already authenticated.", m_name.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Got authentication from %s when they are already authenticated.", m_name.c_str());
break;
}
case ServerOP_LauncherConnectInfo: {
const LauncherConnectInfo *it = (const LauncherConnectInfo *) pack->pBuffer;
if(HasName()) {
_log(WORLD__LAUNCH_ERR, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher '%s' received an additional connect packet with name '%s'. Ignoring.", m_name.c_str(), it->name);
break;
}
m_name = it->name;
EQLConfig *config = launcher_list.GetConfig(m_name.c_str());
if(config == nullptr) {
_log(WORLD__LAUNCH, "Unknown launcher '%s' connected. Disconnecting.", it->name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown launcher '%s' connected. Disconnecting.", it->name);
Disconnect();
break;
}
_log(WORLD__LAUNCH, "Launcher Identified itself as '%s'. Loading zone list.", it->name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Launcher Identified itself as '%s'. Loading zone list.", it->name);
std::vector<LauncherZone> result;
//database.GetLauncherZones(it->name, result);
@ -146,7 +146,7 @@ bool LauncherLink::Process() {
zs.port = cur->port;
zs.up = false;
zs.starts = 0;
_log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), cur->name.c_str(), zs.port);
m_states[cur->name] = zs;
}
@ -162,17 +162,17 @@ bool LauncherLink::Process() {
std::map<std::string, ZoneState>::iterator res;
res = m_states.find(it->short_name);
if(res == m_states.end()) {
_log(WORLD__LAUNCH_ERR, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: reported state for zone %s which it does not have.", m_name.c_str(), it->short_name);
break;
}
_log(WORLD__LAUNCH, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: %s reported state %s (%d starts)", m_name.c_str(), it->short_name, it->running?"STARTED":"STOPPED", it->start_count);
res->second.up = it->running;
res->second.starts = it->start_count;
break;
}
default:
{
_log(WORLD__LAUNCH_ERR, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown ServerOPcode from launcher 0x%04x, size %d",pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
@ -200,7 +200,7 @@ void LauncherLink::BootZone(const char *short_name, uint16 port) {
zs.port = port;
zs.up = false;
zs.starts = 0;
_log(WORLD__LAUNCH_TRACE, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "%s: Loaded zone '%s' on port %d", m_name.c_str(), short_name, zs.port);
m_states[short_name] = zs;
StartZone(short_name);

View File

@ -60,7 +60,7 @@ void LauncherList::Process() {
//printf("ProcP %d: %p\n", l->GetID(), l);
if(!l->Process()) {
//launcher has died before it identified itself.
_log(WORLD__LAUNCH, "Removing pending launcher %d", l->GetID());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d", l->GetID());
cur = m_pendingLaunchers.erase(cur);
delete l;
} else if(l->HasName()) {
@ -72,10 +72,10 @@ void LauncherList::Process() {
std::map<std::string, LauncherLink *>::iterator res;
res = m_launchers.find(name);
if(res != m_launchers.end()) {
_log(WORLD__LAUNCH, "Ghosting launcher %s", name.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Ghosting launcher %s", name.c_str());
delete res->second;
}
_log(WORLD__LAUNCH, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing pending launcher %d. Adding %s to active list.", l->GetID(), name.c_str());
//put the launcher in the list.
m_launchers[name] = l;
} else {
@ -91,7 +91,7 @@ void LauncherList::Process() {
//printf("Proc %s(%d): %p\n", l->GetName(), l->GetID(), l);
if(!l->Process()) {
//launcher has died before it identified itself.
_log(WORLD__LAUNCH, "Removing launcher %s (%d)", l->GetName(), l->GetID());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Removing launcher %s (%d)", l->GetName(), l->GetID());
curl = m_launchers.erase(curl);
delete l;
} else {
@ -131,7 +131,7 @@ LauncherLink *LauncherList::FindByZone(const char *short_name) {
void LauncherList::Add(EmuTCPConnection *conn) {
auto it = new LauncherLink(nextID++, conn);
_log(WORLD__LAUNCH, "Adding pending launcher %d", it->GetID());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Adding pending launcher %d", it->GetID());
m_pendingLaunchers.push_back(it);
}

View File

@ -96,7 +96,7 @@ bool LoginServer::Process() {
ServerPacket *pack = 0;
while((pack = tcpc->PopPacket()))
{
_log(WORLD__LS_TRACE,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Recevied ServerPacket from LS OpCode 0x04x",pack->opcode);
_hex(WORLD__LS_TRACE,pack->pBuffer,pack->size);
switch(pack->opcode) {
@ -160,12 +160,12 @@ bool LoginServer::Process() {
case ServerOP_LSFatalError: {
#ifndef IGNORE_LS_FATAL_ERROR
WorldConfig::DisableLoginserver();
_log(WORLD__LS_ERR, "Login server responded with FatalError. Disabling reconnect.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError. Disabling reconnect.");
#else
_log(WORLD__LS_ERR, "Login server responded with FatalError.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Login server responded with FatalError.");
#endif
if (pack->size > 1) {
_log(WORLD__LS_ERR, " %s",pack->pBuffer);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, " %s",pack->pBuffer);
}
break;
}
@ -177,18 +177,18 @@ bool LoginServer::Process() {
case ServerOP_LSRemoteAddr: {
if (!Config->WorldAddress.length()) {
WorldConfig::SetWorldAddress((char *)pack->pBuffer);
_log(WORLD__LS, "Loginserver provided %s as world address",pack->pBuffer);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loginserver provided %s as world address",pack->pBuffer);
}
break;
}
case ServerOP_LSAccountUpdate: {
_log(WORLD__LS, "Received ServerOP_LSAccountUpdate packet from loginserver");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Received ServerOP_LSAccountUpdate packet from loginserver");
CanAccountUpdate = true;
break;
}
default:
{
_log(WORLD__LS_ERR, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unknown LSOpCode: 0x%04x size=%d",(int)pack->opcode,pack->size);
DumpPacket(pack->pBuffer, pack->size);
break;
}
@ -202,10 +202,10 @@ bool LoginServer::Process() {
bool LoginServer::InitLoginServer() {
if(Connected() == false) {
if(ConnectReady()) {
_log(WORLD__LS, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to login server: %s:%d",LoginServerAddress,LoginServerPort);
Connect();
} else {
_log(WORLD__LS_ERR, "Not connected but not ready to connect, this is bad: %s:%d",
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Not connected but not ready to connect, this is bad: %s:%d",
LoginServerAddress,LoginServerPort);
}
}
@ -216,29 +216,29 @@ bool LoginServer::Connect() {
char tmp[25];
if(database.GetVariable("loginType",tmp,sizeof(tmp)) && strcasecmp(tmp,"MinILogin") == 0){
minilogin = true;
_log(WORLD__LS, "Setting World to MiniLogin Server type");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Setting World to MiniLogin Server type");
}
else
minilogin = false;
if (minilogin && WorldConfig::get()->WorldAddress.length()==0) {
_log(WORLD__LS_ERR, "**** For minilogin to work, you need to set the <address> element in the <world> section.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "**** For minilogin to work, you need to set the <address> element in the <world> section.");
return false;
}
char errbuf[TCPConnection_ErrorBufferSize];
if ((LoginServerIP = ResolveIP(LoginServerAddress, errbuf)) == 0) {
_log(WORLD__LS_ERR, "Unable to resolve '%s' to an IP.",LoginServerAddress);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to resolve '%s' to an IP.",LoginServerAddress);
return false;
}
if (LoginServerIP == 0 || LoginServerPort == 0) {
_log(WORLD__LS_ERR, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connect info incomplete, cannot connect: %s:%d",LoginServerAddress,LoginServerPort);
return false;
}
if (tcpc->ConnectIP(LoginServerIP, LoginServerPort, errbuf)) {
_log(WORLD__LS, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connected to Loginserver: %s:%d",LoginServerAddress,LoginServerPort);
if (minilogin)
SendInfo();
else
@ -248,7 +248,7 @@ bool LoginServer::Connect() {
return true;
}
else {
_log(WORLD__LS_ERR, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not connect to login server: %s:%d %s",LoginServerAddress,LoginServerPort,errbuf);
return false;
}
}
@ -324,7 +324,7 @@ void LoginServer::SendStatus() {
void LoginServer::SendAccountUpdate(ServerPacket* pack) {
ServerLSAccountUpdate_Struct* s = (ServerLSAccountUpdate_Struct *) pack->pBuffer;
if(CanUpdate()) {
_log(WORLD__LS, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Sending ServerOP_LSAccountUpdate packet to loginserver: %s:%d",LoginServerAddress,LoginServerPort);
strn0cpy(s->worldaccount, LoginAccount, 30);
strn0cpy(s->worldpassword, LoginPassword, 30);
SendPacket(pack);

View File

@ -134,7 +134,7 @@ bool LoginServerList::SendPacket(ServerPacket* pack) {
bool LoginServerList::SendAccountUpdate(ServerPacket* pack) {
LinkedListIterator<LoginServer*> iterator(list);
_log(WORLD__LS, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Requested to send ServerOP_LSAccountUpdate packet to all loginservers");
iterator.Reset();
while(iterator.MoreElements()){
if(iterator.GetData()->CanUpdate()) {

View File

@ -126,36 +126,36 @@ int main(int argc, char** argv) {
}
// Load server configuration
_log(WORLD__INIT, "Loading server configuration..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration..");
if (!WorldConfig::LoadConfig()) {
_log(WORLD__INIT_ERR, "Loading server configuration failed.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading server configuration failed.");
return 1;
}
const WorldConfig *Config=WorldConfig::get();
if(!load_log_settings(Config->LogSettingsFile.c_str()))
_log(WORLD__INIT, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Warning: Unable to read %s", Config->LogSettingsFile.c_str());
else
_log(WORLD__INIT, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Log settings loaded from %s", Config->LogSettingsFile.c_str());
_log(WORLD__INIT, "CURRENT_VERSION: %s", CURRENT_VERSION);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "CURRENT_VERSION: %s", CURRENT_VERSION);
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler");
return 1;
}
if (signal(SIGTERM, CatchSignal) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler");
return 1;
}
#ifndef WIN32
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
_log(WORLD__INIT_ERR, "Could not set signal handler");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Could not set signal handler");
return 1;
}
#endif
@ -164,7 +164,7 @@ int main(int argc, char** argv) {
if (Config->LoginCount == 0) {
if (Config->LoginHost.length()) {
loginserverlist.Add(Config->LoginHost.c_str(), Config->LoginPort, Config->LoginAccount.c_str(), Config->LoginPassword.c_str());
_log(WORLD__INIT, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", Config->LoginHost.c_str(), Config->LoginPort);
}
} else {
LinkedList<LoginConfig*> loginlist=Config->loginlist;
@ -172,19 +172,19 @@ int main(int argc, char** argv) {
iterator.Reset();
while(iterator.MoreElements()) {
loginserverlist.Add(iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort, iterator.GetData()->LoginAccount.c_str(), iterator.GetData()->LoginPassword.c_str());
_log(WORLD__INIT, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Added loginserver %s:%i", iterator.GetData()->LoginHost.c_str(), iterator.GetData()->LoginPort);
iterator.Advance();
}
}
_log(WORLD__INIT, "Connecting to MySQL...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connecting to MySQL...");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort)) {
_log(WORLD__INIT_ERR, "Cannot continue without a database connection.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Cannot continue without a database connection.");
return 1;
}
guild_mgr.SetDatabase(&database);
@ -280,56 +280,56 @@ int main(int argc, char** argv) {
}
if(Config->WorldHTTPEnabled) {
_log(WORLD__INIT, "Starting HTTP world service...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Starting HTTP world service...");
http_server.Start(Config->WorldHTTPPort, Config->WorldHTTPMimeFile.c_str());
} else {
_log(WORLD__INIT, "HTTP world service disabled.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "HTTP world service disabled.");
}
_log(WORLD__INIT, "Checking Database Conversions..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking Database Conversions..");
database.CheckDatabaseConversions();
_log(WORLD__INIT, "Loading variables..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading variables..");
database.LoadVariables();
_log(WORLD__INIT, "Loading zones..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading zones..");
database.LoadZoneNames();
_log(WORLD__INIT, "Clearing groups..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing groups..");
database.ClearGroup();
_log(WORLD__INIT, "Clearing raids..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing raids..");
database.ClearRaid();
database.ClearRaidDetails();
database.ClearRaidLeader();
_log(WORLD__INIT, "Loading items..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading items..");
if (!database.LoadItems())
_log(WORLD__INIT_ERR, "Error: Could not load item data. But ignoring");
_log(WORLD__INIT, "Loading skill caps..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load item data. But ignoring");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading skill caps..");
if (!database.LoadSkillCaps())
_log(WORLD__INIT_ERR, "Error: Could not load skill cap data. But ignoring");
_log(WORLD__INIT, "Loading guilds..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Error: Could not load skill cap data. But ignoring");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading guilds..");
guild_mgr.LoadGuilds();
//rules:
{
char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
_log(WORLD__INIT, "Loading rule set '%s'", tmp);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
_log(WORLD__INIT_ERR, "Failed to load ruleset '%s', falling back to defaults.", tmp);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Failed to load ruleset '%s', falling back to defaults.", tmp);
}
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
_log(WORLD__INIT, "No rule set configured, using default rules");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "No rule set configured, using default rules");
} else {
_log(WORLD__INIT, "Loaded default rule set 'default'", tmp);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loaded default rule set 'default'", tmp);
}
}
}
if(RuleB(World, ClearTempMerchantlist)){
_log(WORLD__INIT, "Clearing temporary merchant lists..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Clearing temporary merchant lists..");
database.ClearMerchantTemp();
}
_log(WORLD__INIT, "Loading EQ time of day..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading EQ time of day..");
if (!zoneserver_list.worldclock.loadFile(Config->EQTimeFile.c_str()))
_log(WORLD__INIT_ERR, "Unable to load %s", Config->EQTimeFile.c_str());
_log(WORLD__INIT, "Loading launcher list..");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load %s", Config->EQTimeFile.c_str());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading launcher list..");
launcher_list.LoadList();
char tmp[20];
@ -338,45 +338,45 @@ int main(int argc, char** argv) {
if ((strcasecmp(tmp, "1") == 0)) {
holdzones = true;
}
_log(WORLD__INIT, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
_log(WORLD__INIT, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
_log(WORLD__INIT, "Loading adventures...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading adventures...");
if(!adventure_manager.LoadAdventureTemplates())
{
_log(WORLD__INIT_ERR, "Unable to load adventure templates.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates.");
}
if(!adventure_manager.LoadAdventureEntries())
{
_log(WORLD__INIT_ERR, "Unable to load adventure templates.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Unable to load adventure templates.");
}
adventure_manager.Load();
adventure_manager.LoadLeaderboardInfo();
_log(WORLD__INIT, "Purging expired instances");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Purging expired instances");
database.PurgeExpiredInstances();
Timer PurgeInstanceTimer(450000);
PurgeInstanceTimer.Start(450000);
_log(WORLD__INIT, "Loading char create info...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Loading char create info...");
database.LoadCharacterCreateAllocations();
database.LoadCharacterCreateCombos();
char errbuf[TCPConnection_ErrorBufferSize];
if (tcps.Open(Config->WorldTCPPort, errbuf)) {
_log(WORLD__INIT,"Zone (TCP) listener started.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener started.");
} else {
_log(WORLD__INIT_ERR,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort);
_log(WORLD__INIT_ERR," %s",errbuf);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start zone (TCP) listener on port %d:",Config->WorldTCPPort);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server," %s",errbuf);
return 1;
}
if (eqsf.Open()) {
_log(WORLD__INIT,"Client (UDP) listener started.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener started.");
} else {
_log(WORLD__INIT_ERR,"Failed to start client (UDP) listener (port 9000)");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to start client (UDP) listener (port 9000)");
return 1;
}
@ -404,7 +404,7 @@ int main(int argc, char** argv) {
//structures and opcodes for that patch.
struct in_addr in;
in.s_addr = eqs->GetRemoteIP();
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqs->GetRemotePort()));
stream_identifier.AddStream(eqs); //takes the stream
}
@ -417,19 +417,19 @@ int main(int argc, char** argv) {
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
_log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
_log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
auto client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
} else {
_log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)){
_log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
auto client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
@ -441,7 +441,7 @@ int main(int argc, char** argv) {
while ((tcpc = tcps.NewQueuePop())) {
struct in_addr in;
in.s_addr = tcpc->GetrIP();
_log(WORLD__ZONE, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
console_list.Add(new Console(tcpc));
}
@ -492,16 +492,16 @@ int main(int argc, char** argv) {
}
Sleep(20);
}
_log(WORLD__SHUTDOWN,"World main loop completed.");
_log(WORLD__SHUTDOWN,"Shutting down console connections (if any).");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"World main loop completed.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down console connections (if any).");
console_list.KillAll();
_log(WORLD__SHUTDOWN,"Shutting down zone connections (if any).");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Shutting down zone connections (if any).");
zoneserver_list.KillAll();
_log(WORLD__SHUTDOWN,"Zone (TCP) listener stopped.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Zone (TCP) listener stopped.");
tcps.Close();
_log(WORLD__SHUTDOWN,"Client (UDP) listener stopped.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Client (UDP) listener stopped.");
eqsf.Close();
_log(WORLD__SHUTDOWN,"Signaling HTTP service to stop...");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Signaling HTTP service to stop...");
http_server.Stop();
CheckEQEMuErrorAndPause();
@ -509,9 +509,9 @@ int main(int argc, char** argv) {
}
void CatchSignal(int sig_num) {
_log(WORLD__SHUTDOWN,"Caught signal %d",sig_num);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Caught signal %d",sig_num);
if(zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str())==false)
_log(WORLD__SHUTDOWN,"Failed to save time file.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Failed to save time file.");
RunLoops = false;
}

View File

@ -79,7 +79,7 @@ void ZSList::KillAll() {
void ZSList::Process() {
if(shutdowntimer && shutdowntimer->Check()){
_log(WORLD__ZONELIST, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "Shutdown timer has expired. Telling all zones to shut down and exiting. (fake sigint)");
auto pack2 = new ServerPacket;
pack2->opcode = ServerOP_ShutdownAll;
pack2->size=0;
@ -99,10 +99,10 @@ void ZSList::Process() {
ZoneServer* zs = iterator.GetData();
struct in_addr in;
in.s_addr = zs->GetIP();
_log(WORLD__ZONELIST,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort());
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Removing zoneserver #%d at %s:%d",zs->GetID(),zs->GetCAddress(),zs->GetCPort());
zs->LSShutDownUpdate(zs->GetZoneID());
if (holdzones){
_log(WORLD__ZONELIST,"Hold Zones mode is ON - rebooting lost zone");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Hold Zones mode is ON - rebooting lost zone");
if(!zs->IsStaticZone())
RebootZone(inet_ntoa(in),zs->GetCPort(),zs->GetCAddress(),zs->GetID());
else
@ -576,7 +576,7 @@ void ZSList::RebootZone(const char* ip1,uint16 port,const char* ip2, uint32 skip
s->port = port;
s->zoneid = zoneid;
if(zoneid != 0)
_log(WORLD__ZONELIST,"Rebooting static zone with the ID of: %i",zoneid);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Rebooting static zone with the ID of: %i",zoneid);
tmp[z]->SendPacket(pack);
delete pack;
safe_delete_array(tmp);

View File

@ -209,7 +209,7 @@ bool ZoneServer::Process() {
}
else
{
_log(WORLD__ZONE,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
authenticated = true;
}
}
@ -708,20 +708,20 @@ bool ZoneServer::Process() {
/* Zone was already running*/
if(ingress_server) {
_log(WORLD__ZONE,"Found a zone already booted for %s\n", ztz->name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Found a zone already booted for %s\n", ztz->name);
ztz->response = 1;
}
/* Boot the Zone*/
else {
int server_id;
if ((server_id = zoneserver_list.TriggerBootup(ztz->requested_zone_id, ztz->requested_instance_id))){
_log(WORLD__ZONE,"Successfully booted a zone for %s\n", ztz->name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"Successfully booted a zone for %s\n", ztz->name);
// bootup successful, ready to rock
ztz->response = 1;
ingress_server = zoneserver_list.FindByID(server_id);
}
else {
_log(WORLD__ZONE_ERR,"FAILED to boot a zone for %s\n", ztz->name);
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server,"FAILED to boot a zone for %s\n", ztz->name);
// bootup failed, send back error code 0
ztz->response = 0;
}

View File

@ -385,7 +385,7 @@ int main(int argc, char** argv) {
//structures and opcodes for that patch.
struct in_addr in;
in.s_addr = eqss->GetRemoteIP();
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
stream_identifier.AddStream(eqss); //takes the stream
}
@ -397,7 +397,7 @@ int main(int argc, char** argv) {
//now that we know what patch they are running, start up their client object
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
_log(WORLD__CLIENT, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
logger.LogDebugType(EQEmuLogSys::Detail, EQEmuLogSys::World_Server, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
entity_list.AddClient(client);
}