TrinityCore
Loading...
Searching...
No Matches
WhoPackets.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
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 "
WhoPackets.h
"
19
20
namespace
WorldPackets::Who
21
{
22
void
WhoIsRequest::Read
()
23
{
24
_worldPacket
>>
CharName
;
25
}
26
27
WorldPacket
const
*
WhoIsResponse::Write
()
28
{
29
_worldPacket
<<
AccountName
;
30
31
return
&
_worldPacket
;
32
}
33
34
ByteBuffer
&
operator>>
(
ByteBuffer
& data,
WhoWord
&
word
)
35
{
36
data >>
word
.Word;
37
38
return
data;
39
}
40
41
ByteBuffer
&
operator>>
(
ByteBuffer
& data,
WhoRequest
&
request
)
42
{
43
data >>
request
.MinLevel;
44
data >>
request
.MaxLevel;
45
data >>
request
.Name;
46
data >>
request
.Guild;
47
data >>
request
.RaceFilter;
48
data >>
request
.ClassFilter;
49
50
request
.Areas.
resize
(data.
read
<
uint32
>());
51
for
(
int32
& area :
request
.Areas)
52
data >> area;
53
54
request
.Words.
resize
(data.
read
<
uint32
>());
55
for
(
WhoWord
&
word
:
request
.Words)
56
data >>
word
;
57
58
return
data;
59
}
60
61
void
WhoRequestPkt::Read
()
62
{
63
_worldPacket
>>
Request
;
64
}
65
66
ByteBuffer
&
operator<<
(
ByteBuffer
& data,
WhoEntry
const
& entry)
67
{
68
data << entry.
Name
;
69
data << entry.
GuildName
;
70
data <<
int32
(entry.
Level
);
71
data <<
int32
(entry.
ClassID
);
72
data <<
int32
(entry.
Race
);
73
data <<
uint8
(entry.
Sex
);
74
data <<
int32
(entry.
AreaID
);
75
76
return
data;
77
}
78
79
ByteBuffer
&
operator<<
(
ByteBuffer
& data,
WhoResponse
const
&
response
)
80
{
81
data <<
uint32
(
response
.Entries.
size
());
82
data <<
uint32
(
response
.TotalMatches);
83
84
for
(
size_t
i
= 0;
i
<
response
.Entries.
size
(); ++
i
)
85
data <<
response
.Entries[
i
];
86
87
return
data;
88
}
89
90
WorldPacket
const
*
WhoResponsePkt::Write
()
91
{
92
_worldPacket
<<
Response
;
93
94
return
&
_worldPacket
;
95
}
96
}
uint8
uint8_t uint8
Definition
Define.h:135
int32
int32_t int32
Definition
Define.h:129
uint32
uint32_t uint32
Definition
Define.h:133
WhoPackets.h
ByteBuffer
Definition
ByteBuffer.h:70
ByteBuffer::read
T read()
Definition
ByteBuffer.h:343
WorldPacket
Definition
WorldPacket.h:27
WorldPackets::Array
Definition
PacketUtilities.h:120
WorldPackets::Array::size
size_type size() const
Definition
PacketUtilities.h:171
WorldPackets::Array::resize
void resize(size_type newSize)
Definition
PacketUtilities.h:177
WorldPackets::Packet::_worldPacket
WorldPacket _worldPacket
Definition
Packet.h:42
WorldPackets::Who::WhoIsRequest::CharName
std::string CharName
Definition
WhoPackets.h:36
WorldPackets::Who::WhoIsRequest::Read
void Read() override
Definition
WhoPackets.cpp:22
WorldPackets::Who::WhoIsResponse::AccountName
std::string AccountName
Definition
WhoPackets.h:46
WorldPackets::Who::WhoIsResponse::Write
WorldPacket const * Write() override
Definition
WhoPackets.cpp:27
WorldPackets::Who::WhoRequestPkt::Request
WhoRequest Request
Definition
WhoPackets.h:73
WorldPackets::Who::WhoRequestPkt::Read
void Read() override
Definition
WhoPackets.cpp:61
WorldPackets::Who::WhoResponsePkt::Response
WhoResponse Response
Definition
WhoPackets.h:100
WorldPackets::Who::WhoResponsePkt::Write
WorldPacket const * Write() override
Definition
WhoPackets.cpp:90
WorldPackets::Who
Definition
WhoPackets.cpp:21
WorldPackets::Who::operator<<
ByteBuffer & operator<<(ByteBuffer &data, WhoEntry const &entry)
Definition
WhoPackets.cpp:66
WorldPackets::Who::operator>>
ByteBuffer & operator>>(ByteBuffer &data, WhoWord &word)
Definition
WhoPackets.cpp:34
WorldPackets::Who::WhoEntry
Definition
WhoPackets.h:77
WorldPackets::Who::WhoEntry::AreaID
int32 AreaID
Definition
WhoPackets.h:84
WorldPackets::Who::WhoEntry::Sex
uint8 Sex
Definition
WhoPackets.h:83
WorldPackets::Who::WhoEntry::Name
std::string_view Name
Definition
WhoPackets.h:78
WorldPackets::Who::WhoEntry::Race
int32 Race
Definition
WhoPackets.h:82
WorldPackets::Who::WhoEntry::Level
int32 Level
Definition
WhoPackets.h:80
WorldPackets::Who::WhoEntry::ClassID
int32 ClassID
Definition
WhoPackets.h:81
WorldPackets::Who::WhoEntry::GuildName
std::string_view GuildName
Definition
WhoPackets.h:79
WorldPackets::Who::WhoRequest
Definition
WhoPackets.h:55
WorldPackets::Who::WhoResponse
Definition
WhoPackets.h:88
WorldPackets::Who::WhoWord
Definition
WhoPackets.h:50
server
game
Server
Packets
WhoPackets.cpp
Generated by
1.9.8