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
22{
24{
25 _worldPacket >> SizedString::BitsSize<6>(CharName);
27}
28
30{
31 _worldPacket << SizedString::BitsSize<11>(AccountName);
33
35
36 return &_worldPacket;
37}
38
40{
41 data.ResetBitPos();
42 data >> SizedString::BitsSize<7>(word.Word);
43 data >> SizedString::Data(word.Word);
44
45 return data;
46}
47
49{
50 data >> serverInfo.FactionGroup;
51 data >> serverInfo.Locale;
52 data >> serverInfo.RequesterVirtualRealmAddress;
53
54 return data;
55}
56
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);
81
82 if (request.ServerInfo)
83 data >> *request.ServerInfo;
84
85 return data;
86}
87
89{
90 _worldPacket >> BitsSize<4>(Areas);
91 _worldPacket >> Bits<1>(IsAddon);
95
96 for (size_t i = 0; i < Areas.size(); ++i)
97 _worldPacket >> Areas[i];
98}
99
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
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
129{
132
133 return &_worldPacket;
134}
135}
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
void ResetBitPos()
Definition ByteBuffer.h:152
void FlushBits()
Definition ByteBuffer.h:141
WorldPacket _worldPacket
Definition Packet.h:43
WorldPacket const * Write() override
WorldPacket const * Write() override
DataWriter< Container > Data(Container const &value)
ByteBuffer & operator<<(ByteBuffer &data, WhoEntry const &entry)
ByteBuffer & operator>>(ByteBuffer &data, WhoWord &word)
OptionalInitWriter< T > OptionalInit(Optional< T > const &value)
Query::PlayerGuidLookupData PlayerData
Definition WhoPackets.h:95
std::vector< WhoWord > Words
Definition WhoPackets.h:72
Trinity::RaceMask< std::array< int32, 2 > > RaceFilter
Definition WhoPackets.h:70
Optional< WhoRequestServerInfo > ServerInfo
Definition WhoPackets.h:76
std::vector< WhoEntry > Entries
Definition WhoPackets.h:105