Skip to content

Commit

Permalink
[Core/Paccket] Split CMSG_SHOWING_CLOAK, CMSG_SHOWING_HELM to Charact…
Browse files Browse the repository at this point in the history
…erPackets (#326)
  • Loading branch information
leelf00 authored Aug 16, 2024
1 parent ea54225 commit 246807d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 11 deletions.
19 changes: 11 additions & 8 deletions src/server/game/Handlers/CharacterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,18 +1345,21 @@ void WorldSession::HandleRequestForcedReactionsOpcode(WorldPacket& recvData)
_player->GetReputationMgr().SendForceReactions();
}

void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData)
void WorldSession::HandleShowingHelmOpcode(WorldPackets::Character::ShowingHelm& packet)
{
TC_LOG_DEBUG("network", "CMSG_SHOWING_HELM for %s", _player->GetName().c_str());
recvData.read_skip<uint8>(); // unknown, bool?
_player->ToggleFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
if (packet.ShowHelm)
_player->RemoveFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
else
_player->SetFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
}

void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
void WorldSession::HandleShowingCloakOpcode(WorldPackets::Character::ShowingCloak& packet)
{
TC_LOG_DEBUG("network", "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str());
recvData.read_skip<uint8>(); // unknown, bool?
_player->ToggleFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
if (packet.ShowCloak)
_player->RemoveFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
else
_player->SetFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);

}

void WorldSession::SendRenameResult(uint8 result, ObjectGuid guid, std::string name)
Expand Down
10 changes: 10 additions & 0 deletions src/server/game/Server/Packets/CharacterPackets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@

#include "CharacterPackets.h"

void WorldPackets::Character::ShowingCloak::Read()
{
_worldPacket >> ShowCloak;
}

void WorldPackets::Character::ShowingHelm::Read()
{
_worldPacket >> ShowHelm;
}

WorldPacket const* WorldPackets::Character::LogoutResponse::Write()
{
_worldPacket << uint32(LogoutResult);
Expand Down
20 changes: 20 additions & 0 deletions src/server/game/Server/Packets/CharacterPackets.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ namespace WorldPackets
namespace Character
{

class ShowingCloak final : public ClientPacket
{
public:
ShowingCloak(WorldPacket&& packet) : ClientPacket(CMSG_SHOWING_CLOAK, std::move(packet)) { }

void Read() override;

bool ShowCloak = false;
};

class ShowingHelm final : public ClientPacket
{
public:
ShowingHelm(WorldPacket&& packet) : ClientPacket(CMSG_SHOWING_HELM, std::move(packet)) { }

void Read() override;

bool ShowHelm = false;
};

class LogoutResponse final : public ServerPacket
{
public:
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Server/WorldSession.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS 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
Expand Down Expand Up @@ -522,8 +522,8 @@ class TC_GAME_API WorldSession
void HandleMountSpecialAnimOpcode(WorldPacket& recvdata);

// character view
void HandleShowingHelmOpcode(WorldPacket& recvData);
void HandleShowingCloakOpcode(WorldPacket& recvData);
void HandleShowingHelmOpcode(WorldPackets::Character::ShowingHelm& packet);
void HandleShowingCloakOpcode(WorldPackets::Character::ShowingCloak& packet);

// repair
void HandleRepairItemOpcode(WorldPacket& recvPacket);
Expand Down

0 comments on commit 246807d

Please sign in to comment.