TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Item Class Reference

#include <Item.h>

Public Member Functions

ItemCloneItem (uint32 count, Player const *player=NULL) const
 
 Item ()
 
virtual bool Create (ObjectGuid::LowType guidlow, uint32 itemid, Player const *owner)
 
ItemTemplate constGetTemplate () const
 
BonusData constGetBonus () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid guid)
 
PlayerGetOwner () const
 
void SetBinding (bool val)
 
bool IsSoulBound () const
 
bool IsBoundAccountWide () const
 
bool IsBattlenetAccountBound () const
 
bool IsBindedNotWith (Player const *player) const
 
bool IsBoundByEnchant () const
 
virtual void SaveToDB (SQLTransaction &trans)
 
virtual bool LoadFromDB (ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field *fields, uint32 entry)
 
void AddBonuses (uint32 bonusListID)
 
virtual void DeleteFromDB (SQLTransaction &trans)
 
void ItemContainerSaveLootToDB ()
 
bool ItemContainerLoadLootFromDB ()
 
void ItemContainerDeleteLootItemsFromDB ()
 
void ItemContainerDeleteLootItemFromDB (uint32 itemID)
 
void ItemContainerDeleteLootMoneyFromDB ()
 
void ItemContainerDeleteLootMoneyAndLootItemsFromDB ()
 
void DeleteFromInventoryDB (SQLTransaction &trans)
 
void SaveRefundDataToDB ()
 
void DeleteRefundDataFromDB (SQLTransaction *trans)
 
BagToBag ()
 
const BagToBag () const
 
bool IsLocked () const
 
bool IsBag () const
 
bool IsCurrencyToken () const
 
bool IsNotEmptyBag () const
 
bool IsBroken () const
 
bool CanBeTraded (bool mail=false, bool trade=false) const
 
void SetInTrade (bool b=true)
 
bool IsInTrade () const
 
