Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Item.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SKYFIRESERVER_ITEM_H
7#define SKYFIRESERVER_ITEM_H
8
9#include "Common.h"
10#include "DatabaseEnv.h"
11#include "ItemPrototype.h"
12#include "LootMgr.h"
13#include "Object.h"
14
15class SpellInfo;
16class Bag;
17class Unit;
18
25
27{
29 EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, // You must reach level %d to use that item.
30 EQUIP_ERR_CANT_EQUIP_SKILL = 2, // You aren't skilled enough to use that item.
31 EQUIP_ERR_WRONG_SLOT = 3, // That item does not go in that slot.
32 EQUIP_ERR_BAG_FULL = 4, // That bag is full.
33 EQUIP_ERR_BAG_IN_BAG = 5, // Can't put non-empty bags in other bags.
34 EQUIP_ERR_TRADE_EQUIPPED_BAG = 6, // You can't trade equipped bags.
35 EQUIP_ERR_AMMO_ONLY = 7, // Only ammo can go there.
36 EQUIP_ERR_PROFICIENCY_NEEDED = 8, // You do not have the required proficiency for that item.
37 EQUIP_ERR_NO_SLOT_AVAILABLE = 9, // No equipment slot is available for that item.
38 EQUIP_ERR_CANT_EQUIP_EVER = 10, // You can never use that item.
39 EQUIP_ERR_CANT_EQUIP_EVER_2 = 11, // You can never use that item.
40 EQUIP_ERR_NO_SLOT_AVAILABLE_2 = 12, // No equipment slot is available for that item.
41 EQUIP_ERR_2HANDED_EQUIPPED = 13, // Cannot equip that with a two-handed weapon.
42 EQUIP_ERR_2HSKILLNOTFOUND = 14, // You cannot dual-wield
43 EQUIP_ERR_WRONG_BAG_TYPE = 15, // That item doesn't go in that container.
44 EQUIP_ERR_WRONG_BAG_TYPE_2 = 16, // That item doesn't go in that container.
45 EQUIP_ERR_ITEM_MAX_COUNT = 17, // You can't carry any more of those items.
46 EQUIP_ERR_NO_SLOT_AVAILABLE_3 = 18, // No equipment slot is available for that item.
47 EQUIP_ERR_CANT_STACK = 19, // This item cannot stack.
48 EQUIP_ERR_NOT_EQUIPPABLE = 20, // This item cannot be equipped.
49 EQUIP_ERR_CANT_SWAP = 21, // These items can't be swapped.
50 EQUIP_ERR_SLOT_EMPTY = 22, // That slot is empty.
51 EQUIP_ERR_ITEM_NOT_FOUND = 23, // The item was not found.
52 EQUIP_ERR_DROP_BOUND_ITEM = 24, // You can't drop a soulbound item.
53 EQUIP_ERR_OUT_OF_RANGE = 25, // Out of range.
54 EQUIP_ERR_TOO_FEW_TO_SPLIT = 26, // Tried to split more than number in stack.
55 EQUIP_ERR_SPLIT_FAILED = 27, // Couldn't split those items.
57 EQUIP_ERR_NOT_ENOUGH_MONEY = 29, // You don't have enough money.
58 EQUIP_ERR_NOT_A_BAG = 30, // Not a bag.
59 EQUIP_ERR_DESTROY_NONEMPTY_BAG = 31, // You can only do that with empty bags.
60 EQUIP_ERR_NOT_OWNER = 32, // You don't own that item.
61 EQUIP_ERR_ONLY_ONE_QUIVER = 33, // You can only equip one quiver.
62 EQUIP_ERR_NO_BANK_SLOT = 34, // You must purchase that bag slot first
63 EQUIP_ERR_NO_BANK_HERE = 35, // You are too far away from a bank.
64 EQUIP_ERR_ITEM_LOCKED = 36, // Item is locked.
65 EQUIP_ERR_GENERIC_STUNNED = 37, // You are stunned
66 EQUIP_ERR_PLAYER_DEAD = 38, // You can't do that when you're dead.
67 EQUIP_ERR_CLIENT_LOCKED_OUT = 39, // You can't do that right now.
68 EQUIP_ERR_INTERNAL_BAG_ERROR = 40, // Internal Bag Error
69 EQUIP_ERR_ONLY_ONE_BOLT = 41, // You can only equip one quiver.
70 EQUIP_ERR_ONLY_ONE_AMMO = 42, // You can only equip one ammo pouch.
71 EQUIP_ERR_CANT_WRAP_STACKABLE = 43, // Stackable items can't be wrapped.
72 EQUIP_ERR_CANT_WRAP_EQUIPPED = 44, // Equipped items can't be wrapped.
73 EQUIP_ERR_CANT_WRAP_WRAPPED = 45, // Wrapped items can't be wrapped.
74 EQUIP_ERR_CANT_WRAP_BOUND = 46, // Bound items can't be wrapped.
75 EQUIP_ERR_CANT_WRAP_UNIQUE = 47, // Unique items can't be wrapped.
76 EQUIP_ERR_CANT_WRAP_BAGS = 48, // Bags can't be wrapped.
77 EQUIP_ERR_LOOT_GONE = 49, // Already looted
78 EQUIP_ERR_INV_FULL = 50, // Inventory is full.
79 EQUIP_ERR_BANK_FULL = 51, // Your bank is full
80 EQUIP_ERR_VENDOR_SOLD_OUT = 52, // That item is currently sold out.
81 EQUIP_ERR_BAG_FULL_2 = 53, // That bag is full.
82 EQUIP_ERR_ITEM_NOT_FOUND_2 = 54, // The item was not found.
83 EQUIP_ERR_CANT_STACK_2 = 55, // This item cannot stack.
84 EQUIP_ERR_BAG_FULL_3 = 56, // That bag is full.
85 EQUIP_ERR_VENDOR_SOLD_OUT_2 = 57, // That item is currently sold out.
86 EQUIP_ERR_OBJECT_IS_BUSY = 58, // That object is busy.
88 EQUIP_ERR_NOT_IN_COMBAT = 60, // You can't do that while in combat
89 EQUIP_ERR_NOT_WHILE_DISARMED = 61, // You can't do that while disarmed
90 EQUIP_ERR_BAG_FULL_4 = 62, // That bag is full.
91 EQUIP_ERR_CANT_EQUIP_RANK = 63, // You don't have the required rank for that item
92 EQUIP_ERR_CANT_EQUIP_REPUTATION = 64, // You don't have the required reputation for that item
93 EQUIP_ERR_TOO_MANY_SPECIAL_BAGS = 65, // You cannot equip another bag of that type
94 EQUIP_ERR_LOOT_CANT_LOOT_THAT_NOW = 66, // You can't loot that item now.
95 EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE = 67, // You cannot equip more than one of those.
96 EQUIP_ERR_VENDOR_MISSING_TURNINS = 68, // You do not have the required items for that purchase
97 EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS = 69, // You don't have enough honor points
98 EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS = 70, // You don't have enough arena points
99 EQUIP_ERR_ITEM_MAX_COUNT_SOCKETED = 71, // You have the maximum number of those gems in your inventory or socketed into items.
100 EQUIP_ERR_MAIL_BOUND_ITEM = 72, // You can't mail soulbound items.
101 EQUIP_ERR_INTERNAL_BAG_ERROR_2 = 73, // Internal Bag Error
102 EQUIP_ERR_BAG_FULL_5 = 74, // That bag is full.
103 EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED = 75, // You have the maximum number of those gems socketed into equipped items.
104 EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED = 76, // You cannot socket more than one of those gems into a single item.
105 EQUIP_ERR_TOO_MUCH_GOLD = 77, // At gold limit
106 EQUIP_ERR_NOT_DURING_ARENA_MATCH = 78, // You can't do that while in an arena match
107 EQUIP_ERR_TRADE_BOUND_ITEM = 79, // You can't trade a soulbound item.
108 EQUIP_ERR_CANT_EQUIP_RATING = 80, // You don't have the personal, team, or battleground rating required to buy that item
110 EQUIP_ERR_NOT_SAME_ACCOUNT = 82, // Account-bound items can only be given to your own characters.
112 EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED_IS = 85, // You can only equip %d |4item:items in the %s category
113 EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_EXCEEDED = 86, // Your level is too high to use that item
114 EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW = 87, // You must reach level %d to purchase that item.
115 EQUIP_ERR_CANT_EQUIP_NEED_TALENT = 88, // You do not have the required talent to equip that.
116 EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS = 89, // You can only equip %d |4item:items in the %s category
117 EQUIP_ERR_SHAPESHIFT_FORM_CANNOT_EQUIP = 90, // Cannot equip item in this form
118 EQUIP_ERR_ITEM_INVENTORY_FULL_SATCHEL = 91, // Your inventory is full. Your satchel has been delivered to your mailbox.
119 EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_TOO_LOW = 92, // Your level is too low to use that item
120 EQUIP_ERR_CANT_BUY_QUANTITY = 93, // You can't buy the specified quantity of that item.
121 EQUIP_ERR_ITEM_STILL_WAITING_TO_BE_UNLOCKED = 94, // Your purchased item is still waiting to be unlocked.
122};
123
124enum class BuyResult
125{
126 BUY_ERR_CANT_FIND_ITEM = 0, // The item was not found.
127 BUY_ERR_ITEM_ALREADY_SOLD = 1, // That item is currently sold out.
128 BUY_ERR_NOT_ENOUGHT_MONEY = 2, // You don't have enough money.
129 BUY_ERR_SELLER_DONT_LIKE_YOU = 4, // That merchant dosn't like u.
130 BUY_ERR_DISTANCE_TOO_FAR = 5, // You are too far away.
131 BUY_ERR_ITEM_SOLD_OUT = 7, // That item is currently sold out.
132 BUY_ERR_CANT_CARRY_MORE = 8, // You can't carry any more of thouse items.
133 BUY_ERR_RANK_REQUIRE = 11, // You don't have the required rank for that item
134 BUY_ERR_REPUTATION_REQUIRE = 12 // You don't have the required reputation for that item
135};
136
137enum class SellResult
138{
140 SELL_ERR_CANT_SELL_ITEM = 2, // merchant doesn't like that item
141 SELL_ERR_CANT_FIND_VENDOR = 3, // merchant doesn't like you
142 SELL_ERR_YOU_DONT_OWN_THAT_ITEM = 4, // you don't own that item
143 SELL_ERR_UNK = 5, // nothing appears...
144 SELL_ERR_ONLY_EMPTY_BAG = 6 // can only do with empty bags
145};
146
147// -1 from client enchantment slot number
149{
156 PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment
157 //TODO: 7,
159
160 PROP_ENCHANTMENT_SLOT_0 = 8, // used with RandomSuffix
161 PROP_ENCHANTMENT_SLOT_1 = 9, // used with RandomSuffix
162 PROP_ENCHANTMENT_SLOT_2 = 10, // used with RandomSuffix and RandomProperty
163 PROP_ENCHANTMENT_SLOT_3 = 11, // used with RandomProperty
164 PROP_ENCHANTMENT_SLOT_4 = 12, // used with RandomProperty
166};
167
168#define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment)
169
170#define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected
171
173{
176 ENCHANTMENT_CHARGES_OFFSET = 2 // now here not only charges, but something new in wotlk
177};
178
179#define MAX_ENCHANTMENT_OFFSET 3
180
188
196
197#define MAX_ITEM_SPELLS 5
198
199bool ItemCanGoIntoBag(ItemTemplate const* proto, ItemTemplate const* pBagProto);
200
201class Item : public Object
202{
203public:
204 static Item* CreateItem(uint32 itemEntry, uint32 count, Player const* player = NULL);
205 Item* CloneItem(uint32 count, Player const* player = NULL) const;
206
207 Item();
208
209 virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
210
211 ItemTemplate const* GetTemplate() const;
212
215 Player* GetOwner()const;
216
219 bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
220 bool IsBindedNotWith(Player const* player) const;
221 bool IsBoundByEnchant() const;
222 virtual void SaveToDB(SQLTransaction& trans);
223 virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry);
224 static void DeleteFromDB(SQLTransaction& trans, uint32 itemGuid);
225 virtual void DeleteFromDB(SQLTransaction& trans);
226 static void DeleteFromInventoryDB(SQLTransaction& trans, uint32 itemGuid);
227
228 // Lootable items and their contents
235
237 void SaveRefundDataToDB();
239
240 Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return NULL; }
241 const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
242
244 bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
245 bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
246 bool IsNotEmptyBag() const;
248 bool CanBeTraded(bool mail = false, bool trade = false) const;
249 void SetInTrade(bool b = true) { mb_in_trade = b; }
250 bool IsInTrade() const { return mb_in_trade; }
251
252 bool HasEnchantRequiredSkill(const Player* player) const;
253
254 bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
255 bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
256 bool GemsFitSockets() const;
257
261 uint8 GetGemCountWithID(uint32 GemID) const;
262 uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
264
265 uint8 GetSlot() const { return m_slot; }
267 uint8 GetBagSlot() const;
268 void SetSlot(uint8 slot) { m_slot = slot; }
269 uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
270 void SetContainer(Bag* container) { m_container = container; }
271
272 bool IsInBag() const { return m_container != NULL; }
273 bool IsEquipped() const;
274
276
277 // RandomPropertyId (signed but stored as unsigned)
280 void SetItemRandomProperties(int32 randomPropId);
283 void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster = 0);
284 void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
285 void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
290
291 std::string const& GetText() const { return m_text; }
292 void SetText(std::string const& text) { m_text = text; }
293
294 void SendTimeUpdate(Player* owner);
295 void UpdateDuration(Player* owner, uint32 diff);
296
297 // spell charges (signed but stored as unsigned)
298 int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
299 void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index, value); }
300
303
304 // Update States
305 ItemUpdateState GetState() const { return uState; }
306 void SetState(ItemUpdateState state, Player* forplayer = NULL);
307 void AddToUpdateQueueOf(Player* player);
308 void RemoveFromUpdateQueueOf(Player* player);
309 bool IsInUpdateQueue() const { return uQueuePos != -1; }
310 uint16 GetQueuePos() const { return uQueuePos; }
311 void FSetState(ItemUpdateState state) // forced
312 {
313 uState = state;
314 }
315
316 bool hasQuest(uint32 quest_id) const { return GetTemplate()->StartQuest == quest_id; }
317 bool hasInvolvedQuest(uint32 /*quest_id*/) const { return false; }
318 bool HasStats() const;
319 bool IsPotion() const { return GetTemplate()->IsPotion(); }
320 bool IsVellum() const { return GetTemplate()->IsVellum(); }
322 bool IsRangedWeapon() const { return GetTemplate()->IsRangedWeapon(); }
323
324 // Item Refund system
325 void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = NULL);
326 void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; }
327 void SetPaidMoney(uint32 money) { m_paidMoney = money; }
329
331 uint32 GetPaidMoney() const { return m_paidMoney; }
333
334 void UpdatePlayedTime(Player* owner);
336 bool IsRefundExpired();
337
338 // Soulbound trade system
339 void SetSoulboundTradeable(AllowedLooterSet const& allowedLooters);
340 void ClearSoulboundTradeable(Player* currentOwner);
342
344
345 uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
346
347 bool CanBeTransmogrified() const;
348 bool CanTransmogrify() const;
349 static bool CanTransmogrifyItemWithItem(Item const* transmogrified, Item const* transmogrifier);
350 static uint32 GetSpecialPrice(ItemTemplate const* proto, uint32 minimumPrice = 10000);
351 uint32 GetSpecialPrice(uint32 minimumPrice = 10000) const { return Item::GetSpecialPrice(GetTemplate(), minimumPrice); }
352
354 {
355 if (uint32 transmogrification = GetDynamicUInt32Value(ITEM_DYNAMIC_MODIFIERS, 1))
356 return transmogrification;
357 return GetEntry();
358 }
359
360 static uint32 GetSellPrice(ItemTemplate const* proto, bool& success);
361
362 int32 GetReforgableStat(ItemModType statType) const;
363
364private:
365 std::string m_text;
370 bool mb_in_trade; // true if item is currently in trade-window
376};
377#endif
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
std::int16_t int16
Definition Define.h:74
BuyResult
Definition Item.h:125
@ BUY_ERR_CANT_CARRY_MORE
Definition Item.h:132
@ BUY_ERR_ITEM_ALREADY_SOLD
Definition Item.h:127
@ BUY_ERR_ITEM_SOLD_OUT
Definition Item.h:131
@ BUY_ERR_SELLER_DONT_LIKE_YOU
Definition Item.h:129
@ BUY_ERR_NOT_ENOUGHT_MONEY
Definition Item.h:128
@ BUY_ERR_CANT_FIND_ITEM
Definition Item.h:126
@ BUY_ERR_RANK_REQUIRE
Definition Item.h:133
@ BUY_ERR_REPUTATION_REQUIRE
Definition Item.h:134
@ BUY_ERR_DISTANCE_TOO_FAR
Definition Item.h:130
#define MAX_ENCHANTMENT_OFFSET
Definition Item.h:179
EnchantmentSlot
Definition Item.h:149
@ PERM_ENCHANTMENT_SLOT
Definition Item.h:150
@ SOCK_ENCHANTMENT_SLOT_3
Definition Item.h:154
@ PROP_ENCHANTMENT_SLOT_0
Definition Item.h:160
@ MAX_ENCHANTMENT_SLOT
Definition Item.h:165
@ PROP_ENCHANTMENT_SLOT_2
Definition Item.h:162
@ TEMP_ENCHANTMENT_SLOT
Definition Item.h:151
@ SOCK_ENCHANTMENT_SLOT_2
Definition Item.h:153
@ PRISMATIC_ENCHANTMENT_SLOT
Definition Item.h:156
@ PROP_ENCHANTMENT_SLOT_1
Definition Item.h:161
@ SOCK_ENCHANTMENT_SLOT
Definition Item.h:152
@ BONUS_ENCHANTMENT_SLOT
Definition Item.h:155
@ MAX_INSPECTED_ENCHANTMENT_SLOT
Definition Item.h:158
@ PROP_ENCHANTMENT_SLOT_4
Definition Item.h:164
@ PROP_ENCHANTMENT_SLOT_3
Definition Item.h:163
EnchantmentSlotMask
Definition Item.h:182
@ ENCHANTMENT_UNK1
Definition Item.h:184
@ ENCHANTMENT_UNK2
Definition Item.h:185
@ ENCHANTMENT_CAN_SOULBOUND
Definition Item.h:183
@ ENCHANTMENT_UNK3
Definition Item.h:186
InventoryResult
Definition Item.h:27
@ EQUIP_ERR_BAG_FULL
Definition Item.h:32
@ EQUIP_ERR_CANT_EQUIP_RANK
Definition Item.h:91
@ EQUIP_ERR_TOO_MUCH_GOLD
Definition Item.h:105
@ EQUIP_ERR_CANT_STACK_2
Definition Item.h:83
@ EQUIP_ERR_CANT_EQUIP_EVER
Definition Item.h:38
@ EQUIP_ERR_BAG_FULL_4
Definition Item.h:90
@ EQUIP_ERR_NOT_A_BAG
Definition Item.h:58
@ EQUIP_ERR_SLOT_EMPTY
Definition Item.h:50
@ EQUIP_ERR_NO_SLOT_AVAILABLE
Definition Item.h:37
@ EQUIP_ERR_NO_BANK_HERE
Definition Item.h:63
@ EQUIP_ERR_CANT_EQUIP_EVER_2
Definition Item.h:39
@ EQUIP_ERR_CANT_EQUIP_RATING
Definition Item.h:108
@ EQUIP_ERR_VENDOR_SOLD_OUT
Definition Item.h:80
@ EQUIP_ERR_MAIL_BOUND_ITEM
Definition Item.h:100
@ EQUIP_ERR_CANT_BUY_QUANTITY
Definition Item.h:120
@ EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_TOO_LOW
Definition Item.h:119
@ EQUIP_ERR_ONLY_ONE_QUIVER
Definition Item.h:61
@ EQUIP_ERR_ITEM_INVENTORY_FULL_SATCHEL
Definition Item.h:118
@ EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED
Definition Item.h:103
@ EQUIP_ERR_DESTROY_NONEMPTY_BAG
Definition Item.h:59
@ EQUIP_ERR_SPLIT_FAILED
Definition Item.h:55
@ EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS
Definition Item.h:97
@ EQUIP_ERR_CANT_WRAP_BAGS
Definition Item.h:76
@ EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE
Definition Item.h:95
@ EQUIP_ERR_ITEM_MAX_COUNT_SOCKETED
Definition Item.h:99
@ EQUIP_ERR_NOT_DURING_ARENA_MATCH
Definition Item.h:106
@ EQUIP_ERR_BAG_FULL_2
Definition Item.h:81
@ EQUIP_ERR_OUT_OF_RANGE
Definition Item.h:53
@ EQUIP_ERR_NO_OUTPUT
Definition Item.h:109
@ EQUIP_ERR_PLAYER_DEAD
Definition Item.h:66
@ EQUIP_ERR_BAG_FULL_3
Definition Item.h:84
@ EQUIP_ERR_SHAPESHIFT_FORM_CANNOT_EQUIP
Definition Item.h:117
@ EQUIP_ERR_BAG_IN_BAG
Definition Item.h:33
@ EQUIP_ERR_CLIENT_LOCKED_OUT
Definition Item.h:67
@ EQUIP_ERR_CANT_BE_DISENCHANTED
Definition Item.h:87
@ EQUIP_ERR_BANK_FULL
Definition Item.h:79
@ EQUIP_ERR_AMMO_ONLY
Definition Item.h:35
@ EQUIP_ERR_NOT_IN_COMBAT
Definition Item.h:88
@ EQUIP_ERR_ITEM_LOCKED
Definition Item.h:64
@ EQUIP_ERR_OBJECT_IS_BUSY
Definition Item.h:86
@ EQUIP_ERR_NO_SLOT_AVAILABLE_3
Definition Item.h:46
@ EQUIP_ERR_ITEM_NOT_FOUND_2
Definition Item.h:82
@ EQUIP_ERR_BAG_FULL_5
Definition Item.h:102
@ EQUIP_ERR_CANT_EQUIP_LEVEL_I
Definition Item.h:29
@ EQUIP_ERR_GENERIC_STUNNED
Definition Item.h:65
@ EQUIP_ERR_WRONG_SLOT
Definition Item.h:31
@ EQUIP_ERR_WRONG_BAG_TYPE
Definition Item.h:43
@ EQUIP_ERR_PROFICIENCY_NEEDED
Definition Item.h:36
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS
Definition Item.h:111
@ EQUIP_ERR_CANT_EQUIP_NEED_TALENT
Definition Item.h:115
@ EQUIP_ERR_ONLY_ONE_BOLT
Definition Item.h:69
@ EQUIP_ERR_NO_BANK_SLOT
Definition Item.h:62
@ EQUIP_ERR_DROP_BOUND_ITEM
Definition Item.h:52
@ EQUIP_ERR_NOT_WHILE_DISARMED
Definition Item.h:89
@ EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW
Definition Item.h:114
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition Item.h:51
@ EQUIP_ERR_ITEM_STILL_WAITING_TO_BE_UNLOCKED
Definition Item.h:121
@ EQUIP_ERR_CANT_EQUIP_REPUTATION
Definition Item.h:92
@ EQUIP_ERR_CANT_WRAP_BOUND
Definition Item.h:74
@ EQUIP_ERR_OK
Definition Item.h:28
@ EQUIP_ERR_LOOT_GONE
Definition Item.h:77
@ EQUIP_ERR_CANT_SWAP
Definition Item.h:49
@ EQUIP_ERR_NOT_OWNER
Definition Item.h:60
@ EQUIP_ERR_NOT_SAME_ACCOUNT
Definition Item.h:110
@ EQUIP_ERR_CANT_EQUIP_SKILL
Definition Item.h:30
@ EQUIP_ERR_WRONG_BAG_TYPE_2
Definition Item.h:44
@ EQUIP_ERR_CANT_STACK
Definition Item.h:47
@ EQUIP_ERR_2HANDED_EQUIPPED
Definition Item.h:41
@ EQUIP_ERR_NOT_ENOUGH_MONEY
Definition Item.h:57
@ EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED
Definition Item.h:104
@ EQUIP_ERR_INV_FULL
Definition Item.h:78
@ EQUIP_ERR_INTERNAL_BAG_ERROR
Definition Item.h:68
@ EQUIP_ERR_CANT_WRAP_EQUIPPED
Definition Item.h:72
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS
Definition Item.h:116
@ EQUIP_ERR_INTERNAL_BAG_ERROR_2
Definition Item.h:101
@ EQUIP_ERR_TRADE_EQUIPPED_BAG
Definition Item.h:34
@ EQUIP_ERR_NOT_EQUIPPABLE
Definition Item.h:48
@ EQUIP_ERR_VENDOR_MISSING_TURNINS
Definition Item.h:96
@ EQUIP_ERR_2HSKILLNOTFOUND
Definition Item.h:42
@ EQUIP_ERR_LOOT_CANT_LOOT_THAT_NOW
Definition Item.h:94
@ EQUIP_ERR_CANT_WRAP_STACKABLE
Definition Item.h:71
@ EQUIP_ERR_TRADE_BOUND_ITEM
Definition Item.h:107
@ EQUIP_ERR_ONLY_ONE_AMMO
Definition Item.h:70
@ EQUIP_ERR_SPELL_FAILED_REAGENTS_GENERIC
Definition Item.h:56
@ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED_IS
Definition Item.h:112
@ EQUIP_ERR_TOO_MANY_SPECIAL_BAGS
Definition Item.h:93
@ EQUIP_ERR_ITEM_MAX_COUNT
Definition Item.h:45
@ EQUIP_ERR_NO_SLOT_AVAILABLE_2
Definition Item.h:40
@ EQUIP_ERR_CANT_WRAP_WRAPPED
Definition Item.h:73
@ EQUIP_ERR_VENDOR_SOLD_OUT_2
Definition Item.h:85
@ EQUIP_ERR_CANT_WRAP_UNIQUE
Definition Item.h:75
@ EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_EXCEEDED
Definition Item.h:113
@ EQUIP_ERR_TOO_FEW_TO_SPLIT
Definition Item.h:54
@ EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS
Definition Item.h:98
ItemUpdateState
Definition Item.h:190
@ ITEM_CHANGED
Definition Item.h:192
@ ITEM_REMOVED
Definition Item.h:194
@ ITEM_NEW
Definition Item.h:193
@ ITEM_UNCHANGED
Definition Item.h:191
SellResult
Definition Item.h:138
@ SELL_ERR_ONLY_EMPTY_BAG
Definition Item.h:144
@ SELL_ERR_CANT_FIND_ITEM
Definition Item.h:139
@ SELL_ERR_CANT_SELL_ITEM
Definition Item.h:140
@ SELL_ERR_YOU_DONT_OWN_THAT_ITEM
Definition Item.h:142
@ SELL_ERR_CANT_FIND_VENDOR
Definition Item.h:141
@ SELL_ERR_UNK
Definition Item.h:143
EnchantmentOffset
Definition Item.h:173
@ ENCHANTMENT_ID_OFFSET
Definition Item.h:174
@ ENCHANTMENT_CHARGES_OFFSET
Definition Item.h:176
@ ENCHANTMENT_DURATION_OFFSET
Definition Item.h:175
bool ItemCanGoIntoBag(ItemTemplate const *proto, ItemTemplate const *pBagProto)
Definition Item.cpp:160
@ INVTYPE_BAG
@ ITEM_PROTO_FLAG_BIND_TO_ACCOUNT
ItemModType
@ ITEM_FLAG_UNLOCKED
@ ITEM_FLAG_SOULBOUND
std::set< uint32 > AllowedLooterSet
Definition LootMgr.h:116
UNORDERED_MAP< Player *, UpdateData > UpdateDataMapType
Definition Object.h:107
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
Definition Transaction.h:42
@ ITEM_FIELD_DURABILITY
@ ITEM_FIELD_STACK_COUNT
@ ITEM_FIELD_ENCHANTMENT
@ ITEM_FIELD_MAX_DURABILITY
@ ITEM_FIELD_RANDOM_PROPERTIES_ID
@ ITEM_FIELD_OWNER
@ ITEM_FIELD_PROPERTY_SEED
@ ITEM_FIELD_DYNAMIC_FLAGS
@ ITEM_FIELD_SPELL_CHARGES
@ ITEM_DYNAMIC_MODIFIERS
Definition Bag.h:16
Definition Field.h:16
Definition Item.h:202
uint32 GetPlayedTime()
Definition Item.cpp:1157
uint32 GetPaidExtendedCost() const
Definition Item.h:332
void BuildUpdate(UpdateDataMapType &)
Definition Item.cpp:1076
uint8 GetSlot() const
Definition Item.h:265
std::string const & GetText() const
Definition Item.h:291
int32 GetReforgableStat(ItemModType statType) const
Definition Item.cpp:1459
bool IsCurrencyToken() const
Definition Item.h:245
uint32 GetScriptId() const
Definition Item.h:345
void UpdateItemSuffixFactor()
Definition Item.cpp:659
Bag * GetContainer()
Definition Item.h:266
void SetNotRefundable(Player *owner, bool changestate=true, SQLTransaction *trans=NULL)
Definition Item.cpp:1111
void SetSpellCharges(uint8 index, int32 value)
Definition Item.h:299
void SetText(std::string const &text)
Definition Item.h:292
void UpdateDuration(Player *owner, uint32 diff)
Definition Item.cpp:287
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster=0)
Definition Item.cpp:856
bool HasEnchantRequiredSkill(const Player *player) const
Definition Item.cpp:769
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
Definition Item.cpp:986
Item()
Definition Item.cpp:233
void SetBinding(bool val)
Definition Item.h:217
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition Item.cpp:667
void AddToUpdateQueueOf(Player *player)
Definition Item.cpp:694
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:287
void ItemContainerSaveLootToDB()
Definition Item.cpp:1502
int32 GetSpellCharges(uint8 index=0) const
Definition Item.h:298
void SetOwnerGUID(uint64 guid)
Definition Item.h:214
bool IsVellum() const
Definition Item.h:320
void RemoveFromUpdateQueueOf(Player *player)
Definition Item.cpp:714
Bag * m_container
Definition Item.h:367
void SetSoulboundTradeable(AllowedLooterSet const &allowedLooters)
Definition Item.cpp:1169
void SetItemRandomProperties(int32 randomPropId)
Definition Item.cpp:621
void SetPaidMoney(uint32 money)
Definition Item.h:327
uint8 GetGemCountWithID(uint32 GemID) const
Definition Item.cpp:944
bool IsBoundAccountWide() const
Definition Item.h:219
bool mb_in_trade
Definition Item.h:370
Bag * ToBag()
Definition Item.h:240
std::string m_text
Definition Item.h:365
Item * CloneItem(uint32 count, Player const *player=NULL) const
Definition Item.cpp:1039
bool HasStats() const
Definition Item.cpp:1289
bool CanBeTraded(bool mail=false, bool trade=false) const
Definition Item.cpp:744
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition Item.h:288
void ItemContainerDeleteLootMoneyAndLootItemsFromDB()
Definition Item.cpp:1673
virtual void SaveToDB(SQLTransaction &trans)
Definition Item.cpp:305
void SetCount(uint32 value)
Definition Item.h:259
bool IsLocked() const
Definition Item.h:243
int32 GetItemRandomPropertyId() const
Definition Item.h:278
ItemTemplate const * GetTemplate() const
Definition Item.cpp:528
uint32 GetVisibleEntry() const
Definition Item.h:353
bool IsInBag() const
Definition Item.h:272
bool IsSoulBound() const
Definition Item.h:218
void SaveRefundDataToDB()
Definition Item.cpp:1083
void SetRefundRecipient(uint32 pGuidLow)
Definition Item.h:326
ItemUpdateState GetState() const
Definition Item.h:305
bool IsPotion() const
Definition Item.h:319
bool IsBroken() const
Definition Item.h:247
uint32 GetItemSuffixFactor() const
Definition Item.h:279
bool IsBindedNotWith(Player const *player) const
Definition Item.cpp:1055
uint32 m_paidMoney
Definition Item.h:373
static uint32 GetSpecialPrice(ItemTemplate const *proto, uint32 minimumPrice=10000)
Definition Item.cpp:1425
uint16 GetQueuePos() const
Definition Item.h:310
bool CanBeTransmogrified() const
Definition Item.cpp:1200
bool IsEquipped() const
Definition Item.cpp:739
void SendTimeUpdate(Player *owner)
Definition Item.cpp:995
bool IsRefundExpired()
Definition Item.cpp:1164
void UpdatePlayedTime(Player *owner)
Definition Item.cpp:1129
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, Field *fields, uint32 entry)
Definition Item.cpp:405
static bool CanTransmogrifyItemWithItem(Item const *transmogrified, Item const *transmogrifier)
Definition Item.cpp:1255
Player * GetOwner() const
Definition Item.cpp:533
uint32 GetSpecialPrice(uint32 minimumPrice=10000) const
Definition Item.h:351
time_t m_lastPlayedTimeUpdate
Definition Item.h:371
uint32 GetSkill()
Definition Item.cpp:538
static Item * CreateItem(uint32 itemEntry, uint32 count, Player const *player=NULL)
Definition Item.cpp:1012
bool hasQuest(uint32 quest_id) const
Definition Item.h:316
static uint32 GetSellPrice(ItemTemplate const *proto, bool &success)
Definition Item.cpp:1306
uint16 GetPos() const
Definition Item.h:269
bool hasInvolvedQuest(uint32) const
Definition Item.h:317
bool GemsFitSockets() const
Definition Item.cpp:907
bool ItemContainerLoadLootFromDB()
Definition Item.cpp:1562
bool IsInTrade() const
Definition Item.h:250
bool IsBoundByEnchant() const
Definition Item.cpp:786
void DeleteRefundDataFromDB(SQLTransaction *trans)
Definition Item.cpp:1101
bool IsRangedWeapon() const
Definition Item.h:322
int16 uQueuePos
Definition Item.h:369
void FSetState(ItemUpdateState state)
Definition Item.h:311
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
Definition Item.cpp:888
const Bag * ToBag() const
Definition Item.h:241
uint32 m_paidExtendedCost
Definition Item.h:374
bool IsBag() const
Definition Item.h:244
void ClearEnchantment(EnchantmentSlot slot)
Definition Item.cpp:897
static void DeleteFromInventoryDB(SQLTransaction &trans, uint32 itemGuid)
Definition Item.cpp:516
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player *owner)
Definition Item.cpp:878
InventoryResult CanBeMergedPartlyWith(ItemTemplate const *proto) const
Definition Item.cpp:803
void SetPaidExtendedCost(uint32 iece)
Definition Item.h:328
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition Item.h:289
bool CanTransmogrify() const
Definition Item.cpp:1226
uint64 GetOwnerGUID() const
Definition Item.h:213
void ItemContainerDeleteLootItemFromDB(uint32 itemID)
Definition Item.cpp:1650
uint32 GetPaidMoney() const
Definition Item.h:331
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const
Definition Item.cpp:963
void ClearSoulboundTradeable(Player *currentOwner)
Definition Item.cpp:1175
void SetSlot(uint8 slot)
Definition Item.h:268
bool IsNotEmptyBag() const
Definition Item.cpp:280
bool m_lootGenerated
Definition Item.h:302
uint32 GetCount() const
Definition Item.h:258
bool CheckSoulboundTradeExpire()
Definition Item.cpp:1188
Loot loot
Definition Item.h:301
void SetContainer(Bag *container)
Definition Item.h:270
uint8 GetBagSlot() const
Definition Item.cpp:734
void ItemContainerDeleteLootMoneyFromDB()
Definition Item.cpp:1662
uint32 m_refundRecipient
Definition Item.h:372
uint32 GetRefundRecipient() const
Definition Item.h:330
static int32 GenerateItemRandomPropertyId(uint32 item_id)
Definition Item.cpp:575
uint32 GetMaxStackCount() const
Definition Item.h:260
virtual bool Create(uint32 guidlow, uint32 itemid, Player const *owner)
Definition Item.cpp:252
bool IsConjuredConsumable() const
Definition Item.h:321
uint8 m_slot
Definition Item.h:366
bool IsInUpdateQueue() const
Definition Item.h:309
void ItemContainerDeleteLootItemsFromDB()
Definition Item.cpp:1639
bool IsFitToSpellRequirements(SpellInfo const *spellInfo) const
Definition Item.cpp:820
ItemUpdateState uState
Definition Item.h:368
void SetInTrade(bool b=true)
Definition Item.h:249
AllowedLooterSet allowedGUIDs
Definition Item.h:375
static void DeleteFromDB(SQLTransaction &trans, uint32 itemGuid)
Definition Item.cpp:499
int32 GetInt32Value(uint16 index) const
Definition Object.cpp:319
void SetInt32Value(uint16 index, int32 value)
Definition Object.cpp:1021
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:325
Object()
Definition Object.cpp:64
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition Object.cpp:1317
uint32 GetDynamicUInt32Value(uint32 tab, uint16 index) const
Definition Object.cpp:357
uint32 GetEntry() const
Definition Object.h:125
uint64 GetUInt64Value(uint16 index) const
Definition Object.cpp:331
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:1309
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:1038
void SetUInt64Value(uint16 index, uint64 value)
Definition Object.cpp:1079
Definition Unit.h:1367
uint32 item_count
Definition Item.h:22
uint32 setid
Definition Item.h:21
SpellInfo const * spells[8]
Definition Item.h:23
bool IsVellum() const
bool IsPotion() const
uint32 GetMaxStackSize() const
bool IsRangedWeapon() const
bool IsCurrencyToken() const
bool IsConjuredConsumable() const
uint32 InventoryType