diff options
author | Carbenium <carbenium@outlook.com> | 2016-02-03 16:47:24 +0100 |
---|---|---|
committer | Carbenium <carbenium@outlook.com> | 2016-02-03 16:47:24 +0100 |
commit | ca967f4374008a6c60540bbc2897fbcc61824372 (patch) | |
tree | 1dc851b14f371ca2bc4efa3d7bf4d6b58ff8b82b | |
parent | 6715a91907628a495deb9e2301d578537c82dce5 (diff) |
Core/PacketIO: Updated CMSG_VOICE_SESSION_ENABLE and CMSG_SET_ACTIVE_VOICE_CHANNEL for further usage
-rw-r--r-- | src/server/game/Handlers/VoiceChatHandler.cpp | 12 | ||||
-rw-r--r-- | src/server/game/Server/Packets/AllPackets.h | 1 | ||||
-rw-r--r-- | src/server/game/Server/Packets/VoicePackets.cpp | 30 | ||||
-rw-r--r-- | src/server/game/Server/Packets/VoicePackets.h | 51 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Server/WorldSession.h | 10 |
6 files changed, 95 insertions, 13 deletions
diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp index 4c96e6bdebb..37d23c120e7 100644 --- a/src/server/game/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Handlers/VoiceChatHandler.cpp @@ -16,20 +16,14 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" -#include "WorldPacket.h" #include "WorldSession.h" +#include "VoicePackets.h" -void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData) +void WorldSession::HandleVoiceSessionEnable(WorldPackets::Voice::VoiceSessionEnable& /*packet*/) { - // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled - recvData.read_skip<uint8>(); - recvData.read_skip<uint8>(); } -void WorldSession::HandleSetActiveVoiceChannel(WorldPacket& recvData) +void WorldSession::HandleSetActiveVoiceChannel(WorldPackets::Voice::SetActiveVoiceChannel& /*packet*/) { - recvData.read_skip<uint32>(); - recvData.read_skip<char*>(); } diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h index f9d06a56286..7a36a726098 100644 --- a/src/server/game/Server/Packets/AllPackets.h +++ b/src/server/game/Server/Packets/AllPackets.h @@ -68,6 +68,7 @@ #include "ToyPackets.h" #include "TradePackets.h" #include "VehiclePackets.h" +#include "VoicePackets.h" #include "VoidStoragePackets.h" #include "WhoPackets.h" #include "WorldStatePackets.h" diff --git a/src/server/game/Server/Packets/VoicePackets.cpp b/src/server/game/Server/Packets/VoicePackets.cpp new file mode 100644 index 00000000000..3e2269a0905 --- /dev/null +++ b/src/server/game/Server/Packets/VoicePackets.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2008-2016 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 "VoicePackets.h" + +void WorldPackets::Voice::VoiceSessionEnable::Read() +{ + EnableVoiceChat = _worldPacket.ReadBit(); + EnableMicrophone = _worldPacket.ReadBit(); +} + +void WorldPackets::Voice::SetActiveVoiceChannel::Read() +{ + _worldPacket >> ChannelType; + ChannelName = _worldPacket.ReadString(_worldPacket.ReadBits(7)); +} diff --git a/src/server/game/Server/Packets/VoicePackets.h b/src/server/game/Server/Packets/VoicePackets.h new file mode 100644 index 00000000000..0ae2645c498 --- /dev/null +++ b/src/server/game/Server/Packets/VoicePackets.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2008-2016 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 VoicePackets_h__ +#define VoicePackets_h__ + +#include "Packet.h" + +namespace WorldPackets +{ + namespace Voice + { + class VoiceSessionEnable final : public ClientPacket + { + public: + VoiceSessionEnable(WorldPacket&& packet) : ClientPacket(CMSG_VOICE_SESSION_ENABLE, std::move(packet)) { } + + void Read() override; + + bool EnableVoiceChat = false; + bool EnableMicrophone = false; + }; + + class SetActiveVoiceChannel final : public ClientPacket + { + public: + SetActiveVoiceChannel(WorldPacket&& packet) : ClientPacket(CMSG_SET_ACTIVE_VOICE_CHANNEL, std::move(packet)) { } + + void Read() override; + + uint8 ChannelType = 0; + std::string ChannelName; + }; + } +} + +#endif // VoicePackets_h__ diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 5eaefb052fd..f0bc08f9f7a 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -673,7 +673,7 @@ void OpcodeTable::Initialize() DEFINE_HANDLER(CMSG_SET_ACTION_BAR_TOGGLES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Character::SetActionBarToggles, &WorldSession::HandleSetActionBarToggles); DEFINE_HANDLER(CMSG_SET_ACTION_BUTTON, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::SetActionButton, &WorldSession::HandleSetActionButtonOpcode); DEFINE_HANDLER(CMSG_SET_ACTIVE_MOVER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Movement::SetActiveMover, &WorldSession::HandleSetActiveMoverOpcode); - DEFINE_OPCODE_HANDLER_OLD(CMSG_SET_ACTIVE_VOICE_CHANNEL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleSetActiveVoiceChannel ); + DEFINE_HANDLER(CMSG_SET_ACTIVE_VOICE_CHANNEL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Voice::SetActiveVoiceChannel, &WorldSession::HandleSetActiveVoiceChannel); DEFINE_HANDLER(CMSG_SET_ADVANCED_COMBAT_LOGGING, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::ClientConfig::SetAdvancedCombatLogging, &WorldSession::HandleSetAdvancedCombatLogging); DEFINE_HANDLER(CMSG_SET_ASSISTANT_LEADER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Party::SetAssistantLeader, &WorldSession::HandleSetAssistantLeaderOpcode); DEFINE_HANDLER(CMSG_SET_BACKPACK_AUTOSORT_DISABLED, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL); @@ -782,7 +782,7 @@ void OpcodeTable::Initialize() DEFINE_HANDLER(CMSG_VIOLENCE_LEVEL, STATUS_AUTHED, PROCESS_INPLACE, WorldPackets::Misc::ViolenceLevel, &WorldSession::HandleViolenceLevel); DEFINE_HANDLER(CMSG_VOICE_ADD_IGNORE, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL); DEFINE_HANDLER(CMSG_VOICE_DEL_IGNORE, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL); - DEFINE_OPCODE_HANDLER_OLD(CMSG_VOICE_SESSION_ENABLE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleVoiceSessionEnableOpcode ); + DEFINE_HANDLER(CMSG_VOICE_SESSION_ENABLE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Voice::VoiceSessionEnable, &WorldSession::HandleVoiceSessionEnable); DEFINE_HANDLER(CMSG_VOID_STORAGE_TRANSFER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::VoidStorage::VoidStorageTransfer, &WorldSession::HandleVoidStorageTransfer); DEFINE_OPCODE_HANDLER_OLD(CMSG_WARDEN_DATA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleWardenDataOpcode ); DEFINE_HANDLER(CMSG_WHO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Who::WhoRequestPkt, &WorldSession::HandleWhoOpcode); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index dfd8ecb0868..9b3f30a14ce 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -665,6 +665,12 @@ namespace WorldPackets class MoveSetVehicleRecIdAck; } + namespace Voice + { + class VoiceSessionEnable; + class SetActiveVoiceChannel; + } + namespace VoidStorage { class UnlockVoidStorage; @@ -1447,8 +1453,8 @@ class WorldSession template<void(Channel::*CommandFunction)(Player const*, std::string const&)> void HandleChannelPlayerCommand(WorldPackets::Channel::ChannelPlayerCommand& packet); - void HandleVoiceSessionEnableOpcode(WorldPacket& recvData); - void HandleSetActiveVoiceChannel(WorldPacket& recvData); + void HandleVoiceSessionEnable(WorldPackets::Voice::VoiceSessionEnable& packet); + void HandleSetActiveVoiceChannel(WorldPackets::Voice::SetActiveVoiceChannel& packet); void HandleCompleteCinematic(WorldPackets::Misc::CompleteCinematic& packet); void HandleNextCinematicCamera(WorldPackets::Misc::NextCinematicCamera& packet); |