TrinityCore
Item Class Reference

#include <Item.h>

Public Member Functions

ItemCloneItem (uint32 count, Player const *player=nullptr) const
 
 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 AddItemFlag (ItemFieldFlags flags)
 
void RemoveItemFlag (ItemFieldFlags flags)
 
void SetItemFlags (ItemFieldFlags flags)
 
bool HasItemFlag2 (ItemFieldFlags2 flag) const
 
void AddItemFlag2 (ItemFieldFlags2 flags)
 
void RemoveItemFlag2 (ItemFieldFlags2 flags)
 
void SetItemFlags2 (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)
 
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 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
 
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)
 
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
 
ItemEffectEntry const * GetEffect (std::size_t i) 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
 
void 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)
 
- 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 AddDynamicFlag (uint32 flag)
 
void RemoveDynamicFlag (uint32 flag)
 
void SetDynamicFlags (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
 
ByteBuffer PrepareValuesUpdateBuffer () const
 
virtual void DestroyForPlayer (Player *target) const
 
void SetIsNewObject (bool enable)
 
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 IsConversation () const
 
ConversationToConversation ()
 
Conversation const * ToConversation () const
 
template<typename T >
void ForceUpdateFieldChange (UF::UpdateFieldSetter< T > 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)
 

Public Attributes

Loot 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) const
 
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 ( )
426 {
429 
430  m_slot = 0;
431  uState = ITEM_NEW;
432  uQueuePos = -1;
433  m_container = nullptr;
434  m_lootGenerated = false;
435  mb_in_trade = false;
437 
438  m_paidMoney = 0;
439  m_paidExtendedCost = 0;
440 
442 
443  memset(&_bonusData, 0, sizeof(_bonusData));
444 }
Definition: ObjectGuid.h:55
bool mb_in_trade
Definition: Item.h:441
bool m_lootGenerated
Definition: Item.h:309
time_t m_lastPlayedTimeUpdate
Definition: Item.h:442
uint32 m_paidExtendedCost
Definition: Item.h:445
Bag * m_container
Definition: Item.h:438
uint16 m_objectType
Definition: Object.h:352
ItemRandomBonusListId m_randomBonusListId
Definition: Item.h:447
ItemUpdateState uState
Definition: Item.h:439
TypeID m_objectTypeId
Definition: Object.h:354
time_t GetGameTime()
Definition: GameTime.cpp:39
BonusData _bonusData
Definition: Item.h:433
uint8 m_slot
Definition: Item.h:437
int16 uQueuePos
Definition: Item.h:440
uint64 m_paidMoney
Definition: Item.h:444
Definition: Item.h:56
Definition: ObjectGuid.h:35
+ Here is the call graph for this function:

Member Function Documentation

◆ AddArtifactPower()

void Item::AddArtifactPower ( ArtifactPowerData const *  artifactPower)
2467 {
2468  uint16 index = uint16(m_artifactPowerIdToIndex.size());
2469  m_artifactPowerIdToIndex[artifactPower->ArtifactPowerId] = index;
2470 
2472  powerField.ArtifactPowerID = artifactPower->ArtifactPowerId;
2473  powerField.PurchasedRank = artifactPower->PurchasedRank;
2474  powerField.CurrentRankWithBonus = artifactPower->CurrentRankWithBonus;
2475 }
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
int16 ArtifactPowerID
Definition: UpdateFields.h:94
std::unordered_map< uint32, uint16 > m_artifactPowerIdToIndex
Definition: Item.h:449
uint8 CurrentRankWithBonus
Definition: UpdateFields.h:96
uint8 PurchasedRank
Definition: UpdateFields.h:95
uint16_t uint16
Definition: Define.h:153
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue(UF::DynamicUpdateFieldSetter< T > setter)
Definition: Object.h:259
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
UF::UpdateFieldHolder m_values
Definition: Object.h:223
Definition: UpdateFields.h:92
DynamicUpdateField< UF::ArtifactPower, 0, 2 > ArtifactPowers
Definition: UpdateFields.h:118
+ Here is the call graph for this function:

◆ AddBonuses()

void Item::AddBonuses ( uint32  bonusListID)
2417 {
2418  if (std::find(m_itemData->BonusListIDs->begin(), m_itemData->BonusListIDs->end(), bonusListID) != m_itemData->BonusListIDs->end())
2419  return;
2420 
2421  if (DB2Manager::ItemBonusList const* bonuses = sDB2Manager.GetItemBonusList(bonusListID))
2422  {
2423  std::vector<int32> bonusListIDs = m_itemData->BonusListIDs;
2424  bonusListIDs.push_back(bonusListID);
2425  SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::BonusListIDs), std::move(bonusListIDs));
2426  for (ItemBonusEntry const* bonus : *bonuses)
2427  _bonusData.AddBonus(bonus->Type, bonus->Value);
2429  }
2430 }
#define sDB2Manager
Definition: DB2Stores.h:445
void AddBonus(uint32 type, int32 const (&values)[4])
Definition: Item.cpp:2773
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
UpdateField< uint8, 0, 17 > ItemAppearanceModID
Definition: UpdateFields.h:133
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
BonusData _bonusData
Definition: Item.h:433
Definition: DB2Structure.h:1870
std::vector< ItemBonusEntry const * > ItemBonusList
Definition: DB2Stores.h:322
uint32 AppearanceModID
Definition: Item.h:78
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
UpdateField< std::vector< int32 >, 0, 1 > BonusListIDs
Definition: UpdateFields.h:117
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddItemFlag()

void Item::AddItemFlag ( ItemFieldFlags  flags)
inline
UpdateField< uint32, 0, 10 > DynamicFlags
Definition: UpdateFields.h:126
void SetUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:245
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the caller graph for this function:

◆ AddItemFlag2()

void Item::AddItemFlag2 ( ItemFieldFlags2  flags)
inline
void SetUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:245
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
UpdateField< uint32, 0, 19 > DynamicFlags2
Definition: UpdateFields.h:135
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the caller graph for this function:

◆ AddToObjectUpdate()

void Item::AddToObjectUpdate ( )
overridevirtual

Implements Object.

1704 {
1705  if (Player* owner = GetOwner())
1706  owner->GetMap()->AddUpdateObject(this);
1707 }
Player * GetOwner() const
Definition: Item.cpp:1112
Definition: Player.h:1056

◆ ApplyArtifactPowerEnchantmentBonuses()

void Item::ApplyArtifactPowerEnchantmentBonuses ( EnchantmentSlot  slot,
uint32  enchantId,
bool  apply,
Player owner 
)
2543 {
2544  if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
2545  {
2546  for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
2547  {
2548  switch (enchant->Effect[i])
2549  {
2551  for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
2552  {
2553  UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
2554  if (uint32(sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label) == enchant->EffectArg[i])
2555  {
2556  uint8 newRank = artifactPower.CurrentRankWithBonus;
2557  if (apply)
2558  newRank += enchant->EffectPointsMin[i];
2559  else
2560  newRank -= enchant->EffectPointsMin[i];
2561 
2563  .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
2564  .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2565 
2566  if (IsEquipped())
2567  if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0))
2568  owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2569  }
2570  }
2571  break;
2573  {
2574  if (uint16 const* artifactPowerIndex = Trinity::Containers::MapGetValuePtr(m_artifactPowerIdToIndex, enchant->EffectArg[i]))
2575  {
2576  uint8 newRank = m_itemData->ArtifactPowers[*artifactPowerIndex].CurrentRankWithBonus;
2577  if (apply)
2578  newRank += enchant->EffectPointsMin[i];
2579  else
2580  newRank -= enchant->EffectPointsMin[i];
2581 
2583  .ModifyValue(&UF::ItemData::ArtifactPowers, *artifactPowerIndex)
2584  .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2585 
2586  if (IsEquipped())
2587  if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(m_itemData->ArtifactPowers[*artifactPowerIndex].ArtifactPowerID, newRank ? newRank - 1 : 0))
2588  owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2589  }
2590  break;
2591  }
2594  {
2595  if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
2596  {
2597  PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
2598  if (!playerCondition || sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
2599  {
2600  for (uint32 artifactPowerIndex = 0; artifactPowerIndex < m_itemData->ArtifactPowers.size(); ++artifactPowerIndex)
2601  {
2602  UF::ArtifactPower const& artifactPower = m_itemData->ArtifactPowers[artifactPowerIndex];
2603  if (sArtifactPowerStore.AssertEntry(artifactPower.ArtifactPowerID)->Label == _bonusData.GemRelicType[slot - SOCK_ENCHANTMENT_SLOT])
2604  {
2605  uint8 newRank = artifactPower.CurrentRankWithBonus;
2606  if (apply)
2607  newRank += enchant->EffectPointsMin[i];
2608  else
2609  newRank -= enchant->EffectPointsMin[i];
2610 
2612  .ModifyValue(&UF::ItemData::ArtifactPowers, artifactPowerIndex)
2613  .ModifyValue(&UF::ArtifactPower::CurrentRankWithBonus), newRank);
2614 
2615  if (IsEquipped())
2616  if (ArtifactPowerRankEntry const* artifactPowerRank = sDB2Manager.GetArtifactPowerRank(artifactPower.ArtifactPowerID, newRank ? newRank - 1 : 0))
2617  owner->ApplyArtifactPowerRank(this, artifactPowerRank, newRank != 0);
2618  }
2619  }
2620  }
2621  }
2622  }
2623  break;
2624  default:
2625  break;
2626  }
2627  }
2628  }
2629 }
#define sDB2Manager
Definition: DB2Stores.h:445
auto MapGetValuePtr(M &map, typename M::key_type const &key) -> decltype(AddressOrSelf(map.find(key) ->second))
Definition: Containers.h:226
Definition: ItemDefines.h:167
Definition: DB2Structure.h:274
Definition: ItemDefines.h:169
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", SpellItemEnchantmentLoadInfo::Instance())
DB2Storage< ArtifactPowerPickerEntry > sArtifactPowerPickerStore("ArtifactPowerPicker.db2", ArtifactPowerPickerLoadInfo::Instance())
Definition: DB2Structure.h:280
int16 ArtifactPowerID
Definition: UpdateFields.h:94
DB2Storage< ArtifactPowerEntry > sArtifactPowerStore("ArtifactPower.db2", ArtifactPowerLoadInfo::Instance())
Definition: DB2Structure.h:3161
R apply(R(*func)(Ts...), apply_tuple_type< Ts... > &&args)
Definition: advstd.h:37
std::unordered_map< uint32, uint16 > m_artifactPowerIdToIndex
Definition: Item.h:449
uint8 CurrentRankWithBonus
Definition: UpdateFields.h:96
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
uint32_t uint32
Definition: Define.h:152
uint16_t uint16
Definition: Define.h:153
BonusData _bonusData
Definition: Item.h:433
#define sConditionMgr
Definition: ConditionMgr.h:326
int32 GemRelicType[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:84
void ApplyArtifactPowerRank(Item *artifact, ArtifactPowerRankEntry const *artifactPowerRank, bool apply)
Definition: Player.cpp:8077
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DB2Structure.h:3159
bool IsEquipped() const
Definition: Item.cpp:1210
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8_t uint8
Definition: Define.h:154
Definition: DB2Structure.h:2571
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
UF::UpdateFieldHolder m_values
Definition: Object.h:223
Definition: UpdateFields.h:92
DynamicUpdateField< UF::ArtifactPower, 0, 2 > ArtifactPowers
Definition: UpdateFields.h:118
+ Here is the call graph for this function:

◆ ApplyBonusList()

void Item::ApplyBonusList ( uint32  itemBonusListId)
protected

◆ BuildUpdate()

void Item::BuildUpdate ( UpdateDataMapType data_map)
overridevirtual

Reimplemented from Object.

1611 {
1612  if (Player* owner = GetOwner())
1613  BuildFieldsUpdate(owner, data_map);
1614  ClearUpdateMask(false);
1615 }
Player * GetOwner() const
Definition: Item.cpp:1112
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition: Object.cpp:805
Definition: Player.h:1056
void ClearUpdateMask(bool remove) override
Definition: Item.cpp:1697

◆ BuildValuesCreate()

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

Implements Object.

1626 {
1628  std::size_t sizePos = data->wpos();
1629  *data << uint32(0);
1630  *data << uint8(flags);
1631  m_objectData->WriteCreate(*data, flags, this, target);
1632  m_itemData->WriteCreate(*data, flags, this, target);
1633  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1634 }
size_t wpos() const
Definition: ByteBuffer.h:409
UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const override
Definition: Item.cpp:1617
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:224
uint32_t uint32
Definition: Define.h:152
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8_t uint8
Definition: Define.h:154
uint8 flags
Definition: DisableMgr.cpp:47
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:212
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildValuesUpdate()

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

Implements Object.

1637 {
1639  std::size_t sizePos = data->wpos();
1640  *data << uint32(0);
1642 
1644  m_objectData->WriteUpdate(*data, flags, this, target);
1645 
1647  m_itemData->WriteUpdate(*data, flags, this, target);
1648 
1649  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1650 }
size_t wpos() const
Definition: ByteBuffer.h:409
UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const override
Definition: Item.cpp:1617
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:670
bool HasChanged(uint32 index) const
Definition: UpdateField.h:675
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:224
uint32_t uint32
Definition: Define.h:152
Definition: ObjectGuid.h:34
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
UF::UpdateFieldHolder m_values
Definition: Object.h:223
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:212
Definition: ObjectGuid.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildValuesUpdateForPlayerWithMask()

void Item::BuildValuesUpdateForPlayerWithMask ( UpdateData data,
UF::ObjectData::Mask const &  requestedObjectMask,
UF::ItemData::Mask const &  requestedItemMask,
Player const *  target 
) const
1670 {
1673  if (requestedObjectMask.IsAnySet())
1674  valuesMask.Set(TYPEID_OBJECT);
1675 
1676  UF::ItemData::Mask itemMask = requestedItemMask;
1677  m_itemData->FilterDisallowedFieldsMaskForFlag(itemMask, flags);
1678  if (itemMask.IsAnySet())
1679  valuesMask.Set(TYPEID_ITEM);
1680 
1682  std::size_t sizePos = buffer.wpos();
1683  buffer << uint32(0);
1684  buffer << uint32(valuesMask.GetBlock(0));
1685 
1686  if (valuesMask[TYPEID_OBJECT])
1687  m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
1688 
1689  if (valuesMask[TYPEID_ITEM])
1690  m_itemData->WriteUpdate(buffer, itemMask, true, this, target);
1691 
1692  buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
1693 
1694  data->AddUpdateBlock(buffer);
1695 }
size_t wpos() const
Definition: ByteBuffer.h:409
Definition: ByteBuffer.h:53
void AddUpdateBlock(ByteBuffer const &block)
Definition: UpdateData.cpp:40
UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const override
Definition: Item.cpp:1617
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:224
void Set(uint32 index)
Definition: UpdateMask.h:84
uint32_t uint32
Definition: Define.h:152
bool IsAnySet() const
Definition: UpdateMask.h:63
ByteBuffer PrepareValuesUpdateBuffer() const
Definition: Object.cpp:269
Definition: ObjectGuid.h:34
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:212
Definition: ObjectGuid.h:35
+ 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.

1653 {
1655  valuesMask.Set(TYPEID_ITEM);
1656 
1657  std::size_t sizePos = data->wpos();
1658  *data << uint32(0);
1659  *data << uint32(valuesMask.GetBlock(0));
1660 
1661  UF::ItemData::Mask mask;
1662  m_itemData->AppendAllowedFieldsMaskForFlag(mask, flags);
1663  m_itemData->WriteUpdate(*data, mask, true, this, target);
1664 
1665  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1666 }
size_t wpos() const
Definition: ByteBuffer.h:409
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
void Set(uint32 index)
Definition: UpdateMask.h:84
uint32_t uint32
Definition: Define.h:152
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:212
Definition: ObjectGuid.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanBeMergedPartlyWith()

InventoryResult Item::CanBeMergedPartlyWith ( ItemTemplate const *  proto) const
1299 {
1300  // not allow merge looting currently items
1301  if (m_lootGenerated)
1302  return EQUIP_ERR_LOOT_GONE;
1303 
1304  // check item type
1305  if (GetEntry() != proto->GetId())
1306  return EQUIP_ERR_CANT_STACK;
1307 
1308  // check free space (full stacks can't be target of merge
1309  if (GetCount() >= proto->GetMaxStackSize())
1310  return EQUIP_ERR_CANT_STACK;
1311 
1312  return EQUIP_ERR_OK;
1313 }
bool m_lootGenerated
Definition: Item.h:309
Definition: ItemDefines.h:75
uint32 GetCount() const
Definition: Item.h:264
Definition: ItemDefines.h:25
uint32 GetEntry() const
Definition: Object.h:155
Definition: ItemDefines.h:44
+ 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
1216 {
1217  if (m_lootGenerated)
1218  return false;
1219 
1220  if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasItemFlag(ITEM_FIELD_FLAG_BOP_TRADEABLE) || !trade)))
1221  return false;
1222 
1223  if (IsBag() && (Player::IsBagPos(GetPos()) || !ToBag()->IsEmpty()))
1224  return false;
1225 
1226  if (Player* owner = GetOwner())
1227  {
1228  if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
1229  return false;
1230  if (owner->GetLootGUID() == GetGUID())
1231  return false;
1232  }
1233 
1234  if (IsBoundByEnchant())
1235  return false;
1236 
1237  return true;
1238 }
bool IsBoundByEnchant() const
Definition: Item.cpp:1286
uint16 GetPos() const
Definition: Item.h:275
bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:207
bool m_lootGenerated
Definition: Item.h:309
Player * GetOwner() const
Definition: Item.cpp:1112
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Bag * ToBag()
Definition: Item.h:237
bool IsBag() const
Definition: Item.h:245
Definition: ItemDefines.h:25
bool IsBoundAccountWide() const
Definition: Item.h:216
Definition: ItemTemplate.h:145
bool IsSoulBound() const
Definition: Item.h:215
static bool IsBagPos(uint16 pos)
Definition: Player.cpp:10249
Definition: Player.h:1056
+ 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
1963 {
1964  ItemTemplate const* source = sObjectMgr->GetItemTemplate(itemModifiedAppearance->ItemID); // source
1965  ItemTemplate const* target = item->GetTemplate(); // dest
1966 
1967  if (!source || !target)
1968  return false;
1969 
1970  if (itemModifiedAppearance == item->GetItemModifiedAppearance())
1971  return false;
1972 
1973  if (!item->IsValidTransmogrificationTarget())
1974  return false;
1975 
1976  if (source->GetClass() != target->GetClass())
1977  return false;
1978 
1979  if (source->GetInventoryType() == INVTYPE_BAG ||
1980  source->GetInventoryType() == INVTYPE_RELIC ||
1981  source->GetInventoryType() == INVTYPE_FINGER ||
1982  source->GetInventoryType() == INVTYPE_TRINKET ||
1983  source->GetInventoryType() == INVTYPE_AMMO ||
1984  source->GetInventoryType() == INVTYPE_QUIVER)
1985  return false;
1986 
1987  if (source->GetSubClass() != target->GetSubClass())
1988  {
1989  switch (source->GetClass())
1990  {
1991  case ITEM_CLASS_WEAPON:
1993  return false;
1994  break;
1995  case ITEM_CLASS_ARMOR:
1996  if (source->GetSubClass() != ITEM_SUBCLASS_ARMOR_COSMETIC)
1997  return false;
1998  if (source->GetInventoryType() != target->GetInventoryType())
2000  return false;
2001  break;
2002  default:
2003  return false;
2004  }
2005  }
2006 
2007  return true;
2008 }
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:748
Definition: ItemTemplate.h:384
uint32 GetClass() const
Definition: ItemTemplate.h:736
Definition: ItemTemplate.h:383
#define sObjectMgr
Definition: ObjectMgr.h:1847
Definition: ItemTemplate.h:390
Definition: ItemTemplate.h:409
static ItemTransmogrificationWeaponCategory GetTransmogrificationWeaponCategory(ItemTemplate const *proto)
Definition: Item.cpp:1896
Definition: ItemTemplate.h:399
Definition: ItemTemplate.h:411
Definition: ItemTemplate.h:730
Definition: ItemTemplate.h:519
Definition: ItemTemplate.h:400
int32 const ItemTransmogrificationSlots[MAX_INVTYPE]
Definition: Item.cpp:1929
uint32 GetSubClass() const
Definition: ItemTemplate.h:737
Definition: ItemTemplate.h:396
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckArtifactRelicSlotUnlock()

