mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[8389] Implement check really read received packet size and warning it not all data read.
* This let more easy catch packet structure chnages at client switch. * Fixed structure CMSG_GUILD_BANK_SWAP_ITEMS * Fixed structure CMSG_SPLIT_ITEM, CMSG_SELL_ITEM * Added read data amount fixes for some other packets. Thanks to TOM_RUS in help check correct packets structure. Note: not all packets possible fixed. Please report for not fixed cases at errors: "opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)"
This commit is contained in:
parent
17b94e1e09
commit
35121cdd34
12 changed files with 82 additions and 41 deletions
|
|
@ -614,12 +614,14 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
|
|||
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
|
||||
if(!guild)
|
||||
{
|
||||
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
|
||||
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
|
||||
return;
|
||||
}
|
||||
|
||||
else if(GetPlayer()->GetGUID() != guild->GetLeader())
|
||||
{
|
||||
recvPacket.rpos(recvPacket.wpos()); // set to end to avoid warnings spam
|
||||
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1026,9 +1028,14 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
uint64 GoGuid;
|
||||
uint8 BankToBank;
|
||||
|
||||
uint8 BankTab, BankTabSlot, AutoStore, AutoStoreCount, PlayerSlot, PlayerBag, SplitedAmount = 0;
|
||||
uint8 BankTabDst, BankTabSlotDst, unk2, ToChar = 1;
|
||||
uint8 BankTab, BankTabSlot, AutoStore;
|
||||
uint8 PlayerSlot = NULL_SLOT;
|
||||
uint8 PlayerBag = NULL_BAG;
|
||||
uint8 BankTabDst, BankTabSlotDst, unk2;
|
||||
uint8 ToChar = 1;
|
||||
uint32 ItemEntry, unk1;
|
||||
uint32 AutoStoreCount = 0;
|
||||
uint32 SplitedAmount = 0;
|
||||
|
||||
recv_data >> GoGuid >> BankToBank;
|
||||
if (BankToBank)
|
||||
|
|
@ -1042,10 +1049,11 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
recv_data >> unk2; // always 0
|
||||
recv_data >> SplitedAmount;
|
||||
|
||||
if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS)
|
||||
return;
|
||||
if (BankTabDst == BankTab && BankTabSlotDst == BankTabSlot)
|
||||
if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || BankTabDst == BankTab && BankTabSlotDst == BankTabSlot)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1056,17 +1064,22 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
if (AutoStore)
|
||||
{
|
||||
recv_data >> AutoStoreCount;
|
||||
recv_data.read_skip<uint8>(); // ToChar (?), always and expected to be 1 (autostore only triggered in guild->ToChar)
|
||||
recv_data.read_skip<uint32>(); // unknown, always 0
|
||||
}
|
||||
recv_data >> PlayerBag;
|
||||
recv_data >> PlayerSlot;
|
||||
if (!AutoStore)
|
||||
else
|
||||
{
|
||||
recv_data >> PlayerBag;
|
||||
recv_data >> PlayerSlot;
|
||||
recv_data >> ToChar;
|
||||
recv_data >> SplitedAmount;
|
||||
}
|
||||
|
||||
if (BankTabSlot >= GUILD_BANK_MAX_SLOTS && BankTabSlot != 0xFF)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
|
|
@ -1201,14 +1214,6 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data )
|
|||
|
||||
// Player <-> Bank
|
||||
|
||||
// char->bank autostore click return BankTabSlot = 255 = NULL_SLOT
|
||||
// do similar for bank->char
|
||||
if(AutoStore && ToChar)
|
||||
{
|
||||
PlayerBag = NULL_BAG;
|
||||
PlayerSlot = NULL_SLOT;
|
||||
}
|
||||
|
||||
// allow work with inventory only
|
||||
if(!Player::IsInventoryPos(PlayerBag,PlayerSlot) && !(PlayerBag == NULL_BAG && PlayerSlot == NULL_SLOT) )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue