TrinityCore
Item Class Reference

#include <Item.h>

Classes

struct  ValuesUpdateForPlayerWithMaskSender
 

Public Member Functions

ItemCloneItem (uint32 count, Player const *player=nullptr) const
 
 Item ()
 
 ~Item ()
 
virtual bool Create (ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const *owner)
 
std::string GetNameForLocaleIdx (LocaleConstant locale) const override
 
ItemTemplate const * GetTemplate () const
 
BonusData const * GetBonus () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid guid)
 
ObjectGuid GetContainedIn () const
 
void SetContainedIn (ObjectGuid guid)
 
ObjectGuid GetCreator () const
 
void SetCreator (ObjectGuid guid)
 
ObjectGuid GetGiftCreator () const
 
void SetGiftCreator (ObjectGuid guid)
 
PlayerGetOwner () const
 
void SetExpiration (uint32 expiration)
 
ItemBondingType GetBonding () const
 
void SetBinding (bool val)
 
bool HasItemFlag (ItemFieldFlags flag) const
 
void SetItemFlag (ItemFieldFlags flags)
 
void RemoveItemFlag (ItemFieldFlags flags)
 
void ReplaceAllItemFlags (ItemFieldFlags flags)
 
bool HasItemFlag2 (ItemFieldFlags2 flag) const
 
void SetItemFlag2 (ItemFieldFlags2 flags)
 
void RemoveItemFlag2 (ItemFieldFlags2 flags)
 
void ReplaceAllItemFlags2 (ItemFieldFlags2 flags)
 
bool IsSoulBound () const
 
bool IsBoundAccountWide () const
 
bool IsBattlenetAccountBound () const
 
bool IsBindedNotWith (Player const *player) const
 
bool IsBoundByEnchant () const
 
virtual void SaveToDB (CharacterDatabaseTransaction trans)
 
virtual bool LoadFromDB (ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field *fields, uint32 entry)
 
void LoadArtifactData (Player const *owner, uint64 xp, uint32 artifactAppearanceId, uint32 artifactTier, std::vector< ArtifactPowerData > &powers)
 
void CheckArtifactRelicSlotUnlock (Player const *owner)
 
void AddBonuses (uint32 bonusListID)
 
std::vector< int32 > const & GetBonusListIDs () const
 
void SetBonuses (std::vector< int32 > bonusListIDs)
 
void ClearBonuses ()
 
virtual void DeleteFromDB (CharacterDatabaseTransaction trans)
 
void DeleteFromInventoryDB (CharacterDatabaseTransaction trans)
 
void SaveRefundDataToDB ()
 
void DeleteRefundDataFromDB (CharacterDatabaseTransaction *trans)
 
BagToBag ()
 
Bag const * ToBag () const
 
AzeriteItemToAzeriteItem ()
 
AzeriteItem const * ToAzeriteItem () const
 
AzeriteEmpoweredItemToAzeriteEmpoweredItem ()
 
AzeriteEmpoweredItem const * ToAzeriteEmpoweredItem () const
 
bool IsRefundable () const
 
bool IsBOPTradeable () const
 
bool IsWrapped () const
 
bool IsLocked () const
 
bool IsBag () const
 
bool IsAzeriteItem () const
 
bool IsAzeriteEmpoweredItem () const
 
bool IsCurrencyToken () const
 
bool IsNotEmptyBag () const
 
bool IsBroken () const
 
void SetDurability (uint32 durability)
 
void SetMaxDurability (uint32 maxDurability)
 
bool CanBeTraded (bool mail=false, bool trade=false) const
 
void SetInTrade (bool b=true)
 
bool IsInTrade () const
 
uint64 CalculateDurabilityRepairCost (float discount) const
 
bool HasEnchantRequiredSkill (Player const *player) const
 
uint32 GetEnchantRequiredLevel () const
 
bool IsFitToSpellRequirements (SpellInfo const *spellInfo) const
 
bool IsLimitedToAnotherMapOrZone (uint32 cur_mapId, uint32 cur_zoneId) const
 
bool GemsFitSockets () const
 
uint32 GetCount () const
 
void SetCount (uint32 value)
 
uint32 GetMaxStackCount () const
 
uint8 GetGemCountWithID (uint32 GemID) const
 
uint8 GetGemCountWithLimitCategory (uint32 limitCategory) const
 
InventoryResult CanBeMergedPartlyWith (ItemTemplate const *proto) const
 
uint8 GetSlot () const
 
BagGetContainer ()
 
uint8 GetBagSlot () const
 
void SetSlot (uint8 slot)
 
uint16 GetPos () const
 
void SetContainer (Bag *container)
 
bool IsInBag () const
 
bool IsEquipped () const
 
uint32 GetSkill ()
 
ItemRandomBonusListId GetItemRandomBonusListId () const
 
void SetItemRandomBonusList (ItemRandomBonusListId bonusListId)
 
void SetEnchantment (EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster=ObjectGuid::Empty)
 
void SetEnchantmentDuration (EnchantmentSlot slot, uint32 duration, Player *owner)
 
void SetEnchantmentCharges (EnchantmentSlot slot, uint32 charges)
 
void ClearEnchantment (EnchantmentSlot slot)
 
uint32 GetEnchantmentId (EnchantmentSlot slot) const
 
uint32 GetEnchantmentDuration (EnchantmentSlot slot) const
 
uint32 GetEnchantmentCharges (EnchantmentSlot slot) const
 
UF::SocketedGem const * GetGem (uint16 slot) const
 
void SetGem (uint16 slot, ItemDynamicFieldGems const *gem, uint32 gemScalingLevel)
 
std::string const & GetText () const
 
void SetText (std::string const &text)
 
void SendUpdateSockets ()
 
void SendTimeUpdate (Player *owner)
 
void UpdateDuration (Player *owner, uint32 diff)
 
void SetCreatePlayedTime (uint32 createPlayedTime)
 
int32 GetSpellCharges (uint8 index=0) const
 
void SetSpellCharges (uint8 index, int32 value)
 
LootGetLootForPlayer (Player const *) const override
 
ItemUpdateState GetState () const
 
void SetState (ItemUpdateState state, Player *forplayer=nullptr)
 
bool IsInUpdateQueue () const
 
uint16 GetQueuePos () const
 
void FSetState (ItemUpdateState state)
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32) const override
 
bool IsPotion () const
 
bool IsVellum () const
 
bool IsConjuredConsumable () const
 
bool IsRangedWeapon () const
 
uint32 GetQuality () const
 
uint32 GetItemLevel (Player const *owner) const
 
int32 GetRequiredLevel () const
 
int32 GetItemStatType (uint32 index) const
 
float GetItemStatValue (uint32 index, Player const *owner) const
 
SocketColor GetSocketColor (uint32 index) const
 
uint32 GetAppearanceModId () const
 
void SetAppearanceModId (uint32 appearanceModId)
 
uint32 GetDisplayId (Player const *owner) const
 
ItemModifiedAppearanceEntry const * GetItemModifiedAppearance () const
 
float GetRepairCostMultiplier () const
 
uint32 GetScalingContentTuningId () const
 
ItemDisenchantLootEntry const * GetDisenchantLoot (Player const *owner) const
 
void SetFixedLevel (uint8 level)
 
Trinity::IteratorPair< ItemEffectEntry const *const * > GetEffects () const
 
void SetNotRefundable (Player *owner, bool changestate=true, CharacterDatabaseTransaction *trans=nullptr, bool addToCollection=true)
 
void SetRefundRecipient (ObjectGuid const &guid)
 
void SetPaidMoney (uint64 money)
 
void SetPaidExtendedCost (uint32 iece)
 
ObjectGuid const & GetRefundRecipient () const
 
uint64 GetPaidMoney () const
 
uint32 GetPaidExtendedCost () const
 
void UpdatePlayedTime (Player *owner)
 
uint32 GetPlayedTime ()
 
bool IsRefundExpired ()
 
void SetSoulboundTradeable (GuidSet const &allowedLooters)
 
void ClearSoulboundTradeable (Player *currentOwner)
 
bool CheckSoulboundTradeExpire ()
 
void BuildUpdate (UpdateDataMapType &) override
 
void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) const override
 
void BuildValuesUpdateForPlayerWithMask (UpdateData *data, UF::ObjectData::Mask const &requestedObjectMask, UF::ItemData::Mask const &requestedItemMask, Player const *target) const
 
bool AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
uint32 GetScriptId () const
 
bool IsValidTransmogrificationTarget () const
 
bool HasStats () const
 
uint32 GetBuyPrice (Player const *owner, bool &standardPrice) const
 
uint32 GetSellPrice (Player const *owner) const
 
uint32 GetVisibleEntry (Player const *owner) const
 
uint16 GetVisibleAppearanceModId (Player const *owner) const
 
uint32 GetVisibleModifiedAppearanceId (Player const *owner) const
 
int32 GetVisibleSecondaryModifiedAppearanceId (Player const *owner) const
 
uint32 GetVisibleEnchantmentId (Player const *owner) const
 
uint16 GetVisibleItemVisual (Player const *owner) const
 
uint32 GetModifier (ItemModifier modifier) const
 
void SetModifier (ItemModifier modifier, uint32 value)
 
ObjectGuid GetChildItem () const
 
void SetChildItem (ObjectGuid childItem)
 
bool IsArtifactDisabled () const
 
UF::ArtifactPower const * GetArtifactPower (uint32 artifactPowerId) const
 
void AddArtifactPower (ArtifactPowerData const *artifactPower)
 
void SetArtifactPower (uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus)
 
void InitArtifactPowers (uint8 artifactId, uint8 artifactTier)
 
uint32 GetTotalUnlockedArtifactPowers () const
 
uint32 GetTotalPurchasedArtifactPowers () const
 
void ApplyArtifactPowerEnchantmentBonuses (EnchantmentSlot slot, uint32 enchantId, bool apply, Player *owner)
 
void CopyArtifactDataFromParent (Item *parent)
 
void SetArtifactXP (uint64 xp)
 
void GiveArtifactXp (uint64 amount, Item *sourceItem, uint32 artifactCategoryId)
 
ItemContext GetContext () const
 
void SetContext (ItemContext context)
 
void SetPetitionId (uint32 petitionId)
 
void SetPetitionNumSignatures (uint32 signatures)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid const & GetGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
void SetDynamicFlag (uint32 flag)
 
void RemoveDynamicFlag (uint32 flag)
 
void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player const *target) const
 
