mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[8382] Implement ByteArray functions for skip read of fields not needed for server in received packets.
* Use this fucntions in some case. * Change some packets to form: read fields first check later for better control recieved packets structure. * Fix CMSG_STAND_STATE_CHANGE packet structure to more correct.
This commit is contained in:
parent
74d27294aa
commit
2b534cbc23
9 changed files with 77 additions and 41 deletions
|
|
@ -610,11 +610,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
|||
void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
|
||||
recv_data.hexlike();
|
||||
|
||||
// ignore if we already in BG or BG queue
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
//recv_data.hexlike();
|
||||
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
uint8 arenaslot; // 2v2, 3v3 or 5v5
|
||||
|
|
@ -624,6 +620,10 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
|
|||
|
||||
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
||||
|
||||
// ignore if we already in BG or BG queue
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
|
||||
void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data)
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR");
|
||||
recv_data.hexlike();
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR"); // empty
|
||||
|
||||
time_t cur_time = time(NULL);
|
||||
|
||||
|
|
@ -74,27 +73,23 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data)
|
|||
{
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_GET_EVENT");
|
||||
recv_data.hexlike();
|
||||
//uint64 unk1;
|
||||
//recv_data >> (uint64)unk1;
|
||||
recv_data.read_skip<uint64>(); // unk
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data)
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_GUILD_FILTER");
|
||||
recv_data.hexlike();
|
||||
//uint32 unk1, unk2, unk3;
|
||||
//recv_data >> (uint32)unk1;
|
||||
//recv_data >> (uint32)unk2;
|
||||
//recv_data >> (uint32)unk3;
|
||||
recv_data.read_skip<uint32>(); // unk1
|
||||
recv_data.read_skip<uint32>(); // unk2
|
||||
recv_data.read_skip<uint32>(); // unk3
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data)
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_ARENA_TEAM");
|
||||
recv_data.hexlike();
|
||||
//uint32 unk;
|
||||
//recv_data >> (uint32)unk;
|
||||
|
||||
recv_data.read_skip<uint32>(); // unk
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data)
|
||||
|
|
@ -241,10 +236,9 @@ void WorldSession::HandleCalendarComplain(WorldPacket &recv_data)
|
|||
//recv_data >> uint64
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarGetNumPending(WorldPacket &recv_data)
|
||||
void WorldSession::HandleCalendarGetNumPending(WorldPacket & /*recv_data*/)
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_GET_NUM_PENDING");
|
||||
recv_data.hexlike();
|
||||
sLog.outDebug("WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
|
||||
data << uint32(0); // 0 - no pending invites, 1 - some pending invites
|
||||
|
|
|
|||
|
|
@ -608,8 +608,6 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
|
|||
std::string rankname;
|
||||
uint32 rankId;
|
||||
uint32 rights, MoneyPerDay;
|
||||
uint32 BankRights;
|
||||
uint32 BankSlotPerDay;
|
||||
|
||||
//sLog.outDebug("WORLD: Received CMSG_GUILD_RANK");
|
||||
|
||||
|
|
@ -633,10 +631,14 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
|
|||
|
||||
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
{
|
||||
uint32 BankRights;
|
||||
uint32 BankSlotPerDay;
|
||||
|
||||
recvPacket >> BankRights;
|
||||
recvPacket >> BankSlotPerDay;
|
||||
guild->SetBankRightsAndSlots(rankId, uint8(i), uint16(BankRights & 0xFF), uint16(BankSlotPerDay), true);
|
||||
}
|
||||
|
||||
sLog.outDebug("WORLD: Changed RankName to %s , Rights to 0x%.4X", rankname.c_str(), rights);
|
||||
|
||||
guild->SetBankMoneyPerDay(rankId, MoneyPerDay);
|
||||
|
|
|
|||
|
|
@ -410,8 +410,8 @@ void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandleStandStateChangeOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
sLog.outDebug( "WORLD: Received CMSG_STAND_STATE_CHANGE" );
|
||||
uint8 animstate;
|
||||
// sLog.outDebug( "WORLD: Received CMSG_STANDSTATECHANGE" ); -- too many spam in log at lags/debug stop
|
||||
uint32 animstate;
|
||||
recv_data >> animstate;
|
||||
|
||||
_player->SetStandState(animstate);
|
||||
|
|
@ -982,11 +982,12 @@ void WorldSession::HandleNextCinematicCamera( WorldPacket & /*recv_data*/ )
|
|||
DEBUG_LOG( "WORLD: Which movie to play" );
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleMoveTimeSkippedOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
/* WorldSession::Update( getMSTime() );*/
|
||||
DEBUG_LOG( "WORLD: Time Lag/Synchronization Resent/Update" );
|
||||
|
||||
recv_data.read_skip2<uint64,uint32>();
|
||||
/*
|
||||
uint64 guid;
|
||||
uint32 time_skipped;
|
||||
|
|
@ -1007,19 +1008,20 @@ void WorldSession::HandleFeatherFallAck(WorldPacket &/*recv_data*/)
|
|||
DEBUG_LOG("WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveUnRootAck(WorldPacket&/* recv_data*/)
|
||||
void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
|
||||
{
|
||||
/*
|
||||
sLog.outDebug( "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK" );
|
||||
|
||||
sLog.outDebug( "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK" );
|
||||
recv_data.read_skip<uint64>(); // guid
|
||||
recv_data.read_skip<uint64>(); // unknown1
|
||||
recv_data.read_skip<uint32>(); // unknown2
|
||||
recv_data.read_skip<float>(); // PositionX
|
||||
recv_data.read_skip<float>(); // PositionY
|
||||
recv_data.read_skip<float>(); // PositionZ
|
||||
recv_data.read_skip<float>(); // Orientation
|
||||
|
||||
/*
|
||||
recv_data.hexlike();
|
||||
uint64 guid;
|
||||
uint64 unknown1;
|
||||
uint32 unknown2;
|
||||
float PositionX;
|
||||
float PositionY;
|
||||
float PositionZ;
|
||||
float Orientation;
|
||||
|
||||
recv_data >> guid;
|
||||
recv_data >> unknown1;
|
||||
|
|
@ -1040,8 +1042,16 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket&/* recv_data*/)
|
|||
*/
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveRootAck(WorldPacket&/* recv_data*/)
|
||||
void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
|
||||
{
|
||||
recv_data.read_skip<uint64>(); // guid
|
||||
recv_data.read_skip<uint64>(); // unknown1
|
||||
recv_data.read_skip<uint32>(); // unknown2
|
||||
recv_data.read_skip<float>(); // PositionX
|
||||
recv_data.read_skip<float>(); // PositionY
|
||||
recv_data.read_skip<float>(); // PositionZ
|
||||
recv_data.read_skip<float>(); // Orientation
|
||||
|
||||
/*
|
||||
sLog.outDebug( "WORLD: CMSG_FORCE_MOVE_ROOT_ACK" );
|
||||
recv_data.hexlike();
|
||||
|
|
@ -1088,8 +1098,9 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
|
|||
GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, ActionBar);
|
||||
}
|
||||
|
||||
void WorldSession::HandleWardenDataOpcode(WorldPacket& /*recv_data*/)
|
||||
void WorldSession::HandleWardenDataOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
recv_data.read_skip<uint8>();
|
||||
/*
|
||||
uint8 tmp;
|
||||
recv_data >> tmp;
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
uint32 entry;
|
||||
recv_data >> entry;
|
||||
recv_data.read_skip<uint64>(); // guid
|
||||
|
||||
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
|
||||
if (ci)
|
||||
|
|
@ -219,6 +220,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
uint32 entryID;
|
||||
recv_data >> entryID;
|
||||
recv_data.read_skip<uint64>(); // guid
|
||||
|
||||
const GameObjectInfo *info = objmgr.GetGameObjectInfo(entryID);
|
||||
if(info)
|
||||
|
|
|
|||
|
|
@ -348,10 +348,9 @@ void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket)
|
|||
if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// increments with every CANCEL packet, don't use for now
|
||||
uint8 counter;
|
||||
uint32 spellId;
|
||||
recvPacket >> counter;
|
||||
|
||||
recvPacket.read_skip<uint8>(); // counter, increments with every CANCEL packet, don't use for now
|
||||
recvPacket >> spellId;
|
||||
|
||||
//FIXME: hack, ignore unexpected client cancel Deadly Throw cast
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ void WorldSession::HandleVoiceSessionEnableOpcode( WorldPacket & recv_data )
|
|||
{
|
||||
sLog.outDebug("WORLD: CMSG_VOICE_SESSION_ENABLE");
|
||||
// uint8 isVoiceEnabled, uint8 isMicrophoneEnabled
|
||||
recv_data.read_skip2<uint8,uint8>();
|
||||
recv_data.hexlike();
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +40,7 @@ void WorldSession::HandleChannelVoiceOnOpcode( WorldPacket & recv_data )
|
|||
void WorldSession::HandleSetActiveVoiceChannel( WorldPacket & recv_data )
|
||||
{
|
||||
sLog.outDebug("WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL");
|
||||
// uint32, string
|
||||
recv_data.read_skip<uint32>();
|
||||
recv_data.read_skip<char*>();
|
||||
recv_data.hexlike();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,6 +259,32 @@ class ByteBuffer
|
|||
return _wpos;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void read_skip() { read_skip(sizeof(T)); }
|
||||
|
||||
template<typename T1, typename T2>
|
||||
void read_skip2() { read_skip(sizeof(T1)+sizeof(T2)); }
|
||||
|
||||
template<>
|
||||
void read_skip<char*>()
|
||||
{
|
||||
uint8 size = read<uint8>();
|
||||
read_skip(size);
|
||||
}
|
||||
|
||||
template<>
|
||||
void read_skip<char const*>() { read_skip<char*>(); }
|
||||
|
||||
template<>
|
||||
void read_skip<std::string>() { read_skip<char*>(); }
|
||||
|
||||
void read_skip(size_t skip)
|
||||
{
|
||||
if(_rpos + skip > size())
|
||||
throw ByteBufferException(false, _rpos, skip, size());
|
||||
_rpos += skip;
|
||||
}
|
||||
|
||||
template <typename T> T read()
|
||||
{
|
||||
T r = read<T>(_rpos);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8381"
|
||||
#define REVISION_NR "8382"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue