TrinityCore
ChannelAppenders.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 _CHANNELAPPENDERS_H
19#define _CHANNELAPPENDERS_H
20
21#include "Channel.h"
22#include "ChannelPackets.h"
23#include "CharacterCache.h"
24#include "GridNotifiers.h"
25#include "World.h"
26
27// initial packet data (notify type and channel name)
28template<class PacketModifier>
30{
31 public:
32 ChannelNameBuilder(Channel const* source, PacketModifier const& modifier)
33 : _source(source), _modifier(modifier){ }
34
36 {
37 // LocalizedPacketDo sends client DBC locale, we need to get available to server locale
38 LocaleConstant localeIdx = sWorld->GetAvailableDbcLocale(locale);
39
41 sender->Data.Type = _modifier.NotificationType;
42 sender->Data._Channel = _source->GetName(localeIdx);
43 _modifier.Append(sender->Data);
44 sender->Data.Write();
45 return sender;
46 }
47
48 private:
50 PacketModifier _modifier;
51};
52
54{
55 explicit JoinedAppend(ObjectGuid const& guid) : _guid(guid) { }
56
58
60 {
61 data.SenderGuid = _guid;
62 }
63
64private:
66};
67
69{
70 explicit LeftAppend(ObjectGuid const& guid) : _guid(guid) { }
71
73
75 {
76 data.SenderGuid = _guid;
77 }
78
79private:
81};
82
84{
85 explicit YouJoinedAppend(Channel const* channel) : _channel(channel) { }
86
88
90 {
92 }
93
94private:
96};
97
99{
100 explicit YouLeftAppend(Channel const* channel) : _channel(channel) { }
101
103
105 {
107 }
108
109private:
111};
112
114{
116
118};
119
121{
123
125};
126
128{
130
132};
133
135{
136 explicit PasswordChangedAppend(ObjectGuid const& guid) : _guid(guid) { }
137
139
141 {
142 data.SenderGuid = _guid;
143 }
144
145private:
147};
148
150{
151 explicit OwnerChangedAppend(ObjectGuid const& guid) : _guid(guid) { }
152
154
156 {
157 data.SenderGuid = _guid;
158 }
159
160private:
162};
163
165{
166 explicit PlayerNotFoundAppend(std::string const& playerName) : _playerName(playerName) { }
167
169
171 {
172 data.Sender = _playerName;
173 }
174
175private:
176 std::string _playerName;
177};
178
180{
182
184};
185
187{
188 explicit ChannelOwnerAppend(Channel const* channel, ObjectGuid const& ownerGuid) : _channel(channel), _ownerGuid(ownerGuid)
189 {
190 if (CharacterCacheEntry const* cInfo = sCharacterCache->GetCharacterCacheByGuid(_ownerGuid))
191 _ownerName = cInfo->Name;
192 }
193
195
197 {
198 data.Sender = ((_channel->IsConstant() || !_ownerGuid) ? "Nobody" : _ownerName);
199 }
200
201private:
204
205 std::string _ownerName;
206};
207
209{
210 explicit ModeChangeAppend(ObjectGuid const& guid, uint8 oldFlags, uint8 newFlags) : _guid(guid), _oldFlags(oldFlags), _newFlags(newFlags) { }
211
213
215 {
216 data.SenderGuid = _guid;
217 data.OldFlags = _oldFlags;
218 data.NewFlags = _newFlags;
219 }
220
221private:
225};
226
228{
229 explicit AnnouncementsOnAppend(ObjectGuid const& guid) : _guid(guid) { }
230
232
234 {
235 data.SenderGuid = _guid;
236 }
237
238private:
240};
241
243{
244 explicit AnnouncementsOffAppend(ObjectGuid const& guid) : _guid(guid) { }
245
247
249 {
250 data.SenderGuid = _guid;
251 }
252
253private:
255};
256
258{
260
262};
263
265{
266 explicit PlayerKickedAppend(ObjectGuid const& kicker, ObjectGuid const& kickee) : _kicker(kicker), _kickee(kickee) { }
267
269
271 {
272 data.SenderGuid = _kicker;
273 data.TargetGuid = _kickee;
274 }
275
276private:
279};
280
282{
284
286};
287
289{
290 explicit PlayerBannedAppend(ObjectGuid const& moderator, ObjectGuid const& banned) : _moderator(moderator), _banned(banned) { }
291
293
295 {
296 data.SenderGuid = _moderator;
297 data.TargetGuid = _banned;
298 }
299
300private:
303};
304
306{
307 explicit PlayerUnbannedAppend(ObjectGuid const& moderator, ObjectGuid const& unbanned) : _moderator(moderator), _unbanned(unbanned) { }
308
310
312 {
313 data.SenderGuid = _moderator;
314 data.TargetGuid = _unbanned;
315 }
316
317private:
320};
321
323{
324 explicit PlayerNotBannedAppend(std::string const& playerName) : _playerName(playerName) { }
325
327
329 {
330 data.Sender = _playerName;
331 }
332
333private:
334 std::string _playerName;
335};
336
338{
339 explicit PlayerAlreadyMemberAppend(ObjectGuid const& guid) : _guid(guid) { }
340
342
344 {
345 data.SenderGuid = _guid;
346 }
347
348private:
350};
351
353{
354 explicit InviteAppend(ObjectGuid const& guid) : _guid(guid) { }
355
357
359 {
360 data.SenderGuid = _guid;
361 }
362
363private:
365};
366
368{
370
372};
373
375{
377
379};
380
382{
384
386};
387
389{
391
393};
394
396{
397 explicit PlayerInvitedAppend(std::string const& playerName) : _playerName(playerName) { }
398
400
402 {
403 data.Sender = _playerName;
404 }
405
406private:
407 std::string _playerName;
408};
409
411{
412 explicit PlayerInviteBannedAppend(std::string const& playerName) : _playerName(playerName) { }
413
415
417 {
418 data.Sender = _playerName;
419 }
420
421private:
422 std::string _playerName;
423};
424
426{
428
430};
431
433{
435
437};
438
440{
442
444};
445
447{
448 explicit VoiceOnAppend(ObjectGuid const& guid) : _guid(guid) { }
449
451
453 {
454 data.SenderGuid = _guid;
455 }
456
457private:
459};
460
462{
463 explicit VoiceOffAppend(ObjectGuid const& guid) : _guid(guid) { }
464
466
468 {
469 data.SenderGuid = _guid;
470 }
471
472private:
474};
475
476#endif // _CHANNELAPPENDERS_H
@ CHAT_YOU_JOINED_NOTICE
Definition: Channel.h:44
@ CHAT_WRONG_FACTION_NOTICE
Definition: Channel.h:69
@ CHAT_NOT_MODERATOR_NOTICE
Definition: Channel.h:49
@ CHAT_PLAYER_UNBANNED_NOTICE
Definition: Channel.h:64
@ CHAT_PLAYER_NOT_FOUND_NOTICE
Definition: Channel.h:52
@ CHAT_MUTED_NOTICE
Definition: Channel.h:60
@ CHAT_PLAYER_NOT_BANNED_NOTICE
Definition: Channel.h:65
@ CHAT_PLAYER_INVITED_NOTICE
Definition: Channel.h:72
@ CHAT_PLAYER_KICKED_NOTICE
Definition: Channel.h:61
@ CHAT_VOICE_OFF_NOTICE
Definition: Channel.h:78
@ CHAT_MODE_CHANGE_NOTICE
Definition: Channel.h:55
@ CHAT_NOT_MEMBER_NOTICE
Definition: Channel.h:48
@ CHAT_ANNOUNCEMENTS_ON_NOTICE
Definition: Channel.h:56
@ CHAT_JOINED_NOTICE
Definition: Channel.h:41
@ CHAT_LEFT_NOTICE
Definition: Channel.h:42
@ CHAT_INVITE_WRONG_FACTION_NOTICE
Definition: Channel.h:68
@ CHAT_BANNED_NOTICE
Definition: Channel.h:62
@ CHAT_PLAYER_BANNED_NOTICE
Definition: Channel.h:63
@ CHAT_PLAYER_ALREADY_MEMBER_NOTICE
Definition: Channel.h:66
@ CHAT_OWNER_CHANGED_NOTICE
Definition: Channel.h:51
@ CHAT_ANNOUNCEMENTS_OFF_NOTICE
Definition: Channel.h:57
@ CHAT_VOICE_ON_NOTICE
Definition: Channel.h:77
@ CHAT_NOT_IN_LFG_NOTICE
Definition: Channel.h:76
@ CHAT_NOT_IN_AREA_NOTICE
Definition: Channel.h:75
@ CHAT_NOT_MODERATED_NOTICE
Definition: Channel.h:71
@ CHAT_YOU_LEFT_NOTICE
Definition: Channel.h:46
@ CHAT_CHANNEL_OWNER_NOTICE
Definition: Channel.h:54
@ CHAT_WRONG_PASSWORD_NOTICE
Definition: Channel.h:47
@ CHAT_THROTTLED_NOTICE
Definition: Channel.h:74
@ CHAT_PLAYER_INVITE_BANNED_NOTICE
Definition: Channel.h:73
@ CHAT_INVITE_NOTICE
Definition: Channel.h:67
@ CHAT_NOT_OWNER_NOTICE
Definition: Channel.h:53
@ CHAT_PASSWORD_CHANGED_NOTICE
Definition: Channel.h:50
@ CHAT_INVALID_NAME_NOTICE
Definition: Channel.h:70
#define sCharacterCache
LocaleConstant
Definition: Common.h:48
uint8_t uint8
Definition: Define.h:144
ChannelNameBuilder(Channel const *source, PacketModifier const &modifier)
PacketModifier _modifier
Trinity::PacketSenderOwning< WorldPackets::Channel::ChannelNotify > * operator()(LocaleConstant locale) const
Channel const * _source
bool IsConstant() const
Definition: Channel.h:167
std::string GetName(LocaleConstant locale=DEFAULT_LOCALE) const
Definition: Channel.cpp:114
uint32 GetChannelId() const
Definition: Channel.h:166
#define sWorld
Definition: World.h:931
AnnouncementsOffAppend(ObjectGuid const &guid)
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
AnnouncementsOnAppend(ObjectGuid const &guid)
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
ChannelOwnerAppend(Channel const *channel, ObjectGuid const &ownerGuid)
Channel const * _channel
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
ObjectGuid _guid
InviteAppend(ObjectGuid const &guid)
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
JoinedAppend(ObjectGuid const &guid)
ObjectGuid _guid
static uint8 const NotificationType
LeftAppend(ObjectGuid const &guid)
ObjectGuid _guid
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
ModeChangeAppend(ObjectGuid const &guid, uint8 oldFlags, uint8 newFlags)
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
OwnerChangedAppend(ObjectGuid const &guid)
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
PasswordChangedAppend(ObjectGuid const &guid)
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
void Append(WorldPackets::Channel::ChannelNotify &data) const
PlayerAlreadyMemberAppend(ObjectGuid const &guid)
static uint8 const NotificationType
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
PlayerBannedAppend(ObjectGuid const &moderator, ObjectGuid const &banned)
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
PlayerInviteBannedAppend(std::string const &playerName)
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
PlayerInvitedAppend(std::string const &playerName)
PlayerKickedAppend(ObjectGuid const &kicker, ObjectGuid const &kickee)
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
PlayerNotBannedAppend(std::string const &playerName)
PlayerNotFoundAppend(std::string const &playerName)
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
static uint8 const NotificationType
PlayerUnbannedAppend(ObjectGuid const &moderator, ObjectGuid const &unbanned)
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
void Append(WorldPackets::Channel::ChannelNotify &data) const
static uint8 const NotificationType
VoiceOffAppend(ObjectGuid const &guid)
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
ObjectGuid _guid
VoiceOnAppend(ObjectGuid const &guid)
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &) const
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
Channel const * _channel
static uint8 const NotificationType
YouJoinedAppend(Channel const *channel)
static uint8 const NotificationType
void Append(WorldPackets::Channel::ChannelNotify &data) const
Channel const * _channel
YouLeftAppend(Channel const *channel)