void BuildValuesUpdateBlockForPlayerWithFlag (UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
 
void BuildDestroyUpdateBlock (UpdateData *data) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
ByteBufferPrepareValuesUpdateBuffer (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
virtual void ClearUpdateMask (bool remove)
 
virtual std::string GetNameForLocaleIdx (LocaleConstant locale) const =0
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
virtual void BuildUpdate (UpdateDataMapType &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsAreaTrigger () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger const * ToAreaTrigger () const
 
bool IsSceneObject () const
 
SceneObjectToSceneObject ()
 
SceneObject const * ToSceneObject () const
 
bool IsConversation () const
 
ConversationToConversation ()
 
Conversation const * ToConversation () const
 
template<typename T >
void ForceUpdateFieldChange (UF::UpdateFieldSetter< T > const &)
 
virtual std::string GetDebugInfo () const
 
virtual LootGetLootForPlayer (Player const *player) const
 
virtual void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) const
 

Static Public Member Functions

static ItemCreateItem (uint32 itemEntry, uint32 count, ItemContext context, Player const *player=nullptr, bool addDefaultBonuses=true)
 
static void DeleteFromDB (CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
 
static void DeleteFromInventoryDB (CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
 
static uint32 GetItemLevel (ItemTemplate const *itemTemplate, BonusData const &bonusData, uint32 level, uint32 fixedLevel, uint32 minItemLevel, uint32 minItemLevelCutoff, uint32 maxItemLevel, bool pvpBonus, uint32 azeriteLevel)
 
static ItemDisenchantLootEntry const * GetDisenchantLoot (ItemTemplate const *itemTemplate, uint32 quality, uint32 itemLevel)
 
static bool HasStats (WorldPackets::Item::ItemInstance const &itemInstance, BonusData const *bonus)
 
static bool CanTransmogrifyItemWithItem (Item const *item, ItemModifiedAppearanceEntry const *itemModifiedAppearance)
 
static uint32 GetBuyPrice (ItemTemplate const *proto, uint32 quality, uint32 itemLevel, bool &standardPrice)
 
static uint32 GetSellPrice (ItemTemplate const *proto, uint32 quality, uint32 itemLevel)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
static PlayerToPlayer (Object *o)
 
static Player const * ToPlayer (Object const *o)
 
static CreatureToCreature (Object *o)
 
static Creature const * ToCreature (Object const *o)
 
static UnitToUnit (Object *o)
 
static Unit const * ToUnit (Object const *o)
 
static GameObjectToGameObject (Object *o)
 
static GameObject const * ToGameObject (Object const *o)
 
static CorpseToCorpse (Object *o)
 
static Corpse const * ToCorpse (Object const *o)
 
static DynamicObjectToDynObject (Object *o)
 
static DynamicObject const * ToDynObject (Object const *o)
 
static AreaTriggerToAreaTrigger (Object *o)
 
static AreaTrigger const * ToAreaTrigger (Object const *o)
 
static SceneObjectToSceneObject (Object *o)
 
static SceneObject const * ToSceneObject (Object const *o)
 
static ConversationToConversation (Object *o)
 
static Conversation const * ToConversation (Object const *o)
 

Public Attributes

std::unique_ptr< Lootm_loot
 
bool m_lootGenerated
 
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEMm_itemData
 
- Public Attributes inherited from Object
UF::UpdateFieldHolder m_values
 
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECTm_objectData
 

Protected Member Functions

UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const override
 
void BuildValuesCreate (ByteBuffer *data, Player const *target) const override
 
void BuildValuesUpdate (ByteBuffer *data, Player const *target) const override
 
void ClearUpdateMask (bool remove) override
 
- Protected Member Functions inherited from Object
 Object ()
 
void _Create (ObjectGuid const &guid)
 
template<typename T >
void SetUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void SetUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
void RemoveUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void RemoveDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void ClearDynamicUpdateFieldValues (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
void RemoveOptionalUpdateFieldValue (UF::OptionalUpdateFieldSetter< T > setter)
 
template<typename T >
void SetUpdateFieldStatValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void ApplyModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type mod, bool apply)
 
template<typename T >
void ApplyPercentModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, float percent, bool apply)
 
template<typename Action >
void DoWithSuppressingObjectUpdates (Action &&action)
 
void BuildMovementUpdate (ByteBuffer *data, CreateObjectBits flags, Player *target) const
 
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const
 
virtual void BuildValuesCreate (ByteBuffer *data, Player const *target) const =0
 
virtual void BuildValuesUpdate (ByteBuffer *data, Player const *target) const =0
 
virtual bool AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

BonusData _bonusData
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
CreateObjectBits m_updateFlag
 
bool m_objectUpdated
 

Private Attributes

std::string m_text
 
uint8 m_slot
 
Bagm_container
 
ItemUpdateState uState
 
int16 uQueuePos
 
bool mb_in_trade
 
time_t m_lastPlayedTimeUpdate
 
ObjectGuid m_refundRecipient
 
uint64 m_paidMoney
 
uint32 m_paidExtendedCost
 
GuidSet allowedGUIDs
 
ItemRandomBonusListId m_randomBonusListId
 
ObjectGuid m_childItem
 
std::unordered_map< uint32, uint16m_artifactPowerIdToIndex
 
std::array< uint32, MAX_ITEM_PROTO_SOCKETSm_gemScalingLevels
 

Friends

void AddItemToUpdateQueueOf (Item *item, Player *player)
 
void RemoveItemFromUpdateQueueOf (Item *item, Player *player)
 

Detailed Description

Definition at line 169 of file Item.h.

Constructor & Destructor Documentation

◆ Item()

Item::Item ( )

Definition at line 444 of file Item.cpp.

445{
448
449 m_slot = 0;
451 uQueuePos = -1;
452 m_container = nullptr;
453 m_lootGenerated = false;
454 mb_in_trade = false;
456
457 m_paidMoney = 0;
459
461 m_gemScalingLevels = { };
462
463 memset(&_bonusData, 0, sizeof(_bonusData));
464}
@ ITEM_NEW
Definition: Item.h:56
@ TYPEID_ITEM
Definition: ObjectGuid.h:36
@ TYPEMASK_ITEM
Definition: ObjectGuid.h:56
Bag * m_container
Definition: Item.h:457
bool mb_in_trade
Definition: Item.h:460
uint64 m_paidMoney
Definition: Item.h:463
std::array< uint32, MAX_ITEM_PROTO_SOCKETS > m_gemScalingLevels
Definition: Item.h:469
ItemRandomBonusListId m_randomBonusListId
Definition: Item.h:466
BonusData _bonusData
Definition: Item.h:452
time_t m_lastPlayedTimeUpdate
Definition: Item.h:461
int16 uQueuePos
Definition: Item.h:459
uint32 m_paidExtendedCost
Definition: Item.h:464
bool m_lootGenerated
Definition: Item.h:318
uint8 m_slot
Definition: Item.h:456
ItemUpdateState uState
Definition: Item.h:458
uint16 m_objectType
Definition: Object.h:386
TypeID m_objectTypeId
Definition: Object.h:388
time_t GetGameTime()
Definition: GameTime.cpp:44
+ Here is the call graph for this function:

◆ ~Item()

Item::~Item ( )
default

Member Function Documentation

◆ AddArtifactPower()

void Item::AddArtifactPower ( ArtifactPowerData const *  artifactPower)

Definition at line 2588 of file Item.cpp.

2589{
2590 uint16 index = uint16(m_artifactPowerIdToIndex.size());
2591 m_artifactPowerIdToIndex[artifactPower->ArtifactPowerId] = index;
2592
2594 powerField.ArtifactPowerID = artifactPower->ArtifactPowerId;
2595 powerField.PurchasedRank = artifactPower->PurchasedRank;
2596 powerField.CurrentRankWithBonus = artifactPower->CurrentRankWithBonus;
2597}
uint16_t uint16
Definition: Define.h:144
std::unordered_map< uint32, uint16 > m_artifactPowerIdToIndex
Definition: Item.h:468
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:449
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue(UF::DynamicUpdateFieldSetter< T > setter)
Definition: Object.h:293
UF::UpdateFieldHolder m_values
Definition: Object.h:253
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:683
uint8 CurrentRankWithBonus
Definition: UpdateFields.h:99
DynamicUpdateField< UF::ArtifactPower, 0, 1 > ArtifactPowers
Definition: UpdateFields.h:120
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddBonuses()

void Item::AddBonuses ( uint32  bonusListID)

Definition at line 2534 of file Item.cpp.

2535{
2536 if (std::find(GetBonusListIDs().begin(), GetBonusListIDs().end(), int32(bonusListID)) != GetBonusListIDs().end())
2537 return;
2538
2540 itemBonusKey.ItemID = GetEntry();
2541 itemBonusKey.BonusListIDs = GetBonusListIDs();
2542 itemBonusKey.BonusListIDs.push_back(bonusListID);
2544 for (ItemBonusEntry const* bonus : ItemBonusMgr::GetItemBonuses(bonusListID))
2545 _bonusData.AddBonus(bonus->Type, bonus->Value);
2547}
int32_t int32
Definition: Define.h:139
std::vector< int32 > const & GetBonusListIDs() const
Definition: Item.h:229
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:272
uint32 GetEntry() const
Definition: Object.h:160
std::span< ItemBonusEntry const * > GetItemBonuses(uint32 bonusListId)
void AddBonus(uint32 type, std::array< int32, 4 > const &values)
Definition: Item.cpp:2904
uint32 AppearanceModID
Definition: Item.h:78
UpdateField< WorldPackets::Item::ItemBonusKey, 0, 19 > ItemBonusKey
Definition: UpdateFields.h:138
UpdateField< uint8, 0, 16 > ItemAppearanceModID
Definition: UpdateFields.h:135
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToObjectUpdate()

bool Item::AddToObjectUpdate ( )
overridevirtual

Implements Object.

Definition at line 1797 of file Item.cpp.

1798{
1799 if (Player* owner = GetOwner())
1800 {
1801 owner->GetMap()->AddUpdateObject(this);
1802 return true;
1803 }
1804
1805 return false;
1806}
Player * GetOwner() const
Definition: Item.cpp:1146
+ Here is the call graph for this function:

◆ ApplyArtifactPowerEnchantmentBonuses()

void Item::ApplyArtifactPowerEnchantmentBonuses ( EnchantmentSlot  slot,
uint32  enchantId,
bool  apply,
Player owner 
)

Definition at line 2664 of file Item.cpp.

2665{
2666 if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
2667 {
2668 for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
2669 {
2670 switch (enchant->Effect[i])
2671 {
2673 for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
2674 {
2675 UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
2676 if (uint32(sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label) == enchant->EffectArg[i])
2677 {
2678 uint8 newRank = artifactPower.CurrentRankWithBonus;
2679 if (apply)
2680 newRank += enchant->EffectPointsMin[i];
2681 else
2682 newRank -= enchant->EffectPointsMin[i];
2683
2685 .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
2686 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2687
2688 if (IsEquipped())
2689 if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0))
2690 owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2691 }
2692 }
2693 break;
2695 {
2696 if (uint16 const* artifactPowerIndex = Trinity::Containers::MapGetValuePtr(m_artifactPowerIdToIndex, enchant->EffectArg[i]))
2697 {
2698 uint8 newRank = m_itemData->ArtifactPowers[*artifactPowerIndex].CurrentRankWithBonus;
2699 if (apply)
2700 newRank += enchant->EffectPointsMin[i];
2701 else
2702 newRank -= enchant->EffectPointsMin[i];
2703
2705 .ModifyValue(&UF::ItemData::ArtifactPowers, *artifactPowerIndex)
2706 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2707
2708 if (IsEquipped())
2709 if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(m_itemData->ArtifactPowers[*artifactPowerIndex].ArtifactPowerID, newRank ? newRank - 1 : 0))
2710 owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2711 }
2712 break;
2713 }
2716 {
2717 if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
2718 {
2719 PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
2720 if (!playerCondition || sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
2721 {
2722 for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
2723 {
2724 UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
2725 if (sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label == _bonusData.GemRelicType[slot - SOCK_ENCHANTMENT_SLOT])
2726 {
2727 uint8 newRank = artifactPower.CurrentRankWithBonus;
2728 if (apply)
2729 newRank += enchant->EffectPointsMin[i];
2730 else
2731 newRank -= enchant->EffectPointsMin[i];
2732
2734 .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
2735 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2736
2737 if (IsEquipped())
2738 if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0))
2739 owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2740 }
2741 }
2742 }
2743 }
2744 }
2745 break;
2746 default:
2747 break;
2748 }
2749 }
2750 }
2751}
#define sConditionMgr
Definition: ConditionMgr.h:365
DB2Storage< ArtifactPowerPickerEntry > sArtifactPowerPickerStore("ArtifactPowerPicker.db2", &ArtifactPowerPickerLoadInfo::Instance)
DB2Storage< ArtifactPowerEntry > sArtifactPowerStore("ArtifactPower.db2", &ArtifactPowerLoadInfo::Instance)
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", &PlayerConditionLoadInfo::Instance)
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", &SpellItemEnchantmentLoadInfo::Instance)
#define sDB2Manager
Definition: DB2Stores.h:537
#define MAX_ITEM_ENCHANTMENT_EFFECTS
@ ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_TYPE
Definition: DBCEnums.h:1010
@ ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_ID
Definition: DBCEnums.h:1011
@ ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_PICKER
Definition: DBCEnums.h:1014
uint8_t uint8
Definition: Define.h:145
uint32_t uint32
Definition: Define.h:143
@ SOCK_ENCHANTMENT_SLOT_3
Definition: ItemDefines.h:183
@ SOCK_ENCHANTMENT_SLOT
Definition: ItemDefines.h:181
bool IsEquipped() const
Definition: Item.cpp:1244
void ApplyArtifactPowerRank(Item *artifact, ArtifactPowerRankEntry const *artifactPowerRank, bool apply)
Definition: Player.cpp:8434
void apply(T *val)
Definition: ByteConverter.h:41
auto MapGetValuePtr(M &map, typename M::key_type const &key)
Definition: MapUtils.h:29
int32 GemRelicType[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildUpdate()

void Item::BuildUpdate ( UpdateDataMapType data_map)
overridevirtual

Reimplemented from Object.

Definition at line 1693 of file Item.cpp.

1694{
1695 if (Player* owner = GetOwner())
1696 BuildFieldsUpdate(owner, data_map);
1697 ClearUpdateMask(false);
1698}
void ClearUpdateMask(bool remove) override
Definition: Item.cpp:1791
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition: Object.cpp:795
+ Here is the call graph for this function:

◆ BuildValuesCreate()

void Item::BuildValuesCreate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

Definition at line 1708 of file Item.cpp.

1709{
1711 std::size_t sizePos = data->wpos();
1712 *data << uint32(0);
1713 *data << uint8(flags);
1714 m_objectData->WriteCreate(*data, flags, this, target);
1715 m_itemData->WriteCreate(*data, flags, this, target);
1716 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1717}
uint16 flags
Definition: DisableMgr.cpp:49
size_t wpos() const
Definition: ByteBuffer.h:412
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const override
Definition: Item.cpp:1700
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:254
UpdateFieldFlag
Definition: UpdateField.h:34
+ Here is the call graph for this function:

◆ BuildValuesUpdate()

void Item::BuildValuesUpdate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

Definition at line 1719 of file Item.cpp.

1720{
1722 std::size_t sizePos = data->wpos();
1723 *data << uint32(0);
1725
1727 m_objectData->WriteUpdate(*data, flags, this, target);
1728
1730 m_itemData->WriteUpdate(*data, flags, this, target);
1731
1732 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1733}
@ TYPEID_OBJECT
Definition: ObjectGuid.h:35
bool HasChanged(uint32 index) const
Definition: UpdateField.h:701
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:696
+ Here is the call graph for this function:

◆ BuildValuesUpdateForPlayerWithMask()

void Item::BuildValuesUpdateForPlayerWithMask ( UpdateData data,
UF::ObjectData::Mask const &  requestedObjectMask,
UF::ItemData::Mask const &  requestedItemMask,
Player const *  target 
) const

Definition at line 1751 of file Item.cpp.

1753{
1756 if (requestedObjectMask.IsAnySet())
1757 valuesMask.Set(TYPEID_OBJECT);
1758
1759 UF::ItemData::Mask itemMask = requestedItemMask;
1760 m_itemData->FilterDisallowedFieldsMaskForFlag(itemMask, flags);
1761 if (itemMask.IsAnySet())
1762 valuesMask.Set(TYPEID_ITEM);
1763
1764 ByteBuffer& buffer = PrepareValuesUpdateBuffer(data);
1765 std::size_t sizePos = buffer.wpos();
1766 buffer << uint32(0);
1767 buffer << uint32(valuesMask.GetBlock(0));
1768
1769 if (valuesMask[TYPEID_OBJECT])
1770 m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
1771
1772 if (valuesMask[TYPEID_ITEM])
1773 m_itemData->WriteUpdate(buffer, itemMask, true, this, target);
1774
1775 buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
1776
1777 data->AddUpdateBlock();
1778}
ByteBuffer & PrepareValuesUpdateBuffer(UpdateData *data) const
Definition: Object.cpp:218
void AddUpdateBlock()
Definition: UpdateData.h:49
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
void Set(uint32 index)
Definition: UpdateMask.h:84
bool IsAnySet() const
Definition: UpdateMask.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildValuesUpdateWithFlag()

void Item::BuildValuesUpdateWithFlag ( ByteBuffer data,
UF::UpdateFieldFlag  flags,
Player const *  target 
) const
overridevirtual

Reimplemented from Object.

Definition at line 1735 of file Item.cpp.

1736{
1738 valuesMask.Set(TYPEID_ITEM);
1739
1740 std::size_t sizePos = data->wpos();
1741 *data << uint32(0);
1742 *data << uint32(valuesMask.GetBlock(0));
1743
1744 UF::ItemData::Mask mask;
1745 m_itemData->AppendAllowedFieldsMaskForFlag(mask, flags);
1746 m_itemData->WriteUpdate(*data, mask, true, this, target);
1747
1748 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1749}
+ Here is the call graph for this function:

◆ CalculateDurabilityRepairCost()

uint64 Item::CalculateDurabilityRepairCost ( float  discount) const

Definition at line 1291 of file Item.cpp.

1292{
1293 uint32 maxDurability = m_itemData->MaxDurability;
1294 if (!maxDurability)
1295 return 0;
1296
1297 uint32 curDurability = m_itemData->Durability;
1298 ASSERT(maxDurability >= curDurability);
1299
1300 uint32 lostDurability = maxDurability - curDurability;
1301 if (!lostDurability)
1302 return 0;
1303
1304 ItemTemplate const* itemTemplate = GetTemplate();
1305
1306 DurabilityCostsEntry const* durabilityCost = sDurabilityCostsStore.LookupEntry(GetItemLevel(GetOwner()));
1307 if (!durabilityCost)
1308 return 0;
1309
1310 uint32 durabilityQualityEntryId = (GetQuality() + 1) * 2;
1311 DurabilityQualityEntry const* durabilityQualityEntry = sDurabilityQualityStore.LookupEntry(durabilityQualityEntryId);
1312 if (!durabilityQualityEntry)
1313 return 0;
1314
1315 uint32 dmultiplier = 0;
1316 if (itemTemplate->GetClass() == ITEM_CLASS_WEAPON)
1317 dmultiplier = durabilityCost->WeaponSubClassCost[itemTemplate->GetSubClass()];
1318 else if (itemTemplate->GetClass() == ITEM_CLASS_ARMOR)
1319 dmultiplier = durabilityCost->ArmorSubClassCost[itemTemplate->GetSubClass()];
1320
1321 uint64 cost = std::round(lostDurability * dmultiplier * durabilityQualityEntry->Data * GetRepairCostMultiplier());
1322 cost = uint64(cost * discount * sWorld->getRate(RATE_REPAIRCOST));
1323
1324 if (cost == 0) // Fix for ITEM_QUALITY_ARTIFACT
1325 cost = 1;
1326
1327 return cost;
1328}
DB2Storage< DurabilityQualityEntry > sDurabilityQualityStore("DurabilityQuality.db2", &DurabilityQualityLoadInfo::Instance)
DB2Storage< DurabilityCostsEntry > sDurabilityCostsStore("DurabilityCosts.db2", &DurabilityCostsLoadInfo::Instance)
uint64_t uint64
Definition: Define.h:142
#define ASSERT
Definition: Errors.h:68
@ ITEM_CLASS_ARMOR
Definition: ItemTemplate.h:424
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:422
uint32 GetQuality() const
Definition: Item.h:337
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1141
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2279
float GetRepairCostMultiplier() const
Definition: Item.h:349
#define sWorld
Definition: World.h:931
@ RATE_REPAIRCOST
Definition: World.h:488
std::array< uint16, 8 > ArmorSubClassCost
std::array< uint16, 21 > WeaponSubClassCost
uint32 GetSubClass() const
Definition: ItemTemplate.h:778
uint32 GetClass() const
Definition: ItemTemplate.h:777
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeMergedPartlyWith()

InventoryResult Item::CanBeMergedPartlyWith ( ItemTemplate const *  proto) const

Definition at line 1370 of file Item.cpp.

1371{
1372 // not allow merge looting currently items
1373 if (m_lootGenerated)
1374 return EQUIP_ERR_LOOT_GONE;
1375
1376 // check item type
1377 if (GetEntry() != proto->GetId())
1378 return EQUIP_ERR_CANT_STACK;
1379
1380 // check free space (full stacks can't be target of merge
1381 if (GetCount() >= proto->GetMaxStackSize())
1382 return EQUIP_ERR_CANT_STACK;
1383
1384 return EQUIP_ERR_OK;
1385}
@ EQUIP_ERR_OK
Definition: ItemDefines.h:26
@ EQUIP_ERR_LOOT_GONE
Definition: ItemDefines.h:76
@ EQUIP_ERR_CANT_STACK
Definition: ItemDefines.h:45
uint32 GetCount() const
Definition: Item.h:273
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeTraded()

bool Item::CanBeTraded ( bool  mail = false,
bool  trade = false 
) const

Definition at line 1250 of file Item.cpp.

1251{
1252 if (m_lootGenerated)
1253 return false;
1254
1255 if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!IsBOPTradeable() || !trade)))
1256 return false;
1257
1258 if (IsBag() && (Player::IsBagPos(GetPos()) || !ToBag()->IsEmpty()))
1259 return false;
1260
1261 if (Player* owner = GetOwner())
1262 {
1263 if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
1264 return false;
1265 if (owner->GetLootGUID() == GetGUID())
1266 return false;
1267 }
1268
1269 if (IsBoundByEnchant())
1270 return false;
1271
1272 return true;
1273}
bool IsBoundAccountWide() const
Definition: Item.h:219
Bag * ToBag()
Definition: Item.h:241
bool IsBOPTradeable() const
Definition: Item.h:249
bool IsSoulBound() const
Definition: Item.h:218
uint16 GetPos() const
Definition: Item.h:284
bool IsBoundByEnchant() const
Definition: Item.cpp:1358
bool IsBag() const
Definition: Item.h:252
ObjectGuid const & GetGUID() const
Definition: Object.h:159
static bool IsBagPos(uint16 pos)
Definition: Player.cpp:9742
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanTransmogrifyItemWithItem()

