TrinityCore
Loading...
Searching...
No Matches
Item.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 TRINITYCORE_ITEM_H
19#define TRINITYCORE_ITEM_H
20
21#include "Object.h"
22#include "Common.h"
23#include "DatabaseEnvFwd.h"
24#include "ItemDefines.h"
25#include "ItemEnchantmentMgr.h"
26#include "ItemTemplate.h"
27#include "IteratorPair.h"
28
29class SpellInfo;
30class Bag;
31class Unit;
32struct Loot;
33namespace WorldPackets
34{
35 namespace Item
36 {
37 struct ItemInstance;
38 }
39}
40
42{
44 std::unordered_set<Item const*> EquippedItems;
45 std::unordered_set<ItemSetSpellEntry const*> SetBonuses;
46};
47
48#define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected
49
50#define MAX_ENCHANTMENT_OFFSET 3
51
53{
57 ITEM_REMOVED = 3
58};
59
60#define MAX_ITEM_SPELLS 5
61
62bool ItemCanGoIntoBag(ItemTemplate const* proto, ItemTemplate const* pBagProto);
67
69{
91 std::array<ItemEffectEntry const*, 13> Effects;
92 std::size_t EffectCount;
96
97 void Initialize(ItemTemplate const* proto);
98 void Initialize(WorldPackets::Item::ItemInstance const& itemInstance);
99 void AddBonusList(uint32 bonusListId);
100 void AddBonus(uint32 type, std::array<int32, 4> const& values);
101
102private:
103 struct
104 {
112};
113
115{
119};
120
122{
126 std::vector<ArtifactPowerData> ArtifactPowers;
127};
128
130{
132 std::array<uint32, MAX_AZERITE_ESSENCE_SLOT> AzeriteEssenceId = { };
133};
134
136{
140 std::vector<uint32> AzeriteItemMilestonePowers;
141 std::vector<AzeriteEssencePowerEntry const*> UnlockedAzeriteEssences;
142 std::array<AzeriteItemSelectedEssencesData, 4> SelectedAzeriteEssences = { };
143};
144
146{
147 std::array<int32, MAX_AZERITE_EMPOWERED_TIER> SelectedAzeritePowers;
148};
149
151{
152 static void Init(std::unordered_map<ObjectGuid::LowType, ItemAdditionalLoadInfo>* loadInfo, PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult,
153 PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult, PreparedQueryResult azeriteEmpoweredItemResult);
154
158};
159
161{
165};
166
167Item* NewItemOrBag(ItemTemplate const* proto);
168
169class TC_GAME_API Item : public Object
170{
171 friend void AddItemToUpdateQueueOf(Item* item, Player* player);
172 friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player);
173
174 public:
175 static Item* CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const* player = nullptr);
176 Item* CloneItem(uint32 count, Player const* player = nullptr) const;
177
178 Item();
180
181 virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const* owner);
182
183 std::string GetNameForLocaleIdx(LocaleConstant locale) const override;
184
185 ItemTemplate const* GetTemplate() const;
186 BonusData const* GetBonus() const { return &_bonusData; }
187
188 ObjectGuid GetOwnerGUID() const { return m_itemData->Owner; }
189 void SetOwnerGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Owner), guid); }
190 ObjectGuid GetContainedIn() const { return m_itemData->ContainedIn; }
191 void SetContainedIn(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ContainedIn), guid); }
192 ObjectGuid GetCreator() const { return m_itemData->Creator; }
193 void SetCreator(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Creator), guid); }
194 ObjectGuid GetGiftCreator() const { return m_itemData->GiftCreator; }
195 void SetGiftCreator(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::GiftCreator), guid); }
196 Player* GetOwner() const;
197
198 void SetExpiration(uint32 expiration) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Expiration), expiration); }
199
200 ItemBondingType GetBonding() const { return _bonusData.Bonding; }
201 void SetBinding(bool val)
202 {
203 if (val)
204 SetItemFlag(ITEM_FIELD_FLAG_SOULBOUND);
205 else
206 RemoveItemFlag(ITEM_FIELD_FLAG_SOULBOUND);
207 }
208 bool HasItemFlag(ItemFieldFlags flag) const { return (*m_itemData->DynamicFlags & flag) != 0; }
212
213 bool HasItemFlag2(ItemFieldFlags2 flag) const { return (*m_itemData->DynamicFlags2 & flag) != 0; }
217
218 bool IsSoulBound() const { return HasItemFlag(ITEM_FIELD_FLAG_SOULBOUND); }
219 bool IsBoundAccountWide() const { return GetTemplate()->HasFlag(ITEM_FLAG_IS_BOUND_TO_ACCOUNT); }
220 bool IsBattlenetAccountBound() const { return GetTemplate()->HasFlag(ITEM_FLAG2_BNET_ACCOUNT_TRADE_OK); }
221 bool IsBindedNotWith(Player const* player) const;
222 bool IsBoundByEnchant() const;
223 virtual void SaveToDB(CharacterDatabaseTransaction trans);
224 virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field* fields, uint32 entry);
225 void LoadArtifactData(Player const* owner, uint64 xp, uint32 artifactAppearanceId, uint32 artifactTier, std::vector<ArtifactPowerData>& powers); // must be called after LoadFromDB to have gems (relics) initialized
226 void CheckArtifactRelicSlotUnlock(Player const* owner);
227
228 void AddBonuses(uint32 bonusListID);
229 std::vector<int32> const& GetBonusListIDs() const { return m_itemData->ItemBonusKey->BonusListIDs; }
230 void SetBonuses(std::vector<int32> bonusListIDs);
231 void ClearBonuses();
232
233 static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid);
234 virtual void DeleteFromDB(CharacterDatabaseTransaction trans);
235 static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid);
236
237 void DeleteFromInventoryDB(CharacterDatabaseTransaction trans);
238 void SaveRefundDataToDB();
239 void DeleteRefundDataFromDB(CharacterDatabaseTransaction* trans);
240
241 Bag* ToBag() { if (IsBag()) return reinterpret_cast<Bag*>(this); else return nullptr; }
242 Bag const* ToBag() const { if (IsBag()) return reinterpret_cast<Bag const*>(this); else return nullptr; }
243 AzeriteItem* ToAzeriteItem() { return IsAzeriteItem() ? reinterpret_cast<AzeriteItem*>(this) : nullptr; }
244 AzeriteItem const* ToAzeriteItem() const { return IsAzeriteItem() ? reinterpret_cast<AzeriteItem const*>(this) : nullptr; }
245 AzeriteEmpoweredItem* ToAzeriteEmpoweredItem() { return IsAzeriteEmpoweredItem() ? reinterpret_cast<AzeriteEmpoweredItem*>(this) : nullptr; }
246 AzeriteEmpoweredItem const* ToAzeriteEmpoweredItem() const { return IsAzeriteEmpoweredItem() ? reinterpret_cast<AzeriteEmpoweredItem const*>(this) : nullptr; }
247
248 bool IsRefundable() const { return HasItemFlag(ITEM_FIELD_FLAG_REFUNDABLE); }
249 bool IsBOPTradeable() const { return HasItemFlag(ITEM_FIELD_FLAG_BOP_TRADEABLE); }
250 bool IsWrapped() const { return HasItemFlag(ITEM_FIELD_FLAG_WRAPPED); }
251 bool IsLocked() const { return !HasItemFlag(ITEM_FIELD_FLAG_UNLOCKED); }
252 bool IsBag() const { return GetTemplate()->GetInventoryType() == INVTYPE_BAG; }
253 bool IsAzeriteItem() const { return GetTypeId() == TYPEID_AZERITE_ITEM; }
255 bool IsCurrencyToken() const { return GetTemplate()->IsCurrencyToken(); }
256 bool IsNotEmptyBag() const;
257 bool IsBroken() const { return *m_itemData->MaxDurability > 0 && *m_itemData->Durability == 0; }
258 void SetDurability(uint32 durability) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Durability), durability); }
259 void SetMaxDurability(uint32 maxDurability) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::MaxDurability), maxDurability); }
260 bool CanBeTraded(bool mail = false, bool trade = false) const;
261 void SetInTrade(bool b = true) { mb_in_trade = b; }
262 bool IsInTrade() const { return mb_in_trade; }
263
264 uint64 CalculateDurabilityRepairCost(float discount) const;
265
266 bool HasEnchantRequiredSkill(Player const* player) const;
267 uint32 GetEnchantRequiredLevel() const;
268
269 bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
270 bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
271 bool GemsFitSockets() const;
272
273 uint32 GetCount() const { return m_itemData->StackCount; }
274 void SetCount(uint32 value);
275 uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
276 uint8 GetGemCountWithID(uint32 GemID) const;
277 uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
278 InventoryResult CanBeMergedPartlyWith(ItemTemplate const* proto) const;
279
280 uint8 GetSlot() const {return m_slot;}
281 Bag* GetContainer() { return m_container; }
282 uint8 GetBagSlot() const;
283 void SetSlot(uint8 slot) { m_slot = slot; }
284 uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
285 void SetContainer(Bag* container) { m_container = container; }
286
287 bool IsInBag() const { return m_container != nullptr; }
288 bool IsEquipped() const;
289
290 uint32 GetSkill();
291
292 ItemRandomBonusListId GetItemRandomBonusListId() const { return m_randomBonusListId; }
293 void SetItemRandomBonusList(ItemRandomBonusListId bonusListId);
294 void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
295 void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
296 void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
297 void ClearEnchantment(EnchantmentSlot slot);
298 uint32 GetEnchantmentId(EnchantmentSlot slot) const { return m_itemData->Enchantment[slot].ID; }
299 uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return m_itemData->Enchantment[slot].Duration; }
300 uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return m_itemData->Enchantment[slot].Charges; }
301 UF::SocketedGem const* GetGem(uint16 slot) const;
302 void SetGem(uint16 slot, ItemDynamicFieldGems const* gem, uint32 gemScalingLevel);
303
304 std::string const& GetText() const { return m_text; }
305 void SetText(std::string const& text) { m_text = text; }
306
307 void SendUpdateSockets();
308
309 void SendTimeUpdate(Player* owner);
310 void UpdateDuration(Player* owner, uint32 diff);
311 void SetCreatePlayedTime(uint32 createPlayedTime) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::CreatePlayedTime), createPlayedTime); }
312
313 // spell charges (signed but stored as unsigned)
314 int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return m_itemData->SpellCharges[index]; }
315 void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::SpellCharges, index), value); }
316
317 std::unique_ptr<Loot> m_loot;
319 Loot* GetLootForPlayer(Player const* /*player*/) const override { return m_loot.get(); }
320
321 // Update States
322 ItemUpdateState GetState() const { return uState; }
323 void SetState(ItemUpdateState state, Player* forplayer = nullptr);
324 bool IsInUpdateQueue() const { return uQueuePos != -1; }
325 uint16 GetQueuePos() const { return uQueuePos; }
326 void FSetState(ItemUpdateState state) // forced
327 {
328 uState = state;
329 }
330
331 bool hasQuest(uint32 quest_id) const override { return GetTemplate()->GetStartQuest() == quest_id; }
332 bool hasInvolvedQuest(uint32 /*quest_id*/) const override { return false; }
333 bool IsPotion() const { return GetTemplate()->IsPotion(); }
334 bool IsVellum() const { return GetTemplate()->IsVellum(); }
335 bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
336 bool IsRangedWeapon() const { return GetTemplate()->IsRangedWeapon(); }
337 uint32 GetQuality() const { return _bonusData.Quality; }
338 uint32 GetItemLevel(Player const* owner) const;
339 static uint32 GetItemLevel(ItemTemplate const* itemTemplate, BonusData const& bonusData, uint32 level, uint32 fixedLevel,
340 uint32 minItemLevel, uint32 minItemLevelCutoff, uint32 maxItemLevel, bool pvpBonus, uint32 azeriteLevel);
341 int32 GetRequiredLevel() const;
342 int32 GetItemStatType(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
343 float GetItemStatValue(uint32 index, Player const* owner) const;
344 SocketColor GetSocketColor(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return SocketColor(_bonusData.SocketColor[index]); }
345 uint32 GetAppearanceModId() const { return m_itemData->ItemAppearanceModID; }
346 void SetAppearanceModId(uint32 appearanceModId) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemAppearanceModID), appearanceModId); }
347 uint32 GetDisplayId(Player const* owner) const;
348 ItemModifiedAppearanceEntry const* GetItemModifiedAppearance() const;
349 float GetRepairCostMultiplier() const { return _bonusData.RepairCostMultiplier; }
350 uint32 GetScalingContentTuningId() const { return _bonusData.ContentTuningId; }
351 ItemDisenchantLootEntry const* GetDisenchantLoot(Player const* owner) const;
352 static ItemDisenchantLootEntry const* GetDisenchantLoot(ItemTemplate const* itemTemplate, uint32 quality, uint32 itemLevel);
353 void SetFixedLevel(uint8 level);
354 Trinity::IteratorPair<ItemEffectEntry const* const*> GetEffects() const { return { std::make_pair(&_bonusData.Effects[0], &_bonusData.Effects[0] + _bonusData.EffectCount) }; }
355
356 // Item Refund system
357 void SetNotRefundable(Player* owner, bool changestate = true, CharacterDatabaseTransaction* trans = nullptr, bool addToCollection = true);
358 void SetRefundRecipient(ObjectGuid const& guid) { m_refundRecipient = guid; }
359 void SetPaidMoney(uint64 money) { m_paidMoney = money; }
360 void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; }
361
362 ObjectGuid const& GetRefundRecipient() const { return m_refundRecipient; }
363 uint64 GetPaidMoney() const { return m_paidMoney; }
364 uint32 GetPaidExtendedCost() const { return m_paidExtendedCost; }
365
366 void UpdatePlayedTime(Player* owner);
367 uint32 GetPlayedTime();
368 bool IsRefundExpired();
369
370 // Soulbound trade system
371 void SetSoulboundTradeable(GuidSet const& allowedLooters);
372 void ClearSoulboundTradeable(Player* currentOwner);
373 bool CheckSoulboundTradeExpire();
374
375 void BuildUpdate(UpdateDataMapType&) override;
376
377 protected:
378 UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const* target) const override;
379 void BuildValuesCreate(ByteBuffer* data, Player const* target) const override;
380 void BuildValuesUpdate(ByteBuffer* data, Player const* target) const override;
381 void ClearUpdateMask(bool remove) override;
382
383 public:
384 void BuildValuesUpdateWithFlag(ByteBuffer* data, UF::UpdateFieldFlag flags, Player const* target) const override;
385 void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask,
386 UF::ItemData::Mask const& requestedItemMask, Player const* target) const;
387
388 struct ValuesUpdateForPlayerWithMaskSender // sender compatible with MessageDistDeliverer
389 {
390 explicit ValuesUpdateForPlayerWithMaskSender(Item const* owner) : Owner(owner) { }
391
392 Item const* Owner;
395
396 void operator()(Player const* player) const;
397 };
398
399 bool AddToObjectUpdate() override;
400 void RemoveFromObjectUpdate() override;
401
402 uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
403
404 bool IsValidTransmogrificationTarget() const;
405 bool HasStats() const;
406 static bool HasStats(WorldPackets::Item::ItemInstance const& itemInstance, BonusData const* bonus);
407 static bool CanTransmogrifyItemWithItem(Item const* item, ItemModifiedAppearanceEntry const* itemModifiedAppearance);
408 uint32 GetBuyPrice(Player const* owner, bool& standardPrice) const;
409 static uint32 GetBuyPrice(ItemTemplate const* proto, uint32 quality, uint32 itemLevel, bool& standardPrice);
410 uint32 GetSellPrice(Player const* owner) const;
411 static uint32 GetSellPrice(ItemTemplate const* proto, uint32 quality, uint32 itemLevel);
412
413 uint32 GetVisibleEntry(Player const* owner) const;
414 uint16 GetVisibleAppearanceModId(Player const* owner) const;
415 int32 GetVisibleSecondaryModifiedAppearanceId(Player const* owner) const;
416 uint32 GetVisibleEnchantmentId(Player const* owner) const;
417 uint16 GetVisibleItemVisual(Player const* owner) const;
418
419 uint32 GetModifier(ItemModifier modifier) const;
420 void SetModifier(ItemModifier modifier, uint32 value);
421
422 ObjectGuid GetChildItem() const { return m_childItem; }
423 void SetChildItem(ObjectGuid childItem) { m_childItem = childItem; }
424
425 bool IsArtifactDisabled() const;
426
427 UF::ArtifactPower const* GetArtifactPower(uint32 artifactPowerId) const;
428 void AddArtifactPower(ArtifactPowerData const* artifactPower);
429 void SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus);
430
431 void InitArtifactPowers(uint8 artifactId, uint8 artifactTier);
432 uint32 GetTotalUnlockedArtifactPowers() const;
433 uint32 GetTotalPurchasedArtifactPowers() const;
434 void ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enchantId, bool apply, Player* owner);
435 void CopyArtifactDataFromParent(Item* parent);
436
437 void SetArtifactXP(uint64 xp) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ArtifactXP), xp); }
438 void GiveArtifactXp(uint64 amount, Item* sourceItem, uint32 artifactCategoryId);
439
440 ItemContext GetContext() const { return ItemContext(*m_itemData->Context); }
441 void SetContext(ItemContext context) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Context), int32(context)); }
442
443 void SetPetitionId(uint32 petitionId) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, 0).ModifyValue(&UF::ItemEnchantment::ID), petitionId); }
444 void SetPetitionNumSignatures(uint32 signatures) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, 0).ModifyValue(&UF::ItemEnchantment::Duration), signatures); }
445
446 std::string GetDebugInfo() const override;
447
449
450 protected:
451 void ApplyBonusList(uint32 itemBonusListId);
453
454 private:
455 std::string m_text;
460 bool mb_in_trade; // true if item is currently in trade-window
466 ItemRandomBonusListId m_randomBonusListId; // store separately to easily find which bonus list is the one randomly given for stat rerolling
468 std::unordered_map<uint32, uint16> m_artifactPowerIdToIndex;
469 std::array<uint32, MAX_ITEM_PROTO_SOCKETS> m_gemScalingLevels;
470};
471#endif
LocaleConstant
Definition: Common.h:64
#define MAX_ITEM_PROTO_SOCKETS
Definition: DBCEnums.h:848
ItemContext
Definition: DBCEnums.h:922
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:849
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:48
#define TC_GAME_API
Definition: Define.h:124
uint8_t uint8
Definition: Define.h:145
int16_t int16
Definition: Define.h:140
int32_t int32
Definition: Define.h:139
uint64_t uint64
Definition: Define.h:142
uint16_t uint16
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:143
uint16 flags
Definition: DisableMgr.cpp:49
#define ASSERT
Definition: Errors.h:68
EnchantmentSlot
Definition: ItemDefines.h:174
InventoryResult
Definition: ItemDefines.h:25
ItemModifier
Definition: ItemDefines.h:206
uint32 ItemRandomBonusListId
Definition: ItemEnchantmentMgr.h:23
@ ITEM_FLAG2_BNET_ACCOUNT_TRADE_OK
Definition: ItemTemplate.h:229
ItemFieldFlags
Definition: ItemTemplate.h:130
@ ITEM_FIELD_FLAG_REFUNDABLE
Definition: ItemTemplate.h:143
@ ITEM_FIELD_FLAG_UNLOCKED
Definition: ItemTemplate.h:133
@ ITEM_FIELD_FLAG_SOULBOUND
Definition: ItemTemplate.h:131
@ ITEM_FIELD_FLAG_WRAPPED
Definition: ItemTemplate.h:134
@ ITEM_FIELD_FLAG_BOP_TRADEABLE
Definition: ItemTemplate.h:139
@ ITEM_FLAG_IS_BOUND_TO_ACCOUNT
Definition: ItemTemplate.h:203
#define MAX_INVTYPE
Definition: ItemTemplate.h:398
SocketColor
Definition: ItemTemplate.h:334
ItemBondingType
Definition: ItemTemplate.h:115
ItemFieldFlags2
Definition: ItemTemplate.h:168
@ INVTYPE_BAG
Definition: ItemTemplate.h:379
void RemoveItemFromUpdateQueueOf(Item *item, Player *player)
Definition: Item.cpp:1217
void AddItemToUpdateQueueOf(Item *item, Player *player)
Definition: Item.cpp:1196
ItemModifier const AppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:282
ItemModifier const SecondaryAppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:300
Item * NewItemOrBag(ItemTemplate const *proto)
Definition: Item.cpp:51
ItemUpdateState
Definition: Item.h:53
@ ITEM_CHANGED
Definition: Item.h:55
@ ITEM_REMOVED
Definition: Item.h:57
@ ITEM_NEW
Definition: Item.h:56
@ ITEM_UNCHANGED
Definition: Item.h:54
ItemModifier const IllusionModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:291
int32 const ItemTransmogrificationSlots[MAX_INVTYPE]
Definition: Item.cpp:2018
bool ItemCanGoIntoBag(ItemTemplate const *proto, ItemTemplate const *pBagProto)
Definition: Item.cpp:207
@ TYPEID_AZERITE_ITEM
Definition: ObjectGuid.h:37
@ TYPEID_AZERITE_EMPOWERED_ITEM
Definition: ObjectGuid.h:36
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:384
std::unordered_map< Player *, UpdateData > UpdateDataMapType
Definition: Object.h:77
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
static void SaveToDB(QuestPool const &pool, CharacterDatabaseTransaction trans)
Definition: QuestPools.cpp:50
#define MAX_SPECIALIZATIONS
Definition: SharedDefines.h:967
Definition: AzeriteEmpoweredItem.h:24
Definition: AzeriteItem.h:30
Definition: Bag.h:27
Definition: ByteBuffer.h:62
Class used to access individual fields of database query result.
Definition: Field.h:84
Definition: Item.h:170
uint32 GetPaidExtendedCost() const
Definition: Item.h:364
bool hasInvolvedQuest(uint32) const override
Definition: Item.h:332
uint8 GetSlot() const
Definition: Item.h:280
std::string const & GetText() const
Definition: Item.h:304
void SetItemFlag(ItemFieldFlags flags)
Definition: Item.h:209
bool IsCurrencyToken() const
Definition: Item.h:255
uint32 GetScriptId() const
Definition: Item.h:402
bool HasItemFlag2(ItemFieldFlags2 flag) const
Definition: Item.h:213
bool IsWrapped() const
Definition: Item.h:250
Bag * GetContainer()
Definition: Item.h:281
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:315
void SetText(std::string const &text)
Definition: Item.h:305
void SetPetitionId(uint32 petitionId)
Definition: Item.h:443
ObjectGuid m_childItem
Definition: Item.h:467
Loot * GetLootForPlayer(Player const *) const override
Definition: Item.h:319
AzeriteItem const * ToAzeriteItem() const
Definition: Item.h:244
void ReplaceAllItemFlags(ItemFieldFlags flags)
Definition: Item.h:211
void RemoveItemFlag(ItemFieldFlags flags)
Definition: Item.h:210
ObjectGuid GetContainedIn() const
Definition: Item.h:190
void SetBinding(bool val)
Definition: Item.h:201
ItemBondingType GetBonding() const
Definition: Item.h:200
Trinity::IteratorPair< ItemEffectEntry const *const * > GetEffects() const
Definition: Item.h:354
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:298
void SetChildItem(ObjectGuid childItem)
Definition: Item.h:423
std::unordered_map< uint32, uint16 > m_artifactPowerIdToIndex
Definition: Item.h:468
void SetPaidMoney(uint64 money)
Definition: Item.h:359
int32 GetSpellCharges(uint8 index=0) const
Definition: Item.h:314
bool IsVellum() const
Definition: Item.h:334
Bag * m_container
Definition: Item.h:457
bool IsAzeriteEmpoweredItem() const
Definition: Item.h:254
bool IsBoundAccountWide() const
Definition: Item.h:219
bool mb_in_trade
Definition: Item.h:460
Bag * ToBag()
Definition: Item.h:241
std::string m_text
Definition: Item.h:455
AzeriteItem * ToAzeriteItem()
Definition: Item.h:243
int32 GetItemStatType(uint32 index) const
Definition: Item.h:342
void ReplaceAllItemFlags2(ItemFieldFlags2 flags)
Definition: Item.h:216
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:299
void SetContext(ItemContext context)
Definition: Item.h:441
uint32 GetQuality() const
Definition: Item.h:337
uint64 m_paidMoney
Definition: Item.h:463
std::array< uint32, MAX_ITEM_PROTO_SOCKETS > m_gemScalingLevels
Definition: Item.h:469
bool IsLocked() const
Definition: Item.h:251
void SetDurability(uint32 durability)
Definition: Item.h:258
ObjectGuid GetCreator() const
Definition: Item.h:192
std::vector< int32 > const & GetBonusListIDs() const
Definition: Item.h:229
bool IsBOPTradeable() const
Definition: Item.h:249
bool IsInBag() const
Definition: Item.h:287
ItemRandomBonusListId GetItemRandomBonusListId() const
Definition: Item.h:292
bool IsSoulBound() const
Definition: Item.h:218
ItemContext GetContext() const
Definition: Item.h:440
ItemRandomBonusListId m_randomBonusListId
Definition: Item.h:466
ItemUpdateState GetState() const
Definition: Item.h:322
bool IsPotion() const
Definition: Item.h:333
bool IsBroken() const
Definition: Item.h:257
bool IsBattlenetAccountBound() const
Definition: Item.h:220
bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:208
uint16 GetQueuePos() const
Definition: Item.h:325
void ApplyBonusList(uint32 itemBonusListId)
BonusData const * GetBonus() const
Definition: Item.h:186
SocketColor GetSocketColor(uint32 index) const
Definition: Item.h:344
AzeriteEmpoweredItem const * ToAzeriteEmpoweredItem() const
Definition: Item.h:246
ObjectGuid GetOwnerGUID() const
Definition: Item.h:188
Bag const * ToBag() const
Definition: Item.h:242
uint32 GetAppearanceModId() const
Definition: Item.h:345
BonusData _bonusData
Definition: Item.h:452
uint64 GetPaidMoney() const
Definition: Item.h:363
time_t m_lastPlayedTimeUpdate
Definition: Item.h:461
bool IsAzeriteItem() const
Definition: Item.h:253
bool IsRefundable() const
Definition: Item.h:248
void SetItemFlag2(ItemFieldFlags2 flags)
Definition: Item.h:214
uint16 GetPos() const
Definition: Item.h:284
ObjectGuid m_refundRecipient
Definition: Item.h:462
bool IsInTrade() const
Definition: Item.h:262
bool IsRangedWeapon() const
Definition: Item.h:336
int16 uQueuePos
Definition: Item.h:459
void SetContainedIn(ObjectGuid guid)
Definition: Item.h:191
ObjectGuid GetGiftCreator() const
Definition: Item.h:194
void RemoveItemFlag2(ItemFieldFlags2 flags)
Definition: Item.h:215
void SetPetitionNumSignatures(uint32 signatures)
Definition: Item.h:444
void FSetState(ItemUpdateState state)
Definition: Item.h:326
void SetMaxDurability(uint32 maxDurability)
Definition: Item.h:259
uint32 m_paidExtendedCost
Definition: Item.h:464
bool IsBag() const
Definition: Item.h:252
void SetArtifactXP(uint64 xp)
Definition: Item.h:437
std::unique_ptr< Loot > m_loot
Definition: Item.h:317
void SetCreator(ObjectGuid guid)
Definition: Item.h:193
ObjectGuid const & GetRefundRecipient() const
Definition: Item.h:362
void SetCreatePlayedTime(uint32 createPlayedTime)
Definition: Item.h:311
void SetPaidExtendedCost(uint32 iece)
Definition: Item.h:360
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:300
void SetAppearanceModId(uint32 appearanceModId)
Definition: Item.h:346
void SetRefundRecipient(ObjectGuid const &guid)
Definition: Item.h:358
void SetSlot(uint8 slot)
Definition: Item.h:283
bool m_lootGenerated
Definition: Item.h:318
uint32 GetCount() const
Definition: Item.h:273
void SetExpiration(uint32 expiration)
Definition: Item.h:198
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:189
void SetContainer(Bag *container)
Definition: Item.h:285
AzeriteEmpoweredItem * ToAzeriteEmpoweredItem()
Definition: Item.h:245
float GetRepairCostMultiplier() const
Definition: Item.h:349
ObjectGuid GetChildItem() const
Definition: Item.h:422
bool hasQuest(uint32 quest_id) const override
Definition: Item.h:331
uint32 GetMaxStackCount() const
Definition: Item.h:275
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:195
bool IsConjuredConsumable() const
Definition: Item.h:335
uint8 m_slot
Definition: Item.h:456
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:448
bool IsInUpdateQueue() const
Definition: Item.h:324
uint32 GetScalingContentTuningId() const
Definition: Item.h:350
GuidSet allowedGUIDs
Definition: Item.h:465
ItemUpdateState uState
Definition: Item.h:458
void SetInTrade(bool b=true)
Definition: Item.h:261
Definition: ObjectGuid.h:258
static ObjectGuid const Empty
Definition: ObjectGuid.h:264
uint64 LowType
Definition: ObjectGuid.h:268
Definition: Object.h:148
virtual void BuildValuesUpdateWithFlag(ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) const
Definition: Object.cpp:764
virtual std::string GetNameForLocaleIdx(LocaleConstant locale) const =0
void RemoveUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:285
TypeID GetTypeId() const
Definition: Object.h:171
virtual bool AddToObjectUpdate()=0
void SetUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:278
virtual void BuildValuesCreate(ByteBuffer *data, Player const *target) const =0
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:779
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:271
virtual std::string GetDebugInfo() const
Definition: Object.cpp:805
virtual void BuildValuesUpdate(ByteBuffer *data, Player const *target) const =0
virtual void BuildUpdate(UpdateDataMapType &)
Definition: Object.h:195
virtual void RemoveFromObjectUpdate()=0
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:759
Definition: Player.h:1125
Definition: SpellInfo.h:322
Utility class to enable range for loop syntax for multimap.equal_range uses.
Definition: IteratorPair.h:32
Definition: UpdateField.h:458
Definition: UpdateField.h:737
Definition: Unit.h:739
Definition: UpdateData.h:37
Definition: UpdateMask.h:32
UpdateFieldFlag
Definition: UpdateField.h:34
Definition: GameObjectAI.h:36
Definition: Item.h:122
std::vector< ArtifactPowerData > ArtifactPowers
Definition: Item.h:126
uint32 ArtifactTierId
Definition: Item.h:125
uint64 Xp
Definition: Item.h:123
uint32 ArtifactAppearanceId
Definition: Item.h:124
Definition: Item.h:115
uint32 ArtifactPowerId
Definition: Item.h:116
uint8 CurrentRankWithBonus
Definition: Item.h:118
uint8 PurchasedRank
Definition: Item.h:117
Definition: Item.h:146
std::array< int32, MAX_AZERITE_EMPOWERED_TIER > SelectedAzeritePowers
Definition: Item.h:147
Definition: Item.h:136
uint32 KnowledgeLevel
Definition: Item.h:139
uint32 Level
Definition: Item.h:138
std::vector< uint32 > AzeriteItemMilestonePowers
Definition: Item.h:140
std::array< AzeriteItemSelectedEssencesData, 4 > SelectedAzeriteEssences
Definition: Item.h:142
std::vector< AzeriteEssencePowerEntry const * > UnlockedAzeriteEssences
Definition: Item.h:141
uint64 Xp
Definition: Item.h:137
Definition: Item.h:130
std::array< uint32, MAX_AZERITE_ESSENCE_SLOT > AzeriteEssenceId
Definition: Item.h:132
uint32 SpecializationId
Definition: Item.h:131
Definition: Item.h:69
int32 RequiredLevel
Definition: Item.h:72
int32 RequiredLevelOverride
Definition: Item.h:87
bool CanScrap
Definition: Item.h:94
int32 ScalingStatDistributionPriority
Definition: Item.h:107
std::array< ItemEffectEntry const *, 13 > Effects
Definition: Item.h:91
void AddBonus(uint32 type, std::array< int32, 4 > const &values)
Definition: Item.cpp:2885
std::size_t EffectCount
Definition: Item.h:92
int32 AppearanceModPriority
Definition: Item.h:106
uint32 DisenchantLootId
Definition: Item.h:82
int32 ItemStatType[MAX_ITEM_PROTO_STATS]
Definition: Item.h:73
bool CanDisenchant
Definition: Item.h:93
int32 RelicType
Definition: Item.h:86
uint16 GemRelicRankBonus[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:85
uint32 PlayerLevelToItemLevelCurveId
Definition: Item.h:81
ItemBondingType Bonding
Definition: Item.h:77
float RepairCostMultiplier
Definition: Item.h:79
int32 RequiredLevelCurvePriority
Definition: Item.h:109
uint32 Quality
Definition: Item.h:70
int32 GemRelicType[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:84
uint32 AppearanceModID
Definition: Item.h:78
int32 ItemLevelBonus
Definition: Item.h:71
struct BonusData::@280 _state
int32 StatPercentEditor[MAX_ITEM_PROTO_STATS]
Definition: Item.h:74
uint32 Suffix
Definition: Item.h:89
bool HasFixedLevel
Definition: Item.h:95
void AddBonusList(uint32 bonusListId)
Definition: Item.cpp:2878
uint32 GemItemLevelBonus[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:83
int32 SuffixPriority
Definition: Item.h:105
int32 AzeriteTierUnlockSetId
Definition: Item.h:88
bool HasQualityBonus
Definition: Item.h:110
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]
Definition: Item.h:75
uint32 ContentTuningId
Definition: Item.h:80
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:2809
int32 AzeriteTierUnlockSetPriority
Definition: Item.h:108
int32 RequiredLevelCurve
Definition: Item.h:90
Definition: Item.h:151
Optional< ArtifactData > Artifact
Definition: Item.h:155
Optional< AzeriteEmpoweredItemData > AzeriteEmpoweredItem
Definition: Item.h:157
static void Init(std::unordered_map< ObjectGuid::LowType, ItemAdditionalLoadInfo > *loadInfo, PreparedQueryResult artifactResult, PreparedQueryResult azeriteItemResult, PreparedQueryResult azeriteItemMilestonePowersResult, PreparedQueryResult azeriteItemUnlockedEssencesResult, PreparedQueryResult azeriteEmpoweredItemResult)
Definition: Item.cpp:309
Optional< AzeriteItemData > AzeriteItem
Definition: Item.h:156
Definition: DB2Structure.h:2154
Definition: Item.h:161
uint32 ItemId
Definition: Item.h:162
uint8 Context
Definition: Item.h:164
uint16 BonusListIDs[16]
Definition: Item.h:163
Definition: DB2Structure.h:2236
Definition: Item.h:42
std::unordered_set< ItemSetSpellEntry const * > SetBonuses
Definition: Item.h:45
std::unordered_set< Item const * > EquippedItems
Definition: Item.h:44
uint32 ItemSetID
Definition: Item.h:43
Definition: ItemTemplate.h:754
UF::ObjectData::Base ObjectMask
Definition: Item.h:393
UF::ItemData::Base ItemMask
Definition: Item.h:394
ValuesUpdateForPlayerWithMaskSender(Item const *owner)
Definition: Item.h:390
Item const * Owner
Definition: Item.h:392
Definition: Loot.h:279
Definition: UpdateFields.h:96
UpdateField< ObjectGuid, 0, 6 > GiftCreator
Definition: UpdateFields.h:125
UpdateFieldArray< UF::ItemEnchantment, 13, 27, 28 > Enchantment
Definition: UpdateFields.h:141
UpdateField< uint32, 0, 18 > DynamicFlags2
Definition: UpdateFields.h:137
UpdateField< ObjectGuid, 0, 5 > Creator
Definition: UpdateFields.h:124
UpdateField< uint32, 0, 10 > Durability
Definition: UpdateFields.h:129
UpdateField< uint32, 0, 11 > MaxDurability
Definition: UpdateFields.h:130
UpdateField< uint32, 0, 9 > DynamicFlags
Definition: UpdateFields.h:128
UpdateFieldArray< int32, 5, 21, 22 > SpellCharges
Definition: UpdateFields.h:140
UpdateField< uint8, 0, 16 > ItemAppearanceModID
Definition: UpdateFields.h:135
UpdateField< uint64, 0, 15 > ArtifactXP
Definition: UpdateFields.h:134
UpdateField< ObjectGuid, 0, 3 > Owner
Definition: UpdateFields.h:122
UpdateField< uint32, 0, 8 > Expiration
Definition: UpdateFields.h:127
UpdateField< ObjectGuid, 0, 4 > ContainedIn
Definition: UpdateFields.h:123
UpdateField< uint32, 0, 12 > CreatePlayedTime
Definition: UpdateFields.h:131
UpdateField< int32, 0, 13 > Context
Definition: UpdateFields.h:132
UpdateField< int32, 0, 1 > ID
Definition: UpdateFields.h:65
UpdateField< uint32, 0, 2 > Duration
Definition: UpdateFields.h:66
Definition: UpdateFields.h:108
Definition: ItemPacketsCommon.h:71