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
21
namespace
WorldPackets::Social
22
{
23
void
SendContactList::Read
()
24
{
25
_worldPacket
>>
Flags
;
26
}
27
28
ByteBuffer
&
operator<<
(
ByteBuffer
& data,
ContactInfo
const
&
contact
)
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
47
WorldPacket
const
*
ContactList::Write
()
48
{
49
_worldPacket
<<
uint32
(
Flags
);
50
_worldPacket
<<
uint32
(
Contacts
.size());
51
52
for
(
ContactInfo
const
&
contact
:
Contacts
)
53
_worldPacket
<<
contact
;
54
55
return
&
_worldPacket
;
56
}
57
58
WorldPacket
const
*
FriendStatus::Write
()
59
{
60
_worldPacket
<<
uint8
(
FriendResult
);
61
_worldPacket
<<
Guid
;
62
63
switch
(
FriendResult
)
64
{
65
case
FRIEND_ADDED_ONLINE
:
66
_worldPacket
<<
Notes
;
67
[[
fallthrough
]];
68
case
FRIEND_ONLINE
:
69
_worldPacket
<<
uint8
(
Status
);
70
_worldPacket
<<
uint32
(
AreaID
);
71
_worldPacket
<<
uint32
(
Level
);
72
_worldPacket
<<
uint32
(
ClassID
);
73
break
;
74
case
FRIEND_ADDED_OFFLINE
:
75
_worldPacket
<<
Notes
;
76
break
;
77
default
:
78
break
;
79
}
80
81
return
&
_worldPacket
;
82
}
83
84
void
AddFriend::Read
()
85
{
86
_worldPacket
>>
Name
;
87
_worldPacket
>>
Notes
;
88
}
89
90
void
DelFriend::Read
()
91
{
92
_worldPacket
>>
Player
;
93
}
94
95
void
SetContactNotes::Read
()
96
{
97
_worldPacket
>>
Player
;
98
_worldPacket
>>
Notes
;
99
}
100
101
void
AddIgnore::Read
()
102
{
103
_worldPacket
>>
Name
;
104
}
105
106
void
DelIgnore::Read
()
107
{
108
_worldPacket
>>
Player
;
109
}
110
}
uint8
uint8_t uint8
Definition
Define.h:135
uint32
uint32_t uint32
Definition
Define.h:133
SocialMgr.h
FRIEND_ONLINE
@ FRIEND_ONLINE
Definition
SocialMgr.h:69
FRIEND_ADDED_OFFLINE
@ FRIEND_ADDED_OFFLINE
Definition
SocialMgr.h:74
FRIEND_ADDED_ONLINE
@ FRIEND_ADDED_ONLINE
Definition
SocialMgr.h:73
SOCIAL_FLAG_FRIEND
@ SOCIAL_FLAG_FRIEND
Definition
SocialMgr.h:40
SocialPackets.h
ByteBuffer
Definition
ByteBuffer.h:70
WorldPacket
Definition
WorldPacket.h:27
WorldPackets::Array
Definition
PacketUtilities.h:120
WorldPackets::Packet::_worldPacket
WorldPacket _worldPacket
Definition
Packet.h:42
WorldPackets::Social::AddFriend::Notes
std::string Notes
Definition
SocialPackets.h:87
WorldPackets::Social::AddFriend::Name
std::string Name
Definition
SocialPackets.h:88
WorldPackets::Social::AddFriend::Read
void Read() override
Definition
SocialPackets.cpp:84
WorldPackets::Social::AddIgnore::Read
void Read() override
Definition
SocialPackets.cpp:101
WorldPackets::Social::AddIgnore::Name
std::string Name
Definition
SocialPackets.h:119
WorldPackets::Social::ContactList::Write
WorldPacket const * Write() override
Definition
SocialPackets.cpp:47
WorldPackets::Social::ContactList::Contacts
std::vector< ContactInfo > Contacts
Definition
SocialPackets.h:60
WorldPackets::Social::ContactList::Flags
uint32 Flags
Definition
SocialPackets.h:61
WorldPackets::Social::DelFriend::Read
void Read() override
Definition
SocialPackets.cpp:90
WorldPackets::Social::DelFriend::Player
ObjectGuid Player
Definition
SocialPackets.h:98
WorldPackets::Social::DelIgnore::Read
void Read() override
Definition
SocialPackets.cpp:106
WorldPackets::Social::DelIgnore::Player
ObjectGuid Player
Definition
SocialPackets.h:129
WorldPackets::Social::FriendStatus::AreaID
uint32 AreaID
Definition
SocialPackets.h:76
WorldPackets::Social::FriendStatus::Guid
ObjectGuid Guid
Definition
SocialPackets.h:74
WorldPackets::Social::FriendStatus::Status
uint8 Status
Definition
SocialPackets.h:73
WorldPackets::Social::FriendStatus::Write
WorldPacket const * Write() override
Definition
SocialPackets.cpp:58
WorldPackets::Social::FriendStatus::Notes
std::string Notes
Definition
SocialPackets.h:71
WorldPackets::Social::FriendStatus::FriendResult
uint8 FriendResult
Definition
SocialPackets.h:77
WorldPackets::Social::FriendStatus::ClassID
uint32 ClassID
Definition
SocialPackets.h:72
WorldPackets::Social::FriendStatus::Level
uint32 Level
Definition
SocialPackets.h:75
WorldPackets::Social::SendContactList::Flags
uint32 Flags
Definition
SocialPackets.h:39
WorldPackets::Social::SendContactList::Read
void Read() override
Definition
SocialPackets.cpp:23
WorldPackets::Social::SetContactNotes::Read
void Read() override
Definition
SocialPackets.cpp:95
WorldPackets::Social::SetContactNotes::Notes
std::string Notes
Definition
SocialPackets.h:109
WorldPackets::Social::SetContactNotes::Player
ObjectGuid Player
Definition
SocialPackets.h:108
WorldPackets::Social
Definition
SocialPackets.cpp:22
WorldPackets::Social::operator<<
ByteBuffer & operator<<(ByteBuffer &data, ContactInfo const &contact)
Definition
SocialPackets.cpp:28
WorldPackets::Social::ContactInfo
Definition
SocialPackets.h:43
server
game
Server
Packets
SocialPackets.cpp
Generated by
1.9.8