void Item::CheckArtifactRelicSlotUnlock ( Player const *  owner)
1039 {
1040  if (!owner)
1041  return;
1042 
1043  uint8 artifactId = GetTemplate()->GetArtifactID();
1044  if (!artifactId)
1045  return;
1046 
1047  for (ArtifactUnlockEntry const* artifactUnlock : sArtifactUnlockStore)
1048  if (artifactUnlock->ArtifactID == artifactId)
1049  if (owner->MeetPlayerCondition(artifactUnlock->PlayerConditionID))
1050  AddBonuses(artifactUnlock->ItemBonusListID);
1051 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint8 GetArtifactID() const
Definition: ItemTemplate.h:786
void AddBonuses(uint32 bonusListID)
Definition: Item.cpp:2416
Definition: DB2Structure.h:306
uint8_t uint8
Definition: Define.h:154
DB2Storage< ArtifactUnlockEntry > sArtifactUnlockStore("ArtifactUnlock.db2", ArtifactUnlockLoadInfo::Instance())
+ Here is the call graph for this function:

◆ CheckSoulboundTradeExpire()

bool Item::CheckSoulboundTradeExpire ( )
1829 {
1830  // called from owner's update - GetOwner() MUST be valid
1831  if (m_itemData->CreatePlayedTime + 2*HOUR < GetOwner()->GetTotalPlayedTime())
1832  {
1834  return true; // remove from tradeable list
1835  }
1836 
1837  return false;
1838 }
Player * GetOwner() const
Definition: Item.cpp:1112
void ClearSoulboundTradeable(Player *currentOwner)
Definition: Item.cpp:1814
Definition: Common.h:63
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ ClearBonuses()

void Item::ClearBonuses ( )
2443 {
2447 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:2697
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
UpdateField< uint8, 0, 17 > ItemAppearanceModID
Definition: UpdateFields.h:133
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
BonusData _bonusData
Definition: Item.h:433
uint32 AppearanceModID
Definition: Item.h:78
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
UpdateField< std::vector< int32 >, 0, 1 > BonusListIDs
Definition: UpdateFields.h:117
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearEnchantment()

void Item::ClearEnchantment ( EnchantmentSlot  slot)
1395 {
1396  if (!GetEnchantmentId(slot))
1397  return;
1398 
1399  auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, slot);
1400  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), 0);
1401  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), 0);
1402  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), 0);
1403  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Inactive), 0);
1405 }
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
Player * GetOwner() const
Definition: Item.cpp:1112
UpdateFieldArray< UF::ItemEnchantment, 13, 26, 27 > Enchantment
Definition: UpdateFields.h:137
UpdateField< uint32, 0, 2 > Duration
Definition: UpdateFields.h:63
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
UpdateField< int16, 0, 3 > Charges
Definition: UpdateFields.h:64
UpdateField< int32, 0, 1 > ID
Definition: UpdateFields.h:62
Definition: Item.h:55
UpdateField< uint16, 0, 4 > Inactive
Definition: UpdateFields.h:65
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:289
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1132
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearSoulboundTradeable()

void Item::ClearSoulboundTradeable ( Player currentOwner)
1815 {
1817  if (allowedGUIDs.empty())
1818  return;
1819 
1820  currentOwner->GetSession()->GetCollectionMgr()->AddItemAppearance(this);
1821  allowedGUIDs.clear();
1822  SetState(ITEM_CHANGED, currentOwner);
1824  stmt->setUInt64(0, GetGUID().GetCounter());
1825  CharacterDatabase.Execute(stmt);
1826 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:155
CollectionMgr * GetCollectionMgr() const
Definition: WorldSession.h:1138
void AddItemAppearance(Item *item)
Definition: CollectionMgr.cpp:618
WorldSession * GetSession() const
Definition: Player.h:1990
void RemoveItemFlag(ItemFieldFlags flags)
Definition: Item.h:209
Definition: DatabaseEnvFwd.h:40
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: Item.h:55
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1132
Definition: ItemTemplate.h:145
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
GuidSet allowedGUIDs
Definition: Item.h:446
+ 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.

1698 {
1700  Object::ClearUpdateMask(remove);
1701 }
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:793
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:664
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ 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
1574 {
1575  Item* newItem = CreateItem(GetEntry(), count, GetContext(), player);
1576  if (!newItem)
1577  return nullptr;
1578 
1579  newItem->SetCreator(GetCreator());
1580  newItem->SetGiftCreator(GetGiftCreator());
1582  newItem->SetExpiration(m_itemData->Expiration);
1583  // player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
1584  if (player)
1586  return newItem;
1587 }
static Item * CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const *player=nullptr)
Definition: Item.cpp:1546
void SetItemRandomBonusList(ItemRandomBonusListId bonusListId)
Definition: Item.cpp:1124
void SetExpiration(uint32 expiration)
Definition: Item.h:197
ItemRandomBonusListId m_randomBonusListId
Definition: Item.h:447
ObjectGuid GetGiftCreator() const
Definition: Item.h:193
Definition: Item.h:169
void SetItemFlags(ItemFieldFlags flags)
Definition: Item.h:210
ItemContext GetContext() const
Definition: Item.h:423
uint32 GetEntry() const
Definition: Object.h:155
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
ObjectGuid GetCreator() const
Definition: Item.h:191
Definition: ItemTemplate.h:145
Definition: ItemTemplate.h:149
ItemFieldFlags
Definition: ItemTemplate.h:135
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:194
void SetCreator(ObjectGuid guid)
Definition: Item.h:192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CopyArtifactDataFromParent()

void Item::CopyArtifactDataFromParent ( Item parent)
2632 {
2636 }
void SetAppearanceModId(uint32 appearanceModId)
Definition: Item.h:336
uint32 GemItemLevelBonus[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:83
uint32 GetAppearanceModId() const
Definition: Item.h:335
BonusData _bonusData
Definition: Item.h:433
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2331
Definition: ItemDefines.h:205
BonusData const * GetBonus() const
Definition: Item.h:185
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
+ 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 Bag, AzeriteItem, and AzeriteEmpoweredItem.

447 {
448  Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
449 
450  SetEntry(itemId);
451  SetObjectScale(1.0f);
452 
453  if (owner)
454  {
455  SetOwnerGUID(owner->GetGUID());
456  SetContainedIn(owner->GetGUID());
457  }
458 
459  ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemId);
460  if (!itemProto)
461  return false;
462 
463  _bonusData.Initialize(itemProto);
464  SetCount(1);
465  SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::MaxDurability), itemProto->MaxDurability);
466  SetDurability(itemProto->MaxDurability);
467 
468  for (std::size_t i = 0; i < itemProto->Effects.size(); ++i)
469  if (itemProto->Effects[i]->LegacySlotIndex < 5)
470  SetSpellCharges(itemProto->Effects[i]->LegacySlotIndex, itemProto->Effects[i]->Charges);
471 
472  SetExpiration(itemProto->GetDuration());
474  SetContext(context);
475 
476  if (itemProto->GetArtifactID())
477  {
478  InitArtifactPowers(itemProto->GetArtifactID(), 0);
479  for (ArtifactAppearanceEntry const* artifactAppearance : sArtifactAppearanceStore)
480  {
481  if (ArtifactAppearanceSetEntry const* artifactAppearanceSet = sArtifactAppearanceSetStore.LookupEntry(artifactAppearance->ArtifactAppearanceSetID))
482  {
483  if (itemProto->GetArtifactID() != artifactAppearanceSet->ArtifactID)
484  continue;
485 
486  if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactAppearance->UnlockPlayerConditionID))
487  if (!owner || !sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition))
488  continue;
489 
490  SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearance->ID);
491  SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
492  break;
493  }
494  }
495 
496  CheckArtifactRelicSlotUnlock(owner ? owner : GetOwner());
497  }
498 
499  return true;
500 }
void SetContext(ItemContext context)
Definition: Item.h:424
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:108
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:2697
void SetAppearanceModId(uint32 appearanceModId)
Definition: Item.h:336
UpdateField< uint32, 0, 12 > MaxDurability
Definition: UpdateFields.h:128
void SetExpiration(uint32 expiration)
Definition: Item.h:197
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
void SetCreatePlayedTime(uint32 createPlayedTime)
Definition: Item.h:302
Player * GetOwner() const
Definition: Item.cpp:1112
void InitArtifactPowers(uint8 artifactId, uint8 artifactTier)
Definition: Item.cpp:2492
void SetCount(uint32 value)
Definition: Item.cpp:1240
void SetEntry(uint32 entry)
Definition: Object.h:156
#define sObjectMgr
Definition: ObjectMgr.h:1847
DB2Storage< ArtifactAppearanceSetEntry > sArtifactAppearanceSetStore("ArtifactAppearanceSet.db2", ArtifactAppearanceSetLoadInfo::Instance())
void SetContainedIn(ObjectGuid guid)
Definition: Item.h:190
DB2Storage< ArtifactAppearanceEntry > sArtifactAppearanceStore("ArtifactAppearance.db2", ArtifactAppearanceLoadInfo::Instance())
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
void CheckArtifactRelicSlotUnlock(Player const *owner)
Definition: Item.cpp:1038
BonusData _bonusData
Definition: Item.h:433
#define sConditionMgr
Definition: ConditionMgr.h:326
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2331
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:306
void SetDurability(uint32 durability)
Definition: Item.h:251
Definition: ItemTemplate.h:730
Definition: ItemDefines.h:205
virtual void SetObjectScale(float scale)
Definition: Object.h:159
Definition: DB2Structure.h:216
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
Definition: DB2Structure.h:236
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:188
Definition: DB2Structure.h:2571
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ 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
1547 {
1548  if (count < 1)
1549  return nullptr; //don't create item at zero count
1550 
1551  ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
1552  if (proto)
1553  {
1554  if (count > proto->GetMaxStackSize())
1555  count = proto->GetMaxStackSize();
1556 
1557  ASSERT(count != 0, "proto->Stackable == 0 but checked at loading already");
1558 
1559  Item* item = NewItemOrBag(proto);
1560  if (item->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), itemEntry, context, player))
1561  {
1562  item->SetCount(count);
1563  return item;
1564  }
1565  else
1566  delete item;
1567  }
1568  else
1569  ABORT();
1570  return nullptr;
1571 }
virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemId, ItemContext context, Player const *owner)
Definition: Item.cpp:446
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:808
void SetCount(uint32 value)
Definition: Item.cpp:1240
#define sObjectMgr
Definition: ObjectMgr.h:1847
Definition: Item.h:169
Item * NewItemOrBag(ItemTemplate const *proto)
Definition: Item.cpp:49
Definition: ItemTemplate.h:730
#define ABORT
Definition: Errors.h:60
#define ASSERT
Definition: Errors.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromDB() [1/2]