bool Item::CanTransmogrifyItemWithItem ( Item const *  item,
ItemModifiedAppearanceEntry const *  itemModifiedAppearance 
)
static

Definition at line 2067 of file Item.cpp.

2068{
2069 ItemTemplate const* source = sObjectMgr->GetItemTemplate(itemModifiedAppearance->ItemID); // source
2070 ItemTemplate const* target = item->GetTemplate(); // dest
2071
2072 if (!source || !target)
2073 return false;
2074
2075 if (itemModifiedAppearance == item->GetItemModifiedAppearance())
2076 return false;
2077
2078 if (!item->IsValidTransmogrificationTarget())
2079 return false;
2080
2081 if (source->GetClass() != target->GetClass())
2082 return false;
2083
2084 if (source->GetInventoryType() == INVTYPE_BAG ||
2085 source->GetInventoryType() == INVTYPE_RELIC ||
2086 source->GetInventoryType() == INVTYPE_FINGER ||
2087 source->GetInventoryType() == INVTYPE_TRINKET ||
2088 source->GetInventoryType() == INVTYPE_AMMO ||
2089 source->GetInventoryType() == INVTYPE_QUIVER)
2090 return false;
2091
2092 if (source->GetSubClass() != target->GetSubClass())
2093 {
2094 switch (source->GetClass())
2095 {
2096 case ITEM_CLASS_WEAPON:
2098 return false;
2099 break;
2100 case ITEM_CLASS_ARMOR:
2102 return false;
2103 if (source->GetInventoryType() != target->GetInventoryType())
2105 return false;
2106 break;
2107 default:
2108 return false;
2109 }
2110 }
2111
2112 return true;
2113}
@ ITEM_SUBCLASS_ARMOR_COSMETIC
Definition: ItemTemplate.h:534
@ INVTYPE_FINGER
Definition: ItemTemplate.h:390
@ INVTYPE_TRINKET
Definition: ItemTemplate.h:391
@ INVTYPE_RELIC
Definition: ItemTemplate.h:407
@ INVTYPE_BAG
Definition: ItemTemplate.h:397
@ INVTYPE_AMMO
Definition: ItemTemplate.h:403
@ INVTYPE_QUIVER
Definition: ItemTemplate.h:406
static ItemTransmogrificationWeaponCategory GetTransmogrificationWeaponCategory(ItemTemplate const *proto)
Definition: Item.cpp:1995
int32 const ItemTransmogrificationSlots[MAX_INVTYPE]
Definition: Item.cpp:2028
#define sObjectMgr
Definition: ObjectMgr.h:1945
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:786
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckArtifactRelicSlotUnlock()

void Item::CheckArtifactRelicSlotUnlock ( Player const *  owner)

Definition at line 1072 of file Item.cpp.

1073{
1074 if (!owner)
1075 return;
1076
1077 uint8 artifactId = GetTemplate()->GetArtifactID();
1078 if (!artifactId)
1079 return;
1080
1081 for (ArtifactUnlockEntry const* artifactUnlock : sArtifactUnlockStore)
1082 if (artifactUnlock->ArtifactID == artifactId)
1083 if (owner->MeetPlayerCondition(artifactUnlock->PlayerConditionID))
1084 AddBonuses(artifactUnlock->ItemBonusListID);
1085}
DB2Storage< ArtifactUnlockEntry > sArtifactUnlockStore("ArtifactUnlock.db2", &ArtifactUnlockLoadInfo::Instance)
void AddBonuses(uint32 bonusListID)
Definition: Item.cpp:2534
uint8 GetArtifactID() const
Definition: ItemTemplate.h:824
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckSoulboundTradeExpire()

bool Item::CheckSoulboundTradeExpire ( )

Definition at line 1927 of file Item.cpp.

1928{
1929 // called from owner's update - GetOwner() MUST be valid
1930 if (m_itemData->CreatePlayedTime + 2*HOUR < GetOwner()->GetTotalPlayedTime())
1931 {
1933 return true; // remove from tradeable list
1934 }
1935
1936 return false;
1937}
@ HOUR
Definition: Common.h:30
void ClearSoulboundTradeable(Player *currentOwner)
Definition: Item.cpp:1913
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearBonuses()

void Item::ClearBonuses ( )

Definition at line 2562 of file Item.cpp.

2563{
2565 itemBonusKey.ItemID = GetEntry();
2569}
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:2829
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearEnchantment()

void Item::ClearEnchantment ( EnchantmentSlot  slot)

Definition at line 1468 of file Item.cpp.

1469{
1470 if (!GetEnchantmentId(slot))
1471 return;
1472
1473 auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, slot);
1474 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), 0);
1475 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), 0);
1476 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), 0);
1477 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Inactive), 0);
1479}
@ ITEM_CHANGED
Definition: Item.h:55
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1166
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:298
UpdateFieldArray< UF::ItemEnchantment, 13, 27, 28 > Enchantment
Definition: UpdateFields.h:141
UpdateField< int16, 0, 3 > Charges
Definition: UpdateFields.h:67
UpdateField< int32, 0, 1 > ID
Definition: UpdateFields.h:65
UpdateField< uint16, 0, 4 > Inactive
Definition: UpdateFields.h:68
UpdateField< uint32, 0, 2 > Duration
Definition: UpdateFields.h:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearSoulboundTradeable()

void Item::ClearSoulboundTradeable ( Player currentOwner)

Definition at line 1913 of file Item.cpp.

1914{
1916 if (allowedGUIDs.empty())
1917 return;
1918
1919 currentOwner->GetSession()->GetCollectionMgr()->AddItemAppearance(this);
1920 allowedGUIDs.clear();
1921 SetState(ITEM_CHANGED, currentOwner);
1923 stmt->setUInt64(0, GetGUID().GetCounter());
1924 CharacterDatabase.Execute(stmt);
1925}
@ CHAR_DEL_ITEM_BOP_TRADE
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
@ ITEM_FIELD_FLAG_BOP_TRADEABLE
Definition: ItemTemplate.h:139
void AddItemAppearance(Item *item)
void RemoveItemFlag(ItemFieldFlags flags)
Definition: Item.h:210
GuidSet allowedGUIDs
Definition: Item.h:465
WorldSession * GetSession() const
Definition: Player.h:2102
void setUInt64(const uint8 index, const uint64 value)
CollectionMgr * GetCollectionMgr() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearUpdateMask()

void Item::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

Definition at line 1791 of file Item.cpp.

1792{
1795}
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:783
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:690
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CloneItem()

Item * Item::CloneItem ( uint32  count,
Player const *  player = nullptr 
) const

Definition at line 1655 of file Item.cpp.

1656{
1657 Item* newItem = CreateItem(GetEntry(), count, GetContext(), player, false);
1658 if (!newItem)
1659 return nullptr;
1660
1661 newItem->SetCreator(GetCreator());
1662 newItem->SetGiftCreator(GetGiftCreator());
1664 newItem->SetExpiration(m_itemData->Expiration);
1665 newItem->SetBonuses(m_itemData->ItemBonusKey->BonusListIDs);
1666 // player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
1667 if (player)
1669 return newItem;
1670}
ItemFieldFlags
Definition: ItemTemplate.h:130
@ ITEM_FIELD_FLAG_REFUNDABLE
Definition: ItemTemplate.h:143
Definition: Item.h:170
void ReplaceAllItemFlags(ItemFieldFlags flags)
Definition: Item.h:211
ObjectGuid GetCreator() const
Definition: Item.h:192
ItemContext GetContext() const
Definition: Item.h:441
void SetItemRandomBonusList(ItemRandomBonusListId bonusListId)
Definition: Item.cpp:1158
ObjectGuid GetGiftCreator() const
Definition: Item.h:194
void SetCreator(ObjectGuid guid)
Definition: Item.h:193
void SetBonuses(std::vector< int32 > bonusListIDs)
Definition: Item.cpp:2549
void SetExpiration(uint32 expiration)
Definition: Item.h:198
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:195
static Item * CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const *player=nullptr, bool addDefaultBonuses=true)
Definition: Item.cpp:1625
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CopyArtifactDataFromParent()

void Item::CopyArtifactDataFromParent ( Item parent)

Definition at line 2753 of file Item.cpp.

2754{
2758}
@ ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID
Definition: ItemDefines.h:219
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2436
BonusData const * GetBonus() const
Definition: Item.h:186
uint32 GetAppearanceModId() const
Definition: Item.h:345
void SetAppearanceModId(uint32 appearanceModId)
Definition: Item.h:346
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2423
uint32 GemItemLevelBonus[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:83
+ Here is the call graph for this function:

◆ Create()

bool Item::Create ( ObjectGuid::LowType  guidlow,
uint32  itemId,
ItemContext  context,
Player const *  owner 
)
virtual

Reimplemented in AzeriteEmpoweredItem, AzeriteItem, and Bag.

Definition at line 468 of file Item.cpp.

469{
470 Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
471
472 SetEntry(itemId);
473 SetObjectScale(1.0f);
474
475 if (owner)
476 {
477 SetOwnerGUID(owner->GetGUID());
478 SetContainedIn(owner->GetGUID());
479 }
480
481 ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemId);
482 if (!itemProto)
483 return false;
484
485 _bonusData.Initialize(itemProto);
486 SetCount(1);
488 SetDurability(itemProto->MaxDurability);
489
490 for (std::size_t i = 0; i < itemProto->Effects.size(); ++i)
491 if (itemProto->Effects[i]->LegacySlotIndex < 5)
492 SetSpellCharges(itemProto->Effects[i]->LegacySlotIndex, itemProto->Effects[i]->Charges);
493
494 SetExpiration(itemProto->GetDuration());
496 SetContext(context);
497
498 if (itemProto->GetArtifactID())
499 {
500 InitArtifactPowers(itemProto->GetArtifactID(), 0);
501 for (ArtifactAppearanceEntry const* artifactAppearance : sArtifactAppearanceStore)
502 {
503 if (ArtifactAppearanceSetEntry const* artifactAppearanceSet = sArtifactAppearanceSetStore.LookupEntry(artifactAppearance->ArtifactAppearanceSetID))
504 {
505 if (itemProto->GetArtifactID() != artifactAppearanceSet->ArtifactID)
506 continue;
507
508 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID))
509 if (!owner || !sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
510 continue;
511
512 SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID);
513 SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
514 break;
515 }
516 }
517
518 CheckArtifactRelicSlotUnlock(owner ? owner : GetOwner());
519 }
520
521 return true;
522}
DB2Storage< ArtifactAppearanceEntry > sArtifactAppearanceStore("ArtifactAppearance.db2", &ArtifactAppearanceLoadInfo::Instance)
DB2Storage< ArtifactAppearanceSetEntry > sArtifactAppearanceSetStore("ArtifactAppearanceSet.db2", &ArtifactAppearanceSetLoadInfo::Instance)
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:315
void InitArtifactPowers(uint8 artifactId, uint8 artifactTier)
Definition: Item.cpp:2614
void SetContext(ItemContext context)
Definition: Item.h:442
void SetCount(uint32 value)
Definition: Item.cpp:1275
void SetDurability(uint32 durability)
Definition: Item.h:258
void SetContainedIn(ObjectGuid guid)
Definition: Item.h:191
void CheckArtifactRelicSlotUnlock(Player const *owner)
Definition: Item.cpp:1072
void SetCreatePlayedTime(uint32 createPlayedTime)
Definition: Item.h:311
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:189
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:101
void SetEntry(uint32 entry)
Definition: Object.h:161
virtual void SetObjectScale(float scale)
Definition: Object.h:164
uint32 GetDuration() const
Definition: ItemTemplate.h:820
std::vector< ItemEffectEntry const * > Effects
Definition: ItemTemplate.h:828
uint32 MaxDurability
Definition: ItemTemplate.h:827
UpdateField< uint32, 0, 11 > MaxDurability
Definition: UpdateFields.h:130
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateItem()

Item * Item::CreateItem ( uint32  itemEntry,
uint32  count,
ItemContext  context,
Player const *  player = nullptr,
bool  addDefaultBonuses = true 
)
static

Definition at line 1625 of file Item.cpp.

1626{
1627 if (count < 1)
1628 return nullptr; //don't create item at zero count
1629
1630 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
1631 if (proto)
1632 {
1633 if (count > proto->GetMaxStackSize())
1634 count = proto->GetMaxStackSize();
1635
1636 ASSERT_NODEBUGINFO(count != 0, "proto->Stackable == 0 but checked at loading already");
1637
1638 Item* item = NewItemOrBag(proto);
1639 if (item->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), itemEntry, context, player))
1640 {
1641 item->SetCount(count);
1642 if (addDefaultBonuses)
1643 item->SetBonuses(ItemBonusMgr::GetBonusListsForItem(itemEntry, context));
1644
1645 return item;
1646 }
1647 else
1648 delete item;
1649 }
1650 else
1651 ABORT();
1652 return nullptr;
1653}
#define ABORT
Definition: Errors.h:74
#define ASSERT_NODEBUGINFO
Definition: Errors.h:69
Item * NewItemOrBag(ItemTemplate const *proto)
Definition: Item.cpp:52
virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const *owner)
Definition: Item.cpp:468
std::vector< int32 > GetBonusListsForItem(uint32 itemId, ItemBonusGenerationParams const &params)
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:847
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromDB() [1/2]

void Item::DeleteFromDB ( CharacterDatabaseTransaction  trans)
virtual

Reimplemented in AzeriteEmpoweredItem, AzeriteItem, and Bag.

Definition at line 1119 of file Item.cpp.

1120{
1121 DeleteFromDB(trans, GetGUID().GetCounter());
1122
1123 // Delete the items if this is a container
1124 if (m_loot && !m_loot->isLooted())
1125 sLootItemStorage->RemoveStoredLootForContainer(GetGUID().GetCounter());
1126}
#define sLootItemStorage
std::unique_ptr< Loot > m_loot
Definition: Item.h:317
static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:1088
+ Here is the call graph for this function:

◆ DeleteFromDB() [2/2]

void Item::DeleteFromDB ( CharacterDatabaseTransaction  trans,
ObjectGuid::LowType  itemGuid 
)
static

Definition at line 1088 of file Item.cpp.

1089{
1091 stmt->setUInt64(0, itemGuid);
1092 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1093
1094 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
1095 stmt->setUInt64(0, itemGuid);
1096 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1097
1098 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
1099 stmt->setUInt64(0, itemGuid);
1100 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1101
1102 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
1103 stmt->setUInt64(0, itemGuid);
1104 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1105
1106 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
1107 stmt->setUInt64(0, itemGuid);
1108 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1109
1110 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
1111 stmt->setUInt64(0, itemGuid);
1112 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1113
1114 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
1115 stmt->setUInt64(0, itemGuid);
1116 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1117}
@ CHAR_DEL_ITEM_INSTANCE_GEMS
@ CHAR_DEL_ITEM_INSTANCE_ARTIFACT
@ CHAR_DEL_ITEM_INSTANCE_TRANSMOG
@ CHAR_DEL_ITEM_INSTANCE
@ CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS
@ CHAR_DEL_ITEM_INSTANCE_MODIFIERS
@ CHAR_DEL_GIFT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromInventoryDB() [1/2]

void Item::DeleteFromInventoryDB ( CharacterDatabaseTransaction  trans)

Definition at line 1136 of file Item.cpp.

1137{
1138 DeleteFromInventoryDB(trans, GetGUID().GetCounter());
1139}
static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:1129
+ Here is the call graph for this function:

◆ DeleteFromInventoryDB() [2/2]

void Item::DeleteFromInventoryDB ( CharacterDatabaseTransaction  trans,
ObjectGuid::LowType  itemGuid 
)
static

Definition at line 1129 of file Item.cpp.

1130{
1132 stmt->setUInt64(0, itemGuid);
1133 trans->Append(stmt);
1134}
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteRefundDataFromDB()

void Item::DeleteRefundDataFromDB ( CharacterDatabaseTransaction trans)

Definition at line 1832 of file Item.cpp.

