diff options
Diffstat (limited to 'src/server/game/Server')
| -rw-r--r-- | src/server/game/Server/Packets/BattlefieldPackets.cpp | 87 | ||||
| -rw-r--r-- | src/server/game/Server/Packets/BattlefieldPackets.h | 132 | ||||
| -rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 17 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.h | 35 |
4 files changed, 250 insertions, 21 deletions
diff --git a/src/server/game/Server/Packets/BattlefieldPackets.cpp b/src/server/game/Server/Packets/BattlefieldPackets.cpp new file mode 100644 index 00000000000..79a1a5e2f31 --- /dev/null +++ b/src/server/game/Server/Packets/BattlefieldPackets.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2008-2015 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 "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); + 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 new file mode 100644 index 00000000000..c27a2c67ab0 --- /dev/null +++ b/src/server/game/Server/Packets/BattlefieldPackets.h @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2008-2015 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 BattlefieldPackets_h__ +#define BattlefieldPackets_h__ + +#include "Packet.h" +#include "ObjectGuid.h" + +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.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index d8a376a124d..0fe303cb26f 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -21,6 +21,7 @@ #include "Packets/AchievementPackets.h" #include "Packets/AuctionHousePackets.h" #include "Packets/BankPackets.h" +#include "Packets/BattlefieldPackets.h" #include "Packets/BattlegroundPackets.h" #include "Packets/BattlePetPackets.h" #include "Packets/BlackMarketPackets.h" @@ -217,9 +218,9 @@ void OpcodeTable::Initialize() DEFINE_HANDLER(CMSG_BATTLE_PET_SUMMON, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::BattlePet::BattlePetSummon, &WorldSession::HandleBattlePetSummon); DEFINE_HANDLER(CMSG_BATTLE_PET_UPDATE_NOTIFY, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL); DEFINE_HANDLER(CMSG_BEGIN_TRADE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Trade::BeginTrade, &WorldSession::HandleBeginTradeOpcode); - DEFINE_OPCODE_HANDLER_OLD(CMSG_BF_MGR_ENTRY_INVITE_RESPONSE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleBfEntryInviteResponse ); - DEFINE_OPCODE_HANDLER_OLD(CMSG_BF_MGR_QUEUE_EXIT_REQUEST, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest); - DEFINE_OPCODE_HANDLER_OLD(CMSG_BF_MGR_QUEUE_INVITE_RESPONSE, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse ); + DEFINE_HANDLER(CMSG_BF_MGR_ENTRY_INVITE_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Battlefield::BFMgrEntryInviteResponse, &WorldSession::HandleBfEntryInviteResponse); + DEFINE_HANDLER(CMSG_BF_MGR_QUEUE_EXIT_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Battlefield::BFMgrQueueExitRequest, &WorldSession::HandleBfQueueExitRequest); + DEFINE_HANDLER(CMSG_BF_MGR_QUEUE_INVITE_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Battlefield::BFMgrQueueInviteResponse, &WorldSession::HandleBfQueueInviteResponse); DEFINE_HANDLER(CMSG_BF_MGR_QUEUE_REQUEST, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL); DEFINE_HANDLER(CMSG_BINDER_ACTIVATE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::NPC::Hello, &WorldSession::HandleBinderActivateOpcode); DEFINE_HANDLER(CMSG_BLACK_MARKET_BID_ON_ITEM, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL); @@ -930,12 +931,12 @@ void OpcodeTable::Initialize() DEFINE_SERVER_OPCODE_HANDLER(SMSG_BATTLE_PET_UPDATES, STATUS_NEVER, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_DROP_TIMER_CANCELLED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_DROP_TIMER_STARTED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); - DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_EJECTED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); + DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_EJECTED, STATUS_NEVER, CONNECTION_TYPE_INSTANCE); DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_EJECT_PENDING, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); - DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_ENTERING, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); - DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_ENTRY_INVITE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); - DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_QUEUE_INVITE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); - DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_QUEUE_REQUEST_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); + DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_ENTERING, STATUS_NEVER, CONNECTION_TYPE_INSTANCE); + DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_ENTRY_INVITE, STATUS_NEVER, CONNECTION_TYPE_REALM); + DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_QUEUE_INVITE, STATUS_NEVER, CONNECTION_TYPE_REALM); + DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_QUEUE_REQUEST_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_QUEUE_STATUS_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_STATE_CHANGED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM); DEFINE_SERVER_OPCODE_HANDLER(SMSG_BINDER_CONFIRM, STATUS_NEVER, CONNECTION_TYPE_REALM); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 302a0522e4c..3134ad331b1 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -104,6 +104,13 @@ namespace WorldPackets class BuyBankSlot; } + namespace Battlefield + { + class BFMgrEntryInviteResponse; + class BFMgrQueueInviteResponse; + class BFMgrQueueExitRequest; + } + namespace Battleground { class AreaSpiritHealerQuery; @@ -719,11 +726,13 @@ enum BarberShopResult enum BFLeaveReason { - BF_LEAVE_REASON_CLOSE = 0x00000001, - //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used) - //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used) - BF_LEAVE_REASON_EXITED = 0x00000008, - BF_LEAVE_REASON_LOW_LEVEL = 0x00000010 + 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 @@ -1444,14 +1453,14 @@ class WorldSession void HandleRequestBattlefieldStatusOpcode(WorldPackets::Battleground::RequestBattlefieldStatus& requestBattlefieldStatus); // Battlefield - void SendBfInvitePlayerToWar(ObjectGuid guid, uint32 zoneId, uint32 time); - void SendBfInvitePlayerToQueue(ObjectGuid guid); - void SendBfQueueInviteResponse(ObjectGuid guid, uint32 zoneId, bool canQueue = true, bool full = false); - void SendBfEntered(ObjectGuid guid); - void SendBfLeaveMessage(ObjectGuid guid, BFLeaveReason reason = BF_LEAVE_REASON_EXITED); - void HandleBfQueueInviteResponse(WorldPacket& recvData); - void HandleBfEntryInviteResponse(WorldPacket& recvData); - void HandleBfExitRequest(WorldPacket& recvData); + 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 HandleWardenDataOpcode(WorldPacket& recvData); void HandleWorldTeleportOpcode(WorldPackets::Misc::WorldTeleport& worldTeleport); |