void Item::DeleteFromDB ( CharacterDatabaseTransaction trans,
ObjectGuid::LowType  itemGuid 
)
static
1055 {
1057  stmt->setUInt64(0, itemGuid);
1058  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1059 
1060  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
1061  stmt->setUInt64(0, itemGuid);
1062  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1063 
1064  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
1065  stmt->setUInt64(0, itemGuid);
1066  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1067 
1068  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
1069  stmt->setUInt64(0, itemGuid);
1070  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1071 
1072  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
1073  stmt->setUInt64(0, itemGuid);
1074  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1075 
1076  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
1077  stmt->setUInt64(0, itemGuid);
1078  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1079 
1080  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
1081  stmt->setUInt64(0, itemGuid);
1082  CharacterDatabase.ExecuteOrAppend(trans, stmt);
1083 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:171
Definition: CharacterDatabase.h:177
Definition: DatabaseEnvFwd.h:40
Definition: CharacterDatabase.h:161
Definition: CharacterDatabase.h:198
Definition: CharacterDatabase.h:164
Definition: CharacterDatabase.h:167
Definition: CharacterDatabase.h:174
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromDB() [2/2]

void Item::DeleteFromDB ( CharacterDatabaseTransaction trans)
virtual

Reimplemented in Bag, AzeriteItem, and AzeriteEmpoweredItem.

1086 {
1087  DeleteFromDB(trans, GetGUID().GetCounter());
1088 
1089  // Delete the items if this is a container
1090  if (!loot.isLooted())
1091  sLootItemStorage->RemoveStoredLootForContainer(GetGUID().GetCounter());
1092 }
static void DeleteFromDB(CharacterDatabaseTransaction &trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:1054
bool isLooted() const
Definition: Loot.h:240
#define sLootItemStorage
Definition: LootItemStorage.h:97
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Loot loot
Definition: Item.h:308

◆ DeleteFromInventoryDB() [1/2]

void Item::DeleteFromInventoryDB ( CharacterDatabaseTransaction trans,
ObjectGuid::LowType  itemGuid 
)
static
1096 {
1098  stmt->setUInt64(0, itemGuid);
1099  trans->Append(stmt);
1100 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: DatabaseEnvFwd.h:40
Definition: CharacterDatabase.h:537
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeleteFromInventoryDB() [2/2]

void Item::DeleteFromInventoryDB ( CharacterDatabaseTransaction trans)
1103 {
1104  DeleteFromInventoryDB(trans, GetGUID().GetCounter());
1105 }
ObjectGuid const & GetGUID() const
Definition: Object.h:154
static void DeleteFromInventoryDB(CharacterDatabaseTransaction &trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:1095

◆ DeleteRefundDataFromDB()

void Item::DeleteRefundDataFromDB ( CharacterDatabaseTransaction trans)
1734 {
1735  if (trans)
1736  {
1738  stmt->setUInt64(0, GetGUID().GetCounter());
1739  (*trans)->Append(stmt);
1740 
1741  }
1742 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: DatabaseEnvFwd.h:40
ObjectGuid const & GetGUID() const
Definition: Object.h:154
Definition: CharacterDatabase.h:469
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
+ Here is the call graph for this function:

◆ FSetState()

void Item::FSetState ( ItemUpdateState  state)
inline
317  {
318  uState = state;
319  }
ItemUpdateState uState
Definition: Item.h:439
+ Here is the caller graph for this function:

◆ GemsFitSockets()

bool Item::GemsFitSockets ( ) const
1473 {
1474  uint32 gemSlot = 0;
1475  for (UF::SocketedGem const& gemData : m_itemData->Gems)
1476  {
1477  SocketColor color = GetTemplate()->GetSocketColor(gemSlot);
1478  if (!color) // no socket slot
1479  continue;
1480 
1481  uint32 GemColor = 0;
1482 
1483  ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemData.ItemID);
1484  if (gemProto)
1485  {
1486  GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GetGemProperties());
1487  if (gemProperty)
1488  GemColor = gemProperty->Type;
1489  }
1490 
1491  if (!(GemColor & SocketColorToGemTypeMask[color])) // bad gem color on this socket
1492  return false;
1493  }
1494  return true;
1495 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
SocketColor GetSocketColor(uint32 index) const
Definition: ItemTemplate.h:778
int32 const SocketColorToGemTypeMask[19]
Definition: ItemTemplate.cpp:23
#define sObjectMgr
Definition: ObjectMgr.h:1847
uint32 GetGemProperties() const
Definition: ItemTemplate.h:780
UpdateField< int32, 0, 1 > ItemID
Definition: UpdateFields.h:106
SocketColor
Definition: ItemTemplate.h:344
Definition: UpdateFields.h:104
DB2Storage< GemPropertiesEntry > sGemPropertiesStore("GemProperties.db2", GemPropertiesLoadInfo::Instance())
Definition: DB2Structure.h:1689
uint32_t uint32
Definition: Define.h:152
Definition: ItemTemplate.h:730
int32 Type
Definition: DB2Structure.h:1693
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAppearanceModId()

uint32 Item::GetAppearanceModId ( ) const
inline
335 { return m_itemData->ItemAppearanceModID; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetArtifactPower()

UF::ArtifactPower const * Item::GetArtifactPower ( uint32  artifactPowerId) const
2458 {
2459  auto indexItr = m_artifactPowerIdToIndex.find(artifactPowerId);
2460  if (indexItr != m_artifactPowerIdToIndex.end())
2461  return &m_itemData->ArtifactPowers[indexItr->second];
2462 
2463  return nullptr;
2464 }
std::unordered_map< uint32, uint16 > m_artifactPowerIdToIndex
Definition: Item.h:449
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetBagSlot()

uint8 Item::GetBagSlot ( ) const
1206 {
1208 }
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:613
Bag * m_container
Definition: Item.h:438
uint8 GetSlot() const
Definition: Item.h:271
uint8_t uint8
Definition: Define.h:154
+ Here is the caller graph for this function:

◆ GetBonding()

ItemBondingType Item::GetBonding ( ) const
inline
199 { return _bonusData.Bonding; }
BonusData _bonusData
Definition: Item.h:433
ItemBondingType Bonding
Definition: Item.h:77
+ Here is the caller graph for this function:

◆ GetBonus()

BonusData const* Item::GetBonus ( ) const
inline
185 { return &_bonusData; }
BonusData _bonusData
Definition: Item.h:433
+ Here is the caller graph for this function:

◆ GetBuyPrice() [1/2]

uint32 Item::GetBuyPrice ( Player const *  owner,
bool &  standardPrice 
) const
2011 {
2012  return Item::GetBuyPrice(GetTemplate(), GetQuality(), GetItemLevel(owner), standardPrice);
2013 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint32 GetQuality() const
Definition: Item.h:327
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2174
uint32 GetBuyPrice(Player const *owner, bool &standardPrice) const
Definition: Item.cpp:2010
+ Here is the caller graph for this function:

◆ GetBuyPrice() [2/2]

uint32 Item::GetBuyPrice ( ItemTemplate const *  proto,
uint32  quality,
uint32  itemLevel,
bool &  standardPrice 
)
static
2016 {
2017  standardPrice = false;
2018 
2019  if (proto->GetFlags2() & ITEM_FLAG2_OVERRIDE_GOLD_COST)
2020  return proto->GetBuyPrice();
2021 
2022  ImportPriceQualityEntry const* qualityPrice = sImportPriceQualityStore.LookupEntry(quality + 1);
2023  if (!qualityPrice)
2024  return 0;
2025 
2026  ItemPriceBaseEntry const* basePrice = sItemPriceBaseStore.LookupEntry(itemLevel);
2027  if (!basePrice)
2028  return 0;
2029 
2030  float qualityFactor = qualityPrice->Data;
2031  float baseFactor = 0.0f;
2032 
2033  uint32 inventoryType = proto->GetInventoryType();
2034 
2035  if (inventoryType == INVTYPE_WEAPON ||
2036  inventoryType == INVTYPE_2HWEAPON ||
2037  inventoryType == INVTYPE_WEAPONMAINHAND ||
2038  inventoryType == INVTYPE_WEAPONOFFHAND ||
2039  inventoryType == INVTYPE_RANGED ||
2040  inventoryType == INVTYPE_THROWN ||
2041  inventoryType == INVTYPE_RANGEDRIGHT)
2042  baseFactor = basePrice->Weapon;
2043  else
2044  baseFactor = basePrice->Armor;
2045 
2046  if (inventoryType == INVTYPE_ROBE)
2047  inventoryType = INVTYPE_CHEST;
2048 
2049  if (proto->GetClass() == ITEM_CLASS_GEM && proto->GetSubClass() == ITEM_SUBCLASS_GEM_ARTIFACT_RELIC)
2050  {
2051  inventoryType = INVTYPE_WEAPON;
2052  baseFactor = basePrice->Weapon / 3.0f;
2053  }
2054 
2055  float typeFactor = 0.0f;
2056  int8 weapType = -1;
2057 
2058  switch (inventoryType)
2059  {
2060  case INVTYPE_HEAD:
2061  case INVTYPE_NECK:
2062  case INVTYPE_SHOULDERS:
2063  case INVTYPE_CHEST:
2064  case INVTYPE_WAIST:
2065  case INVTYPE_LEGS:
2066  case INVTYPE_FEET:
2067  case INVTYPE_WRISTS:
2068  case INVTYPE_HANDS:
2069  case INVTYPE_FINGER:
2070  case INVTYPE_TRINKET:
2071  case INVTYPE_CLOAK:
2072  case INVTYPE_HOLDABLE:
2073  {
2074  ImportPriceArmorEntry const* armorPrice = sImportPriceArmorStore.LookupEntry(inventoryType);
2075  if (!armorPrice)
2076  return 0;
2077 
2078  switch (proto->GetSubClass())
2079  {
2082  typeFactor = armorPrice->ClothModifier;
2083  break;
2085  typeFactor = armorPrice->LeatherModifier;
2086  break;
2088  typeFactor = armorPrice->ChainModifier;
2089  break;
2091  typeFactor = armorPrice->PlateModifier;
2092  break;
2093  default:
2094  typeFactor = 1.0f;
2095  break;
2096  }
2097 
2098  break;
2099  }
2100  case INVTYPE_SHIELD:
2101  {
2102  ImportPriceShieldEntry const* shieldPrice = sImportPriceShieldStore.LookupEntry(2);
2103  if (!shieldPrice)
2104  return 0;
2105 
2106  typeFactor = shieldPrice->Data;
2107  break;
2108  }
2110  weapType = 0;
2111  break;
2112  case INVTYPE_WEAPONOFFHAND:
2113  weapType = 1;
2114  break;
2115  case INVTYPE_WEAPON:
2116  weapType = 2;
2117  break;
2118  case INVTYPE_2HWEAPON:
2119  weapType = 3;
2120  break;
2121  case INVTYPE_RANGED:
2122  case INVTYPE_RANGEDRIGHT:
2123  case INVTYPE_RELIC:
2124  weapType = 4;
2125  break;
2126  default:
2127  return proto->GetBuyPrice();
2128  }
2129 
2130  if (weapType != -1)
2131  {
2132  ImportPriceWeaponEntry const* weaponPrice = sImportPriceWeaponStore.LookupEntry(weapType + 1);
2133  if (!weaponPrice)
2134  return 0;
2135 
2136  typeFactor = weaponPrice->Data;
2137  }
2138 
2139  standardPrice = false;
2140  return uint32(proto->GetPriceVariance() * typeFactor * baseFactor * qualityFactor * proto->GetPriceRandomValue());
2141 }
Definition: DB2Structure.h:1805
float LeatherModifier
Definition: DB2Structure.h:1794
DB2Storage< ImportPriceShieldEntry > sImportPriceShieldStore("ImportPriceShield.db2", ImportPriceShieldLoadInfo::Instance())
float Weapon
Definition: DB2Structure.h:2088
Definition: ItemTemplate.h:228
Definition: ItemTemplate.h:397
int8_t int8
Definition: Define.h:150
Definition: ItemTemplate.h:378
Definition: ItemTemplate.h:384
float Armor
Definition: DB2Structure.h:2087
float ChainModifier
Definition: DB2Structure.h:1795
Definition: ItemTemplate.h:380
Definition: ItemTemplate.h:382
Definition: DB2Structure.h:1790
float PlateModifier
Definition: DB2Structure.h:1796
Definition: ItemTemplate.h:394
Definition: ItemTemplate.h:383
Definition: DB2Structure.h:2083
DB2Storage< ImportPriceArmorEntry > sImportPriceArmorStore("ImportPriceArmor.db2", ImportPriceArmorLoadInfo::Instance())
Definition: ItemTemplate.h:410
Definition: ItemTemplate.h:375
Definition: ItemTemplate.h:388
Definition: ItemTemplate.h:381
Definition: ItemTemplate.h:518
Definition: DB2Structure.h:1811
Definition: ItemTemplate.h:517
Definition: ItemTemplate.h:373
Definition: ItemTemplate.h:398
Definition: ItemTemplate.h:392
Definition: ItemTemplate.h:385
Definition: ItemTemplate.h:393
Definition: ItemTemplate.h:516
uint32_t uint32
Definition: Define.h:152
DB2Storage< ImportPriceQualityEntry > sImportPriceQualityStore("ImportPriceQuality.db2", ImportPriceQualityLoadInfo::Instance())
Definition: ItemTemplate.h:379
Definition: ItemTemplate.h:386
Definition: ItemTemplate.h:395
float ClothModifier
Definition: DB2Structure.h:1793
Definition: ItemTemplate.h:514
float Data
Definition: DB2Structure.h:1802
float Data
Definition: DB2Structure.h:1808
Definition: ItemTemplate.h:387
Definition: ItemTemplate.h:400
Definition: ItemTemplate.h:377
Definition: ItemTemplate.h:374
Definition: DB2Structure.h:1799
float Data
Definition: DB2Structure.h:1814
Definition: ItemTemplate.h:515
Definition: ItemTemplate.h:507
DB2Storage< ImportPriceWeaponEntry > sImportPriceWeaponStore("ImportPriceWeapon.db2", ImportPriceWeaponLoadInfo::Instance())
Definition: ItemTemplate.h:389
DB2Storage< ItemPriceBaseEntry > sItemPriceBaseStore("ItemPriceBase.db2", ItemPriceBaseLoadInfo::Instance())
+ Here is the call graph for this function:

◆ GetChildItem()

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

◆ GetContainedIn()

ObjectGuid Item::GetContainedIn ( ) const
inline
189 { return m_itemData->ContainedIn; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429

◆ GetContainer()

Bag* Item::GetContainer ( )
inline
272 { return m_container; }
Bag * m_container
Definition: Item.h:438
+ Here is the caller graph for this function:

◆ GetContext()

ItemContext Item::GetContext ( ) const
inline
423 { return ItemContext(*m_itemData->Context); }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
ItemContext
Definition: DBCEnums.h:833
+ Here is the caller graph for this function:

◆ GetCount()

uint32 Item::GetCount ( ) const
inline
264 { return m_itemData->StackCount; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetCreator()

ObjectGuid Item::GetCreator ( ) const
inline
191 { return m_itemData->Creator; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetDisenchantLoot() [1/2]

ItemDisenchantLootEntry const * Item::GetDisenchantLoot ( Player const *  owner) const
2256 {
2258  return nullptr;
2259 
2261 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint32 GetQuality() const
Definition: Item.h:327
BonusData _bonusData
Definition: Item.h:433
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2174
bool CanDisenchant
Definition: Item.h:93
ItemDisenchantLootEntry const * GetDisenchantLoot(Player const *owner) const
Definition: Item.cpp:2255
+ Here is the caller graph for this function:

◆ GetDisenchantLoot() [2/2]

ItemDisenchantLootEntry const * Item::GetDisenchantLoot ( ItemTemplate const *  itemTemplate,
uint32  quality,
uint32  itemLevel 
)
static
2264 {
2265  if (itemTemplate->GetFlags() & (ITEM_FLAG_CONJURED | ITEM_FLAG_NO_DISENCHANT) || itemTemplate->GetBonding() == BIND_QUEST)
2266  return nullptr;
2267 
2268  if (itemTemplate->GetArea(0) || itemTemplate->GetArea(1) || itemTemplate->GetMap() || itemTemplate->GetMaxStackSize() > 1)
2269  return nullptr;
2270 
2271  if (!Item::GetSellPrice(itemTemplate, quality, itemLevel) && !sDB2Manager.HasItemCurrencyCost(itemTemplate->GetId()))
2272  return nullptr;
2273 
2274  uint32 itemClass = itemTemplate->GetClass();
2275  int8 itemSubClass = itemTemplate->GetSubClass();
2276  uint8 expansion = itemTemplate->GetRequiredExpansion();
2277  for (ItemDisenchantLootEntry const* disenchant : sItemDisenchantLootStore)
2278  {
2279  if (disenchant->Class != itemClass)
2280  continue;
2281 
2282  if (disenchant->Subclass >= 0 && itemSubClass)
2283  continue;
2284 
2285  if (disenchant->Quality != quality)
2286  continue;
2287 
2288  if (disenchant->MinLevel > itemLevel || disenchant->MaxLevel < itemLevel)
2289  continue;
2290 
2291  if (disenchant->ExpansionID != -2 && disenchant->ExpansionID != expansion)
2292  continue;
2293 
2294  return disenchant;
2295  }
2296 
2297  return nullptr;
2298 }
Definition: ItemTemplate.h:179
#define sDB2Manager
Definition: DB2Stores.h:445
int8_t int8
Definition: Define.h:150
Definition: DB2Structure.h:1974
Definition: ItemTemplate.h:126
DB2Storage< ItemDisenchantLootEntry > sItemDisenchantLootStore("ItemDisenchantLoot.db2", ItemDisenchantLootLoadInfo::Instance())
uint32_t uint32
Definition: Define.h:152
uint32 GetSellPrice(Player const *owner) const
Definition: Item.cpp:2143
Definition: ItemTemplate.h:193
uint8_t uint8
Definition: Define.h:154
+ Here is the call graph for this function:

◆ GetDisplayId()

uint32 Item::GetDisplayId ( Player const *  owner) const
2301 {
2302  uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2303  if (!itemModifiedAppearanceId)
2304  itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2305 
2306  if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2307  if (ItemAppearanceEntry const* itemAppearance = sItemAppearanceStore.LookupEntry(transmog->ItemAppearanceID))
2308  return itemAppearance->ItemDisplayInfoID;
2309 
2310  return sDB2Manager.GetItemDisplayId(GetEntry(), GetAppearanceModId());
2311 }
#define sDB2Manager
Definition: DB2Stores.h:445
Definition: DB2Structure.h:2056
Definition: DB2Structure.h:1831
uint32 GetAppearanceModId() const
Definition: Item.h:335
ItemModifier const AppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:264
Definition: ItemDefines.h:197
uint32_t uint32
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:155
DB2Storage< ItemAppearanceEntry > sItemAppearanceStore("ItemAppearance.db2", ItemAppearanceLoadInfo::Instance())
DB2Storage< ItemModifiedAppearanceEntry > sItemModifiedAppearanceStore("ItemModifiedAppearance.db2", ItemModifiedAppearanceLoadInfo::Instance())
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEffect()

ItemEffectEntry const* Item::GetEffect ( std::size_t  i) const
inline
346  {
347  ASSERT(i < _bonusData.EffectCount, "Attempted to get effect at index " SZFMTD " but item has only " SZFMTD " effects!", i, _bonusData.EffectCount);
348  return _bonusData.Effects[i];
349  }
#define SZFMTD
Definition: Define.h:145
BonusData _bonusData
Definition: Item.h:433
std::array< ItemEffectEntry const *, 13 > Effects
Definition: Item.h:91
std::size_t EffectCount
Definition: Item.h:92
#define ASSERT
Definition: Errors.h:57
+ Here is the caller graph for this function:

◆ GetEffects()

Trinity::IteratorPair<ItemEffectEntry const* const*> Item::GetEffects ( ) const
inline
344 { return { std::make_pair(&_bonusData.Effects[0], &_bonusData.Effects[0] + _bonusData.EffectCount) }; }
BonusData _bonusData
Definition: Item.h:433
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
291 { return m_itemData->Enchantment[slot].Charges; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetEnchantmentDuration()

uint32 Item::GetEnchantmentDuration ( EnchantmentSlot  slot) const
inline
290 { return m_itemData->Enchantment[slot].Duration; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetEnchantmentId()

uint32 Item::GetEnchantmentId ( EnchantmentSlot  slot) const
inline
289 { return m_itemData->Enchantment[slot].ID; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetEnchantRequiredLevel()

uint32 Item::GetEnchantRequiredLevel ( ) const
1271 {
1272  uint32 level = 0;
1273 
1274  // Check all enchants for required level
1275  for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
1276  {
1277  if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
1278  if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
1279  if (enchantEntry->MinLevel > level)
1280  level = enchantEntry->MinLevel;
1281  }
1282 
1283  return level;
1284 }
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", SpellItemEnchantmentLoadInfo::Instance())
EnchantmentSlot
Definition: ItemDefines.h:163
Definition: DB2Structure.h:3161
uint32_t uint32
Definition: Define.h:152
Definition: ItemDefines.h:165
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:289
Definition: ItemDefines.h:181

◆ GetGem()

UF::SocketedGem const * Item::GetGem ( uint16  slot) const
1408 {
1409  ASSERT(slot < MAX_GEM_SOCKETS);
1410  return slot < m_itemData->Gems.size() ? &m_itemData->Gems[slot] : nullptr;
1411 }
#define MAX_GEM_SOCKETS
Definition: Item.h:48
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
#define ASSERT
Definition: Errors.h:57
+ Here is the caller graph for this function:

◆ GetGemCountWithID()

uint8 Item::GetGemCountWithID ( uint32  GemID) const
1498 {
1499  return uint8(std::count_if(m_itemData->Gems.begin(), m_itemData->Gems.end(), [GemID](UF::SocketedGem const& gemData)
1500  {
1501  return gemData.ItemID == int32(GemID);
1502  }));
1503 }
Definition: UpdateFields.h:104
int32_t int32
Definition: Define.h:148
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8_t uint8
Definition: Define.h:154
+ Here is the caller graph for this function:

◆ GetGemCountWithLimitCategory()

uint8 Item::GetGemCountWithLimitCategory ( uint32  limitCategory) const
1506 {
1507  return uint8(std::count_if(m_itemData->Gems.begin(), m_itemData->Gems.end(), [limitCategory](UF::SocketedGem const& gemData)
1508  {
1509  ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemData.ItemID);
1510  if (!gemProto)
1511  return false;
1512 
1513  return gemProto->GetItemLimitCategory() == limitCategory;
1514  }));
1515 }
#define sObjectMgr
Definition: ObjectMgr.h:1847
uint32 GetItemLimitCategory() const
Definition: ItemTemplate.h:783
Definition: UpdateFields.h:104
Definition: ItemTemplate.h:730
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8_t uint8
Definition: Define.h:154
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetGiftCreator()

ObjectGuid Item::GetGiftCreator ( ) const
inline
193 { return m_itemData->GiftCreator; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetItemLevel() [1/2]

uint32 Item::GetItemLevel ( Player const *  owner) const
2175 {
2176  ItemTemplate const* itemTemplate = GetTemplate();
2177  uint32 minItemLevel = owner->m_unitData->MinItemLevel;
2178  uint32 minItemLevelCutoff = owner->m_unitData->MinItemLevelCutoff;
2179  uint32 maxItemLevel = itemTemplate->GetFlags3() & ITEM_FLAG3_IGNORE_ITEM_LEVEL_CAP_IN_PVP ? 0 : owner->m_unitData->MaxItemLevel;
2180  bool pvpBonus = owner->IsUsingPvpItemLevels();
2181  uint32 azeriteLevel = 0;
2182  if (AzeriteItem const* azeriteItem = ToAzeriteItem())
2183  azeriteLevel = azeriteItem->GetEffectiveLevel();
2184  return Item::GetItemLevel(itemTemplate, _bonusData, owner->getLevel(), GetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL),
2185  minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus, azeriteLevel);
2186 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemDefines.h:206
AzeriteItem * ToAzeriteItem()
Definition: Item.h:239
uint32_t uint32
Definition: Define.h:152
uint32 GetFlags3() const
Definition: ItemTemplate.h:741
Definition: ItemTemplate.h:258
BonusData _bonusData
Definition: Item.h:433
Definition: ItemTemplate.h:730
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2174
Definition: AzeriteItem.h:29
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemLevel() [2/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
2190 {
2191  if (!itemTemplate)
2192  return MIN_ITEM_LEVEL;
2193 
2194  uint32 itemLevel = itemTemplate->GetBaseItemLevel();
2195  if (AzeriteLevelInfoEntry const* azeriteLevelInfo = sAzeriteLevelInfoStore.LookupEntry(azeriteLevel))
2196  itemLevel = azeriteLevelInfo->ItemLevel;
2197 
2198  if (bonusData.PlayerLevelToItemLevelCurveId)
2199  {
2200  if (fixedLevel)
2201  level = fixedLevel;
2202  else if (Optional<ContentTuningLevels> levels = sDB2Manager.GetContentTuningData(bonusData.ContentTuningId, 0, true))
2203  level = std::min(std::max(int16(level), levels->MinLevel), levels->MaxLevel);
2204 
2205  itemLevel = uint32(sDB2Manager.GetCurveValueAt(bonusData.PlayerLevelToItemLevelCurveId, level));
2206  }
2207 
2208  itemLevel += bonusData.ItemLevelBonus;
2209 
2210  for (uint32 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i)
2211  itemLevel += bonusData.GemItemLevelBonus[i];
2212 
2213  uint32 itemLevelBeforeUpgrades = itemLevel;
2214 
2215  if (pvpBonus)
2216  itemLevel += sDB2Manager.GetPvpItemLevelBonus(itemTemplate->GetId());
2217 
2218  if (itemTemplate->GetInventoryType() != INVTYPE_NON_EQUIP)
2219  {
2220  if (minItemLevel && (!minItemLevelCutoff || itemLevelBeforeUpgrades >= minItemLevelCutoff) && itemLevel < minItemLevel)
2221  itemLevel = minItemLevel;
2222 
2223  if (maxItemLevel && itemLevel > maxItemLevel)
2224  itemLevel = maxItemLevel;
2225  }
2226 
2227  return std::min(std::max(itemLevel, uint32(MIN_ITEM_LEVEL)), uint32(MAX_ITEM_LEVEL));
2228 }
#define sDB2Manager
Definition: DB2Stores.h:445
Definition: ItemTemplate.h:724
DB2Storage< AzeriteLevelInfoEntry > sAzeriteLevelInfoStore("AzeriteLevelInfo.db2", AzeriteLevelInfoLoadInfo::Instance())
Definition: DB2Structure.h:375
Definition: ItemTemplate.h:723
#define MAX_ITEM_PROTO_SOCKETS
Definition: DBCEnums.h:731
uint32_t uint32
Definition: Define.h:152
int16_t int16
Definition: Define.h:149
Definition: ItemTemplate.h:372
Definition: OptionalFwd.h:24
+ Here is the call graph for this function:

◆ GetItemModifiedAppearance()

ItemModifiedAppearanceEntry const * Item::GetItemModifiedAppearance ( ) const
2314 {
2315  return sDB2Manager.GetItemModifiedAppearance(GetEntry(), _bonusData.AppearanceModID);
2316 }
#define sDB2Manager
Definition: DB2Stores.h:445
BonusData _bonusData
Definition: Item.h:433
uint32 GetEntry() const
Definition: Object.h:155
uint32 AppearanceModID
Definition: Item.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemRandomBonusListId()

ItemRandomBonusListId Item::GetItemRandomBonusListId ( ) const
inline
283 { return m_randomBonusListId; }
ItemRandomBonusListId m_randomBonusListId
Definition: Item.h:447
+ Here is the caller graph for this function:

◆ GetItemStatType()

int32 Item::GetItemStatType ( uint32  index) const
inline
332 { ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:732
int32 ItemStatType[MAX_ITEM_PROTO_STATS]
Definition: Item.h:73
BonusData _bonusData
Definition: Item.h:433
#define ASSERT
Definition: Errors.h:57
+ Here is the caller graph for this function:

◆ GetItemStatValue()

float Item::GetItemStatValue ( uint32  index,
Player const *  owner 
) const
2231 {
2232  ASSERT(index < MAX_ITEM_PROTO_STATS);
2233  switch (GetItemStatType(index))
2234  {
2235  case ITEM_MOD_CORRUPTION:
2237  return _bonusData.StatPercentEditor[index];
2238  default:
2239  break;
2240  }
2241 
2242  uint32 itemLevel = GetItemLevel(owner);
2243  if (float randomPropPoints = GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate()->GetInventoryType(), GetTemplate()->GetSubClass()))
2244  {
2245  float statValue = float(_bonusData.StatPercentEditor[index] * randomPropPoints) * 0.0001f;
2246  if (GtItemSocketCostPerLevelEntry const* gtCost = sItemSocketCostPerLevelGameTable.GetRow(itemLevel))
2247  statValue -= float(int32(_bonusData.ItemStatSocketCostMultiplier[index] * gtCost->SocketCost));
2248 
2249  return statValue;
2250  }
2251 
2252  return 0.0f;
2253 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
TC_GAME_API float GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
Definition: ItemEnchantmentMgr.cpp:110
uint32 GetQuality() const
Definition: Item.h:327
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]
Definition: Item.h:75
int32 GetItemStatType(uint32 index) const
Definition: Item.h:332
Definition: GameTables.h:108
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:732
int32_t int32
Definition: Define.h:148
Definition: ItemTemplate.h:47
int32 StatPercentEditor[MAX_ITEM_PROTO_STATS]
Definition: Item.h:74
uint32_t uint32
Definition: Define.h:152
BonusData _bonusData
Definition: Item.h:433
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2174
#define ASSERT
Definition: Errors.h:57
Definition: ItemTemplate.h:48
GameTable< GtItemSocketCostPerLevelEntry > sItemSocketCostPerLevelGameTable
Definition: GameTables.cpp:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMaxStackCount()

uint32 Item::GetMaxStackCount ( ) const
inline
266 { return GetTemplate()->GetMaxStackSize(); }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:808
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetModifier()

uint32 Item::GetModifier ( ItemModifier  modifier) const
2319 {
2320  int32 modifierIndex = m_itemData->Modifiers->Values.FindIndexIf([modifier](UF::ItemMod mod)
2321  {
2322  return mod.Type == modifier;
2323  });
2324 
2325  if (modifierIndex != -1)
2326  return m_itemData->Modifiers->Values[modifierIndex].Value;
2327 
2328  return 0;
2329 }
uint8 Type
Definition: UpdateFields.h:75
int32_t int32
Definition: Define.h:148
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
Definition: UpdateFields.h:72
+ Here is the caller graph for this function:

◆ GetNameForLocaleIdx()

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

Implements Object.

503 {
504  ItemTemplate const* itemTemplate = GetTemplate();
505  if (ItemNameDescriptionEntry const* suffix = sItemNameDescriptionStore.LookupEntry(_bonusData.Suffix))
506  return Trinity::StringFormat("%s %s", itemTemplate->GetName(locale), suffix->Description[locale]);
507 
508  return itemTemplate->GetName(locale);
509 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
char const * GetName(LocaleConstant locale) const
Definition: ItemTemplate.cpp:46
Definition: DB2Structure.h:2076
BonusData _bonusData
Definition: Item.h:433
DB2Storage< ItemNameDescriptionEntry > sItemNameDescriptionStore("ItemNameDescription.db2", ItemNameDescriptionLoadInfo::Instance())
Definition: ItemTemplate.h:730
std::string StringFormat(Format &&fmt, Args &&... args)
Default TC string format function.
Definition: StringFormat.h:27
uint32 Suffix
Definition: Item.h:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwner()

Player * Item::GetOwner ( ) const
1113 {
1115 }
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:254
ObjectGuid GetOwnerGUID() const
Definition: Item.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid Item::GetOwnerGUID ( ) const
inline
187 { return m_itemData->Owner; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetPaidExtendedCost()

uint32 Item::GetPaidExtendedCost ( ) const
inline
359 { return m_paidExtendedCost; }
uint32 m_paidExtendedCost
Definition: Item.h:445
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPaidMoney()

uint64 Item::GetPaidMoney ( ) const
inline
358 { return m_paidMoney; }
uint64 m_paidMoney
Definition: Item.h:444
+ Here is the caller graph for this function:

◆ GetPlayedTime()

uint32 Item::GetPlayedTime ( )
1797 {
1798  time_t curtime = GameTime::GetGameTime();
1799  uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
1800  return *m_itemData->CreatePlayedTime + elapsed;
1801 }
time_t m_lastPlayedTimeUpdate
Definition: Item.h:442
time_t GetGameTime()
Definition: GameTime.cpp:39
uint32_t uint32
Definition: Define.h:152
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPos()

uint16 Item::GetPos ( ) const
inline
275 { return uint16(GetBagSlot()) << 8 | GetSlot(); }
uint8 GetBagSlot() const
Definition: Item.cpp:1205
uint16_t uint16
Definition: Define.h:153
uint8 GetSlot() const
Definition: Item.h:271
+ Here is the caller graph for this function:

◆ GetQuality()

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

◆ GetQueuePos()

uint16 Item::GetQueuePos ( ) const
inline
315 { return uQueuePos; }
int16 uQueuePos
Definition: Item.h:440
+ Here is the caller graph for this function:

◆ GetRefundRecipient()

ObjectGuid const& Item::GetRefundRecipient ( ) const
inline
357 { return m_refundRecipient; }
ObjectGuid m_refundRecipient
Definition: Item.h:443
+ Here is the caller graph for this function:

◆ GetRepairCostMultiplier()

float Item::GetRepairCostMultiplier ( ) const
inline
float RepairCostMultiplier
Definition: Item.h:79
BonusData _bonusData
Definition: Item.h:433
+ Here is the caller graph for this function:

◆ GetRequiredLevel()

int32 Item::GetRequiredLevel ( ) const
2686 {
2689  return sDB2Manager.GetCurveValueAt(_bonusData.RequiredLevelCurve, fixedLevel);
2693  return fixedLevel;
2694  return _bonusData.RequiredLevel;
2695 }
#define sDB2Manager
Definition: DB2Stores.h:445
uint32 PlayerLevelToItemLevelCurveId
Definition: Item.h:81
bool HasFixedLevel
Definition: Item.h:95
Definition: ItemDefines.h:206
int32 RequiredLevelCurve
Definition: Item.h:90
int32 RequiredLevel
Definition: Item.h:72
int32_t int32
Definition: Define.h:148
BonusData _bonusData
Definition: Item.h:433
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
int32 RequiredLevelOverride
Definition: Item.h:87
+ Here is the caller graph for this function:

◆ GetScalingContentTuningId()

uint32 Item::GetScalingContentTuningId ( ) const
inline
340 { return _bonusData.ContentTuningId; }
BonusData _bonusData
Definition: Item.h:433
uint32 ContentTuningId
Definition: Item.h:80
+ Here is the caller graph for this function:

◆ GetScriptId()

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

◆ GetSellPrice() [1/2]

uint32 Item::GetSellPrice ( Player const *  owner) const
2144 {
2146 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint32 GetQuality() const
Definition: Item.h:327
uint32 GetSellPrice(Player const *owner) const
Definition: Item.cpp:2143
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:2174
+ Here is the caller graph for this function:

◆ GetSellPrice() [2/2]

uint32 Item::GetSellPrice ( ItemTemplate const *  proto,
uint32  quality,
uint32  itemLevel 
)
static
2149 {
2150  if (proto->GetFlags2() & ITEM_FLAG2_OVERRIDE_GOLD_COST)
2151  return proto->GetSellPrice();
2152  else
2153  {
2154  bool standardPrice;
2155  uint32 cost = Item::GetBuyPrice(proto, quality, itemLevel, standardPrice);
2156 
2157  if (standardPrice)
2158  {
2159  if (ItemClassEntry const* classEntry = sDB2Manager.GetItemClassByOldEnum(proto->GetClass()))
2160  {
2161  uint32 buyCount = std::max(proto->GetBuyCount(), 1u);
2162  return cost * classEntry->PriceModifier / buyCount;
2163  }
2164 
2165  return 0;
2166  }
2167  else
2168  return proto->GetSellPrice();
2169  }
2170 
2171  return 0;
2172 }
#define sDB2Manager
Definition: DB2Stores.h:445
Definition: ItemTemplate.h:228
uint32_t uint32
Definition: Define.h:152
uint32 GetBuyPrice(Player const *owner, bool &standardPrice) const
Definition: Item.cpp:2010
Definition: DB2Structure.h:1924
+ Here is the call graph for this function:

◆ GetSkill()

uint32 Item::GetSkill ( )
1119 {
1120  ItemTemplate const* proto = GetTemplate();
1121  return proto->GetSkill();
1122 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemTemplate.h:730
uint32 GetSkill() const
Definition: ItemTemplate.cpp:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSlot()

uint8 Item::GetSlot ( ) const
inline
271 {return m_slot;}
uint8 m_slot
Definition: Item.h:437
+ Here is the caller graph for this function:

◆ GetSocketColor()

SocketColor Item::GetSocketColor ( uint32  index) const
inline
334 { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return SocketColor(_bonusData.SocketColor[index]); }
SocketColor
Definition: ItemTemplate.h:344
#define MAX_ITEM_PROTO_SOCKETS
Definition: DBCEnums.h:731
uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:76
BonusData _bonusData
Definition: Item.h:433
#define ASSERT
Definition: Errors.h:57
+ Here is the caller graph for this function:

◆ GetSpellCharges()

int32 Item::GetSpellCharges ( uint8  index = 0) const
inline
305 { return m_itemData->SpellCharges[index]; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ GetState()

ItemUpdateState Item::GetState ( ) const
inline
312 { return uState; }
ItemUpdateState uState
Definition: Item.h:439
+ Here is the caller graph for this function:

◆ GetTemplate()

ItemTemplate const * Item::GetTemplate ( ) const
1108 {
1109  return sObjectMgr->GetItemTemplate(GetEntry());
1110 }
#define sObjectMgr
Definition: ObjectMgr.h:1847
uint32 GetEntry() const
Definition: Object.h:155
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetText()

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

◆ GetTotalPurchasedArtifactPowers()

uint32 Item::GetTotalPurchasedArtifactPowers ( ) const
2534 {
2535  uint32 purchasedRanks = 0;
2536  for (UF::ArtifactPower const& power : m_itemData->ArtifactPowers)
2537  purchasedRanks += power.PurchasedRank;
2538 
2539  return purchasedRanks;
2540 }
uint8 PurchasedRank
Definition: UpdateFields.h:95
uint32_t uint32
Definition: Define.h:152
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
Definition: UpdateFields.h:92
+ Here is the caller graph for this function:

◆ GetTotalUnlockedArtifactPowers()

uint32 Item::GetTotalUnlockedArtifactPowers ( ) const
2511 {
2513  uint64 artifactXp = m_itemData->ArtifactXP;
2514  uint32 currentArtifactTier = GetModifier(ITEM_MODIFIER_ARTIFACT_TIER);
2515  uint32 extraUnlocked = 0;
2516  do
2517  {
2518  uint64 xpCost = 0;
2519  if (GtArtifactLevelXPEntry const* cost = sArtifactLevelXPGameTable.GetRow(purchased + extraUnlocked + 1))
2520  xpCost = uint64(currentArtifactTier == MAX_ARTIFACT_TIER ? cost->XP2 : cost->XP);
2521 
2522  if (artifactXp < xpCost)
2523  break;
2524 
2525  artifactXp -= xpCost;
2526  ++extraUnlocked;
2527 
2528  } while (true);
2529 
2530  return purchased + extraUnlocked;
2531 }
Definition: GameTables.h:32
Definition: ItemDefines.h:221
uint32_t uint32
Definition: Define.h:152
uint64_t uint64
Definition: Define.h:151
#define MAX_ARTIFACT_TIER
Definition: DBCEnums.h:175
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
GameTable< GtArtifactLevelXPEntry > sArtifactLevelXPGameTable
Definition: GameTables.cpp:28
uint32 GetTotalPurchasedArtifactPowers() const
Definition: Item.cpp:2533
+ Here is the caller graph for this function:

◆ GetUpdateFieldFlagsFor()

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

Reimplemented from Object.

1618 {
1619  if (target->GetGUID() == GetOwnerGUID())
1621 
1623 }
ObjectGuid GetOwnerGUID() const
Definition: Item.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleAppearanceModId()

uint16 Item::GetVisibleAppearanceModId ( Player const *  owner) const
2376 {
2377  uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2378  if (!itemModifiedAppearanceId)
2379  itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2380 
2381  if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2382  return transmog->ItemAppearanceModifierID;
2383 
2384  return uint16(GetAppearanceModId());
2385 }
Definition: DB2Structure.h:2056
uint32 GetAppearanceModId() const
Definition: Item.h:335
ItemModifier const AppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:264
Definition: ItemDefines.h:197
uint32_t uint32
Definition: Define.h:152
uint16_t uint16
Definition: Define.h:153
DB2Storage< ItemModifiedAppearanceEntry > sItemModifiedAppearanceStore("ItemModifiedAppearance.db2", ItemModifiedAppearanceLoadInfo::Instance())
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleEnchantmentId()

uint32 Item::GetVisibleEnchantmentId ( Player const *  owner) const
2397 {
2398  uint32 enchantmentId = GetModifier(IllusionModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2399  if (!enchantmentId)
2401 
2402  if (!enchantmentId)
2403  enchantmentId = GetEnchantmentId(PERM_ENCHANTMENT_SLOT);
2404 
2405  return enchantmentId;
2406 }
ItemModifier const IllusionModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:273
uint32_t uint32
Definition: Define.h:152
Definition: ItemDefines.h:165
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:289
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
Definition: ItemDefines.h:204
+ Here is the call graph for this function:

◆ GetVisibleEntry()

uint32 Item::GetVisibleEntry ( Player const *  owner) const
2364 {
2365  uint32 itemModifiedAppearanceId = GetModifier(AppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2366  if (!itemModifiedAppearanceId)
2367  itemModifiedAppearanceId = GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS);
2368 
2369  if (ItemModifiedAppearanceEntry const* transmog = sItemModifiedAppearanceStore.LookupEntry(itemModifiedAppearanceId))
2370  return transmog->ItemID;
2371 
2372  return GetEntry();
2373 }
Definition: DB2Structure.h:2056
ItemModifier const AppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:264
Definition: ItemDefines.h:197
uint32_t uint32
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:155
DB2Storage< ItemModifiedAppearanceEntry > sItemModifiedAppearanceStore("ItemModifiedAppearance.db2", ItemModifiedAppearanceLoadInfo::Instance())
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetVisibleItemVisual()

uint16 Item::GetVisibleItemVisual ( Player const *  owner) const
2409 {
2410  if (SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(GetVisibleEnchantmentId(owner)))
2411  return enchant->ItemVisual;
2412 
2413  return 0;
2414 }
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", SpellItemEnchantmentLoadInfo::Instance())
uint32 GetVisibleEnchantmentId(Player const *owner) const
Definition: Item.cpp:2396
Definition: DB2Structure.h:3161
+ Here is the caller graph for this function:

◆ GetVisibleSecondaryModifiedAppearanceId()

int32 Item::GetVisibleSecondaryModifiedAppearanceId ( Player const *  owner) const
2388 {
2389  uint32 itemModifiedAppearanceId = GetModifier(SecondaryAppearanceModifierSlotBySpec[owner->GetActiveTalentGroup()]);
2390  if (!itemModifiedAppearanceId)
2392 
2393  return itemModifiedAppearanceId;
2394 }
uint32_t uint32
Definition: Define.h:152
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
ItemModifier const SecondaryAppearanceModifierSlotBySpec[MAX_SPECIALIZATIONS]
Definition: Item.cpp:282
+ 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 
)
2639 {
2640  Player* owner = GetOwner();
2641  if (!owner)
2642  return;
2643 
2644  if (artifactCategoryId)
2645  {
2646  uint32 artifactKnowledgeLevel = 1;
2647  if (sourceItem && sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL))
2648  artifactKnowledgeLevel = sourceItem->GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL);
2649 
2650  if (GtArtifactKnowledgeMultiplierEntry const* artifactKnowledge = sArtifactKnowledgeMultiplierGameTable.GetRow(artifactKnowledgeLevel))
2651  amount = uint64(amount * artifactKnowledge->Multiplier);
2652 
2653  if (amount >= 5000)
2654  amount = 50 * (amount / 50);
2655  else if (amount >= 1000)
2656  amount = 25 * (amount / 25);
2657  else if (amount >= 50)
2658  amount = 5 * (amount / 5);
2659  }
2660 
2661  SetArtifactXP(m_itemData->ArtifactXP + amount);
2662 
2664  artifactXpGain.ArtifactGUID = GetGUID();
2665  artifactXpGain.Amount = amount;
2666  owner->SendDirectMessage(artifactXpGain.Write());
2667 
2668  SetState(ITEM_CHANGED, owner);
2669 }
ObjectGuid ArtifactGUID
Definition: ArtifactPackets.h:99
Definition: ArtifactPackets.h:92
Player * GetOwner() const
Definition: Item.cpp:1112
Definition: ItemDefines.h:220
ObjectGuid const & GetGUID() const
Definition: Object.h:154
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6123
GameTable< GtArtifactKnowledgeMultiplierEntry > sArtifactKnowledgeMultiplierGameTable
Definition: GameTables.cpp:27
uint32_t uint32
Definition: Define.h:152
uint64_t uint64
Definition: Define.h:151
uint64 Amount
Definition: ArtifactPackets.h:100
Definition: Item.h:55
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1132
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
void SetArtifactXP(uint64 xp)
Definition: Item.h:420
Definition: GameTables.h:27
WorldPacket const * Write() override
Definition: ArtifactPackets.cpp:65
Definition: Player.h:1056
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2318
+ Here is the call graph for this function:

◆ HasEnchantRequiredSkill()

bool Item::HasEnchantRequiredSkill ( Player const *  player) const
1257 {
1258  // Check all enchants for required skill
1259  for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
1260  {
1261  if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
1262  if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
1263  if (enchantEntry->RequiredSkillID && player->GetSkillValue(enchantEntry->RequiredSkillID) < enchantEntry->RequiredSkillRank)
1264  return false;
1265  }
1266 
1267  return true;
1268 }
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", SpellItemEnchantmentLoadInfo::Instance())
EnchantmentSlot
Definition: ItemDefines.h:163
Definition: DB2Structure.h:3161
uint32_t uint32
Definition: Define.h:152
Definition: ItemDefines.h:165
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:289
Definition: ItemDefines.h:181
+ Here is the call graph for this function:

◆ hasInvolvedQuest()

bool Item::hasInvolvedQuest ( uint32  ) const
inlineoverridevirtual

Reimplemented from Object.

322 { return false; }

◆ HasItemFlag()

bool Item::HasItemFlag ( ItemFieldFlags  flag) const
inline
207 { return (*m_itemData->DynamicFlags & flag) != 0; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ HasItemFlag2()

bool Item::HasItemFlag2 ( ItemFieldFlags2  flag) const
inline
211 { return (*m_itemData->DynamicFlags2 & flag) != 0; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429

◆ hasQuest()

bool Item::hasQuest ( uint32  quest_id) const
inlineoverridevirtual

Reimplemented from Object.

321 { return GetTemplate()->GetStartQuest() == quest_id; }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint32 GetStartQuest() const
Definition: ItemTemplate.h:771
+ Here is the call graph for this function:

◆ HasStats() [1/2]

bool Item::HasStats ( ) const
1863 {
1864  ItemTemplate const* proto = GetTemplate();
1865  Player const* owner = GetOwner();
1866  for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1867  if ((owner ? GetItemStatValue(i, owner) : proto->GetStatPercentEditor(i)) != 0)
1868  return true;
1869 
1870  return false;
1871 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:732
Player * GetOwner() const
Definition: Item.cpp:1112
int32 GetStatPercentEditor(uint32 index) const
Definition: ItemTemplate.h:761
Definition: ItemTemplate.h:730
uint8_t uint8
Definition: Define.h:154
Definition: Player.h:1056
float GetItemStatValue(uint32 index, Player const *owner) const
Definition: Item.cpp:2230
+ Here is the call graph for this function:

◆ HasStats() [2/2]

bool Item::HasStats ( WorldPackets::Item::ItemInstance const &  itemInstance,
BonusData const *  bonus 
)
static
1874 {
1875  for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1876  if (bonus->StatPercentEditor[i] != 0)
1877  return true;
1878 
1879  return false;
1880 }
#define MAX_ITEM_PROTO_STATS
Definition: DBCEnums.h:732
uint8_t uint8
Definition: Define.h:154

◆ InitArtifactPowers()

void Item::InitArtifactPowers ( uint8  artifactId,
uint8  artifactTier 
)
2493 {
2494  for (ArtifactPowerEntry const* artifactPower : sDB2Manager.GetArtifactPowers(artifactId))
2495  {
2496  if (artifactPower->Tier != artifactTier)
2497  continue;
2498 
2499  if (m_artifactPowerIdToIndex.find(artifactPower->ID) != m_artifactPowerIdToIndex.end())
2500  continue;
2501 
2502  ArtifactPowerData powerData;
2503  powerData.ArtifactPowerId = artifactPower->ID;
2504  powerData.PurchasedRank = 0;
2505  powerData.CurrentRankWithBonus = (artifactPower->Flags & ARTIFACT_POWER_FLAG_FIRST) == ARTIFACT_POWER_FLAG_FIRST ? 1 : 0;
2506  AddArtifactPower(&powerData);
2507  }
2508 }
#define sDB2Manager
Definition: DB2Stores.h:445
uint8 CurrentRankWithBonus
Definition: Item.h:118
uint8 PurchasedRank
Definition: Item.h:117
std::unordered_map< uint32, uint16 > m_artifactPowerIdToIndex
Definition: Item.h:449
void AddArtifactPower(ArtifactPowerData const *artifactPower)
Definition: Item.cpp:2466
Definition: Item.h:114
uint32 ArtifactPowerId
Definition: Item.h:116
Definition: DB2Structure.h:256
Definition: DBCEnums.h:172
+ Here is the caller graph for this function:

◆ IsArtifactDisabled()

bool Item::IsArtifactDisabled ( ) const
2450 {
2451  if (ArtifactEntry const* artifact = sArtifactStore.LookupEntry(GetTemplate()->GetArtifactID()))
2452  return artifact->ArtifactCategoryID != 2; // fishing artifact
2453 
2454  return true;
2455 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
DB2Storage< ArtifactEntry > sArtifactStore("Artifact.db2", ArtifactLoadInfo::Instance())
Definition: DB2Structure.h:201
+ Here is the caller graph for this function:

◆ IsAzeriteEmpoweredItem()

bool Item::IsAzeriteEmpoweredItem ( ) const
inline
TypeID GetTypeId() const
Definition: Object.h:167
Definition: ObjectGuid.h:37
+ Here is the caller graph for this function:

◆ IsAzeriteItem()

bool Item::IsAzeriteItem ( ) const
inline
246 { return GetTypeId() == TYPEID_AZERITE_ITEM; }
TypeID GetTypeId() const
Definition: Object.h:167
Definition: ObjectGuid.h:38

◆ IsBag()

bool Item::IsBag ( ) const
inline
245 { return GetTemplate()->GetInventoryType() == INVTYPE_BAG; }
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:748
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemTemplate.h:390
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBattlenetAccountBound()

bool Item::IsBattlenetAccountBound ( ) const
inline
217 { return (GetTemplate()->GetFlags2() & ITEM_FLAG2_BNET_ACCOUNT_TRADE_OK) != 0; }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemTemplate.h:231
+ Here is the caller graph for this function:

◆ IsBindedNotWith()

bool Item::IsBindedNotWith ( Player const *  player) const
1590 {
1591  // not binded item
1592  if (!IsSoulBound())
1593  return false;
1594 
1595  // own item
1596  if (GetOwnerGUID() == player->GetGUID())
1597  return false;
1598 
1600  if (allowedGUIDs.find(player->GetGUID()) != allowedGUIDs.end())
1601  return false;
1602 
1603  // BOA item case
1604  if (IsBoundAccountWide())
1605  return false;
1606 
1607  return true;
1608 }
bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:207
bool IsBoundAccountWide() const
Definition: Item.h:216
Definition: ItemTemplate.h:145
bool IsSoulBound() const
Definition: Item.h:215
ObjectGuid GetOwnerGUID() const
Definition: Item.h:187
GuidSet allowedGUIDs
Definition: Item.h:446
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsBoundAccountWide()

bool Item::IsBoundAccountWide ( ) const
inline
216 { return (GetTemplate()->GetFlags() & ITEM_FLAG_IS_BOUND_TO_ACCOUNT) != 0; }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemTemplate.h:205
+ Here is the caller graph for this function:

◆ IsBoundByEnchant()

bool Item::IsBoundByEnchant ( ) const
1287 {
1288  // Check all enchants for soulbound
1289  for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
1290  if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
1291  if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
1292  if (enchantEntry->Flags & ENCHANTMENT_CAN_SOULBOUND)
1293  return true;
1294 
1295  return false;
1296 }
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", SpellItemEnchantmentLoadInfo::Instance())
EnchantmentSlot
Definition: ItemDefines.h:163
Definition: DB2Structure.h:3161
Definition: DBCEnums.h:1430
uint32_t uint32
Definition: Define.h:152
Definition: ItemDefines.h:165
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:289
Definition: ItemDefines.h:181

◆ IsBroken()

bool Item::IsBroken ( ) const
inline
250 { return *m_itemData->MaxDurability > 0 && *m_itemData->Durability == 0; }
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
+ Here is the caller graph for this function:

◆ IsConjuredConsumable()

bool Item::IsConjuredConsumable ( ) const
inline
325 { return GetTemplate()->IsConjuredConsumable(); }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
bool IsConjuredConsumable() const
Definition: ItemTemplate.h:817
+ Here is the call graph for this function:

◆ IsCurrencyToken()

bool Item::IsCurrencyToken ( ) const
inline
248 { return GetTemplate()->IsCurrencyToken(); }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
bool IsCurrencyToken() const
Definition: ItemTemplate.h:806
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsEquipped()

bool Item::IsEquipped ( ) const
1211 {
1212  return !IsInBag() && m_slot < EQUIPMENT_SLOT_END;
1213 }
bool IsInBag() const
Definition: Item.h:278
uint8 m_slot
Definition: Item.h:437
Definition: Player.h:638
+ Here is the caller graph for this function:

◆ IsFitToSpellRequirements()

bool Item::IsFitToSpellRequirements ( SpellInfo const *  spellInfo) const
1316 {
1317  ItemTemplate const* proto = GetTemplate();
1318 
1319  bool isEnchantSpell = spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM) || spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) || spellInfo->HasEffect(SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC);
1320  if (spellInfo->EquippedItemClass != -1) // -1 == any item class
1321  {
1322  if (isEnchantSpell && proto->GetFlags3() & ITEM_FLAG3_CAN_STORE_ENCHANTS)
1323  return true;
1324 
1325  if (spellInfo->EquippedItemClass != int32(proto->GetClass()))
1326  return false; // wrong item class
1327 
1328  if (spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
1329  {
1330  if ((spellInfo->EquippedItemSubClassMask & (1 << proto->GetSubClass())) == 0)
1331  return false; // subclass not present in mask
1332  }
1333  }
1334 
1335  if (isEnchantSpell && spellInfo->EquippedItemInventoryTypeMask != 0) // 0 == any inventory type
1336  {
1337  // Special case - accept weapon type for main and offhand requirements
1338  if (proto->GetInventoryType() == INVTYPE_WEAPON &&
1339  (spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
1340  spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
1341  return true;
1342  else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->GetInventoryType())) == 0)
1343  return false; // inventory type not present in mask
1344  }
1345 
1346  return true;
1347 }
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:748
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: SharedDefines.h:1248
uint32 GetClass() const
Definition: ItemTemplate.h:736
Definition: ItemTemplate.h:394
Definition: ItemTemplate.h:385
Definition: ItemTemplate.h:393
int32_t int32
Definition: Define.h:148
uint32 GetFlags3() const
Definition: ItemTemplate.h:741
Definition: ItemTemplate.h:730
Definition: ItemTemplate.h:274
Definition: SharedDefines.h:1145
Definition: SharedDefines.h:1146
uint32 GetSubClass() const
Definition: ItemTemplate.h:737
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInBag()

bool Item::IsInBag ( ) const
inline
278 { return m_container != nullptr; }
Bag * m_container
Definition: Item.h:438

◆ IsInTrade()

bool Item::IsInTrade ( ) const
inline
255 { return mb_in_trade; }
bool mb_in_trade
Definition: Item.h:441
+ Here is the caller graph for this function:

◆ IsInUpdateQueue()

bool Item::IsInUpdateQueue ( ) const
inline
314 { return uQueuePos != -1; }
int16 uQueuePos
Definition: Item.h:440
+ Here is the caller graph for this function:

◆ IsLimitedToAnotherMapOrZone()

bool Item::IsLimitedToAnotherMapOrZone ( uint32  cur_mapId,
uint32  cur_zoneId 
) const
1518 {
1519  ItemTemplate const* proto = GetTemplate();
1520  return proto && ((proto->GetMap() && proto->GetMap() != cur_mapId) ||
1521  ((proto->GetArea(0) && proto->GetArea(0) != cur_zoneId) && (proto->GetArea(1) && proto->GetArea(1) != cur_zoneId)));
1522 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
uint32 GetMap() const
Definition: ItemTemplate.h:775
Definition: ItemTemplate.h:730
uint32 GetArea(uint32 index) const
Definition: ItemTemplate.h:774
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsLocked()

bool Item::IsLocked ( ) const
inline
bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:207
Definition: ItemTemplate.h:139
+ Here is the caller graph for this function:

◆ IsNotEmptyBag()

bool Item::IsNotEmptyBag ( ) const
514 {
515  if (Bag const* bag = ToBag())
516  return !bag->IsEmpty();
517  return false;
518 }
Definition: Bag.h:26
Bag * ToBag()
Definition: Item.h:237
+ Here is the caller graph for this function:

◆ IsPotion()

bool Item::IsPotion ( ) const
inline
323 { return GetTemplate()->IsPotion(); }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
bool IsPotion() const
Definition: ItemTemplate.h:815
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsRangedWeapon()

bool Item::IsRangedWeapon ( ) const
inline
326 { return GetTemplate()->IsRangedWeapon(); }
bool IsRangedWeapon() const
Definition: ItemTemplate.h:822
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
+ Here is the call graph for this function:

◆ IsRefundExpired()

bool Item::IsRefundExpired ( )
1804 {
1805  return (GetPlayedTime() > 2*HOUR);
1806 }
uint32 GetPlayedTime()
Definition: Item.cpp:1796
Definition: Common.h:63
+ Here is the caller graph for this function:

◆ IsSoulBound()

bool Item::IsSoulBound ( ) const
inline
Definition: ItemTemplate.h:137
bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:207
+ Here is the caller graph for this function:

◆ IsValidTransmogrificationTarget()

bool Item::IsValidTransmogrificationTarget ( ) const
1841 {
1842  ItemTemplate const* proto = GetTemplate();
1843  if (!proto)
1844  return false;
1845 
1846  if (proto->GetClass() != ITEM_CLASS_ARMOR &&
1847  proto->GetClass() != ITEM_CLASS_WEAPON)
1848  return false;
1849 
1851  return false;
1852 
1854  return false;
1855 
1856  if (!HasStats())
1857  return false;
1858 
1859  return true;
1860 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemTemplate.h:235
uint32 GetClass() const
Definition: ItemTemplate.h:736
bool HasStats() const
Definition: Item.cpp:1862
Definition: ItemTemplate.h:409
Definition: ItemTemplate.h:411
Definition: ItemTemplate.h:730
uint32 GetFlags2() const
Definition: ItemTemplate.h:740
Definition: ItemTemplate.h:485
uint32 GetSubClass() const
Definition: ItemTemplate.h:737
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsVellum()

bool Item::IsVellum ( ) const
inline
324 { return GetTemplate()->IsVellum(); }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
bool IsVellum() const
Definition: ItemTemplate.h:816
+ Here is the call graph for this function:
+ 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 
)
970 {
971  for (uint8 i = 0; i <= artifactTier; ++i)
972  InitArtifactPowers(GetTemplate()->GetArtifactID(), i);
973 
975  SetModifier(ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID, artifactAppearanceId);
977 
978  if (ArtifactAppearanceEntry const* artifactAppearance = sArtifactAppearanceStore.LookupEntry(artifactAppearanceId))
979  SetAppearanceModId(artifactAppearance->ItemAppearanceModifierID);
980 
981  uint8 totalPurchasedRanks = 0;
982  for (ArtifactPowerData& power : powers)
983  {
984  power.CurrentRankWithBonus += power.PurchasedRank;
985  totalPurchasedRanks += power.PurchasedRank;
986 
987  ArtifactPowerEntry const* artifactPower = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
989  {
991  {
992  for (uint32 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
993  {
994  switch (enchant->Effect[i])
995  {
997  if (uint32(artifactPower->Label) == enchant->EffectArg[i])
998  power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
999  break;
1001  if (artifactPower->ID == enchant->EffectArg[i])
1002  power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1003  break;
1006  {
1007  if (ArtifactPowerPickerEntry const* artifactPowerPicker = sArtifactPowerPickerStore.LookupEntry(enchant->EffectArg[i]))
1008  {
1009  PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(artifactPowerPicker->PlayerConditionID);
1010  if (!playerCondition || (owner && sConditionMgr->IsPlayerMeetingCondition(owner, playerCondition)))
1011  if (artifactPower->Label == _bonusData.GemRelicType[e - SOCK_ENCHANTMENT_SLOT])
1012  power.CurrentRankWithBonus += enchant->EffectPointsMin[i];
1013  }
1014  }
1015  break;
1016  default:
1017  break;
1018  }
1019  }
1020  }
1021  }
1022 
1023  SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, power.CurrentRankWithBonus);
1024  }
1025 
1026  for (ArtifactPowerData& power : powers)
1027  {
1028  ArtifactPowerEntry const* scaledArtifactPowerEntry = sArtifactPowerStore.AssertEntry(power.ArtifactPowerId);
1029  if (!(scaledArtifactPowerEntry->Flags & ARTIFACT_POWER_FLAG_SCALES_WITH_NUM_POWERS))
1030  continue;
1031 
1032  SetArtifactPower(power.ArtifactPowerId, power.PurchasedRank, totalPurchasedRanks + 1);
1033  }
1034 
1036 }
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
void SetArtifactPower(uint16 artifactPowerId, uint8 purchasedRank, uint8 currentRankWithBonus)
Definition: Item.cpp:2477
void SetAppearanceModId(uint32 appearanceModId)
Definition: Item.h:336
Definition: ItemDefines.h:167
Definition: DB2Structure.h:274
Definition: ItemDefines.h:169
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", SpellItemEnchantmentLoadInfo::Instance())
DB2Storage< ArtifactPowerPickerEntry > sArtifactPowerPickerStore("ArtifactPowerPicker.db2", ArtifactPowerPickerLoadInfo::Instance())
EnchantmentSlot
Definition: ItemDefines.h:163
void InitArtifactPowers(uint8 artifactId, uint8 artifactTier)
Definition: Item.cpp:2492
DB2Storage< ArtifactPowerEntry > sArtifactPowerStore("ArtifactPower.db2", ArtifactPowerLoadInfo::Instance())
Definition: DB2Structure.h:3161
int32 Label
Definition: DB2Structure.h:262
UpdateField< uint64, 0, 16 > ArtifactXP
Definition: UpdateFields.h:132
DB2Storage< ArtifactAppearanceEntry > sArtifactAppearanceStore("ArtifactAppearance.db2", ArtifactAppearanceLoadInfo::Instance())
Definition: ItemDefines.h:221
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
void CheckArtifactRelicSlotUnlock(Player const *owner)
Definition: Item.cpp:1038
uint32_t uint32
Definition: Define.h:152
BonusData _bonusData
Definition: Item.h:433
#define sConditionMgr
Definition: ConditionMgr.h:326
int32 GemRelicType[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:84
Definition: Item.h:114
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2331
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DB2Structure.h:3159
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:289
Definition: ItemDefines.h:205
uint32 ID
Definition: DB2Structure.h:259
Definition: DB2Structure.h:256
Definition: DB2Structure.h:216
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8_t uint8
Definition: Define.h:154
Definition: DB2Structure.h:2571
DB2Storage< PlayerConditionEntry > sPlayerConditionStore("PlayerCondition.db2", PlayerConditionLoadInfo::Instance())
UF::UpdateFieldHolder m_values
Definition: Object.h:223
uint8 Flags
Definition: DB2Structure.h:263
+ 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.

799 {
800  // 0 1 2 3 4 5 6 7 8 9 10 11 12
801  // SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomBonusListId, durability, playedTime, text,
802  // 13 14 15 16 17 18
803  // battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, context, bonusListIDs,
804  // 19 20 21 22 23 24
805  // itemModifiedAppearanceAllSpecs, itemModifiedAppearanceSpec1, itemModifiedAppearanceSpec2, itemModifiedAppearanceSpec3, itemModifiedAppearanceSpec4, itemModifiedAppearanceSpec5,
806  // 25 26 27 28 29 30
807  // spellItemEnchantmentAllSpecs, spellItemEnchantmentSpec1, spellItemEnchantmentSpec2, spellItemEnchantmentSpec3, spellItemEnchantmentSpec4, spellItemEnchantmentSpec5,
808  // 31 32 33
809  // secondaryItemModifiedAppearanceAllSpecs, secondaryItemModifiedAppearanceSpec1, secondaryItemModifiedAppearanceSpec2,
810  // 34 35 36
811  // secondaryItemModifiedAppearanceSpec3, secondaryItemModifiedAppearanceSpec4, secondaryItemModifiedAppearanceSpec5,
812  // 37 38 39 40 41 42 43 44 45 46 47 48
813  // gemItemId1, gemBonuses1, gemContext1, gemScalingLevel1, gemItemId2, gemBonuses2, gemContext2, gemScalingLevel2, gemItemId3, gemBonuses3, gemContext3, gemScalingLevel3
814  // 49 50
815  // fixedScalingLevel, artifactKnowledgeLevel FROM item_instance
816 
817  // create item before any checks for store correct guid
818  // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
819  Object::_Create(ObjectGuid::Create<HighGuid::Item>(guid));
820 
821  // Set entry, MUST be before proto check
822  SetEntry(entry);
823  SetObjectScale(1.0f);
824 
825  ItemTemplate const* proto = GetTemplate();
826  if (!proto)
827  return false;
828 
829  _bonusData.Initialize(proto);
830 
831  // set owner (not if item is only loaded for gbank/auction/mail
832  if (!ownerGuid.IsEmpty())
833  SetOwnerGUID(ownerGuid);
834 
835  uint32 itemFlags = fields[7].GetUInt32();
836  bool need_save = false; // need explicit save data at load fixes
837  if (uint64 creator = fields[2].GetUInt64())
838  {
839  if (!(itemFlags & ITEM_FIELD_FLAG_CHILD))
840  SetCreator(ObjectGuid::Create<HighGuid::Player>(creator));
841  else
842  SetCreator(ObjectGuid::Create<HighGuid::Item>(creator));
843  }
844  if (uint64 giftCreator = fields[3].GetUInt64())
845  SetGiftCreator(ObjectGuid::Create<HighGuid::Player>(giftCreator));
846  SetCount(fields[4].GetUInt32());
847 
848  uint32 duration = fields[5].GetUInt32();
849  SetExpiration(duration);
850  // update duration if need, and remove if not need
851  if ((proto->GetDuration() == 0) != (duration == 0))
852  {
853  SetExpiration(proto->GetDuration());
854  need_save = true;
855  }
856 
857  SetItemFlags(ItemFieldFlags(itemFlags));
858 
859  uint32 durability = fields[10].GetUInt16();
860  SetDurability(durability);
861  // update max durability (and durability) if need
863 
864  // do not overwrite durability for wrapped items
865  if (durability > proto->MaxDurability && !HasItemFlag(ITEM_FIELD_FLAG_WRAPPED))
866  {
868  need_save = true;
869  }
870 
871  SetCreatePlayedTime(fields[11].GetUInt32());
872  SetText(fields[12].GetString());
873 
874  SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[13].GetUInt32());
875  SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[14].GetUInt32());
876  SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[15].GetUInt16());
877  SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[16].GetUInt32());
878 
879  SetContext(ItemContext(fields[17].GetUInt8()));
880 
881  Tokenizer bonusListString(fields[18].GetString(), ' ');
882  std::vector<int32> bonusListIDs;
883  bonusListIDs.reserve(bonusListString.size());
884  for (char const* token : bonusListString)
885  bonusListIDs.push_back(atoi(token));
886  SetBonuses(std::move(bonusListIDs));
887 
888  // load charges after bonuses, they can add more item effects
889  Tokenizer tokens(fields[6].GetString(), ' ', proto->Effects.size());
890  for (uint8 i = 0; i < m_itemData->SpellCharges.size() && i < _bonusData.EffectCount && i < tokens.size(); ++i)
891  SetSpellCharges(i, atoi(tokens[i]));
892 
894  SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1, fields[20].GetUInt32());
895  SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2, fields[21].GetUInt32());
896  SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3, fields[22].GetUInt32());
897  SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4, fields[23].GetUInt32());
898  SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_5, fields[24].GetUInt32());
899 
900  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS, fields[25].GetUInt32());
901  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1, fields[26].GetUInt32());
902  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2, fields[27].GetUInt32());
903  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3, fields[28].GetUInt32());
904  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4, fields[29].GetUInt32());
905  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_5, fields[30].GetUInt32());
906 
913 
914  uint32 const gemFields = 4;
916  memset(gemData, 0, sizeof(gemData));
917  for (uint32 i = 0; i < MAX_GEM_SOCKETS; ++i)
918  {
919  gemData[i].ItemId = fields[37 + i * gemFields].GetUInt32();
920  Tokenizer gemBonusListIDs(fields[38 + i * gemFields].GetString(), ' ');
921  uint32 b = 0;
922  for (char const* token : gemBonusListIDs)
923  if (uint32 bonusListID = atoul(token))
924  gemData[i].BonusListIDs[b++] = bonusListID;
925 
926  gemData[i].Context = fields[39 + i * gemFields].GetUInt8();
927  if (gemData[i].ItemId)
928  SetGem(i, &gemData[i], fields[40 + i * gemFields].GetUInt32());
929  }
930 
931  SetModifier(ITEM_MODIFIER_TIMEWALKER_LEVEL, fields[49].GetUInt32());
932  SetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL, fields[50].GetUInt32());
933 
934  // Enchants must be loaded after all other bonus/scaling data
935  Tokenizer enchantmentTokens(fields[8].GetString(), ' ');
936  if (enchantmentTokens.size() == MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET)
937  {
938  for (uint32 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
939  {
940  auto enchantmentField = m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::Enchantment, i);
941  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::ID), atoul(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 0]));
942  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Duration), atoul(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 1]));
943  SetUpdateFieldValue(enchantmentField.ModifyValue(&UF::ItemEnchantment::Charges), atoi(enchantmentTokens[i * MAX_ENCHANTMENT_OFFSET + 2]));
944  }
945  }
946  m_randomBonusListId = fields[9].GetUInt32();
947 
948  // Remove bind flag for items vs BIND_NONE set
949  if (IsSoulBound() && GetBonding() == BIND_NONE)
950  {
952  need_save = true;
953  }
954 
955  if (need_save) // normal item changed state set not work at loading
956  {
957  uint8 index = 0;
959  stmt->setUInt32(index++, m_itemData->Expiration);
960  stmt->setUInt32(index++, m_itemData->DynamicFlags);
961  stmt->setUInt32(index++, m_itemData->Durability);
962  stmt->setUInt64(index++, guid);
963  CharacterDatabase.Execute(stmt);
964  }
965 
966  return true;
967 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define MAX_GEM_SOCKETS
Definition: Item.h:48
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: ItemDefines.h:210
Definition: ItemDefines.h:203
Definition: ItemTemplate.h:137
void SetContext(ItemContext context)
Definition: Item.h:424
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:108
uint16 GetUInt16() const
Definition: Field.cpp:69
uint32 ItemId
Definition: Item.h:162
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:2697
bool HasItemFlag(ItemFieldFlags flag) const
Definition: Item.h:207
Definition: ItemTemplate.h:140
UpdateField< uint32, 0, 12 > MaxDurability
Definition: UpdateFields.h:128
Definition: Util.h:30
Definition: Item.h:160
Definition: ItemDefines.h:200
Definition: ItemDefines.h:224
void SetExpiration(uint32 expiration)
Definition: Item.h:197
void RemoveItemFlag(ItemFieldFlags flags)
Definition: Item.h:209
Definition: ItemTemplate.h:122
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
void SetCreatePlayedTime(uint32 createPlayedTime)
Definition: Item.h:302
Definition: ItemDefines.h:212
Definition: ItemDefines.h:206
uint8 Context
Definition: Item.h:164
void SetBonuses(std::vector< int32 > bonusListIDs)
Definition: Item.cpp:2432
void SetCount(uint32 value)
Definition: Item.cpp:1240
void SetEntry(uint32 entry)
Definition: Object.h:156
Definition: ItemTemplate.h:156
Definition: ItemDefines.h:222
Definition: CharacterDatabase.h:160
Definition: DatabaseEnvFwd.h:40
Definition: ItemDefines.h:220
ItemRandomBonusListId m_randomBonusListId
Definition: Item.h:447
UpdateFieldArray< UF::ItemEnchantment, 13, 26, 27 > Enchantment
Definition: UpdateFields.h:137
uint32 GetUInt32() const
Definition: Field.cpp:105
Definition: ItemDefines.h:208
Definition: ItemDefines.h:201
Definition: ItemDefines.h:213
uint16 BonusListIDs[16]
Definition: Item.h:163
std::vector< ItemEffectEntry const * > Effects
Definition: ItemTemplate.h:790
unsigned long atoul(char const *str)
Definition: Common.h:55
UpdateField< uint32, 0, 2 > Duration
Definition: UpdateFields.h:63
Definition: ItemDefines.h:197
Definition: ItemDefines.h:198
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:116
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:50
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:238
uint32_t uint32
Definition: Define.h:152
UpdateField< int16, 0, 3 > Charges
Definition: UpdateFields.h:64
void SetGem(uint16 slot, ItemDynamicFieldGems const *gem, uint32 gemScalingLevel)
Definition: Item.cpp:1413
uint64_t uint64
Definition: Define.h:151
BonusData _bonusData
Definition: Item.h:433
UpdateField< int32, 0, 1 > ID
Definition: UpdateFields.h:62
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2331
uint32 MaxDurability
Definition: ItemTemplate.h:789
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:306
void SetDurability(uint32 durability)
Definition: Item.h:251
Definition: ItemDefines.h:207
void SetItemFlags(ItemFieldFlags flags)
Definition: Item.h:210
bool IsEmpty() const
Definition: ObjectGuid.h:299
Definition: ItemTemplate.h:730
Definition: ItemDefines.h:202
virtual void SetObjectScale(float scale)
Definition: Object.h:159
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
Definition: ItemDefines.h:181
std::size_t EffectCount
Definition: Item.h:92
ItemBondingType GetBonding() const
Definition: Item.h:199
uint8 GetUInt8() const
Definition: Field.cpp:33
uint8_t uint8
Definition: Define.h:154
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:188
bool IsSoulBound() const
Definition: Item.h:215
Definition: ItemDefines.h:209
Definition: ItemDefines.h:211
ItemFieldFlags
Definition: ItemTemplate.h:135
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:194
uint32 GetDuration() const
Definition: ItemTemplate.h:782
UF::UpdateFieldHolder m_values
Definition: Object.h:223
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
ItemContext
Definition: DBCEnums.h:833
void SetText(std::string const &text)
Definition: Item.h:296
Definition: ItemDefines.h:204
void SetCreator(ObjectGuid guid)
Definition: Item.h:192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveFromObjectUpdate()

