TrinityCore
Loading...
Searching...
No Matches
LFGPackets.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 "LFGPackets.h"
19#include "PacketOperators.h"
20
21namespace WorldPackets::LFG
22{
24{
25 _worldPacket >> Bits<1>(QueueAsGroup);
27 _worldPacket >> Bits<1>(Mercenary);
29 _worldPacket >> Size<uint32>(Slots);
30 if (PartyIndex)
32
33 for (uint32& slot : Slots)
34 _worldPacket >> slot;
35}
36
38{
40}
41
49
57
59{
60 _worldPacket >> Bits<1>(Vote);
61}
62
64{
65 _worldPacket >> Bits<1>(TeleportOut);
66}
67
75
76ByteBuffer& operator<<(ByteBuffer& data, LFGBlackListSlot const& lfgBlackListSlot)
77{
78 data << uint32(lfgBlackListSlot.Slot);
79 data << uint32(lfgBlackListSlot.Reason);
80 data << int32(lfgBlackListSlot.SubReason1);
81 data << int32(lfgBlackListSlot.SubReason2);
82 data << uint32(lfgBlackListSlot.SoftLock);
83
84 return data;
85}
86
88{
89 data << OptionalInit(blackList.PlayerGuid);
90 data << Size<uint32>(blackList.Slot);
91 if (blackList.PlayerGuid)
92 data << *blackList.PlayerGuid;
93
94 for (LFGBlackListSlot const& slot : blackList.Slot)
95 data << slot;
96
97 return data;
98}
99
100ByteBuffer& operator<<(ByteBuffer& data, LfgPlayerQuestRewardItem const& playerQuestRewardItem)
101{
102 data << int32(playerQuestRewardItem.ItemID);
103 data << int32(playerQuestRewardItem.Quantity);
104
105 return data;
106}
107
108ByteBuffer& operator<<(ByteBuffer& data, LfgPlayerQuestRewardCurrency const& playerQuestRewardCurrency)
109{
110 data << int32(playerQuestRewardCurrency.CurrencyID);
111 data << int32(playerQuestRewardCurrency.Quantity);
112
113 return data;
114}
115
116ByteBuffer& operator<<(ByteBuffer& data, LfgPlayerQuestReward const& playerQuestReward)
117{
118 data << uint8(playerQuestReward.Mask);
119 data << int32(playerQuestReward.RewardMoney);
120 data << int32(playerQuestReward.RewardXP);
121 data << Size<uint32>(playerQuestReward.Item);
122 data << Size<uint32>(playerQuestReward.Currency);
123 data << Size<uint32>(playerQuestReward.BonusCurrency);
124
125 for (LfgPlayerQuestRewardItem const& item : playerQuestReward.Item)
126 data << item;
127
128 for (LfgPlayerQuestRewardCurrency const& currency : playerQuestReward.Currency)
129 data << currency;
130
131 for (LfgPlayerQuestRewardCurrency const& bonusCurrency : playerQuestReward.BonusCurrency)
132 data << bonusCurrency;
133
134 data << OptionalInit(playerQuestReward.RewardSpellID);
135 data << OptionalInit(playerQuestReward.ArtifactXPCategory);
136 data << OptionalInit(playerQuestReward.ArtifactXP);
137 data << OptionalInit(playerQuestReward.Honor);
138 data.FlushBits();
139
140 if (playerQuestReward.RewardSpellID)
141 data << int32(*playerQuestReward.RewardSpellID);
142
143 if (playerQuestReward.ArtifactXPCategory)
144 data << int32(*playerQuestReward.ArtifactXPCategory);
145
146 if (playerQuestReward.ArtifactXP)
147 data << uint64(*playerQuestReward.ArtifactXP);
148
149 if (playerQuestReward.Honor)
150 data << int32(*playerQuestReward.Honor);
151
152 return data;
153}
154
155ByteBuffer& operator<<(ByteBuffer& data, LfgPlayerDungeonInfo const& playerDungeonInfo)
156{
157 data << uint32(playerDungeonInfo.Slot);
158 data << int32(playerDungeonInfo.CompletionQuantity);
159 data << int32(playerDungeonInfo.CompletionLimit);
160 data << int32(playerDungeonInfo.CompletionCurrencyID);
161 data << int32(playerDungeonInfo.SpecificQuantity);
162 data << int32(playerDungeonInfo.SpecificLimit);
163 data << int32(playerDungeonInfo.OverallQuantity);
164 data << int32(playerDungeonInfo.OverallLimit);
165 data << int32(playerDungeonInfo.PurseWeeklyQuantity);
166 data << int32(playerDungeonInfo.PurseWeeklyLimit);
167 data << int32(playerDungeonInfo.PurseQuantity);
168 data << int32(playerDungeonInfo.PurseLimit);
169 data << int32(playerDungeonInfo.Quantity);
170 data << uint32(playerDungeonInfo.CompletedMask);
171 data << uint32(playerDungeonInfo.EncounterMask);
172 data << Size<uint32>(playerDungeonInfo.ShortageReward);
173 data << Bits<1>(playerDungeonInfo.FirstReward);
174 data << Bits<1>(playerDungeonInfo.ShortageEligible);
175 data.FlushBits();
176
177 data << playerDungeonInfo.Rewards;
178 for (LfgPlayerQuestReward const& shortageReward : playerDungeonInfo.ShortageReward)
179 data << shortageReward;
180
181 return data;
182}
183
185{
186 _worldPacket << Size<uint32>(Dungeon);
188 for (LfgPlayerDungeonInfo const& playerDungeonInfo : Dungeon)
189 _worldPacket << playerDungeonInfo;
190
191 return &_worldPacket;
192}
193
195{
196 _worldPacket << Size<uint32>(Player);
197 for (LFGBlackList const& player : Player)
198 _worldPacket << player;
199
200 return &_worldPacket;
201}
202
204{
208 _worldPacket << Size<uint32>(Slots);
210 _worldPacket << Size<uint32>(SuspendedPlayers);
212
213 for (uint32 slot : Slots)
214 _worldPacket << uint32(slot);
215
216 for (ObjectGuid const& suspendedPlayer : SuspendedPlayers)
217 _worldPacket << suspendedPlayer;
218
219 _worldPacket << Bits<1>(IsParty);
220 _worldPacket << Bits<1>(NotifyUI);
221 _worldPacket << Bits<1>(Joined);
222 _worldPacket << Bits<1>(LfgJoined);
223 _worldPacket << Bits<1>(Queued);
224 _worldPacket << Bits<1>(Brawl);
226
227 return &_worldPacket;
228}
229
231{
234 _worldPacket << Bits<1>(Accepted);
236
237 return &_worldPacket;
238}
239
240ByteBuffer& operator<<(ByteBuffer& data, LFGRoleCheckUpdateMember const& lfgRoleCheckUpdateMember)
241{
242 data << lfgRoleCheckUpdateMember.Guid;
243 data << uint8(lfgRoleCheckUpdateMember.RolesDesired);
244 data << uint8(lfgRoleCheckUpdateMember.Level);
245 data << Bits<1>(lfgRoleCheckUpdateMember.RoleCheckComplete);
246 data.FlushBits();
247
248 return data;
249}
250
252{
255 _worldPacket << Size<uint32>(JoinSlots);
256 _worldPacket << Size<uint32>(BgQueueIDs);
258 _worldPacket << Size<uint32>(Members);
259
260 for (uint32 slot : JoinSlots)
261 _worldPacket << uint32(slot);
262
263 for (uint64 bgQueueID : BgQueueIDs)
264 _worldPacket << uint64(bgQueueID);
265
266 _worldPacket << Bits<1>(IsBeginning);
267 _worldPacket << Bits<1>(IsRequeue);
269
270 for (LFGRoleCheckUpdateMember const& member : Members)
271 _worldPacket << member;
272
273 return &_worldPacket;
274}
275
277{
281 _worldPacket << Size<uint32>(BlackList);
282 _worldPacket << Size<uint32>(BlackListNames);
283
284 for (LFGBlackList const& blackList : BlackList)
285 _worldPacket << blackList;
286
287 for (std::string_view const& str : BlackListNames)
288 _worldPacket << SizedCString::BitsSize<24>(str);
289
290 for (std::string_view const& str : BlackListNames)
292
293 return &_worldPacket;
294}
295
297{
302
303 for (uint32 i = 0; i < 3; ++i)
304 {
307 }
309
310 return &_worldPacket;
311}
312
313ByteBuffer& operator<<(ByteBuffer& data, LFGPlayerRewards const& lfgPlayerRewards)
314{
315 data << OptionalInit(lfgPlayerRewards.RewardItem);
316 data << OptionalInit(lfgPlayerRewards.RewardCurrency);
317 if (lfgPlayerRewards.RewardItem)
318 data << *lfgPlayerRewards.RewardItem;
319
320 data << uint32(lfgPlayerRewards.Quantity);
321 data << int32(lfgPlayerRewards.BonusQuantity);
322 if (lfgPlayerRewards.RewardCurrency)
323 data << int32(*lfgPlayerRewards.RewardCurrency);
324
325 return data;
326}
327
329{
334 _worldPacket << Size<uint32>(Rewards);
335
336 for (LFGPlayerRewards const& reward : Rewards)
337 _worldPacket << reward;
338
339 return &_worldPacket;
340}
341
342ByteBuffer& operator<<(ByteBuffer& data, LfgBootInfo const& lfgBootInfo)
343{
344 data << Bits<1>(lfgBootInfo.VoteInProgress);
345 data << Bits<1>(lfgBootInfo.VotePassed);
346 data << Bits<1>(lfgBootInfo.MyVoteCompleted);
347 data << Bits<1>(lfgBootInfo.MyVote);
348 data << SizedString::BitsSize<9>(lfgBootInfo.Reason);
349 data << lfgBootInfo.Target;
350 data << uint32(lfgBootInfo.TotalVotes);
351 data << uint32(lfgBootInfo.BootVotes);
352 data << int32(lfgBootInfo.TimeLeft);
353 data << uint32(lfgBootInfo.VotesNeeded);
354 data << SizedString::Data(lfgBootInfo.Reason);
355
356 return data;
357}
358
360{
362
363 return &_worldPacket;
364}
365
366ByteBuffer& operator<<(ByteBuffer& data, LFGProposalUpdatePlayer const& lfgProposalUpdatePlayer)
367{
368 data << uint8(lfgProposalUpdatePlayer.Roles);
369 data << Bits<1>(lfgProposalUpdatePlayer.Me);
370 data << Bits<1>(lfgProposalUpdatePlayer.SameParty);
371 data << Bits<1>(lfgProposalUpdatePlayer.MyParty);
372 data << Bits<1>(lfgProposalUpdatePlayer.Responded);
373 data << Bits<1>(lfgProposalUpdatePlayer.Accepted);
374 data.FlushBits();
375
376 return data;
377}
378
380{
388 _worldPacket << Size<uint32>(Players);
390 _worldPacket << Bits<1>(ValidCompletedMask);
391 _worldPacket << Bits<1>(ProposalSilent);
392 _worldPacket << Bits<1>(FailedByMyParty);
394
395 for (LFGProposalUpdatePlayer const& player : Players)
396 _worldPacket << player;
397
398 return &_worldPacket;
399}
400
402{
404
405 return &_worldPacket;
406}
407
409{
410 _worldPacket << Bits<4>(Reason);
412
413 return &_worldPacket;
414}
415}
uint8_t uint8
Definition Define.h:156
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
void FlushBits()
Definition ByteBuffer.h:141
Array< uint32, 50 > Slots
Definition LFGPackets.h:47
Optional< uint8 > PartyIndex
Definition LFGPackets.h:45
Optional< uint8 > PartyIndex
Definition LFGPackets.h:81
std::vector< std::string_view > BlackListNames
Definition LFGPackets.h:292
WorldPacket const * Write() override
std::vector< LFGBlackList > BlackList
Definition LFGPackets.h:291
WorldPacket const * Write() override
std::vector< LFGPlayerRewards > Rewards
Definition LFGPackets.h:345
WorldPacket const * Write() override
std::vector< LFGProposalUpdatePlayer > Players
Definition LFGPackets.h:400
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< LFGRoleCheckUpdateMember > Members
Definition LFGPackets.h:276
WorldPacket const * Write() override
WorldPacket const * Write() override
lfg::LfgTeleportResult Reason
Definition LFGPackets.h:428
WorldPacket const * Write() override
std::vector< ObjectGuid > SuspendedPlayers
Definition LFGPackets.h:230
std::vector< uint32 > Slots
Definition LFGPackets.h:228
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< LFGBlackList > Player
Definition LFGPackets.h:215
std::vector< LfgPlayerDungeonInfo > Dungeon
Definition LFGPackets.h:205
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket _worldPacket
Definition Packet.h:43
ByteBuffer & operator<<(ByteBuffer &data, LFGBlackListSlot const &lfgBlackListSlot)
DataWriter< Container > Data(Container const &value)
DataWriter< Container > Data(Container const &value)
OptionalInitWriter< T > OptionalInit(Optional< T > const &value)
Optional< ObjectGuid > PlayerGuid
Definition LFGPackets.h:138
std::vector< LFGBlackListSlot > Slot
Definition LFGPackets.h:139
Optional< Item::ItemInstance > RewardItem
Definition LFGPackets.h:328
std::vector< LfgPlayerQuestReward > ShortageReward
Definition LFGPackets.h:194
std::vector< LfgPlayerQuestRewardCurrency > Currency
Definition LFGPackets.h:166
std::vector< LfgPlayerQuestRewardItem > Item
Definition LFGPackets.h:165
std::vector< LfgPlayerQuestRewardCurrency > BonusCurrency
Definition LFGPackets.h:167