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 << uint32(lootItem.Quantity);
30 data << uint8(lootItem.LootItemType);
31 data << uint8(lootItem.LootListID);
32 data << lootItem.Loot; // WorldPackets::Item::ItemInstance
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
65 for (LootItemData const& item : Items)
66 _worldPacket << item;
67
68 for (LootCurrency const& currency : Currencies)
69 _worldPacket << currency;
70
71 _worldPacket << Bits<1>(Acquired);
72 _worldPacket << Bits<1>(AELooting);
73 _worldPacket << Bits<1>(SuppressError);
75
76 return &_worldPacket;
77}
78
80{
81 _worldPacket >> Size<uint32>(Loot);
82
83 for (LootRequest& lootRequest : Loot)
84 {
85 _worldPacket >> lootRequest.Object;
86 _worldPacket >> lootRequest.LootListID;
87 }
88
89 _worldPacket >> Bits<1>(IsSoftInteract);
90}
91
93{
94 _worldPacket >> Size<uint32>(Loot);
96
97 for (LootRequest& lootRequest : Loot)
98 {
99 _worldPacket >> lootRequest.Object;
100 _worldPacket >> lootRequest.LootListID;
101 }
102}
103
105{
109
110 return &_worldPacket;
111}
112
114{
116}
117
119{
120 _worldPacket >> Bits<1>(IsSoftInteract);
121}
122
124{
127 _worldPacket << Bits<1>(SoleLooter);
129
130 return &_worldPacket;
131}
132
134{
136
137 return &_worldPacket;
138}
139
146
154
173
178
192
194{
201 _worldPacket << Bits<1>(Autopassed);
202 _worldPacket << Bits<1>(OffSpec);
204
205 return &_worldPacket;
206}
207
209{
216 _worldPacket << Bits<1>(MainSpec);
218
219 return &_worldPacket;
220}
221
230
239
241{
243 _worldPacket << Size<uint32>(Players);
244 for (ObjectGuid const& player : Players)
245 _worldPacket << player;
246
247 return &_worldPacket;
248}
249
251{
253
254 return &_worldPacket;
255}
256}
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:131
void FlushBits()
Definition ByteBuffer.h:142
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