void Item::RemoveFromObjectUpdate ( )
overridevirtual

Implements Object.

1710 {
1711  if (Player* owner = GetOwner())
1712  owner->GetMap()->RemoveUpdateObject(this);
1713 }
Player * GetOwner() const
Definition: Item.cpp:1112
Definition: Player.h:1056

◆ RemoveItemFlag()

void Item::RemoveItemFlag ( ItemFieldFlags  flags)
inline
UpdateField< uint32, 0, 10 > DynamicFlags
Definition: UpdateFields.h:126
void RemoveUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:252
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the caller graph for this function:

◆ RemoveItemFlag2()

void Item::RemoveItemFlag2 ( ItemFieldFlags2  flags)
inline
void RemoveUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:252
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
UpdateField< uint32, 0, 19 > DynamicFlags2
Definition: UpdateFields.h:135
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:429
uint8 flags
Definition: DisableMgr.cpp:47
UF::UpdateFieldHolder m_values
Definition: Object.h:223
+ Here is the caller graph for this function:

◆ SaveRefundDataToDB()

void Item::SaveRefundDataToDB ( )
1716 {
1717  CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
1718 
1720  stmt->setUInt64(0, GetGUID().GetCounter());
1721  trans->Append(stmt);
1722 
1723  stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE);
1724  stmt->setUInt64(0, GetGUID().GetCounter());
1725  stmt->setUInt64(1, GetRefundRecipient().GetCounter());
1726  stmt->setUInt64(2, GetPaidMoney());
1727  stmt->setUInt16(3, uint16(GetPaidExtendedCost()));
1728  trans->Append(stmt);
1729 
1730  CharacterDatabase.CommitTransaction(trans);
1731 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:470
uint32 GetPaidExtendedCost() const
Definition: Item.h:359
Definition: DatabaseEnvFwd.h:40
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:108
ObjectGuid const & GetGUID() const
Definition: Object.h:154
uint64 GetPaidMoney() const
Definition: Item.h:358
uint16_t uint16
Definition: Define.h:153
Definition: CharacterDatabase.h:469
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
ObjectGuid const & GetRefundRecipient() const
Definition: Item.h:357
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:72
+ 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 Bag, AzeriteItem, and AzeriteEmpoweredItem.