bool HasEnchantRequiredSkill (const Player *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 ()
 
int32 GetItemRandomPropertyId () const
 
uint32 GetItemSuffixFactor () const
 
void SetItemRandomProperties (int32 randomPropId)
 
void UpdateItemSuffixFactor ()
 
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
 
std::string constGetText () const
 
void SetText (std::string const &text)
 
void SendUpdateSockets ()
 
void SendTimeUpdate (Player *owner)
 
void UpdateDuration (Player *owner, uint32 diff)
 
int32 GetSpellCharges (uint8 index=0) const
 
void SetSpellCharges (uint8 index, int32 value)
 
ItemUpdateState GetState () const
 
void SetState (ItemUpdateState state, Player *forplayer=NULL)
 
void AddToUpdateQueueOf (Player *player)
 
void RemoveFromUpdateQueueOf (Player *player)
 
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
 
int32 GetItemStatValue (uint32 index, Player const *owner) const
 
SocketColor GetSocketColor (uint32 index) const
 
uint32 GetAppearanceModId () const
 
uint32 GetArmor (Player const *owner) const
 
void GetDamage (Player const *owner, float &minDamage, float &maxDamage) const
 
uint32 GetDisplayId () const
 
float GetRepairCostMultiplier () const
 
uint32 GetScalingStatDistribution () const
 
void SetNotRefundable (Player *owner, bool changestate=true, SQLTransaction *trans=NULL)
 
void SetRefundRecipient (ObjectGuid const &guid)
 
void SetPaidMoney (uint32 money)
 
void SetPaidExtendedCost (uint32 iece)
 
ObjectGuid constGetRefundRecipient () const
 
uint32 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 BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const override
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
uint32 GetScriptId () const
 
bool IsValidTransmogrificationTarget () const
 
bool HasStats () const
 
uint32 GetSpecialPrice (uint32 minimumPrice=10000) const
 
uint32 GetVisibleEntry () const
 
uint32 GetVisibleAppearanceModId () const
 
uint32 GetModifier (ItemModifier modifier) const
 
void SetModifier (ItemModifier modifier, uint32 value)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
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 *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid constGetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () const
 

Static Public Member Functions

static ItemCreateItem (uint32 itemEntry, uint32 count, Player const *player=NULL)
 
static void DeleteFromDB (SQLTransaction &trans, ObjectGuid::LowType itemGuid)
 
static void DeleteFromInventoryDB (SQLTransaction &trans, ObjectGuid::LowType itemGuid)
 
static int32 GenerateItemRandomPropertyId (uint32 item_id)
 
static bool IsValidTransmogrificationSource (WorldPackets::Item::ItemInstance const &transmogrifier, BonusData const *bonus)
 
static bool HasStats (WorldPackets::Item::ItemInstance const &itemInstance, BonusData const *bonus)
 
static bool CanTransmogrifyItemWithItem (Item const *transmogrified, WorldPackets::Item::ItemInstance const &transmogrifier, BonusData const *bonus)
 
static uint32 GetSpecialPrice (ItemTemplate const *proto, uint32 minimumPrice=10000)
 
static uint32 GetSellPrice (ItemTemplate const *proto, bool &success)
 

Public Attributes

Loot loot
 
bool m_lootGenerated
 

Protected Attributes

BonusData _bonusData
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
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
 
uint32 m_paidMoney
 
uint32 m_paidExtendedCost
 
GuidSet allowedGUIDs
 
uint32 _modifiers [MAX_ITEM_MODIFIERS]
 

Additional Inherited Members

- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
void AddToObjectUpdateIfNeeded ()
 

Constructor & Destructor Documentation

Item::Item ( )
231 {
234 
235  m_updateFlag = 0;
236 
239  m_slot = 0;
240  uState = ITEM_NEW;
241  uQueuePos = -1;
242  m_container = NULL;
243  m_lootGenerated = false;
244  mb_in_trade = false;
246 
247  m_paidMoney = 0;
248  m_paidExtendedCost = 0;
249 
250  memset(_modifiers, 0, sizeof(_modifiers));
251  memset(&_bonusData, 0, sizeof(_bonusData));
252 }
Definition: UpdateFields.h:65
Definition: ObjectGuid.h:47
bool mb_in_trade
Definition: Item.h:452
uint16 _dynamicValuesCount
Definition: Object.h:246
bool m_lootGenerated
Definition: Item.h:368
time_t m_lastPlayedTimeUpdate
Definition: Item.h:453
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 m_paidExtendedCost
Definition: Item.h:456
Bag * m_container
Definition: Item.h:449
uint16 m_objectType
Definition: Object.h:227
ItemUpdateState uState
Definition: Item.h:450
TypeID m_objectTypeId
Definition: Object.h:229
BonusData _bonusData
Definition: Item.h:444
uint32 m_paidMoney
Definition: Item.h:455
uint8 m_slot
Definition: Item.h:448
int16 uQueuePos
Definition: Item.h:451
uint16 m_valuesCount
Definition: Object.h:245
Definition: Item.h:218
Definition: UpdateFields.h:58
Definition: ObjectGuid.h:30
uint32 _modifiers[MAX_ITEM_MODIFIERS]
Definition: Item.h:458
uint32 m_updateFlag
Definition: Object.h:230

Member Function Documentation

void Item::AddBonuses ( uint32  bonusListID)
1932 {
1933  if (DB2Manager::ItemBonusList const* bonuses = sDB2Manager.GetItemBonusList(bonusListID))
1934  {
1936  for (ItemBonusEntry const* bonus : *bonuses)
1937  _bonusData.AddBonus(bonus->Type, bonus->Value);
1938  }
1939 }
#define sDB2Manager
Definition: DB2Stores.h:224
void AddDynamicValue(uint16 index, uint32 value)
Definition: Object.cpp:1344
void AddBonus(uint32 type, int32 const (&values)[2])
Definition: Item.cpp:1981
std::vector< ItemBonusEntry const * > ItemBonusList
Definition: DB2Stores.h:147
Definition: UpdateFields.h:64
BonusData _bonusData
Definition: Item.h:444
Definition: DB2Structure.h:653

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::AddToObjectUpdate ( )
overridevirtual

Implements Object.

1201 {
1202  if (Player* owner = GetOwner())
1203  owner->GetMap()->AddUpdateObject(this);
1204 }
Player * GetOwner() const
Definition: Item.cpp:552

+ Here is the call graph for this function:

void Item::AddToUpdateQueueOf ( Player player)
718 {
719  if (IsInUpdateQueue())
720  return;
721 
722  ASSERT(player != NULL);
723 
724  if (player->GetGUID() != GetOwnerGUID())
725  {
726  TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
727  GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
728  return;
729  }
730 
731  if (player->m_itemUpdateQueueBlocked)
732  return;
733 
734  player->m_itemUpdateQueue.push_back(this);
735  uQueuePos = player->m_itemUpdateQueue.size()-1;
736 }
arena_t NULL
Definition: jemalloc_internal.h:624
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
string ToString(int i)
Definition: strutil.h:491
int16 uQueuePos
Definition: Item.h:451
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272
#define ASSERT
Definition: Errors.h:55
bool IsInUpdateQueue() const
Definition: Item.h:375

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::BuildDynamicValuesUpdate ( uint8  updatetype,
ByteBuffer data,
Player target 
) const
overridevirtual

Reimplemented from Object.

1140 {
1141  if (!target)
1142  return;
1143 
1144  ByteBuffer fieldBuffer;
1145  UpdateMask updateMask;
1146  updateMask.SetCount(_dynamicValuesCount);
1147 
1148  uint32* flags = nullptr;
1149  uint32 visibleFlag = GetDynamicUpdateFieldData(target, flags);
1150 
1151  for (uint16 index = 0; index < _dynamicValuesCount; ++index)
1152  {
1153  ByteBuffer buffer;
1154  std::vector<uint32> const& values = _dynamicValues[index];
1155  if (_fieldNotifyFlags & flags[index] ||
1156  ((updateType == UPDATETYPE_VALUES ? _dynamicChangesMask.GetBit(index) : !values.empty()) && (flags[index] & visibleFlag)) ||
1158  {
1159  updateMask.SetBit(index);
1160 
1161  UpdateMask arrayMask;
1162  if (index != ITEM_DYNAMIC_FIELD_MODIFIERS)
1163  {
1164  arrayMask.SetCount(values.size());
1165  for (std::size_t v = 0; v < values.size(); ++v)
1166  {
1167  if (updateType != UPDATETYPE_VALUES || _dynamicChangesArrayMask[index].GetBit(v))
1168  {
1169  arrayMask.SetBit(v);
1170  buffer << uint32(values[v]);
1171  }
1172  }
1173  }
1174  else
1175  {
1176  uint32 count = 0;
1177  arrayMask.SetCount(MAX_ITEM_MODIFIERS);
1178  for (uint32 v = 0; v < MAX_ITEM_MODIFIERS; ++v)
1179  {
1180  if (uint32 modifier = _modifiers[v])
1181  {
1182  arrayMask.SetBit(count++);
1183  buffer << uint32(modifier);
1184  }
1185  }
1186 
1187  }
1188 
1189  fieldBuffer << uint8(arrayMask.GetBlockCount());
1190  arrayMask.AppendToPacket(&fieldBuffer);
1191  fieldBuffer.append(buffer);
1192  }
1193  }
1194 
1195  *data << uint8(updateMask.GetBlockCount());
1196  updateMask.AppendToPacket(data);
1197  data->append(fieldBuffer);
1198 }
Definition: UpdateMask.h:26
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: ByteBuffer.h:70
UpdateMask _changesMask
Definition: Object.h:241
uint16 _dynamicValuesCount
Definition: Object.h:246
uint32 GetBlockCount() const
Definition: UpdateMask.h:64
UpdateMask _dynamicChangesMask
Definition: Object.h:242
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:51
uint32 GetDynamicUpdateFieldData(Player const *target, uint32 *&flags) const
Definition: Object.cpp:921
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
Definition: UpdateFields.h:63
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
void append(T value)
Definition: ByteBuffer.h:143
uint8_t uint8
Definition: g3dmath.h:164
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
bool GetBit(uint32 index) const
Definition: UpdateMask.h:49
uint32_t uint32
Definition: g3dmath.h:168
uint8 flags
Definition: DisableMgr.cpp:44
void SetBit(uint32 index)
Definition: UpdateMask.h:47
Definition: Item.h:233
Definition: UpdateData.h:30
uint32 _modifiers[MAX_ITEM_MODIFIERS]
Definition: Item.h:458
Definition: UpdateFields.h:56
uint16 _fieldNotifyFlags
Definition: Object.h:248

+ Here is the call graph for this function:

void Item::BuildUpdate ( UpdateDataMapType data_map)
overridevirtual

Reimplemented from Object.

1133 {
1134  if (Player* owner = GetOwner())
1135  BuildFieldsUpdate(owner, data_map);
1136  ClearUpdateMask(false);
1137 }
void ClearUpdateMask(bool remove)
Definition: Object.cpp:829
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition: Object.cpp:844
Player * GetOwner() const
Definition: Item.cpp:552

+ Here is the call graph for this function:

InventoryResult Item::CanBeMergedPartlyWith ( ItemTemplate const proto) const
853 {
854  // not allow merge looting currently items
855  if (m_lootGenerated)
856  return EQUIP_ERR_LOOT_GONE;
857 
858  // check item type
859  if (GetEntry() != proto->GetId())
860  return EQUIP_ERR_CANT_STACK;
861 
862  // check free space (full stacks can't be target of merge
863  if (GetCount() >= proto->GetMaxStackSize())
864  return EQUIP_ERR_CANT_STACK;
865 
866  return EQUIP_ERR_OK;
867 }
uint32 GetCount() const
Definition: Item.h:322
bool m_lootGenerated
Definition: Item.h:368
Definition: Item.h:97
Definition: Item.h:48
uint32 GetEntry() const
Definition: Object.h:107
Definition: Item.h:67

+ Here is the call graph for this function:

bool Item::CanBeTraded ( bool  mail = false,
bool  trade = false 
) const
770 {
771  if (m_lootGenerated)
772  return false;
773 
774  if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE) || !trade)))
775  return false;
776 
777  if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()))
778  return false;
779 
780  if (Player* owner = GetOwner())
781  {
782  if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
783  return false;
784  if (owner->GetLootGUID() == GetGUID())
785  return false;
786  }
787 
788  if (IsBoundByEnchant())
789  return false;
790 
791  return true;
792 }
bool IsSoulBound() const
Definition: Item.h:277
Definition: UpdateFields.h:49
bool m_lootGenerated
Definition: Item.h:368
uint16 GetPos() const
Definition: Item.h:333
bool IsBag() const
Definition: Item.h:307
Definition: Item.h:48
bool IsBoundAccountWide() const
Definition: Item.h:278
Definition: Bag.h:28
Player * GetOwner() const
Definition: Item.cpp:552
bool IsBoundByEnchant() const
Definition: Item.cpp:840
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ItemTemplate.h:143
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::CanTransmogrifyItemWithItem ( Item const transmogrified,
WorldPackets::Item::ItemInstance const transmogrifier,
BonusData const bonus 
)
static
1493 {
1494  ItemTemplate const* source = sObjectMgr->GetItemTemplate(transmogrifier.ItemID); // source
1495  ItemTemplate const* target = transmogrified->GetTemplate(); // dest
1496 
1497  if (!source || !target)
1498  return false;
1499 
1500  if (sDB2Manager.GetItemDisplayId(source->GetId(), bonus->AppearanceModID) == transmogrified->GetDisplayId())
1501  return false;
1502 
1503  if (!IsValidTransmogrificationSource(transmogrifier, bonus) || !transmogrified->IsValidTransmogrificationTarget())
1504  return false;
1505 
1506  if (source->GetClass() != target->GetClass())
1507  return false;
1508 
1509  if (source->GetInventoryType() == INVTYPE_TABARD ||
1510  source->GetInventoryType() == INVTYPE_BAG ||
1511  source->GetInventoryType() == INVTYPE_RELIC ||
1512  source->GetInventoryType() == INVTYPE_BODY ||
1513  source->GetInventoryType() == INVTYPE_FINGER ||
1514  source->GetInventoryType() == INVTYPE_TRINKET ||
1515  source->GetInventoryType() == INVTYPE_AMMO ||
1516  source->GetInventoryType() == INVTYPE_QUIVER)
1517  return false;
1518 
1519  if (source->GetSubClass() != target->GetSubClass())
1520  {
1521  if (source->GetClass() != ITEM_CLASS_WEAPON)
1522  return false;
1523 
1525  return false;
1526  }
1527 
1528  if (source->GetInventoryType() != target->GetInventoryType())
1529  {
1530  int32 sourceSlot = ItemTransmogrificationSlots[source->GetInventoryType()];
1531  if (sourceSlot == -1 && source->GetInventoryType() == INVTYPE_WEAPON && (target->GetInventoryType() == INVTYPE_WEAPONMAINHAND || target->GetInventoryType() == INVTYPE_WEAPONOFFHAND))
1532  sourceSlot = ItemTransmogrificationSlots[target->GetInventoryType()];
1533 
1534  if (sourceSlot != ItemTransmogrificationSlots[target->GetInventoryType()])
1535  return false;
1536  }
1537 
1538  return true;
1539 }
Definition: ItemTemplate.h:360
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: ItemTemplate.h:344
Definition: ItemTemplate.h:351
uint32 GetClass() const
Definition: ItemTemplate.h:653
static bool IsValidTransmogrificationSource(WorldPackets::Item::ItemInstance const &transmogrifier, BonusData const *bonus)
Definition: Item.cpp:1359
Definition: ItemTemplate.h:343
#define sObjectMgr
Definition: ObjectMgr.h:1567
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:664
Definition: ItemTemplate.h:345
Definition: ItemTemplate.h:354
Definition: ItemTemplate.h:359
Definition: ItemTemplate.h:356
int32_t int32
Definition: Define.h:146
static ItemTransmogrificationWeaponCategory GetTransmogrificationWeaponCategory(ItemTemplate const *proto)
Definition: Item.cpp:1427
Definition: ItemTemplate.h:350
Definition: ItemTemplate.h:353
Definition: ItemTemplate.h:369
Definition: ItemTemplate.h:336
Definition: ItemTemplate.h:647
uint32 GetSubClass() const
Definition: ItemTemplate.h:654
int32 const ItemTransmogrificationSlots[MAX_INVTYPE]
Definition: Item.cpp:1459
uint32 GetId() const
Definition: ItemTemplate.h:652

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::CheckSoulboundTradeExpire ( )
1323 {
1324  // called from owner's update - GetOwner() MUST be valid
1325  if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2*HOUR < GetOwner()->GetTotalPlayedTime())
1326  {
1328  return true; // remove from tradeable list
1329  }
1330 
1331  return false;
1332 }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: Common.h:98
void ClearSoulboundTradeable(Player *currentOwner)
Definition: Item.cpp:1309
Player * GetOwner() const
Definition: Item.cpp:552
Definition: UpdateFields.h:55

