[8483] Implement glyph 43361.
[getmangos.git] / src / game / Channel.cpp
blobe0fca88c68bb46379034c3cd595d86a45ec05bff
1 /*
2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "Channel.h"
20 #include "ObjectMgr.h"
21 #include "World.h"
22 #include "SocialMgr.h"
24 Channel::Channel(const std::string& name, uint32 channel_id)
25 : m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id), m_ownerGUID(0)
27 // set special flags if built-in channel
28 ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
29 if(ch) // it's built-in channel
31 channel_id = ch->ChannelID; // built-in channel
32 m_announce = false; // no join/leave announces
34 m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
36 if(ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
37 m_flags |= CHANNEL_FLAG_TRADE;
39 if(ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
40 m_flags |= CHANNEL_FLAG_CITY;
42 if(ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
43 m_flags |= CHANNEL_FLAG_LFG;
44 else // for all other channels
45 m_flags |= CHANNEL_FLAG_NOT_LFG;
47 else // it's custom channel
49 m_flags |= CHANNEL_FLAG_CUSTOM;
53 void Channel::Join(uint64 p, const char *pass)
55 WorldPacket data;
56 if(IsOn(p))
58 if(!IsConstant()) // non send error message for built-in channels
60 MakePlayerAlreadyMember(&data, p);
61 SendToOne(&data, p);
63 return;
66 if(IsBanned(p))
68 MakeBanned(&data);
69 SendToOne(&data, p);
70 return;
73 if(m_password.length() > 0 && strcmp(pass, m_password.c_str()))
75 MakeWrongPassword(&data);
76 SendToOne(&data, p);
77 return;
80 Player *plr = objmgr.GetPlayer(p);
82 if(plr)
84 if(HasFlag(CHANNEL_FLAG_LFG) &&
85 sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER &&
86 (plr->GetGroup() || plr->m_lookingForGroup.Empty()) )
88 MakeNotInLfg(&data);
89 SendToOne(&data, p);
90 return;
93 if(plr->GetGuildId() && (GetFlags() == 0x38))
94 return;
96 plr->JoinedChannel(this);
99 if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
101 MakeJoined(&data, p);
102 SendToAll(&data);
105 data.clear();
107 PlayerInfo pinfo;
108 pinfo.player = p;
109 pinfo.flags = 0;
110 players[p] = pinfo;
112 MakeYouJoined(&data);
113 SendToOne(&data, p);
115 JoinNotify(p);
117 // if no owner first logged will become
118 if(!IsConstant() && !m_ownerGUID)
120 SetOwner(p, (players.size() > 1 ? true : false));
121 players[p].SetModerator(true);
125 void Channel::Leave(uint64 p, bool send)
127 if(!IsOn(p))
129 if(send)
131 WorldPacket data;
132 MakeNotMember(&data);
133 SendToOne(&data, p);
136 else
138 Player *plr = objmgr.GetPlayer(p);
140 if(send)
142 WorldPacket data;
143 MakeYouLeft(&data);
144 SendToOne(&data, p);
145 if(plr)
146 plr->LeftChannel(this);
147 data.clear();
150 bool changeowner = players[p].IsOwner();
152 players.erase(p);
153 if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
155 WorldPacket data;
156 MakeLeft(&data, p);
157 SendToAll(&data);
160 LeaveNotify(p);
162 if(changeowner)
164 uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
165 SetOwner(newowner);
170 void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
172 AccountTypes sec = SEC_PLAYER;
173 Player *gplr = objmgr.GetPlayer(good);
174 if(gplr)
175 sec = gplr->GetSession()->GetSecurity();
177 if(!IsOn(good))
179 WorldPacket data;
180 MakeNotMember(&data);
181 SendToOne(&data, good);
183 else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
185 WorldPacket data;
186 MakeNotModerator(&data);
187 SendToOne(&data, good);
189 else
191 Player *bad = objmgr.GetPlayer(badname);
192 if(bad == NULL || !IsOn(bad->GetGUID()))
194 WorldPacket data;
195 MakePlayerNotFound(&data, badname);
196 SendToOne(&data, good);
198 else if(sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
200 WorldPacket data;
201 MakeNotOwner(&data);
202 SendToOne(&data, good);
204 else
206 bool changeowner = (m_ownerGUID == bad->GetGUID());
208 WorldPacket data;
210 if(ban && !IsBanned(bad->GetGUID()))
212 banned.insert(bad->GetGUID());
213 MakePlayerBanned(&data, bad->GetGUID(), good);
215 else
216 MakePlayerKicked(&data, bad->GetGUID(), good);
218 SendToAll(&data);
219 players.erase(bad->GetGUID());
220 bad->LeftChannel(this);
222 if(changeowner)
224 uint64 newowner = !players.empty() ? good : false;
225 SetOwner(newowner);
231 void Channel::UnBan(uint64 good, const char *badname)
233 uint32 sec = 0;
234 Player *gplr = objmgr.GetPlayer(good);
235 if(gplr)
236 sec = gplr->GetSession()->GetSecurity();
238 if(!IsOn(good))
240 WorldPacket data;
241 MakeNotMember(&data);
242 SendToOne(&data, good);
244 else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
246 WorldPacket data;
247 MakeNotModerator(&data);
248 SendToOne(&data, good);
250 else
252 Player *bad = objmgr.GetPlayer(badname);
253 if(bad == NULL || !IsBanned(bad->GetGUID()))
255 WorldPacket data;
256 MakePlayerNotFound(&data, badname);
257 SendToOne(&data, good);
259 else
261 banned.erase(bad->GetGUID());
263 WorldPacket data;
264 MakePlayerUnbanned(&data, bad->GetGUID(), good);
265 SendToAll(&data);
270 void Channel::Password(uint64 p, const char *pass)
272 uint32 sec = 0;
273 Player *plr = objmgr.GetPlayer(p);
274 if(plr)
275 sec = plr->GetSession()->GetSecurity();
277 if(!IsOn(p))
279 WorldPacket data;
280 MakeNotMember(&data);
281 SendToOne(&data, p);
283 else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
285 WorldPacket data;
286 MakeNotModerator(&data);
287 SendToOne(&data, p);
289 else
291 m_password = pass;
293 WorldPacket data;
294 MakePasswordChanged(&data, p);
295 SendToAll(&data);
299 void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
301 Player *plr = objmgr.GetPlayer(p);
302 if (!plr)
303 return;
305 uint32 sec = plr->GetSession()->GetSecurity();
307 if(!IsOn(p))
309 WorldPacket data;
310 MakeNotMember(&data);
311 SendToOne(&data, p);
313 else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
315 WorldPacket data;
316 MakeNotModerator(&data);
317 SendToOne(&data, p);
319 else
321 Player *newp = objmgr.GetPlayer(p2n);
322 if(!newp)
324 WorldPacket data;
325 MakePlayerNotFound(&data, p2n);
326 SendToOne(&data, p);
327 return;
330 PlayerInfo inf = players[newp->GetGUID()];
331 if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
332 return;
334 if(!IsOn(newp->GetGUID()))
336 WorldPacket data;
337 MakePlayerNotFound(&data, p2n);
338 SendToOne(&data, p);
339 return;
342 // allow make moderator from another team only if both is GMs
343 // at this moment this only way to show channel post for GM from another team
344 if( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
345 plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) )
347 WorldPacket data;
348 MakePlayerNotFound(&data, p2n);
349 SendToOne(&data, p);
350 return;
353 if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
355 WorldPacket data;
356 MakeNotOwner(&data);
357 SendToOne(&data, p);
358 return;
361 if(mod)
362 SetModerator(newp->GetGUID(), set);
363 else
364 SetMute(newp->GetGUID(), set);
368 void Channel::SetOwner(uint64 p, const char *newname)
370 Player *plr = objmgr.GetPlayer(p);
371 if (!plr)
372 return;
374 uint32 sec = plr->GetSession()->GetSecurity();
376 if(!IsOn(p))
378 WorldPacket data;
379 MakeNotMember(&data);
380 SendToOne(&data, p);
381 return;
384 if(sec < SEC_GAMEMASTER && p != m_ownerGUID)
386 WorldPacket data;
387 MakeNotOwner(&data);
388 SendToOne(&data, p);
389 return;
392 Player *newp = objmgr.GetPlayer(newname);
393 if(newp == NULL || !IsOn(newp->GetGUID()))
395 WorldPacket data;
396 MakePlayerNotFound(&data, newname);
397 SendToOne(&data, p);
398 return;
401 if(newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
403 WorldPacket data;
404 MakePlayerNotFound(&data, newname);
405 SendToOne(&data, p);
406 return;
409 players[newp->GetGUID()].SetModerator(true);
410 SetOwner(newp->GetGUID());
413 void Channel::SendWhoOwner(uint64 p)
415 if(!IsOn(p))
417 WorldPacket data;
418 MakeNotMember(&data);
419 SendToOne(&data, p);
421 else
423 WorldPacket data;
424 MakeChannelOwner(&data);
425 SendToOne(&data, p);
429 void Channel::List(Player* player)
431 uint64 p = player->GetGUID();
433 if(!IsOn(p))
435 WorldPacket data;
436 MakeNotMember(&data);
437 SendToOne(&data, p);
439 else
441 WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+players.size()*(8+1));
442 data << uint8(1); // channel type?
443 data << GetName(); // channel name
444 data << uint8(GetFlags()); // channel flags?
446 size_t pos = data.wpos();
447 data << uint32(0); // size of list, placeholder
449 uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
451 uint32 count = 0;
452 for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
454 Player *plr = objmgr.GetPlayer(i->first);
456 // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
457 // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
458 if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= gmLevelInWhoList) &&
459 plr->IsVisibleGloballyFor(player))
461 data << uint64(i->first);
462 data << uint8(i->second.flags); // flags seems to be changed...
463 ++count;
467 data.put<uint32>(pos,count);
469 SendToOne(&data, p);
473 void Channel::Announce(uint64 p)
475 uint32 sec = 0;
476 Player *plr = objmgr.GetPlayer(p);
477 if(plr)
478 sec = plr->GetSession()->GetSecurity();
480 if(!IsOn(p))
482 WorldPacket data;
483 MakeNotMember(&data);
484 SendToOne(&data, p);
486 else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
488 WorldPacket data;
489 MakeNotModerator(&data);
490 SendToOne(&data, p);
492 else
494 m_announce = !m_announce;
496 WorldPacket data;
497 if(m_announce)
498 MakeAnnouncementsOn(&data, p);
499 else
500 MakeAnnouncementsOff(&data, p);
501 SendToAll(&data);
505 void Channel::Moderate(uint64 p)
507 uint32 sec = 0;
508 Player *plr = objmgr.GetPlayer(p);
509 if(plr)
510 sec = plr->GetSession()->GetSecurity();
512 if(!IsOn(p))
514 WorldPacket data;
515 MakeNotMember(&data);
516 SendToOne(&data, p);
518 else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
520 WorldPacket data;
521 MakeNotModerator(&data);
522 SendToOne(&data, p);
524 else
526 m_moderate = !m_moderate;
528 WorldPacket data;
529 if(m_moderate)
530 MakeModerationOn(&data, p);
531 else
532 MakeModerationOff(&data, p);
533 SendToAll(&data);
537 void Channel::Say(uint64 p, const char *what, uint32 lang)
539 if(!what)
540 return;
541 if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
542 lang = LANG_UNIVERSAL;
544 uint32 sec = 0;
545 Player *plr = objmgr.GetPlayer(p);
546 if(plr)
547 sec = plr->GetSession()->GetSecurity();
549 if(!IsOn(p))
551 WorldPacket data;
552 MakeNotMember(&data);
553 SendToOne(&data, p);
555 else if(players[p].IsMuted())
557 WorldPacket data;
558 MakeMuted(&data);
559 SendToOne(&data, p);
561 else if(m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
563 WorldPacket data;
564 MakeNotModerator(&data);
565 SendToOne(&data, p);
567 else
569 uint32 messageLength = strlen(what) + 1;
571 WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1);
572 data << (uint8)CHAT_MSG_CHANNEL;
573 data << (uint32)lang;
574 data << p; // 2.1.0
575 data << uint32(0); // 2.1.0
576 data << m_name;
577 data << p;
578 data << messageLength;
579 data << what;
580 data << uint8(plr ? plr->chatTag() : 0);
582 SendToAll(&data, !players[p].IsModerator() ? p : false);
586 void Channel::Invite(uint64 p, const char *newname)
588 if(!IsOn(p))
590 WorldPacket data;
591 MakeNotMember(&data);
592 SendToOne(&data, p);
593 return;
596 Player *newp = objmgr.GetPlayer(newname);
597 if(!newp)
599 WorldPacket data;
600 MakePlayerNotFound(&data, newname);
601 SendToOne(&data, p);
602 return;
605 Player *plr = objmgr.GetPlayer(p);
606 if (!plr)
607 return;
609 if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
611 WorldPacket data;
612 MakeInviteWrongFaction(&data);
613 SendToOne(&data, p);
614 return;
617 if(IsOn(newp->GetGUID()))
619 WorldPacket data;
620 MakePlayerAlreadyMember(&data, newp->GetGUID());
621 SendToOne(&data, p);
622 return;
625 WorldPacket data;
626 if(!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
628 MakeInvite(&data, p);
629 SendToOne(&data, newp->GetGUID());
630 data.clear();
632 MakePlayerInvited(&data, newp->GetName());
633 SendToOne(&data, p);
636 void Channel::SetOwner(uint64 guid, bool exclaim)
638 if(m_ownerGUID)
640 // [] will re-add player after it possible removed
641 PlayerList::iterator p_itr = players.find(m_ownerGUID);
642 if(p_itr != players.end())
643 p_itr->second.SetOwner(false);
646 m_ownerGUID = guid;
647 if(m_ownerGUID)
649 uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
650 players[m_ownerGUID].SetOwner(true);
652 WorldPacket data;
653 MakeModeChange(&data, m_ownerGUID, oldFlag);
654 SendToAll(&data);
656 if(exclaim)
658 MakeOwnerChanged(&data, m_ownerGUID);
659 SendToAll(&data);
664 void Channel::SendToAll(WorldPacket *data, uint64 p)
666 for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
668 Player *plr = objmgr.GetPlayer(i->first);
669 if(plr)
671 if(!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
672 plr->GetSession()->SendPacket(data);
677 void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
679 for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
681 if(i->first != who)
683 Player *plr = objmgr.GetPlayer(i->first);
684 if(plr)
685 plr->GetSession()->SendPacket(data);
690 void Channel::SendToOne(WorldPacket *data, uint64 who)
692 Player *plr = objmgr.GetPlayer(who);
693 if(plr)
694 plr->GetSession()->SendPacket(data);
697 void Channel::Voice(uint64 /*guid1*/, uint64 /*guid2*/)
702 void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
707 // done
708 void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type)
710 data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
711 *data << uint8(notify_type);
712 *data << m_name;
715 // done 0x00
716 void Channel::MakeJoined(WorldPacket *data, uint64 guid)
718 MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
719 *data << uint64(guid);
722 // done 0x01
723 void Channel::MakeLeft(WorldPacket *data, uint64 guid)
725 MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
726 *data << uint64(guid);
729 // done 0x02
730 void Channel::MakeYouJoined(WorldPacket *data)
732 MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE);
733 *data << uint8(GetFlags());
734 *data << uint32(GetChannelId());
735 *data << uint32(0);
738 // done 0x03
739 void Channel::MakeYouLeft(WorldPacket *data)
741 MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE);
742 *data << uint32(GetChannelId());
743 *data << uint8(0); // can be 0x00 and 0x01
746 // done 0x04
747 void Channel::MakeWrongPassword(WorldPacket *data)
749 MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE);
752 // done 0x05
753 void Channel::MakeNotMember(WorldPacket *data)
755 MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE);
758 // done 0x06
759 void Channel::MakeNotModerator(WorldPacket *data)
761 MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
764 // done 0x07
765 void Channel::MakePasswordChanged(WorldPacket *data, uint64 guid)
767 MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
768 *data << uint64(guid);
771 // done 0x08
772 void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid)
774 MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
775 *data << uint64(guid);
778 // done 0x09
779 void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name)
781 MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
782 *data << name;
785 // done 0x0A
786 void Channel::MakeNotOwner(WorldPacket *data)
788 MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE);
791 // done 0x0B
792 void Channel::MakeChannelOwner(WorldPacket *data)
794 std::string name = "";
796 if(!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
797 name = "PLAYER_NOT_FOUND";
799 MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
800 *data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name);
803 // done 0x0C
804 void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags)
806 MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
807 *data << uint64(guid);
808 *data << uint8(oldflags);
809 *data << uint8(GetPlayerFlags(guid));
812 // done 0x0D
813 void Channel::MakeAnnouncementsOn(WorldPacket *data, uint64 guid)
815 MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
816 *data << uint64(guid);
819 // done 0x0E
820 void Channel::MakeAnnouncementsOff(WorldPacket *data, uint64 guid)
822 MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
823 *data << uint64(guid);
826 // done 0x0F
827 void Channel::MakeModerationOn(WorldPacket *data, uint64 guid)
829 MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE);
830 *data << uint64(guid);
833 // done 0x10
834 void Channel::MakeModerationOff(WorldPacket *data, uint64 guid)
836 MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE);
837 *data << uint64(guid);
840 // done 0x11
841 void Channel::MakeMuted(WorldPacket *data)
843 MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
846 // done 0x12
847 void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good)
849 MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
850 *data << uint64(bad);
851 *data << uint64(good);
854 // done 0x13
855 void Channel::MakeBanned(WorldPacket *data)
857 MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
860 // done 0x14
861 void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good)
863 MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
864 *data << uint64(bad);
865 *data << uint64(good);
868 // done 0x15
869 void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good)
871 MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
872 *data << uint64(bad);
873 *data << uint64(good);
876 // done 0x16
877 void Channel::MakePlayerNotBanned(WorldPacket *data, uint64 guid)
879 MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
880 *data << uint64(guid);
883 // done 0x17
884 void Channel::MakePlayerAlreadyMember(WorldPacket *data, uint64 guid)
886 MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
887 *data << uint64(guid);
890 // done 0x18
891 void Channel::MakeInvite(WorldPacket *data, uint64 guid)
893 MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
894 *data << uint64(guid);
897 // done 0x19
898 void Channel::MakeInviteWrongFaction(WorldPacket *data)
900 MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE);
903 // done 0x1A
904 void Channel::MakeWrongFaction(WorldPacket *data)
906 MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE);
909 // done 0x1B
910 void Channel::MakeInvalidName(WorldPacket *data)
912 MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE);
915 // done 0x1C
916 void Channel::MakeNotModerated(WorldPacket *data)
918 MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE);
921 // done 0x1D
922 void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name)
924 MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE);
925 *data << name;
928 // done 0x1E
929 void Channel::MakePlayerInviteBanned(WorldPacket *data, uint64 guid)
931 MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
932 *data << uint64(guid);
935 // done 0x1F
936 void Channel::MakeThrottled(WorldPacket *data)
938 MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE);
941 // done 0x20
942 void Channel::MakeNotInArea(WorldPacket *data)
944 MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE);
947 // done 0x21
948 void Channel::MakeNotInLfg(WorldPacket *data)
950 MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
953 // done 0x22
954 void Channel::MakeVoiceOn(WorldPacket *data, uint64 guid)
956 MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
957 *data << uint64(guid);
960 // done 0x23
961 void Channel::MakeVoiceOff(WorldPacket *data, uint64 guid)
963 MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
964 *data << uint64(guid);
967 void Channel::JoinNotify(uint64 guid)
969 WorldPacket data;
971 if(IsConstant())
972 data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1);
973 else
974 data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1);
976 data << uint64(guid);
977 data << uint8(GetPlayerFlags(guid));
978 data << uint8(GetFlags());
979 data << uint32(GetNumPlayers());
980 data << GetName();
981 SendToAll(&data);
984 void Channel::LeaveNotify(uint64 guid)
986 WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1);
987 data << uint64(guid);
988 data << uint8(GetFlags());
989 data << uint32(GetNumPlayers());
990 data << GetName();
991 SendToAll(&data);