TrinityCore
Loading...
Searching...
No Matches
ChatPackets.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_CHAT_PACKETS_H
19#define TRINITYCORE_CHAT_PACKETS_H
20
21#include "Packet.h"
22#include "ObjectGuid.h"
23#include "SharedDefines.h"
24
25class WorldObject;
26
27namespace WorldPackets
28{
29 namespace Chat
30 {
31 // CMSG_MESSAGECHAT
33 {
34 public:
36
37 void Read() override;
38
41 std::string Text;
42 std::string Target;
43 };
44
45 // SMSG_MESSAGECHAT
46 // SMSG_GM_MESSAGECHAT
48 {
49 public:
50 explicit Chat() : ServerPacket(SMSG_MESSAGECHAT, 100) { }
51 Chat(Chat const& chat);
52
53 void Initialize(ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0,
54 std::string_view channelName = "", LocaleConstant locale = DEFAULT_LOCALE, std::string_view addonPrefix = "");
55 void SetSender(WorldObject const* sender, LocaleConstant locale);
56 void SetReceiver(WorldObject const* receiver, LocaleConstant locale);
57
58 WorldPacket const* Write() override;
59
60 uint8 SlashCmd = 0;
64 std::string SenderName;
65 std::string TargetName;
66 std::string _Channel;
67 std::string ChatText;
68 uint32 AchievementID = 0;
69 uint8 ChatTag = 0;
70
71 std::size_t TargetGUIDPos = 0;
72 };
73
74 class Emote final : public ServerPacket
75 {
76 public:
77 explicit Emote() : ServerPacket(SMSG_EMOTE, 4 + 8) { }
78
79 WorldPacket const* Write() override;
80
83 };
84
86 {
87 public:
89
90 void Read() override;
91
95 };
96
98 {
99 public:
100 explicit STextEmote() : ServerPacket(SMSG_TEXT_EMOTE, 8 + 4 + 4 + 4 + 48) { }
101
102 WorldPacket const* Write() override;
103
105 std::string_view TargetName;
108 };
109
111 {
112 public:
114
115 void Read() override;
116
118 };
119
121 {
122 public:
124
125 WorldPacket const* Write() override;
126
128 std::string StringParam;
129 };
130 }
131}
132
133#endif // TRINITYCORE_CHAT_PACKETS_H
LocaleConstant
Definition Common.h:48
#define DEFAULT_LOCALE
Definition Common.h:62
#define TC_GAME_API
Definition Define.h:114
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
Language
@ LANG_UNIVERSAL
ChatMsg
CTextEmote(WorldPacket &&packet)
Definition ChatPackets.h:88
ChatMessage(WorldPacket &&packet)
Definition ChatPackets.h:35
std::string Target
Whisper target or channel name.
Definition ChatPackets.h:42
WorldPacket const * Write() override
std::string _Channel
Channel Name.
Definition ChatPackets.h:66
EmoteClient(WorldPacket &&packet)
WorldPacket const * Write() override
WorldPacket const * Write() override
@ CMSG_TEXT_EMOTE
Definition Opcodes.h:289
@ SMSG_MESSAGECHAT
Definition Opcodes.h:179
@ CMSG_EMOTE
Definition Opcodes.h:287
@ SMSG_CHAT_SERVER_MESSAGE
Definition Opcodes.h:686
@ SMSG_EMOTE
Definition Opcodes.h:288
@ SMSG_TEXT_EMOTE
Definition Opcodes.h:290
@ CMSG_MESSAGECHAT
Definition Opcodes.h:178
STL namespace.