TrinityCore
Loading...
Searching...
No Matches
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
 
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)
 
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
 
void ApplyBonusList (uint32 itemBonusListId)
 
- 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)
 

Constructor & Destructor Documentation

◆ Item()

Item::Item ( )
444{
447
448 m_slot = 0;
450 uQueuePos = -1;
451 m_container = nullptr;
452 m_lootGenerated = false;
453 mb_in_trade = false;
455
456 m_paidMoney = 0;
458
460 m_gemScalingLevels = { };
461
462 memset(&_bonusData, 0, sizeof(_bonusData));
463}
@ ITEM_NEW
Definition: Item.h:56
@ TYPEID_ITEM
Definition: ObjectGuid.h:34
@ TYPEMASK_ITEM
Definition: ObjectGuid.h:54
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:385
TypeID m_objectTypeId
Definition: Object.h:387
time_t GetGameTime()
Definition: GameTime.cpp:39
+ Here is the call graph for this function:

◆ ~Item()

Item::~Item ( )
default

Member Function Documentation

◆ AddArtifactPower()

void Item::AddArtifactPower ( ArtifactPowerData const *  artifactPower)
2569{
2570 uint16 index = uint16(m_artifactPowerIdToIndex.size());
2571 m_artifactPowerIdToIndex[artifactPower->ArtifactPowerId] = index;
2572
2574 powerField.ArtifactPowerID = artifactPower->ArtifactPowerId;
2575 powerField.PurchasedRank = artifactPower->PurchasedRank;
2576 powerField.CurrentRankWithBonus = artifactPower->CurrentRankWithBonus;
2577}
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:448
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue(UF::DynamicUpdateFieldSetter< T > setter)
Definition: Object.h:292
UF::UpdateFieldHolder m_values
Definition: Object.h:252
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:673
Definition: UpdateFields.h:96
uint8 PurchasedRank
Definition: UpdateFields.h:98
int16 ArtifactPowerID
Definition: UpdateFields.h:97
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)
2512{
2513 if (std::find(GetBonusListIDs().begin(), GetBonusListIDs().end(), int32(bonusListID)) != GetBonusListIDs().end())
2514 return;
2515
2516 if (DB2Manager::ItemBonusList const* bonuses = sDB2Manager.GetItemBonusList(bonusListID))
2517 {
2519 itemBonusKey.ItemID = GetEntry();
2520 itemBonusKey.BonusListIDs = GetBonusListIDs();
2521 itemBonusKey.BonusListIDs.push_back(bonusListID);
2523 for (ItemBonusEntry const* bonus : *bonuses)
2524 _bonusData.AddBonus(bonus->Type, bonus->Value);
2526 }
2527}
#define sDB2Manager
Definition: DB2Stores.h:502
int32_t int32
Definition: Define.h:139
std::vector< ItemBonusEntry const * > ItemBonusList
Definition: DB2Stores.h:371
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:271
uint32 GetEntry() const
Definition: Object.h:159
void AddBonus(uint32 type, std::array< int32, 4 > const &values)
Definition: Item.cpp:2885
uint32 AppearanceModID
Definition: Item.h:78
Definition: DB2Structure.h:2048
UpdateField< WorldPackets::Item::ItemBonusKey, 0, 19 > ItemBonusKey
Definition: UpdateFields.h:138
UpdateField< uint8, 0, 16 > ItemAppearanceModID
Definition: UpdateFields.h:135
Definition: ItemPacketsCommon.h:86
int32 ItemID
Definition: ItemPacketsCommon.h:87
std::vector< int32 > BonusListIDs
Definition: ItemPacketsCommon.h:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToObjectUpdate()

bool Item::AddToObjectUpdate ( )
overridevirtual

Implements Object.

1788{
1789 if (Player* owner = GetOwner())
1790 {
1791 owner->GetMap()->AddUpdateObject(this);
1792 return true;
1793 }
1794
1795 return false;
1796}
Player * GetOwner() const
Definition: Item.cpp:1145
Definition: Player.h:1125
+ Here is the call graph for this function:

◆ ApplyArtifactPowerEnchantmentBonuses()