+ Here is the call graph for this function:

void Item::ClearEnchantment ( EnchantmentSlot  slot)
947 {
948  if (!GetEnchantmentId(slot))
949  return;
950 
951  for (uint8 x = 0; x < MAX_ITEM_ENCHANTMENT_EFFECTS; ++x)
954 }
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
#define MAX_ITEM_ENCHANTMENT_EFFECTS
Definition: DBCStructure.h:1212
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Player * GetOwner() const
Definition: Item.cpp:552
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
Definition: Item.h:217
uint8_t uint8
Definition: Define.h:152
G3D::int16 x
Definition: Vector2int16.h:37
Definition: UpdateFields.h:50
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::ClearSoulboundTradeable ( Player currentOwner)
1310 {
1312  if (allowedGUIDs.empty())
1313  return;
1314 
1315  allowedGUIDs.clear();
1316  SetState(ITEM_CHANGED, currentOwner);
1318  stmt->setUInt64(0, GetGUID().GetCounter());
1319  CharacterDatabase.Execute(stmt);
1320 }
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: UpdateFields.h:49
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Item.h:217
Definition: CharacterDatabase.h:139
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
Definition: ItemTemplate.h:143
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
GuidSet allowedGUIDs
Definition: Item.h:457

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * Item::CloneItem ( uint32  count,
Player const player = NULL 
) const
1096 {
1097  Item* newItem = CreateItem(GetEntry(), count, player);
1098  if (!newItem)
1099  return NULL;
1100 
1105  // player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
1106  if (player)
1108  return newItem;
1109 }
Definition: UpdateFields.h:47
Definition: UpdateFields.h:44
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:49
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
void SetItemRandomProperties(int32 randomPropId)
Definition: Item.cpp:640
int32 GetItemRandomPropertyId() const
Definition: Item.h:342
Definition: Item.h:259
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
static Item * CreateItem(uint32 itemEntry, uint32 count, Player const *player=NULL)
Definition: Item.cpp:1068
Definition: ItemTemplate.h:143
Definition: ItemTemplate.h:147
uint32 GetEntry() const
Definition: Object.h:107
Definition: UpdateFields.h:45

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::Create ( ObjectGuid::LowType  guidlow,
uint32  itemid,
Player const owner 
)
virtual

Reimplemented in Bag.

255 {
256  Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
257 
258  SetEntry(itemid);
259  SetObjectScale(1.0f);
260 
261  if (owner)
262  {
263  SetOwnerGUID(owner->GetGUID());
264  SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
265  }
266 
267  ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
268  if (!itemProto)
269  return false;
270 
271  _bonusData.Initialize(itemProto);
275 
276  for (uint8 i = 0; i < itemProto->Effects.size() && i < 5; ++i)
277  SetSpellCharges(i, itemProto->Effects[i]->Charges);
278 
281  return true;
282 }
Definition: UpdateFields.h:47
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:1941
Definition: UpdateFields.h:43
Definition: UpdateFields.h:53
uint32 GetDuration() const
Definition: ItemTemplate.h:699
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
void SetEntry(uint32 entry)
Definition: Object.h:108
#define sObjectMgr
Definition: ObjectMgr.h:1567
std::vector< ItemEffectEntry const * > Effects
Definition: ItemTemplate.h:707
BonusData _bonusData
Definition: Item.h:444
Definition: UpdateFields.h:55
Definition: UpdateFields.h:46
uint32 MaxDurability
Definition: ItemTemplate.h:706
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:365
Definition: ItemTemplate.h:647
virtual void SetObjectScale(float scale)
Definition: Object.h:111
uint8_t uint8
Definition: Define.h:152
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:273
Definition: UpdateFields.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Item * Item::CreateItem ( uint32  itemEntry,
uint32  count,
Player const player = NULL 
)
static
1069 {
1070  if (count < 1)
1071  return NULL; //don't create item at zero count
1072 
1073  ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
1074  if (proto)
1075  {
1076  if (count > proto->GetMaxStackSize())
1077  count = proto->GetMaxStackSize();
1078 
1079  ASSERT(count != 0, "proto->Stackable == 0 but checked at loading already");
1080 
1081  Item* item = NewItemOrBag(proto);
1082  if (item->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), itemEntry, player))
1083  {
1084  item->SetCount(count);
1085  return item;
1086  }
1087  else
1088  delete item;
1089  }
1090  else
1091  ABORT();
1092  return NULL;
1093 }
virtual bool Create(ObjectGuid::LowType guidlow, uint32 itemid, Player const *owner)
Definition: Item.cpp:254
arena_t NULL
Definition: jemalloc_internal.h:624
void SetCount(uint32 value)
Definition: Item.cpp:794
#define sObjectMgr
Definition: ObjectMgr.h:1567
Item * NewItemOrBag(ItemTemplate const *proto)
Definition: Bag.h:69
Definition: Item.h:259
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:745
Definition: ItemTemplate.h:647
#define ABORT
Definition: Errors.h:56
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::DeleteFromDB ( SQLTransaction trans,
ObjectGuid::LowType  itemGuid 
)
static
519 {
521  stmt->setUInt64(0, itemGuid);
522  trans->Append(stmt);
523 }
Definition: PreparedStatement.h:74
Definition: CharacterDatabase.h:145
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::DeleteFromDB ( SQLTransaction trans)
virtual

Reimplemented in Bag.

