1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
|
/*
* This file is part of the TrinityCore 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 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 TRINITYCORE_CHAT_PACKETS_H
#define TRINITYCORE_CHAT_PACKETS_H
#include "Packet.h"
#include "Common.h"
#include "ObjectGuid.h"
#include "Optional.h"
#include "PacketUtilities.h"
#include "SharedDefines.h"
class WorldObject;
enum class ChatWhisperTargetStatus : uint8;
namespace WorldPackets
{
namespace Chat
{
// CMSG_CHAT_MESSAGE_GUILD
// CMSG_CHAT_MESSAGE_OFFICER
// CMSG_CHAT_MESSAGE_YELL
// CMSG_CHAT_MESSAGE_SAY
// CMSG_CHAT_MESSAGE_PARTY
// CMSG_CHAT_MESSAGE_RAID
// CMSG_CHAT_MESSAGE_RAID_WARNING
// CMSG_CHAT_MESSAGE_INSTANCE_CHAT
class ChatMessage final : public ClientPacket
{
public:
explicit ChatMessage(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
void Read() override;
std::string Text;
int32 Language = LANG_UNIVERSAL;
bool IsSecure = true;
};
// CMSG_CHAT_MESSAGE_WHISPER
// CMSG_MESSAGE_WHISPER
class ChatMessageWhisper final : public ClientPacket
{
public:
explicit ChatMessageWhisper(WorldPacket&& packet) : ClientPacket(std::move(packet)) { }
void Read() override;
int32 Language = LANG_UNIVERSAL;
ObjectGuid TargetGUID;
uint32 TargetVirtualRealmAddress = 0;
std::string Target;
std::string Text;
};
// CMSG_CHAT_MESSAGE_CHANNEL
class ChatMessageChannel final : public ClientPacket
{
public:
explicit ChatMessageChannel(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_MESSAGE_CHANNEL, std::move(packet)) { }
void Read() override;
int32 Language = LANG_UNIVERSAL;
ObjectGuid ChannelGUID;
std::string Text;
std::string Target;
Optional<bool> IsSecure;
};
struct ChatAddonMessageParams
{
std::string Prefix;
std::string Text;
ChatMsg Type = CHAT_MSG_PARTY;
bool IsLogged = false;
};
// CMSG_CHAT_ADDON_MESSAGE
class ChatAddonMessage final : public ClientPacket
{
public:
explicit ChatAddonMessage(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_ADDON_MESSAGE, std::move(packet)) { }
void Read() override;
ChatAddonMessageParams Params;
};
// CMSG_CHAT_ADDON_MESSAGE_CHANNEL
class ChatAddonMessageTargeted final : public ClientPacket
{
public:
explicit ChatAddonMessageTargeted(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_ADDON_MESSAGE_TARGETED, std::move(packet)) { }
void Read() override;
ChatAddonMessageParams Params;
std::string PlayerName;
ObjectGuid PlayerGUID;
uint32 PlayerVirtualRealmAddress = 0;
std::string ChannelName;
ObjectGuid ChannelGUID;
};
class ChatMessageDND final : public ClientPacket
{
public:
explicit ChatMessageDND(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_MESSAGE_DND, std::move(packet)) { }
void Read() override;
std::string Text;
};
class ChatMessageAFK final : public ClientPacket
{
public:
explicit ChatMessageAFK(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_MESSAGE_AFK, std::move(packet)) { }
void Read() override;
std::string Text;
};
class ChatMessageEmote final : public ClientPacket
{
public:
explicit ChatMessageEmote(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_MESSAGE_EMOTE, std::move(packet)) { }
void Read() override;
std::string Text;
};
// SMSG_CHAT
class TC_GAME_API Chat final : public ServerPacket
{
public:
explicit Chat() : ServerPacket(SMSG_CHAT, 100) { }
Chat(Chat const& chat);
void Initialize(ChatMsg chatType, Language language, WorldObject const* sender, WorldObject const* receiver, std::string_view message, uint32 achievementId = 0,
std::string_view channelName = "", LocaleConstant locale = DEFAULT_LOCALE, std::string_view addonPrefix = "");
void SetSender(WorldObject const* sender, LocaleConstant locale);
void SetReceiver(WorldObject const* receiver, LocaleConstant locale);
WorldPacket const* Write() override;
uint8 SlashCmd = 0; ///< @see enum ChatMsg
uint32 _Language = LANG_UNIVERSAL;
ObjectGuid SenderGUID;
ObjectGuid SenderGuildGUID;
ObjectGuid SenderWowAccount;
ObjectGuid TargetGUID;
uint32 SenderVirtualAddress = 0;
uint32 TargetVirtualAddress = 0;
std::string SenderName;
std::string TargetName;
std::string Prefix; ///< Addon Prefix
std::string _Channel; ///< Channel Name
std::string ChatText;
uint32 AchievementID = 0;
uint16 _ChatFlags = 0; ///< @see enum ChatFlags
float DisplayTime = 0.0f;
int32 SpellID = 0;
Optional<uint32> BroadcastTextID;
bool HideChatLog = false;
bool FakeSenderName = false;
Optional<ObjectGuid> ChannelGUID;
};
class Emote final : public ServerPacket
{
public:
explicit Emote() : ServerPacket(SMSG_EMOTE, 18 + 4) { }
WorldPacket const* Write() override;
ObjectGuid Guid;
uint32 EmoteID = 0;
std::vector<int32> SpellVisualKitIDs;
int32 SequenceVariation = 0;
};
class CTextEmote final : public ClientPacket
{
public:
explicit CTextEmote(WorldPacket&& packet) : ClientPacket(CMSG_SEND_TEXT_EMOTE, std::move(packet)) { }
void Read() override;
ObjectGuid Target;
int32 EmoteID = 0;
int32 SoundIndex = -1;
Array<int32, 2> SpellVisualKitIDs;
int32 SequenceVariation = 0;
};
class STextEmote final : public ServerPacket
{
public:
explicit STextEmote() : ServerPacket(SMSG_TEXT_EMOTE, 3 * 18 + 2 * 4) { }
WorldPacket const* Write() override;
ObjectGuid SourceGUID;
ObjectGuid SourceAccountGUID;
ObjectGuid TargetGUID;
int32 SoundIndex = -1;
int32 EmoteID = 0;
};
class ClearBossEmotes final : public ServerPacket
{
public:
explicit ClearBossEmotes() : ServerPacket(SMSG_CLEAR_BOSS_EMOTES, 0) { }
WorldPacket const* Write() override { return &_worldPacket; }
};
class TC_GAME_API PrintNotification final : public ServerPacket
{
public:
explicit PrintNotification(std::string const& notifyText) : ServerPacket(SMSG_PRINT_NOTIFICATION, 2 + notifyText.size()), NotifyText(notifyText) { }
WorldPacket const* Write() override;
std::string NotifyText;
};
class EmoteClient final : public ClientPacket
{
public:
explicit EmoteClient(WorldPacket&& packet) : ClientPacket(CMSG_EMOTE, std::move(packet)) { }
void Read() override { }
};
class ChatPlayerNotfound final : public ServerPacket
{
public:
explicit ChatPlayerNotfound(std::string const& name) : ServerPacket(SMSG_CHAT_PLAYER_NOTFOUND, 2 + name.size()), Name(name) { }
WorldPacket const* Write() override;
std::string Name;
};
class ChatServerMessage final : public ServerPacket
{
public:
explicit ChatServerMessage() : ServerPacket(SMSG_CHAT_SERVER_MESSAGE, 4 + 2) { }
WorldPacket const* Write() override;
int32 MessageID = 0;
std::string_view StringParam;
};
class ChatRegisterAddonPrefixes final : public ClientPacket
{
public:
enum
{
MAX_PREFIXES = 64
};
explicit ChatRegisterAddonPrefixes(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_REGISTER_ADDON_PREFIXES, std::move(packet)) { }
void Read() override;
Array<std::string, MAX_PREFIXES> Prefixes;
};
class ChatUnregisterAllAddonPrefixes final : public ClientPacket
{
public:
explicit ChatUnregisterAllAddonPrefixes(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_UNREGISTER_ALL_ADDON_PREFIXES, std::move(packet)) { }
void Read() override { }
};
class DefenseMessage final : public ServerPacket
{
public:
explicit DefenseMessage() : ServerPacket(SMSG_DEFENSE_MESSAGE) { }
WorldPacket const* Write() override;
int32 ZoneID = 0;
std::string MessageText;
};
class ChatReportIgnored final : public ClientPacket
{
public:
explicit ChatReportIgnored(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_REPORT_IGNORED, std::move(packet)) { }
void Read() override;
ObjectGuid IgnoredGUID;
uint8 Reason = 0;
};
class ChatPlayerAmbiguous final : public ServerPacket
{
public:
explicit ChatPlayerAmbiguous(std::string const& name) : ServerPacket(SMSG_CHAT_PLAYER_AMBIGUOUS, 2 + name.length()), Name(name) { }
WorldPacket const* Write() override;
std::string Name;
};
class ChatRestricted final : public ServerPacket
{
public:
explicit ChatRestricted() : ServerPacket(SMSG_CHAT_RESTRICTED, 4) { }
WorldPacket const* Write() override;
int32 Reason = 0;
};
class CanLocalWhisperTargetRequest final : public ClientPacket
{
public:
explicit CanLocalWhisperTargetRequest(WorldPacket&& packet) : ClientPacket(CMSG_CHAT_CAN_LOCAL_WHISPER_TARGET_REQUEST, std::move(packet)) { }
void Read() override;
ObjectGuid WhisperTarget;
};
class CanLocalWhisperTargetResponse final : public ServerPacket
{
public:
explicit CanLocalWhisperTargetResponse() : ServerPacket(SMSG_CHAT_CAN_LOCAL_WHISPER_TARGET_RESPONSE, 16 + 1) { }
WorldPacket const* Write() override;
ObjectGuid WhisperTarget;
ChatWhisperTargetStatus Status = {};
};
class UpdateAADCStatus final : public ClientPacket
{
public:
explicit UpdateAADCStatus(WorldPacket&& packet) : ClientPacket(CMSG_UPDATE_AADC_STATUS, std::move(packet)) { }
void Read() override;
bool ChatDisabled = false;
};
class UpdateAADCStatusResponse final : public ServerPacket
{
public:
explicit UpdateAADCStatusResponse() : ServerPacket(SMSG_UPDATE_AADC_STATUS_RESPONSE, 1) { }
WorldPacket const* Write() override;
bool Success = false;
bool ChatDisabled = false;
};
}
}
#endif // TRINITYCORE_CHAT_PACKETS_H
|