TrinityCore
Loading...
Searching...
No Matches
WhoPackets.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 "
WhoPackets.h
"
19
#include "
PacketOperators.h
"
20
21
namespace
WorldPackets::Who
22
{
23
void
WhoIsRequest::Read
()
24
{
25
_worldPacket
>> SizedString::BitsSize<6>(
CharName
);
26
_worldPacket
>>
SizedString::Data
(
CharName
);
27
}
28
29
WorldPacket
const
*
WhoIsResponse::Write
()
30
{
31
_worldPacket << SizedString::BitsSize<11>(
AccountName
);
32
_worldPacket
.
FlushBits
();
33
34
_worldPacket
<<
SizedString::Data
(
AccountName
);
35
36
return
&
_worldPacket
;
37
}
38
39
ByteBuffer
&
operator>>
(
ByteBuffer
& data,
WhoWord
& word)
40
{
41
data.
ResetBitPos
();
42
data >> SizedString::BitsSize<7>(word.
Word
);
43
data >>
SizedString::Data
(word.
Word
);
44
45
return
data;
46
}
47
48
ByteBuffer
&
operator>>
(
ByteBuffer
& data,
WhoRequestServerInfo
& serverInfo)
49
{
50
data >> serverInfo.
FactionGroup
;
51
data >> serverInfo.
Locale
;
52
data >> serverInfo.
RequesterVirtualRealmAddress
;
53
54
return
data;
55
}
56
57
ByteBuffer
&
operator>>
(
ByteBuffer
& data,
WhoRequest
& request)
58
{
59
data >> request.
MinLevel
;
60
data >> request.
MaxLevel
;
61
for
(
int32
& rawValue : request.
RaceFilter
.
RawValue
)
62
data >> rawValue;
63
data >> request.
ClassFilter
;
64
data >> SizedString::BitsSize<6>(request.
Name
);
65
data >> SizedString::BitsSize<9>(request.
VirtualRealmName
);
66
data >> SizedString::BitsSize<7>(request.
Guild
);
67
data >> SizedString::BitsSize<9>(request.
GuildVirtualRealmName
);
68
data >> BitsSize<3>(request.
Words
);
69
data >> Bits<1>(request.
ShowEnemies
);
70
data >> Bits<1>(request.
ShowArenaPlayers
);
71
data >> Bits<1>(request.
ExactName
);
72
data >>
OptionalInit
(request.
ServerInfo
);
73
74
for
(
size_t
i = 0; i < request.
Words
.size(); ++i)
75
data >> request.
Words
[i];
76
77
data >>
SizedString::Data
(request.
Name
);
78
data >>
SizedString::Data
(request.
VirtualRealmName
);
79
data >>
SizedString::Data
(request.
Guild
);
80
data >>
SizedString::Data
(request.
GuildVirtualRealmName
);
81
82
if
(request.
ServerInfo
)
83
data >> *request.
ServerInfo
;
84
85
return
data;
86
}
87
88
void
WhoRequestPkt::Read
()
89
{
90
_worldPacket
>> BitsSize<4>(
Areas
);
91
_worldPacket
>> Bits<1>(
IsAddon
);
92
_worldPacket
>>
Request
;
93
_worldPacket
>>
Token
;
94
_worldPacket
>>
Origin
;
95
96
for
(
size_t
i = 0; i <
Areas
.size(); ++i)
97
_worldPacket
>>
Areas
[i];
98
}
99
100
ByteBuffer
&
operator<<
(
ByteBuffer
& data,
WhoEntry
const
& entry)
101
{
102
data << entry.
PlayerData
;
103
104
data << entry.
GuildGUID
;
105
data <<
uint32
(entry.
GuildVirtualRealmAddress
);
106
data <<
int32
(entry.
AreaID
);
107
108
data << SizedString::BitsSize<7>(entry.
GuildName
);
109
data << Bits<1>(entry.
IsGM
);
110
data.
FlushBits
();
111
112
data <<
SizedString::Data
(entry.
GuildName
);
113
114
return
data;
115
}
116
117
ByteBuffer
&
operator<<
(
ByteBuffer
& data,
WhoResponse
const
& response)
118
{
119
data << BitsSize<6>(response.
Entries
);
120
data.
FlushBits
();
121
122
for
(
WhoEntry
const
& whoEntry : response.
Entries
)
123
data << whoEntry;
124
125
return
data;
126
}
127
128
WorldPacket
const
*
WhoResponsePkt::Write
()
129
{
130
_worldPacket
<<
uint32
(
Token
);
131
_worldPacket
<<
Response
;
132
133
return
&
_worldPacket
;
134
}
135
}
int32
int32_t int32
Definition
Define.h:150
uint32
uint32_t uint32
Definition
Define.h:154
PacketOperators.h
WhoPackets.h
ByteBuffer
Definition
ByteBuffer.h:63
ByteBuffer::ResetBitPos
void ResetBitPos()
Definition
ByteBuffer.h:152
ByteBuffer::FlushBits
void FlushBits()
Definition
ByteBuffer.h:141
WorldPacket
Definition
WorldPacket.h:26
WorldPackets::Packet::_worldPacket
WorldPacket _worldPacket
Definition
Packet.h:43
WorldPackets::Who::WhoIsRequest::CharName
std::string CharName
Definition
WhoPackets.h:37
WorldPackets::Who::WhoIsRequest::Read
void Read() override
Definition
WhoPackets.cpp:23
WorldPackets::Who::WhoIsResponse::AccountName
std::string AccountName
Definition
WhoPackets.h:47
WorldPackets::Who::WhoIsResponse::Write
WorldPacket const * Write() override
Definition
WhoPackets.cpp:29
WorldPackets::Who::WhoRequestPkt::IsAddon
bool IsAddon
Definition
WhoPackets.h:89
WorldPackets::Who::WhoRequestPkt::Request
WhoRequest Request
Definition
WhoPackets.h:86
WorldPackets::Who::WhoRequestPkt::Read
void Read() override
Definition
WhoPackets.cpp:88
WorldPackets::Who::WhoRequestPkt::Origin
uint8 Origin
Definition
WhoPackets.h:88
WorldPackets::Who::WhoRequestPkt::Token
uint32 Token
Definition
WhoPackets.h:87
WorldPackets::Who::WhoResponsePkt::Response
WhoResponse Response
Definition
WhoPackets.h:116
WorldPackets::Who::WhoResponsePkt::Write
WorldPacket const * Write() override
Definition
WhoPackets.cpp:128
WorldPackets::Who::WhoResponsePkt::Token
uint32 Token
Definition
WhoPackets.h:115
WorldPackets::SizedString::Data
DataWriter< Container > Data(Container const &value)
Definition
PacketOperators.h:325
WorldPackets::Who
Definition
WhoPackets.cpp:22
WorldPackets::Who::operator<<
ByteBuffer & operator<<(ByteBuffer &data, WhoEntry const &entry)
Definition
WhoPackets.cpp:100
WorldPackets::Who::operator>>
ByteBuffer & operator>>(ByteBuffer &data, WhoWord &word)
Definition
WhoPackets.cpp:39
WorldPackets::OptionalInit
OptionalInitWriter< T > OptionalInit(Optional< T > const &value)
Definition
PacketOperators.h:100
Areas
Definition
Player.h:468
Trinity::RaceMask::RawValue
T RawValue
Definition
RaceMask.h:94
WorldPackets::Who::WhoEntry
Definition
WhoPackets.h:94
WorldPackets::Who::WhoEntry::AreaID
int32 AreaID
Definition
WhoPackets.h:99
WorldPackets::Who::WhoEntry::GuildVirtualRealmAddress
uint32 GuildVirtualRealmAddress
Definition
WhoPackets.h:97
WorldPackets::Who::WhoEntry::PlayerData
Query::PlayerGuidLookupData PlayerData
Definition
WhoPackets.h:95
WorldPackets::Who::WhoEntry::GuildGUID
ObjectGuid GuildGUID
Definition
WhoPackets.h:96
WorldPackets::Who::WhoEntry::GuildName
std::string GuildName
Definition
WhoPackets.h:98
WorldPackets::Who::WhoEntry::IsGM
bool IsGM
Definition
WhoPackets.h:100
WorldPackets::Who::WhoRequestServerInfo
Definition
WhoPackets.h:56
WorldPackets::Who::WhoRequestServerInfo::Locale
int32 Locale
Definition
WhoPackets.h:58
WorldPackets::Who::WhoRequestServerInfo::RequesterVirtualRealmAddress
uint32 RequesterVirtualRealmAddress
Definition
WhoPackets.h:59
WorldPackets::Who::WhoRequestServerInfo::FactionGroup
uint8 FactionGroup
Definition
WhoPackets.h:57
WorldPackets::Who::WhoRequest
Definition
WhoPackets.h:63
WorldPackets::Who::WhoRequest::Words
std::vector< WhoWord > Words
Definition
WhoPackets.h:72
WorldPackets::Who::WhoRequest::RaceFilter
Trinity::RaceMask< std::array< int32, 2 > > RaceFilter
Definition
WhoPackets.h:70
WorldPackets::Who::WhoRequest::MaxLevel
int32 MaxLevel
Definition
WhoPackets.h:65
WorldPackets::Who::WhoRequest::Guild
std::string Guild
Definition
WhoPackets.h:68
WorldPackets::Who::WhoRequest::ExactName
bool ExactName
Definition
WhoPackets.h:75
WorldPackets::Who::WhoRequest::VirtualRealmName
std::string VirtualRealmName
Definition
WhoPackets.h:67
WorldPackets::Who::WhoRequest::ClassFilter
int32 ClassFilter
Definition
WhoPackets.h:71
WorldPackets::Who::WhoRequest::Name
std::string Name
Definition
WhoPackets.h:66
WorldPackets::Who::WhoRequest::ShowArenaPlayers
bool ShowArenaPlayers
Definition
WhoPackets.h:74
WorldPackets::Who::WhoRequest::ShowEnemies
bool ShowEnemies
Definition
WhoPackets.h:73
WorldPackets::Who::WhoRequest::ServerInfo
Optional< WhoRequestServerInfo > ServerInfo
Definition
WhoPackets.h:76
WorldPackets::Who::WhoRequest::MinLevel
int32 MinLevel
Definition
WhoPackets.h:64
WorldPackets::Who::WhoRequest::GuildVirtualRealmName
std::string GuildVirtualRealmName
Definition
WhoPackets.h:69
WorldPackets::Who::WhoResponse
Definition
WhoPackets.h:104
WorldPackets::Who::WhoResponse::Entries
std::vector< WhoEntry > Entries
Definition
WhoPackets.h:105
WorldPackets::Who::WhoWord
Definition
WhoPackets.h:51
WorldPackets::Who::WhoWord::Word
std::string Word
Definition
WhoPackets.h:52
server
game
Server
Packets
WhoPackets.cpp
Generated on Sun May 10 2026 02:09:03 for TrinityCore by
1.9.8