mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Replace rest of EQEmuLog->write with EQEmuLogSys Log
This commit is contained in:
parent
167e11426f
commit
17d9b9199c
@ -37,22 +37,22 @@ int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||
set_exception_handler();
|
||||
|
||||
LogFile->write(EQEmuLog::Status, "Client Files Export Utility");
|
||||
logger.Log(EQEmuLogSys::Status, "Client Files Export Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to load configuration file.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
LogFile->write(EQEmuLog::Status, "Connecting to database...");
|
||||
logger.Log(EQEmuLogSys::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
@ -65,11 +65,11 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
void ExportSpells(SharedDatabase *db) {
|
||||
LogFile->write(EQEmuLog::Status, "Exporting Spells...");
|
||||
logger.Log(EQEmuLogSys::Status, "Exporting Spells...");
|
||||
|
||||
FILE *f = fopen("export/spells_us.txt", "w");
|
||||
if(!f) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ void ExportSpells(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEmuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
@ -107,7 +107,7 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
|
||||
class_id, skill_id);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
class_id, skill_id, level);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -139,11 +139,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db) {
|
||||
LogFile->write(EQEmuLog::Status, "Exporting Skill Caps...");
|
||||
logger.Log(EQEmuLogSys::Status, "Exporting Skill Caps...");
|
||||
|
||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||
if(!f) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -168,11 +168,11 @@ void ExportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db) {
|
||||
LogFile->write(EQEmuLog::Status, "Exporting Base Data...");
|
||||
logger.Log(EQEmuLogSys::Status, "Exporting Base Data...");
|
||||
|
||||
FILE *f = fopen("export/BaseData.txt", "w");
|
||||
if(!f) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ void ExportBaseData(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEmuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
@ -35,22 +35,22 @@ int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||
set_exception_handler();
|
||||
|
||||
LogFile->write(EQEmuLog::Status, "Client Files Import Utility");
|
||||
logger.Log(EQEmuLogSys::Status, "Client Files Import Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to load configuration file.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
LogFile->write(EQEmuLog::Status, "Connecting to database...");
|
||||
logger.Log(EQEmuLogSys::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
@ -67,7 +67,7 @@ int GetSpellColumns(SharedDatabase *db) {
|
||||
const std::string query = "DESCRIBE spells_new";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -75,10 +75,10 @@ int GetSpellColumns(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportSpells(SharedDatabase *db) {
|
||||
LogFile->write(EQEmuLog::Status, "Importing Spells...");
|
||||
logger.Log(EQEmuLogSys::Status, "Importing Spells...");
|
||||
FILE *f = fopen("import/spells_us.txt", "r");
|
||||
if(!f) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -141,23 +141,23 @@ void ImportSpells(SharedDatabase *db) {
|
||||
|
||||
spells_imported++;
|
||||
if(spells_imported % 1000 == 0) {
|
||||
LogFile->write(EQEmuLog::Status, "%d spells imported.", spells_imported);
|
||||
logger.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
}
|
||||
|
||||
if(spells_imported % 1000 != 0) {
|
||||
LogFile->write(EQEmuLog::Status, "%d spells imported.", spells_imported);
|
||||
logger.Log(EQEmuLogSys::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ImportSkillCaps(SharedDatabase *db) {
|
||||
LogFile->write(EQEmuLog::Status, "Importing Skill Caps...");
|
||||
logger.Log(EQEmuLogSys::Status, "Importing Skill Caps...");
|
||||
|
||||
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||
if(!f) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -189,11 +189,11 @@ void ImportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportBaseData(SharedDatabase *db) {
|
||||
LogFile->write(EQEmuLog::Status, "Importing Base Data...");
|
||||
logger.Log(EQEmuLogSys::Status, "Importing Base Data...");
|
||||
|
||||
FILE *f = fopen("import/BaseData.txt", "r");
|
||||
if(!f) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "debug.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "crash.h"
|
||||
|
||||
#if defined(_WINDOWS) && defined(CRASH_LOGGING)
|
||||
@ -24,7 +25,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
LogFile->write(EQEmuLog::Crash, buffer);
|
||||
logger.Log(EQEmuLogSys::Crash, buffer);
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
};
|
||||
@ -34,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
break;
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
break;
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_BREAKPOINT");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT");
|
||||
break;
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
break;
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
break;
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
break;
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
break;
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
break;
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
break;
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
break;
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
break;
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
break;
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_SINGLE_STEP:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
break;
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
LogFile->write(EQEmuLog::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
logger.Log(EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
break;
|
||||
default:
|
||||
LogFile->write(EQEmuLog::Crash, "Unknown Exception");
|
||||
logger.Log(EQEmuLogSys::Crash, "Unknown Exception");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -84,12 +84,12 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
||||
uint32 errnum= 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||
LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -706,7 +706,7 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
charid = GetCharacterID(pp->name);
|
||||
|
||||
if(!charid) {
|
||||
LogFile->write(EQEmuLog::Error, "StoreCharacter: no character id");
|
||||
logger.Log(EQEmuLogSys::Error, "StoreCharacter: no character id");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -736,10 +736,10 @@ bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inven
|
||||
auto results = QueryDatabase(invquery);
|
||||
|
||||
if (!results.RowsAffected())
|
||||
LogFile->write(EQEmuLog::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str());
|
||||
#if EQDEBUG >= 9
|
||||
else
|
||||
LogFile->write(EQEmuLog::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str());
|
||||
logger.Log(EQEmuLogSys::Debug, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -805,7 +805,7 @@ uint32 Database::GetAccountIDByChar(uint32 char_id) {
|
||||
std::string query = StringFormat("SELECT `account_id` FROM `character_data` WHERE `id` = %i LIMIT 1", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3162,28 +3162,28 @@ void Database::SetLFP(uint32 CharID, bool LFP) {
|
||||
std::string query = StringFormat("UPDATE `character_data` SET `lfp` = %i WHERE `id` = %i",LFP, CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Database::SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon) {
|
||||
std::string query = StringFormat("update `character_data` SET `lfp` = %i, `lfg` = %i, `firstlogon` = %i WHERE `id` = %i",LFP, LFG, firstlogon, CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Database::SetLFG(uint32 CharID, bool LFG) {
|
||||
std::string query = StringFormat("update `character_data` SET `lfg` = %i WHERE `id` = %i",LFG, CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Database::SetFirstLogon(uint32 CharID, uint8 firstlogon) {
|
||||
std::string query = StringFormat( "UPDATE `character_data` SET `firstlogon` = %i WHERE `id` = %i",firstlogon, CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Database::AddReport(std::string who, std::string against, std::string lines) {
|
||||
@ -3195,7 +3195,7 @@ void Database::AddReport(std::string who, std::string against, std::string lines
|
||||
safe_delete_array(escape_str);
|
||||
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc) {
|
||||
@ -3206,7 +3206,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@ -3216,7 +3216,7 @@ void Database::SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ism
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
void Database::ClearAllGroups(void)
|
||||
@ -3255,14 +3255,14 @@ uint32 Database::GetGroupID(const char* name){
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error getting group id: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
// Commenting this out until logging levels can prevent this from going to console
|
||||
//LogFile->write(EQEmuLog::Debug, "Character not in a group: %s", name);
|
||||
//logger.Log(EQEmuLogSys::Debug, "Character not in a group: %s", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3309,7 +3309,7 @@ void Database::SetGroupLeaderName(uint32 gid, const char* name) {
|
||||
result = QueryDatabase(query);
|
||||
|
||||
if(!result.Success()) {
|
||||
LogFile->write(EQEmuLog::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -4049,7 +4049,7 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &ch
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "eq_packet.h"
|
||||
#include "eq_stream.h"
|
||||
#include "op_codes.h"
|
||||
@ -987,7 +988,7 @@ EQRawApplicationPacket *p=nullptr;
|
||||
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
|
||||
#if EQDEBUG >= 4
|
||||
if(emu_op == OP_Unknown) {
|
||||
LogFile->write(EQEmuLog::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
|
||||
logger.Log(EQEmuLogSys::Debug, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
|
||||
}
|
||||
#endif
|
||||
p->SetOpcode(emu_op);
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#include <fstream>
|
||||
#include "../common/debug.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/eqtime.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include <memory.h>
|
||||
@ -140,7 +141,7 @@ bool EQTime::saveFile(const char *filename)
|
||||
of.open(filename);
|
||||
if(!of)
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
|
||||
logger.Log(EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
|
||||
return false;
|
||||
}
|
||||
//Enable for debugging
|
||||
@ -164,14 +165,14 @@ bool EQTime::loadFile(const char *filename)
|
||||
in.open(filename);
|
||||
if(!in)
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Could not load EQTime file %s", filename);
|
||||
logger.Log(EQEmuLogSys::Error, "Could not load EQTime file %s", filename);
|
||||
return false;
|
||||
}
|
||||
in >> version;
|
||||
in.ignore(80, '\n');
|
||||
if(version != EQT_VERSION)
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION);
|
||||
logger.Log(EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION);
|
||||
return false;
|
||||
}
|
||||
//in >> eqTime.start_eqtime.day;
|
||||
|
||||
@ -337,7 +337,7 @@ uint32 BaseGuildManager::_GetFreeGuildID() {
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst)
|
||||
}
|
||||
|
||||
if (result == INVALID_INDEX) {
|
||||
LogFile->write(EQEmuLog::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot);
|
||||
logger.Log(EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot);
|
||||
Inventory::MarkDirty(inst); // Slot not found, clean up
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -168,7 +168,7 @@ bool PersistentTimer::Store(Database *db) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -188,7 +188,7 @@ bool PersistentTimer::Clear(Database *db) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -200,7 +200,7 @@ bool PersistentTimer::Clear(Database *db) {
|
||||
/* This function checks if the timer triggered */
|
||||
bool PersistentTimer::Expired(Database *db, bool iReset) {
|
||||
if (this == nullptr) {
|
||||
LogFile->write(EQEmuLog::Error, "Null timer during ->Check()!?\n");
|
||||
logger.Log(EQEmuLogSys::Error, "Null timer during ->Check()!?\n");
|
||||
return(true);
|
||||
}
|
||||
uint32 current_time = get_current_time();
|
||||
@ -292,7 +292,7 @@ bool PTimerList::Load(Database *db) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -351,7 +351,7 @@ bool PTimerList::Clear(Database *db) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
LogFile->write(EQEmuLog::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -443,7 +443,7 @@ bool PTimerList::ClearOffline(Database *db, uint32 char_id, pTimerType type) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
LogFile->write(EQEmuLog::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) {
|
||||
safe_delete_array(rst);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ std::string RuleManager::GetRulesetName(Database *db, int id) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ bool RuleManager::ListRulesets(Database *db, std::map<int, std::string> &into) {
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ bool SharedDatabase::VerifyInventory(uint32 account_id, int16 slot_id, const Ite
|
||||
account_id, slot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
//returning true is less harmful in the face of a query error
|
||||
return true;
|
||||
}
|
||||
@ -214,7 +214,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i
|
||||
}
|
||||
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst,
|
||||
}
|
||||
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) {
|
||||
std::string query = StringFormat("DELETE FROM inventory WHERE charid = %i AND slotid = %i", char_id, slot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -284,7 +284,7 @@ bool SharedDatabase::DeleteInventorySlot(uint32 char_id, int16 slot_id) {
|
||||
char_id, base_slot_id, (base_slot_id+10));
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) {
|
||||
std::string query = StringFormat("DELETE FROM sharedbank WHERE acctid=%i AND slotid=%i", account_id, slot_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id) {
|
||||
account_id, base_slot_id, (base_slot_id+10));
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
||||
"FROM sharedbank WHERE acctid=%i", id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
||||
const Item_Struct* item = GetItem(item_id);
|
||||
|
||||
if (!item) {
|
||||
LogFile->write(EQEmuLog::Error,
|
||||
logger.Log(EQEmuLogSys::Error,
|
||||
"Warning: %s %i has an invalid item_id %i in inventory slot %i",
|
||||
((is_charid==true) ? "charid" : "acctid"), id, item_id, slot_id);
|
||||
continue;
|
||||
@ -473,7 +473,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) {
|
||||
if (put_slot_id != INVALID_INDEX)
|
||||
continue;
|
||||
|
||||
LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i",
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i",
|
||||
((is_charid==true)? "charid": "acctid"), id, item_id, slot_id);
|
||||
|
||||
if (is_charid)
|
||||
@ -492,8 +492,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
"FROM inventory WHERE charid = %i ORDER BY slotid", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
LogFile->write(EQEmuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
|
||||
logger.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -521,7 +521,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
const Item_Struct* item = GetItem(item_id);
|
||||
|
||||
if (!item) {
|
||||
LogFile->write(EQEmuLog::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id);
|
||||
logger.Log(EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -587,7 +587,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
else if (slot_id >= 3111 && slot_id <= 3179)
|
||||
{
|
||||
// Admins: please report any occurrences of this error
|
||||
LogFile->write(EQEmuLog::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id);
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: Defunct location for item in inventory: charid=%i, item_id=%i, slot_id=%i .. pushing to cursor...", char_id, item_id, slot_id);
|
||||
put_slot_id = inv->PushCursor(*inst);
|
||||
}
|
||||
else
|
||||
@ -599,7 +599,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
|
||||
|
||||
// Save ptr to item in inventory
|
||||
if (put_slot_id == INVALID_INDEX) {
|
||||
LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id);
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -617,8 +617,8 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
|
||||
name, account_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()){
|
||||
LogFile->write(EQEmuLog::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
LogFile->write(EQEmuLog::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
|
||||
logger.Log(EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "If you got an error related to the 'instnodrop' field, run the following SQL Queries:\nalter table inventory add instnodrop tinyint(1) unsigned default 0 not null;\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv)
|
||||
|
||||
// Save ptr to item in inventory
|
||||
if (put_slot_id == INVALID_INDEX)
|
||||
LogFile->write(EQEmuLog::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id);
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: name=%s, acctid=%i, item_id=%i, slot_id=%i", name, account_id, item_id, slot_id);
|
||||
|
||||
}
|
||||
|
||||
@ -720,7 +720,7 @@ void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id) {
|
||||
const std::string query = "SELECT MAX(id), count(*) FROM items";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -760,7 +760,7 @@ bool SharedDatabase::LoadItems() {
|
||||
items_hash = new EQEmu::FixedMemoryHashSet<Item_Struct>(reinterpret_cast<uint8*>(items_mmf->Get()), size);
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Error Loading Items: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Error Loading Items: %s", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -805,7 +805,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
"updated FROM items ORDER BY id";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1018,7 +1018,7 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
try {
|
||||
hash.insert(item.ID, item);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Database::LoadItems: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile)
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
LogFile->write(EQEmuLog::Error, "No book to send, (%s)", txtfile);
|
||||
logger.Log(EQEmuLogSys::Error, "No book to send, (%s)", txtfile);
|
||||
txtout.assign(" ",1);
|
||||
return txtout;
|
||||
}
|
||||
@ -1097,7 +1097,7 @@ void SharedDatabase::GetFactionListInfo(uint32 &list_count, uint32 &max_lists) {
|
||||
const std::string query = "SELECT COUNT(*), MAX(id) FROM npc_faction";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@ void SharedDatabase::LoadNPCFactionLists(void *data, uint32 size, uint32 list_co
|
||||
"ON npc_faction.id = npc_faction_entries.npc_faction_id ORDER BY npc_faction.id;";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1198,7 +1198,7 @@ bool SharedDatabase::LoadNPCFactionLists() {
|
||||
faction_hash = new EQEmu::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), size);
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Error Loading npc factions: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1216,8 +1216,8 @@ ItemInst* SharedDatabase::CreateItem(uint32 item_id, int16 charges, uint32 aug1,
|
||||
inst = CreateBaseItem(item, charges);
|
||||
|
||||
if (inst == nullptr) {
|
||||
LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
|
||||
LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
|
||||
logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1242,8 +1242,8 @@ ItemInst* SharedDatabase::CreateItem(const Item_Struct* item, int16 charges, uin
|
||||
inst = CreateBaseItem(item, charges);
|
||||
|
||||
if (inst == nullptr) {
|
||||
LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
|
||||
LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
|
||||
logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1273,8 +1273,8 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges)
|
||||
inst = new ItemInst(item, charges);
|
||||
|
||||
if (inst == nullptr) {
|
||||
LogFile->write(EQEmuLog::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()");
|
||||
LogFile->write(EQEmuLog::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
logger.Log(EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()");
|
||||
logger.Log(EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1344,7 +1344,7 @@ bool SharedDatabase::LoadSkillCaps() {
|
||||
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Error loading skill caps: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1360,7 +1360,7 @@ void SharedDatabase::LoadSkillCaps(void *data) {
|
||||
const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1462,7 +1462,7 @@ void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpe
|
||||
"AND `spellid` <= %i", iMaxSpellID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() {
|
||||
const std::string query = "SELECT MAX(level) FROM base_data";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1691,7 +1691,7 @@ bool SharedDatabase::LoadBaseData() {
|
||||
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Error Loading Base Data: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1704,7 +1704,7 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) {
|
||||
const std::string query = "SELECT * FROM base_data ORDER BY level, class ASC";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1716,22 +1716,22 @@ void SharedDatabase::LoadBaseData(void *data, int max_level) {
|
||||
cl = atoi(row[1]);
|
||||
|
||||
if(lvl <= 0) {
|
||||
LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.level <= 0, ignoring.");
|
||||
logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(lvl >= max_level) {
|
||||
LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.level >= max_level, ignoring.");
|
||||
logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(cl <= 0) {
|
||||
LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.cl <= 0, ignoring.");
|
||||
logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(cl > 16) {
|
||||
LogFile->write(EQEmuLog::Error, "Non fatal error: base_data.class > 16, ignoring.");
|
||||
logger.Log(EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1784,7 +1784,7 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot
|
||||
const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1806,7 +1806,7 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d
|
||||
const std::string query = "SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1832,7 +1832,7 @@ void SharedDatabase::LoadLootTables(void *data, uint32 size) {
|
||||
"ON loottable.id = loottable_entries.loottable_id ORDER BY id";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1886,7 +1886,7 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) {
|
||||
"ON lootdrop.id = lootdrop_entries.lootdrop_id ORDER BY lootdrop_id";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
uint32 current_id = 0;
|
||||
@ -1940,7 +1940,7 @@ bool SharedDatabase::LoadLoot() {
|
||||
loot_drop_mmf->Size());
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Error loading loot: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Error loading loot: %s", ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1956,7 +1956,7 @@ const LootTable_Struct* SharedDatabase::GetLootTable(uint32 loottable_id) {
|
||||
return &loot_table_hash->at(loottable_id);
|
||||
}
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Could not get loot table: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Could not get loot table: %s", ex.what());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -1970,7 +1970,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) {
|
||||
return &loot_drop_hash->at(lootdrop_id);
|
||||
}
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "Could not get loot drop: %s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() {
|
||||
Timeoutable *it = *cur;
|
||||
if(it->next_check.Check()) {
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
LogFile->write(EQEmuLog::Debug, "Checking timeout on 0x%x\n", it);
|
||||
logger.Log(EQEmuLogSys::Debug, "Checking timeout on 0x%x\n", it);
|
||||
#endif
|
||||
it->CheckTimeout();
|
||||
}
|
||||
@ -58,13 +58,13 @@ void TimeoutManager::AddMember(Timeoutable *who) {
|
||||
DeleteMember(who); //just in case... prolly not needed.
|
||||
members.push_back(who);
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
LogFile->write(EQEmuLog::Debug, "Adding timeoutable 0x%x\n", who);
|
||||
logger.Log(EQEmuLogSys::Debug, "Adding timeoutable 0x%x\n", who);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TimeoutManager::DeleteMember(Timeoutable *who) {
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
LogFile->write(EQEmuLog::Debug, "Removing timeoutable 0x%x\n", who);
|
||||
logger.Log(EQEmuLogSys::Debug, "Removing timeoutable 0x%x\n", who);
|
||||
#endif
|
||||
std::vector<Timeoutable *>::iterator cur,end;
|
||||
cur = members.begin();
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -68,14 +69,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf))
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
HandleMysqlError(errnum);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,22 +39,22 @@ int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
||||
set_exception_handler();
|
||||
|
||||
LogFile->write(EQEmuLog::Status, "Shared Memory Loader Program");
|
||||
logger.Log(EQEmuLogSys::Status, "Shared Memory Loader Program");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to load configuration file.");
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEmuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
LogFile->write(EQEmuLog::Status, "Connecting to database...");
|
||||
logger.Log(EQEmuLogSys::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEmuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
logger.Log(EQEmuLogSys::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
@ -113,61 +113,61 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if(load_all || load_items) {
|
||||
LogFile->write(EQEmuLog::Status, "Loading items...");
|
||||
logger.Log(EQEmuLogSys::Status, "Loading items...");
|
||||
try {
|
||||
LoadItems(&database);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "%s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "%s", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(load_all || load_factions) {
|
||||
LogFile->write(EQEmuLog::Status, "Loading factions...");
|
||||
logger.Log(EQEmuLogSys::Status, "Loading factions...");
|
||||
try {
|
||||
LoadFactions(&database);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "%s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "%s", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(load_all || load_loot) {
|
||||
LogFile->write(EQEmuLog::Status, "Loading loot...");
|
||||
logger.Log(EQEmuLogSys::Status, "Loading loot...");
|
||||
try {
|
||||
LoadLoot(&database);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "%s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "%s", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(load_all || load_skill_caps) {
|
||||
LogFile->write(EQEmuLog::Status, "Loading skill caps...");
|
||||
logger.Log(EQEmuLogSys::Status, "Loading skill caps...");
|
||||
try {
|
||||
LoadSkillCaps(&database);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "%s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "%s", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(load_all || load_spells) {
|
||||
LogFile->write(EQEmuLog::Status, "Loading spells...");
|
||||
logger.Log(EQEmuLogSys::Status, "Loading spells...");
|
||||
try {
|
||||
LoadSpells(&database);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "%s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "%s", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(load_all || load_bd) {
|
||||
LogFile->write(EQEmuLog::Status, "Loading base data...");
|
||||
logger.Log(EQEmuLogSys::Status, "Loading base data...");
|
||||
try {
|
||||
LoadBaseData(&database);
|
||||
} catch(std::exception &ex) {
|
||||
LogFile->write(EQEmuLog::Error, "%s", ex.what());
|
||||
logger.Log(EQEmuLogSys::Error, "%s", ex.what());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -73,14 +74,14 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf))
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
logger.Log(EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf);
|
||||
HandleMysqlError(errnum);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEmuLog::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
logger.Log(EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ void Adventure::MoveCorpsesToGraveyard()
|
||||
std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if(!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
|
||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||
dbid_list.push_back(atoi(row[0]));
|
||||
@ -405,7 +405,7 @@ void Adventure::MoveCorpsesToGraveyard()
|
||||
x, y, z, GetInstanceID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if(!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
auto c_iter = charid_list.begin();
|
||||
|
||||
@ -652,7 +652,7 @@ bool AdventureManager::LoadAdventureTemplates()
|
||||
"graveyard_radius FROM adventure_template";
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventures: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ bool AdventureManager::LoadAdventureEntries()
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
{
|
||||
LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::LoadAdventureEntries: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1079,7 +1079,7 @@ void AdventureManager::LoadLeaderboardInfo()
|
||||
"AS adv_stats LEFT JOIN `character_data` AS ch ON adv_stats.player_id = ch.id;";
|
||||
auto results = database.QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in AdventureManager:::GetLeaderboardInfo: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ void EQLConfig::LoadSettings() {
|
||||
std::string query = StringFormat("SELECT dynamics FROM launcher WHERE name = '%s'", namebuf);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
|
||||
else {
|
||||
auto row = results.begin();
|
||||
m_dynamics = atoi(row[0]);
|
||||
@ -51,7 +51,7 @@ void EQLConfig::LoadSettings() {
|
||||
query = StringFormat("SELECT zone, port FROM launcher_zones WHERE launcher = '%s'", namebuf);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "EQLConfig::LoadSettings: %s", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ EQLConfig *EQLConfig::CreateLauncher(const char *name, uint8 dynamic_count) {
|
||||
std::string query = StringFormat("INSERT INTO launcher (name, dynamics) VALUES('%s', %d)", namebuf, dynamic_count);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in CreateLauncher query: %s", results.ErrorMessage().c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -118,14 +118,14 @@ void EQLConfig::DeleteLauncher() {
|
||||
std::string query = StringFormat("DELETE FROM launcher WHERE name = '%s'", namebuf);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 1st query: %s", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
query = StringFormat("DELETE FROM launcher_zones WHERE launcher = '%s'", namebuf);
|
||||
results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in DeleteLauncher 2nd query: %s", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -173,7 +173,7 @@ bool EQLConfig::BootStaticZone(Const_char *short_name, uint16 port) {
|
||||
"VALUES('%s', '%s', %d)", namebuf, zonebuf, port);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in BootStaticZone query: %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
|
||||
res = m_zones.find(short_name);
|
||||
if(res == m_zones.end()) {
|
||||
//not found.
|
||||
LogFile->write(EQEmuLog::Error, "Update for unknown zone %s", short_name);
|
||||
logger.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ bool EQLConfig::ChangeStaticZone(Const_char *short_name, uint16 port) {
|
||||
"launcher = '%s' AND zone = '%s'",port, namebuf, zonebuf);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in ChangeStaticZone query: %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
|
||||
res = m_zones.find(short_name);
|
||||
if(res == m_zones.end()) {
|
||||
//not found.
|
||||
LogFile->write(EQEmuLog::Error, "Update for unknown zone %s", short_name);
|
||||
logger.Log(EQEmuLogSys::Error, "Update for unknown zone %s", short_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ bool EQLConfig::DeleteStaticZone(Const_char *short_name) {
|
||||
"launcher = '%s' AND zone = '%s'", namebuf, zonebuf);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in DeleteStaticZone query: %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ bool EQLConfig::SetDynamicCount(int count) {
|
||||
std::string query = StringFormat("UPDATE launcher SET dynamics=%d WHERE name='%s'", count, namebuf);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Error in SetDynamicCount query: %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -298,11 +298,11 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
|
||||
in_cc->race);
|
||||
auto results = QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
LogFile->write(EQEmuLog::Status, "Start zone query: %s\n", query.c_str());
|
||||
logger.Log(EQEmuLogSys::Status, "Start zone query: %s\n", query.c_str());
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
printf("No start_zones entry in database, using defaults\n");
|
||||
@ -395,7 +395,7 @@ bool WorldDatabase::GetStartZone(PlayerProfile_Struct* in_pp, CharCreate_Struct*
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEmuLog::Status, "Found starting location in start_zones");
|
||||
logger.Log(EQEmuLogSys::Status, "Found starting location in start_zones");
|
||||
auto row = results.begin();
|
||||
in_pp->x = atof(row[0]);
|
||||
in_pp->y = atof(row[1]);
|
||||
@ -434,11 +434,11 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
|
||||
in_cc->start_zone, in_cc->class_, in_cc->deity, in_cc->race);
|
||||
auto results = QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Status, "SoF Start zone query failed: %s : %s\n", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
LogFile->write(EQEmuLog::Status, "SoF Start zone query: %s\n", query.c_str());
|
||||
logger.Log(EQEmuLogSys::Status, "SoF Start zone query: %s\n", query.c_str());
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
printf("No start_zones entry in database, using defaults\n");
|
||||
@ -453,7 +453,7 @@ bool WorldDatabase::GetStartZoneSoF(PlayerProfile_Struct* in_pp, CharCreate_Stru
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEmuLog::Status, "Found starting location in start_zones");
|
||||
logger.Log(EQEmuLogSys::Status, "Found starting location in start_zones");
|
||||
auto row = results.begin();
|
||||
in_pp->x = atof(row[0]);
|
||||
in_pp->y = atof(row[1]);
|
||||
@ -478,7 +478,7 @@ void WorldDatabase::GetLauncherList(std::vector<std::string> &rl) {
|
||||
const std::string query = "SELECT name FROM launcher";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "WorldDatabase::GetLauncherList: %s", results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ void WorldDatabase::SetMailKey(int CharID, int IPAddress, int MailKey) {
|
||||
MailKeyString, CharID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
LogFile->write(EQEmuLog::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "WorldDatabase::SetMailKey(%i, %s) : %s", CharID, MailKeyString, results.ErrorMessage().c_str());
|
||||
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ bool WorldDatabase::GetCharacterLevel(const char *name, int &level)
|
||||
std::string query = StringFormat("SELECT level FROM character_data WHERE name = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEmuLog::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str());
|
||||
logger.Log(EQEmuLogSys::Error, "WorldDatabase::GetCharacterLevel: %s", results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user