TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ChatPackets.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 ChatPackets_h__
19 #define ChatPackets_h__
20 
21 #include "Packet.h"
22 #include "SharedDefines.h"
23 #include "ObjectGuid.h"
24 #include "PacketUtilities.h"
25 
26 class WorldObject;
27 
28 namespace WorldPackets
29 {
30  namespace Chat
31  {
32  // CMSG_CHAT_MESSAGE_GUILD
33  // CMSG_CHAT_MESSAGE_OFFICER
34  // CMSG_CHAT_MESSAGE_YELL
35  // CMSG_CHAT_MESSAGE_SAY
36  // CMSG_CHAT_MESSAGE_PARTY
37  // CMSG_CHAT_MESSAGE_RAID
38  // CMSG_CHAT_MESSAGE_RAID_WARNING
39  // CMSG_CHAT_MESSAGE_INSTANCE_CHAT
40  class ChatMessage final : public ClientPacket
41  {
42  public:
43  ChatMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
44 
45  void Read() override;
46 
47  std::string Text;
49  };
50 
51  // CMSG_CHAT_MESSAGE_WHISPER
52  class ChatMessageWhisper final : public ClientPacket
53  {
54  public:
55  ChatMessageWhisper(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
56 
57  void Read() override;
58 
60  std::string Text;
61  std::string Target;
62  };
63 
64  // CMSG_CHAT_MESSAGE_CHANNEL
65  class ChatMessageChannel final : public ClientPacket
66  {
67  public:
68  ChatMessageChannel(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
69 
70  void Read() override;
71 
73  std::string Text;
74  std::string Target;
75  };
76 
77  // CMSG_CHAT_ADDON_MESSAGE_GUILD
78  // CMSG_CHAT_ADDON_MESSAGE_OFFICER
79  // CMSG_CHAT_ADDON_MESSAGE_PARTY
80  // CMSG_CHAT_ADDON_MESSAGE_RAID
81  // CMSG_CHAT_ADDON_MESSAGE_INSTANCE_CHAT
82  class ChatAddonMessage final : public ClientPacket
83  {
84  public:
85  ChatAddonMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
86 
87  void Read() override;
88 
89  std::string Prefix;
90  std::string Text;
91  };
92 
93  // CMSG_CHAT_ADDON_MESSAGE_WHISPER
95  {
96  public:
98 
99  void Read() override;
100 
101  std::string Prefix;
102  std::string Target;
103  std::string Text;
104  };
105 
106  // CMSG_CHAT_ADDON_MESSAGE_CHANNEL
108  {
109  public:
111 
112  void Read() override;
113 
114  std::string Text;
115  std::string Target;
116  std::string Prefix;
117  };
118 
119  class ChatMessageDND final : public ClientPacket
120  {
121  public:
123 
124  void Read() override;
125 
126  std::string Text;
127  };
128 
129  class ChatMessageAFK final : public ClientPacket
130  {
131  public:
133 
134  void Read() override;
135 
136  std::string Text;
137  };
138 
139  class ChatMessageEmote final : public ClientPacket
140  {
141  public:
143 
144  void Read() override;
145 
146  std::string Text;
147  };
148 
149  // SMSG_CHAT
150  class TC_GAME_API Chat final : public ServerPacket
151  {
152  public:
154  Chat(Chat const& chat);
155 
156  void Initialize(ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string message, uint32 achievementId = 0, std::string channelName = "", LocaleConstant locale = DEFAULT_LOCALE, std::string addonPrefix = "");
157  void SetSender(WorldObject const* sender, LocaleConstant locale);
158  void SetReceiver(WorldObject const* receiver, LocaleConstant locale);
159 
160  WorldPacket const* Write() override;
161 
162  uint8 SlashCmd = 0;
163  uint8 _Language = LANG_UNIVERSAL;
169  uint32 SenderVirtualAddress = 0;
170  uint32 TargetVirtualAddress = 0;
171  std::string SenderName;
172  std::string TargetName;
173  std::string Prefix;
174  std::string _Channel;
175  std::string ChatText;
176  uint32 AchievementID = 0;
177  uint8 _ChatFlags = 0;
178  float DisplayTime = 0.0f;
179  bool HideChatLog = false;
180  bool FakeSenderName = false;
181  };
182 
183  class Emote final : public ServerPacket
184  {
185  public:
186  Emote() : ServerPacket(SMSG_EMOTE, 18 + 4) { }
187 
188  WorldPacket const* Write() override;
189 
192  };
193 
194  class CTextEmote final : public ClientPacket
195  {
196  public:
198 
199  void Read() override;
200 
204  };
205 
206  class STextEmote final : public ServerPacket
207  {
208  public:
209  STextEmote() : ServerPacket(SMSG_TEXT_EMOTE, 3 * 18 + 2 * 4) { }
210 
211  WorldPacket const* Write() override;
212 
218  };
219 
221  {
222  public:
223  PrintNotification(std::string const& notifyText) : ServerPacket(SMSG_PRINT_NOTIFICATION, 2 + notifyText.size()), NotifyText(notifyText) { }
224 
225  WorldPacket const* Write() override;
226 
227  std::string NotifyText;
228  };
229 
230  class EmoteClient final : public ClientPacket
231  {
232  public:
233  EmoteClient(WorldPacket&& packet) : ClientPacket(CMSG_EMOTE, std::move(packet)) { }
234 
235  void Read() override { }
236  };
237 
238  class ChatPlayerNotfound final : public ServerPacket
239  {
240  public:
241  ChatPlayerNotfound(std::string const& name) : ServerPacket(SMSG_CHAT_PLAYER_NOTFOUND, 2 + name.size()), Name(name) { }
242 
243  WorldPacket const* Write() override;
244 
245  std::string Name;
246  };
247 
248  class ChatServerMessage final : public ServerPacket
249  {
250  public:
252 
253  WorldPacket const* Write() override;
254 
256  std::string StringParam;
257  };
258 
260  {
261  public:
262  enum
263  {
265  };
266 
268 
269  void Read() override;
270 
272  };
273 
275  {
276  public:
278 
279  void Read() override { }
280  };
281 
282  class DefenseMessage final : public ServerPacket
283  {
284  public:
286 
287  WorldPacket const* Write() override;
288 
290  std::string MessageText;
291  };
292 
293  class ChatReportIgnored final : public ClientPacket
294  {
295  public:
297 
298  void Read() override;
299 
302  };
303 
304  class ChatPlayerAmbiguous final : public ServerPacket
305  {
306  public:
307  ChatPlayerAmbiguous(std::string const& name) : ServerPacket(SMSG_CHAT_PLAYER_AMBIGUOUS, 2 + name.length()), Name(name) { }
308 
309  WorldPacket const* Write() override;
310 
311  std::string Name;
312  };
313 
314  class ChatRestricted final : public ServerPacket
315  {
316  public:
318 
319  WorldPacket const* Write() override;
320 
322  };
323  }
324 }
325 
326 #endif // ChatPackets_h__
std::string Name
Definition: ChatPackets.h:311
void Read() override
Definition: ChatPackets.cpp:40
ChatMessageAFK(WorldPacket &&packet)
Definition: ChatPackets.h:132
ObjectGuid IgnoredGUID
Definition: ChatPackets.h:300
Definition: ChatPackets.h:183
WorldPacket const * Write() override
Definition: ChatPackets.cpp:283
Definition: SharedDefines.h:961
std::string SenderName
Definition: ChatPackets.h:171
void Read() override
Definition: ChatPackets.cpp:57
Definition: ChatPackets.h:129
ChatPlayerNotfound(std::string const &name)
Definition: ChatPackets.h:241
std::string Text
Definition: ChatPackets.h:136
std::string Name
Definition: ChatPackets.h:245
std::string Text
Definition: ChatPackets.h:103
ChatMessageEmote(WorldPacket &&packet)
Definition: ChatPackets.h:142
Definition: ChatPackets.h:293
int32 EmoteID
Definition: ChatPackets.h:202
ChatMessageWhisper(WorldPacket &&packet)
Definition: ChatPackets.h:55
Definition: Opcodes.h:946
ObjectGuid PartyGUID
Definition: ChatPackets.h:168
int32 SoundIndex
Definition: ChatPackets.h:203
void Read() override
Definition: ChatPackets.cpp:67
int32 MessageID
Definition: ChatPackets.h:255
std::string ChatText
Definition: ChatPackets.h:175
EmoteClient(WorldPacket &&packet)
Definition: ChatPackets.h:233
Emote()
Definition: ChatPackets.h:186
STL namespace.
Definition: ChatPackets.h:150
ChatMessage(WorldPacket &&packet)
Definition: ChatPackets.h:43
Definition: ChatPackets.h:82
ChatMsg
Definition: SharedDefines.h:4228
ObjectGuid SenderGuildGUID
Definition: ChatPackets.h:165
PrintNotification(std::string const &notifyText)
Definition: ChatPackets.h:223
Definition: Opcodes.h:904
void Read() override
Definition: ChatPackets.cpp:269
Definition: Object.h:423
std::string Prefix
Definition: ChatPackets.h:101
ChatMessageDND(WorldPacket &&packet)
Definition: ChatPackets.h:122
uint8 Reason
Definition: ChatPackets.h:301
ChatServerMessage()
Definition: ChatPackets.h:251
Definition: ChatPackets.h:194
void Read() override
Definition: ChatPackets.cpp:252
void Read() override
Definition: ChatPackets.cpp:31
Definition: ChatPackets.h:314
Definition: Opcodes.h:906
Definition: ChatPackets.h:139
std::string StringParam
Definition: ChatPackets.h:256
Definition: ChatPackets.h:107
std::string Text
Definition: ChatPackets.h:146
void Read() override
Definition: ChatPackets.h:279
ChatAddonMessageChannel(WorldPacket &&packet)
Definition: ChatPackets.h:110
Definition: Opcodes.h:1384
std::string Prefix
Addon Prefix.
Definition: ChatPackets.h:173
ObjectGuid SenderGUID
Definition: ChatPackets.h:164
Definition: Opcodes.h:164
WorldPacket const * Write() override
Definition: ChatPackets.cpp:194
ObjectGuid SourceAccountGUID
Definition: ChatPackets.h:214
Definition: Packet.h:59
ChatReportIgnored(WorldPacket &&packet)
Definition: ChatPackets.h:296
Definition: Opcodes.h:198
ObjectGuid TargetGUID
Definition: ChatPackets.h:215
ObjectGuid SenderAccountGUID
Definition: ChatPackets.h:166
Language
Definition: SharedDefines.h:959
Chat()
Definition: ChatPackets.h:153
int32 SoundIndex
Definition: ChatPackets.h:216
WorldPacket const * Write() override
Definition: ChatPackets.cpp:230
int32 EmoteID
Definition: ChatPackets.h:191
std::string Text
Definition: ChatPackets.h:114
std::string Prefix
Definition: ChatPackets.h:89
LocaleConstant
Definition: Common.h:115
WorldPacket const * Write() override
Definition: ChatPackets.cpp:240
void Read() override
Definition: ChatPackets.cpp:202
Definition: Packet.h:46
void Read() override
Definition: ChatPackets.cpp:83
Definition: Opcodes.h:897
Definition: Opcodes.h:197
CTextEmote(WorldPacket &&packet)
Definition: ChatPackets.h:197
ObjectGuid TargetGUID
Definition: ChatPackets.h:167
STextEmote()
Definition: ChatPackets.h:209
std::string NotifyText
Definition: ChatPackets.h:227
Definition: ChatPackets.h:206
ChatRegisterAddonPrefixes(WorldPacket &&packet)
Definition: ChatPackets.h:267
int32_t int32
Definition: Define.h:146
Definition: ChatPackets.h:230
uint32_t uint32
Definition: Define.h:150
static void Initialize(PCASC_SALSA20 pState, LPBYTE pbKey, DWORD cbKeyLength, LPBYTE pbVector)
Definition: CascDecrypt.cpp:81
Definition: Opcodes.h:969
std::string Prefix
Definition: ChatPackets.h:116
ChatRestricted()
Definition: ChatPackets.h:317
std::string Text
Definition: ChatPackets.h:60
Definition: Opcodes.h:170
std::string Text
Definition: ChatPackets.h:126
void Read() override
Definition: ChatPackets.cpp:49
float length(float v)
Definition: vectorMath.h:208
DefenseMessage()
Definition: ChatPackets.h:285
Definition: BattlegroundMgr.h:57
Definition: Opcodes.h:907
Array< std::string, MAX_PREFIXES > Prefixes
Definition: ChatPackets.h:271
std::string Text
Definition: ChatPackets.h:73
ObjectGuid Target
Definition: ChatPackets.h:201
ObjectGuid SourceGUID
Definition: ChatPackets.h:213
Definition: ChatPackets.h:119
void Read() override
Definition: ChatPackets.h:235
void Read() override
Definition: ChatPackets.cpp:24
ChatAddonMessageWhisper(WorldPacket &&packet)
Definition: ChatPackets.h:97
Definition: Opcodes.h:601
std::string Target
Definition: ChatPackets.h:74
void Read() override
Definition: ChatPackets.cpp:77
#define TC_GAME_API
Definition: Define.h:134
std::string TargetName
Definition: ChatPackets.h:172
std::string _Channel
Channel Name.
Definition: ChatPackets.h:174
Definition: Opcodes.h:208
Definition: ChatPackets.h:248
WorldPacket const * Write() override
Definition: ChatPackets.cpp:259
ChatAddonMessage(WorldPacket &&packet)
Definition: ChatPackets.h:85
uint8_t uint8
Definition: Define.h:152
Definition: ChatPackets.h:238
std::string Target
Definition: ChatPackets.h:61
ChatPlayerAmbiguous(std::string const &name)
Definition: ChatPackets.h:307
Definition: ChatPackets.h:304
WorldPacket const * Write() override
Definition: ChatPackets.cpp:209
Definition: ObjectGuid.h:189
void Read() override
Definition: ChatPackets.cpp:89
std::string Text
Definition: ChatPackets.h:47
std::string Target
Definition: ChatPackets.h:102
Definition: Opcodes.h:259
Definition: ChatPackets.h:52
uint8 Reason
Definition: ChatPackets.h:321
ChatMessageChannel(WorldPacket &&packet)
Definition: ChatPackets.h:68
WorldPacket const * Write() override
Definition: ChatPackets.cpp:275
int32 EmoteID
Definition: ChatPackets.h:217
std::string Text
Definition: ChatPackets.h:90
Definition: Opcodes.h:195
ChatUnregisterAllAddonPrefixes(WorldPacket &&packet)
Definition: ChatPackets.h:277
#define DEFAULT_LOCALE
Definition: Common.h:134
Definition: ChatPackets.h:40
Definition: ChatPackets.h:65
Definition: Opcodes.h:903
Definition: WorldPacket.h:26
std::string Target
Definition: ChatPackets.h:115
std::string MessageText
Definition: ChatPackets.h:290
Definition: Opcodes.h:210
Definition: Opcodes.h:1569
ObjectGuid Guid
Definition: ChatPackets.h:190
Definition: ChatPackets.h:282
int32 ZoneID
Definition: ChatPackets.h:289
Definition: ChatPackets.h:220