Core/PacketIO: Fix some more "unprocessed tail data" errors.
Also some cleanup.
This commit is contained in:
@@ -158,7 +158,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ADD_EVENT");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//std::string unk1, unk2;
|
||||
//recv_data >> (std::string)unk1;
|
||||
@@ -194,7 +194,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_UPDATE_EVENT");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data >> uint64
|
||||
//recv_data >> uint64
|
||||
@@ -213,7 +213,7 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_REMOVE_EVENT");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data >> uint64
|
||||
//recv_data >> uint64
|
||||
@@ -225,7 +225,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COPY_EVENT");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data >> uint64
|
||||
//recv_data >> uint64
|
||||
@@ -237,7 +237,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_INVITE");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data >> uint64
|
||||
//recv_data >> uint64
|
||||
@@ -251,7 +251,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_RSVP");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data >> uint64
|
||||
//recv_data >> uint64
|
||||
@@ -263,7 +263,7 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data.readPackGUID(guid)
|
||||
//recv_data >> uint64
|
||||
@@ -275,7 +275,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_STATUS");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data.readPackGUID(guid)
|
||||
//recv_data >> uint64
|
||||
@@ -288,7 +288,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data.readPackGUID(guid)
|
||||
//recv_data >> uint64
|
||||
@@ -301,7 +301,7 @@ void WorldSession::HandleCalendarComplain(WorldPacket &recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COMPLAIN");
|
||||
recv_data.hexlike();
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
|
||||
//recv_data >> uint64
|
||||
//recv_data >> uint64
|
||||
|
||||
@@ -73,6 +73,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
|
||||
if (type >= MAX_CHAT_MSG_TYPE)
|
||||
{
|
||||
sLog->outError("CHAT: Wrong message type received: %u", type);
|
||||
recv_data.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -85,6 +86,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
|
||||
if (!langDesc)
|
||||
{
|
||||
SendNotification(LANG_UNKNOWN_LANGUAGE);
|
||||
recv_data.rfinish();
|
||||
return;
|
||||
}
|
||||
if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))
|
||||
@@ -103,6 +105,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
|
||||
if (!foundAura)
|
||||
{
|
||||
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
|
||||
recv_data.rfinish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -167,6 +170,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(NULL));
|
||||
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
recv_data.rfinish(); // Prevent warnings
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
Player *pl;
|
||||
Player *plTarget;
|
||||
|
||||
recvPacket >> guid;
|
||||
|
||||
if (!GetPlayer()->duel) // ignore accept from duel-sender
|
||||
return;
|
||||
|
||||
recvPacket >> guid;
|
||||
|
||||
pl = GetPlayer();
|
||||
plTarget = pl->duel->opponent;
|
||||
|
||||
@@ -55,7 +55,9 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
|
||||
void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_CANCELLED");
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DUEL_CANCELLED");
|
||||
uint64 guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
// no duel requested
|
||||
if (!GetPlayer()->duel)
|
||||
@@ -73,10 +75,5 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
// player either discarded the duel using the "discard button"
|
||||
// or used "/forfeit" before countdown reached 0
|
||||
uint64 guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
GetPlayer()->DuelComplete(DUEL_INTERRUPTED);
|
||||
}
|
||||
|
||||
@@ -363,23 +363,20 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER");
|
||||
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
|
||||
/** error handling **/
|
||||
if (!player || !group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
|
||||
if (!group || !player)
|
||||
return;
|
||||
/********************/
|
||||
|
||||
// Everything's fine, do it
|
||||
if (!group->IsLeader(GetPlayer()->GetGUID()) || player->GetGroup() != group)
|
||||
return;
|
||||
|
||||
// Everything's fine, accepted.
|
||||
group->ChangeLeader(guid);
|
||||
|
||||
group->SendUpdate();
|
||||
}
|
||||
|
||||
@@ -410,15 +407,15 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LOOT_METHOD");
|
||||
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
uint32 lootMethod;
|
||||
uint64 lootMaster;
|
||||
uint32 lootThreshold;
|
||||
recv_data >> lootMethod >> lootMaster >> lootThreshold;
|
||||
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
/** error handling **/
|
||||
if (!group->IsLeader(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
@@ -434,7 +431,10 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleLootRoll(WorldPacket &recv_data)
|
||||
{
|
||||
if (!GetPlayer()->GetGroup())
|
||||
{
|
||||
recv_data.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 Guid;
|
||||
uint32 NumberOfPlayers;
|
||||
|
||||
@@ -424,14 +424,14 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
|
||||
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // Prevent additional spam at rejected packet
|
||||
recv_data.rfinish(); // Prevent additional spam at rejected packet
|
||||
return;
|
||||
}
|
||||
|
||||
Guild* pGuild = _GetPlayerGuild(this);
|
||||
if (!pGuild)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // Prevent additional spam at rejected packet
|
||||
recv_data.rfinish(); // Prevent additional spam at rejected packet
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
|
||||
if (!sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) ||
|
||||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID()))
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos());
|
||||
recv_data.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
|
||||
if (!numDungeons)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID());
|
||||
recv_data.rpos(recv_data.wpos());
|
||||
recv_data.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
||||
if (items_count > MAX_MAIL_ITEMS) // client limit
|
||||
{
|
||||
GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_TOO_MANY_ATTACHMENTS);
|
||||
recv_data.rpos(recv_data.wpos()); // set to end to avoid warnings spam
|
||||
recv_data.rfinish(); // set to end to avoid warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -954,7 +954,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
|
||||
|
||||
if (decompressedSize > 0xFFFF)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case
|
||||
recv_data.rfinish(); // unnneded warning spam in this case
|
||||
sLog->outError("UAD: Account data packet too big, size %u", decompressedSize);
|
||||
return;
|
||||
}
|
||||
@@ -965,12 +965,12 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
|
||||
uLongf realSize = decompressedSize;
|
||||
if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // unnneded warning spam in this case
|
||||
recv_data.rfinish(); // unnneded warning spam in this case
|
||||
sLog->outError("UAD: Failed to decompress account data");
|
||||
return;
|
||||
}
|
||||
|
||||
recv_data.rpos(recv_data.wpos()); // uncompress read (recv_data.size() - recv_data.rpos())
|
||||
recv_data.rfinish(); // uncompress read (recv_data.size() - recv_data.rpos())
|
||||
|
||||
std::string adata;
|
||||
dest >> adata;
|
||||
@@ -1100,13 +1100,13 @@ void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data)
|
||||
sLog->outStaticDebug("WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
|
||||
|
||||
// no used
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
|
||||
{
|
||||
// no used
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
/*
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
@@ -1114,7 +1114,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
|
||||
void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
|
||||
{
|
||||
// no used
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
/*
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
@@ -1140,7 +1140,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
|
||||
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
|
||||
if (plMover && plMover->IsBeingTeleported())
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
|
||||
movementInfo.guid = guid;
|
||||
ReadMovementInfo(recv_data, &movementInfo);
|
||||
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
|
||||
// prevent tampered movement data
|
||||
if (guid != mover->GetGUID())
|
||||
@@ -275,7 +275,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
|
||||
|
||||
if (!movementInfo.pos.IsPositionValid())
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,14 +286,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
|
||||
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
|
||||
if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(),
|
||||
movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation()))
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -546,9 +546,13 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
if (GetPlayer()->m_trade)
|
||||
{
|
||||
recvPacket.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 ID;
|
||||
recvPacket >> ID;
|
||||
|
||||
if (!GetPlayer()->isAlive())
|
||||
{
|
||||
@@ -580,8 +584,6 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
recvPacket >> ID;
|
||||
|
||||
Player* pOther = ObjectAccessor::FindPlayer(ID);
|
||||
|
||||
if (!pOther)
|
||||
|
||||
Reference in New Issue
Block a user