TrinityCore
Loading...
Searching...
No Matches
LootPackets.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 "LootPackets.h"
19#include "PacketOperators.h"
20
21namespace WorldPackets::Loot
22{
23static ByteBuffer& operator<<(ByteBuffer& data, LootItemData const& lootItem)
24{
25 data << Bits<2>(lootItem.Type);
26 data << Bits<3>(lootItem.UIType);
27 data << Bits<1>(lootItem.CanTradeToTapList);
28 data.FlushBits();
29 data << lootItem.Loot; // WorldPackets::Item::ItemInstance
30 data << uint32(lootItem.Quantity);
31 data << uint8(lootItem.LootItemType);
32 data << uint8(lootItem.LootListID);
33
34 return data;
35}
36
37static ByteBuffer& operator<<(ByteBuffer& data, LootCurrency const& lootCurrency)
38{
39 data << uint32(lootCurrency.CurrencyID);
40 data << uint32(lootCurrency.Quantity);
41 data << uint8(lootCurrency.LootListID);
42 data << Bits<3>(lootCurrency.UIType);
43 data.FlushBits();
44
45 return data;
46}
47
49{
51}
52
54{
62 _worldPacket << Size<uint32>(Items);
63 _worldPacket << Size<uint32>(Currencies);
64 _worldPacket << Bits<1>(Acquired);
65 _worldPacket << Bits<1>(AELooting);
66 _worldPacket << Bits<1>(SuppressError);
68
69 for (LootItemData const& item : Items)
70 _worldPacket << item;
71
72 for (LootCurrency const& currency : Currencies)
73 _worldPacket << currency;
74
75 return &_worldPacket;
76}
77
79{
80 _worldPacket >> Size<uint32>(Loot);
81
82 for (LootRequest& lootRequest : Loot)
83 {
84 _worldPacket >> lootRequest.Object;
85 _worldPacket >> lootRequest.LootListID;
86 }
87
88 _worldPacket >> Bits<1>(IsSoftInteract);
89}
90
92{
93 _worldPacket >> Size<uint32>(Loot);
95
96 for (LootRequest& lootRequest : Loot)
97 {
98 _worldPacket >> lootRequest.Object;
99 _worldPacket >> lootRequest.LootListID;
100 }
101}
102
104{
108
109 return &_worldPacket;
110}
111
113{
115}
116
118{
119 _worldPacket >> Bits<1>(IsSoftInteract);
120}
121
123{
126 _worldPacket << Bits<1>(SoleLooter);
128
129 return &_worldPacket;
130}
131
133{
135
136 return &_worldPacket;
137}
138
145
153
172
177
191
193{
200 _worldPacket << Bits<1>(Autopassed);
201 _worldPacket << Bits<1>(OffSpec);
203
204 return &_worldPacket;
205}
206
208{
215 _worldPacket << Bits<1>(MainSpec);
217
218 return &_worldPacket;
219}
220
229
238
240{
242 _worldPacket << Size<uint32>(Players);
243 for (ObjectGuid const& player : Players)
244 _worldPacket << player;
245
246 return &_worldPacket;
247}
248
250{
252
253 return &_worldPacket;
254}
255}
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
RollType
Definition Loot.h:55
void append(T value)
Definition ByteBuffer.h:130
void FlushBits()
Definition ByteBuffer.h:141
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
Array< LootRequest, 100 > Loot
Definition LootPackets.h:95
Optional< ObjectGuid > Master
WorldPacket const * Write() override
Optional< ObjectGuid > RoundRobinWinner
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< LootItemData > Items
Definition LootPackets.h:75
WorldPacket const * Write() override
std::vector< LootCurrency > Currencies
Definition LootPackets.h:76
WorldPacket const * Write() override
int32 Roll
Roll value can be negative, it means that it is an "offspec" roll but only during roll selection broa...
bool Autopassed
Triggers message |HlootHistory:d|h[Loot]|h: You automatically passed on: s because you cannot loot th...
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
Array< LootRequest, 100 > Loot
WorldPacket const * Write() override
std::array< LootRollIneligibilityReason, 5 > LootRollIneligibleReason
Duration< Milliseconds, uint32 > RollTime
WorldPacket _worldPacket
Definition Packet.h:43
static ByteBuffer & operator<<(ByteBuffer &data, LootItemData const &lootItem)
OptionalInitWriter< T > OptionalInit(Optional< T > const &value)
Definition Loot.h:286
WorldPackets::Item::ItemInstance Loot
Definition LootPackets.h:50