Core/PacketIO: Updated CMSG_VOICE_SESSION_ENABLE and CMSG_SET_ACTIVE_VOICE_CHANNEL for further usage

This commit is contained in:
Carbenium
2016-02-03 16:47:24 +01:00
parent 6715a91907
commit ca967f4374
6 changed files with 95 additions and 13 deletions

View File

@@ -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*>();
}

View File

@@ -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"

View File

@@ -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));
}

View File

@@ -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__

View File

@@ -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);

View File

@@ -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);