void Item::ApplyArtifactPowerEnchantmentBonuses ( EnchantmentSlot  slot,
uint32  enchantId,
bool  apply,
Player owner 
)
2645{
2646 if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
2647 {
2648 for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
2649 {
2650 switch (enchant->Effect[i])
2651 {
2653 for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
2654 {
2655 UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
2656 if (uint32(sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label) == enchant->EffectArg[i])
2657 {
2658 uint8 newRank = artifactPower.CurrentRankWithBonus;
2659 if (apply)
2660 newRank += enchant->EffectPointsMin[i];
2661 else
2662 newRank -= enchant->EffectPointsMin[i];
2663
2665 .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
2666 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2667
2668 if (IsEquipped())
2669 if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0))
2670 owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2671 }
2672 }
2673 break;
2675 {
2676 if (uint16 const* artifactPowerIndex = Trinity::Containers::MapGetValuePtr(m_artifactPowerIdToIndex, enchant->EffectArg[i]))
2677 {
2678 uint8 newRank = m_itemData->ArtifactPowers[*artifactPowerIndex].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(m_itemData->ArtifactPowers[*artifactPowerIndex].ArtifactPowerID, newRank ? newRank - 1 : 0))
2690 owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2691 }
2692 break;
2693 }
2696 {
2697 if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
2698 {
2699 PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
2700 if (!playerCondition || sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
2701 {
2702 for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
2703 {
2704 UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
2705 if (sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label == _bonusData.GemRelicType[slot - SOCK_ENCHANTMENT_SLOT])
2706 {
2707 uint8 newRank = artifactPower.CurrentRankWithBonus;
2708 if (apply)
2709 newRank += enchant->EffectPointsMin[i];
2710 else
2711 newRank -= enchant->EffectPointsMin[i];
2712
2714 .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
2715 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2716
2717 if (IsEquipped())
2718 if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0))
2719 owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2720 }
2721 }
2722 }
2723 }
2724 }
2725 break;
2726 default:
2727 break;
2728 }
2729 }
2730 }
2731}
#define sConditionMgr
Definition: ConditionMgr.h:351
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 MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DB2Structure.h:3495
@ ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_TYPE
Definition: DBCEnums.h:869
@ ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_BY_ID
Definition: DBCEnums.h:870
@ ITEM_ENCHANTMENT_TYPE_ARTIFACT_POWER_BONUS_RANK_PICKER
Definition: DBCEnums.h:873
uint8_t uint8
Definition: Define.h:145
uint32_t uint32
Definition: Define.h:143
@ SOCK_ENCHANTMENT_SLOT_3
Definition: ItemDefines.h:179
@ SOCK_ENCHANTMENT_SLOT
Definition: ItemDefines.h:177
bool IsEquipped() const
Definition: Item.cpp:1243
void ApplyArtifactPowerRank(Item *artifact, ArtifactPowerRankEntry const *artifactPowerRank, bool apply)
Definition: Player.cpp:8375
auto MapGetValuePtr(M &map, typename M::key_type const &key)
Definition: MapUtils.h:29
Definition: DB2Structure.h:273
Definition: DB2Structure.h:279
int32 GemRelicType[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:84
Definition: DB2Structure.h:2870
Definition: DB2Structure.h:3498
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ApplyBonusList()

void Item::ApplyBonusList ( uint32  itemBonusListId)
protected

◆ BuildUpdate()

void Item::BuildUpdate ( UpdateDataMapType data_map)
overridevirtual

Reimplemented from Object.

1684{
1685 if (Player* owner = GetOwner())
1686 BuildFieldsUpdate(owner, data_map);
1687 ClearUpdateMask(false);
1688}
void ClearUpdateMask(bool remove) override
Definition: Item.cpp:1781
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition: Object.cpp:791
+ Here is the call graph for this function:

◆ BuildValuesCreate()

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

Implements Object.

1699{
1701 std::size_t sizePos = data->wpos();
1702 *data << uint32(0);
1703 *data << uint8(flags);
1704 m_objectData->WriteCreate(*data, flags, this, target);
1705 m_itemData->WriteCreate(*data, flags, this, target);
1706 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1707}
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:1690
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:253
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.

1710{
1712 std::size_t sizePos = data->wpos();
1713 *data << uint32(0);
1715
1717 m_objectData->WriteUpdate(*data, flags, this, target);
1718
1720 m_itemData->WriteUpdate(*data, flags, this, target);
1721
1722 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1723}
@ TYPEID_OBJECT
Definition: ObjectGuid.h:33
bool HasChanged(uint32 index) const
Definition: UpdateField.h:691
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:686
+ 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
1743{
1746 if (requestedObjectMask.IsAnySet())
1747 valuesMask.Set(TYPEID_OBJECT);
1748
1749 UF::ItemData::Mask itemMask = requestedItemMask;
1750 m_itemData->FilterDisallowedFieldsMaskForFlag(itemMask, flags);
1751 if (itemMask.IsAnySet())
1752 valuesMask.Set(TYPEID_ITEM);
1753
1754 ByteBuffer& buffer = PrepareValuesUpdateBuffer(data);
1755 std::size_t sizePos = buffer.wpos();
1756 buffer << uint32(0);
1757 buffer << uint32(valuesMask.GetBlock(0));
1758
1759 if (valuesMask[TYPEID_OBJECT])
1760 m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
1761
1762 if (valuesMask[TYPEID_ITEM])
1763 m_itemData->WriteUpdate(buffer, itemMask, true, this, target);
1764
1765 buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
1766
1767 data->AddUpdateBlock();
1768}
Definition: ByteBuffer.h:62
ByteBuffer & PrepareValuesUpdateBuffer(UpdateData *data) const
Definition: Object.cpp:218
void AddUpdateBlock()
Definition: UpdateData.h:49
Definition: UpdateMask.h:32
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.

1726{
1728 valuesMask.Set(TYPEID_ITEM);
1729
1730 std::size_t sizePos = data->wpos();
1731 *data << uint32(0);
1732 *data << uint32(valuesMask.GetBlock(0));
1733
1734 UF::ItemData::Mask mask;
1735 m_itemData->AppendAllowedFieldsMaskForFlag(mask, flags);
1736 m_itemData->WriteUpdate(*data, mask, true, this, target);
1737
1738 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1739}
+ Here is the call graph for this function:

◆ CalculateDurabilityRepairCost()

uint64 Item::CalculateDurabilityRepairCost ( float  discount) const
1291{
1292 uint32 maxDurability = m_itemData->MaxDurability;
1293 if (!maxDurability)
1294 return 0;
1295
1296 uint32 curDurability = m_itemData->Durability;
1297 ASSERT(maxDurability >= curDurability);
1298
1299 uint32 lostDurability = maxDurability - curDurability;
1300 if (!lostDurability)
1301 return 0;
1302
1303 ItemTemplate const* itemTemplate = GetTemplate();
1304
1305 DurabilityCostsEntry const* durabilityCost = sDurabilityCostsStore.LookupEntry(GetItemLevel(GetOwner()));
1306 if (!durabilityCost)
1307 return 0;
1308
1309 uint32 durabilityQualityEntryId = (GetQuality() + 1) * 2;
1310 DurabilityQualityEntry const* durabilityQualityEntry = sDurabilityQualityStore.LookupEntry(durabilityQualityEntryId);
1311 if (!durabilityQualityEntry)
1312 return 0;
1313
1314 uint32 dmultiplier = 0;
1315 if (itemTemplate->GetClass() == ITEM_CLASS_WEAPON)
1316 dmultiplier = durabilityCost->WeaponSubClassCost[itemTemplate->GetSubClass()];
1317 else if (itemTemplate->GetClass() == ITEM_CLASS_ARMOR)
1318 dmultiplier = durabilityCost->ArmorSubClassCost[itemTemplate->GetSubClass()];
1319
1320 uint64 cost = std::round(lostDurability * dmultiplier * durabilityQualityEntry->Data * GetRepairCostMultiplier());
1321 cost = uint64(cost * discount * sWorld->getRate(RATE_REPAIRCOST));
1322
1323 if (cost == 0) // Fix for ITEM_QUALITY_ARTIFACT
1324 cost = 1;
1325
1326 return cost;
1327}
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:406
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:404
uint32 GetQuality() const
Definition: Item.h:337
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1140
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2269
float GetRepairCostMultiplier() const
Definition: Item.h:349
#define sWorld
Definition: World.h:961
@ RATE_REPAIRCOST
Definition: World.h:482
Definition: DB2Structure.h:1419
std::array< uint16, 8 > ArmorSubClassCost
Definition: DB2Structure.h:1422
std::array< uint16, 21 > WeaponSubClassCost
Definition: DB2Structure.h:1421
Definition: DB2Structure.h:1426
float Data
Definition: DB2Structure.h:1428
Definition: ItemTemplate.h:754
uint32 GetSubClass() const
Definition: ItemTemplate.h:760
uint32 GetClass() const
Definition: ItemTemplate.h:759
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeMergedPartlyWith()

InventoryResult Item::CanBeMergedPartlyWith ( ItemTemplate const *  proto) const
1370{
1371 // not allow merge looting currently items
1372 if (m_lootGenerated)
1373 return EQUIP_ERR_LOOT_GONE;
1374
1375 // check item type
1376 if (GetEntry() != proto->GetId())
1377 return EQUIP_ERR_CANT_STACK;
1378
1379 // check free space (full stacks can't be target of merge
1380 if (GetCount() >= proto->GetMaxStackSize())
1381 return EQUIP_ERR_CANT_STACK;
1382
1383 return EQUIP_ERR_OK;
1384}
@ 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
1250{
1251 if (m_lootGenerated)
1252 return false;
1253
1254 if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!IsBOPTradeable() || !trade)))
1255 return false;
1256
1257 if (IsBag() && (Player::IsBagPos(GetPos()) || !ToBag()->IsEmpty()))
1258 return false;
1259
1260 if (Player* owner = GetOwner())
1261 {
1262 if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
1263 return false;
1264 if (owner->GetLootGUID() == GetGUID())
1265 return false;
1266 }
1267
1268 if (IsBoundByEnchant())
1269 return false;
1270
1271 return true;
1272}
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:1357
bool IsBag() const
Definition: Item.h:252
ObjectGuid const & GetGUID() const
Definition: Object.h:158
static bool IsBagPos(uint16 pos)
Definition: Player.cpp:9669
+ 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
2058{
2059 ItemTemplate const* source = sObjectMgr->GetItemTemplate(itemModifiedAppearance->ItemID); // source
2060 ItemTemplate const* target = item->GetTemplate(); // dest
2061
2062 if (!source || !target)
2063 return false;
2064
2065 if (itemModifiedAppearance == item->GetItemModifiedAppearance())
2066 return false;
2067
2068 if (!item->IsValidTransmogrificationTarget())
2069 return false;
2070
2071 if (source->GetClass() != target->GetClass())
2072 return false;
2073
2074 if (source->GetInventoryType() == INVTYPE_BAG ||
2075 source->GetInventoryType() == INVTYPE_RELIC ||
2076 source->GetInventoryType() == INVTYPE_FINGER ||
2077 source->GetInventoryType() == INVTYPE_TRINKET ||
2078 source->GetInventoryType() == INVTYPE_AMMO ||
2079 source->GetInventoryType() == INVTYPE_QUIVER)
2080 return false;
2081
2082 if (source->GetSubClass() != target->GetSubClass())
2083 {
2084 switch (source->GetClass())
2085 {
2086 case ITEM_CLASS_WEAPON:
2088 return false;
2089 break;
2090 case ITEM_CLASS_ARMOR:
2092 return false;
2093 if (source->GetInventoryType() != target->GetInventoryType())
2095 return false;
2096 break;
2097 default:
2098 return false;
2099 }
2100 }
2101
2102 return true;
2103}
@ ITEM_SUBCLASS_ARMOR_COSMETIC
Definition: ItemTemplate.h:516
@ INVTYPE_FINGER
Definition: ItemTemplate.h:372
@ INVTYPE_TRINKET
Definition: ItemTemplate.h:373
@ INVTYPE_RELIC
Definition: ItemTemplate.h:389
@ INVTYPE_BAG
Definition: ItemTemplate.h:379
@ INVTYPE_AMMO
Definition: ItemTemplate.h:385
@ INVTYPE_QUIVER
Definition: ItemTemplate.h:388
static ItemTransmogrificationWeaponCategory GetTransmogrificationWeaponCategory(ItemTemplate const *proto)
Definition: Item.cpp:1985
int32 const ItemTransmogrificationSlots[MAX_INVTYPE]
Definition: Item.cpp:2018
#define sObjectMgr
Definition: ObjectMgr.h:1976
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:768
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckArtifactRelicSlotUnlock()

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

◆ CheckSoulboundTradeExpire()

bool Item::CheckSoulboundTradeExpire ( )
1918{
1919 // called from owner's update - GetOwner() MUST be valid
1920 if (m_itemData->CreatePlayedTime + 2*HOUR < GetOwner()->GetTotalPlayedTime())
1921 {
1923 return true; // remove from tradeable list
1924 }
1925
1926 return false;
1927}
@ HOUR
Definition: Common.h:46
void ClearSoulboundTradeable(Player *currentOwner)
Definition: Item.cpp:1903
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearBonuses()

void Item::ClearBonuses ( )
2543{
2545 itemBonusKey.ItemID = GetEntry();
2549}
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:2809
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearEnchantment()

void Item::ClearEnchantment ( EnchantmentSlot  slot)
1468{
1469 if (!GetEnchantmentId(slot))
1470 return;
1471
1472 auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, slot);
1473 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), 0);
1474 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), 0);
1475 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), 0);
1476 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Inactive), 0);
1478}
@ ITEM_CHANGED
Definition: Item.h:55
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1165
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)
1904{
1906 if (allowedGUIDs.empty())
1907 return;
1908
1909 currentOwner->GetSession()->GetCollectionMgr()->AddItemAppearance(this);
1910 allowedGUIDs.clear();
1911 SetState(ITEM_CHANGED, currentOwner);
1913 stmt->setUInt64(0, GetGUID().GetCounter());
1914 CharacterDatabase.Execute(stmt);
1915}
@ CHAR_DEL_ITEM_BOP_TRADE
Definition: CharacterDatabase.h:152
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)
Definition: CollectionMgr.cpp:591
void RemoveItemFlag(ItemFieldFlags flags)
Definition: Item.h:210
GuidSet allowedGUIDs
Definition: Item.h:465
WorldSession * GetSession() const
Definition: Player.h:2103
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:54
Definition: PreparedStatement.h:103
CollectionMgr * GetCollectionMgr() const
Definition: WorldSession.h:1167
+ 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.

