Renamed DoLog to Out as the aggregate logging function for simplicity of use and shortened syntax of Log.Out

This commit is contained in:
Akkadius
2015-01-18 02:00:15 -06:00
parent 1c048cb1d1
commit c025765283
119 changed files with 2653 additions and 2653 deletions
+22 -22
View File
@@ -25,7 +25,7 @@ public:
}
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, buffer);
StackWalker::OnOutput(szText);
}
};
@@ -35,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ACCESS_VIOLATION");
break;
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
break;
case EXCEPTION_BREAKPOINT:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_BREAKPOINT");
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
break;
case EXCEPTION_FLT_DENORMAL_OPERAND:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
break;
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
break;
case EXCEPTION_FLT_INEXACT_RESULT:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
break;
case EXCEPTION_FLT_INVALID_OPERATION:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
break;
case EXCEPTION_FLT_OVERFLOW:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_OVERFLOW");
break;
case EXCEPTION_FLT_STACK_CHECK:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_STACK_CHECK");
break;
case EXCEPTION_FLT_UNDERFLOW:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_FLT_UNDERFLOW");
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
break;
case EXCEPTION_IN_PAGE_ERROR:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_IN_PAGE_ERROR");
break;
case EXCEPTION_INT_DIVIDE_BY_ZERO:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
break;
case EXCEPTION_INT_OVERFLOW:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INT_OVERFLOW");
break;
case EXCEPTION_INVALID_DISPOSITION:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_INVALID_DISPOSITION");
break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
break;
case EXCEPTION_PRIV_INSTRUCTION:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_PRIV_INSTRUCTION");
break;
case EXCEPTION_SINGLE_STEP:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_SINGLE_STEP");
break;
case EXCEPTION_STACK_OVERFLOW:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "EXCEPTION_STACK_OVERFLOW");
break;
default:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Crash, "Unknown Exception");
break;
}
+17 -17
View File
@@ -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)) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Failed to connect to database: Error: %s", errbuf);
return false;
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Status, "Using database '%s' at %s:%d",database,host,port);
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter: no character id");
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "StoreCharacter inventory failed. Query '%s' %s", invquery.c_str(), results.ErrorMessage().c_str());
#if EQDEBUG >= 9
else
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "StoreCharacter inventory succeeded. Query '%s'", invquery.c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetAccountIDByChar query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating LFP for character %i : %s", CharID, results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error updating firstlogon for character %i : %s", CharID, results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding a report for %s: %s", who.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error deleting character from group id: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error adding character to group id: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting group id: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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
//Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Character not in a group: %s", name);
//Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::None, "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())
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetCharactersInInstace query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return;
}
+121 -121
View File
@@ -81,18 +81,18 @@ void EQStream::init(bool resetSession) {
OpMgr = nullptr;
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "init Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
}
EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
{
EQRawApplicationPacket *ap=nullptr;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, p->size);
_raw(NET__APP_CREATE_HEX, 0xFFFF, p);
ap = p->MakeAppPacket();
return ap;
@@ -101,7 +101,7 @@ EQRawApplicationPacket *EQStream::MakeApplicationPacket(EQProtocolPacket *p)
EQRawApplicationPacket *EQStream::MakeApplicationPacket(const unsigned char *buf, uint32 len)
{
EQRawApplicationPacket *ap=nullptr;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Creating new application packet, length %d" __L, len);
_hex(NET__APP_CREATE_HEX, buf, len);
ap = new EQRawApplicationPacket(buf, len);
return ap;
@@ -132,7 +132,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
}
if (!Session && p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Session not initialized, packet ignored" __L);
_raw(NET__DEBUG, 0xFFFF, p);
return;
}
@@ -143,7 +143,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
while(processed < p->size) {
subpacket_length=*(p->pBuffer+processed);
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+processed+1,subpacket_length);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined packet of length %d" __L, subpacket_length);
_raw(NET__NET_CREATE_HEX, 0xFFFF, subp);
subp->copyInfo(p);
ProcessPacket(subp);
@@ -158,12 +158,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
while(processed<p->size) {
EQRawApplicationPacket *ap=nullptr;
if ((subpacket_length=(unsigned char)*(p->pBuffer+processed))!=0xff) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
ap=MakeApplicationPacket(p->pBuffer+processed+1,subpacket_length);
processed+=subpacket_length+1;
} else {
subpacket_length=ntohs(*(uint16 *)(p->pBuffer+processed+1));
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Extracting combined app packet of length %d, short len" __L, subpacket_length);
ap=MakeApplicationPacket(p->pBuffer+processed+3,subpacket_length);
processed+=subpacket_length+3;
}
@@ -178,29 +178,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_Packet: {
if(!p->pBuffer || (p->Size() < 4))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Packet that was of malformed size" __L);
break;
}
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
SeqOrder check=CompareSequence(NextInSeq,seq);
if (check == SeqFuture) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
_raw(NET__DEBUG, seq, p);
PacketQueue[seq]=p->Copy();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
//SendOutOfOrderAck(seq);
} else if (check == SeqPast) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Packet: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
_raw(NET__DEBUG, seq, p);
SendOutOfOrderAck(seq); //we already got this packet but it was out of order
} else {
// In case we did queue one before as well.
EQProtocolPacket *qp=RemoveQueue(seq);
if (qp) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Packet: Removing older queued packet with sequence %d", seq);
delete qp;
}
@@ -209,7 +209,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
// Check for an embedded OP_AppCombinded (protocol level 0x19)
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
EQProtocolPacket *subp=MakeProtocolPacket(p->pBuffer+2,p->size-2);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined packet of length %d" __L, seq, subp->size);
_raw(NET__NET_CREATE_HEX, seq, subp);
subp->copyInfo(p);
ProcessPacket(subp);
@@ -228,29 +228,29 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_Fragment: {
if(!p->pBuffer || (p->Size() < 4))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Fragment that was of malformed size" __L);
break;
}
uint16 seq=ntohs(*(uint16 *)(p->pBuffer));
SeqOrder check=CompareSequence(NextInSeq,seq);
if (check == SeqFuture) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Future OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
_raw(NET__DEBUG, seq, p);
PacketQueue[seq]=p->Copy();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Fragment Queue size=%d" __L, PacketQueue.size());
//SendOutOfOrderAck(seq);
} else if (check == SeqPast) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Duplicate OP_Fragment: Expecting Seq=%d, but got Seq=%d" __L, NextInSeq, seq);
_raw(NET__DEBUG, seq, p);
SendOutOfOrderAck(seq);
} else {
// In case we did queue one before as well.
EQProtocolPacket *qp=RemoveQueue(seq);
if (qp) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[NET_TRACE] OP_Fragment: Removing older queued packet with sequence %d", seq);
delete qp;
}
SetNextAckToSend(seq);
@@ -258,18 +258,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
if (oversize_buffer) {
memcpy(oversize_buffer+oversize_offset,p->pBuffer+2,p->size-2);
oversize_offset+=p->size-2;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Fragment of oversized of length %d, seq %d: now at %d/%d" __L, p->size-2, seq, oversize_offset, oversize_length);
if (oversize_offset==oversize_length) {
if (*(p->pBuffer+2)==0x00 && *(p->pBuffer+3)==0x19) {
EQProtocolPacket *subp=MakeProtocolPacket(oversize_buffer,oversize_offset);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, Extracting combined oversize packet of length %d" __L, seq, subp->size);
//_raw(NET__NET_CREATE_HEX, subp);
subp->copyInfo(p);
ProcessPacket(subp);
delete subp;
} else {
EQRawApplicationPacket *ap=MakeApplicationPacket(oversize_buffer,oversize_offset);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "seq %d, completed combined oversize packet of length %d" __L, seq, ap->size);
if (ap) {
ap->copyInfo(p);
InboundQueuePush(ap);
@@ -284,7 +284,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
oversize_buffer=new unsigned char[oversize_length];
memcpy(oversize_buffer,p->pBuffer+6,p->size-6);
oversize_offset=p->size-6;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment of oversized of seq %d: now at %d/%d" __L, seq, oversize_offset, oversize_length);
}
}
}
@@ -292,14 +292,14 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_KeepAlive: {
#ifndef COLLECTOR
NonSequencedPush(new EQProtocolPacket(p->opcode,p->pBuffer,p->size));
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received and queued reply to keep alive" __L);
#endif
}
break;
case OP_Ack: {
if(!p->pBuffer || (p->Size() < 4))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_Ack that was of malformed size" __L);
break;
}
#ifndef COLLECTOR
@@ -315,12 +315,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_SessionRequest: {
if(p->Size() < sizeof(SessionRequest))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest that was of malformed size" __L);
break;
}
#ifndef COLLECTOR
if (GetState()==ESTABLISHED) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest in ESTABLISHED state (%d) streamactive (%i) attempt (%i)" __L, GetState(),streamactive,sessionAttempts);
// client seems to try a max of 30 times (initial+3 retries) then gives up, giving it a few more attempts just in case
// streamactive means we identified the opcode for the stream, we cannot re-establish this connection
@@ -340,7 +340,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
SessionRequest *Request=(SessionRequest *)p->pBuffer;
Session=ntohl(Request->Session);
SetMaxLen(ntohl(Request->MaxLength));
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionRequest: session %lu, maxlen %d" __L, (unsigned long)Session, MaxLen);
SetState(ESTABLISHED);
#ifndef COLLECTOR
Key=0x11223344;
@@ -351,7 +351,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_SessionResponse: {
if(p->Size() < sizeof(SessionResponse))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse that was of malformed size" __L);
break;
}
@@ -367,7 +367,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
compressed=(Response->Format&FLAG_COMPRESSED);
encoded=(Response->Format&FLAG_ENCODED);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionResponse: session %lu, maxlen %d, key %lu, compressed? %s, encoded? %s" __L, (unsigned long)Session, MaxLen, (unsigned long)Key, compressed?"yes":"no", encoded?"yes":"no");
// Kinda kludgy, but trie for now
if (StreamType==UnknownStream) {
@@ -390,17 +390,17 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
EQStreamState state = GetState();
if(state == ESTABLISHED) {
//client initiated disconnect?
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received unsolicited OP_SessionDisconnect. Treating like a client-initiated disconnect." __L);
_SendDisconnect();
SetState(CLOSED);
} else if(state == CLOSING) {
//we were waiting for this anyways, ignore pending messages, send the reply and be closed.
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionDisconnect when we have a pending close, they beat us to it. Were happy though." __L);
_SendDisconnect();
SetState(CLOSED);
} else {
//we are expecting this (or have already gotten it, but dont care either way)
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received expected OP_SessionDisconnect. Moving to closed state." __L);
SetState(CLOSED);
}
}
@@ -408,7 +408,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_OutOfOrderAck: {
if(!p->pBuffer || (p->Size() < 4))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck that was of malformed size" __L);
break;
}
#ifndef COLLECTOR
@@ -416,15 +416,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
MOutboundQueue.lock();
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
//if the packet they got out of order is between our last acked packet and the last sent packet, then its valid.
if (CompareSequence(SequencedBase,seq) != SeqPast && CompareSequence(NextOutSeq,seq) == SeqPast) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for sequence %d, starting retransmit at the start of our unacked buffer (seq %d, was %d)." __L,
seq, SequencedBase, SequencedBase+NextSequencedSend);
bool retransmit_acked_packets = false;
@@ -435,7 +435,7 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
if(!retransmit_acked_packets) {
uint16 sqsize = SequencedQueue.size();
uint16 index = seq - SequencedBase;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_OutOfOrderAck marking packet acked in queue (queue index = %d, queue size = %d)." __L, index, sqsize);
if (index < sqsize) {
std::deque<EQProtocolPacket *>::iterator sitr;
sitr = SequencedQueue.begin();
@@ -450,15 +450,15 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
NextSequencedSend = 0;
} else {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfOrderAck for out-of-window %d. Window (%d->%d)." __L, seq, SequencedBase, NextOutSeq);
}
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-OOA Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
MOutboundQueue.unlock();
#endif
@@ -467,12 +467,12 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
case OP_SessionStatRequest: {
if(p->Size() < sizeof(SessionStats))
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatRequest that was of malformed size" __L);
break;
}
#ifndef COLLECTOR
SessionStats *Stats=(SessionStats *)p->pBuffer;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received Stats: %lu packets received, %lu packets sent, Deltas: local %lu, (%lu <- %lu -> %lu) remote %lu" __L,
(unsigned long)ntohl(Stats->packets_received), (unsigned long)ntohl(Stats->packets_sent), (unsigned long)ntohl(Stats->last_local_delta),
(unsigned long)ntohl(Stats->low_delta), (unsigned long)ntohl(Stats->average_delta),
(unsigned long)ntohl(Stats->high_delta), (unsigned long)ntohl(Stats->last_remote_delta));
@@ -493,18 +493,18 @@ void EQStream::ProcessPacket(EQProtocolPacket *p)
}
if(retransmittimeout > RETRANSMIT_TIMEOUT_MAX)
retransmittimeout = RETRANSMIT_TIMEOUT_MAX;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Retransmit timeout recalculated to %dms" __L, retransmittimeout);
}
}
#endif
}
break;
case OP_SessionStatResponse: {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_SessionStatResponse. Ignoring." __L);
}
break;
case OP_OutOfSession: {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received OP_OutOfSession. Ignoring." __L);
}
break;
default:
@@ -535,7 +535,7 @@ void EQStream::FastQueuePacket(EQApplicationPacket **p, bool ack_req)
return;
if(OpMgr == nullptr || *OpMgr == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Packet enqueued into a stream with no opcode manager, dropping." __L);
delete pack;
return;
}
@@ -562,7 +562,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
// Convert the EQApplicationPacket to 1 or more EQProtocolPackets
if (p->size>(MaxLen-8)) { // proto-op(2), seq(2), app-op(2) ... data ... crc(2)
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Making oversized packet, len %d" __L, p->size);
unsigned char *tmpbuff=new unsigned char[p->size+3];
length=p->serialize(opcode, tmpbuff);
@@ -571,7 +571,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
*(uint32 *)(out->pBuffer+2)=htonl(p->Size());
used=MaxLen-10;
memcpy(out->pBuffer+6,tmpbuff,used);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "First fragment: used %d/%d. Put size %d in the packet" __L, used, p->size, p->Size());
SequencedPush(out);
@@ -582,7 +582,7 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
out->size=chunksize+2;
SequencedPush(out);
used+=chunksize;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Subsequent fragment: len %d, used %d/%d." __L, chunksize, used, p->size);
}
delete p;
delete[] tmpbuff;
@@ -606,22 +606,22 @@ void EQStream::SequencedPush(EQProtocolPacket *p)
#else
MOutboundQueue.lock();
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing sequenced packet %d of length %d. Base Seq is %d." __L, NextOutSeq, p->size, SequencedBase);
*(uint16 *)(p->pBuffer)=htons(NextOutSeq);
SequencedQueue.push_back(p);
NextOutSeq++;
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Push Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
MOutboundQueue.unlock();
#endif
@@ -633,7 +633,7 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p)
delete p;
#else
MOutboundQueue.lock();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pushing non-sequenced packet of length %d" __L, p->size);
NonSequencedQueue.push(p);
MOutboundQueue.unlock();
#endif
@@ -642,14 +642,14 @@ void EQStream::NonSequencedPush(EQProtocolPacket *p)
void EQStream::SendAck(uint16 seq)
{
uint16 Seq=htons(seq);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending ack with sequence %d" __L, seq);
SetLastAckSent(seq);
NonSequencedPush(new EQProtocolPacket(OP_Ack,(unsigned char *)&Seq,sizeof(uint16)));
}
void EQStream::SendOutOfOrderAck(uint16 seq)
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending out of order ack with sequence %d" __L, seq);
uint16 Seq=htons(seq);
NonSequencedPush(new EQProtocolPacket(OP_OutOfOrderAck,(unsigned char *)&Seq,sizeof(uint16)));
}
@@ -685,7 +685,7 @@ void EQStream::Write(int eq_fd)
// if we have a timeout defined and we have not received an ack recently enough, retransmit from beginning of queue
if (RETRANSMIT_TIMEOUT_MULT && !SequencedQueue.empty() && NextSequencedSend &&
(GetState()==ESTABLISHED) && ((retransmittimer+retransmittimeout) < Timer::GetCurrentTime())) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked "
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout since last ack received, starting retransmit at the start of our unacked "
"buffer (seq %d, was %d)." __L, SequencedBase, SequencedBase+NextSequencedSend);
NextSequencedSend = 0;
retransmittimer = Timer::GetCurrentTime(); // don't want to endlessly retransmit the first packet
@@ -706,24 +706,24 @@ void EQStream::Write(int eq_fd)
// If we don't have a packet to try to combine into, use this one as the base
// And remove it form the queue
p = NonSequencedQueue.front();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with non-seq packet of len %d" __L, p->size);
NonSequencedQueue.pop();
} else if (!p->combine(NonSequencedQueue.front())) {
// Tryint to combine this packet with the base didn't work (too big maybe)
// So just send the base packet (we'll try this packet again later)
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next non-seq packet is len %d" __L, p->size, (NonSequencedQueue.front())->size);
ReadyToSend.push(p);
BytesWritten+=p->size;
p=nullptr;
if (BytesWritten > threshold) {
// Sent enough this round, lets stop to be fair
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in nonseq (%d > %d)" __L, BytesWritten, threshold);
break;
}
} else {
// Combine worked, so just remove this packet and it's spot in the queue
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined non-seq packet of len %d, yeilding %d combined." __L, (NonSequencedQueue.front())->size, p->size);
delete NonSequencedQueue.front();
NonSequencedQueue.pop();
}
@@ -734,48 +734,48 @@ void EQStream::Write(int eq_fd)
if (sitr!=SequencedQueue.end()) {
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Seq NSS=%d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, NextSequencedSend, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
uint16 seq_send = SequencedBase + NextSequencedSend; //just for logging...
if(SequencedQueue.empty()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Tried to write a packet with an empty queue (%d is past next out %d)" __L, seq_send, NextOutSeq);
SeqEmpty=true;
continue;
}
if(GetExecutablePlatform() == ExePlatformWorld || GetExecutablePlatform() == ExePlatformZone) {
if (!RETRANSMIT_ACKED_PACKETS && (*sitr)->acked) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not retransmitting seq packet %d because already marked as acked" __L, seq_send);
sitr++;
NextSequencedSend++;
} else if (!p) {
// If we don't have a packet to try to combine into, use this one as the base
// Copy it first as it will still live until it is acked
p=(*sitr)->Copy();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
++sitr;
NextSequencedSend++;
} else if (!p->combine(*sitr)) {
// Trying to combine this packet with the base didn't work (too big maybe)
// So just send the base packet (we'll try this packet again later)
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size);
ReadyToSend.push(p);
BytesWritten+=p->size;
p=nullptr;
if (BytesWritten > threshold) {
// Sent enough this round, lets stop to be fair
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
break;
}
} else {
// Combine worked
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
++sitr;
NextSequencedSend++;
}
@@ -784,35 +784,35 @@ void EQStream::Write(int eq_fd)
// If we don't have a packet to try to combine into, use this one as the base
// Copy it first as it will still live until it is acked
p=(*sitr)->Copy();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
++sitr;
NextSequencedSend++;
} else if (!p->combine(*sitr)) {
// Trying to combine this packet with the base didn't work (too big maybe)
// So just send the base packet (we'll try this packet again later)
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined packet full at len %d, next seq packet %d is len %d" __L, p->size, seq_send, (*sitr)->size);
ReadyToSend.push(p);
BytesWritten+=p->size;
p=nullptr;
if (BytesWritten > threshold) {
// Sent enough this round, lets stop to be fair
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Exceeded write threshold in seq (%d > %d)" __L, BytesWritten, threshold);
break;
}
} else {
// Combine worked
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
++sitr;
NextSequencedSend++;
}
}
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post send Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
} else {
// No more sequenced packets
@@ -824,7 +824,7 @@ void EQStream::Write(int eq_fd)
// We have a packet still, must have run out of both seq and non-seq, so send it
if (p) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Final combined packet not full, len %d" __L, p->size);
ReadyToSend.push(p);
BytesWritten+=p->size;
}
@@ -841,7 +841,7 @@ void EQStream::Write(int eq_fd)
if(SeqEmpty && NonSeqEmpty) {
//no more data to send
if(CheckState(CLOSING)) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L );
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "All outgoing data flushed, closing stream." __L );
//we are waiting for the queues to empty, now we can do our disconnect.
//this packet will not actually go out until the next call to Write().
_SendDisconnect();
@@ -904,7 +904,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionResponse,nullptr,sizeof(Ses
out->size=sizeof(SessionResponse);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionResponse: session %lu, maxlen=%d, key=0x%x, compressed? %s, encoded? %s" __L,
(unsigned long)Session, MaxLen, Key, compressed?"yes":"no", encoded?"yes":"no");
NonSequencedPush(out);
@@ -918,7 +918,7 @@ EQProtocolPacket *out=new EQProtocolPacket(OP_SessionRequest,nullptr,sizeof(Sess
Request->Session=htonl(time(nullptr));
Request->MaxLength=htonl(512);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength));
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionRequest: session %lu, maxlen=%d" __L, (unsigned long)ntohl(Request->Session), ntohl(Request->MaxLength));
NonSequencedPush(out);
}
@@ -932,7 +932,7 @@ void EQStream::_SendDisconnect()
*(uint32 *)out->pBuffer=htonl(Session);
NonSequencedPush(out);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Sending OP_SessionDisconnect: session %lu" __L, (unsigned long)Session);
}
void EQStream::InboundQueuePush(EQRawApplicationPacket *p)
@@ -959,7 +959,7 @@ EQRawApplicationPacket *p=nullptr;
if(OpMgr != nullptr && *OpMgr != nullptr) {
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
if (emu_op == OP_Unknown) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
}
p->SetOpcode(emu_op);
@@ -986,7 +986,7 @@ EQRawApplicationPacket *p=nullptr;
if(OpMgr != nullptr && *OpMgr != nullptr) {
EmuOpcode emu_op = (*OpMgr)->EQToEmu(p->opcode);
if(emu_op == OP_Unknown) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "Unable to convert EQ opcode 0x%.4x to an Application opcode.", p->opcode);
}
p->SetOpcode(emu_op);
@@ -1014,7 +1014,7 @@ void EQStream::InboundQueueClear()
{
EQApplicationPacket *p=nullptr;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing inbound queue" __L);
MInboundQueue.lock();
if (!InboundQueue.empty()) {
@@ -1057,7 +1057,7 @@ void EQStream::OutboundQueueClear()
{
EQProtocolPacket *p=nullptr;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing outbound queue" __L);
MOutboundQueue.lock();
while(!NonSequencedQueue.empty()) {
@@ -1079,7 +1079,7 @@ void EQStream::PacketQueueClear()
{
EQProtocolPacket *p=nullptr;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Clearing future packet queue" __L);
if(!PacketQueue.empty()) {
std::map<unsigned short,EQProtocolPacket *>::iterator itr;
@@ -1111,7 +1111,7 @@ uint32 newlength=0;
delete p;
ProcessQueue();
} else {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Incoming packet failed checksum" __L);
_hex(NET__NET_CREATE_HEX, buffer, length);
}
}
@@ -1141,33 +1141,33 @@ std::deque<EQProtocolPacket *>::iterator itr, tmp;
MOutboundQueue.lock();
//do a bit of sanity checking.
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Pre-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
SeqOrder ord = CompareSequence(SequencedBase, seq);
if(ord == SeqInOrder) {
//they are not acking anything new...
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with no window advancement (seq %d)." __L, seq);
} else if(ord == SeqPast) {
//they are nacking blocks going back before our buffer, wtf?
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack with backward window advancement (they gave %d, our window starts at %d). This is bad." __L, seq, SequencedBase);
} else {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Received an ack up through sequence %d. Our base is %d." __L, seq, SequencedBase);
//this is a good ack, we get to ack some blocks.
seq++; //we stop at the block right after their ack, counting on the wrap of both numbers.
while(SequencedBase != seq) {
if(SequencedQueue.empty()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
SequencedBase = NextOutSeq;
NextSequencedSend = 0;
break;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Removing acked packet with sequence %lu. Next send is %d before this." __L, (unsigned long)SequencedBase, NextSequencedSend);
//clean out the acked packet
delete SequencedQueue.front();
SequencedQueue.pop_front();
@@ -1178,10 +1178,10 @@ Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OUT OF PACKETS acked pa
SequencedBase++;
}
if(uint16(SequencedBase + SequencedQueue.size()) != NextOutSeq) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack on %d Invalid Sequenced queue: BS %d + SQ %d != NOS %d" __L, seq, SequencedBase, SequencedQueue.size(), NextOutSeq);
}
if(NextSequencedSend > SequencedQueue.size()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Post-Ack Next Send Sequence is beyond the end of the queue NSS %d > SQ %d" __L, NextSequencedSend, SequencedQueue.size());
}
}
@@ -1191,7 +1191,7 @@ if(NextSequencedSend > SequencedQueue.size()) {
void EQStream::SetNextAckToSend(uint32 seq)
{
MAcks.lock();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Next Ack To Send to %lu" __L, (unsigned long)seq);
NextAckToSend=seq;
MAcks.unlock();
}
@@ -1199,7 +1199,7 @@ void EQStream::SetNextAckToSend(uint32 seq)
void EQStream::SetLastAckSent(uint32 seq)
{
MAcks.lock();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Set Last Ack Sent to %lu" __L, (unsigned long)seq);
LastAckSent=seq;
MAcks.unlock();
}
@@ -1212,10 +1212,10 @@ void EQStream::ProcessQueue()
EQProtocolPacket *qp=nullptr;
while((qp=RemoveQueue(NextInSeq))!=nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Processing Queued Packet: Seq=%d" __L, NextInSeq);
ProcessPacket(qp);
delete qp;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
}
}
@@ -1226,21 +1226,21 @@ EQProtocolPacket *qp=nullptr;
if ((itr=PacketQueue.find(seq))!=PacketQueue.end()) {
qp=itr->second;
PacketQueue.erase(itr);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "OP_Packet Queue size=%d" __L, PacketQueue.size());
}
return qp;
}
void EQStream::SetStreamType(EQStreamType type)
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type));
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing stream type from %s to %s" __L, StreamTypeString(StreamType), StreamTypeString(type));
StreamType=type;
switch (StreamType) {
case LoginStream:
app_opcode_size=1;
compressed=false;
encoded=false;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Login stream has app opcode size %d, is not compressed or encoded." __L, app_opcode_size);
break;
case ChatOrMailStream:
case ChatStream:
@@ -1248,7 +1248,7 @@ void EQStream::SetStreamType(EQStreamType type)
app_opcode_size=1;
compressed=false;
encoded=true;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Chat/Mail stream has app opcode size %d, is not compressed, and is encoded." __L, app_opcode_size);
break;
case ZoneStream:
case WorldStream:
@@ -1256,7 +1256,7 @@ void EQStream::SetStreamType(EQStreamType type)
app_opcode_size=2;
compressed=true;
encoded=false;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "World/Zone stream has app opcode size %d, is compressed, and is not encoded." __L, app_opcode_size);
break;
}
}
@@ -1306,7 +1306,7 @@ EQStream::SeqOrder EQStream::CompareSequence(uint16 expected_seq , uint16 seq)
void EQStream::SetState(EQStreamState state) {
MState.lock();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Changing state from %d to %d" __L, State, state);
State=state;
MState.unlock();
}
@@ -1318,29 +1318,29 @@ void EQStream::CheckTimeout(uint32 now, uint32 timeout) {
EQStreamState orig_state = GetState();
if (orig_state == CLOSING && !outgoing_data) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Out of data in closing state, disconnecting." __L);
_SendDisconnect();
SetState(DISCONNECTING);
} else if (LastPacket && (now-LastPacket) > timeout) {
switch(orig_state) {
case CLOSING:
//if we time out in the closing state, they are not acking us, just give up
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closing state. Moving to closed state." __L);
_SendDisconnect();
SetState(CLOSED);
break;
case DISCONNECTING:
//we timed out waiting for them to send us the disconnect reply, just give up.
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in disconnecting state. Moving to closed state." __L);
SetState(CLOSED);
break;
case CLOSED:
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in closed state??" __L);
break;
case ESTABLISHED:
//we timed out during normal operation. Try to be nice about it.
//we will almost certainly time out again waiting for the disconnect reply, but oh well.
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Timeout expired in established state. Closing connection." __L);
_SendDisconnect();
SetState(DISCONNECTING);
break;
@@ -1369,11 +1369,11 @@ void EQStream::AdjustRates(uint32 average_delta)
MRate.lock();
RateThreshold=RATEBASE/average_delta;
DecayRate=DECAYBASE/average_delta;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
RateThreshold, DecayRate, average_delta);
MRate.unlock();
} else {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Not adjusting data rate because avg delta over max (%d > %d)" __L,
average_delta, AVERAGE_DELTA_MAX);
}
} else {
@@ -1381,7 +1381,7 @@ void EQStream::AdjustRates(uint32 average_delta)
MRate.lock();
RateThreshold=RATEBASE/average_delta;
DecayRate=DECAYBASE/average_delta;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Adjusting data rate to thresh %d, decay %d based on avg delta %d" __L,
RateThreshold, DecayRate, average_delta);
MRate.unlock();
}
@@ -1391,12 +1391,12 @@ void EQStream::AdjustRates(uint32 average_delta)
void EQStream::Close() {
if(HasOutgoingData()) {
//there is pending data, wait for it to go out.
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream requested to Close(), but there is pending data, waiting for it." __L);
SetState(CLOSING);
} else {
//otherwise, we are done, we can drop immediately.
_SendDisconnect();
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, _L "Stream closing immediate due to Close()" __L);
SetState(DISCONNECTING);
}
}
@@ -1424,19 +1424,19 @@ EQStream::MatchState EQStream::CheckSignature(const Signature *sig) {
} else if(p->opcode == sig->first_eq_opcode) {
//opcode matches, check length..
if(p->size == sig->first_length) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length matched %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
res = MatchSuccessful;
} else if(sig->first_length == 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x and length (%d) is ignored", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size);
res = MatchSuccessful;
} else {
//opcode matched but length did not.
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode matched 0x%x, but length %d did not match expected %d", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), sig->first_eq_opcode, p->size, sig->first_length);
res = MatchFailed;
}
} else {
//first opcode did not match..
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: First opcode 0x%x did not match expected 0x%x", long2ip(GetRemoteIP()).c_str(), ntohs(GetRemotePort()), p->opcode, sig->first_eq_opcode);
res = MatchFailed;
}
}
+4 -4
View File
@@ -26,13 +26,13 @@ ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
#endif
fs->ReaderLoop();
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
#endif
THREAD_RETURN(nullptr);
@@ -43,13 +43,13 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
#endif
fs->WriterLoop();
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
#endif
THREAD_RETURN(nullptr);
+10 -10
View File
@@ -46,7 +46,7 @@ void EQStreamIdentifier::Process() {
//first see if this stream has expired
if(r->expire.Check(false)) {
//this stream has failed to match any pattern in our timeframe.
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
r->stream->ReleaseFromUse();
delete r;
cur = m_streams.erase(cur);
@@ -62,23 +62,23 @@ void EQStreamIdentifier::Process() {
}
if(r->stream->GetState() != ESTABLISHED) {
//the stream closed before it was identified.
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
switch(r->stream->GetState())
{
case ESTABLISHED:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Established");
break;
case CLOSING:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closing");
break;
case DISCONNECTING:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Disconnecting");
break;
case CLOSED:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Closed");
break;
default:
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
break;
}
r->stream->ReleaseFromUse();
@@ -109,7 +109,7 @@ void EQStreamIdentifier::Process() {
case EQStream::MatchSuccessful: {
//yay, a match.
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
r->stream->SetActive(true);
@@ -123,7 +123,7 @@ void EQStreamIdentifier::Process() {
}
case EQStream::MatchFailed:
//do nothing...
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
break;
}
}
@@ -131,7 +131,7 @@ void EQStreamIdentifier::Process() {
//if we checked all patches and did not find a match.
if(all_ready && !found_one) {
//the stream cannot be identified.
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
r->stream->ReleaseFromUse();
}
+3 -3
View File
@@ -91,7 +91,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
log_settings_loaded = true;
}
std::string EQEmuLogSys::FormatDoLogMessageString(uint16 log_category, std::string in_message){
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){
std::string category_string = "";
if (log_category > 0 && LogCategoryName[log_category]){
category_string = StringFormat("[%s] ", LogCategoryName[log_category]);
@@ -162,14 +162,14 @@ void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string m
#endif
}
void EQEmuLogSys::DoLog(DebugLevel debug_level, uint16 log_category, std::string message, ...)
void EQEmuLogSys::Out(DebugLevel debug_level, uint16 log_category, std::string message, ...)
{
va_list args;
va_start(args, message);
std::string output_message = vStringFormat(message.c_str(), args);
va_end(args);
std::string output_debug_message = EQEmuLogSys::FormatDoLogMessageString(log_category, output_message);
std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message);
EQEmuLogSys::ProcessConsoleMessage(log_category, output_debug_message);
EQEmuLogSys::ProcessGMSay(log_category, output_debug_message);
+2 -2
View File
@@ -82,7 +82,7 @@ public:
void CloseFileLogs();
void LoadLogSettingsDefaults();
void DoLog(DebugLevel debug_level, uint16 log_category, std::string message, ...);
void Out(DebugLevel debug_level, uint16 log_category, std::string message, ...);
void MakeDirectory(std::string directory_name);
void SetCurrentTimeStamp(char* time_stamp);
void StartFileLogs(const std::string log_name);
@@ -103,7 +103,7 @@ private:
bool zone_general_init = false;
std::function<void(uint16 log_category, std::string&)> on_log_gmsay_hook;
std::string FormatDoLogMessageString(uint16 log_category, std::string in_message);
std::string FormatOutMessageString(uint16 log_category, std::string in_message);
void ProcessConsoleMessage(uint16 log_category, const std::string message);
void ProcessGMSay(uint16 log_category, std::string message);
+3 -3
View File
@@ -141,7 +141,7 @@ bool EQTime::saveFile(const char *filename)
of.open(filename);
if(!of)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
return false;
}
//Enable for debugging
@@ -165,14 +165,14 @@ bool EQTime::loadFile(const char *filename)
in.open(filename);
if(!in)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not load EQTime file %s", filename);
return false;
}
in >> version;
in.ignore(80, '\n');
if(version != EQT_VERSION)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION);
Log.Out(EQEmuLogSys::General, 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;
+66 -66
View File
@@ -46,7 +46,7 @@ bool BaseGuildManager::LoadGuilds() {
ClearGuilds();
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object.");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to load guilds when we have no database object.");
return(false);
}
@@ -57,7 +57,7 @@ bool BaseGuildManager::LoadGuilds() {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -69,7 +69,7 @@ bool BaseGuildManager::LoadGuilds() {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -79,13 +79,13 @@ bool BaseGuildManager::LoadGuilds() {
uint8 rankn = atoi(row[1]);
if(rankn > GUILD_MAX_RANK) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id);
continue;
}
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found rank %d for non-existent guild %d, skipping.", rankn, guild_id);
continue;
}
@@ -107,7 +107,7 @@ bool BaseGuildManager::LoadGuilds() {
bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to refresh guild %d when we have no database object.", guild_id);
return(false);
}
@@ -120,13 +120,13 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guilds '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
if (results.RowCount() == 0)
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find guild %d in the database.", guild_id);
return false;
}
@@ -140,7 +140,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error reloading guild ranks '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -149,7 +149,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
uint8 rankn = atoi(row[1]);
if(rankn > GUILD_MAX_RANK) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Found invalid (too high) rank %d for guild %d, skipping.", rankn, guild_id);
continue;
}
@@ -166,7 +166,7 @@ bool BaseGuildManager::RefreshGuild(uint32 guild_id) {
rank.permissions[GUILD_WARPEACE] = (row[10][0] == '1') ? true: false;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Successfully refreshed guild %d from the database.", guild_id);
return true;
}
@@ -218,14 +218,14 @@ BaseGuildManager::GuildInfo *BaseGuildManager::_CreateGuild(uint32 guild_id, con
bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store guild %d when we have no database object.", guild_id);
return(false);
}
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to store non-existent guild %d", guild_id);
return(false);
}
GuildInfo *info = res->second;
@@ -236,14 +236,14 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
auto results = m_db->QueryDatabase(query);
if (!results.Success())
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild record when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
//clear out old `guild_ranks` entries
query = StringFormat("DELETE FROM guild_ranks WHERE guild_id=%lu", (unsigned long)guild_id);
results = m_db->QueryDatabase(query);
if (!results.Success())
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error clearing old guild_ranks records when storing %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
//escape our strings.
char *name_esc = new char[info->name.length()*2+1];
@@ -260,7 +260,7 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild record when storing %d. Giving up. '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
safe_delete_array(name_esc);
safe_delete_array(motd_esc);
safe_delete_array(motd_set_esc);
@@ -294,21 +294,21 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error inserting new guild rank record when storing %d for %d. Giving up. '%s': %s", rank, guild_id, query.c_str(), results.ErrorMessage().c_str());
safe_delete_array(title_esc);
return false;
}
safe_delete_array(title_esc);
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Stored guild %d in the database", guild_id);
return true;
}
uint32 BaseGuildManager::_GetFreeGuildID() {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object.");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested find a free guild ID when we have no database object.");
return(GUILD_NONE);
}
@@ -337,18 +337,18 @@ uint32 BaseGuildManager::_GetFreeGuildID() {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in _GetFreeGuildID query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
continue;
}
if (results.RowCount() == 0)
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Located free guild ID %d in the database", index);
return index;
}
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested.");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Unable to find a free guild ID when requested.");
return GUILD_NONE;
}
@@ -518,11 +518,11 @@ uint32 BaseGuildManager::DBCreateGuild(const char* name, uint32 leader) {
//now store the resulting guild setup into the DB.
if(!_StoreGuildDB(new_id)) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal.");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error storing new guild. It may have been partially created which may need manual removal.");
return(GUILD_NONE);
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Created guild %d in the database.", new_id);
return(new_id);
}
@@ -538,7 +538,7 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) {
}
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to delete guild %d when we have no database object.", guild_id);
return(false);
}
@@ -558,14 +558,14 @@ bool BaseGuildManager::DBDeleteGuild(uint32 guild_id) {
query = StringFormat("DELETE FROM guild_bank WHERE guildid=%lu", (unsigned long)guild_id);
QueryWithLogging(query, "deleting guild bank");
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Deleted guild %d from the database.", guild_id);
return(true);
}
bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to rename guild %d when we have no database object.", guild_id);
return false;
}
@@ -586,13 +586,13 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error renaming guild %d '%s': %s", guild_id, query.c_str(), results.Success());
safe_delete_array(esc);
return false;
}
safe_delete_array(esc);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Renamed guild %s (%d) to %s in database.", info->name.c_str(), guild_id, name);
info->name = name; //update our local record.
@@ -601,7 +601,7 @@ bool BaseGuildManager::DBRenameGuild(uint32 guild_id, const char* name) {
bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the leader for guild %d when we have no database object.", guild_id);
return false;
}
@@ -617,7 +617,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error changing leader on guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -628,7 +628,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
if(!DBSetGuildRank(leader, GUILD_LEADER))
return false;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set guild leader for guild %d to %d in the database", guild_id, leader);
info->leader_char_id = leader; //update our local record.
@@ -637,7 +637,7 @@ bool BaseGuildManager::DBSetGuildLeader(uint32 guild_id, uint32 leader) {
bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const char *setter) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set the MOTD for guild %d when we have no database object.", guild_id);
return(false);
}
@@ -661,7 +661,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting MOTD for guild %d '%s': %s", guild_id, query.c_str(), results.ErrorMessage().c_str());
safe_delete_array(esc);
safe_delete_array(esc_set);
return false;
@@ -669,7 +669,7 @@ bool BaseGuildManager::DBSetGuildMOTD(uint32 guild_id, const char* motd, const c
safe_delete_array(esc);
safe_delete_array(esc_set);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set MOTD for guild %d in the database", guild_id);
info->motd = motd; //update our local record.
info->motd_setter = setter; //update our local record.
@@ -698,13 +698,13 @@ bool BaseGuildManager::DBSetGuildURL(uint32 GuildID, const char* URL)
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting URL for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str());
safe_delete_array(esc);
return(false);
}
safe_delete_array(esc);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set URL for guild %d in the database", GuildID);
info->url = URL; //update our local record.
@@ -733,13 +733,13 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel)
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting Channel for guild %d '%s': %s", GuildID, query.c_str(), results.ErrorMessage().c_str());
safe_delete_array(esc);
return(false);
}
safe_delete_array(esc);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set Channel for guild %d in the database", GuildID);
info->channel = Channel; //update our local record.
@@ -748,7 +748,7 @@ bool BaseGuildManager::DBSetGuildChannel(uint32 GuildID, const char* Channel)
bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested to set char to guild %d when we have no database object.", guild_id);
return(false);
}
@@ -759,7 +759,7 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error Changing char %d to guild %d '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -768,11 +768,11 @@ bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) {
auto results = m_db->QueryDatabase(query);
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error removing char %d from guild '%s': %s", charid, guild_id, query.c_str(), results.ErrorMessage().c_str());
return false;
}
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set char %d to guild %d and rank %d in the database.", charid, guild_id, rank);
return true;
}
@@ -796,7 +796,7 @@ bool BaseGuildManager::GetBankerFlag(uint32 CharID)
auto results = m_db->QueryDatabase(query);
if(!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving banker flag '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -827,7 +827,7 @@ bool BaseGuildManager::GetAltFlag(uint32 CharID)
auto results = m_db->QueryDatabase(query);
if(!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error retrieving alt flag '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -863,11 +863,11 @@ bool BaseGuildManager::DBSetPublicNote(uint32 charid, const char* note) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error setting public note for char %d '%s': %s", charid, query.c_str(), results.ErrorMessage().c_str());
return false;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Set public not for char %d", charid);
return true;
}
@@ -880,7 +880,7 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) {
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error %s: '%s': %s", errmsg, query.c_str(), results.ErrorMessage().c_str());
return(false);
}
@@ -938,7 +938,7 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vector<CharGuildInfo
std::string query = StringFormat(GuildMemberBaseQuery " WHERE g.guild_id=%d", guild_id);
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member list '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -948,14 +948,14 @@ bool BaseGuildManager::GetEntireGuild(uint32 guild_id, std::vector<CharGuildInfo
members.push_back(ci);
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived entire guild member list for guild %d from the database", guild_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived entire guild member list for guild %d from the database", guild_id);
return true;
}
bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %s when we have no database object.", char_name);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %s when we have no database object.", char_name);
return(false);
}
@@ -969,7 +969,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
safe_delete_array(esc);
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -978,7 +978,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
auto row = results.begin();
ProcessGuildMember(row, into);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %s from the database", char_name);
return true;
@@ -987,7 +987,7 @@ bool BaseGuildManager::GetCharInfo(const char *char_name, CharGuildInfo &into) {
bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
if(m_db == nullptr) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Requested char info on %d when we have no database object.", char_id);
return false;
}
@@ -1000,7 +1000,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
#endif
auto results = m_db->QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error loading guild member '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
@@ -1009,7 +1009,7 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
auto row = results.begin();
ProcessGuildMember(row, into);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Retreived guild member info for char %d", char_id);
return true;
@@ -1124,16 +1124,16 @@ bool BaseGuildManager::GuildExists(uint32 guild_id) const {
bool BaseGuildManager::IsGuildLeader(uint32 guild_id, uint32 char_id) const {
if(guild_id == GUILD_NONE) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: not a guild.", char_id);
return(false);
}
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for char %d: invalid guild.", char_id);
return(false); //invalid guild
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check leader for guild %d, char %d: leader id=%d", guild_id, char_id, res->second->leader_char_id);
return(char_id == res->second->leader_char_id);
}
@@ -1163,20 +1163,20 @@ uint8 BaseGuildManager::GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 cha
bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const {
if(status >= 250) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d > 250, granted.", guild_id, status);
return(true); //250+ as allowed anything
}
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d with user status %d, no such guild, denied.", guild_id, status);
return(false); //invalid guild
}
bool granted = (res->second->minstatus <= status);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s",
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) with user status %d. Min status %d: %s",
res->second->name.c_str(), guild_id, status, res->second->minstatus, granted?"granted":"denied");
return(granted);
@@ -1184,21 +1184,21 @@ bool BaseGuildManager::CheckGMStatus(uint32 guild_id, uint8 status) const {
bool BaseGuildManager::CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const {
if(rank > GUILD_MAX_RANK) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.",
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid rank, denied.",
guild_id, rank, GuildActionNames[act], act);
return(false); //invalid rank
}
std::map<uint32, GuildInfo *>::const_iterator res;
res = m_guilds.find(guild_id);
if(res == m_guilds.end()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.",
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %d and rank %d for action %s (%d): Invalid guild, denied.",
guild_id, rank, GuildActionNames[act], act);
return(false); //invalid guild
}
bool granted = res->second->ranks[rank].permissions[act];
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s",
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Check permission on guild %s (%d) and rank %s (%d) for action %s (%d): %s",
res->second->name.c_str(), guild_id,
res->second->ranks[rank].name.c_str(), rank,
GuildActionNames[act], act,
@@ -1245,7 +1245,7 @@ uint32 BaseGuildManager::DoesAccountContainAGuildLeader(uint32 AccountID)
auto results = m_db->QueryDatabase(query);
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Guilds, "Error executing query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
return 0;
}
+1 -1
View File
@@ -1153,7 +1153,7 @@ int16 Inventory::_PutItem(int16 slot_id, ItemInst* inst)
}
if (result == INVALID_INDEX) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Inventory::_PutItem: Invalid slot_id specified (%i) with parent slot id (%i)", slot_id, parentSlot);
Log.Out(EQEmuLogSys::General, 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
}
+1 -1
View File
@@ -40,7 +40,7 @@
#define VERIFY_PACKET_LENGTH(OPCode, Packet, StructName) \
if(Packet->size != sizeof(StructName)) \
{ \
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Size mismatch in " #OPCode " expected %i got %i", sizeof(StructName), Packet->size); \
DumpPacket(Packet); \
return; \
}
+17 -17
View File
@@ -52,7 +52,7 @@ namespace RoF
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
if (!opcodes->LoadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
return;
}
}
@@ -78,7 +78,7 @@ namespace RoF
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
}
void Reload()
@@ -93,10 +93,10 @@ namespace RoF
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
return;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
}
}
@@ -316,7 +316,7 @@ namespace RoF
if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
delete in;
return;
}
@@ -551,7 +551,7 @@ namespace RoF
if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
delete in;
@@ -585,7 +585,7 @@ namespace RoF
safe_delete_array(Serialized);
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
}
}
@@ -1386,7 +1386,7 @@ namespace RoF
char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0);
if (!serialized) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
return;
}
@@ -2556,7 +2556,7 @@ namespace RoF
outapp->WriteUInt8(0); // Unknown
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition());
unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()];
memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition());
@@ -3321,7 +3321,7 @@ namespace RoF
if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
delete in;
return;
}
@@ -3654,7 +3654,7 @@ namespace RoF
//determine and verify length
int entrycount = in->size / sizeof(Spawn_Struct);
if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
delete in;
return;
}
@@ -3902,7 +3902,7 @@ namespace RoF
Buffer += 29;
if (Buffer != (BufferStart + PacketSize))
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize));
}
//Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size);
//_hex(NET__ERROR, outapp->pBuffer, outapp->size);
@@ -4498,7 +4498,7 @@ namespace RoF
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
//Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot);
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
emu->from_slot = RoFToServerSlot(eq->from_slot);
emu->to_slot = RoFToServerSlot(eq->to_slot);
IN(number_in_stack);
@@ -5455,7 +5455,7 @@ namespace RoF
RoFSlot.MainSlot = TempSlot;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
return RoFSlot;
}
@@ -5496,7 +5496,7 @@ namespace RoF
RoFSlot.SubSlot = TempSlot - ((RoFSlot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01);
return RoFSlot;
}
@@ -5601,7 +5601,7 @@ namespace RoF
ServerSlot = INVALID_INDEX;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.SlotType, RoFSlot.Unknown02, RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
return ServerSlot;
}
@@ -5636,7 +5636,7 @@ namespace RoF
ServerSlot = TempSlot;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoFSlot.MainSlot, RoFSlot.SubSlot, RoFSlot.AugSlot, RoFSlot.Unknown01, ServerSlot);
return ServerSlot;
}
+17 -17
View File
@@ -52,7 +52,7 @@ namespace RoF2
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
if (!opcodes->LoadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
return;
}
}
@@ -78,7 +78,7 @@ namespace RoF2
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
}
void Reload()
@@ -93,10 +93,10 @@ namespace RoF2
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
return;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
}
}
@@ -382,7 +382,7 @@ namespace RoF2
if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
delete in;
return;
}
@@ -617,7 +617,7 @@ namespace RoF2
if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
delete in;
@@ -651,7 +651,7 @@ namespace RoF2
safe_delete_array(Serialized);
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
}
}
@@ -1452,7 +1452,7 @@ namespace RoF2
char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0, old_item_pkt->PacketType);
if (!serialized) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
return;
}
@@ -2640,7 +2640,7 @@ namespace RoF2
// Think we need 1 byte of padding at the end
outapp->WriteUInt8(0); // Unknown
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Player Profile Packet is %i bytes", outapp->GetWritePosition());
unsigned char *NewBuffer = new unsigned char[outapp->GetWritePosition()];
memcpy(NewBuffer, outapp->pBuffer, outapp->GetWritePosition());
@@ -3387,7 +3387,7 @@ namespace RoF2
if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
delete in;
return;
}
@@ -3721,7 +3721,7 @@ namespace RoF2
//determine and verify length
int entrycount = in->size / sizeof(Spawn_Struct);
if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
delete in;
return;
}
@@ -3973,7 +3973,7 @@ namespace RoF2
Buffer += 29;
if (Buffer != (BufferStart + PacketSize))
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] SPAWN ENCODE LOGIC PROBLEM: Buffer pointer is now %i from end", Buffer - (BufferStart + PacketSize));
}
//Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Sending zone spawn for %s packet is %i bytes", emu->name, outapp->size);
//_hex(NET__ERROR, outapp->pBuffer, outapp->size);
@@ -4569,7 +4569,7 @@ namespace RoF2
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
//Log.LogDebugType(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot.MainSlot, eq->to_slot.MainSlot);
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] MoveItem SlotType from %i to %i, MainSlot from %i to %i, SubSlot from %i to %i, AugSlot from %i to %i, Unknown01 from %i to %i, Number %u", eq->from_slot.SlotType, eq->to_slot.SlotType, eq->from_slot.MainSlot, eq->to_slot.MainSlot, eq->from_slot.SubSlot, eq->to_slot.SubSlot, eq->from_slot.AugSlot, eq->to_slot.AugSlot, eq->from_slot.Unknown01, eq->to_slot.Unknown01, eq->number_in_stack);
emu->from_slot = RoF2ToServerSlot(eq->from_slot);
emu->to_slot = RoF2ToServerSlot(eq->to_slot);
IN(number_in_stack);
@@ -5546,7 +5546,7 @@ namespace RoF2
RoF2Slot.MainSlot = TempSlot;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
return RoF2Slot;
}
@@ -5587,7 +5587,7 @@ namespace RoF2
RoF2Slot.SubSlot = TempSlot - ((RoF2Slot.MainSlot + 2) * EmuConstants::ITEM_CONTAINER_SIZE);
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert Server Slot %i to RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i", ServerSlot, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01);
return RoF2Slot;
}
@@ -5696,7 +5696,7 @@ namespace RoF2
ServerSlot = RoF2Slot.MainSlot + EmuConstants::CORPSE_BEGIN;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Type %i, Unk2 %i, Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.SlotType, RoF2Slot.Unknown02, RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot);
return ServerSlot;
}
@@ -5731,7 +5731,7 @@ namespace RoF2
ServerSlot = TempSlot;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Convert RoF2 Slots: Main %i, Sub %i, Aug %i, Unk1 %i to Server Slot %i", RoF2Slot.MainSlot, RoF2Slot.SubSlot, RoF2Slot.AugSlot, RoF2Slot.Unknown01, ServerSlot);
return ServerSlot;
}
+11 -11
View File
@@ -50,7 +50,7 @@ namespace SoD
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
if (!opcodes->LoadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
return;
}
}
@@ -76,7 +76,7 @@ namespace SoD
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
}
void Reload()
@@ -91,10 +91,10 @@ namespace SoD
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
return;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
}
}
@@ -247,7 +247,7 @@ namespace SoD
if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
delete in;
return;
}
@@ -359,7 +359,7 @@ namespace SoD
if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
delete in;
@@ -391,7 +391,7 @@ namespace SoD
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
}
}
@@ -967,7 +967,7 @@ namespace SoD
char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0);
if (!serialized) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
return;
}
@@ -2108,7 +2108,7 @@ namespace SoD
if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
delete in;
return;
}
@@ -2363,7 +2363,7 @@ namespace SoD
//determine and verify length
int entrycount = in->size / sizeof(Spawn_Struct);
if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
delete in;
return;
}
@@ -3091,7 +3091,7 @@ namespace SoD
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = SoDToServerSlot(eq->from_slot);
emu->to_slot = SoDToServerSlot(eq->to_slot);
+11 -11
View File
@@ -50,7 +50,7 @@ namespace SoF
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
if (!opcodes->LoadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
return;
}
}
@@ -76,7 +76,7 @@ namespace SoF
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
}
void Reload()
@@ -91,10 +91,10 @@ namespace SoF
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
return;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
}
}
@@ -214,7 +214,7 @@ namespace SoF
//determine and verify length
int entrycount = in->size / sizeof(BazaarSearchResults_Struct);
if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
delete in;
return;
@@ -337,7 +337,7 @@ namespace SoF
if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
delete in;
@@ -371,7 +371,7 @@ namespace SoF
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
}
}
@@ -766,7 +766,7 @@ namespace SoF
char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0);
if (!serialized) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
return;
}
@@ -1707,7 +1707,7 @@ namespace SoF
if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
delete in;
return;
}
@@ -1887,7 +1887,7 @@ namespace SoF
//determine and verify length
int entrycount = in->size / sizeof(Spawn_Struct);
if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
delete in;
return;
}
@@ -2429,7 +2429,7 @@ namespace SoF
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = SoFToServerSlot(eq->from_slot);
emu->to_slot = SoFToServerSlot(eq->to_slot);
+4 -4
View File
@@ -64,7 +64,7 @@
//check length of packet before decoding. Call before setup.
#define ENCODE_LENGTH_EXACT(struct_) \
if((*p)->size != sizeof(struct_)) { \
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \
_hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \
delete *p; \
*p = nullptr; \
@@ -72,7 +72,7 @@
}
#define ENCODE_LENGTH_ATLEAST(struct_) \
if((*p)->size < sizeof(struct_)) { \
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on outbound %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName((*p)->GetOpcode()), (*p)->size, sizeof(struct_)); \
_hex(NET__STRUCT_HEX, (*p)->pBuffer, (*p)->size); \
delete *p; \
*p = nullptr; \
@@ -127,14 +127,14 @@
#define DECODE_LENGTH_EXACT(struct_) \
if(__packet->size != sizeof(struct_)) { \
__packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \
_hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \
return; \
}
#define DECODE_LENGTH_ATLEAST(struct_) \
if(__packet->size < sizeof(struct_)) { \
__packet->SetOpcode(OP_Unknown); /* invalidate the packet */ \
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Netcode, "Wrong size on incoming %s (" #struct_ "): Got %d, expected at least %d", opcodes->EmuToName(__packet->GetOpcode()), __packet->size, sizeof(struct_)); \
_hex(NET__STRUCT_HEX, __packet->pBuffer, __packet->size); \
return; \
}
+11 -11
View File
@@ -48,7 +48,7 @@ namespace Titanium
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
if (!opcodes->LoadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
return;
}
}
@@ -74,7 +74,7 @@ namespace Titanium
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
}
void Reload()
@@ -89,10 +89,10 @@ namespace Titanium
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
return;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
}
}
@@ -187,7 +187,7 @@ namespace Titanium
//determine and verify length
int entrycount = in->size / sizeof(BazaarSearchResults_Struct);
if (entrycount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
delete in;
return;
@@ -268,7 +268,7 @@ namespace Titanium
int itemcount = in->size / sizeof(InternalSerializedItem_Struct);
if (itemcount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
delete in;
return;
}
@@ -285,7 +285,7 @@ namespace Titanium
safe_delete_array(serialized);
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
}
}
@@ -635,7 +635,7 @@ namespace Titanium
char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0);
if (!serialized) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
return;
}
@@ -1157,7 +1157,7 @@ namespace Titanium
if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
delete in;
return;
}
@@ -1274,7 +1274,7 @@ namespace Titanium
//determine and verify length
int entrycount = in->size / sizeof(Spawn_Struct);
if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
delete in;
return;
}
@@ -1623,7 +1623,7 @@ namespace Titanium
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = TitaniumToServerSlot(eq->from_slot);
emu->to_slot = TitaniumToServerSlot(eq->to_slot);
+11 -11
View File
@@ -50,7 +50,7 @@ namespace Underfoot
//TODO: figure out how to support shared memory with multiple patches...
opcodes = new RegularOpcodeManager();
if (!opcodes->LoadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error loading opcodes file %s. Not registering patch %s.", opfile.c_str(), name);
return;
}
}
@@ -76,7 +76,7 @@ namespace Underfoot
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[IDENTIFY] Registered patch %s", name);
}
void Reload()
@@ -91,10 +91,10 @@ namespace Underfoot
opfile += name;
opfile += ".conf";
if (!opcodes->ReloadOpcodes(opfile.c_str())) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Error reloading opcodes file %s for patch %s.", opfile.c_str(), name);
return;
}
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[OPCODES] Reloaded opcodes for patch %s", name);
}
}
@@ -307,7 +307,7 @@ namespace Underfoot
if (EntryCount == 0 || (in->size % sizeof(BazaarSearchResults_Struct)) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(BazaarSearchResults_Struct));
delete in;
return;
}
@@ -494,7 +494,7 @@ namespace Underfoot
if (ItemCount == 0 || (in->size % sizeof(InternalSerializedItem_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d",
opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(InternalSerializedItem_Struct));
delete in;
@@ -526,7 +526,7 @@ namespace Underfoot
safe_delete_array(Serialized);
}
else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Serialization failed on item slot %d during OP_CharInventory. Item skipped.", eq->slot_id);
}
}
@@ -1190,7 +1190,7 @@ namespace Underfoot
char *serialized = SerializeItem((ItemInst *)int_struct->inst, int_struct->slot_id, &length, 0);
if (!serialized) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Serialization failed on item slot %d.", int_struct->slot_id);
delete in;
return;
}
@@ -2374,7 +2374,7 @@ namespace Underfoot
if (EntryCount == 0 || ((in->size % sizeof(Track_Struct))) != 0)
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Track_Struct));
delete in;
return;
}
@@ -2624,7 +2624,7 @@ namespace Underfoot
//determine and verify length
int entrycount = in->size / sizeof(Spawn_Struct);
if (entrycount == 0 || (in->size % sizeof(Spawn_Struct)) != 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Wrong size on outbound %s: Got %d, expected multiple of %d", opcodes->EmuToName(in->GetOpcode()), in->size, sizeof(Spawn_Struct));
delete in;
return;
}
@@ -3406,7 +3406,7 @@ namespace Underfoot
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[ERROR] Moved item from %u to %u", eq->from_slot, eq->to_slot);
emu->from_slot = UnderfootToServerSlot(eq->from_slot);
emu->to_slot = UnderfootToServerSlot(eq->to_slot);
+7 -7
View File
@@ -135,7 +135,7 @@ bool PersistentTimer::Load(Database *db) {
auto results = db->QueryDatabase(query);
if (!results.Success()) {
#if EQDEBUG > 5
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Store, error: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Null timer during ->Check()!?\n");
Log.Out(EQEmuLogSys::General, 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
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PersistentTimer::Clear, error: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in PTimerList::ClearOffline, error: %s", results.ErrorMessage().c_str());
#endif
return false;
}
+18 -18
View File
@@ -107,7 +107,7 @@ bool RuleManager::ListRules(const char *catname, std::vector<const char *> &into
if(catname != nullptr) {
cat = FindCategory(catname);
if(cat == InvalidCategory) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find category '%s'", catname);
return(false);
}
}
@@ -168,18 +168,18 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas
switch(type) {
case IntRule:
m_RuleIntValues [index] = atoi(rule_value);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %d", rule_name, m_RuleIntValues[index]);
break;
case RealRule:
m_RuleRealValues[index] = atof(rule_value);
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %.13f", rule_name, m_RuleRealValues[index]);
break;
case BoolRule:
uint32 val = 0;
if(!strcasecmp(rule_value, "on") || !strcasecmp(rule_value, "true") || !strcasecmp(rule_value, "yes") || !strcasecmp(rule_value, "enabled") || !strcmp(rule_value, "1"))
val = 1;
m_RuleBoolValues[index] = val;
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Set rule %s to value %s", rule_name, m_RuleBoolValues[index] == 1 ?"true":"false");
break;
}
@@ -190,7 +190,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas
}
void RuleManager::ResetRules() {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Resetting running rules to default values");
#define RULE_INT(cat, rule, default_value) \
m_RuleIntValues[ Int__##rule ] = default_value;
#define RULE_REAL(cat, rule, default_value) \
@@ -214,7 +214,7 @@ bool RuleManager::_FindRule(const char *rule_name, RuleType &type_into, uint16 &
return(true);
}
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find rule '%s'", rule_name);
return(false);
}
@@ -241,14 +241,14 @@ void RuleManager::SaveRules(Database *db, const char *ruleset) {
m_activeRuleset = _FindOrCreateRuleset(db, ruleset);
if(m_activeRuleset == -1) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to find or create rule set %s", ruleset);
return;
}
m_activeName = ruleset;
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into rule set %s (%d)", ruleset, m_activeRuleset);
} else {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Saving running rules into running rule set %s", m_activeName.c_str(), m_activeRuleset);
}
int r;
@@ -269,11 +269,11 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) {
int rsid = GetRulesetID(db, ruleset);
if(rsid < 0) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Failed to find ruleset '%s' for load operation. Canceling.", ruleset);
return(false);
}
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Loading rule set '%s' (%d)", ruleset, rsid);
m_activeRuleset = rsid;
m_activeName = ruleset;
@@ -282,13 +282,13 @@ bool RuleManager::LoadRules(Database *db, const char *ruleset) {
auto results = db->QueryDatabase(query);
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
for(auto row = results.begin(); row != results.end(); ++row)
if(!SetRule(row[0], row[1], nullptr, false))
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Unable to interpret rule record for %s", row[0]);
return true;
}
@@ -314,7 +314,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
m_activeRuleset, _GetRuleName(type, index), vstr);
auto results = db->QueryDatabase(query);
if (!results.Success())
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to set rule in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str());
}
@@ -329,7 +329,7 @@ int RuleManager::GetRulesetID(Database *db, const char *rulesetname) {
safe_delete_array(rst);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
return -1;
}
@@ -356,7 +356,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) {
auto results = db->QueryDatabase(query);
if (!results.Success())
{
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %s: %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Rules, "Fauled to create rule set in the database: %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())
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadRules query %s: %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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())
{
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in ListRulesets query %s: %s", query.c_str(), results.ErrorMessage().c_str());
return false;
}
+53 -53
View File
@@ -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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error runing inventory verification query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "UpdateSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteInventorySlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "DeleteSharedBankSlot, bags query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::GetSharedBank(uint32 account_id): %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error,
Log.Out(EQEmuLogSys::General, 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;
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i",
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.DoLog(EQEmuLogSys::General, 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");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error,"Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, slot_id);
Log.Out(EQEmuLogSys::General, 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
Log.DoLog(EQEmuLogSys::General, 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);
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i",char_id, item_id, slot_id);
Log.Out(EQEmuLogSys::General, 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()){
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.DoLog(EQEmuLogSys::General, 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");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "GetInventory query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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)
Log.DoLog(EQEmuLogSys::General, 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);
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetItemsCount '%s': '%s'", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Items: %s", ex.what());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "LoadItems '%s', %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Database::LoadItems: %s", ex.what());
break;
}
}
@@ -1079,7 +1079,7 @@ std::string SharedDatabase::GetBook(const char *txtfile)
}
if (results.RowCount() == 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "No book to send, (%s)", txtfile);
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting npc faction info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading npc factions: %s", ex.what());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateItem()");
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()");
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Item Data = ID: %u, Name: %s, Charges: %i", item->ID, item->Name, charges);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error: valid item data returned a null reference for ItemInst creation in SharedDatabase::CreateBaseItem()");
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps: %s", ex.what());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading skill caps from database: %s", results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str());
return;
}
@@ -1482,7 +1482,7 @@ int SharedDatabase::GetMaxSpellID() {
std::string query = "SELECT MAX(id) FROM spells_new";
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in GetMaxSpellID query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
return -1;
}
@@ -1497,12 +1497,12 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
const std::string query = "SELECT * FROM spells_new ORDER BY id ASC";
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Error in LoadSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
return;
}
if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT);
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT);
return;
}
@@ -1512,7 +1512,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
for (auto row = results.begin(); row != results.end(); ++row) {
tempid = atoi(row[0]);
if(tempid >= max_spells) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring.");
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "Non fatal error: spell.id >= max_spells, ignoring.");
continue;
}
@@ -1658,7 +1658,7 @@ int SharedDatabase::GetMaxBaseDataLevel() {
const std::string query = "SELECT MAX(level) FROM base_data";
auto results = QueryDatabase(query);
if (!results.Success()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in GetMaxBaseDataLevel query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error Loading Base Data: %s", ex.what());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error in LoadBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring.");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level <= 0, ignoring.");
continue;
}
if(lvl >= max_level) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring.");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.level >= max_level, ignoring.");
continue;
}
if(cl <= 0) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring.");
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.cl <= 0, ignoring.");
continue;
}
if(cl > 16) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Non fatal error: base_data.class > 16, ignoring.");
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot table info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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()) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error getting loot drop info from database: %s, %s", query.c_str(), results.ErrorMessage().c_str());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Error loading loot: %s", ex.what());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot table: %s", ex.what());
Log.Out(EQEmuLogSys::General, 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) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what());
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Error, "Could not get loot drop: %s", ex.what());
}
return nullptr;
}
+1 -1
View File
@@ -839,7 +839,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType)
// If we have a DamageShieldType for this spell from the damageshieldtypes table, return that,
// else, make a guess, based on the resist type. Default return value is DS_THORNS
if (IsValidSpell(spell_id)) {
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id,
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id,
spells[spell_id].name, spells[spell_id].DamageShieldType);
if (spells[spell_id].DamageShieldType)
+2 -2
View File
@@ -39,13 +39,13 @@ void StructStrategy::ErrorEncoder(EQApplicationPacket **in_p, EQStream *dest, bo
EQApplicationPacket *p = *in_p;
*in_p = nullptr;
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode()));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error encoding opcode %s: no encoder provided. Dropping.", OpcodeManager::EmuToName(p->GetOpcode()));
delete p;
}
void StructStrategy::ErrorDecoder(EQApplicationPacket *p) {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode()));
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[STRUCTS] Error decoding opcode %s: no decoder provided. Invalidating.", OpcodeManager::EmuToName(p->GetOpcode()));
p->SetOpcode(OP_Unknown);
}
+2 -2
View File
@@ -900,7 +900,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) {
}
TCPConnection* tcpc = (TCPConnection*) tmp;
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ " Starting TCPConnectionLoop with thread ID %d", pthread_self());
#endif
tcpc->MLoopRunning.lock();
while (tcpc->RunLoop()) {
@@ -927,7 +927,7 @@ ThreadReturnType TCPConnection::TCPConnectionLoop(void* tmp) {
tcpc->MLoopRunning.unlock();
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::TCP_Connection, __FUNCTION__ "Ending TCPConnectionLoop with thread ID %d", pthread_self());
#endif
THREAD_RETURN(nullptr);
+2 -2
View File
@@ -68,7 +68,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) {
BaseTCPServer* tcps = (BaseTCPServer*) tmp;
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Starting TCPServerLoop with thread ID %d", pthread_self());
#endif
tcps->MLoopRunning.lock();
@@ -79,7 +79,7 @@ ThreadReturnType BaseTCPServer::TCPServerLoop(void* tmp) {
tcps->MLoopRunning.unlock();
#ifndef WIN32
Log.DoLog(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self());
Log.Out(EQEmuLogSys::Detail, EQEmuLogSys::None, "Ending TCPServerLoop with thread ID %d", pthread_self());
#endif
THREAD_RETURN(nullptr);
+3 -3
View File
@@ -43,7 +43,7 @@ void TimeoutManager::CheckTimeouts() {
Timeoutable *it = *cur;
if(it->next_check.Check()) {
#ifdef TIMEOUT_DEBUG
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Checking timeout on 0x%x\n", it);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "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
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Adding timeoutable 0x%x\n", who);
#endif
}
void TimeoutManager::DeleteMember(Timeoutable *who) {
#ifdef TIMEOUT_DEBUG
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::None,, "Removing timeoutable 0x%x\n", who);
#endif
std::vector<Timeoutable *>::iterator cur,end;
cur = members.begin();
+2 -2
View File
@@ -44,7 +44,7 @@ bool WorldConnection::SendPacket(ServerPacket* pack) {
void WorldConnection::OnConnected() {
const EQEmuConfig *Config=EQEmuConfig::get();
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] Connected to World: %s:%d", Config->WorldIP.c_str(), Config->WorldTCPPort);
ServerPacket* pack = new ServerPacket(ServerOP_ZAAuth, 16);
MD5::Generate((const uchar*) m_password.c_str(), m_password.length(), pack->pBuffer);
@@ -76,7 +76,7 @@ bool WorldConnection::Connect() {
if (tcpc.Connect(Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf)) {
return true;
} else {
Log.DoLog(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf);
Log.Out(EQEmuLogSys::General, EQEmuLogSys::Netcode, "[WORLD] WorldConnection connect: Connecting to the server %s:%d failed: %s", Config->WorldIP.c_str(), Config->WorldTCPPort, errbuf);
}
return false;
}