526 {
527  DeleteFromDB(trans, GetGUID().GetCounter());
528 
529  // Delete the items if this is a container
530  if (!loot.isLooted())
532 }
void ItemContainerDeleteLootMoneyAndLootItemsFromDB()
Definition: Item.cpp:1864
ObjectGuid const & GetGUID() const
Definition: Object.h:105
static void DeleteFromDB(SQLTransaction &trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:518
bool isLooted() const
Definition: LootMgr.h:375
Loot loot
Definition: Item.h:367

+ Here is the call graph for this function:

void Item::DeleteFromInventoryDB ( SQLTransaction trans,
ObjectGuid::LowType  itemGuid 
)
static
536 {
538  stmt->setUInt64(0, itemGuid);
539  trans->Append(stmt);
540 }
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: CharacterDatabase.h:477
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::DeleteFromInventoryDB ( SQLTransaction trans)
543 {
544  DeleteFromInventoryDB(trans, GetGUID().GetCounter());
545 }
static void DeleteFromInventoryDB(SQLTransaction &trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:535
ObjectGuid const & GetGUID() const
Definition: Object.h:105

+ Here is the call graph for this function:

void Item::DeleteRefundDataFromDB ( SQLTransaction trans)
1231 {
1232  if (trans)
1233  {
1235  stmt->setUInt64(0, GetGUID().GetCounter());
1236  (*trans)->Append(stmt);
1237 
1238  }
1239 }
Definition: CharacterDatabase.h:414
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::FSetState ( ItemUpdateState  state)
inline
378  {
379  uState = state;
380  }
ItemUpdateState uState
Definition: Item.h:450

+ Here is the caller graph for this function:

bool Item::GemsFitSockets ( ) const
957 {
958  for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
959  {
961 
962  if (!SocketColor) // no socket slot
963  continue;
964 
965  uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
966  if (!enchant_id) // no gems on this socket
967  return false;
968 
969  SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
970  if (!enchantEntry) // invalid gem id on this socket
971  return false;
972 
973  uint8 GemColor = 0;
974 
975  uint32 gemid = enchantEntry->SRCItemID;
976  if (gemid)
977  {
978  ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
979  if (gemProto)
980  {
981  GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GetGemProperties());
982  if (gemProperty)
983  GemColor = gemProperty->Type;
984  }
985  }
986 
987  if (!(GemColor & SocketColor)) // bad gem color on this socket
988  return false;
989  }
990  return true;
991 }
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesfmt)
#define MAX_GEM_SOCKETS
Definition: Item.h:195
uint32 GetGemProperties() const
Definition: ItemTemplate.h:697
uint32 SRCItemID
Definition: DBCStructure.h:1224
EnchantmentSlot
Definition: Item.h:172
SocketColor GetSocketColor(uint32 index) const
Definition: ItemTemplate.h:695
uint32 Type
Definition: DBCStructure.h:505
Definition: DBCStructure.h:1214
#define sObjectMgr
Definition: ObjectMgr.h:1567
SocketColor
Definition: ItemTemplate.h:318
Definition: DBCStructure.h:499
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
Definition: Item.h:176
Definition: ItemTemplate.h:647
uint8_t uint8
Definition: Define.h:152
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Item::GenerateItemRandomPropertyId ( uint32  item_id)
static
595 {
596  ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
597 
598  if (!itemProto)
599  return 0;
600 
601  // item must have one from this field values not null if it can have random enchantments
602  if ((!itemProto->GetRandomProperty()) && (!itemProto->GetRandomSuffix()))
603  return 0;
604 
605  // item can have not null only one from field values
606  if ((itemProto->GetRandomProperty()) && (itemProto->GetRandomSuffix()))
607  {
608  TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->GetId(), itemProto->GetRandomProperty(), itemProto->GetRandomSuffix());
609  return 0;
610  }
611 
612  // RandomProperty case
613  if (itemProto->GetRandomProperty())
614  {
615  uint32 randomPropId = GetItemEnchantMod(itemProto->GetRandomProperty());
616  ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
617  if (!random_id)
618  {
619  TC_LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
620  return 0;
621  }
622 
623  return random_id->ID;
624  }
625  // RandomSuffix case
626  else
627  {
628  uint32 randomPropId = GetItemEnchantMod(itemProto->GetRandomSuffix());
629  ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
630  if (!random_id)
631  {
632  TC_LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
633  return 0;
634  }
635 
636  return -int32(random_id->ID);
637  }
638 }
uint32 GetRandomSuffix() const
Definition: ItemTemplate.h:689
TC_GAME_API uint32 GetItemEnchantMod(int32 entry)
Definition: ItemEnchantmentMgr.cpp:80
DB2Storage< ItemRandomSuffixEntry > sItemRandomSuffixStore("ItemRandomSuffix.db2", ItemRandomSuffixFormat, HOTFIX_SEL_ITEM_RANDOM_SUFFIX)
uint32 GetRandomProperty() const
Definition: ItemTemplate.h:688
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
Definition: DB2Structure.h:779
Definition: ItemTemplate.h:647
DB2Storage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore("ItemRandomProperties.db2", ItemRandomPropertiesFormat, HOTFIX_SEL_ITEM_RANDOM_PROPERTIES)
int32_t int32
Definition: g3dmath.h:167
uint32 GetId() const
Definition: ItemTemplate.h:652
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: DB2Structure.h:771

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetAppearanceModId ( ) const
inline
394 { return _bonusData.AppearanceModID; }
BonusData _bonusData
Definition: Item.h:444
uint32 AppearanceModID
Definition: Item.h:250

+ Here is the caller graph for this function:

uint32 Item::GetArmor ( Player const owner) const
inline
395 { return GetTemplate()->GetArmor(GetItemLevel(owner)); }
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:1871
uint32 GetArmor(uint32 itemLevel) const
Definition: ItemTemplate.cpp:38
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

uint8 Item::GetBagSlot ( ) const
760 {
762 }
#define INVENTORY_SLOT_BAG_0
Bag * m_container
Definition: Item.h:449
uint8 GetSlot() const
Definition: Item.h:329
uint8_t uint8
Definition: g3dmath.h:164

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BonusData const* Item::GetBonus ( ) const
inline
270 { return &_bonusData; }
BonusData _bonusData
Definition: Item.h:444

+ Here is the caller graph for this function:

Bag* Item::GetContainer ( )
inline
330 { return m_container; }
Bag * m_container
Definition: Item.h:449

+ Here is the caller graph for this function:

uint32 Item::GetCount ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:46

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::GetDamage ( Player const owner,
float &  minDamage,
float &  maxDamage 
) const
inline
396 { GetTemplate()->GetDamage(GetItemLevel(owner), minDamage, maxDamage); }
void GetDamage(uint32 itemLevel, float &minDamage, float &maxDamage) const
Definition: ItemTemplate.cpp:74
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:1871
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

uint32 Item::GetDisplayId ( ) const
1902 {
1903  if (uint32 transmogrification = GetModifier(ITEM_MODIFIER_TRANSMOG_ITEM_ID))
1904  return sDB2Manager.GetItemDisplayId(transmogrification, GetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_MOD));
1905 
1906  return sDB2Manager.GetItemDisplayId(GetEntry(), GetAppearanceModId());
1907 }
#define sDB2Manager
Definition: DB2Stores.h:224
uint32 GetAppearanceModId() const
Definition: Item.h:394
Definition: Item.h:225
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.h:440
uint32_t uint32
Definition: Define.h:150
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetEnchantmentCharges ( EnchantmentSlot  slot) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
Definition: Item.h:201
Definition: UpdateFields.h:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetEnchantmentDuration ( EnchantmentSlot  slot) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: Item.h:200
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
Definition: UpdateFields.h:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetEnchantmentId ( EnchantmentSlot  slot) const
inline
Definition: Item.h:199
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
Definition: UpdateFields.h:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetEnchantRequiredLevel ( ) const
825 {
826  uint32 level = 0;
827 
828  // Check all enchants for required level
829  for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
830  {
831  if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
832  if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
833  if (enchantEntry->MinLevel > level)
834  level = enchantEntry->MinLevel;
835  }
836 
837  return level;
838 }
Definition: Item.h:174
EnchantmentSlot
Definition: Item.h:172
Definition: Item.h:190
Definition: DBCStructure.h:1214
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