1782{
1785}
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:779
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:680
+ 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
1647{
1648 Item* newItem = CreateItem(GetEntry(), count, GetContext(), player);
1649 if (!newItem)
1650 return nullptr;
1651
1652 newItem->SetCreator(GetCreator());
1653 newItem->SetGiftCreator(GetGiftCreator());
1655 newItem->SetExpiration(m_itemData->Expiration);
1656 // player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
1657 if (player)
1659 return newItem;
1660}
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:440
void SetItemRandomBonusList(ItemRandomBonusListId bonusListId)
Definition: Item.cpp:1157
ObjectGuid GetGiftCreator() const
Definition: Item.h:194
static Item * CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const *player=nullptr)
Definition: Item.cpp:1619
void SetCreator(ObjectGuid guid)
Definition: Item.h:193
void SetExpiration(uint32 expiration)
Definition: Item.h:198
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:195
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CopyArtifactDataFromParent()

void Item::CopyArtifactDataFromParent ( Item parent)
2734{
2738}
@ ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID
Definition: ItemDefines.h:215
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2426
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:2413
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.

468{
469 Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
470
471 SetEntry(itemId);
472 SetObjectScale(1.0f);
473
474 if (owner)
475 {
476 SetOwnerGUID(owner->GetGUID());
477 SetContainedIn(owner->GetGUID());
478 }
479
480 ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemId);
481 if (!itemProto)
482 return false;
483
484 _bonusData.Initialize(itemProto);
485 SetCount(1);
487 SetDurability(itemProto->MaxDurability);
488
489 for (std::size_t i = 0; i < itemProto->Effects.size(); ++i)
490 if (itemProto->Effects[i]->LegacySlotIndex < 5)
491 SetSpellCharges(itemProto->Effects[i]->LegacySlotIndex, itemProto->Effects[i]->Charges);
492
493 SetExpiration(itemProto->GetDuration());
495 SetContext(context);
496
497 if (itemProto->GetArtifactID())
498 {
499 InitArtifactPowers(itemProto->GetArtifactID(), 0);
500 for (ArtifactAppearanceEntry const* artifactAppearance : sArtifactAppearanceStore)
501 {
502 if (ArtifactAppearanceSetEntry const* artifactAppearanceSet = sArtifactAppearanceSetStore.LookupEntry(artifactAppearance->ArtifactAppearanceSetID))
503 {
504 if (itemProto->GetArtifactID() != artifactAppearanceSet->ArtifactID)
505 continue;
506
507 if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID))
508 if (!owner || !sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
509 continue;
510
511 SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID);
512 SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
513 break;
514 }
515 }
516
517 CheckArtifactRelicSlotUnlock(owner ? owner : GetOwner());
518 }
519
520 return true;
521}
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:2594
void SetContext(ItemContext context)
Definition: Item.h:441
void SetCount(uint32 value)
Definition: Item.cpp:1274
void SetDurability(uint32 durability)
Definition: Item.h:258
void SetContainedIn(ObjectGuid guid)
Definition: Item.h:191
void CheckArtifactRelicSlotUnlock(Player const *owner)
Definition: Item.cpp:1071
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:160
virtual void SetObjectScale(float scale)
Definition: Object.h:163
Definition: DB2Structure.h:215
Definition: DB2Structure.h:235
uint32 GetDuration() const
Definition: ItemTemplate.h:802
std::vector< ItemEffectEntry const * > Effects
Definition: ItemTemplate.h:810
uint32 MaxDurability
Definition: ItemTemplate.h:809
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 
)
static
1620{
1621 if (count < 1)
1622 return nullptr; //don't create item at zero count
1623
1624 ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
1625 if (proto)
1626 {
1627 if (count > proto->GetMaxStackSize())
1628 count = proto->GetMaxStackSize();
1629
1630 ASSERT_NODEBUGINFO(count != 0, "proto->Stackable == 0 but checked at loading already");
1631
1632 Item* item = NewItemOrBag(proto);
1633 if (item->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), itemEntry, context, player))
1634 {
1635 item->SetCount(count);
1636 return item;
1637 }
1638 else
1639 delete item;
1640 }
1641 else
1642 ABORT();
1643 return nullptr;
1644}
#define ABORT
Definition: Errors.h:74
#define ASSERT_NODEBUGINFO
Definition: Errors.h:69
Item * NewItemOrBag(ItemTemplate const *proto)
Definition: Item.cpp:51
virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const *owner)
Definition: Item.cpp:467
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:828
+ 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.

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

◆ DeleteFromDB() [2/2]

void Item::DeleteFromDB ( CharacterDatabaseTransaction  trans,
ObjectGuid::LowType  itemGuid 
)
static
1088{
1090 stmt->setUInt64(0, itemGuid);
1091 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1092
1093 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
1094 stmt->setUInt64(0, itemGuid);
1095 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1096
1097 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
1098 stmt->setUInt64(0, itemGuid);
1099 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1100
1101 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
1102 stmt->setUInt64(0, itemGuid);
1103 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1104
1105 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
1106 stmt->setUInt64(0, itemGuid);
1107 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1108
1109 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
1110 stmt->setUInt64(0, itemGuid);
1111 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1112
1113 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
1114 stmt->setUInt64(0, itemGuid);
1115 CharacterDatabase.ExecuteOrAppend(trans, stmt);
1116}
@ CHAR_DEL_ITEM_INSTANCE_GEMS
Definition: CharacterDatabase.h:161
@ CHAR_DEL_ITEM_INSTANCE_ARTIFACT
Definition: CharacterDatabase.h:168
@ CHAR_DEL_ITEM_INSTANCE_TRANSMOG
Definition: CharacterDatabase.h:164
@ CHAR_DEL_ITEM_INSTANCE
Definition: CharacterDatabase.h:158
@ CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS
Definition: CharacterDatabase.h:171
@ CHAR_DEL_ITEM_INSTANCE_MODIFIERS
Definition: CharacterDatabase.h:174
@ CHAR_DEL_GIFT
Definition: CharacterDatabase.h:195
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromInventoryDB() [1/2]

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

◆ DeleteFromInventoryDB() [2/2]

void Item::DeleteFromInventoryDB ( CharacterDatabaseTransaction  trans,
ObjectGuid::LowType  itemGuid 
)
static
1129{
1131 stmt->setUInt64(0, itemGuid);
1132 trans->Append(stmt);
1133}
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
Definition: CharacterDatabase.h:507
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteRefundDataFromDB()

void Item::DeleteRefundDataFromDB ( CharacterDatabaseTransaction trans)
1823{
1824 if (trans)
1825 {
1827 stmt->setUInt64(0, GetGUID().GetCounter());
1828 (*trans)->Append(stmt);
1829
1830 }
1831}
@ CHAR_DEL_ITEM_REFUND_INSTANCE
Definition: CharacterDatabase.h:445
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FSetState()

void Item::FSetState ( ItemUpdateState  state)
inline
327 {
328 uState = state;
329 }
+ Here is the caller graph for this function:

◆ GemsFitSockets()

bool Item::GemsFitSockets ( ) const
1546{
1547 uint32 gemSlot = 0;
1548 for (UF::SocketedGem const& gemData : m_itemData->Gems)
1549 {
1550 SocketColor color = GetTemplate()->GetSocketColor(gemSlot);
1551 if (!color) // no socket slot
1552 continue;
1553
1554 uint32 GemColor = 0;
1555
1556 ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemData.ItemID);
1557 if (gemProto)
1558 {
1559 GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GetGemProperties());
1560 if (gemProperty)
1561 GemColor = gemProperty->Type;
1562 }
1563
1564 if (!(GemColor & SocketColorToGemTypeMask[color])) // bad gem color on this socket
1565 return false;
1566 }
1567 return true;
1568}
DB2Storage< GemPropertiesEntry > sGemPropertiesStore("GemProperties.db2", &GemPropertiesLoadInfo::Instance)
int32 const SocketColorToGemTypeMask[19]
Definition: ItemTemplate.cpp:23
SocketColor
Definition: ItemTemplate.h:334
Definition: DB2Structure.h:1845
int32 Type
Definition: DB2Structure.h:1848
uint32 GetGemProperties() const
Definition: ItemTemplate.h:800
SocketColor GetSocketColor(uint32 index) const
Definition: ItemTemplate.h:798
Definition: UpdateFields.h:108
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:

◆ GetAppearanceModId()

uint32 Item::GetAppearanceModId ( ) const
inline
345{ return m_itemData->ItemAppearanceModID; }
+ Here is the caller graph for this function:

◆ GetArtifactPower()

UF::ArtifactPower const * Item::GetArtifactPower ( uint32  artifactPowerId) const
2560{
2561 auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
2562 if (indexItr != m_artifactPowerIdToIndex.end())
2563 return &m_itemData->ArtifactPowers[indexItr->second];
2564
2565 return nullptr;
2566}
+ Here is the caller graph for this function:

◆ GetBagSlot()

uint8 Item::GetBagSlot ( ) const
1239{
1241}
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:656
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
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
186{ return &_bonusData; }
+ Here is the caller graph for this function:

◆ GetBonusListIDs()

