Core/Misc: improve error log messages by adding more info. Specially for Aokromes.

This commit is contained in:
Azazel
2011-02-17 19:47:08 +06:00
parent aaa9b069d9
commit 4dc1eaa47c
12 changed files with 82 additions and 74 deletions

View File

@@ -295,13 +295,20 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
}
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
if (!classEntry || !raceEntry)
if (!classEntry)
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket(&data);
sLog->outError("Class: %u or Race %u not found in DBC (Wrong DBC files?) or Cheater?", class_, race_);
sLog->outError("Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
return;
}
ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
if (!raceEntry)
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket(&data);
sLog->outError("Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
return;
}

View File

@@ -189,12 +189,11 @@ void WorldSession::QueuePacket(WorldPacket *new_packet)
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnexpectedOpcode(WorldPacket *packet, const char *reason)
void WorldSession::LogUnexpectedOpcode(WorldPacket *packet, const char* status, const char *reason)
{
sLog->outError("SESSION: received unexpected opcode %s (0x%.4X) %s",
LookupOpcodeName(packet->GetOpcode()),
packet->GetOpcode(),
reason);
sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s",
GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, reason);
}
/// Logging helper for unexpected opcodes
@@ -238,7 +237,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
if (!m_playerRecentlyLogout)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN", "the player has not logged in yet");
}
else if (_player->IsInWorld())
{
@@ -251,7 +250,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
break;
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT:
if (!_player && !m_playerRecentlyLogout)
LogUnexpectedOpcode(packet, "the player has not logged in yet and not recently logout");
LogUnexpectedOpcode(packet, "STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT",
"the player has not logged in yet and not recently logout");
else
{
// not expected _player or must checked in packet hanlder
@@ -263,9 +263,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
break;
case STATUS_TRANSFER:
if (!_player)
LogUnexpectedOpcode(packet, "the player has not logged in yet");
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player has not logged in yet");
else if (_player->IsInWorld())
LogUnexpectedOpcode(packet, "the player is still in world");
LogUnexpectedOpcode(packet, "STATUS_TRANSFER", "the player is still in world");
else
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
@@ -278,7 +278,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
// prevent cheating with skip queue wait
if (m_inQueue)
{
LogUnexpectedOpcode(packet, "the player not pass queue yet");
LogUnexpectedOpcode(packet, "STATUS_AUTHED", "the player not pass queue yet");
break;
}
@@ -293,10 +293,14 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
sLog->outError("SESSION: received not allowed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
sLog->outError("SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)",
GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
case STATUS_UNHANDLED:
sLog->outDebug("SESSION: received not handled opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
sLog->outDebug("SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)",
GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
break;
}
}

View File

@@ -882,7 +882,7 @@ class WorldSession
void moveItems(Item* myItems[], Item* hisItems[]);
// logging helper
void LogUnexpectedOpcode(WorldPacket *packet, const char * reason);
void LogUnexpectedOpcode(WorldPacket *packet, const char* status, const char *reason);
void LogUnprocessedTail(WorldPacket *packet);
uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)

View File

@@ -494,8 +494,12 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
sLog->outError ("WorldSocket::handle_input_header: client sent malformed packet size = %d , cmd = %d",
header.size, header.cmd);
Player *_player = m_Session ? m_Session->GetPlayer() : NULL;
sLog->outError ("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d , cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName() : "<none>",
header.size, header.cmd);
errno = EINVAL;
return -1;
@@ -1030,9 +1034,12 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
if (m_Session && m_Session->GetSecurity() == SEC_PLAYER)
{
sLog->outError ("WorldSocket::HandlePing: Player kicked for "
"over-speed pings address = %s",
GetRemoteAddress().c_str());
Player* _player = m_Session->GetPlayer();
sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)",
m_Session->GetAccountId(),
_player ? _player->GetGUIDLow() : 0,
_player ? _player->GetName() : "<none>",
GetRemoteAddress().c_str());
return -1;
}