1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITYCORE_ITEM_PACKETS_COMMON_H
#define TRINITYCORE_ITEM_PACKETS_COMMON_H
#include "ItemDefines.h"
#include "PacketUtilities.h"
#include "Optional.h"
#include <vector>
class ByteBuffer;
class Item;
struct LootItem;
struct VoidStorageItem;
enum class ItemContext : uint8;
namespace UF
{
struct SocketedGem;
}
namespace WorldPackets
{
namespace Item
{
struct ItemBonuses
{
ItemContext Context = ItemContext(0);
std::vector<int32> BonusListIDs;
bool operator==(ItemBonuses const& r) const;
};
struct ItemMod
{
int32 Value = 0;
ItemModifier Type = MAX_ITEM_MODIFIERS;
friend bool operator==(ItemMod const& left, ItemMod const& right) = default;
};
struct ItemModList
{
Array<ItemMod, MAX_ITEM_MODIFIERS> Values;
bool operator==(ItemModList const& r) const;
};
struct ItemInstance
{
void Initialize(::Item const* item);
void Initialize(UF::SocketedGem const* gem);
void Initialize(::LootItem const& lootItem);
uint32 ItemID = 0;
Optional<ItemBonuses> ItemBonus;
ItemModList Modifications;
bool operator==(ItemInstance const& r) const;
};
struct ItemBonusKey
{
int32 ItemID = 0;
std::vector<int32> BonusListIDs;
std::vector<ItemMod> Modifications;
bool operator==(ItemBonusKey const& right) const;
};
struct ItemEnchantData
{
ItemEnchantData(int32 id, uint32 expiration, int32 charges, uint8 slot) : ID(id), Expiration(expiration), Charges(charges), Slot(slot) { }
int32 ID = 0;
uint32 Expiration = 0;
int32 Charges = 0;
uint8 Slot = 0;
};
struct ItemGemData
{
uint8 Slot;
ItemInstance Item;
};
struct InvUpdate
{
struct InvItem
{
uint8 ContainerSlot = 0;
uint8 Slot = 0;
};
std::vector<InvItem> Items;
};
struct UiEventToast
{
int32 UiEventToastID = 0;
int32 Asset = 0;
};
ByteBuffer& operator<<(ByteBuffer& data, ItemEnchantData const& itemEnchantData);
ByteBuffer& operator<<(ByteBuffer& data, ItemGemData const& itemGemInstanceData);
ByteBuffer& operator>>(ByteBuffer& data, ItemGemData& itemGemInstanceData);
ByteBuffer& operator<<(ByteBuffer& data, ItemInstance const& itemInstance);
ByteBuffer& operator>>(ByteBuffer& data, ItemInstance& itemInstance);
ByteBuffer& operator<<(ByteBuffer& data, ItemBonusKey const& itemBonusKey);
ByteBuffer& operator>>(ByteBuffer& data, InvUpdate& invUpdate);
ByteBuffer& operator<<(ByteBuffer& data, UiEventToast const& uiEventToast);
}
}
#endif // TRINITYCORE_ITEM_PACKETS_COMMON_H
|