std::vector< int32 > const & Item::GetBonusListIDs ( ) const
inline
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
2111{
2112 standardPrice = false;
2113
2114 if (proto->HasFlag(ITEM_FLAG2_OVERRIDE_GOLD_COST))
2115 return proto->GetBuyPrice();
2116
2117 ImportPriceQualityEntry const* qualityPrice = sImportPriceQualityStore.LookupEntry(quality + 1);
2118 if (!qualityPrice)
2119 return 0;
2120
2121 ItemPriceBaseEntry const* basePrice = sItemPriceBaseStore.LookupEntry(itemLevel);
2122 if (!basePrice)
2123 return 0;
2124
2125 float qualityFactor = qualityPrice->Data;
2126 float baseFactor = 0.0f;
2127
2128 uint32 inventoryType = proto->GetInventoryType();
2129
2130 if (inventoryType == INVTYPE_WEAPON ||
2131 inventoryType == INVTYPE_2HWEAPON ||
2132 inventoryType == INVTYPE_WEAPONMAINHAND ||
2133 inventoryType == INVTYPE_WEAPONOFFHAND ||
2134 inventoryType == INVTYPE_RANGED ||
2135 inventoryType == INVTYPE_THROWN ||
2136 inventoryType == INVTYPE_RANGEDRIGHT)
2137 baseFactor = basePrice->Weapon;
2138 else
2139 baseFactor = basePrice->Armor;
2140
2141 if (inventoryType == INVTYPE_ROBE)
2142 inventoryType = INVTYPE_CHEST;
2143
2144 if (proto->GetClass() == ITEM_CLASS_GEM && proto->GetSubClass() == ITEM_SUBCLASS_GEM_ARTIFACT_RELIC)
2145 {
2146 inventoryType = INVTYPE_WEAPON;
2147 baseFactor = basePrice->Weapon / 3.0f;
2148 }
2149
2150 float typeFactor = 0.0f;
2151 int8 weapType = -1;
2152
2153 switch (inventoryType)
2154 {
2155 case INVTYPE_HEAD:
2156 case INVTYPE_NECK:
2157 case INVTYPE_SHOULDERS:
2158 case INVTYPE_CHEST:
2159 case INVTYPE_WAIST:
2160 case INVTYPE_LEGS:
2161 case INVTYPE_FEET:
2162 case INVTYPE_WRISTS:
2163 case INVTYPE_HANDS:
2164 case INVTYPE_FINGER:
2165 case INVTYPE_TRINKET:
2166 case INVTYPE_CLOAK:
2167 case INVTYPE_HOLDABLE:
2168 {
2169 ImportPriceArmorEntry const* armorPrice = sImportPriceArmorStore.LookupEntry(inventoryType);
2170 if (!armorPrice)
2171 return 0;
2172
2173 switch (proto->GetSubClass())
2174 {
2177 typeFactor = armorPrice->ClothModifier;
2178 break;
2180 typeFactor = armorPrice->LeatherModifier;
2181 break;
2183 typeFactor = armorPrice->ChainModifier;
2184 break;
2186 typeFactor = armorPrice->PlateModifier;
2187 break;
2188 default:
2189 typeFactor = 1.0f;
2190 break;
2191 }
2192
2193 break;
2194 }
2195 case INVTYPE_SHIELD:
2196 {
2197 ImportPriceShieldEntry const* shieldPrice = sImportPriceShieldStore.LookupEntry(2);
2198 if (!shieldPrice)
2199 return 0;
2200
2201 typeFactor = shieldPrice->Data;
2202 break;
2203 }
2205 weapType = 0;
2206 break;
2208 weapType = 1;
2209 break;
2210 case INVTYPE_WEAPON:
2211 weapType = 2;
2212 break;
2213 case INVTYPE_2HWEAPON:
2214 weapType = 3;
2215 break;
2216 case INVTYPE_RANGED:
2218 case INVTYPE_RELIC:
2219 weapType = 4;
2220 break;
2221 default:
2222 return proto->GetBuyPrice();
2223 }
2224
2225 if (weapType != -1)
2226 {
2227 ImportPriceWeaponEntry const* weaponPrice = sImportPriceWeaponStore.LookupEntry(weapType + 1);
2228 if (!weaponPrice)
2229 return 0;
2230
2231 typeFactor = weaponPrice->Data;
2232 }
2233
2234 standardPrice = false;
2235 return uint32(proto->GetPriceVariance() * typeFactor * baseFactor * qualityFactor * proto->GetPriceRandomValue());
2236}
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:405
@ ITEM_FLAG2_OVERRIDE_GOLD_COST
Definition: ItemTemplate.h:226
@ ITEM_SUBCLASS_ARMOR_MAIL
Definition: ItemTemplate.h:514
@ ITEM_SUBCLASS_ARMOR_CLOTH
Definition: ItemTemplate.h:512
@ ITEM_SUBCLASS_ARMOR_LEATHER
Definition: ItemTemplate.h:513
@ ITEM_SUBCLASS_ARMOR_PLATE
Definition: ItemTemplate.h:515
@ ITEM_SUBCLASS_ARMOR_MISCELLANEOUS
Definition: ItemTemplate.h:511
@ ITEM_SUBCLASS_GEM_ARTIFACT_RELIC
Definition: ItemTemplate.h:504
@ INVTYPE_HEAD
Definition: ItemTemplate.h:362
@ INVTYPE_CLOAK
Definition: ItemTemplate.h:377
@ INVTYPE_ROBE
Definition: ItemTemplate.h:381
@ INVTYPE_HOLDABLE
Definition: ItemTemplate.h:384
@ INVTYPE_RANGED
Definition: ItemTemplate.h:376
@ INVTYPE_THROWN
Definition: ItemTemplate.h:386
@ INVTYPE_WAIST
Definition: ItemTemplate.h:367
@ INVTYPE_RANGEDRIGHT
Definition: ItemTemplate.h:387
@ INVTYPE_WRISTS
Definition: ItemTemplate.h:370
@ INVTYPE_WEAPON
Definition: ItemTemplate.h:374
@ INVTYPE_WEAPONMAINHAND
Definition: ItemTemplate.h:382
@ INVTYPE_WEAPONOFFHAND
Definition: ItemTemplate.h:383
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:378
@ INVTYPE_NECK
Definition: ItemTemplate.h:363
@ INVTYPE_SHOULDERS
Definition: ItemTemplate.h:364
@ INVTYPE_FEET
Definition: ItemTemplate.h:369
@ INVTYPE_SHIELD
Definition: ItemTemplate.h:375
@ INVTYPE_LEGS
Definition: ItemTemplate.h:368
@ INVTYPE_CHEST
Definition: ItemTemplate.h:366
@ INVTYPE_HANDS
Definition: ItemTemplate.h:371
Definition: DB2Structure.h:1966
float ClothModifier
Definition: DB2Structure.h:1968
float ChainModifier
Definition: DB2Structure.h:1970
float LeatherModifier
Definition: DB2Structure.h:1969
float PlateModifier
Definition: DB2Structure.h:1971
Definition: DB2Structure.h:1975
float Data
Definition: DB2Structure.h:1977
Definition: DB2Structure.h:1981
float Data
Definition: DB2Structure.h:1983
Definition: DB2Structure.h:1987
float Data
Definition: DB2Structure.h:1989
Definition: DB2Structure.h:2263
float Weapon
Definition: DB2Structure.h:2267
float Armor
Definition: DB2Structure.h:2266
+ Here is the call graph for this function:

◆ GetBuyPrice() [2/2]

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

◆ GetChildItem()

ObjectGuid Item::GetChildItem ( ) const
inline
422{ return m_childItem; }
ObjectGuid m_childItem
Definition: Item.h:467
+ Here is the caller graph for this function:

◆ GetContainedIn()

ObjectGuid Item::GetContainedIn ( ) const
inline
190{ return m_itemData->ContainedIn; }

◆ GetContainer()

Bag * Item::GetContainer ( )
inline
281{ return m_container; }
+ Here is the caller graph for this function:

◆ GetContext()

ItemContext Item::GetContext ( ) const
inline
440{ return ItemContext(*m_itemData->Context); }
ItemContext
Definition: DBCEnums.h:922
+ Here is the caller graph for this function:

◆ GetCount()

uint32 Item::GetCount ( ) const
inline
273{ return m_itemData->StackCount; }
+ Here is the caller graph for this function:

◆ GetCreator()

ObjectGuid Item::GetCreator ( ) const
inline
192{ return m_itemData->Creator; }
+ Here is the caller graph for this function:

◆ GetDebugInfo()

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

Reimplemented from Object.

