diff options
author | Intel <chemicstry@gmail.com> | 2014-11-15 22:00:31 +0200 |
---|---|---|
committer | Intel <chemicstry@gmail.com> | 2014-11-15 22:00:31 +0200 |
commit | 2120868d34a2255c9b26012dc5168e204d8f8e91 (patch) | |
tree | be71e9d7e00948af7e1eaae56ae2e1fe05f4d9cb /src | |
parent | 7d88f8c491837dcfd02995a32310c196102200ce (diff) |
Core/Packets: Added CMSG_ATTACKSWING and SMSG_ATTACKSTOP
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Handlers/CombatHandler.cpp | 12 | ||||
-rw-r--r-- | src/server/game/Server/Packets/CombatPackets.cpp | 23 | ||||
-rw-r--r-- | src/server/game/Server/Packets/CombatPackets.h | 47 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 5 | ||||
-rw-r--r-- | src/server/game/Server/WorldSession.h | 10 |
5 files changed, 86 insertions, 11 deletions
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index 99aae6f5d0d..deac92d1b0b 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -27,15 +27,13 @@ #include "VehicleDefines.h" #include "Player.h" #include "Opcodes.h" +#include "CombatPackets.h" -void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) +void WorldSession::HandleAttackSwingOpcode(WorldPackets::Combat::AttackSwing& packet) { - ObjectGuid guid; - recvData >> guid; + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message %s", packet.Victim.ToString().c_str()); - TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.ToString().c_str()); - - Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid); + Unit* pEnemy = ObjectAccessor::GetUnit(*_player, packet.Victim); if (!pEnemy) { @@ -68,7 +66,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) _player->Attack(pEnemy, true); } -void WorldSession::HandleAttackStopOpcode(WorldPacket & /*recvData*/) +void WorldSession::HandleAttackStopOpcode(WorldPackets::Combat::AttackStop& /*recvData*/) { GetPlayer()->AttackStop(); } diff --git a/src/server/game/Server/Packets/CombatPackets.cpp b/src/server/game/Server/Packets/CombatPackets.cpp new file mode 100644 index 00000000000..17c0599d266 --- /dev/null +++ b/src/server/game/Server/Packets/CombatPackets.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> + * + * 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "CombatPackets.h" + +void WorldPackets::Combat::AttackSwing::Read() +{ + _worldPacket >> Victim; +} diff --git a/src/server/game/Server/Packets/CombatPackets.h b/src/server/game/Server/Packets/CombatPackets.h new file mode 100644 index 00000000000..2402daf6b22 --- /dev/null +++ b/src/server/game/Server/Packets/CombatPackets.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> + * + * 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef CombatPackets_h__ +#define CombatPackets_h__ + +#include "Packet.h" + +namespace WorldPackets +{ + namespace Combat + { + class AttackSwing final : public ClientPacket + { + public: + AttackSwing(WorldPacket&& packet) : ClientPacket(CMSG_ATTACKSWING, std::move(packet)) { } + + void Read() override; + + ObjectGuid Victim; + }; + + class AttackStop final : public ClientPacket + { + public: + AttackStop(WorldPacket&& packet) : ClientPacket(CMSG_ATTACKSTOP, std::move(packet)) { } + + void Read() override {}; + }; + } +} + +#endif // CombatPackets_h__ diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index f2f9f39481e..417a7420361 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -19,6 +19,7 @@ #include "Opcodes.h" #include "WorldSession.h" #include "Packets/CharacterPackets.h" +#include "Packets/CombatPackets.h" #include "Packets/GuildPackets.h" #include "Packets/MiscPackets.h" #include "Packets/MovementPackets.h" @@ -132,8 +133,8 @@ void OpcodeTable::Initialize() DEFINE_OPCODE_HANDLER_OLD(CMSG_ARENA_TEAM_QUERY, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleArenaTeamQueryOpcode ); DEFINE_OPCODE_HANDLER_OLD(CMSG_ARENA_TEAM_REMOVE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleArenaTeamRemoveOpcode ); DEFINE_OPCODE_HANDLER_OLD(CMSG_ARENA_TEAM_ROSTER, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleArenaTeamRosterOpcode ); - DEFINE_OPCODE_HANDLER_OLD(CMSG_ATTACKSTOP, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::HandleAttackStopOpcode ); - DEFINE_OPCODE_HANDLER_OLD(CMSG_ATTACKSWING, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::HandleAttackSwingOpcode ); + DEFINE_HANDLER(CMSG_ATTACKSTOP, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Combat::AttackStop, &WorldSession::HandleAttackStopOpcode); + DEFINE_HANDLER(CMSG_ATTACKSWING, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Combat::AttackSwing, &WorldSession::HandleAttackSwingOpcode); DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_HELLO, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionHelloOpcode ); DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_LIST_BIDDER_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListBidderItems ); DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_LIST_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListItems ); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 37cfc414702..445e7412629 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -96,6 +96,12 @@ namespace WorldPackets class LoadingScreenNotify; } + namespace Combat + { + class AttackSwing; + class AttackStop; + } + namespace Guild { class QueryGuildInfo; @@ -765,8 +771,8 @@ class WorldSession void HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket); void HandleWrapItemOpcode(WorldPacket& recvPacket); - void HandleAttackSwingOpcode(WorldPacket& recvPacket); - void HandleAttackStopOpcode(WorldPacket& recvPacket); + void HandleAttackSwingOpcode(WorldPackets::Combat::AttackSwing& packet); + void HandleAttackStopOpcode(WorldPackets::Combat::AttackStop& packet); void HandleSetSheathedOpcode(WorldPacket& recvPacket); void HandleUseItemOpcode(WorldPacket& recvPacket); |