TrinityCore
ItemPacketsCommon.h
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#ifndef ItemPacketsCommon_h__
19#define ItemPacketsCommon_h__
20
21#include "ItemDefines.h"
22#include "PacketUtilities.h"
23#include "Optional.h"
24#include <vector>
25
26class ByteBuffer;
27class Item;
28struct LootItem;
29struct VoidStorageItem;
30enum class ItemContext : uint8;
31
32namespace UF
33{
34 struct SocketedGem;
35}
36
37namespace WorldPackets
38{
39 namespace Item
40 {
42 {
44 std::vector<int32> BonusListIDs;
45
46 bool operator==(ItemBonuses const& r) const;
47 };
48
49 struct ItemMod
50 {
51 ItemMod() = default;
52 ItemMod(int32 value, ItemModifier type) : Value(value), Type(type) { }
53
56
57 bool operator==(ItemMod const& r) const;
58 };
59
61 {
63
64 bool operator==(ItemModList const& r) const;
65 };
66
68 {
69 void Initialize(::Item const* item);
70 void Initialize(UF::SocketedGem const* gem);
71 void Initialize(::LootItem const& lootItem);
72 void Initialize(::VoidStorageItem const* voidItem);
73
77
78 bool operator==(ItemInstance const& r) const;
79 };
80
82 {
84 std::vector<int32> BonusListIDs;
85 std::vector<ItemMod> Modifications;
86
87 bool operator==(ItemBonusKey const& right) const;
88 };
89
91 {
92 ItemEnchantData(int32 id, uint32 expiration, int32 charges, uint8 slot) : ID(id), Expiration(expiration), Charges(charges), Slot(slot) { }
93 int32 ID = 0;
97 };
98
100 {
103 };
104
106 {
107 struct InvItem
108 {
111 };
112
113 std::vector<InvItem> Items;
114 };
115
117 {
120 };
121
122 ByteBuffer& operator<<(ByteBuffer& data, ItemEnchantData const& itemEnchantData);
123
124 ByteBuffer& operator<<(ByteBuffer& data, ItemGemData const& itemGemInstanceData);
125 ByteBuffer& operator>>(ByteBuffer& data, ItemGemData& itemGemInstanceData);
126
127 ByteBuffer& operator<<(ByteBuffer& data, ItemInstance const& itemInstance);
128 ByteBuffer& operator>>(ByteBuffer& data, ItemInstance& itemInstance);
129
130 ByteBuffer& operator<<(ByteBuffer& data, ItemBonusKey const& itemBonusKey);
131
132 ByteBuffer& operator>>(ByteBuffer& data, InvUpdate& invUpdate);
133
134 ByteBuffer& operator<<(ByteBuffer& data, UiEventToast const& uiEventToast);
135 }
136}
137
138#endif // ItemPacketsCommon_h__
ItemContext
Definition: DBCEnums.h:1063
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
ItemModifier
Definition: ItemDefines.h:210
@ MAX_ITEM_MODIFIERS
Definition: ItemDefines.h:270
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Definition: Item.h:170
Definition: Object.h:109
ByteBuffer & operator<<(ByteBuffer &data, ItemBonuses const &itemBonusInstanceData)
ByteBuffer & operator>>(ByteBuffer &data, ItemBonuses &itemBonusInstanceData)
Definition: Loot.h:176
std::vector< InvItem > Items
bool operator==(ItemBonusKey const &right) const
std::vector< ItemMod > Modifications
bool operator==(ItemBonuses const &r) const
std::vector< int32 > BonusListIDs
ItemEnchantData(int32 id, uint32 expiration, int32 charges, uint8 slot)
Optional< ItemBonuses > ItemBonus
bool operator==(ItemInstance const &r) const
void Initialize(::Item const *item)
bool operator==(ItemModList const &r) const
Array< ItemMod, MAX_ITEM_MODIFIERS > Values
bool operator==(ItemMod const &r) const
ItemMod(int32 value, ItemModifier type)