TrinityCore
Loading...
Searching...
No Matches
SocialPackets.cpp
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#include "SocialPackets.h"
19#include "SocialMgr.h"
20
22{
27
29{
30 data << contact.Guid;
31 data << uint32(contact.TypeFlags);
32 data << contact.Notes;
33 if (contact.TypeFlags & SOCIAL_FLAG_FRIEND) // if IsFriend()
34 {
35 data << uint8(contact.Status);
36 if (contact.Status) // if online
37 {
38 data << uint32(contact.AreaID);
39 data << uint32(contact.Level);
40 data << uint32(contact.ClassID);
41 }
42 }
43
44 return data;
45}
46
48{
50 _worldPacket << uint32(Contacts.size());
51
52 for (ContactInfo const& contact : Contacts)
54
55 return &_worldPacket;
56}
57
59{
62
63 switch (FriendResult)
64 {
67 [[fallthrough]];
68 case FRIEND_ONLINE:
73 break;
76 break;
77 default:
78 break;
79 }
80
81 return &_worldPacket;
82}
83
85{
88}
89
91{
93}
94
100
102{
104}
105
107{
109}
110}
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ FRIEND_ONLINE
Definition SocialMgr.h:69
@ FRIEND_ADDED_OFFLINE
Definition SocialMgr.h:74
@ FRIEND_ADDED_ONLINE
Definition SocialMgr.h:73
@ SOCIAL_FLAG_FRIEND
Definition SocialMgr.h:40
WorldPacket _worldPacket
Definition Packet.h:42
WorldPacket const * Write() override
std::vector< ContactInfo > Contacts
WorldPacket const * Write() override
ByteBuffer & operator<<(ByteBuffer &data, ContactInfo const &contact)