1833{
1834 if (trans)
1835 {
1837 stmt->setUInt64(0, GetGUID().GetCounter());
1838 (*trans)->Append(stmt);
1839
1840 }
1841}
@ CHAR_DEL_ITEM_REFUND_INSTANCE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FSetState()

void Item::FSetState ( ItemUpdateState  state)
inline

Definition at line 326 of file Item.h.

327 {
328 uState = state;
329 }
+ Here is the caller graph for this function:

◆ GemsFitSockets()

bool Item::GemsFitSockets ( ) const

Definition at line 1544 of file Item.cpp.

1545{
1546 for (uint32 gemSlot = 0; gemSlot < MAX_ITEM_PROTO_SOCKETS; ++gemSlot)
1547 {
1549
1550 if (!SocketColor) // no socket slot
1551 continue;
1552
1553 if (gemSlot >= m_itemData->Gems.size()) // no gems on this socket
1554 return false;
1555
1556 uint8 GemColor = 0;
1557
1558 uint32 gemid = m_itemData->Gems[gemSlot].ItemID;
1559 if (gemid)
1560 {
1561 ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
1562 if (gemProto)
1563 {
1564 GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GetGemProperties());
1565 if (gemProperty)
1566 GemColor = gemProperty->Type;
1567 }
1568 }
1569
1570 if (!(GemColor & SocketColorToGemTypeMask[SocketColor])) // bad gem color on this socket
1571 return false;
1572 }
1573 return true;
1574}
DB2Storage< GemPropertiesEntry > sGemPropertiesStore("GemProperties.db2", &GemPropertiesLoadInfo::Instance)
#define MAX_ITEM_PROTO_SOCKETS
Definition: DBCEnums.h:989
int32 const SocketColorToGemTypeMask[26]
SocketColor
Definition: ItemTemplate.h:345
uint32 GetGemProperties() const
Definition: ItemTemplate.h:818
SocketColor GetSocketColor(uint32 index) const
Definition: ItemTemplate.h:816
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAppearanceModId()

uint32 Item::GetAppearanceModId ( ) const
inline

Definition at line 345 of file Item.h.

345{ return m_itemData->ItemAppearanceModID; }
+ Here is the caller graph for this function:

◆ GetArtifactPower()

UF::ArtifactPower const * Item::GetArtifactPower ( uint32  artifactPowerId) const

Definition at line 2579 of file Item.cpp.

2580{
2581 auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
2582 if (indexItr != m_artifactPowerIdToIndex.end())
2583 return &m_itemData->ArtifactPowers[indexItr->second];
2584
2585 return nullptr;
2586}
+ Here is the caller graph for this function:

◆ GetBagSlot()

uint8 Item::GetBagSlot ( ) const

Definition at line 1239 of file Item.cpp.

1240{
1242}
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:625
uint8 GetSlot() const
Definition: Item.h:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBonding()

ItemBondingType Item::GetBonding ( ) const
inline

Definition at line 200 of file Item.h.

200{ return _bonusData.Bonding; }
ItemBondingType Bonding
Definition: Item.h:77
+ Here is the caller graph for this function:

◆ GetBonus()

BonusData const * Item::GetBonus ( ) const
inline

Definition at line 186 of file Item.h.

186{ return &_bonusData; }
+ Here is the caller graph for this function:

◆ GetBonusListIDs()

std::vector< int32 > const & Item::GetBonusListIDs ( ) const
inline

Definition at line 229 of file Item.h.

229{ return m_itemData->ItemBonusKey->BonusListIDs; }
+ Here is the caller graph for this function:

◆ GetBuyPrice() [1/2]

uint32 Item::GetBuyPrice ( ItemTemplate const *  proto,
uint32  quality,
uint32  itemLevel,
bool &  standardPrice 
)
static

Definition at line 2120 of file Item.cpp.

2121{
2122 standardPrice = false;
2123
2124 if (proto->HasFlag(ITEM_FLAG2_OVERRIDE_GOLD_COST))
2125 return proto->GetBuyPrice();
2126
2127 ImportPriceQualityEntry const* qualityPrice = sImportPriceQualityStore.LookupEntry(quality + 1);
2128 if (!qualityPrice)
2129 return 0;
2130
2131 ItemPriceBaseEntry const* basePrice = sItemPriceBaseStore.LookupEntry(itemLevel);
2132 if (!basePrice)
2133 return 0;
2134
2135 float qualityFactor = qualityPrice->Data;
2136 float baseFactor = 0.0f;
2137
2138 uint32 inventoryType = proto->GetInventoryType();
2139
2140 if (inventoryType == INVTYPE_WEAPON ||
2141 inventoryType == INVTYPE_2HWEAPON ||
2142 inventoryType == INVTYPE_WEAPONMAINHAND ||
2143 inventoryType == INVTYPE_WEAPONOFFHAND ||
2144 inventoryType == INVTYPE_RANGED ||
2145 inventoryType == INVTYPE_THROWN ||
2146 inventoryType == INVTYPE_RANGEDRIGHT)
2147 baseFactor = basePrice->Weapon;
2148 else
2149 baseFactor = basePrice->Armor;
2150
2151 if (inventoryType == INVTYPE_ROBE)
2152 inventoryType = INVTYPE_CHEST;
2153
2154 if (proto->GetClass() == ITEM_CLASS_GEM && proto->GetSubClass() == ITEM_SUBCLASS_GEM_ARTIFACT_RELIC)
2155 {
2156 inventoryType = INVTYPE_WEAPON;
2157 baseFactor = basePrice->Weapon / 3.0f;
2158 }
2159
2160 float typeFactor = 0.0f;
2161 int8 weapType = -1;
2162
2163 switch (inventoryType)
2164 {
2165 case INVTYPE_HEAD:
2166 case INVTYPE_NECK:
2167 case INVTYPE_SHOULDERS:
2168 case INVTYPE_CHEST:
2169 case INVTYPE_WAIST:
2170 case INVTYPE_LEGS:
2171 case INVTYPE_FEET:
2172 case INVTYPE_WRISTS:
2173 case INVTYPE_HANDS:
2174 case INVTYPE_FINGER:
2175 case INVTYPE_TRINKET:
2176 case INVTYPE_CLOAK:
2177 case INVTYPE_HOLDABLE:
2178 {
2179 ImportPriceArmorEntry const* armorPrice = sImportPriceArmorStore.LookupEntry(inventoryType);
2180 if (!armorPrice)
2181 return 0;
2182
2183 switch (proto->GetSubClass())
2184 {
2187 typeFactor = armorPrice->ClothModifier;
2188 break;
2190 typeFactor = armorPrice->LeatherModifier;
2191 break;
2193 typeFactor = armorPrice->ChainModifier;
2194 break;
2196 typeFactor = armorPrice->PlateModifier;
2197 break;
2198 default:
2199 typeFactor = 1.0f;
2200 break;
2201 }
2202
2203 break;
2204 }
2205 case INVTYPE_SHIELD:
2206 {
2207 ImportPriceShieldEntry const* shieldPrice = sImportPriceShieldStore.LookupEntry(2);
2208 if (!shieldPrice)
2209 return 0;
2210
2211 typeFactor = shieldPrice->Data;
2212 break;
2213 }
2215 weapType = 0;
2216 break;
2218 weapType = 1;
2219 break;
2220 case INVTYPE_WEAPON:
2221 weapType = 2;
2222 break;
2223 case INVTYPE_2HWEAPON:
2224 weapType = 3;
2225 break;
2226 case INVTYPE_RANGED:
2228 case INVTYPE_RELIC:
2229 weapType = 4;
2230 break;
2231 default:
2232 return proto->GetBuyPrice();
2233 }
2234
2235 if (weapType != -1)
2236 {
2237 ImportPriceWeaponEntry const* weaponPrice = sImportPriceWeaponStore.LookupEntry(weapType + 1);
2238 if (!weaponPrice)
2239 return 0;
2240
2241 typeFactor = weaponPrice->Data;
2242 }
2243
2244 standardPrice = false;
2245 return uint32(proto->GetPriceVariance() * typeFactor * baseFactor * qualityFactor * proto->GetPriceRandomValue());
2246}
DB2Storage< ImportPriceWeaponEntry > sImportPriceWeaponStore("ImportPriceWeapon.db2", &ImportPriceWeaponLoadInfo::Instance)
DB2Storage< ItemPriceBaseEntry > sItemPriceBaseStore("ItemPriceBase.db2", &ItemPriceBaseLoadInfo::Instance)
DB2Storage< ImportPriceShieldEntry > sImportPriceShieldStore("ImportPriceShield.db2", &ImportPriceShieldLoadInfo::Instance)
DB2Storage< ImportPriceQualityEntry > sImportPriceQualityStore("ImportPriceQuality.db2", &ImportPriceQualityLoadInfo::Instance)
DB2Storage< ImportPriceArmorEntry > sImportPriceArmorStore("ImportPriceArmor.db2", &ImportPriceArmorLoadInfo::Instance)
int8_t int8
Definition: Define.h:141
@ ITEM_CLASS_GEM
Definition: ItemTemplate.h:423
@ ITEM_FLAG2_OVERRIDE_GOLD_COST
Definition: ItemTemplate.h:226
@ ITEM_SUBCLASS_ARMOR_MAIL
Definition: ItemTemplate.h:532
@ ITEM_SUBCLASS_ARMOR_CLOTH
Definition: ItemTemplate.h:530
@ ITEM_SUBCLASS_ARMOR_LEATHER
Definition: ItemTemplate.h:531
@ ITEM_SUBCLASS_ARMOR_PLATE
Definition: ItemTemplate.h:533
@ ITEM_SUBCLASS_ARMOR_MISCELLANEOUS
Definition: ItemTemplate.h:529
@ ITEM_SUBCLASS_GEM_ARTIFACT_RELIC
Definition: ItemTemplate.h:522
@ INVTYPE_HEAD
Definition: ItemTemplate.h:380
@ INVTYPE_CLOAK
Definition: ItemTemplate.h:395
@ INVTYPE_ROBE
Definition: ItemTemplate.h:399
@ INVTYPE_HOLDABLE
Definition: ItemTemplate.h:402
@ INVTYPE_RANGED
Definition: ItemTemplate.h:394
@ INVTYPE_THROWN
Definition: ItemTemplate.h:404
@ INVTYPE_WAIST
Definition: ItemTemplate.h:385
@ INVTYPE_RANGEDRIGHT
Definition: ItemTemplate.h:405
@ INVTYPE_WRISTS
Definition: ItemTemplate.h:388
@ INVTYPE_WEAPON
Definition: ItemTemplate.h:392
@ INVTYPE_WEAPONMAINHAND
Definition: ItemTemplate.h:400
@ INVTYPE_WEAPONOFFHAND
Definition: ItemTemplate.h:401
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:396
@ INVTYPE_NECK
Definition: ItemTemplate.h:381
@ INVTYPE_SHOULDERS
Definition: ItemTemplate.h:382
@ INVTYPE_FEET
Definition: ItemTemplate.h:387
@ INVTYPE_SHIELD
Definition: ItemTemplate.h:393
@ INVTYPE_LEGS
Definition: ItemTemplate.h:386
@ INVTYPE_CHEST
Definition: ItemTemplate.h:384
@ INVTYPE_HANDS
Definition: ItemTemplate.h:389
+ Here is the call graph for this function:

◆ GetBuyPrice() [2/2]

uint32 Item::GetBuyPrice ( Player const *  owner,
bool &  standardPrice 
) const

Definition at line 2115 of file Item.cpp.

2116{
2117 return Item::GetBuyPrice(GetTemplate(), GetQuality(), GetItemLevel(owner), standardPrice);
2118}
uint32 GetBuyPrice(Player const *owner, bool &standardPrice) const
Definition: Item.cpp:2115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetChildItem()

ObjectGuid Item::GetChildItem ( ) const
inline

Definition at line 423 of file Item.h.

423{ return m_childItem; }
ObjectGuid m_childItem
Definition: Item.h:467
+ Here is the caller graph for this function:

◆ GetContainedIn()

ObjectGuid Item::GetContainedIn ( ) const
inline

Definition at line 190 of file Item.h.

190{ return m_itemData->ContainedIn; }

◆ GetContainer()

Bag * Item::GetContainer ( )
inline

Definition at line 281 of file Item.h.

281{ return m_container; }
+ Here is the caller graph for this function:

◆ GetContext()

ItemContext Item::GetContext ( ) const
inline

Definition at line 441 of file Item.h.

441{ return ItemContext(*m_itemData->Context); }
ItemContext
Definition: DBCEnums.h:1063
+ Here is the caller graph for this function:

◆ GetCount()

uint32 Item::GetCount ( ) const
inline

Definition at line 273 of file Item.h.

273{ return m_itemData->StackCount; }
+ Here is the caller graph for this function:

◆ GetCreator()

ObjectGuid Item::GetCreator ( ) const
inline

Definition at line 192 of file Item.h.

192{ return m_itemData->Creator; }
+ Here is the caller graph for this function:

◆ GetDebugInfo()

std::string Item::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 2819 of file Item.cpp.

2820{
2821 std::stringstream sstr;
2822 sstr << Object::GetDebugInfo() << "\n"
2823 << std::boolalpha
2824 << "Owner: " << GetOwnerGUID().ToString() << " Count: " << GetCount()
2825 << " BagSlot: " << std::to_string(GetBagSlot()) << " Slot: " << std::to_string(GetSlot()) << " Equipped: " << IsEquipped();
2826 return sstr.str();
2827}
ObjectGuid GetOwnerGUID() const
Definition: Item.h:188
uint8 GetBagSlot() const
Definition: Item.cpp:1239
std::string ToString() const
Definition: ObjectGuid.cpp:554
virtual std::string GetDebugInfo() const
Definition: Object.cpp:809
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDisenchantLoot() [1/2]

ItemDisenchantLootEntry const * Item::GetDisenchantLoot ( ItemTemplate const *  itemTemplate,
uint32  quality,
uint32  itemLevel 
)
static

Definition at line 2368 of file Item.cpp.

2369{
2370 if (itemTemplate->HasFlag(ITEM_FLAG_CONJURED) || itemTemplate->HasFlag(ITEM_FLAG_NO_DISENCHANT) || itemTemplate->GetBonding() == BIND_QUEST)
2371 return nullptr;
2372
2373 if (itemTemplate->GetArea(0) || itemTemplate->GetArea(1) || itemTemplate->GetMap() || itemTemplate->GetMaxStackSize() > 1)
2374 return nullptr;
2375
2376 if (!Item::GetSellPrice(itemTemplate, quality, itemLevel) && !sDB2Manager.HasItemCurrencyCost(itemTemplate->GetId()))
2377 return nullptr;
2378
2379 uint32 itemClass = itemTemplate->GetClass();
2380 int8 itemSubClass = itemTemplate->GetSubClass();
2381 uint8 expansion = itemTemplate->GetRequiredExpansion();
2382 for (ItemDisenchantLootEntry const* disenchant : sItemDisenchantLootStore)
2383 {
2384 if (disenchant->Class != itemClass)
2385 continue;
2386
2387 if (disenchant->Subclass >= 0 && itemSubClass)
2388 continue;
2389
2390 if (disenchant->Quality != quality)
2391 continue;
2392
2393 if (disenchant->MinLevel > itemLevel || disenchant->MaxLevel < itemLevel)
2394 continue;
2395
2396 if (disenchant->ExpansionID != -2 && disenchant->ExpansionID != expansion)
2397 continue;
2398
2399 return disenchant;
2400 }
2401
2402 return nullptr;
2403}
DB2Storage< ItemDisenchantLootEntry > sItemDisenchantLootStore("ItemDisenchantLoot.db2", &ItemDisenchantLootLoadInfo::Instance)
@ ITEM_FLAG_NO_DISENCHANT
Definition: ItemTemplate.h:191
@ ITEM_FLAG_CONJURED
Definition: ItemTemplate.h:177
@ BIND_QUEST
Definition: ItemTemplate.h:120
uint32 GetSellPrice(Player const *owner) const
Definition: Item.cpp:2248
+ Here is the call graph for this function:

◆ GetDisenchantLoot() [2/2]

ItemDisenchantLootEntry const * Item::GetDisenchantLoot ( Player const *  owner) const

Definition at line 2360 of file Item.cpp.

2361{
2363 return nullptr;
2364
2366}
ItemDisenchantLootEntry const * GetDisenchantLoot(Player const *owner) const
Definition: Item.cpp:2360
bool CanDisenchant
Definition: Item.h:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDisplayId()

uint32 Item::GetDisplayId ( Player const *  owner) const

Definition at line 2405 of file Item.cpp.