uint8 Item::GetGemCountWithID ( uint32  GemID) const
994 {
995  uint8 count = 0;
996  for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
997  {
998  uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
999  if (!enchant_id)
1000  continue;
1001 
1002  SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
1003  if (!enchantEntry)
1004  continue;
1005 
1006  if (GemID == enchantEntry->SRCItemID)
1007  ++count;
1008  }
1009  return count;
1010 }
#define MAX_GEM_SOCKETS
Definition: Item.h:195
uint32 SRCItemID
Definition: DBCStructure.h:1224
EnchantmentSlot
Definition: Item.h:172
Definition: DBCStructure.h:1214
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
Definition: Item.h:176
uint8_t uint8
Definition: Define.h:152
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8 Item::GetGemCountWithLimitCategory ( uint32  limitCategory) const
1013 {
1014  uint8 count = 0;
1015  for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
1016  {
1017  uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
1018  if (!enchant_id)
1019  continue;
1020 
1021  SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
1022  if (!enchantEntry)
1023  continue;
1024 
1025  ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(enchantEntry->SRCItemID);
1026  if (!gemProto)
1027  continue;
1028 
1029  if (gemProto->GetItemLimitCategory() == limitCategory)
1030  ++count;
1031  }
1032  return count;
1033 }
#define MAX_GEM_SOCKETS
Definition: Item.h:195
uint32 SRCItemID
Definition: DBCStructure.h:1224
EnchantmentSlot
Definition: Item.h:172
Definition: DBCStructure.h:1214
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetItemLimitCategory() const
Definition: ItemTemplate.h:700
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
Definition: Item.h:176
Definition: ItemTemplate.h:647
uint8_t uint8
Definition: Define.h:152
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

uint32 Item::GetItemLevel ( Player const owner) const
1872 {
1873  ItemTemplate const* stats = GetTemplate();
1874  if (!stats)
1875  return MIN_ITEM_LEVEL;
1876 
1877  uint32 itemLevel = stats->GetBaseItemLevel();
1879  if (uint32 heirloomIlvl = sDB2Manager.GetHeirloomItemLevel(ssd->ItemLevelCurveID, owner->getLevel()))
1880  itemLevel = heirloomIlvl;
1881 
1883 }
uint32 GetBaseItemLevel() const
Definition: ItemTemplate.h:667
#define sDB2Manager
Definition: DB2Stores.h:224
#define MIN_ITEM_LEVEL
Definition: ItemTemplate.h:642
Definition: DB2Structure.h:1106
T max(const T &x, const T &y)
Definition: g3dmath.h:320
T min(const T &x, const T &y)
Definition: g3dmath.h:305
#define MAX_ITEM_LEVEL
Definition: ItemTemplate.h:643
uint32 GetScalingStatDistribution() const
Definition: Item.h:399
uint32_t uint32
Definition: Define.h:150
BonusData _bonusData
Definition: Item.h:444
int32 ItemLevel
Definition: Item.h:243
Definition: ItemTemplate.h:647
uint32_t uint32
Definition: g3dmath.h:168
DB2Storage< ScalingStatDistributionEntry > sScalingStatDistributionStore("ScalingStatDistribution.db2", ScalingStatDistributionFormat, HOTFIX_SEL_SCALING_STAT_DISTRIBUTION)
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Item::GetItemRandomPropertyId ( ) const
inline
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:294
Definition: UpdateFields.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Item::GetItemStatType ( uint32  index) const
inline
391 { ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
int32 ItemStatType[MAX_ITEM_PROTO_STATS]
Definition: Item.h:245
#define MAX_ITEM_PROTO_STATS
Definition: DB2Structure.h:790
BonusData _bonusData
Definition: Item.h:444
#define ASSERT
Definition: Errors.h:55
int32 Item::GetItemStatValue ( uint32  index,
Player const owner 
) const
1886 {
1887  ASSERT(index < MAX_ITEM_PROTO_STATS);
1888  uint32 itemLevel = GetItemLevel(owner);
1889  if (uint32 randomPropPoints = GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate()->GetInventoryType(), GetTemplate()->GetSubClass()))
1890  {
1891  float statValue = float(_bonusData.ItemStatAllocation[index] * randomPropPoints) * 0.0001f;
1892  if (GtItemSocketCostPerLevelEntry const* gtCost = sGtItemSocketCostPerLevelStore.EvaluateTable(itemLevel - 1, 0))
1893  statValue -= float(int32(_bonusData.ItemStatSocketCostMultiplier[index] * gtCost->ratio));
1894 
1895  return int32(std::floor(statValue + 0.5f));
1896  }
1897 
1898  return _bonusData.ItemStatValue[index];
1899 }
uint32 GetQuality() const
Definition: Item.h:388
int32 ItemStatAllocation[MAX_ITEM_PROTO_STATS]
Definition: Item.h:247
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]
Definition: Item.h:248
static Vector3int16 floor(const Vector3 &v)
Definition: DBCStructure.h:547
#define MAX_ITEM_PROTO_STATS
Definition: DB2Structure.h:790
uint32 GetItemLevel(Player const *owner) const
Definition: Item.cpp:1871
uint32_t uint32
Definition: Define.h:150
BonusData _bonusData
Definition: Item.h:444
GameTable< GtItemSocketCostPerLevelEntry > sGtItemSocketCostPerLevelStore(GtItemSocketCostPerLevelfmt)
int32_t int32
Definition: g3dmath.h:167
int32 ItemStatValue[MAX_ITEM_PROTO_STATS]
Definition: Item.h:246
#define ASSERT
Definition: Errors.h:55
TC_GAME_API uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
Definition: ItemEnchantmentMgr.cpp:133
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetItemSuffixFactor ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:51

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetMaxStackCount ( ) const
inline
324 { return GetTemplate()->GetMaxStackSize(); }
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:745
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetModifier ( ItemModifier  modifier) const
inline
440 { return _modifiers[modifier]; }
uint32 _modifiers[MAX_ITEM_MODIFIERS]
Definition: Item.h:458

+ Here is the caller graph for this function:

Player * Item::GetOwner ( ) const
553 {
555 }
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid Item::GetOwnerGUID ( ) const
inline
272 { return GetGuidValue(ITEM_FIELD_OWNER); }
Definition: UpdateFields.h:42
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetPaidExtendedCost ( ) const
inline
409 { return m_paidExtendedCost; }
uint32 m_paidExtendedCost
Definition: Item.h:456

+ Here is the caller graph for this function:

uint32 Item::GetPaidMoney ( ) const
inline
408 { return m_paidMoney; }
uint32 m_paidMoney
Definition: Item.h:455

+ Here is the caller graph for this function:

uint32 Item::GetPlayedTime ( )
1292 {
1293  time_t curtime = time(NULL);
1294  uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
1296 }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
time_t m_lastPlayedTimeUpdate
Definition: Item.h:453
arena_t NULL
Definition: jemalloc_internal.h:624
uint32_t uint32
Definition: Define.h:150
Definition: UpdateFields.h:55
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16 Item::GetPos ( ) const
inline
333 { return uint16(GetBagSlot()) << 8 | GetSlot(); }
uint16_t uint16
Definition: g3dmath.h:166
uint8 GetSlot() const
Definition: Item.h:329
uint8 GetBagSlot() const
Definition: Item.cpp:759

+ Here is the caller graph for this function:

uint32 Item::GetQuality ( ) const
inline
388 { return _bonusData.Quality; }
uint32 Quality
Definition: Item.h:242
BonusData _bonusData
Definition: Item.h:444

+ Here is the caller graph for this function:

uint16 Item::GetQueuePos ( ) const
inline
376 { return uQueuePos; }
int16 uQueuePos
Definition: Item.h:451

+ Here is the caller graph for this function:

ObjectGuid const& Item::GetRefundRecipient ( ) const
inline
407 { return m_refundRecipient; }
ObjectGuid m_refundRecipient
Definition: Item.h:454

+ Here is the caller graph for this function:

float Item::GetRepairCostMultiplier ( ) const
inline
float RepairCostMultiplier
Definition: Item.h:251
BonusData _bonusData
Definition: Item.h:444
int32 Item::GetRequiredLevel ( ) const
inline
390 { return _bonusData.RequiredLevel; }
int32 RequiredLevel
Definition: Item.h:244
BonusData _bonusData
Definition: Item.h:444
uint32 Item::GetScalingStatDistribution ( ) const
inline
BonusData _bonusData
Definition: Item.h:444
uint32 ScalingStatDistribution
Definition: Item.h:252

+ Here is the caller graph for this function:

uint32 Item::GetScriptId ( ) const
inline
425 { return GetTemplate()->ScriptId; }
uint32 ScriptId
Definition: ItemTemplate.h:710
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the caller graph for this function:

uint32 Item::GetSellPrice ( ItemTemplate const proto,
bool success 
)
static
1543 {
1544  normalSellPrice = true;
1545 
1546  if (proto->GetFlags2() & ITEM_FLAG2_HAS_NORMAL_PRICE)
1547  {
1548  return proto->GetBuyPrice();
1549  }
1550  else
1551  {
1552  ImportPriceQualityEntry const* qualityPrice = sImportPriceQualityStore.LookupEntry(proto->GetQuality() + 1);
1553  ItemPriceBaseEntry const* basePrice = sItemPriceBaseStore.LookupEntry(proto->GetBaseItemLevel());
1554 
1555  if (!qualityPrice || !basePrice)
1556  return 0;
1557 
1558  float qualityFactor = qualityPrice->Factor;
1559  float baseFactor = 0.0f;
1560 
1561  uint32 inventoryType = proto->GetInventoryType();
1562 
1563  if (inventoryType == INVTYPE_WEAPON ||
1564  inventoryType == INVTYPE_2HWEAPON ||
1565  inventoryType == INVTYPE_WEAPONMAINHAND ||
1566  inventoryType == INVTYPE_WEAPONOFFHAND ||
1567  inventoryType == INVTYPE_RANGED ||
1568  inventoryType == INVTYPE_THROWN ||
1569  inventoryType == INVTYPE_RANGEDRIGHT)
1570  baseFactor = basePrice->WeaponFactor;
1571  else
1572  baseFactor = basePrice->ArmorFactor;
1573 
1574  if (inventoryType == INVTYPE_ROBE)
1575  inventoryType = INVTYPE_CHEST;
1576 
1577  float typeFactor = 0.0f;
1578  int8 weapType = -1;
1579 
1580  switch (inventoryType)
1581  {
1582  case INVTYPE_HEAD:
1583  case INVTYPE_SHOULDERS:
1584  case INVTYPE_CHEST:
1585  case INVTYPE_WAIST:
1586  case INVTYPE_LEGS:
1587  case INVTYPE_FEET:
1588  case INVTYPE_WRISTS:
1589  case INVTYPE_HANDS:
1590  case INVTYPE_CLOAK:
1591  {
1592  ImportPriceArmorEntry const* armorPrice = sImportPriceArmorStore.LookupEntry(inventoryType);
1593  if (!armorPrice)
1594  return 0;
1595 
1596  switch (proto->GetSubClass())
1597  {
1600  typeFactor = armorPrice->ClothFactor;
1601  break;
1603  typeFactor = armorPrice->LeatherFactor;
1604  break;
1606  typeFactor = armorPrice->MailFactor;
1607  break;
1609  typeFactor = armorPrice->PlateFactor;
1610  break;
1611  default:
1612  return 0;
1613  }
1614 
1615  break;
1616  }
1617  case INVTYPE_SHIELD:
1618  {
1619  ImportPriceShieldEntry const* shieldPrice = sImportPriceShieldStore.LookupEntry(1); // it only has two rows, it's unclear which is the one used
1620  if (!shieldPrice)
1621  return 0;
1622 
1623  typeFactor = shieldPrice->Factor;
1624  break;
1625  }
1627  weapType = 0;
1628  break;
1629  case INVTYPE_WEAPONOFFHAND:
1630  weapType = 1;
1631  break;
1632  case INVTYPE_WEAPON:
1633  weapType = 2;
1634  break;
1635  case INVTYPE_2HWEAPON:
1636  weapType = 3;
1637  break;
1638  case INVTYPE_RANGED:
1639  case INVTYPE_RANGEDRIGHT:
1640  case INVTYPE_RELIC:
1641  weapType = 4;
1642  break;
1643  default:
1644  return proto->GetBuyPrice();
1645  }
1646 
1647  if (weapType != -1)
1648  {
1649  ImportPriceWeaponEntry const* weaponPrice = sImportPriceWeaponStore.LookupEntry(weapType + 1);
1650  if (!weaponPrice)
1651  return 0;
1652 
1653  typeFactor = weaponPrice->Factor;
1654  }
1655 
1656  normalSellPrice = false;
1657  return uint32(qualityFactor * proto->GetUnk1() * proto->GetUnk2() * typeFactor * baseFactor);
1658  }
1659 }
Definition: DB2Structure.h:634
Definition: ItemTemplate.h:360
int8_t int8
Definition: Define.h:148
float MailFactor
Definition: DB2Structure.h:624
float Factor
Definition: DB2Structure.h:631
float WeaponFactor
Definition: DB2Structure.h:766
Definition: ItemTemplate.h:352
Definition: ItemTemplate.h:348
Definition: ItemTemplate.h:223
Definition: DB2Structure.h:619
DB2Storage< ImportPriceArmorEntry > sImportPriceArmorStore("ImportPriceArmor.db2", ImportPriceArmorFormat, HOTFIX_SEL_IMPORT_PRICE_ARMOR)
Definition: DB2Structure.h:761
Definition: ItemTemplate.h:335
DB2Storage< ImportPriceQualityEntry > sImportPriceQualityStore("ImportPriceQuality.db2", ImportPriceQualityFormat, HOTFIX_SEL_IMPORT_PRICE_QUALITY)
DB2Storage< ImportPriceShieldEntry > sImportPriceShieldStore("ImportPriceShield.db2", ImportPriceShieldFormat, HOTFIX_SEL_IMPORT_PRICE_SHIELD)
Definition: ItemTemplate.h:474
Definition: DB2Structure.h:640
Definition: ItemTemplate.h:473
DB2Storage< ImportPriceWeaponEntry > sImportPriceWeaponStore("ImportPriceWeapon.db2", ImportPriceWeaponFormat, HOTFIX_SEL_IMPORT_PRICE_WEAPON)
Definition: ItemTemplate.h:345
Definition: ItemTemplate.h:346
Definition: ItemTemplate.h:333
Definition: ItemTemplate.h:340
float LeatherFactor
Definition: DB2Structure.h:623
float Factor
Definition: DB2Structure.h:637
Definition: ItemTemplate.h:354
Definition: ItemTemplate.h:347
Definition: ItemTemplate.h:472
uint32_t uint32
Definition: Define.h:150
Definition: ItemTemplate.h:337
Definition: ItemTemplate.h:357
float ArmorFactor
Definition: DB2Structure.h:765
Definition: ItemTemplate.h:349
Definition: ItemTemplate.h:353
DB2Storage< ItemPriceBaseEntry > sItemPriceBaseStore("ItemPriceBase.db2", ItemPriceBaseFormat, HOTFIX_SEL_ITEM_PRICE_BASE)
Definition: ItemTemplate.h:342
Definition: ItemTemplate.h:470
float ClothFactor
Definition: DB2Structure.h:622
Definition: ItemTemplate.h:339
Definition: ItemTemplate.h:358
uint32_t uint32
Definition: g3dmath.h:168
float Factor
Definition: DB2Structure.h:643
Definition: DB2Structure.h:628
float PlateFactor
Definition: DB2Structure.h:625
Definition: ItemTemplate.h:341
Definition: ItemTemplate.h:471
Definition: ItemTemplate.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetSkill ( )
558 {
559  const static uint32 item_weapon_skills[MAX_ITEM_SUBCLASS_WEAPON] =
560  {
566  };
567 
568  const static uint32 item_armor_skills[MAX_ITEM_SUBCLASS_ARMOR] =
569  {
571  };
572 
573  ItemTemplate const* proto = GetTemplate();
574 
575  switch (proto->GetClass())
576  {
577  case ITEM_CLASS_WEAPON:
578  if (proto->GetSubClass() >= MAX_ITEM_SUBCLASS_WEAPON)
579  return 0;
580  else
581  return item_weapon_skills[proto->GetSubClass()];
582 
583  case ITEM_CLASS_ARMOR:
584  if (proto->GetSubClass() >= MAX_ITEM_SUBCLASS_ARMOR)
585  return 0;
586  else
587  return item_armor_skills[proto->GetSubClass()];
588 
589  default:
590  return 0;
591  }
592 }
Definition: SharedDefines.h:3970
Definition: SharedDefines.h:3892
Definition: SharedDefines.h:3961
uint32 GetClass() const
Definition: ItemTemplate.h:653
Definition: SharedDefines.h:3984
Definition: SharedDefines.h:3897
Definition: SharedDefines.h:3913
#define MAX_ITEM_SUBCLASS_ARMOR
Definition: ItemTemplate.h:484
Definition: SharedDefines.h:3983
Definition: SharedDefines.h:3931
Definition: SharedDefines.h:3896
Definition: SharedDefines.h:3925
Definition: SharedDefines.h:3932
#define MAX_ITEM_SUBCLASS_WEAPON
Definition: ItemTemplate.h:449
Definition: SharedDefines.h:3976
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:3891
Definition: SharedDefines.h:3933
Definition: ItemTemplate.h:369
Definition: ItemTemplate.h:647
Definition: SharedDefines.h:3965
uint32 GetSubClass() const
Definition: ItemTemplate.h:654
Definition: SharedDefines.h:3960
Definition: SharedDefines.h:3890
Definition: SharedDefines.h:3982
Definition: ItemTemplate.h:371
Definition: SharedDefines.h:3959
Definition: SharedDefines.h:3981
Definition: SharedDefines.h:3893
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547
Definition: SharedDefines.h:3985