2800{
2801 std::stringstream sstr;
2802 sstr << Object::GetDebugInfo() << "\n"
2803 << std::boolalpha
2804 << "Owner: " << GetOwnerGUID().ToString() << " Count: " << GetCount()
2805 << " BagSlot: " << std::to_string(GetBagSlot()) << " Slot: " << std::to_string(GetSlot()) << " Equipped: " << IsEquipped();
2806 return sstr.str();
2807}
ObjectGuid GetOwnerGUID() const
Definition: Item.h:188
uint8 GetBagSlot() const
Definition: Item.cpp:1238
std::string ToString() const
Definition: ObjectGuid.cpp:531
virtual std::string GetDebugInfo() const
Definition: Object.cpp:805
+ 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
2359{
2360 if (itemTemplate->HasFlag(ITEM_FLAG_CONJURED) || itemTemplate->HasFlag(ITEM_FLAG_NO_DISENCHANT) || itemTemplate->GetBonding() == BIND_QUEST)
2361 return nullptr;
2362
2363 if (itemTemplate->GetArea(0) || itemTemplate->GetArea(1) || itemTemplate->GetMap() || itemTemplate->GetMaxStackSize() > 1)
2364 return nullptr;
2365
2366 if (!Item::GetSellPrice(itemTemplate, quality, itemLevel) && !sDB2Manager.HasItemCurrencyCost(itemTemplate->GetId()))
2367 return nullptr;
2368
2369 uint32 itemClass = itemTemplate->GetClass();
2370 int8 itemSubClass = itemTemplate->GetSubClass();
2371 uint8 expansion = itemTemplate->GetRequiredExpansion();
2372 for (ItemDisenchantLootEntry const* disenchant : sItemDisenchantLootStore)
2373 {
2374 if (disenchant->Class != itemClass)
2375 continue;
2376
2377 if (disenchant->Subclass >= 0 && itemSubClass)
2378 continue;
2379
2380 if (disenchant->Quality != quality)
2381 continue;
2382
2383 if (disenchant->MinLevel > itemLevel || disenchant->MaxLevel < itemLevel)
2384 continue;
2385
2386 if (disenchant->ExpansionID != -2 && disenchant->ExpansionID != expansion)
2387 continue;
2388
2389 return disenchant;
2390 }
2391
2392 return nullptr;
2393}
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:2238
Definition: DB2Structure.h:2154
+ Here is the call graph for this function:

◆ GetDisenchantLoot() [2/2]

ItemDisenchantLootEntry const * Item::GetDisenchantLoot ( Player const *  owner) const
2351{
2353 return nullptr;
2354
2356}
ItemDisenchantLootEntry const * GetDisenchantLoot(Player const *owner) const
Definition: Item.cpp:2350
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
2396{
2397 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2398 if (!itemModifiedAppearanceId)
2399 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2400
2401 if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2402 if (ItemAppearanceEntry const* itemAppearance = sItemAppearanceStore.LookupEntry(transmog->ItemAppearanceID))
2403 return itemAppearance->ItemDisplayInfoID;
2404
2405 return sDB2Manager.GetItemDisplayId(GetEntry(), GetAppearanceModId());
2406}
DB2Storage< ItemModifiedAppearanceEntry > sItemModifiedAppearanceStore("ItemModifiedAppearance.db2", &ItemModifiedAppearanceLoadInfo::Instance)
DB2Storage< ItemAppearanceEntry > sItemAppearanceStore("ItemAppearance.db2", &ItemAppearanceLoadInfo::Instance)
@ ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS
Definition: ItemDefines.h:207
ItemModifier const AppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:282
Definition: DB2Structure.h:2009
Definition: DB2Structure.h:2236
+ 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
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
300{ return m_itemData->Enchantment[slot].Charges; }
+ Here is the caller graph for this function:

◆ GetEnchantmentDuration()

uint32 Item::GetEnchantmentDuration ( EnchantmentSlot  slot) const
inline
299{ return m_itemData->Enchantment[slot].Duration; }
+ Here is the caller graph for this function:

◆ GetEnchantmentId()

uint32 Item::GetEnchantmentId ( EnchantmentSlot  slot) const
inline
298{ return m_itemData->Enchantment[slot].ID; }
+ Here is the caller graph for this function:

◆ GetEnchantRequiredLevel()

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

◆ GetGem()

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

◆ GetGemCountWithID()

uint8 Item::GetGemCountWithID ( uint32  GemID) const
1571{
1572 return uint8(std::count_if(m_itemData->Gems.begin(), m_itemData->Gems.end(), [GemID](UF::SocketedGem const& gemData)
1573 {
1574 return gemData.ItemID == int32(GemID);
1575 }));
1576}
+ Here is the caller graph for this function:

◆ GetGemCountWithLimitCategory()

uint8 Item::GetGemCountWithLimitCategory ( uint32  limitCategory) const
1579{
1580 return uint8(std::count_if(m_itemData->Gems.begin(), m_itemData->Gems.end(), [limitCategory](UF::SocketedGem const& gemData)
1581 {
1582 ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemData.ItemID);
1583 if (!gemProto)
1584 return false;
1585
1586 return gemProto->GetItemLimitCategory() == limitCategory;
1587 }));
1588}
+ Here is the caller graph for this function:

◆ GetGiftCreator()

ObjectGuid Item::GetGiftCreator ( ) const
inline
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
2285{
2286 if (!itemTemplate)
2287 return MIN_ITEM_LEVEL;
2288
2289 uint32 itemLevel = itemTemplate->GetBaseItemLevel();
2290 if (AzeriteLevelInfoEntry const* azeriteLevelInfo = sAzeriteLevelInfoStore.LookupEntry(azeriteLevel))
2291 itemLevel = azeriteLevelInfo->ItemLevel;
2292
2293 if (bonusData.PlayerLevelToItemLevelCurveId)
2294 {
2295 if (fixedLevel)
2296 level = fixedLevel;
2297 else if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(bonusData.ContentTuningId, 0, true))
2298 level = std::min(std::max(int16(level), levels->MinLevel), levels->MaxLevel);
2299
2300 itemLevel = uint32(sDB2Manager.GetCurveValueAt(bonusData.PlayerLevelToItemLevelCurveId, level));
2301 }
2302
2303 itemLevel += bonusData.ItemLevelBonus;
2304
2305 for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i)
2306 itemLevel += bonusData.GemItemLevelBonus[i];
2307
2308 uint32 itemLevelBeforeUpgrades = itemLevel;
2309
2310 if (pvpBonus)
2311 itemLevel += sDB2Manager.GetPvpItemLevelBonus(itemTemplate->GetId());
2312
2313 if (itemTemplate->GetInventoryType() != INVTYPE_NON_EQUIP)
2314 {
2315 if (minItemLevel && (!minItemLevelCutoff || itemLevelBeforeUpgrades >= minItemLevelCutoff) && itemLevel < minItemLevel)
2316 itemLevel = minItemLevel;
2317
2318 if (maxItemLevel && itemLevel > maxItemLevel)
2319 itemLevel = maxItemLevel;
2320 }
2321
2322 return std::min(std::max(itemLevel, uint32(MIN_ITEM_LEVEL)), uint32(MAX_ITEM_LEVEL));
2323}
DB2Storage< AzeriteLevelInfoEntry > sAzeriteLevelInfoStore("AzeriteLevelInfo.db2", &AzeriteLevelInfoLoadInfo::Instance)
#define MAX_ITEM_PROTO_SOCKETS
Definition: DBCEnums.h:848
int16_t int16
Definition: Define.h:140
@ MIN_ITEM_LEVEL
Definition: ItemTemplate.h:746
@ MAX_ITEM_LEVEL
Definition: ItemTemplate.h:747
@ INVTYPE_NON_EQUIP
Definition: ItemTemplate.h:361
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
Definition: DB2Structure.h:374
+ Here is the call graph for this function:

◆ GetItemLevel() [2/2]

uint32 Item::GetItemLevel ( Player const *  owner) const
2270{
2271 ItemTemplate const* itemTemplate = GetTemplate();
2272 uint32 minItemLevel = owner->m_unitData->MinItemLevel;
2273 uint32 minItemLevelCutoff = owner->m_unitData->MinItemLevelCutoff;
2274 uint32 maxItemLevel = itemTemplate->HasFlag(ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP) ? 0 : owner->m_unitData->MaxItemLevel;
2275 bool pvpBonus = owner->IsUsingPvpItemLevels();
2276 uint32 azeriteLevel = 0;
2277 if (AzeriteItem const* azeriteItem = ToAzeriteItem())
2278 azeriteLevel = azeriteItem->GetEffectiveLevel();
2279 return Item::GetItemLevel(itemTemplate, _bonusData, owner->GetLevel(), GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL),
2280 minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus, azeriteLevel);
2281}
@ ITEM_MODIFIER_TIMEWALKER_LEVEL
Definition: ItemDefines.h:216
@ ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP
Definition: ItemTemplate.h:256
Definition: AzeriteItem.h:30
AzeriteItem * ToAzeriteItem()
Definition: Item.h:243
bool HasFlag(ItemFlags flag) const
Definition: ItemTemplate.h:852
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemModifiedAppearance()

ItemModifiedAppearanceEntry const * Item::GetItemModifiedAppearance ( ) const
2409{
2410 return sDB2Manager.GetItemModifiedAppearance(GetEntry(), _bonusData.AppearanceModID);
2411}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemRandomBonusListId()

ItemRandomBonusListId Item::GetItemRandomBonusListId ( ) const
inline
292{ return m_randomBonusListId; }
+ Here is the caller graph for this function:

◆ GetItemStatType()

int32 Item::GetItemStatType ( uint32  index) const
inline
342{ ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:849
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
2326{
2328 switch (GetItemStatType(index))
2329 {
2332 return _bonusData.StatPercentEditor[index];
2333 default:
2334 break;
2335 }
2336
2337 uint32 itemLevel = GetItemLevel(owner);
2338 if (float randomPropPoints = GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate()->GetInventoryType(), GetTemplate()->GetSubClass()))
2339 {
2340 float statValue = float(_bonusData.StatPercentEditor[index] * randomPropPoints) * 0.0001f;
2341 if (GtItemSocketCostPerLevelEntry const* gtCost = sItemSocketCostPerLevelGameTable.GetRow(itemLevel))
2342 statValue -= float(int32(_bonusData.ItemStatSocketCostMultiplier[index] * gtCost->SocketCost));
2343
2344 return statValue;
2345 }
2346
2347 return 0.0f;
2348}
GameTable< GtItemSocketCostPerLevelEntry > sItemSocketCostPerLevelGameTable
Definition: GameTables.cpp:35
TC_GAME_API float GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
Definition: ItemEnchantmentMgr.cpp:106
@ 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
Definition: GameTables.h:117
+ 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.