2406{
2407 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2408 if (!itemModifiedAppearanceId)
2409 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2410
2411 if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2412 if (ItemAppearanceEntry const* itemAppearance = sItemAppearanceStore.LookupEntry(transmog->ItemAppearanceID))
2413 return itemAppearance->ItemDisplayInfoID;
2414
2415 return sDB2Manager.GetItemDisplayId(GetEntry(), GetAppearanceModId());
2416}
DB2Storage< ItemModifiedAppearanceEntry > sItemModifiedAppearanceStore("ItemModifiedAppearance.db2", &ItemModifiedAppearanceLoadInfo::Instance)
DB2Storage< ItemAppearanceEntry > sItemAppearanceStore("ItemAppearance.db2", &ItemAppearanceLoadInfo::Instance)
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS
Definition: ItemDefines.h:211
ItemModifier const AppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:283
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffects()

Trinity::IteratorPair< ItemEffectEntry const *const * > Item::GetEffects ( ) const
inline

Definition at line 354 of file Item.h.

354{ return { std::make_pair(&_bonusData.Effects[0], &_bonusData.Effects[0] + _bonusData.EffectCount) }; }
std::array< ItemEffectEntry const *, 13 > Effects
Definition: Item.h:91
std::size_t EffectCount
Definition: Item.h:92
+ Here is the caller graph for this function:

◆ GetEnchantmentCharges()

uint32 Item::GetEnchantmentCharges ( EnchantmentSlot  slot) const
inline

Definition at line 300 of file Item.h.

300{ return m_itemData->Enchantment[slot].Charges; }
+ Here is the caller graph for this function:

◆ GetEnchantmentDuration()

uint32 Item::GetEnchantmentDuration ( EnchantmentSlot  slot) const
inline

Definition at line 299 of file Item.h.

299{ return m_itemData->Enchantment[slot].Duration; }
+ Here is the caller graph for this function:

◆ GetEnchantmentId()

uint32 Item::GetEnchantmentId ( EnchantmentSlot  slot) const
inline

Definition at line 298 of file Item.h.

298{ return m_itemData->Enchantment[slot].ID; }
+ Here is the caller graph for this function:

◆ GetEnchantRequiredLevel()

uint32 Item::GetEnchantRequiredLevel ( ) const

Definition at line 1344 of file Item.cpp.

1345{
1346 uint32 level = 0;
1347
1348 // Check all enchants for required level
1349 for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
1350 if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
1351 if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
1352 if (enchantEntry->MinLevel > level)
1353 level = enchantEntry->MinLevel;
1354
1355 return level;
1356}
EnchantmentSlot
Definition: ItemDefines.h:178
@ PERM_ENCHANTMENT_SLOT
Definition: ItemDefines.h:179
@ MAX_ENCHANTMENT_SLOT
Definition: ItemDefines.h:195
+ Here is the call graph for this function:

◆ GetGem()

UF::SocketedGem const * Item::GetGem ( uint16  slot) const

Definition at line 1481 of file Item.cpp.

1482{
1483 ASSERT(slot < MAX_GEM_SOCKETS);
1484 return slot < m_itemData->Gems.size() ? &m_itemData->Gems[slot] : nullptr;
1485}
#define MAX_GEM_SOCKETS
Definition: Item.h:48
+ Here is the caller graph for this function:

◆ GetGemCountWithID()

uint8 Item::GetGemCountWithID ( uint32  GemID) const

Definition at line 1576 of file Item.cpp.

1577{
1578 return uint8(std::count_if(m_itemData->Gems.begin(), m_itemData->Gems.end(), [GemID](UF::SocketedGem const& gemData)
1579 {
1580 return gemData.ItemID == int32(GemID);
1581 }));
1582}
+ Here is the caller graph for this function:

◆ GetGemCountWithLimitCategory()

uint8 Item::GetGemCountWithLimitCategory ( uint32  limitCategory) const

Definition at line 1584 of file Item.cpp.

1585{
1586 return uint8(std::count_if(m_itemData->Gems.begin(), m_itemData->Gems.end(), [limitCategory](UF::SocketedGem const& gemData)
1587 {
1588 ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemData.ItemID);
1589 if (!gemProto)
1590 return false;
1591
1592 return gemProto->GetItemLimitCategory() == limitCategory;
1593 }));
1594}
+ Here is the caller graph for this function:

◆ GetGiftCreator()

ObjectGuid Item::GetGiftCreator ( ) const
inline

Definition at line 194 of file Item.h.

194{ return m_itemData->GiftCreator; }
+ Here is the caller graph for this function:

◆ GetItemLevel() [1/2]

uint32 Item::GetItemLevel ( ItemTemplate const *  itemTemplate,
BonusData const &  bonusData,
uint32  level,
uint32  fixedLevel,
uint32  minItemLevel,
uint32  minItemLevelCutoff,
uint32  maxItemLevel,
bool  pvpBonus,
uint32  azeriteLevel 
)
static

Definition at line 2293 of file Item.cpp.

2295{
2296 if (!itemTemplate)
2297 return MIN_ITEM_LEVEL;
2298
2299 uint32 itemLevel = itemTemplate->GetBaseItemLevel();
2300 if (AzeriteLevelInfoEntry const* azeriteLevelInfo = sAzeriteLevelInfoStore.LookupEntry(azeriteLevel))
2301 itemLevel = azeriteLevelInfo->ItemLevel;
2302
2303 if (bonusData.PlayerLevelToItemLevelCurveId)
2304 {
2305 if (fixedLevel)
2306 level = fixedLevel;
2307 else if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(bonusData.ContentTuningId, 0, true))
2308 level = std::min(std::max(int16(level), levels->MinLevel), levels->MaxLevel);
2309
2310 itemLevel = uint32(sDB2Manager.GetCurveValueAt(bonusData.PlayerLevelToItemLevelCurveId, level));
2311 }
2312
2313 itemLevel += bonusData.ItemLevelBonus;
2314
2315 for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i)
2316 itemLevel += bonusData.GemItemLevelBonus[i];
2317
2318 uint32 itemLevelBeforeUpgrades = itemLevel;
2319
2320 if (pvpBonus)
2321 itemLevel += sDB2Manager.GetPvpItemLevelBonus(itemTemplate->GetId());
2322
2323 if (itemTemplate->GetInventoryType() != INVTYPE_NON_EQUIP)
2324 {
2325 if (minItemLevel && (!minItemLevelCutoff || itemLevelBeforeUpgrades >= minItemLevelCutoff) && itemLevel < minItemLevel)
2326 itemLevel = minItemLevel;
2327
2328 if (maxItemLevel && itemLevel > maxItemLevel)
2329 itemLevel = maxItemLevel;
2330 }
2331
2332 return std::min(std::max(itemLevel, uint32(MIN_ITEM_LEVEL)), uint32(MAX_ITEM_LEVEL));
2333}
DB2Storage< AzeriteLevelInfoEntry > sAzeriteLevelInfoStore("AzeriteLevelInfo.db2", &AzeriteLevelInfoLoadInfo::Instance)
int16_t int16
Definition: Define.h:140
@ MIN_ITEM_LEVEL
Definition: ItemTemplate.h:764
@ MAX_ITEM_LEVEL
Definition: ItemTemplate.h:765
@ INVTYPE_NON_EQUIP
Definition: ItemTemplate.h:379
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
if(posix_memalign(&__mallocedMemory, __align, __size)) return NULL
+ Here is the call graph for this function:

◆ GetItemLevel() [2/2]

uint32 Item::GetItemLevel ( Player const *  owner) const

Definition at line 2279 of file Item.cpp.

2280{
2281 ItemTemplate const* itemTemplate = GetTemplate();
2282 uint32 minItemLevel = owner->m_unitData->MinItemLevel;
2283 uint32 minItemLevelCutoff = owner->m_unitData->MinItemLevelCutoff;
2284 uint32 maxItemLevel = itemTemplate->HasFlag(ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP) ? 0 : owner->m_unitData->MaxItemLevel;
2285 bool pvpBonus = owner->IsUsingPvpItemLevels();
2286 uint32 azeriteLevel = 0;
2287 if (AzeriteItem const* azeriteItem = ToAzeriteItem())
2288 azeriteLevel = azeriteItem->GetEffectiveLevel();
2289 return Item::GetItemLevel(itemTemplate, _bonusData, owner->GetLevel(), GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL),
2290 minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus, azeriteLevel);
2291}
@ ITEM_MODIFIER_TIMEWALKER_LEVEL
Definition: ItemDefines.h:220
@ ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP
Definition: ItemTemplate.h:256
AzeriteItem * ToAzeriteItem()
Definition: Item.h:243
bool HasFlag(ItemFlags flag) const
Definition: ItemTemplate.h:871
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemModifiedAppearance()

ItemModifiedAppearanceEntry const * Item::GetItemModifiedAppearance ( ) const

Definition at line 2418 of file Item.cpp.

2419{
2420 return sDB2Manager.GetItemModifiedAppearance(GetEntry(), _bonusData.AppearanceModID);
2421}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemRandomBonusListId()

ItemRandomBonusListId Item::GetItemRandomBonusListId ( ) const
inline

Definition at line 292 of file Item.h.

292{ return m_randomBonusListId; }
+ Here is the caller graph for this function:

◆ GetItemStatType()

int32 Item::GetItemStatType ( uint32  index) const
inline

Definition at line 342 of file Item.h.

342{ ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:990
int32 ItemStatType[MAX_ITEM_PROTO_STATS]
Definition: Item.h:73
+ Here is the caller graph for this function:

◆ GetItemStatValue()

float Item::GetItemStatValue ( uint32  index,
Player const *  owner 
) const

Definition at line 2335 of file Item.cpp.

2336{
2338 switch (GetItemStatType(index))
2339 {
2342 return _bonusData.StatPercentEditor[index];
2343 default:
2344 break;
2345 }
2346
2347 uint32 itemLevel = GetItemLevel(owner);
2348 if (float randomPropPoints = GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate()->GetInventoryType(), GetTemplate()->GetSubClass()))
2349 {
2350 float statValue = float(_bonusData.StatPercentEditor[index] * randomPropPoints) * 0.0001f;
2351 if (GtItemSocketCostPerLevelEntry const* gtCost = sItemSocketCostPerLevelGameTable.GetRow(itemLevel))
2352 statValue -= float(int32(_bonusData.ItemStatSocketCostMultiplier[index] * gtCost->SocketCost));
2353
2354 return statValue;
2355 }
2356
2357 return 0.0f;
2358}
GameTable< GtItemSocketCostPerLevelEntry > sItemSocketCostPerLevelGameTable
Definition: GameTables.cpp:36
TC_GAME_API float GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
@ ITEM_MOD_CORRUPTION_RESISTANCE
Definition: ItemTemplate.h:48
@ ITEM_MOD_CORRUPTION
Definition: ItemTemplate.h:47
int32 GetItemStatType(uint32 index) const
Definition: Item.h:342
int32 StatPercentEditor[MAX_ITEM_PROTO_STATS]
Definition: Item.h:74
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]
Definition: Item.h:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLootForPlayer()

Loot * Item::GetLootForPlayer ( Player const *  ) const
inlineoverridevirtual

Reimplemented from Object.

Definition at line 319 of file Item.h.

319{ return m_loot.get(); }

◆ GetMaxStackCount()

uint32 Item::GetMaxStackCount ( ) const
inline

Definition at line 275 of file Item.h.

275{ return GetTemplate()->GetMaxStackSize(); }
+ Here is the caller graph for this function:

◆ GetModifier()

uint32 Item::GetModifier ( ItemModifier  modifier) const

Definition at line 2423 of file Item.cpp.

2424{
2425 int32 modifierIndex = m_itemData->Modifiers->Values.FindIndexIf([modifier](UF::ItemMod mod)
2426 {
2427 return mod.Type == modifier;
2428 });
2429
2430 if (modifierIndex != -1)
2431 return m_itemData->Modifiers->Values[modifierIndex].Value;
2432
2433 return 0;
2434}
+ Here is the caller graph for this function:

◆ GetNameForLocaleIdx()

std::string Item::GetNameForLocaleIdx ( LocaleConstant  locale) const
overridevirtual

Implements Object.

Definition at line 524 of file Item.cpp.

525{
526 ItemTemplate const* itemTemplate = GetTemplate();
528 return Trinity::StringFormat("{} {}", itemTemplate->GetName(locale), suffix->Description[locale]);
529
530 return itemTemplate->GetName(locale);
531}
DB2Storage< ItemNameDescriptionEntry > sItemNameDescriptionStore("ItemNameDescription.db2", &ItemNameDescriptionLoadInfo::Instance)
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
Definition: StringFormat.h:37
uint32 Suffix
Definition: Item.h:89
char const * GetName(LocaleConstant locale) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwner()

Player * Item::GetOwner ( ) const

Definition at line 1146 of file Item.cpp.

1147{
1149}
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid Item::GetOwnerGUID ( ) const
inline

Definition at line 188 of file Item.h.

188{ return m_itemData->Owner; }
+ Here is the caller graph for this function:

◆ GetPaidExtendedCost()

uint32 Item::GetPaidExtendedCost ( ) const
inline

Definition at line 364 of file Item.h.

364{ return m_paidExtendedCost; }
+ Here is the caller graph for this function:

◆ GetPaidMoney()

uint64 Item::GetPaidMoney ( ) const
inline

Definition at line 363 of file Item.h.

363{ return m_paidMoney; }
+ Here is the caller graph for this function:

◆ GetPlayedTime()

uint32 Item::GetPlayedTime ( )

Definition at line 1895 of file Item.cpp.

1896{
1897 time_t curtime = GameTime::GetGameTime();
1898 uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
1899 return *m_itemData->CreatePlayedTime + elapsed;
1900}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPos()

uint16 Item::GetPos ( ) const
inline

Definition at line 284 of file Item.h.

284{ return uint16(GetBagSlot()) << 8 | GetSlot(); }
+ Here is the caller graph for this function:

◆ GetQuality()

uint32 Item::GetQuality ( ) const
inline

Definition at line 337 of file Item.h.

337{ return _bonusData.Quality; }
uint32 Quality
Definition: Item.h:70
+ Here is the caller graph for this function:

◆ GetQueuePos()

uint16 Item::GetQueuePos ( ) const
inline

Definition at line 325 of file Item.h.

325{ return uQueuePos; }
+ Here is the caller graph for this function:

◆ GetRefundRecipient()

ObjectGuid const & Item::GetRefundRecipient ( ) const
inline

Definition at line 362 of file Item.h.

362{ return m_refundRecipient; }
ObjectGuid m_refundRecipient
Definition: Item.h:462
+ Here is the caller graph for this function:

◆ GetRepairCostMultiplier()

float Item::GetRepairCostMultiplier ( ) const
inline

Definition at line 349 of file Item.h.

float RepairCostMultiplier
Definition: Item.h:79
+ Here is the caller graph for this function:

◆ GetRequiredLevel()

int32 Item::GetRequiredLevel ( ) const

Definition at line 2807 of file Item.cpp.

2808{
2811 return sDB2Manager.GetCurveValueAt(_bonusData.RequiredLevelCurve, fixedLevel);
2815 return fixedLevel;
2817}
int32 RequiredLevel
Definition: Item.h:72
int32 RequiredLevelOverride
Definition: Item.h:87
uint32 PlayerLevelToItemLevelCurveId
Definition: Item.h:81
bool HasFixedLevel
Definition: Item.h:95
int32 RequiredLevelCurve
Definition: Item.h:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetScalingContentTuningId()

uint32 Item::GetScalingContentTuningId ( ) const
inline

Definition at line 350 of file Item.h.

350{ return _bonusData.ContentTuningId; }
uint32 ContentTuningId
Definition: Item.h:80
+ Here is the caller graph for this function:

◆ GetScriptId()

uint32 Item::GetScriptId ( ) const
inline

Definition at line 402 of file Item.h.

402{ return GetTemplate()->ScriptId; }
uint32 ScriptId
Definition: ItemTemplate.h:831
+ Here is the caller graph for this function:

◆ GetSellPrice() [1/2]

uint32 Item::GetSellPrice ( ItemTemplate const *  proto,
uint32  quality,
uint32  itemLevel 
)
static

Definition at line 2253 of file Item.cpp.

2254{
2255 if (proto->HasFlag(ITEM_FLAG2_OVERRIDE_GOLD_COST))
2256 return proto->GetSellPrice();
2257 else
2258 {
2259 bool standardPrice;
2260 uint32 cost = Item::GetBuyPrice(proto, quality, itemLevel, standardPrice);
2261
2262 if (standardPrice)
2263 {
2264 if (ItemClassEntry const* classEntry = sDB2Manager.GetItemClassByOldEnum(proto->GetClass()))
2265 {
2266 uint32 buyCount = std::max(proto->GetBuyCount(), 1u);
2267 return cost * classEntry->PriceModifier / buyCount;
2268 }
2269
2270 return 0;
2271 }
2272 else
2273 return proto->GetSellPrice();
2274 }
2275
2276 return 0;
2277}
+ Here is the call graph for this function:

