refactor(Core/Packet): Chat (#9509)

* Chat

* .

* Update GameObject.cpp

* Update Object.cpp

* Update Player.cpp
This commit is contained in:
IntelligentQuantum
2022-01-08 13:41:06 +03:30
committed by GitHub
parent 03efc110a0
commit 725b1266b4
20 changed files with 153 additions and 48 deletions

View File

@@ -18,6 +18,7 @@
#ifndef AllPackets_h__
#define AllPackets_h__
#include "ChatPackets.h"
#include "CharacterPackets.h"
#include "MiscPackets.h"
#include "WorldStatePackets.h"

View File

@@ -0,0 +1,39 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
* Free Software Foundation; either version 3 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 Affero 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 "ChatPackets.h"
WorldPacket const* WorldPackets::Chat::Emote::Write()
{
_worldPacket << EmoteID;
_worldPacket << Guid;
return &_worldPacket;
}
void WorldPackets::Chat::EmoteClient::Read()
{
_worldPacket >> EmoteID;
}
WorldPacket const* WorldPackets::Chat::ChatServerMessage::Write()
{
_worldPacket << int32(MessageID);
_worldPacket << StringParam;
return &_worldPacket;
}

View File

@@ -0,0 +1,62 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
* Free Software Foundation; either version 3 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 Affero 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 ChatPackets_h__
#define ChatPackets_h__
#include "Packet.h"
#include "ObjectGuid.h"
namespace WorldPackets
{
namespace Chat
{
class Emote final : public ServerPacket
{
public:
Emote() : ServerPacket(SMSG_EMOTE, 4 + 8) { }
WorldPacket const* Write() override;
uint32 EmoteID = 0;
ObjectGuid Guid;
};
class EmoteClient final : public ClientPacket
{
public:
EmoteClient(WorldPacket&& packet) : ClientPacket(CMSG_EMOTE, std::move(packet)) { }
void Read() override;
uint32 EmoteID = 0;
};
class ChatServerMessage final : public ServerPacket
{
public:
ChatServerMessage() : ServerPacket(SMSG_CHAT_SERVER_MESSAGE, 4 + 20) { }
WorldPacket const* Write() override;
int32 MessageID = 0;
std::string StringParam;
};
}
}
#endif // ChatPackets_h__