540 {
541  bool isInTransaction = bool(trans);
542  if (!isInTransaction)
543  trans = CharacterDatabase.BeginTransaction();
544 
545  switch (uState)
546  {
547  case ITEM_NEW:
548  case ITEM_CHANGED:
549  {
550  uint8 index = 0;
552  stmt->setUInt32( index, GetEntry());
553  stmt->setUInt64(++index, GetOwnerGUID().GetCounter());
554  stmt->setUInt64(++index, GetCreator().GetCounter());
555  stmt->setUInt64(++index, GetGiftCreator().GetCounter());
556  stmt->setUInt32(++index, GetCount());
557  stmt->setUInt32(++index, m_itemData->Expiration);
558 
559  std::ostringstream ssSpells;
560  for (uint8 i = 0; i < m_itemData->SpellCharges.size() && i < _bonusData.EffectCount; ++i)
561  ssSpells << GetSpellCharges(i) << ' ';
562  stmt->setString(++index, ssSpells.str());
563 
564  stmt->setUInt32(++index, m_itemData->DynamicFlags);
565 
566  std::ostringstream ssEnchants;
567  for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
568  {
569  ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' ';
570  ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
571  ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
572  }
573  stmt->setString(++index, ssEnchants.str());
574 
575  stmt->setUInt32(++index, m_randomBonusListId);
576  stmt->setUInt16(++index, m_itemData->Durability);
577  stmt->setUInt32(++index, m_itemData->CreatePlayedTime);
578  stmt->setString(++index, m_text);
583  stmt->setUInt8(++index, uint8(m_itemData->Context));
584 
585  std::ostringstream bonusListIDs;
586  for (int32 bonusListID : *m_itemData->BonusListIDs)
587  bonusListIDs << bonusListID << ' ';
588  stmt->setString(++index, bonusListIDs.str());
589 
590  stmt->setUInt64(++index, GetGUID().GetCounter());
591 
592  trans->Append(stmt);
593 
595  {
596  stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER);
597  stmt->setUInt64(0, GetOwnerGUID().GetCounter());
598  stmt->setUInt64(1, GetGUID().GetCounter());
599  trans->Append(stmt);
600  }
601 
602  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
603  stmt->setUInt64(0, GetGUID().GetCounter());
604  trans->Append(stmt);
605 
606  if (m_itemData->Gems.size())
607  {
608  stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_GEMS);
609  stmt->setUInt64(0, GetGUID().GetCounter());
610  uint32 i = 0;
611  uint32 const gemFields = 4;
612  for (UF::SocketedGem const& gemData : m_itemData->Gems)
613  {
614  if (gemData.ItemID)
615  {
616  stmt->setUInt32(1 + i * gemFields, gemData.ItemID);
617  std::ostringstream gemBonusListIDs;
618  for (uint16 bonusListID : gemData.BonusListIDs)
619  if (bonusListID)
620  gemBonusListIDs << bonusListID << ' ';
621  stmt->setString(2 + i * gemFields, gemBonusListIDs.str());
622  stmt->setUInt8(3 + i * gemFields, gemData.Context);
623  stmt->setUInt32(4 + i * gemFields, m_gemScalingLevels[i]);
624  }
625  else
626  {
627  stmt->setUInt32(1 + i * gemFields, 0);
628  stmt->setString(2 + i * gemFields, "");
629  stmt->setUInt8(3 + i * gemFields, 0);
630  stmt->setUInt32(4 + i * gemFields, 0);
631  }
632  ++i;
633  }
634  for (; i < MAX_GEM_SOCKETS; ++i)
635  {
636  stmt->setUInt32(1 + i * gemFields, 0);
637  stmt->setString(2 + i * gemFields, "");
638  stmt->setUInt8(3 + i * gemFields, 0);
639  stmt->setUInt32(4 + i * gemFields, 0);
640  }
641  trans->Append(stmt);
642  }
643 
644  static ItemModifier const transmogMods[18] =
645  {
652 
659 
666  };
667 
668  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
669  stmt->setUInt64(0, GetGUID().GetCounter());
670  trans->Append(stmt);
671 
672  if (std::find_if(std::begin(transmogMods), std::end(transmogMods), [this](ItemModifier modifier) { return GetModifier(modifier) != 0; }) != std::end(transmogMods))
673  {
674  stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_TRANSMOG);
675  stmt->setUInt64(0, GetGUID().GetCounter());
693  stmt->setUInt32(18, GetModifier(ITEM_MODIFIER_TRANSMOG_SECONDARY_APPEARANCE_SPEC_5));
694  trans->Append(stmt);
695  }
696 
697  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
698  stmt->setUInt64(0, GetGUID().GetCounter());
699  trans->Append(stmt);
700 
701  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
702  stmt->setUInt64(0, GetGUID().GetCounter());
703  trans->Append(stmt);
704 
705  if (GetTemplate()->GetArtifactID())
706  {
707  stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT);
708  stmt->setUInt64(0, GetGUID().GetCounter());
709  stmt->setUInt64(1, m_itemData->ArtifactXP);
712  trans->Append(stmt);
713 
714  for (UF::ArtifactPower const& artifactPower : m_itemData->ArtifactPowers)
715  {
716  stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_ARTIFACT_POWERS);
717  stmt->setUInt64(0, GetGUID().GetCounter());
718  stmt->setUInt32(1, artifactPower.ArtifactPowerID);
719  stmt->setUInt8(2, artifactPower.PurchasedRank);
720  trans->Append(stmt);
721  }
722  }
723 
724  static ItemModifier const modifiersTable[] =
725  {
728  };
729 
730  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
731  stmt->setUInt64(0, GetGUID().GetCounter());
732  trans->Append(stmt);
733 
734  if (std::find_if(std::begin(modifiersTable), std::end(modifiersTable), [this](ItemModifier modifier) { return GetModifier(modifier) != 0; }) != std::end(modifiersTable))
735  {
736  stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_INSTANCE_MODIFIERS);
737  stmt->setUInt64(0, GetGUID().GetCounter());
739  stmt->setUInt32(2, GetModifier(ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL));
740  trans->Append(stmt);
741  }
742 
743  break;
744  }
745  case ITEM_REMOVED:
746  {
748  stmt->setUInt64(0, GetGUID().GetCounter());
749  trans->Append(stmt);
750 
751  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_GEMS);
752  stmt->setUInt64(0, GetGUID().GetCounter());
753  trans->Append(stmt);
754 
755  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_TRANSMOG);
756  stmt->setUInt64(0, GetGUID().GetCounter());
757  trans->Append(stmt);
758 
759  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT);
760  stmt->setUInt64(0, GetGUID().GetCounter());
761  trans->Append(stmt);
762 
763  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
764  stmt->setUInt64(0, GetGUID().GetCounter());
765  trans->Append(stmt);
766 
767  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_MODIFIERS);
768  stmt->setUInt64(0, GetGUID().GetCounter());
769  trans->Append(stmt);
770 
772  {
773  stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
774  stmt->setUInt64(0, GetGUID().GetCounter());
775  trans->Append(stmt);
776  }
777 
778  if (!isInTransaction)
779  CharacterDatabase.CommitTransaction(trans);
780 
781  // Delete the items if this is a container
782  if (!loot.isLooted())
783  sLootItemStorage->RemoveStoredLootForContainer(GetGUID().GetCounter());
784 
785  delete this;
786  return;
787  }
788  case ITEM_UNCHANGED:
789  break;
790  }
791 
793 
794  if (!isInTransaction)
795  CharacterDatabase.CommitTransaction(trans);
796 }
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: CharacterDatabase.h:173
Definition: CharacterDatabase.h:171
Definition: CharacterDatabase.h:177
Definition: CharacterDatabase.h:159
#define MAX_GEM_SOCKETS
Definition: Item.h:48
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1107
Definition: CharacterDatabase.h:197
Definition: ItemDefines.h:210