◆ GetSellPrice() [2/2]

uint32 Item::GetSellPrice ( Player const *  owner) const

Definition at line 2248 of file Item.cpp.

2249{
2251}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSkill()

uint32 Item::GetSkill ( )

Definition at line 1152 of file Item.cpp.

1153{
1154 ItemTemplate const* proto = GetTemplate();
1155 return proto->GetSkill();
1156}
uint32 GetSkill() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSlot()

uint8 Item::GetSlot ( ) const
inline

Definition at line 280 of file Item.h.

280{return m_slot;}
+ Here is the caller graph for this function:

◆ GetSocketColor()

SocketColor Item::GetSocketColor ( uint32  index) const
inline

Definition at line 344 of file Item.h.

uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:76
+ Here is the caller graph for this function:

◆ GetSpellCharges()

int32 Item::GetSpellCharges ( uint8  index = 0) const
inline

Definition at line 314 of file Item.h.

314{ return m_itemData->SpellCharges[index]; }
+ Here is the caller graph for this function:

◆ GetState()

ItemUpdateState Item::GetState ( ) const
inline

Definition at line 322 of file Item.h.

322{ return uState; }
+ Here is the caller graph for this function:

◆ GetTemplate()

ItemTemplate const * Item::GetTemplate ( ) const

Definition at line 1141 of file Item.cpp.

1142{
1143 return sObjectMgr->GetItemTemplate(GetEntry());
1144}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetText()

std::string const & Item::GetText ( ) const
inline

Definition at line 304 of file Item.h.

304{ return m_text; }
std::string m_text
Definition: Item.h:455

◆ GetTotalPurchasedArtifactPowers()

uint32 Item::GetTotalPurchasedArtifactPowers ( ) const

Definition at line 2655 of file Item.cpp.

2656{
2657 uint32 purchasedRanks = 0;
2658 for (UF::ArtifactPower const& power : m_itemData->ArtifactPowers)
2659 purchasedRanks += power.PurchasedRank;
2660
2661 return purchasedRanks;
2662}
+ Here is the caller graph for this function:

◆ GetTotalUnlockedArtifactPowers()

uint32 Item::GetTotalUnlockedArtifactPowers ( ) const

Definition at line 2632 of file Item.cpp.

2633{
2635 uint64 artifactXp = m_itemData->ArtifactXP;
2636 uint32 currentArtifactTier = GetModifier(ITEM_MODIFIER_ARTIFACT_TIER);
2637 uint32 extraUnlocked = 0;
2638 do
2639 {
2640 uint64 xpCost = 0;
2641 if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(purchased + extraUnlocked + 1))
2642 xpCost = uint64(currentArtifactTier == MAX_ARTIFACT_TIER ? cost->XP2 : cost->XP);
2643
2644 if (artifactXp < xpCost)
2645 break;
2646
2647 artifactXp -= xpCost;
2648 ++extraUnlocked;
2649
2650 } while (true);
2651
2652 return purchased + extraUnlocked;
2653}
#define MAX_ARTIFACT_TIER
Definition: DBCEnums.h:198
GameTable< GtArtifactLevelXPEntry > sArtifactLevelXPGameTable
Definition: GameTables.cpp:29
@ ITEM_MODIFIER_ARTIFACT_TIER
Definition: ItemDefines.h:235
uint32 GetTotalPurchasedArtifactPowers() const
Definition: Item.cpp:2655
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetUpdateFieldFlagsFor()

UF::UpdateFieldFlag Item::GetUpdateFieldFlagsFor ( Player const *  target) const
overrideprotectedvirtual

Reimplemented from Object.

Definition at line 1700 of file Item.cpp.

1701{
1702 if (target->GetGUID() == GetOwnerGUID())
1704
1706}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleAppearanceModId()

uint16 Item::GetVisibleAppearanceModId ( Player const *  owner) const

Definition at line 2480 of file Item.cpp.

2481{
2482 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2483 if (!itemModifiedAppearanceId)
2484 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2485
2486 if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2487 return transmog->ItemAppearanceModifierID;
2488
2489 return uint16(GetAppearanceModId());
2490}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleEnchantmentId()

uint32 Item::GetVisibleEnchantmentId ( Player const *  owner) const

Definition at line 2514 of file Item.cpp.

2515{
2516 uint32 enchantmentId = GetModifier(IllusionModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2517 if (!enchantmentId)
2519
2520 if (!enchantmentId)
2521 enchantmentId = GetEnchantmentId(PERM_ENCHANTMENT_SLOT);
2522
2523 return enchantmentId;
2524}
@ ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS
Definition: ItemDefines.h:218
ItemModifier const IllusionModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:292
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleEntry()

uint32 Item::GetVisibleEntry ( Player const *  owner) const

Definition at line 2468 of file Item.cpp.

2469{
2470 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2471 if (!itemModifiedAppearanceId)
2472 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2473
2474 if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2475 return transmog->ItemID;
2476
2477 return GetEntry();
2478}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleItemVisual()

uint16 Item::GetVisibleItemVisual ( Player const *  owner) const

Definition at line 2526 of file Item.cpp.

2527{
2528 if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(GetVisibleEnchantmentId(owner)))
2529 return enchant->ItemVisual;
2530
2531 return 0;
2532}
uint32 GetVisibleEnchantmentId(Player const *owner) const
Definition: Item.cpp:2514
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleModifiedAppearanceId()

uint32 Item::GetVisibleModifiedAppearanceId ( Player const *  owner) const

Definition at line 2492 of file Item.cpp.

2493{
2494 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2495 if (!itemModifiedAppearanceId)
2496 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2497
2498 if (!itemModifiedAppearanceId)
2499 if (ItemModifiedAppearanceEntry const* itemModifiedAppearance = GetItemModifiedAppearance())
2500 itemModifiedAppearanceId = itemModifiedAppearance->ID;
2501
2502 return itemModifiedAppearanceId;
2503}
ItemModifiedAppearanceEntry const * GetItemModifiedAppearance() const
Definition: Item.cpp:2418
+ Here is the call graph for this function:

◆ GetVisibleSecondaryModifiedAppearanceId()

int32 Item::GetVisibleSecondaryModifiedAppearanceId ( Player const *  owner) const

Definition at line 2505 of file Item.cpp.

2506{
2507 uint32 itemModifiedAppearanceId = GetModifier(SecondaryAppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2508 if (!itemModifiedAppearanceId)
2510
2511 return itemModifiedAppearanceId;
2512}
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_ALL_SPECS
Definition: ItemDefines.h:242
ItemModifier const SecondaryAppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:301
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GiveArtifactXp()

void Item::GiveArtifactXp ( uint64  amount,
Item sourceItem,
uint32  artifactCategoryId 
)

Definition at line 2760 of file Item.cpp.

2761{
2762 Player* owner = GetOwner();
2763 if (!owner)
2764 return;
2765
2766 if (artifactCategoryId)
2767 {
2768 uint32 artifactKnowledgeLevel = 1;
2769 if (sourceItem && sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL))
2770 artifactKnowledgeLevel = sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL);
2771
2772 if (GtArtifactKnowledgeMultiplierEntry const* artifactKnowledge = sArtifactKnowledgeMultiplierGameTable.GetRow(artifactKnowledgeLevel))
2773 amount = uint64(amount * artifactKnowledge->Multiplier);
2774
2775 if (amount >= 5000)
2776 amount = 50 * (amount / 50);
2777 else if (amount >= 1000)
2778 amount = 25 * (amount / 25);
2779 else if (amount >= 50)
2780 amount = 5 * (amount / 5);
2781 }
2782
2783 SetArtifactXP(m_itemData->ArtifactXP + amount);
2784
2786 artifactXpGain.ArtifactGUID = GetGUID();
2787 artifactXpGain.Amount = amount;
2788 owner->SendDirectMessage(artifactXpGain.Write());
2789
2790 SetState(ITEM_CHANGED, owner);
2791}
GameTable< GtArtifactKnowledgeMultiplierEntry > sArtifactKnowledgeMultiplierGameTable
Definition: GameTables.cpp:28
@ ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL
Definition: ItemDefines.h:234
void SetArtifactXP(uint64 xp)
Definition: Item.h:438
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6318
WorldPacket const * Write() override
+ Here is the call graph for this function:

◆ HasEnchantRequiredSkill()

bool Item::HasEnchantRequiredSkill ( Player const *  player) const

Definition at line 1330 of file Item.cpp.

1331{
1332 // Check all enchants for required skill
1333 for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
1334 {
1335 if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
1336 if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
1337 if (enchantEntry->RequiredSkillID && player->GetSkillValue(enchantEntry->RequiredSkillID) < enchantEntry->RequiredSkillRank)
1338 return false;
1339 }
1340
1341 return true;
1342}
+ Here is the call graph for this function:

◆ hasInvolvedQuest()

bool Item::hasInvolvedQuest ( uint32  ) const
inlineoverridevirtual

Reimplemented from Object.

Definition at line 332 of file Item.h.

332{ return false; }

◆ HasItemFlag()

bool Item::HasItemFlag ( ItemFieldFlags  flag) const
inline

Definition at line 208 of file Item.h.

208{ return (*m_itemData->DynamicFlags & flag) != 0; }
+ Here is the caller graph for this function:

◆ HasItemFlag2()

bool Item::HasItemFlag2 ( ItemFieldFlags2  flag) const
inline

Definition at line 213 of file Item.h.

213{ return (*m_itemData->DynamicFlags2 & flag) != 0; }

◆ hasQuest()

bool Item::hasQuest ( uint32  quest_id) const
inlineoverridevirtual

Reimplemented from Object.

Definition at line 331 of file Item.h.

331{ return GetTemplate()->GetStartQuest() == quest_id; }
uint32 GetStartQuest() const
Definition: ItemTemplate.h:809

◆ HasStats() [1/2]

bool Item::HasStats ( ) const

Definition at line 1961 of file Item.cpp.

1962{
1963 ItemTemplate const* proto = GetTemplate();
1964 Player const* owner = GetOwner();
1965 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1966 if ((owner ? GetItemStatValue(i, owner) : proto->GetStatPercentEditor(i)) != 0)
1967 return true;
1968
1969 return false;
1970}
float GetItemStatValue(uint32 index, Player const *owner) const
Definition: Item.cpp:2335
int32 GetStatPercentEditor(uint32 index) const
Definition: ItemTemplate.h:799
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasStats() [2/2]

bool Item::HasStats ( WorldPackets::Item::ItemInstance const &  itemInstance,
BonusData const *  bonus 
)
static

Definition at line 1972 of file Item.cpp.

1973{
1974 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1975 if (bonus->StatPercentEditor[i] != 0)
1976 return true;
1977
1978 return false;
1979}

◆ InitArtifactPowers()

void Item::InitArtifactPowers ( uint8  artifactId,
uint8  artifactTier 
)

Definition at line 2614 of file Item.cpp.

2615{
2616 for (ArtifactPowerEntry const* artifactPower : sDB2Manager.GetArtifactPowers(artifactId))
2617 {
2618 if (artifactPower->Tier != artifactTier)
2619 continue;
2620
2621 if (m_artifactPowerIdToIndex.find(artifactPower->ID) != m_artifactPowerIdToIndex.end())
2622 continue;
2623
2624 ArtifactPowerData powerData;
2625 powerData.ArtifactPowerId = artifactPower->ID;
2626 powerData.PurchasedRank = 0;
2627 powerData.CurrentRankWithBonus = (artifactPower->Flags & ARTIFACT_POWER_FLAG_FIRST) == ARTIFACT_POWER_FLAG_FIRST ? 1 : 0;
2628 AddArtifactPower(&powerData);
2629 }
2630}
@ ARTIFACT_POWER_FLAG_FIRST
Definition: DBCEnums.h:195
void AddArtifactPower(ArtifactPowerData const *artifactPower)
Definition: Item.cpp:2588
uint32 ArtifactPowerId
Definition: Item.h:116
uint8 CurrentRankWithBonus
Definition: Item.h:118
uint8 PurchasedRank
Definition: Item.h:117
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsArtifactDisabled()

bool Item::IsArtifactDisabled ( ) const

Definition at line 2571 of file Item.cpp.

2572{
2573 if (ArtifactEntry const* artifact = sArtifactStore.LookupEntry(GetTemplate()->GetArtifactID()))
2574 return artifact->ArtifactCategoryID != 2; // fishing artifact
2575
2576 return true;
2577}
DB2Storage< ArtifactEntry > sArtifactStore("Artifact.db2", &ArtifactLoadInfo::Instance)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAzeriteEmpoweredItem()

bool Item::IsAzeriteEmpoweredItem ( ) const
inline

Definition at line 254 of file Item.h.

@ TYPEID_AZERITE_EMPOWERED_ITEM
Definition: ObjectGuid.h:38
TypeID GetTypeId() const
Definition: Object.h:172
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAzeriteItem()

bool Item::IsAzeriteItem ( ) const
inline

Definition at line 253 of file Item.h.

253{ return GetTypeId() == TYPEID_AZERITE_ITEM; }
@ TYPEID_AZERITE_ITEM
Definition: ObjectGuid.h:39
+ Here is the call graph for this function:

◆ IsBag()

bool Item::IsBag ( ) const
inline

Definition at line 252 of file Item.h.

252{ return GetTemplate()->GetInventoryType() == INVTYPE_BAG; }
+ Here is the caller graph for this function:

◆ IsBattlenetAccountBound()

bool Item::IsBattlenetAccountBound ( ) const
inline

Definition at line 220 of file Item.h.

@ ITEM_FLAG2_BNET_ACCOUNT_TRADE_OK
Definition: ItemTemplate.h:229
+ Here is the caller graph for this function:

◆ IsBindedNotWith()

bool Item::IsBindedNotWith ( Player const *  player) const

Definition at line 1672 of file Item.cpp.

1673{
1674 // not binded item
1675 if (!IsSoulBound())
1676 return false;
1677
1678 // own item
1679 if (GetOwnerGUID() == player->GetGUID())
1680 return false;
1681
1682 if (IsBOPTradeable())
1683 if (allowedGUIDs.find(player->GetGUID()) != allowedGUIDs.end())
1684 return false;
1685
1686 // BOA item case
1687 if (IsBoundAccountWide())
1688 return false;
1689
1690 return true;
1691}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBOPTradeable()

bool Item::IsBOPTradeable ( ) const
inline

Definition at line 249 of file Item.h.

bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:208
+ Here is the caller graph for this function:

◆ IsBoundAccountWide()

bool Item::IsBoundAccountWide ( ) const
inline

Definition at line 219 of file Item.h.

@ ITEM_FLAG_IS_BOUND_TO_ACCOUNT
Definition: ItemTemplate.h:203
+ Here is the caller graph for this function:

◆ IsBoundByEnchant()

bool Item::IsBoundByEnchant ( ) const

Definition at line 1358 of file Item.cpp.

1359{
1360 // Check all enchants for soulbound
1361 for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
1362 if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
1363 if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
1364 if (enchantEntry->GetFlags().HasFlag(SpellItemEnchantmentFlags::Soulbound))
1365 return true;
1366
1367 return false;
1368}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBroken()

bool Item::IsBroken ( ) const
inline

Definition at line 257 of file Item.h.

257{ return *m_itemData->MaxDurability > 0 && *m_itemData->Durability == 0; }
+ Here is the caller graph for this function:

◆ IsConjuredConsumable()

bool Item::IsConjuredConsumable ( ) const
inline

Definition at line 335 of file Item.h.

335{ return GetTemplate()->IsConjuredConsumable(); }
bool IsConjuredConsumable() const
Definition: ItemTemplate.h:856

◆ IsCurrencyToken()

bool Item::IsCurrencyToken ( ) const
inline

Definition at line 255 of file Item.h.

255{ return GetTemplate()->IsCurrencyToken(); }
bool IsCurrencyToken() const
Definition: ItemTemplate.h:845
+ Here is the caller graph for this function:

◆ IsEquipped()

bool Item::IsEquipped ( ) const

Definition at line 1244 of file Item.cpp.

