diff options
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
| -rw-r--r-- | src/server/game/Handlers/MiscHandler.cpp | 102 |
1 files changed, 53 insertions, 49 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 942eae9c54..fd5167cbe1 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -468,7 +468,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT); } - GetPlayer()->SetRooted(true); + GetPlayer()->SetRooted(true, true, true); GetPlayer()->SetUnitFlag(UNIT_FLAG_STUNNED); } @@ -492,7 +492,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCance // not remove flags if can't free move - its not set in Logout request code. if (GetPlayer()->CanFreeMove()) { - GetPlayer()->SetRooted(false); + GetPlayer()->SetRooted(false, true, true); GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND); GetPlayer()->RemoveUnitFlag(UNIT_FLAG_STUNNED); @@ -949,12 +949,6 @@ void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/) GetPlayer()->GetCinematicMgr()->BeginCinematic(); } -void WorldSession::HandleFeatherFallAck(WorldPacket& recv_data) -{ - // no used - recv_data.rfinish(); // prevent warnings spam -} - void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) { uint8 ActionBar; @@ -1144,45 +1138,18 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) LOG_DEBUG("network", "Received whois command from player {} for character {}", GetPlayer()->GetName(), charname); } -void WorldSession::HandleComplainOpcode(WorldPacket& recv_data) +void WorldSession::HandleComplainOpcode(WorldPackets::Misc::Complain& packet) { LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN"); - uint8 spam_type; // 0 - mail, 1 - chat - ObjectGuid spammer_guid; - uint32 unk1 = 0; - uint32 unk2 = 0; - uint32 unk3 = 0; - uint32 unk4 = 0; - std::string description = ""; - recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat) - recv_data >> spammer_guid; // player guid - switch (spam_type) - { - case 0: - recv_data >> unk1; // const 0 - recv_data >> unk2; // probably mail id - recv_data >> unk3; // const 0 - break; - case 1: - recv_data >> unk1; // probably language - recv_data >> unk2; // message type? - recv_data >> unk3; // probably channel id - recv_data >> unk4; // unk random value - recv_data >> description; // spam description string (messagetype, channel name, player name, message) - break; - } - // NOTE: all chat messages from this spammer automatically ignored by spam reporter until logout in case chat spam. // if it's mail spam - ALL mails from this spammer automatically removed by client // Complaint Received message - WorldPacket data(SMSG_COMPLAIN_RESULT, 1); - data << uint8(0); - SendPacket(&data); + SendPacket(WorldPackets::Misc::ComplainResult().Write()); LOG_DEBUG("network", "REPORT SPAM: type {}, {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}", - spam_type, spammer_guid.ToString(), unk1, unk2, unk3, unk4, description); + packet.SpamType, packet.SpammerGuid.ToString(), packet.Unk1, packet.Unk2, packet.Unk3, packet.Unk4, packet.Description); } void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data) @@ -1519,12 +1486,15 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recv_data*/) _player->RemoveAurasByType(SPELL_AURA_MOUNTED); } -void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data) +void WorldSession::HandleMoveFlagChangeOpcode(WorldPacket& recv_data) { - // fly mode on/off - LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); + LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging((Opcodes)recv_data.GetOpcode())); + + Opcodes opcode = (Opcodes)recv_data.GetOpcode(); ObjectGuid guid; + uint32 counter; + uint32 isApplied; recv_data >> guid.ReadAsPacked(); if (!_player) @@ -1533,17 +1503,51 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data) return; } - recv_data.read_skip<uint32>(); // unk + recv_data >> counter; MovementInfo movementInfo; movementInfo.guid = guid; ReadMovementInfo(recv_data, &movementInfo); - recv_data.read_skip<float>(); // unk2 + if (opcode != CMSG_MOVE_GRAVITY_DISABLE_ACK && opcode != CMSG_MOVE_GRAVITY_ENABLE_ACK) + recv_data >> isApplied; sScriptMgr->AnticheatSetCanFlybyServer(_player, movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY)); - _player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags(); + Unit* mover = _player->m_mover; + Player* plrMover = mover->ToPlayer(); + + mover->m_movementInfo.flags = movementInfo.GetMovementFlags(); + + // old map - async processing, ignore + if (counter <= _player->GetMapChangeOrderCounter()) + return; + + if (!ProcessMovementInfo(movementInfo, mover, plrMover, recv_data)) + { + recv_data.rfinish(); // prevent warnings spam + return; + } + + if (_player->GetPendingFlightChange() == counter && opcode == CMSG_MOVE_SET_CAN_FLY_ACK) + _player->SetPendingFlightChange(false); + + Opcodes response; + + switch (recv_data.GetOpcode()) + { + case CMSG_MOVE_HOVER_ACK: response = MSG_MOVE_HOVER; break; + case CMSG_MOVE_FEATHER_FALL_ACK: response = MSG_MOVE_FEATHER_FALL; break; + case CMSG_MOVE_WATER_WALK_ACK: response = MSG_MOVE_WATER_WALK; break; + case CMSG_MOVE_SET_CAN_FLY_ACK: response = MSG_MOVE_UPDATE_CAN_FLY; break; + case CMSG_MOVE_GRAVITY_DISABLE_ACK: response = MSG_MOVE_GRAVITY_CHNG; break; + case CMSG_MOVE_GRAVITY_ENABLE_ACK: response = MSG_MOVE_GRAVITY_CHNG; break; + default: return; + } + + WorldPacket data(response, 8); + WriteMovementInfo(&data, &movementInfo); + _player->m_mover->SendMessageToSet(&data, _player); } void WorldSession::HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& /*packet*/) |
