diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/BattleGroundHandler.cpp | 10 | ||||
-rw-r--r-- | src/game/CalendarHandler.cpp | 22 | ||||
-rw-r--r-- | src/game/GuildHandler.cpp | 6 | ||||
-rw-r--r-- | src/game/MiscHandler.cpp | 41 | ||||
-rw-r--r-- | src/game/QueryHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/SpellHandler.cpp | 5 | ||||
-rw-r--r-- | src/game/VoiceChatHandler.cpp | 4 | ||||
-rw-r--r-- | src/shared/ByteBuffer.h | 26 |
8 files changed, 76 insertions, 40 deletions
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 45323313e89..cc6793b8575 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -617,11 +617,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 @@ -631,6 +627,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; diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 0ba22304fb5..cfc853daa82 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -27,8 +27,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); @@ -75,27 +74,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) @@ -242,10 +237,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 diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 5752fd60d20..36f8ffbe327 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -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); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 066ef3d1fd5..543bf7d90be 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -495,8 +495,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); @@ -1035,11 +1035,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; @@ -1060,19 +1061,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" ); + + 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_UNROOT_ACK" ); recv_data.hexlike(); - uint64 guid; - uint64 unknown1; - uint32 unknown2; - float PositionX; - float PositionY; - float PositionZ; - float Orientation; recv_data >> guid; recv_data >> unknown1; @@ -1093,8 +1095,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(); @@ -1141,8 +1151,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; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 63233e8f678..860427e787e 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -154,6 +154,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) @@ -221,6 +222,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) diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index ab1ce6c4ba9..e1e816635aa 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -355,10 +355,9 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket) { - // 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; if(_player->IsNonMeleeSpellCasted(false)) diff --git a/src/game/VoiceChatHandler.cpp b/src/game/VoiceChatHandler.cpp index 0aef129a010..e4c588dc4af 100644 --- a/src/game/VoiceChatHandler.cpp +++ b/src/game/VoiceChatHandler.cpp @@ -28,6 +28,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(); } @@ -41,7 +42,8 @@ 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(); } diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 5e02afd86cf..d4842ec7515 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -261,6 +261,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); |