1245{
1246 return !IsInBag() && (m_slot < EQUIPMENT_SLOT_END
1248}
@ EQUIPMENT_SLOT_END
Definition: Player.h:650
@ PROFESSION_SLOT_START
Definition: Player.h:668
@ PROFESSION_SLOT_END
Definition: Player.h:667
bool IsInBag() const
Definition: Item.h:287
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsFitToSpellRequirements()

bool Item::IsFitToSpellRequirements ( SpellInfo const *  spellInfo) const

Definition at line 1387 of file Item.cpp.

1388{
1389 ItemTemplate const* proto = GetTemplate();
1390
1391 bool isEnchantSpell = spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM) || spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) || spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC);
1392 if (spellInfo->EquippedItemClass != -1) // -1 == any item class
1393 {
1394 if (isEnchantSpell && proto->HasFlag(ITEM_FLAG3_CAN_STORE_ENCHANTS))
1395 return true;
1396
1397 if (spellInfo->EquippedItemClass != int32(proto->GetClass()))
1398 return false; // wrong item class
1399
1400 if (spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
1401 {
1402 if ((spellInfo->EquippedItemSubClassMask & (1 << proto->GetSubClass())) == 0)
1403 return false; // subclass not present in mask
1404 }
1405 }
1406
1407 if (isEnchantSpell && spellInfo->EquippedItemInventoryTypeMask != 0) // 0 == any inventory type
1408 {
1409 // Special case - accept weapon type for main and offhand requirements
1410 if (proto->GetInventoryType() == INVTYPE_WEAPON &&
1411 (spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
1412 spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
1413 return true;
1414 else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->GetInventoryType())) == 0)
1415 return false; // inventory type not present in mask
1416 }
1417
1418 return true;
1419}
@ ITEM_FLAG3_CAN_STORE_ENCHANTS
Definition: ItemTemplate.h:272
@ SPELL_EFFECT_ENCHANT_ITEM
@ SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
@ SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInBag()

bool Item::IsInBag ( ) const
inline

Definition at line 287 of file Item.h.

287{ return m_container != nullptr; }
+ Here is the caller graph for this function:

◆ IsInTrade()

bool Item::IsInTrade ( ) const
inline

Definition at line 262 of file Item.h.

262{ return mb_in_trade; }
+ Here is the caller graph for this function:

◆ IsInUpdateQueue()

bool Item::IsInUpdateQueue ( ) const
inline

Definition at line 324 of file Item.h.

324{ return uQueuePos != -1; }
+ Here is the caller graph for this function:

◆ IsLimitedToAnotherMapOrZone()

bool Item::IsLimitedToAnotherMapOrZone ( uint32  cur_mapId,
uint32  cur_zoneId 
) const

Definition at line 1596 of file Item.cpp.

1597{
1598 ItemTemplate const* proto = GetTemplate();
1599 return proto && ((proto->GetMap() && proto->GetMap() != cur_mapId) ||
1600 ((proto->GetArea(0) && proto->GetArea(0) != cur_zoneId) && (proto->GetArea(1) && proto->GetArea(1) != cur_zoneId)));
1601}
uint32 GetArea(uint32 index) const
Definition: ItemTemplate.h:812
uint32 GetMap() const
Definition: ItemTemplate.h:813
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsLocked()

bool Item::IsLocked ( ) const
inline

Definition at line 251 of file Item.h.

@ ITEM_FIELD_FLAG_UNLOCKED
Definition: ItemTemplate.h:133
+ Here is the caller graph for this function:

◆ IsNotEmptyBag()

bool Item::IsNotEmptyBag ( ) const

Definition at line 535 of file Item.cpp.

536{
537 if (Bag const* bag = ToBag())
538 return !bag->IsEmpty();
539 return false;
540}
Definition: Bag.h:27
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsPotion()

bool Item::IsPotion ( ) const
inline

Definition at line 333 of file Item.h.

333{ return GetTemplate()->IsPotion(); }
bool IsPotion() const
Definition: ItemTemplate.h:854
+ Here is the caller graph for this function:

◆ IsRangedWeapon()

bool Item::IsRangedWeapon ( ) const
inline

Definition at line 336 of file Item.h.

336{ return GetTemplate()->IsRangedWeapon(); }
bool IsRangedWeapon() const
Definition: ItemTemplate.h:863

◆ IsRefundable()

bool Item::IsRefundable ( ) const
inline

Definition at line 248 of file Item.h.

+ Here is the caller graph for this function:

◆ IsRefundExpired()

bool Item::IsRefundExpired ( )

Definition at line 1902 of file Item.cpp.

1903{
1904 return (GetPlayedTime() > 2*HOUR);
1905}
uint32 GetPlayedTime()
Definition: Item.cpp:1895
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsSoulBound()

bool Item::IsSoulBound ( ) const
inline

Definition at line 218 of file Item.h.

@ ITEM_FIELD_FLAG_SOULBOUND
Definition: ItemTemplate.h:131
+ Here is the caller graph for this function:

◆ IsValidTransmogrificationTarget()

bool Item::IsValidTransmogrificationTarget ( ) const

Definition at line 1939 of file Item.cpp.

1940{
1941 ItemTemplate const* proto = GetTemplate();
1942 if (!proto)
1943 return false;
1944
1945 if (proto->GetClass() != ITEM_CLASS_ARMOR &&
1946 proto->GetClass() != ITEM_CLASS_WEAPON)
1947 return false;
1948
1950 return false;
1951
1953 return false;
1954
1955 if (!HasStats())
1956 return false;
1957
1958 return true;
1959}
@ ITEM_FLAG2_NO_ALTER_ITEM_VISUAL
Definition: ItemTemplate.h:233
@ ITEM_SUBCLASS_WEAPON_FISHING_POLE
Definition: ItemTemplate.h:500
bool HasStats() const
Definition: Item.cpp:1961
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsVellum()

bool Item::IsVellum ( ) const
inline

Definition at line 334 of file Item.h.

334{ return GetTemplate()->IsVellum(); }
bool IsVellum() const
Definition: ItemTemplate.h:855
+ Here is the caller graph for this function:

◆ IsWrapped()

bool Item::IsWrapped ( ) const
inline

Definition at line 250 of file Item.h.

@ ITEM_FIELD_FLAG_WRAPPED
Definition: ItemTemplate.h:134
+ Here is the caller graph for this function:

◆ LoadArtifactData()

void Item::LoadArtifactData ( Player const *  owner,
uint64  xp,
uint32  artifactAppearanceId,
uint32  artifactTier,
std::vector< ArtifactPowerData > &  powers 
)

Definition at line 1003 of file Item.cpp.

1004{
1005 for (uint8 i = 0; i <= artifactTier; ++i)
1006 InitArtifactPowers(GetTemplate()->GetArtifactID(), i);
1007
1011
1012 if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifactAppearanceId))
1013 SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
1014
1015 uint8 totalPurchasedRanks = 0;
1016 for (ArtifactPowerData& power : powers)
1017 {
1018 power.CurrentRankWithBonus += power.PurchasedRank;
1019 totalPurchasedRanks += power.PurchasedRank;
1020
1021 ArtifactPowerEntry const* artifactPower = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
1023 {
1025 {
1026 for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
1027 {
1028 switch (enchant->Effect[i])
1029 {
1031 if (uint32(artifactPower->Label) == enchant->EffectArg[i])
1032 power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1033 break;
1035 if (artifactPower->ID == enchant->EffectArg[i])
1036 power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1037 break;
1040 {
1041 if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
1042 {
1043 PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
1044 if (!playerCondition || (owner && sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition)))
1045 if (artifactPower->Label == _bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT])
1046 power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1047 }
1048 }
1049 break;
1050 default:
1051 break;
1052 }
1053 }
1054 }
1055 }
1056
1057 SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, power.CurrentRankWithBonus);
1058 }
1059
1060 for (ArtifactPowerData& power : powers)
1061 {
1062 ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
1063 if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
1064 continue;
1065
1066 SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, totalPurchasedRanks + 1);
1067 }
1068
1070}
@ ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS
Definition: DBCEnums.h:191
void SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus)
Definition: Item.cpp:2599
UpdateField< uint64, 0, 15 > ArtifactXP
Definition: UpdateFields.h:134
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadFromDB()

bool Item::LoadFromDB ( ObjectGuid::LowType  guid,
ObjectGuid  ownerGuid,
Field fields,
uint32  entry 
)
virtual

Reimplemented in Bag.

Definition at line 828 of file Item.cpp.

829{
830 // 0 1 2 3 4 5 6 7 8 9 10 11 12
831 // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomBonusListId, durability, playedTime, text,
832 // 13 14 15 16 17 18
833 // battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs,
834 // 19 20 21 22 23 24
835 // itemModifiedAppearanceAllSpecs, itemModifiedAppearanceSpec1, itemModifiedAppearanceSpec2, itemModifiedAppearanceSpec3, itemModifiedAppearanceSpec4, itemModifiedAppearanceSpec5,
836 // 25 26 27 28 29 30
837 // spellItemEnchantmentAllSpecs, spellItemEnchantmentSpec1, spellItemEnchantmentSpec2, spellItemEnchantmentSpec3, spellItemEnchantmentSpec4, spellItemEnchantmentSpec5,
838 // 31 32 33
839 // secondaryItemModifiedAppearanceAllSpecs, secondaryItemModifiedAppearanceSpec1, secondaryItemModifiedAppearanceSpec2,
840 // 34 35 36
841 // secondaryItemModifiedAppearanceSpec3, secondaryItemModifiedAppearanceSpec4, secondaryItemModifiedAppearanceSpec5,
842 // 37 38 39 40 41 42 43 44 45 46 47 48
843 // gemItemId1, gemBonuses1, gemContext1, gemScalingLevel1, gemItemId2, gemBonuses2, gemContext2, gemScalingLevel2, gemItemId3, gemBonuses3, gemContext3, gemScalingLevel3
844 // 49 50
845 // fixedScalingLevel, artifactKnowledgeLevel FROM item_instance
846
847 // create item before any checks for store correct guid
848 // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
849 Object::_Create(ObjectGuid::Create<HighGuid::Item>(guid));
850
851 // Set entry, MUST be before proto check
852 SetEntry(entry);
853 SetObjectScale(1.0f);
854
855 ItemTemplate const* proto = GetTemplate();
856 if (!proto)
857 {
858 TC_LOG_ERROR("entities.item", "Invalid entry {} for item {}. Refusing to load.", GetEntry(), GetGUID().ToString());
859 return false;
860 }
861
862 _bonusData.Initialize(proto);
863
864 // set owner (not if item is only loaded for gbank/auction/mail
865 if (!ownerGuid.IsEmpty())
866 SetOwnerGUID(ownerGuid);
867
868 uint32 itemFlags = fields[7].GetUInt32();
869 bool need_save = false; // need explicit save data at load fixes
870 if (uint64 creator = fields[2].GetUInt64())
871 {
872 if (!(itemFlags & ITEM_FIELD_FLAG_CHILD))
873 SetCreator(ObjectGuid::Create<HighGuid::Player>(creator));
874 else
875 SetCreator(ObjectGuid::Create<HighGuid::Item>(creator));
876 }
877 if (uint64 giftCreator = fields[3].GetUInt64())
878 SetGiftCreator(ObjectGuid::Create<HighGuid::Player>(giftCreator));
879 SetCount(fields[4].GetUInt32());
880
881 uint32 duration = fields[5].GetUInt32();
882 SetExpiration(duration);
883 // update duration if need, and remove if not need
884 if ((proto->GetDuration() == 0) != (duration == 0))
885 {
886 SetExpiration(proto->GetDuration());
887 need_save = true;
888 }
889
891
892 uint32 durability = fields[10].GetUInt16();
893 SetDurability(durability);
894 // update max durability (and durability) if need
896
897 // do not overwrite durability for wrapped items
898 if (durability > proto->MaxDurability && !IsWrapped())
899 {
901 need_save = true;
902 }
903
904 SetCreatePlayedTime(fields[11].GetUInt32());
905 SetText(fields[12].GetString());
906
907 SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[13].GetUInt32());
908 SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[14].GetUInt32());
909 SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[15].GetUInt16());
910 SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[16].GetUInt32());
911
912 SetContext(ItemContext(fields[17].GetUInt8()));
913
914 std::vector<std::string_view> bonusListString = Trinity::Tokenize(fields[18].GetStringView(), ' ', false);
915 std::vector<int32> bonusListIDs;
916 bonusListIDs.reserve(bonusListString.size());
917 for (std::string_view token : bonusListString)
918 if (Optional<int32> bonusListID = Trinity::StringTo<int32>(token))
919 bonusListIDs.push_back(*bonusListID);
920 SetBonuses(std::move(bonusListIDs));
921
922 // load charges after bonuses, they can add more item effects
923 std::vector<std::string_view> tokens = Trinity::Tokenize(fields[6].GetStringView(), ' ', false);
924 for (uint8 i = 0; i < m_itemData->SpellCharges.size() && i < _bonusData.EffectCount && i < tokens.size(); ++i)
925 SetSpellCharges(i, Trinity::StringTo<int32>(tokens[i]).value_or(0));
926
933
935 SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1, fields[26].GetUInt32());
936 SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2, fields[27].GetUInt32());
937 SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3, fields[28].GetUInt32());
938 SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4, fields[29].GetUInt32());
939 SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_5, fields[30].GetUInt32());
940
947
948 uint32 const gemFields = 4;
950 memset(gemData, 0, sizeof(gemData));
951 for (uint32 i = 0; i < MAX_GEM_SOCKETS; ++i)
952 {
953 gemData[i].ItemId = fields[37 + i * gemFields].GetUInt32();
954 std::vector<std::string_view> gemBonusListIDs = Trinity::Tokenize(fields[38 + i * gemFields].GetStringView(), ' ', false);
955 uint32 b = 0;
956 for (std::string_view token : gemBonusListIDs)
957 if (Optional<uint16> bonusListID = Trinity::StringTo<uint16>(token))
958 gemData[i].BonusListIDs[b++] = *bonusListID;
959
960 gemData[i].Context = fields[39 + i * gemFields].GetUInt8();
961 if (gemData[i].ItemId)
962 SetGem(i, &gemData[i], fields[40 + i * gemFields].GetUInt32());
963 }
964
965 SetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL, fields[49].GetUInt32());
967
968 // Enchants must be loaded after all other bonus/scaling data
969 std::vector<std::string_view> enchantmentTokens = Trinity::Tokenize(fields[8].GetStringView(), ' ', false);
970 if (enchantmentTokens.size() == MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET)
971 {
972 for (uint32 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
973 {
974 auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, i);
975 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), Trinity::StringTo<int32>(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 0]).value_or(0));
976 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), Trinity::StringTo<uint32>(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 1]).value_or(0));
977 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), Trinity::StringTo<int16>(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 2]).value_or(0));
978 }
979 }
980 m_randomBonusListId = fields[9].GetUInt32();
981
982 // Remove bind flag for items vs BIND_NONE set
983 if (IsSoulBound() && GetBonding() == BIND_NONE)
984 {
986 need_save = true;
987 }
988
989 if (need_save) // normal item changed state set not work at loading
990 {
991 uint8 index = 0;
993 stmt->setUInt32(index++, m_itemData->Expiration);
994 stmt->setUInt32(index++, m_itemData->DynamicFlags);
995 stmt->setUInt32(index++, m_itemData->Durability);
996 stmt->setUInt64(index++, guid);
997 CharacterDatabase.Execute(stmt);
998 }
999
1000 return true;
1001}
@ CHAR_UPD_ITEM_INSTANCE_ON_LOAD
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_3
Definition: ItemDefines.h:245
@ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_5
Definition: ItemDefines.h:238
@ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2
Definition: ItemDefines.h:223
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_4
Definition: ItemDefines.h:246
@ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1
Definition: ItemDefines.h:221
@ ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID
Definition: ItemDefines.h:217
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_5
Definition: ItemDefines.h:247
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4
Definition: ItemDefines.h:226
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_5
Definition: ItemDefines.h:236
@ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4
Definition: ItemDefines.h:227
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_1
Definition: ItemDefines.h:243
@ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3
Definition: ItemDefines.h:225
@ ITEM_MODIFIER_BATTLE_PET_BREED_DATA
Definition: ItemDefines.h:215
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2
Definition: ItemDefines.h:222
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3
Definition: ItemDefines.h:224
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_2
Definition: ItemDefines.h:244
@ ITEM_MODIFIER_BATTLE_PET_SPECIES_ID
Definition: ItemDefines.h:214
@ ITEM_MODIFIER_BATTLE_PET_LEVEL
Definition: ItemDefines.h:216
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1
Definition: ItemDefines.h:212
@ ITEM_FIELD_FLAG_CHILD
Definition: ItemTemplate.h:150
@ BIND_NONE
Definition: ItemTemplate.h:116
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:50
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
uint8 GetUInt8() const
Definition: Field.cpp:30
uint16 GetUInt16() const
Definition: Field.cpp:46
uint32 GetUInt32() const
Definition: Field.cpp:62
bool IsWrapped() const
Definition: Item.h:250
void SetText(std::string const &text)
Definition: Item.h:305
ItemBondingType GetBonding() const
Definition: Item.h:200
void SetGem(uint16 slot, ItemDynamicFieldGems const *gem, uint32 gemScalingLevel)
Definition: Item.cpp:1487
bool IsEmpty() const
Definition: ObjectGuid.h:317
void setUInt32(const uint8 index, const uint32 value)
std::string ToString(Type &&val, Params &&... params)
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Util.cpp:56
uint16 BonusListIDs[16]
Definition: Item.h:163
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveFromObjectUpdate()

