diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-07-19 22:01:51 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-07-19 22:01:51 +0200 |
commit | 83b32667940844a257059965711284c9ab38ce44 (patch) | |
tree | 4363ea5822256d78d6e8d117083391a158fadd1b /src | |
parent | ff59362aa9dcf69cf957dfb9eeb3c1b888b6dd68 (diff) |
Core/PacketIO: Remove packet handlers for deleted opcodes
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Battlefield/Battlefield.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Handlers/BattlefieldHandler.cpp | 169 | ||||
-rw-r--r-- | src/server/game/Server/Packets/AllPackets.h | 1 | ||||
-rw-r--r-- | src/server/game/Server/Packets/BattlefieldPackets.cpp | 88 | ||||
-rw-r--r-- | src/server/game/Server/Packets/BattlefieldPackets.h | 133 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.h | 9 | ||||
-rw-r--r-- | src/server/game/Server/WorldSession.h | 28 |
7 files changed, 2 insertions, 434 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 75166c6beeb..6542277bea1 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -111,7 +111,6 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end()) { m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID()); - player->GetSession()->SendBfLeaveMessage(GetQueueId(), GetState(), player->GetZoneId() == GetZoneId()); if (Group* group = player->GetGroup()) // Remove the player from the raid group group->RemoveMember(player->GetGUID()); @@ -214,7 +213,7 @@ void Battlefield::InvitePlayerToQueue(Player* player) return; if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer) - player->GetSession()->SendBfInvitePlayerToQueue(GetQueueId(), GetState()); + PlayerAcceptInviteToQueue(player); } void Battlefield::InvitePlayersInQueueToWar() @@ -290,7 +289,7 @@ void Battlefield::InvitePlayerToWar(Player* player) m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID()); m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + m_TimeForAcceptInvite; - player->GetSession()->SendBfInvitePlayerToWar(GetQueueId(), m_ZoneId, m_TimeForAcceptInvite); + PlayerAcceptInviteToWar(player); } void Battlefield::InitStalker(uint32 entry, Position const& pos) @@ -370,8 +369,6 @@ void Battlefield::PlayerAcceptInviteToQueue(Player* player) { // Add player in queue m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID()); - // Send notification - player->GetSession()->SendBfQueueInviteResponse(GetQueueId(), m_ZoneId, GetState()); } // Called in WorldSession::HandleBfExitRequest @@ -397,7 +394,6 @@ void Battlefield::PlayerAcceptInviteToWar(Player* player) if (AddOrSetPlayerToCorrectBfGroup(player)) { - player->GetSession()->SendBfEntered(GetQueueId(), player->GetZoneId() != GetZoneId(), player->GetTeamId() == GetAttackerTeam()); m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID()); m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID()); diff --git a/src/server/game/Handlers/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp deleted file mode 100644 index d8fe4153d5a..00000000000 --- a/src/server/game/Handlers/BattlefieldHandler.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * This file is part of the TrinityCore 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 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 "WorldSession.h" -#include "Battlefield.h" -#include "BattlefieldMgr.h" -#include "BattlefieldPackets.h" -#include "GameTime.h" -#include "Player.h" - -/** - * @fn void WorldSession::SendBfInvitePlayerToWar(uint64 queueId, uint32 zoneId, uint32 acceptTime) - * - * @brief This send to player windows for invite player to join the war. - * - * @param queueId The queue id of Bf - * @param zoneId The zone where the battle is (4197 for wg) - * @param acceptTime Time in second that the player have for accept - */ -void WorldSession::SendBfInvitePlayerToWar(uint64 queueId, uint32 zoneId, uint32 acceptTime) -{ - WorldPackets::Battlefield::BFMgrEntryInvite bfMgrEntryInvite; - bfMgrEntryInvite.QueueID = queueId; - bfMgrEntryInvite.AreaID = zoneId; - bfMgrEntryInvite.ExpireTime = GameTime::GetGameTime() + acceptTime; - SendPacket(bfMgrEntryInvite.Write()); -} - -/** - * @fn void WorldSession::SendBfInvitePlayerToQueue(uint64 queueId, int8 battleState) - * - * @brief This send invitation to player to join the queue. - * - * @param queueId The queue id of Bf - */ -void WorldSession::SendBfInvitePlayerToQueue(uint64 queueId, int8 battleState) -{ - WorldPackets::Battlefield::BFMgrQueueInvite bfMgrQueueInvite; - bfMgrQueueInvite.QueueID = queueId; - bfMgrQueueInvite.BattleState = battleState; - SendPacket(bfMgrQueueInvite.Write()); -} - -/** - * @fn void WorldSession::SendBfQueueInviteResponse(uint64 queueId, uint32 zoneId, int8 battleStatus, bool canQueue, bool loggingIn) - * - * @brief This send packet for inform player that he join queue. - * - * @param queueId The queue id of Bf - * @param zoneId The zone where the battle is (4197 for wg) - * @param battleStatus Battlefield status - * @param canQueue if able to queue - * @param loggingIn on log in send queue status - */ -void WorldSession::SendBfQueueInviteResponse(uint64 queueId, uint32 zoneId, int8 battleStatus, bool canQueue /*= true*/, bool loggingIn /*= false*/) -{ - WorldPackets::Battlefield::BFMgrQueueRequestResponse bfMgrQueueRequestResponse; - bfMgrQueueRequestResponse.QueueID = queueId; - bfMgrQueueRequestResponse.AreaID = zoneId; - bfMgrQueueRequestResponse.Result = canQueue ? 1 : 0; - bfMgrQueueRequestResponse.BattleState = battleStatus; - bfMgrQueueRequestResponse.LoggingIn = loggingIn; - SendPacket(bfMgrQueueRequestResponse.Write()); -} - -/** - * @fn void WorldSession::SendBfEntered(uint64 queueId, bool relocated, bool onOffense) - * - * @brief This is call when player accept to join war. - * - * @param queueId The queue id of Bf - * @param relocated Whether player is added to Bf on the spot or teleported from queue - * @param onOffense Whether player belongs to attacking team or not - */ -void WorldSession::SendBfEntered(uint64 queueId, bool relocated, bool onOffense) -{ - WorldPackets::Battlefield::BFMgrEntering bfMgrEntering; - bfMgrEntering.ClearedAFK = _player->isAFK(); - bfMgrEntering.Relocated = relocated; - bfMgrEntering.OnOffense = onOffense; - bfMgrEntering.QueueID = queueId; - SendPacket(bfMgrEntering.Write()); -} - -/** - * @fn void WorldSession::SendBfLeaveMessage(uint64 queueId, int8 battleState, bool relocated, BFLeaveReason reason) - * - * @brief This is call when player leave battlefield zone. - * - * @param queueId The queue id of Bf - * @param battleState Battlefield status - * @param relocated Whether player is added to Bf on the spot or teleported from queue - * @param reason Reason why player left battlefield - */ -void WorldSession::SendBfLeaveMessage(uint64 queueId, int8 battleState, bool relocated, BFLeaveReason reason /*= BF_LEAVE_REASON_EXITED*/) -{ - WorldPackets::Battlefield::BFMgrEjected bfMgrEjected; - bfMgrEjected.QueueID = queueId; - bfMgrEjected.Reason = reason; - bfMgrEjected.BattleState = battleState; - bfMgrEjected.Relocated = relocated; - SendPacket(bfMgrEjected.Write()); -} - -/** - * @fn void WorldSession::HandleBfEntryInviteResponse(WorldPackets::Battlefield::BFMgrEntryInviteResponse& bfMgrEntryInviteResponse) - * - * @brief Send by client on clicking in accept or refuse of invitation windows for join game. - */ -void WorldSession::HandleBfEntryInviteResponse(WorldPackets::Battlefield::BFMgrEntryInviteResponse& bfMgrEntryInviteResponse) -{ - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByQueueId(bfMgrEntryInviteResponse.QueueID); - if (!bf) - return; - - // If player accept invitation - if (bfMgrEntryInviteResponse.AcceptedInvite) - { - bf->PlayerAcceptInviteToWar(_player); - } - else - { - if (_player->GetZoneId() == bf->GetZoneId()) - bf->KickPlayerFromBattlefield(_player->GetGUID()); - } -} - -/** - * @fn void WorldSession::HandleBfQueueInviteResponse(WorldPackets::Battlefield::BFMgrQueueInviteResponse& bfMgrQueueInviteResponse) - * - * @brief Send by client when he click on accept for queue. - */ -void WorldSession::HandleBfQueueInviteResponse(WorldPackets::Battlefield::BFMgrQueueInviteResponse& bfMgrQueueInviteResponse) -{ - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByQueueId(bfMgrQueueInviteResponse.QueueID); - if (!bf) - return; - - if (bfMgrQueueInviteResponse.AcceptedInvite) - bf->PlayerAcceptInviteToQueue(_player); -} - -/** - * @fn void WorldSession::HandleBfExitRequest(WorldPackets::Battlefield::BFMgrQueueExitRequest& bfMgrQueueExitRequest) - * - * @brief Send by client when exited battlefield - */ -void WorldSession::HandleBfQueueExitRequest(WorldPackets::Battlefield::BFMgrQueueExitRequest& bfMgrQueueExitRequest) -{ - Battlefield* bf = sBattlefieldMgr->GetBattlefieldByQueueId(bfMgrQueueExitRequest.QueueID); - if (!bf) - return; - - bf->AskToLeaveQueue(_player); -} diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h index 6b2898d9655..eab189b56e9 100644 --- a/src/server/game/Server/Packets/AllPackets.h +++ b/src/server/game/Server/Packets/AllPackets.h @@ -29,7 +29,6 @@ #include "AzeritePackets.h" #include "BankPackets.h" #include "BlackMarketPackets.h" -#include "BattlefieldPackets.h" #include "BattlegroundPackets.h" #include "BattlenetPackets.h" #include "BattlePetPackets.h" diff --git a/src/server/game/Server/Packets/BattlefieldPackets.cpp b/src/server/game/Server/Packets/BattlefieldPackets.cpp deleted file mode 100644 index 90433d50d51..00000000000 --- a/src/server/game/Server/Packets/BattlefieldPackets.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is part of the TrinityCore 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 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 "BattlefieldPackets.h" - -WorldPacket const* WorldPackets::Battlefield::BFMgrEntryInvite::Write() -{ - _worldPacket << uint64(QueueID); - _worldPacket << uint32(AreaID); - _worldPacket << uint32(ExpireTime); - return &_worldPacket; -} - -void WorldPackets::Battlefield::BFMgrEntryInviteResponse::Read() -{ - _worldPacket >> QueueID; - AcceptedInvite = _worldPacket.ReadBit(); -} - -WorldPacket const* WorldPackets::Battlefield::BFMgrQueueInvite::Write() -{ - _worldPacket << uint64(QueueID); - _worldPacket << int8(BattleState); - _worldPacket << uint32(Timeout); - _worldPacket << int32(MinLevel); - _worldPacket << int32(MaxLevel); - _worldPacket << int32(MapID); - _worldPacket << uint32(InstanceID); - _worldPacket.WriteBit(Index != 0); - _worldPacket.FlushBits(); - return &_worldPacket; -} - -void WorldPackets::Battlefield::BFMgrQueueInviteResponse::Read() -{ - _worldPacket >> QueueID; - AcceptedInvite = _worldPacket.ReadBit(); -} - -WorldPacket const* WorldPackets::Battlefield::BFMgrQueueRequestResponse::Write() -{ - _worldPacket << uint64(QueueID); - _worldPacket << int32(AreaID); - _worldPacket << int8(Result); - _worldPacket << FailedPlayerGUID; - _worldPacket << int8(BattleState); - _worldPacket.WriteBit(LoggingIn); - _worldPacket.FlushBits(); - return &_worldPacket; -} - -void WorldPackets::Battlefield::BFMgrQueueExitRequest::Read() -{ - _worldPacket >> QueueID; -} - -WorldPacket const* WorldPackets::Battlefield::BFMgrEntering::Write() -{ - _worldPacket.WriteBit(ClearedAFK); - _worldPacket.WriteBit(Relocated); - _worldPacket.WriteBit(OnOffense); - _worldPacket << uint64(QueueID); - return &_worldPacket; -} - -WorldPacket const* WorldPackets::Battlefield::BFMgrEjected::Write() -{ - _worldPacket << uint64(QueueID); - _worldPacket << int8(Reason); - _worldPacket << int8(BattleState); - _worldPacket.WriteBit(Relocated); - _worldPacket.FlushBits(); - return &_worldPacket; -} diff --git a/src/server/game/Server/Packets/BattlefieldPackets.h b/src/server/game/Server/Packets/BattlefieldPackets.h deleted file mode 100644 index 6c01cc0937b..00000000000 --- a/src/server/game/Server/Packets/BattlefieldPackets.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This file is part of the TrinityCore 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 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 BattlefieldPackets_h__ -#define BattlefieldPackets_h__ - -#include "Packet.h" -#include "ObjectGuid.h" -#include <limits> - -namespace WorldPackets -{ - namespace Battlefield - { - class BFMgrEntryInvite final : public ServerPacket - { - public: - BFMgrEntryInvite() : ServerPacket(SMSG_BF_MGR_ENTRY_INVITE, 8 + 4 + 4) { } - - WorldPacket const* Write() override; - - uint64 QueueID = 0; - int32 AreaID = 0; - time_t ExpireTime = time_t(0); - }; - - class BFMgrEntryInviteResponse final : public ClientPacket - { - public: - BFMgrEntryInviteResponse(WorldPacket&& packet) : ClientPacket(CMSG_BF_MGR_ENTRY_INVITE_RESPONSE, std::move(packet)) { } - - void Read() override; - - uint64 QueueID = 0; - bool AcceptedInvite = false; - }; - - class BFMgrQueueInvite final : public ServerPacket - { - public: - BFMgrQueueInvite() : ServerPacket(SMSG_BF_MGR_QUEUE_INVITE, 8 + 4 + 4 + 4 + 4 + 4 + 1 + 1) { } - - WorldPacket const* Write() override; - - uint64 QueueID = 0; - int8 BattleState = 0; - uint32 Timeout = std::numeric_limits<uint32>::max(); // unused in client - int32 MinLevel = 0; // unused in client - int32 MaxLevel = 0; // unused in client - int32 MapID = 0; // unused in client - uint32 InstanceID = 0; // unused in client - int8 Index = 0; // unused in client - }; - - class BFMgrQueueInviteResponse final : public ClientPacket - { - public: - BFMgrQueueInviteResponse(WorldPacket&& packet) : ClientPacket(CMSG_BF_MGR_QUEUE_INVITE_RESPONSE, std::move(packet)) { } - - void Read() override; - - uint64 QueueID = 0; - bool AcceptedInvite = false; - }; - - class BFMgrQueueRequestResponse final : public ServerPacket - { - public: - BFMgrQueueRequestResponse() : ServerPacket(SMSG_BF_MGR_QUEUE_REQUEST_RESPONSE, 8 + 4 + 1 + 16 + 1 + 1) { } - - WorldPacket const* Write() override; - - uint64 QueueID = 0; - int32 AreaID = 0; - int8 Result = 0; - ObjectGuid FailedPlayerGUID; - int8 BattleState = 0; - bool LoggingIn = false; - }; - - class BFMgrQueueExitRequest final : public ClientPacket - { - public: - BFMgrQueueExitRequest(WorldPacket&& packet) : ClientPacket(CMSG_BF_MGR_QUEUE_EXIT_REQUEST, std::move(packet)) { } - - void Read() override; - - uint64 QueueID = 0; - }; - - class BFMgrEntering final : public ServerPacket - { - public: - BFMgrEntering() : ServerPacket(SMSG_BF_MGR_ENTERING, 1 + 8) { } - - WorldPacket const* Write() override; - - bool ClearedAFK = false; - bool Relocated = false; - bool OnOffense = false; - uint64 QueueID = 0; - }; - - class BFMgrEjected final : public ServerPacket - { - public: - BFMgrEjected() : ServerPacket(SMSG_BF_MGR_EJECTED, 8 + 1 + 1 + 1) { } - - WorldPacket const* Write() override; - - uint64 QueueID = 0; - int8 Reason = 0; - int8 BattleState = 0; - bool Relocated = false; - }; - } -} - -#endif // BattlefieldPackets_h__ diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 44494fd60bd..9b46b07f36b 100644 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -837,10 +837,6 @@ enum OpcodeClient : uint16 CMSG_WHO_IS = 0x367F, CMSG_WORLD_PORT_RESPONSE = 0x35F9, CMSG_WRAP_ITEM = 0x3994, - - CMSG_BF_MGR_ENTRY_INVITE_RESPONSE = 0xBADD, - CMSG_BF_MGR_QUEUE_INVITE_RESPONSE = 0xBADD, - CMSG_BF_MGR_QUEUE_EXIT_REQUEST = 0xBADD, }; enum OpcodeServer : uint16 @@ -1987,11 +1983,6 @@ enum OpcodeServer : uint16 // Deleted opcodes, here only to allow compile SMSG_ARENA_TEAM_STATS = 0xBADD, - SMSG_BF_MGR_EJECTED = 0xBADD, - SMSG_BF_MGR_ENTERING = 0xBADD, - SMSG_BF_MGR_ENTRY_INVITE = 0xBADD, - SMSG_BF_MGR_QUEUE_INVITE = 0xBADD, - SMSG_BF_MGR_QUEUE_REQUEST_RESPONSE = 0xBADD, }; inline bool IsInstanceOnlyOpcode(uint32 opcode) diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index b440ec68c42..4b267810455 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -166,13 +166,6 @@ namespace WorldPackets class ReagentBank; } - namespace Battlefield - { - class BFMgrEntryInviteResponse; - class BFMgrQueueInviteResponse; - class BFMgrQueueExitRequest; - } - namespace Battleground { class AreaSpiritHealerQuery; @@ -872,17 +865,6 @@ enum PartyOperation PARTY_OP_SWAP = 4 }; -enum BFLeaveReason -{ - BF_LEAVE_REASON_CLOSE = 1, - //BF_LEAVE_REASON_UNK1 = 2, (not used) - //BF_LEAVE_REASON_UNK2 = 4, (not used) - BF_LEAVE_REASON_EXITED = 8, - BF_LEAVE_REASON_LOW_LEVEL = 10, - BF_LEAVE_REASON_NOT_WHILE_IN_RAID = 15, - BF_LEAVE_REASON_DESERTER = 16 -}; - enum ChatRestrictionType { ERR_CHAT_RESTRICTED = 0, @@ -1604,16 +1586,6 @@ class TC_GAME_API WorldSession void HandleHearthAndResurrect(WorldPackets::Battleground::HearthAndResurrect& hearthAndResurrect); void HandleRequestBattlefieldStatusOpcode(WorldPackets::Battleground::RequestBattlefieldStatus& requestBattlefieldStatus); - // Battlefield - void SendBfInvitePlayerToWar(uint64 queueId, uint32 zoneId, uint32 acceptTime); - void SendBfInvitePlayerToQueue(uint64 queueId, int8 battleState); - void SendBfQueueInviteResponse(uint64 queueId, uint32 zoneId, int8 battleStatus, bool canQueue = true, bool loggingIn = false); - void SendBfEntered(uint64 queueId, bool relocated, bool onOffense); - void SendBfLeaveMessage(uint64 queueId, int8 battleState, bool relocated, BFLeaveReason reason = BF_LEAVE_REASON_EXITED); - void HandleBfEntryInviteResponse(WorldPackets::Battlefield::BFMgrEntryInviteResponse& bfMgrEntryInviteResponse); - void HandleBfQueueInviteResponse(WorldPackets::Battlefield::BFMgrQueueInviteResponse& bfMgrQueueInviteResponse); - void HandleBfQueueExitRequest(WorldPackets::Battlefield::BFMgrQueueExitRequest& bfMgrQueueExitRequest); - void HandleMinimapPingOpcode(WorldPackets::Party::MinimapPingClient& packet); void HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet); void HandleFarSightOpcode(WorldPackets::Misc::FarSight& packet); |