+ Here is the call graph for this function:

uint8 Item::GetSlot ( ) const
inline
329 {return m_slot;}
uint8 m_slot
Definition: Item.h:448

+ Here is the caller graph for this function:

SocketColor Item::GetSocketColor ( uint32  index) const
inline
393 { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return SocketColor(_bonusData.SocketColor[index]); }
SocketColor
Definition: ItemTemplate.h:318
uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS]
Definition: Item.h:249
BonusData _bonusData
Definition: Item.h:444
#define MAX_ITEM_PROTO_SOCKETS
Definition: DB2Structure.h:789
#define ASSERT
Definition: Errors.h:55

+ Here is the caller graph for this function:

uint32 Item::GetSpecialPrice ( ItemTemplate const proto,
uint32  minimumPrice = 10000 
)
static
1662 {
1663  uint32 cost = 0;
1664 
1665  if (proto->GetFlags2() & ITEM_FLAG2_HAS_NORMAL_PRICE)
1666  cost = proto->GetSellPrice();
1667  else
1668  {
1669  bool normalPrice;
1670  cost = Item::GetSellPrice(proto, normalPrice);
1671 
1672  if (!normalPrice)
1673  {
1674  if (proto->GetBuyCount() <= 1)
1675  {
1676  ItemClassEntry const* classEntry = sItemClassStore.LookupEntry(proto->GetClass());
1677  if (classEntry)
1678  cost *= classEntry->PriceMod;
1679  else
1680  cost = 0;
1681  }
1682  else
1683  cost /= 4 * proto->GetBuyCount();
1684  }
1685  else
1686  cost = proto->GetSellPrice();
1687  }
1688 
1689  if (cost < minimumPrice)
1690  cost = minimumPrice;
1691 
1692  return cost;
1693 }
DB2Storage< ItemClassEntry > sItemClassStore("ItemClass.db2", ItemClassFormat, HOTFIX_SEL_ITEM_CLASS)
float PriceMod
Definition: DB2Structure.h:675
Definition: ItemTemplate.h:223
static uint32 GetSellPrice(ItemTemplate const *proto, bool &success)
Definition: Item.cpp:1542
uint32_t uint32
Definition: Define.h:150
Definition: DB2Structure.h:671

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Item::GetSpecialPrice ( uint32  minimumPrice = 10000) const
inline
433 { return Item::GetSpecialPrice(GetTemplate(), minimumPrice); }
static uint32 GetSpecialPrice(ItemTemplate const *proto, uint32 minimumPrice=10000)
Definition: Item.cpp:1661
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