319{ return m_loot.get(); }

◆ GetMaxStackCount()

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

◆ GetModifier()

uint32 Item::GetModifier ( ItemModifier  modifier) const
2414{
2415 int32 modifierIndex = m_itemData->Modifiers->Values.FindIndexIf([modifier](UF::ItemMod mod)
2416 {
2417 return mod.Type == modifier;
2418 });
2419
2420 if (modifierIndex != -1)
2421 return m_itemData->Modifiers->Values[modifierIndex].Value;
2422
2423 return 0;
2424}
Definition: UpdateFields.h:76
uint8 Type
Definition: UpdateFields.h:78
+ Here is the caller graph for this function:

◆ GetNameForLocaleIdx()

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

Implements Object.

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

◆ GetOwner()

Player * Item::GetOwner ( ) const
1146{
1148}
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:252
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid Item::GetOwnerGUID ( ) const
inline
188{ return m_itemData->Owner; }
+ Here is the caller graph for this function:

◆ GetPaidExtendedCost()

uint32 Item::GetPaidExtendedCost ( ) const
inline
364{ return m_paidExtendedCost; }
+ Here is the caller graph for this function:

◆ GetPaidMoney()

uint64 Item::GetPaidMoney ( ) const
inline
363{ return m_paidMoney; }
+ Here is the caller graph for this function:

◆ GetPlayedTime()

uint32 Item::GetPlayedTime ( )
1886{
1887 time_t curtime = GameTime::GetGameTime();
1888 uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
1889 return *m_itemData->CreatePlayedTime + elapsed;
1890}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPos()

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

◆ GetQuality()

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

◆ GetQueuePos()

uint16 Item::GetQueuePos ( ) const
inline
325{ return uQueuePos; }
+ Here is the caller graph for this function:

◆ GetRefundRecipient()

ObjectGuid const & Item::GetRefundRecipient ( ) const
inline
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
float RepairCostMultiplier
Definition: Item.h:79
+ Here is the caller graph for this function:

◆ GetRequiredLevel()

int32 Item::GetRequiredLevel ( ) const
2788{
2791 return sDB2Manager.GetCurveValueAt(_bonusData.RequiredLevelCurve, fixedLevel);
2795 return fixedLevel;
2797}
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
350{ return _bonusData.ContentTuningId; }
uint32 ContentTuningId
Definition: Item.h:80
+ Here is the caller graph for this function:

◆ GetScriptId()

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

◆ GetSellPrice() [1/2]

uint32 Item::GetSellPrice ( ItemTemplate const *  proto,
uint32  quality,
uint32  itemLevel 
)
static
2244{
2245 if (proto->HasFlag(ITEM_FLAG2_OVERRIDE_GOLD_COST))
2246 return proto->GetSellPrice();
2247 else
2248 {
2249 bool standardPrice;
2250 uint32 cost = Item::GetBuyPrice(proto, quality, itemLevel, standardPrice);
2251
2252 if (standardPrice)
2253 {
2254 if (ItemClassEntry const* classEntry = sDB2Manager.GetItemClassByOldEnum(proto->GetClass()))
2255 {
2256 uint32 buyCount = std::max(proto->GetBuyCount(), 1u);
2257 return cost * classEntry->PriceModifier / buyCount;
2258 }
2259
2260 return 0;
2261 }
2262 else
2263 return proto->GetSellPrice();
2264 }
2265
2266 return 0;
2267}
Definition: DB2Structure.h:2104
+ Here is the call graph for this function:

◆ GetSellPrice() [2/2]

uint32 Item::GetSellPrice ( Player const *  owner) const
2239{
2241}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSkill()

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

◆ GetSlot()

uint8 Item::GetSlot ( ) const
inline
280{return m_slot;}
+ Here is the caller graph for this function:

◆ GetSocketColor()

SocketColor Item::GetSocketColor ( uint32  index) const
inline
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
314{ return m_itemData->SpellCharges[index]; }
+ Here is the caller graph for this function:

◆ GetState()

ItemUpdateState Item::GetState ( ) const
inline
322{ return uState; }
+ Here is the caller graph for this function:

◆ GetTemplate()

ItemTemplate const * Item::GetTemplate ( ) const
1141{
1142 return sObjectMgr->GetItemTemplate(GetEntry());
1143}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetText()

std::string const & Item::GetText ( ) const
inline
304{ return m_text; }
std::string m_text
Definition: Item.h:455

◆ GetTotalPurchasedArtifactPowers()

uint32 Item::GetTotalPurchasedArtifactPowers ( ) const
2636{
2637 uint32 purchasedRanks = 0;
2638 for (UF::ArtifactPower const& power : m_itemData->ArtifactPowers)
2639 purchasedRanks += power.PurchasedRank;
2640
2641 return purchasedRanks;
2642}
+ Here is the caller graph for this function:

◆ GetTotalUnlockedArtifactPowers()

uint32 Item::GetTotalUnlockedArtifactPowers ( ) const
2613{
2615 uint64 artifactXp = m_itemData->ArtifactXP;
2616 uint32 currentArtifactTier = GetModifier(ITEM_MODIFIER_ARTIFACT_TIER);
2617 uint32 extraUnlocked = 0;
2618 do
2619 {
2620 uint64 xpCost = 0;
2621 if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(purchased + extraUnlocked + 1))
2622 xpCost = uint64(currentArtifactTier == MAX_ARTIFACT_TIER ? cost->XP2 : cost->XP);
2623
2624 if (artifactXp < xpCost)
2625 break;
2626
2627 artifactXp -= xpCost;
2628 ++extraUnlocked;
2629
2630 } while (true);
2631
2632 return purchased + extraUnlocked;
2633}
#define MAX_ARTIFACT_TIER
Definition: DBCEnums.h:175
GameTable< GtArtifactLevelXPEntry > sArtifactLevelXPGameTable
Definition: GameTables.cpp:28
@ ITEM_MODIFIER_ARTIFACT_TIER
Definition: ItemDefines.h:231
uint32 GetTotalPurchasedArtifactPowers() const
Definition: Item.cpp:2635
Definition: GameTables.h:33
+ 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.

1691{
1692 if (target->GetGUID() == GetOwnerGUID())
1694
1696}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleAppearanceModId()

uint16 Item::GetVisibleAppearanceModId ( Player const *  owner) const
2471{
2472 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2473 if (!itemModifiedAppearanceId)
2474 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2475
2476 if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2477 return transmog->ItemAppearanceModifierID;
2478
2479 return uint16(GetAppearanceModId());
2480}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleEnchantmentId()

uint32 Item::GetVisibleEnchantmentId ( Player const *  owner) const
2492{
2493 uint32 enchantmentId = GetModifier(IllusionModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2494 if (!enchantmentId)
2496
2497 if (!enchantmentId)
2498 enchantmentId = GetEnchantmentId(PERM_ENCHANTMENT_SLOT);
2499
2500 return enchantmentId;
2501}
@ ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS
Definition: ItemDefines.h:214
ItemModifier const IllusionModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:291
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleEntry()

uint32 Item::GetVisibleEntry ( Player const *  owner) const
2459{
2460 uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2461 if (!itemModifiedAppearanceId)
2462 itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2463
2464 if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2465 return transmog->ItemID;
2466
2467 return GetEntry();
2468}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleItemVisual()

uint16 Item::GetVisibleItemVisual ( Player const *  owner) const
2504{
2505 if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(GetVisibleEnchantmentId(owner)))
2506 return enchant->ItemVisual;
2507
2508 return 0;
2509}
uint32 GetVisibleEnchantmentId(Player const *owner) const
Definition: Item.cpp:2491
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleSecondaryModifiedAppearanceId()

int32 Item::GetVisibleSecondaryModifiedAppearanceId ( Player const *  owner) const
2483{
2484 uint32 itemModifiedAppearanceId = GetModifier(SecondaryAppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2485 if (!itemModifiedAppearanceId)
2487
2488 return itemModifiedAppearanceId;
2489}
@ ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_ALL_SPECS
Definition: ItemDefines.h:238
ItemModifier const SecondaryAppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:300
+ 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 
)
2741{
2742 Player* owner = GetOwner();
2743 if (!owner)
2744 return;
2745
2746 if (artifactCategoryId)
2747 {
2748 uint32 artifactKnowledgeLevel = 1;
2749 if (sourceItem && sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL))
2750 artifactKnowledgeLevel = sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL);
2751
2752 if (GtArtifactKnowledgeMultiplierEntry const* artifactKnowledge = sArtifactKnowledgeMultiplierGameTable.GetRow(artifactKnowledgeLevel))
2753 amount = uint64(amount * artifactKnowledge->Multiplier);
2754
2755 if (amount >= 5000)
2756 amount = 50 * (amount / 50);
2757 else if (amount >= 1000)
2758 amount = 25 * (amount / 25);
2759 else if (amount >= 50)
2760 amount = 5 * (amount / 5);
2761 }
2762
2763 SetArtifactXP(m_itemData->ArtifactXP + amount);
2764
2766 artifactXpGain.ArtifactGUID = GetGUID();
2767 artifactXpGain.Amount = amount;
2768 owner->SendDirectMessage(artifactXpGain.Write());
2769
2770 SetState(ITEM_CHANGED, owner);
2771}
GameTable< GtArtifactKnowledgeMultiplierEntry > sArtifactKnowledgeMultiplierGameTable
Definition: GameTables.cpp:27
@ ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL
Definition: ItemDefines.h:230
void SetArtifactXP(uint64 xp)
Definition: Item.h:437
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6309
Definition: ArtifactPackets.h:93
ObjectGuid ArtifactGUID
Definition: ArtifactPackets.h:99
uint64 Amount
Definition: ArtifactPackets.h:100
WorldPacket const * Write() override
Definition: ArtifactPackets.cpp:65
Definition: GameTables.h:28
+ Here is the call graph for this function:

◆ HasEnchantRequiredSkill()

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

◆ hasInvolvedQuest()

bool Item::hasInvolvedQuest ( uint32  ) const
inlineoverridevirtual

Reimplemented from Object.

332{ return false; }

◆ HasItemFlag()

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

◆ HasItemFlag2()

bool Item::HasItemFlag2 ( ItemFieldFlags2  flag) const
inline
213{ return (*m_itemData->DynamicFlags2 & flag) != 0; }

◆ hasQuest()

bool Item::hasQuest ( uint32  quest_id) const
inlineoverridevirtual

Reimplemented from Object.

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

◆ HasStats() [1/2]

bool Item::HasStats ( ) const
1952{
1953 ItemTemplate const* proto = GetTemplate();
1954 Player const* owner = GetOwner();
1955 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1956 if ((owner ? GetItemStatValue(i, owner) : proto->GetStatPercentEditor(i)) != 0)
1957 return true;
1958
1959 return false;
1960}
float GetItemStatValue(uint32 index, Player const *owner) const
Definition: Item.cpp:2325
int32 GetStatPercentEditor(uint32 index) const
Definition: ItemTemplate.h:781
+ 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
1963{
1964 for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1965 if (bonus->StatPercentEditor[i] != 0)
1966 return true;
1967
1968 return false;
1969}

◆ InitArtifactPowers()

void Item::InitArtifactPowers ( uint8  artifactId,
uint8  artifactTier 
)
2595{
2596 for (ArtifactPowerEntry const* artifactPower : sDB2Manager.GetArtifactPowers(artifactId))
2597 {
2598 if (artifactPower->Tier != artifactTier)
2599 continue;
2600
2601 if (m_artifactPowerIdToIndex.find(artifactPower->ID) != m_artifactPowerIdToIndex.end())
2602 continue;
2603
2604 ArtifactPowerData powerData;
2605 powerData.ArtifactPowerId = artifactPower->ID;
2606 powerData.PurchasedRank = 0;
2607 powerData.CurrentRankWithBonus = (artifactPower->Flags & ARTIFACT_POWER_FLAG_FIRST) == ARTIFACT_POWER_FLAG_FIRST ? 1 : 0;
2608 AddArtifactPower(&powerData);
2609 }
2610}
@ ARTIFACT_POWER_FLAG_FIRST
Definition: DBCEnums.h:172
void AddArtifactPower(ArtifactPowerData const *artifactPower)
Definition: Item.cpp:2568
Definition: Item.h:115
uint32 ArtifactPowerId
Definition: Item.h:116
uint8 CurrentRankWithBonus
Definition: Item.h:118
uint8 PurchasedRank
Definition: Item.h:117
Definition: DB2Structure.h:255
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsArtifactDisabled()

bool Item::IsArtifactDisabled ( ) const
2552{
2553 if (ArtifactEntry const* artifact = sArtifactStore.LookupEntry(GetTemplate()->GetArtifactID()))
2554 return artifact->ArtifactCategoryID != 2; // fishing artifact
2555
2556 return true;
2557}
DB2Storage< ArtifactEntry > sArtifactStore("Artifact.db2", &ArtifactLoadInfo::Instance)
Definition: DB2Structure.h:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAzeriteEmpoweredItem()

bool Item::IsAzeriteEmpoweredItem ( ) const
inline
@ TYPEID_AZERITE_EMPOWERED_ITEM
Definition: ObjectGuid.h:36
TypeID GetTypeId() const
Definition: Object.h:171
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsAzeriteItem()

bool Item::IsAzeriteItem ( ) const
inline
253{ return GetTypeId() == TYPEID_AZERITE_ITEM; }
@ TYPEID_AZERITE_ITEM
Definition: ObjectGuid.h:37
+ Here is the call graph for this function:

◆ IsBag()

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

◆ IsBattlenetAccountBound()

bool Item::IsBattlenetAccountBound ( ) const
inline
@ 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
1663{
1664 // not binded item
1665 if (!IsSoulBound())
1666 return false;
1667
1668 // own item
1669 if (GetOwnerGUID() == player->GetGUID())
1670 return false;
1671
1672 if (IsBOPTradeable())
1673 if (allowedGUIDs.find(player->GetGUID()) != allowedGUIDs.end())
1674 return false;
1675
1676 // BOA item case
1677 if (IsBoundAccountWide())
1678 return false;
1679
1680 return true;
1681}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBOPTradeable()

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

◆ IsBoundAccountWide()

bool Item::IsBoundAccountWide ( ) const
inline
@ ITEM_FLAG_IS_BOUND_TO_ACCOUNT
Definition: ItemTemplate.h:203
+ Here is the caller graph for this function:

◆ IsBoundByEnchant()

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

◆ IsBroken()

bool Item::IsBroken ( ) const
inline
257{ return *m_itemData->MaxDurability > 0 && *m_itemData->Durability == 0; }
+ Here is the caller graph for this function:

◆ IsConjuredConsumable()

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

◆ IsCurrencyToken()

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

◆ IsEquipped()

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

◆ IsInBag()

bool Item::IsInBag ( ) const
inline
287{ return m_container != nullptr; }
+ Here is the caller graph for this function:

◆ IsInTrade()

bool Item::IsInTrade ( ) const
inline
262{ return mb_in_trade; }
+ Here is the caller graph for this function:

◆ IsInUpdateQueue()

bool Item::IsInUpdateQueue ( ) const
inline
324{ return uQueuePos != -1; }
+ Here is the caller graph for this function:

◆ IsLimitedToAnotherMapOrZone()

bool Item::IsLimitedToAnotherMapOrZone ( uint32  cur_mapId,
uint32  cur_zoneId 
) const
1591{
1592 ItemTemplate const* proto = GetTemplate();
1593 return proto && ((proto->GetMap() && proto->GetMap() != cur_mapId) ||
1594 ((proto->GetArea(0) && proto->GetArea(0) != cur_zoneId) && (proto->GetArea(1) && proto->GetArea(1) != cur_zoneId)));
1595}
uint32 GetArea(uint32 index) const
Definition: ItemTemplate.h:794
uint32 GetMap() const
Definition: ItemTemplate.h:795
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsLocked()

bool Item::IsLocked ( ) const
inline
@ ITEM_FIELD_FLAG_UNLOCKED
Definition: ItemTemplate.h:133
+ Here is the caller graph for this function:

◆ IsNotEmptyBag()

bool Item::IsNotEmptyBag ( ) const
535{
536 if (Bag const* bag = ToBag())
537 return !bag->IsEmpty();
538 return false;
539}
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
333{ return GetTemplate()->IsPotion(); }
bool IsPotion() const
Definition: ItemTemplate.h:835
+ Here is the caller graph for this function:

◆ IsRangedWeapon()

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

◆ IsRefundable()

bool Item::IsRefundable ( ) const
inline
+ Here is the caller graph for this function:

◆ IsRefundExpired()

bool Item::IsRefundExpired ( )
1893{
1894 return (GetPlayedTime() > 2*HOUR);
1895}
uint32 GetPlayedTime()
Definition: Item.cpp:1885
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsSoulBound()

bool Item::IsSoulBound ( ) const
inline
@ ITEM_FIELD_FLAG_SOULBOUND
Definition: ItemTemplate.h:131
+ Here is the caller graph for this function:

◆ IsValidTransmogrificationTarget()

bool Item::IsValidTransmogrificationTarget ( ) const
1930{
1931 ItemTemplate const* proto = GetTemplate();
1932 if (!proto)
1933 return false;
1934
1935 if (proto->GetClass() != ITEM_CLASS_ARMOR &&
1936 proto->GetClass() != ITEM_CLASS_WEAPON)
1937 return false;
1938
1940 return false;
1941
1943 return false;
1944
1945 if (!HasStats())
1946 return false;
1947
1948 return true;
1949}
@ ITEM_FLAG2_NO_ALTER_ITEM_VISUAL
Definition: ItemTemplate.h:233
@ ITEM_SUBCLASS_WEAPON_FISHING_POLE
Definition: ItemTemplate.h:482
bool HasStats() const
Definition: Item.cpp:1951
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsVellum()

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

◆ IsWrapped()