void Item::RemoveFromObjectUpdate ( )
overridevirtual

Implements Object.

Definition at line 1808 of file Item.cpp.

1809{
1810 if (Player* owner = GetOwner())
1811 owner->GetMap()->RemoveUpdateObject(this);
1812}
+ Here is the call graph for this function:

◆ RemoveItemFlag()

void Item::RemoveItemFlag ( ItemFieldFlags  flags)
inline

Definition at line 210 of file Item.h.

void RemoveUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:286
UpdateField< uint32, 0, 9 > DynamicFlags
Definition: UpdateFields.h:128
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveItemFlag2()

void Item::RemoveItemFlag2 ( ItemFieldFlags2  flags)
inline

Definition at line 215 of file Item.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReplaceAllItemFlags()

void Item::ReplaceAllItemFlags ( ItemFieldFlags  flags)
inline

Definition at line 211 of file Item.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReplaceAllItemFlags2()

void Item::ReplaceAllItemFlags2 ( ItemFieldFlags2  flags)
inline

Definition at line 216 of file Item.h.

+ Here is the call graph for this function:

◆ SaveRefundDataToDB()

void Item::SaveRefundDataToDB ( )

Definition at line 1814 of file Item.cpp.

1815{
1816 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
1817
1819 stmt->setUInt64(0, GetGUID().GetCounter());
1820 trans->Append(stmt);
1821
1822 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE);
1823 stmt->setUInt64(0, GetGUID().GetCounter());
1824 stmt->setUInt64(1, GetRefundRecipient().GetCounter());
1825 stmt->setUInt64(2, GetPaidMoney());
1827 trans->Append(stmt);
1828
1829 CharacterDatabase.CommitTransaction(trans);
1830}
@ CHAR_INS_ITEM_REFUND_INSTANCE
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
uint32 GetPaidExtendedCost() const
Definition: Item.h:364
uint64 GetPaidMoney() const
Definition: Item.h:363
ObjectGuid const & GetRefundRecipient() const
Definition: Item.h:362
void setUInt16(const uint8 index, const uint16 value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SaveToDB()

void Item::SaveToDB ( CharacterDatabaseTransaction  trans)
virtual

Reimplemented in AzeriteEmpoweredItem, AzeriteItem, and Bag.

Definition at line 561 of file Item.cpp.

562{
563 bool isInTransaction = bool(trans);
564 if (!isInTransaction)
565 trans = CharacterDatabase.BeginTransaction();
566
567 switch (uState)
568 {
569 case ITEM_NEW:
570 case ITEM_CHANGED:
571 {
572 uint8 index = 0;
574 stmt->setUInt32( index, GetEntry());
575 stmt->setUInt64(++index, GetOwnerGUID().GetCounter());
576 stmt->setUInt64(++index, GetCreator().GetCounter());
577 stmt->setUInt64(++index, GetGiftCreator().GetCounter());
578 stmt->setUInt32(++index, GetCount());
579 stmt->setUInt32(++index, m_itemData->Expiration);
580
581 std::ostringstream ssSpells;
582 for (uint8 i = 0; i < m_itemData->SpellCharges.size() && i < _bonusData.EffectCount; ++i)
583 ssSpells << GetSpellCharges(i) << ' ';
584 stmt->setString(++index, ssSpells.str());
585
586 stmt->setUInt32(++index, m_itemData->DynamicFlags);
587
588 std::ostringstream ssEnchants;
589 for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
590 {
592 enchantment && !enchantment->GetFlags().HasFlag(SpellItemEnchantmentFlags::DoNotSaveToDB))
593 {
594 ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' ';
595 ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
596 ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
597 }
598 else
599 {
600 ssEnchants << "0 0 0 ";
601 }
602 }
603 stmt->setString(++index, ssEnchants.str());
604
605 stmt->setUInt32(++index, m_randomBonusListId);
606 stmt->setUInt16(++index, m_itemData->Durability);
607 stmt->setUInt32(++index, m_itemData->CreatePlayedTime);
608 stmt->setString(++index, m_text);
613 stmt->setUInt8(++index, uint8(m_itemData->Context));
614
615 std::ostringstream bonusListIDs;
616 for (int32 bonusListID : GetBonusListIDs())
617 bonusListIDs << bonusListID << ' ';
618 stmt->setString(++index, bonusListIDs.str());
619
620 stmt->setUInt64(++index, GetGUID().GetCounter());
621
622 trans->Append(stmt);
623
624 if ((uState == ITEM_CHANGED) && IsWrapped())
625 {
626 stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
627 stmt->setUInt64(0, GetOwnerGUID().GetCounter());
628 stmt->setUInt64(1, GetGUID().GetCounter());
629 trans->Append(stmt);
630 }
631
632 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
633 stmt->setUInt64(0, GetGUID().GetCounter());
634 trans->Append(stmt);
635
636 if (m_itemData->Gems.size())
637 {
638 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_GEMS);
639 stmt->setUInt64(0, GetGUID().GetCounter());
640 uint32 i = 0;
641 uint32 const gemFields = 4;
642 for (UF::SocketedGem const& gemData : m_itemData->Gems)
643 {
644 if (gemData.ItemID)
645 {
646 stmt->setUInt32(1 + i * gemFields, gemData.ItemID);
647 std::ostringstream gemBonusListIDs;
648 for (uint16 bonusListID : gemData.BonusListIDs)
649 if (bonusListID)
650 gemBonusListIDs << bonusListID << ' ';
651 stmt->setString(2 + i * gemFields, gemBonusListIDs.str());
652 stmt->setUInt8(3 + i * gemFields, gemData.Context);
653 stmt->setUInt32(4 + i * gemFields, m_gemScalingLevels[i]);
654 }
655 else
656 {
657 stmt->setUInt32(1 + i * gemFields, 0);
658 stmt->setString(2 + i * gemFields, "");
659 stmt->setUInt8(3 + i * gemFields, 0);
660 stmt->setUInt32(4 + i * gemFields, 0);
661 }
662 ++i;
663 }
664 for (; i < MAX_GEM_SOCKETS; ++i)
665 {
666 stmt->setUInt32(1 + i * gemFields, 0);
667 stmt->setString(2 + i * gemFields, "");
668 stmt->setUInt8(3 + i * gemFields, 0);
669 stmt->setUInt32(4 + i * gemFields, 0);
670 }
671 trans->Append(stmt);
672 }
673
674 static ItemModifier const transmogMods[18] =
675 {
682
689
696 };
697
698 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
699 stmt->setUInt64(0, GetGUID().GetCounter());
700 trans->Append(stmt);
701
702 if (std::find_if(std::begin(transmogMods), std::end(transmogMods), [this](ItemModifier modifier) { return GetModifier(modifier) != 0; }) != std::end(transmogMods))
703 {
704 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_TRANSMOG);
705 stmt->setUInt64(0, GetGUID().GetCounter());
724 trans->Append(stmt);
725 }
726
727 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
728 stmt->setUInt64(0, GetGUID().GetCounter());
729 trans->Append(stmt);
730
732 stmt->setUInt64(0, GetGUID().GetCounter());
733 trans->Append(stmt);
734
735 if (GetTemplate()->GetArtifactID())
736 {
737 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT);
738 stmt->setUInt64(0, GetGUID().GetCounter());
739 stmt->setUInt64(1, m_itemData->ArtifactXP);
742 trans->Append(stmt);
743
744 for (UF::ArtifactPower const& artifactPower : m_itemData->ArtifactPowers)
745 {
747 stmt->setUInt64(0, GetGUID().GetCounter());
748 stmt->setUInt32(1, artifactPower.ArtifactPowerID);
749 stmt->setUInt8(2, artifactPower.PurchasedRank);
750 trans->Append(stmt);
751 }
752 }
753
754 static ItemModifier const modifiersTable[] =
755 {
758 };
759
760 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
761 stmt->setUInt64(0, GetGUID().GetCounter());
762 trans->Append(stmt);
763
764 if (std::find_if(std::begin(modifiersTable), std::end(modifiersTable), [this](ItemModifier modifier) { return GetModifier(modifier) != 0; }) != std::end(modifiersTable))
765 {
766 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_MODIFIERS);
767 stmt->setUInt64(0, GetGUID().GetCounter());
770 trans->Append(stmt);
771 }
772
773 break;
774 }
775 case ITEM_REMOVED:
776 {
778 stmt->setUInt64(0, GetGUID().GetCounter());
779 trans->Append(stmt);
780
781 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
782 stmt->setUInt64(0, GetGUID().GetCounter());
783 trans->Append(stmt);
784
785 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
786 stmt->setUInt64(0, GetGUID().GetCounter());
787 trans->Append(stmt);
788
789 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
790 stmt->setUInt64(0, GetGUID().GetCounter());
791 trans->Append(stmt);
792
794 stmt->setUInt64(0, GetGUID().GetCounter());
795 trans->Append(stmt);
796
797 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
798 stmt->setUInt64(0, GetGUID().GetCounter());
799 trans->Append(stmt);
800
801 if (IsWrapped())
802 {
803 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
804 stmt->setUInt64(0, GetGUID().GetCounter());
805 trans->Append(stmt);
806 }
807
808 if (!isInTransaction)
809 CharacterDatabase.CommitTransaction(trans);
810
811 // Delete the items if this is a container
812 if (m_loot && !m_loot->isLooted())
813 sLootItemStorage->RemoveStoredLootForContainer(GetGUID().GetCounter());
814
815 delete this;
816 return;
817 }
818 case ITEM_UNCHANGED:
819 break;
820 }
821
823
824 if (!isInTransaction)
825 CharacterDatabase.CommitTransaction(trans);
826}
@ CHAR_UPD_ITEM_INSTANCE
@ CHAR_INS_ITEM_INSTANCE_ARTIFACT_POWERS
@ CHAR_INS_ITEM_INSTANCE_MODIFIERS
@ CHAR_INS_ITEM_INSTANCE_TRANSMOG
@ CHAR_INS_ITEM_INSTANCE_ARTIFACT
@ CHAR_UPD_GIFT_OWNER
@ CHAR_INS_ITEM_INSTANCE_GEMS
@ CHAR_REP_ITEM_INSTANCE
ItemModifier
Definition: ItemDefines.h:210
@ ITEM_REMOVED
Definition: Item.h:57
@ ITEM_UNCHANGED
Definition: Item.h:54
int32 GetSpellCharges(uint8 index=0) const
Definition: Item.h:314
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:299
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:300
LowType GetCounter() const
Definition: ObjectGuid.h:291
void setUInt8(const uint8 index, const uint8 value)
void setString(const uint8 index, const std::string &value)
UpdateFieldArray< uint16, 16, 3, 4 > BonusListIDs
Definition: UpdateFields.h:111
UpdateField< uint8, 0, 2 > Context
Definition: UpdateFields.h:110
UpdateField< int32, 0, 1 > ItemID
Definition: UpdateFields.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendTimeUpdate()

void Item::SendTimeUpdate ( Player owner)

Definition at line 1613 of file Item.cpp.

1614{
1615 uint32 duration = m_itemData->Expiration;
1616 if (!duration)
1617 return;
1618
1620 itemTimeUpdate.ItemGuid = GetGUID();
1621 itemTimeUpdate.DurationLeft = duration;
1622 owner->GetSession()->SendPacket(itemTimeUpdate.Write());
1623}
WorldPacket const * Write() override
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendUpdateSockets()

void Item::SendUpdateSockets ( )

Definition at line 1603 of file Item.cpp.

1604{
1606 socketGems.Item = GetGUID();
1607 GetOwner()->GetSession()->SendPacket(socketGems.Write());
1608}
WorldPacket const * Write() override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAppearanceModId()

void Item::SetAppearanceModId ( uint32  appearanceModId)
inline

Definition at line 346 of file Item.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetArtifactPower()

void Item::SetArtifactPower ( uint16  artifactPowerId,
uint8  purchasedRank,
uint8  currentRankWithBonus 
)

Definition at line 2599 of file Item.cpp.

2600{
2601 auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
2602 if (indexItr != m_artifactPowerIdToIndex.end())
2603 {
2605 .ModifyValue(&UF::ItemData::ArtifactPowers, indexItr->second)
2606 .ModifyValue(&UF::ArtifactPower::PurchasedRank), purchasedRank);
2607
2609 .ModifyValue(&UF::ItemData::ArtifactPowers, indexItr->second)
2610 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), currentRankWithBonus);
2611 }
2612}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetArtifactXP()

void Item::SetArtifactXP ( uint64  xp)
inline

Definition at line 438 of file Item.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetBinding()

void Item::SetBinding ( bool  val)
inline

Definition at line 201 of file Item.h.

202 {
203 if (val)
205 else
207 }
void SetItemFlag(ItemFieldFlags flags)
Definition: Item.h:209
+ Here is the caller graph for this function:

◆ SetBonuses()

void Item::SetBonuses ( std::vector< int32 bonusListIDs)

Definition at line 2549 of file Item.cpp.

2550{
2552 itemBonusKey.ItemID = GetEntry();
2553 itemBonusKey.BonusListIDs = std::move(bonusListIDs);
2555
2556 for (int32 bonusListID : GetBonusListIDs())
2557 _bonusData.AddBonusList(bonusListID);
2558
2560}
void AddBonusList(uint32 bonusListId)
Definition: Item.cpp:2898
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChildItem()

void Item::SetChildItem ( ObjectGuid  childItem)
inline

Definition at line 424 of file Item.h.

424{ m_childItem = childItem; }
+ Here is the caller graph for this function:

◆ SetContainedIn()

void Item::SetContainedIn ( ObjectGuid  guid)
inline

Definition at line 191 of file Item.h.

UpdateField< ObjectGuid, 0, 4 > ContainedIn
Definition: UpdateFields.h:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetContainer()

void Item::SetContainer ( Bag container)
inline

Definition at line 285 of file Item.h.

285{ m_container = container; }
+ Here is the caller graph for this function:

◆ SetContext()

void Item::SetContext ( ItemContext  context)
inline

Definition at line 442 of file Item.h.

UpdateField< int32, 0, 13 > Context
Definition: UpdateFields.h:132
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCount()

void Item::SetCount ( uint32  value)

Definition at line 1275 of file Item.cpp.

1276{
1278
1279 if (Player* player = GetOwner())
1280 {
1281 if (TradeData* tradeData = player->GetTradeData())
1282 {
1283 TradeSlots slot = tradeData->GetTradeSlotForItem(GetGUID());
1284
1285 if (slot != TRADE_SLOT_INVALID)
1286 tradeData->SetItem(slot, this, true);
1287 }
1288 }
1289}
TradeSlots
Definition: TradeData.h:24
@ TRADE_SLOT_INVALID
Definition: TradeData.h:28
UpdateField< uint32, 0, 7 > StackCount
Definition: UpdateFields.h:126
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCreatePlayedTime()

void Item::SetCreatePlayedTime ( uint32  createPlayedTime)
inline

Definition at line 311 of file Item.h.

UpdateField< uint32, 0, 12 > CreatePlayedTime
Definition: UpdateFields.h:131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetCreator()

void Item::SetCreator ( ObjectGuid  guid)
inline

Definition at line 193 of file Item.h.

UpdateField< ObjectGuid, 0, 5 > Creator
Definition: UpdateFields.h:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDurability()

void Item::SetDurability ( uint32  durability)
inline

Definition at line 258 of file Item.h.

UpdateField< uint32, 0, 10 > Durability
Definition: UpdateFields.h:129
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetEnchantment()

void Item::SetEnchantment ( EnchantmentSlot  slot,
uint32  id,
uint32  duration,
uint32  charges,
ObjectGuid  caster = ObjectGuid::Empty 
)

Definition at line 1421 of file Item.cpp.

1422{
1423 // Better lost small time at check in comparison lost time at item save to DB.
1424 if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
1425 return;
1426
1427 Player* owner =