int32 Item::GetSpellCharges ( uint8  index = 0) const
inline
364 { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:294
Definition: UpdateFields.h:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ItemUpdateState Item::GetState ( ) const
inline
371 { return uState; }
ItemUpdateState uState
Definition: Item.h:450

+ Here is the caller graph for this function:

ItemTemplate const * Item::GetTemplate ( ) const
548 {
549  return sObjectMgr->GetItemTemplate(GetEntry());
550 }
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

std::string const& Item::GetText ( ) const
inline
355 { return m_text; }
std::string m_text
Definition: Item.h:447
uint32 Item::GetVisibleAppearanceModId ( ) const
1924 {
1927 
1928  return GetAppearanceModId();
1929 }
uint32 GetAppearanceModId() const
Definition: Item.h:394
Definition: Item.h:225
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.h:440

+ Here is the call graph for this function:

uint32 Item::GetVisibleEntry ( ) const
1916 {
1917  if (uint32 transmogrification = GetModifier(ITEM_MODIFIER_TRANSMOG_ITEM_ID))
1918  return transmogrification;
1919 
1920  return GetEntry();
1921 }
Definition: Item.h:225
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.h:440
uint32_t uint32
Definition: Define.h:150
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

bool Item::HasEnchantRequiredSkill ( const Player player) const
811 {
812  // Check all enchants for required skill
813  for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
814  {
815  if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
816  if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
817  if (enchantEntry->RequiredSkillID && player->GetSkillValue(enchantEntry->RequiredSkillID) < enchantEntry->RequiredSkillRank)
818  return false;
819  }
820 
821  return true;
822 }
Definition: Item.h:174
EnchantmentSlot
Definition: Item.h:172
Definition: Item.h:190
Definition: DBCStructure.h:1214
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

bool Item::hasInvolvedQuest ( uint32  ) const
inlineoverridevirtual

Reimplemented from Object.

383 { return false; }
bool Item::hasQuest ( uint32  quest_id) const
inlineoverridevirtual

Reimplemented from Object.

382 { return GetTemplate()->GetStartQuest() == quest_id; }
uint32 GetStartQuest() const
Definition: ItemTemplate.h:686
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

bool Item::HasStats ( ) const
1388 {
1389  if (GetItemRandomPropertyId() != 0)
1390  return true;
1391 
1392  ItemTemplate const* proto = GetTemplate();
1393  Player const* owner = GetOwner();
1394  for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1395  if ((owner ? GetItemStatValue(i, owner) : proto->GetItemStatValue(i)) != 0)
1396  return true;
1397 
1398  return false;
1399 }
int32 GetItemStatValue(uint32 index) const
Definition: ItemTemplate.h:677
int32 GetItemRandomPropertyId() const
Definition: Item.h:342
int32 GetItemStatValue(uint32 index, Player const *owner) const
Definition: Item.cpp:1885
#define MAX_ITEM_PROTO_STATS
Definition: DB2Structure.h:790
Player * GetOwner() const
Definition: Item.cpp:552
Definition: ItemTemplate.h:647
uint8_t uint8
Definition: Define.h:152
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::HasStats ( WorldPackets::Item::ItemInstance const itemInstance,
BonusData const bonus 
)
static
1402 {
1403  if (itemInstance.RandomPropertiesID != 0)
1404  return true;
1405 
1406  for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1407  if (bonus->ItemStatValue[i] != 0)
1408  return true;
1409 
1410  return false;
1411 }
#define MAX_ITEM_PROTO_STATS
Definition: DB2Structure.h:790
uint8_t uint8
Definition: Define.h:152
bool Item::IsBag ( ) const
inline
307 { return GetTemplate()->GetInventoryType() == INVTYPE_BAG; }
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:664
Definition: ItemTemplate.h:350
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsBattlenetAccountBound ( ) const
inline
279 { return (GetTemplate()->GetFlags2() & ITEM_FLAG2_BNET_ACCOUNT_BOUND) != 0; }
Definition: ItemTemplate.h:226
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the caller graph for this function:

bool Item::IsBindedNotWith ( Player const player) const
1112 {
1113  // not binded item
1114  if (!IsSoulBound())
1115  return false;
1116 
1117  // own item
1118  if (GetOwnerGUID() == player->GetGUID())
1119  return false;
1120 
1122  if (allowedGUIDs.find(player->GetGUID()) != allowedGUIDs.end())
1123  return false;
1124 
1125  // BOA item case
1126  if (IsBoundAccountWide())
1127  return false;
1128 
1129  return true;
1130 }
bool IsSoulBound() const
Definition: Item.h:277
Definition: UpdateFields.h:49
bool IsBoundAccountWide() const
Definition: Item.h:278
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272
Definition: ItemTemplate.h:143
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
GuidSet allowedGUIDs
Definition: Item.h:457

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsBoundAccountWide ( ) const
inline
278 { return (GetTemplate()->GetFlags() & ITEM_FLAG_BIND_TO_ACCOUNT) != 0; }
Definition: ItemTemplate.h:200
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the caller graph for this function:

bool Item::IsBoundByEnchant ( ) const
841 {
842  // Check all enchants for soulbound
843  for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
844  if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
845  if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
846  if (enchantEntry->Flags & ENCHANTMENT_CAN_SOULBOUND)
847  return true;
848 
849  return false;
850 }
Definition: Item.h:174
EnchantmentSlot
Definition: Item.h:172
Definition: Item.h:190
Definition: DBCStructure.h:1214
Definition: Item.h:208
uint32_t uint32
Definition: Define.h:150
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsBroken ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:53
Definition: UpdateFields.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsConjuredConsumable ( ) const
inline
386 { return GetTemplate()->IsConjuredConsumable(); }
bool IsConjuredConsumable() const
Definition: ItemTemplate.h:752
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

bool Item::IsCurrencyToken ( ) const
inline
308 { return GetTemplate()->IsCurrencyToken(); }
bool IsCurrencyToken() const
Definition: ItemTemplate.h:743
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

bool Item::IsEquipped ( ) const
765 {
766  return !IsInBag() && m_slot < EQUIPMENT_SLOT_END;
767 }
uint8 m_slot
Definition: Item.h:448
bool IsInBag() const
Definition: Item.h:336

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsFitToSpellRequirements ( SpellInfo const spellInfo) const
870 {
871  ItemTemplate const* proto = GetTemplate();
872 
873  if (spellInfo->EquippedItemClass != -1) // -1 == any item class
874  {
875  // Special case - accept vellum for armor/weapon requirements
876  if ((spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR ||
877  spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON) && proto->IsVellum())
878  if (spellInfo->IsAbilityOfSkillType(SKILL_ENCHANTING)) // only for enchanting spells
879  return true;
880 
881  if (spellInfo->EquippedItemClass != int32(proto->GetClass()))
882  return false; // wrong item class
883 
884  if (spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
885  {
886  if ((spellInfo->EquippedItemSubClassMask & (1 << proto->GetSubClass())) == 0)
887  return false; // subclass not present in mask
888  }
889  }
890 
891  if (spellInfo->EquippedItemInventoryTypeMask != 0) // 0 == any inventory type
892  {
893  // Special case - accept weapon type for main and offhand requirements
894  if (proto->GetInventoryType() == INVTYPE_WEAPON &&
895  (spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
896  spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
897  return true;
898  else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->GetInventoryType())) == 0)
899  return false; // inventory type not present in mask
900  }
901 
902  return true;
903 }
Definition: SharedDefines.h:3973
uint32 GetClass() const
Definition: ItemTemplate.h:653
bool IsVellum() const
Definition: ItemTemplate.h:751
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:664
Definition: ItemTemplate.h:345
Definition: ItemTemplate.h:354
int32_t int32
Definition: Define.h:146
Definition: ItemTemplate.h:353
Definition: ItemTemplate.h:369
Definition: ItemTemplate.h:647
uint32 GetSubClass() const
Definition: ItemTemplate.h:654
Definition: ItemTemplate.h:371
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsInBag ( ) const
inline
336 { return m_container != NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
Bag * m_container
Definition: Item.h:449

+ Here is the caller graph for this function:

bool Item::IsInTrade ( ) const
inline
313 { return mb_in_trade; }
bool mb_in_trade
Definition: Item.h:452
bool Item::IsInUpdateQueue ( ) const
inline
375 { return uQueuePos != -1; }
int16 uQueuePos
Definition: Item.h:451

+ Here is the caller graph for this function:

bool Item::IsLimitedToAnotherMapOrZone ( uint32  cur_mapId,
uint32  cur_zoneId 
) const
1036 {
1037  ItemTemplate const* proto = GetTemplate();
1038  return proto && ((proto->GetMap() && proto->GetMap() != cur_mapId) || (proto->GetArea() && proto->GetArea() != cur_zoneId));
1039 }
uint32 GetMap() const
Definition: ItemTemplate.h:692
Definition: ItemTemplate.h:647
uint32 GetArea() const
Definition: ItemTemplate.h:691
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

bool Item::IsLocked ( ) const
inline
Definition: UpdateFields.h:49
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: ItemTemplate.h:137

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsNotEmptyBag ( ) const
287 {
288  if (Bag const* bag = ToBag())
289  return !bag->IsEmpty();
290  return false;
291 }
Definition: Bag.h:28
Bag * ToBag()
Definition: Item.h:303

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsPotion ( ) const
inline
384 { return GetTemplate()->IsPotion(); }
bool IsPotion() const
Definition: ItemTemplate.h:750
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsRangedWeapon ( ) const
inline
387 { return GetTemplate()->IsRangedWeapon(); }
bool IsRangedWeapon() const
Definition: ItemTemplate.h:754
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

bool Item::IsRefundExpired ( )
1299 {
1300  return (GetPlayedTime() > 2*HOUR);
1301 }
Definition: Common.h:98
uint32 GetPlayedTime()
Definition: Item.cpp:1291

+ Here is the call graph for this function:

bool Item::IsSoulBound ( ) const
inline
Definition: ItemTemplate.h:135
Definition: UpdateFields.h:49
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsValidTransmogrificationSource ( WorldPackets::Item::ItemInstance const transmogrifier,
BonusData const bonus 
)
static
1360 {
1361  ItemTemplate const* proto = sObjectMgr->GetItemTemplate(transmogrifier.ItemID);
1362  if (!proto)
1363  return false;
1364 
1365  if (proto->GetFlags2() & ITEM_FLAG2_CANNOT_TRANSMOG)
1366  return false;
1367 
1368  if (proto->GetQuality() == ITEM_QUALITY_LEGENDARY)
1369  return false;
1370 
1371  if (proto->GetClass() != ITEM_CLASS_ARMOR &&
1372  proto->GetClass() != ITEM_CLASS_WEAPON)
1373  return false;
1374 
1376  return false;
1377 
1378  if (proto->GetFlags2() & ITEM_FLAG2_CAN_TRANSMOG)
1379  return true;
1380 
1381  if (!HasStats(transmogrifier, bonus))
1382  return false;
1383 
1384  return true;
1385 }
uint32 GetClass() const
Definition: ItemTemplate.h:653
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32 GetFlags2() const
Definition: ItemTemplate.h:657
Definition: ItemTemplate.h:231
Definition: ItemTemplate.h:369
Definition: ItemTemplate.h:647
uint32 GetSubClass() const
Definition: ItemTemplate.h:654
Definition: ItemTemplate.h:232
Definition: ItemTemplate.h:442
Definition: SharedDefines.h:325
Definition: ItemTemplate.h:371
bool HasStats() const
Definition: Item.cpp:1387
uint32 GetQuality() const
Definition: ItemTemplate.h:655

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Item::IsValidTransmogrificationTarget ( ) const
1335 {
1336  ItemTemplate const* proto = GetTemplate();
1337  if (!proto)
1338  return false;
1339 
1340  if (proto->GetQuality() == ITEM_QUALITY_LEGENDARY)
1341  return false;
1342 
1343  if (proto->GetClass() != ITEM_CLASS_ARMOR &&
1344  proto->GetClass() != ITEM_CLASS_WEAPON)
1345  return false;
1346 
1348  return false;
1349 
1351  return false;
1352 
1353  if (!HasStats())
1354  return false;
1355 
1356  return true;
1357 }
uint32 GetClass() const
Definition: ItemTemplate.h:653
uint32 GetFlags2() const
Definition: ItemTemplate.h:657
Definition: ItemTemplate.h:230
Definition: ItemTemplate.h:369
Definition: ItemTemplate.h:647
uint32 GetSubClass() const
Definition: ItemTemplate.h:654
Definition: ItemTemplate.h:442
Definition: SharedDefines.h:325
Definition: ItemTemplate.h:371
bool HasStats() const
Definition: Item.cpp:1387
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547
uint32 GetQuality() const
Definition: ItemTemplate.h:655

+ Here is the call graph for this function: