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 << playerDungeonInfo.Rewards;
174
175 for (LfgPlayerQuestReward const& shortageReward : playerDungeonInfo.ShortageReward)
176 data << shortageReward;
177
178 data << Bits<1>(playerDungeonInfo.FirstReward);
179 data << Bits<1>(playerDungeonInfo.ShortageEligible);
180 data.FlushBits();
181
182 return data;
183}
184
186{
187 _worldPacket << Size<uint32>(Dungeon);
189 for (LfgPlayerDungeonInfo const& playerDungeonInfo : Dungeon)
190 _worldPacket << playerDungeonInfo;
191
192 return &_worldPacket;
193}
194
196{
197 _worldPacket << Size<uint32>(Player);
198 for (LFGBlackList const& player : Player)
199 _worldPacket << player;
200
201 return &_worldPacket;
202}
203
205{
209 _worldPacket << Size<uint32>(Slots);
211 _worldPacket << Size<uint32>(SuspendedPlayers);
213
214 for (uint32 slot : Slots)
215 _worldPacket << uint32(slot);
216
217 for (ObjectGuid const& suspendedPlayer : SuspendedPlayers)
218 _worldPacket << suspendedPlayer;
219
220 _worldPacket << Bits<1>(NotifyUI);
221 _worldPacket << Bits<1>(IsParty);
222 _worldPacket << Bits<1>(Joined);
223 _worldPacket << Bits<1>(LfgJoined);
224 _worldPacket << Bits<1>(Queued);
225 _worldPacket << Bits<1>(Brawl);
227
228 return &_worldPacket;
229}
230
232{
235 _worldPacket << Bits<1>(Accepted);
237
238 return &_worldPacket;
239}
240
241ByteBuffer& operator<<(ByteBuffer& data, LFGRoleCheckUpdateMember const& lfgRoleCheckUpdateMember)
242{
243 data << lfgRoleCheckUpdateMember.Guid;
244 data << uint8(lfgRoleCheckUpdateMember.RolesDesired);
245 data << uint8(lfgRoleCheckUpdateMember.Level);
246 data << Bits<1>(lfgRoleCheckUpdateMember.RoleCheckComplete);
247 data.FlushBits();
248
249 return data;
250}
251
253{
256 _worldPacket << Size<uint32>(JoinSlots);
257 _worldPacket << Size<uint32>(BgQueueIDs);
259 _worldPacket << Size<uint32>(Members);
260
261 for (uint32 slot : JoinSlots)
262 _worldPacket << uint32(slot);
263
264 for (uint64 bgQueueID : BgQueueIDs)
265 _worldPacket << uint64(bgQueueID);
266
267 for (LFGRoleCheckUpdateMember const& member : Members)
268 _worldPacket << member;
269
270 _worldPacket << Bits<1>(IsBeginning);
271 _worldPacket << Bits<1>(IsRequeue);
273
274 return &_worldPacket;
275}
276
278{
282 _worldPacket << Size<uint32>(BlackList);
283 _worldPacket << Size<uint32>(BlackListNames);
284
285 for (LFGBlackList const& blackList : BlackList)
286 _worldPacket << blackList;
287
288 for (std::string_view const& str : BlackListNames)
289 _worldPacket << SizedCString::BitsSize<24>(str);
290
291 for (std::string_view const& str : BlackListNames)
293
294 return &_worldPacket;
295}
296
298{
303
304 for (uint32 i = 0; i < 3; ++i)
305 {
308 }
310
311 return &_worldPacket;
312}
313
314ByteBuffer& operator<<(ByteBuffer& data, LFGPlayerRewards const& lfgPlayerRewards)
315{
316 data << OptionalInit(lfgPlayerRewards.RewardItem);
317 data << OptionalInit(lfgPlayerRewards.RewardCurrency);
318 data << uint32(lfgPlayerRewards.Quantity);
319 data << int32(lfgPlayerRewards.BonusQuantity);
320
321 if (lfgPlayerRewards.RewardItem)
322 data << *lfgPlayerRewards.RewardItem;
323
324 if (lfgPlayerRewards.RewardCurrency)
325 data << int32(*lfgPlayerRewards.RewardCurrency);
326
327 return data;
328}
329
331{
336 _worldPacket << Size<uint32>(Rewards);
337
338 for (LFGPlayerRewards const& reward : Rewards)
339 _worldPacket << reward;
340
341 return &_worldPacket;
342}
343
344ByteBuffer& operator<<(ByteBuffer& data, LfgBootInfo const& lfgBootInfo)
345{
346 data << Bits<1>(lfgBootInfo.VoteInProgress);
347 data << Bits<1>(lfgBootInfo.VotePassed);
348 data << Bits<1>(lfgBootInfo.MyVoteCompleted);
349 data << Bits<1>(lfgBootInfo.MyVote);
350 data << SizedString::BitsSize<9>(lfgBootInfo.Reason);
351 data << lfgBootInfo.Target;
352 data << uint32(lfgBootInfo.TotalVotes);
353 data << uint32(lfgBootInfo.BootVotes);
354 data << int32(lfgBootInfo.TimeLeft);
355 data << uint32(lfgBootInfo.VotesNeeded);
356 data << SizedString::Data(lfgBootInfo.Reason);
357
358 return data;
359}
360
362{
364
365 return &_worldPacket;
366}
367
368ByteBuffer& operator<<(ByteBuffer& data, LFGProposalUpdatePlayer const& lfgProposalUpdatePlayer)
369{
370 data << uint8(lfgProposalUpdatePlayer.Roles);
371 data << Bits<1>(lfgProposalUpdatePlayer.Me);
372 data << Bits<1>(lfgProposalUpdatePlayer.SameParty);
373 data << Bits<1>(lfgProposalUpdatePlayer.MyParty);
374 data << Bits<1>(lfgProposalUpdatePlayer.Responded);
375 data << Bits<1>(lfgProposalUpdatePlayer.Accepted);
376 data.FlushBits();
377
378 return data;
379}
380
382{
390 _worldPacket << Size<uint32>(Players);
392
393 for (LFGProposalUpdatePlayer const& player : Players)
394 _worldPacket << player;
395
396 _worldPacket << Bits<1>(ValidCompletedMask);
397 _worldPacket << Bits<1>(ProposalSilent);
398 _worldPacket << Bits<1>(FailedByMyParty);
400
401 return &_worldPacket;
402}
403
405{
407
408 return &_worldPacket;
409}
410
412{
413 _worldPacket << Bits<4>(Reason);
415
416 return &_worldPacket;
417}
418}
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:142
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