bool Item::IsWrapped ( ) const
inline
@ 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 
)
1003{
1004 for (uint8 i = 0; i <= artifactTier; ++i)
1005 InitArtifactPowers(GetTemplate()->GetArtifactID(), i);
1006
1010
1011 if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifactAppearanceId))
1012 SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
1013
1014 uint8 totalPurchasedRanks = 0;
1015 for (ArtifactPowerData& power : powers)
1016 {
1017 power.CurrentRankWithBonus += power.PurchasedRank;
1018 totalPurchasedRanks += power.PurchasedRank;
1019
1020 ArtifactPowerEntry const* artifactPower = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
1022 {
1024 {
1025 for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
1026 {
1027 switch (enchant->Effect[i])
1028 {
1030 if (uint32(artifactPower->Label) == enchant->EffectArg[i])
1031 power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1032 break;
1034 if (artifactPower->ID == enchant->EffectArg[i])
1035 power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1036 break;
1039 {
1040 if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
1041 {
1042 PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
1043 if (!playerCondition || (owner && sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition)))
1044 if (artifactPower->Label == _bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT])
1045 power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1046 }
1047 }
1048 break;
1049 default:
1050 break;
1051 }
1052 }
1053 }
1054 }
1055
1056 SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, power.CurrentRankWithBonus);
1057 }
1058
1059 for (ArtifactPowerData& power : powers)
1060 {
1061 ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
1062 if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
1063 continue;
1064
1065 SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, totalPurchasedRanks + 1);
1066 }
1067
1069}
@ ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS
Definition: DBCEnums.h:168
void SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus)
Definition: Item.cpp:2579
int32 Label
Definition: DB2Structure.h:260
uint32 ID
Definition: DB2Structure.h:257
uint8 Flags
Definition: DB2Structure.h:261
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.

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

1799{
1800 if (Player* owner = GetOwner())
1801 owner->GetMap()->RemoveUpdateObject(this);
1802}
+ Here is the call graph for this function:

◆ RemoveItemFlag()

void Item::RemoveItemFlag ( ItemFieldFlags  flags)
inline
void RemoveUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:285
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
UpdateField< uint32, 0, 18 > DynamicFlags2
Definition: UpdateFields.h:137
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReplaceAllItemFlags()

void Item::ReplaceAllItemFlags ( ItemFieldFlags  flags)
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReplaceAllItemFlags2()

void Item::ReplaceAllItemFlags2 ( ItemFieldFlags2  flags)
inline
+ Here is the call graph for this function:

◆ SaveRefundDataToDB()

void Item::SaveRefundDataToDB ( )
1805{
1806 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
1807
1809 stmt->setUInt64(0, GetGUID().GetCounter());
1810 trans->Append(stmt);
1811
1812 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE);
1813 stmt->setUInt64(0, GetGUID().GetCounter());
1814 stmt->setUInt64(1, GetRefundRecipient().GetCounter());
1815 stmt->setUInt64(2, GetPaidMoney());
1817 trans->Append(stmt);
1818
1819 CharacterDatabase.CommitTransaction(trans);
1820}
@ CHAR_INS_ITEM_REFUND_INSTANCE
Definition: CharacterDatabase.h:446
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
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)
Definition: PreparedStatement.cpp:42
+ 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.

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

◆ SendTimeUpdate()

void Item::SendTimeUpdate ( Player owner)
1608{
1609 uint32 duration = m_itemData->Expiration;
1610 if (!duration)
1611 return;
1612
1614 itemTimeUpdate.ItemGuid = GetGUID();
1615 itemTimeUpdate.DurationLeft = duration;
1616 owner->GetSession()->SendPacket(itemTimeUpdate.Write());
1617}
Definition: ItemPackets.h:187
ObjectGuid ItemGuid
Definition: ItemPackets.h:193
uint32 DurationLeft
Definition: ItemPackets.h:194
WorldPacket const * Write() override
Definition: ItemPackets.cpp:137
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Definition: WorldSession.cpp:214
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendUpdateSockets()

void Item::SendUpdateSockets ( )
1598{
1600 socketGems.Item = GetGUID();
1601 GetOwner()->GetSession()->SendPacket(socketGems.Write());
1602}
Definition: ItemPackets.h:480
ObjectGuid Item
Definition: ItemPackets.h:486
WorldPacket const * Write() override
Definition: ItemPackets.cpp:362
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAppearanceModId()

void Item::SetAppearanceModId ( uint32  appearanceModId)
inline
+ 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 
)
2580{
2581 auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
2582 if (indexItr != m_artifactPowerIdToIndex.end())
2583 {
2585 .ModifyValue(&UF::ItemData::ArtifactPowers, indexItr->second)
2586 .ModifyValue(&UF::ArtifactPower::PurchasedRank), purchasedRank);
2587
2589 .ModifyValue(&UF::ItemData::ArtifactPowers, indexItr->second)
2590 .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), currentRankWithBonus);
2591 }
2592}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetArtifactXP()

void Item::SetArtifactXP ( uint64  xp)
inline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetBinding()

void Item::SetBinding ( bool  val)
inline
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)
2530{
2532 itemBonusKey.ItemID = GetEntry();
2533 itemBonusKey.BonusListIDs = std::move(bonusListIDs);
2535
2536 for (int32 bonusListID : GetBonusListIDs())
2537 _bonusData.AddBonusList(bonusListID);
2538
2540}
void AddBonusList(uint32 bonusListId)
Definition: Item.cpp:2878
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChildItem()

void Item::SetChildItem ( ObjectGuid  childItem)
inline
423{ m_childItem = childItem; }
+ Here is the caller graph for this function:

◆ SetContainedIn()

void Item::SetContainedIn ( ObjectGuid  guid)
inline
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
285{ m_container = container; }
+ Here is the caller graph for this function:

◆ SetContext()

void Item::SetContext ( ItemContext  context)
inline
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)
1275{
1277
1278 if (Player* player = GetOwner())
1279 {
1280 if (TradeData* tradeData = player->GetTradeData())
1281 {
1282 TradeSlots slot = tradeData->GetTradeSlotForItem(GetGUID());
1283
1284 if (slot != TRADE_SLOT_INVALID)
1285 tradeData->SetItem(slot, this, true);
1286 }
1287 }
1288}
TradeSlots
Definition: TradeData.h:24
@ TRADE_SLOT_INVALID
Definition: TradeData.h:28
Definition: TradeData.h:35
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
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
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
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 
)
1421{
1422 // Better lost small time at check in comparison lost time at item save to DB.
1423 if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
1424 return;
1425
1426 Player* owner = GetOwner();
1428 {
1429 if (SpellItemEnchantmentEntry const* oldEnchant = sSpellItemEnchantmentStore.LookupEntry(GetEnchantmentId(slot)))
1430 if (!oldEnchant->GetFlags().HasFlag(SpellItemEnchantmentFlags::DoNotLog))
1431 owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetGUID(), GetEntry(), oldEnchant->ID, slot);
1432
1433 if (SpellItemEnchantmentEntry const* newEnchant = sSpellItemEnchantmentStore.LookupEntry(id))
1434 if (!newEnchant->GetFlags().HasFlag(SpellItemEnchantmentFlags::DoNotLog))
1435 owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetGUID(), GetEntry(), id, slot);
1436 }
1437
1438 ApplyArtifactPowerEnchantmentBonuses(slot, GetEnchantmentId(slot), false, owner);
1439 ApplyArtifactPowerEnchantmentBonuses(slot, id, true, owner);
1440
1441 auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, slot);
1442 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), id);
1443 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), duration);
1444 SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), charges);
1445 SetState(ITEM_CHANGED, owner);
1446}
@ MAX_INSPECTED_ENCHANTMENT_SLOT
Definition: ItemDefines.h:184
void ApplyArtifactPowerEnchantmentBonuses(EnchantmentSlot slot, uint32 enchantId, bool apply, Player *owner)
Definition: Item.cpp:2644
static ObjectGuid const Empty
Definition: ObjectGuid.h:264
void SendEnchantmentLog(ObjectGuid owner, ObjectGuid caster, ObjectGuid itemGuid, uint32 itemId, uint32 enchantId, uint32 enchantSlot)
Definition: ItemHandler.cpp:772
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetEnchantmentCharges()

void Item::SetEnchantmentCharges ( EnchantmentSlot  slot,
uint32  charges 
)
1459{
1460 if (GetEnchantmentCharges(slot) == charges)
1461 return;
1462
1465}
+ Here is the call graph for this function:

◆ SetEnchantmentDuration()

void Item::SetEnchantmentDuration ( EnchantmentSlot  slot,
uint32  duration,
Player owner 
)
1449{
1450 if (GetEnchantmentDuration(slot) == duration)
1451 return;
1452
1454 SetState(ITEM_CHANGED, owner);
1455 // Cannot use GetOwner() here, has to be passed as an argument to avoid freeze due to hashtable locking
1456}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetExpiration()

void Item::SetExpiration ( uint32  expiration)
inline
UpdateField< uint32, 0, 8 > Expiration
Definition: UpdateFields.h:127
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetFixedLevel()

void Item::SetFixedLevel ( uint8  level)
2774{
2776 return;
2777
2779 {
2780 if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(_bonusData.ContentTuningId, 0, true))
2781 level = std::min(std::max(int16(level), levels->MinLevel), levels->MaxLevel);
2782
2784 }
2785}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetGem()

void Item::SetGem ( uint16  slot,
ItemDynamicFieldGems const *  gem,
uint32  gemScalingLevel 
)
1487{
1488 ASSERT(slot < MAX_GEM_SOCKETS);
1489 m_gemScalingLevels[slot] = gemScalingLevel;
1490 _bonusData.GemItemLevelBonus[slot] = 0;
1491 if (ItemTemplate const* gemTemplate = sObjectMgr->GetItemTemplate(gem->ItemId))