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:

+ Here is the caller graph for this function:

bool Item::IsVellum ( ) const
inline
385 { return GetTemplate()->IsVellum(); }
bool IsVellum() const
Definition: ItemTemplate.h:751
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::ItemContainerDeleteLootItemFromDB ( uint32  itemID)
1848 {
1849  // Deletes a single item associated with an openable item from the DB
1851  stmt->setUInt64(0, GetGUID().GetCounter());
1852  stmt->setUInt32(1, itemID);
1853  CharacterDatabase.Execute(stmt);
1854 }
Definition: CharacterDatabase.h:565
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
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:

void Item::ItemContainerDeleteLootItemsFromDB ( )
1840 {
1841  // Deletes items associated with an openable item from the DB
1843  stmt->setUInt64(0, GetGUID().GetCounter());
1844  CharacterDatabase.Execute(stmt);
1845 }
Definition: CharacterDatabase.h:564
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
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::ItemContainerDeleteLootMoneyAndLootItemsFromDB ( )
1865 {
1866  // Deletes money and items associated with an openable item from the DB
1869 }
void ItemContainerDeleteLootMoneyFromDB()
Definition: Item.cpp:1856
void ItemContainerDeleteLootItemsFromDB()
Definition: Item.cpp:1839

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::ItemContainerDeleteLootMoneyFromDB ( )
1857 {
1858  // Deletes the money loot associated with an openable item from the DB
1860  stmt->setUInt64(0, GetGUID().GetCounter());
1861  CharacterDatabase.Execute(stmt);
1862 }
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: CharacterDatabase.h:568
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:

bool Item::ItemContainerLoadLootFromDB ( )
1763 {
1764  // Loads the money and item loot associated with an openable item from the DB
1765  // Default. If there are no records for this item then it will be rolled for in Player::SendLoot()
1766  m_lootGenerated = false;
1767 
1768  // Save this for later use
1769  loot.containerID = GetGUID();
1770 
1771  // First, see if there was any money loot. This gets added directly to the container.
1773  stmt->setUInt64(0, loot.containerID.GetCounter());
1774  PreparedQueryResult money_result = CharacterDatabase.Query(stmt);
1775 
1776  if (money_result)
1777  {
1778  Field* fields = money_result->Fetch();
1779  loot.gold = fields[0].GetUInt32();
1780  }
1781 
1782  // Next, load any items that were saved
1784  stmt->setUInt64(0, loot.containerID.GetCounter());
1785  PreparedQueryResult item_result = CharacterDatabase.Query(stmt);
1786 
1787  if (item_result)
1788  {
1789  // Get a LootTemplate for the container item. This is where
1790  // the saved loot was originally rolled from, we will copy conditions from it
1792  if (lt)
1793  {
1794  do
1795  {
1796  // Create an empty LootItem
1797  LootItem loot_item = LootItem();
1798 
1799  // Fill in the rest of the LootItem from the DB
1800  Field* fields = item_result->Fetch();
1801 
1802  // item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
1803  loot_item.itemid = fields[0].GetUInt32();
1804  loot_item.count = fields[1].GetUInt32();
1805  loot_item.follow_loot_rules = fields[2].GetBool();
1806  loot_item.freeforall = fields[3].GetBool();
1807  loot_item.is_blocked = fields[4].GetBool();
1808  loot_item.is_counted = fields[5].GetBool();
1809  loot_item.canSave = true;
1810  loot_item.is_underthreshold = fields[6].GetBool();
1811  loot_item.needs_quest = fields[7].GetBool();
1812  loot_item.randomPropertyId = fields[8].GetInt32();
1813  loot_item.randomSuffix = fields[9].GetUInt32();
1814 
1815  // Copy the extra loot conditions from the item in the loot template
1816  lt->CopyConditions(&loot_item);
1817 
1818  // If container item is in a bag, add that player as an allowed looter
1819  if (GetBagSlot())
1820  loot_item.allowedGUIDs.insert(GetOwner()->GetGUID());
1821 
1822  // Finally add the LootItem to the container
1823  loot.items.push_back(loot_item);
1824 
1825  // Increment unlooted count
1826  loot.unlootedCount++;
1827 
1828  }
1829  while (item_result->NextRow());
1830  }
1831  }
1832 
1833  // Mark the item if it has loot so it won't be generated again on open
1835 
1836  return m_lootGenerated;
1837 }
bool follow_loot_rules
Definition: LootMgr.h:172
void CopyConditions(const ConditionContainer &conditions)
Definition: LootMgr.cpp:1268
bool is_counted
Definition: LootMgr.h:170
bool is_underthreshold
Definition: LootMgr.h:169
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
Definition: CharacterDatabase.h:567
bool freeforall
Definition: LootMgr.h:168
LootStore LootTemplates_Item("item_loot_template","item entry", true)
Class used to access individual fields of database query result.
Definition: Field.h:56
bool m_lootGenerated
Definition: Item.h:368
bool is_blocked
Definition: LootMgr.h:167
uint32 randomSuffix
Definition: LootMgr.h:160
Definition: PreparedStatement.h:74
LootTemplate const * GetLootFor(uint32 loot_id) const
Definition: LootMgr.cpp:227
int32 randomPropertyId
Definition: LootMgr.h:161
Definition: CharacterDatabase.h:563
GuidSet allowedGUIDs
Definition: LootMgr.h:164
uint8 unlootedCount
Definition: LootMgr.h:323
Player * GetOwner() const
Definition: Item.cpp:552
bool canSave
Definition: LootMgr.h:173
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
uint32 gold
Definition: LootMgr.h:322
Definition: LootMgr.h:157
bool needs_quest
Definition: LootMgr.h:171
int32 GetInt32() const
Definition: Field.h:165
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: LootMgr.h:250
std::vector< LootItem > items
Definition: LootMgr.h:320
bool isLooted() const
Definition: LootMgr.h:375
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
uint32 GetUInt32() const
Definition: Field.h:146
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32 GetEntry() const
Definition: Object.h:107
ObjectGuid containerID
Definition: LootMgr.h:330
uint8 count
Definition: LootMgr.h:165
bool GetBool() const
Definition: Field.h:65
uint8 GetBagSlot() const
Definition: Item.cpp:759
uint32 itemid
Definition: LootMgr.h:159
Loot loot
Definition: Item.h:367
LowType GetCounter() const
Definition: ObjectGuid.h:221

+ Here is the call graph for this function:

void Item::ItemContainerSaveLootToDB ( )
1696 {
1697  // Saves the money and item loot associated with an openable item to the DB
1698  if (loot.isLooted()) // no money and no loot
1699  return;
1700 
1702 
1703  loot.containerID = GetGUID(); // Save this for when a LootItem is removed
1704 
1705  // Save money
1706  if (loot.gold > 0)
1707  {
1709  stmt_money->setUInt64(0, loot.containerID.GetCounter());
1710  trans->Append(stmt_money);
1711 
1713  stmt_money->setUInt64(0, loot.containerID.GetCounter());
1714  stmt_money->setUInt32(1, loot.gold);
1715  trans->Append(stmt_money);
1716  }
1717 
1718  // Save items
1719  if (!loot.isLooted())
1720  {
1722  stmt_items->setUInt64(0, loot.containerID.GetCounter());
1723  trans->Append(stmt_items);
1724 
1725  // Now insert the items
1726  for (LootItemList::const_iterator _li = loot.items.begin(); _li != loot.items.end(); ++_li)
1727  {
1728  // When an item is looted, it doesn't get removed from the items collection
1729  // but we don't want to resave it.
1730  if (!_li->canSave)
1731  continue;
1732  // Conditions are not checked when loot is generated, it is checked when loot is sent to a player.
1733  // For items that are lootable, loot is saved to the DB immediately, that means that loot can be
1734  // saved to the DB that the player never should have gotten. This check prevents that, so that only
1735  // items that the player should get in loot are in the DB.
1736  // IE: Horde items are not saved to the DB for Ally players.
1737  Player* const guid = GetOwner();
1738  if (!_li->AllowedForPlayer(guid))
1739  continue;
1740 
1742 
1743  // container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
1744  stmt_items->setUInt64(0, loot.containerID.GetCounter());
1745  stmt_items->setUInt32(1, _li->itemid);
1746  stmt_items->setUInt32(2, _li->count);
1747  stmt_items->setBool(3, _li->follow_loot_rules);
1748  stmt_items->setBool(4, _li->freeforall);
1749  stmt_items->setBool(5, _li->is_blocked);
1750  stmt_items->setBool(6, _li->is_counted);
1751  stmt_items->setBool(7, _li->is_underthreshold);
1752  stmt_items->setBool(8, _li->needs_quest);
1753  stmt_items->setInt32(9, _li->randomPropertyId);
1754  stmt_items->setUInt32(10, _li->randomSuffix);
1755  trans->Append(stmt_items);
1756  }
1757  }
1758 
1760 }
Definition: CharacterDatabase.h:564
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
Definition: CharacterDatabase.h:568
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
void setBool(const uint8 index, const bool value)
Definition: PreparedStatement.cpp:88
Definition: CharacterDatabase.h:566
Player * GetOwner() const
Definition: Item.cpp:552
Definition: CharacterDatabase.h:569
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setInt32(const uint8 index, const int32 value)
Definition: PreparedStatement.cpp:151
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
uint32 gold
Definition: LootMgr.h:322
ObjectGuid const & GetGUID() const
Definition: Object.h:105
std::vector< LootItem > items
Definition: LootMgr.h:320
bool isLooted() const
Definition: LootMgr.h:375
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
ObjectGuid containerID
Definition: LootMgr.h:330
Loot loot
Definition: Item.h:367
LowType GetCounter() const
Definition: ObjectGuid.h:221
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

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

Reimplemented in Bag.

412 {
413  // 0 1 2 3 4 5 6 7 8 9 10 11 12
414  //result = CharacterDatabase.PQuery("SELECT guid, itemEntry, creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text,
415  // 13 14 15 16 17 18 19 20
416  // transmogrification, upgradeId, enchantIllusion, battlePetSpeciesId, battlePetBreedData, battlePetLevel, battlePetDisplayId, bonusListIDs FROM item_instance WHERE guid = '%u'", guid);
417 
418  // create item before any checks for store correct guid
419  // and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
420  Object::_Create(ObjectGuid::Create<HighGuid::Item>(guid));
421 
422  // Set entry, MUST be before proto check
423  SetEntry(entry);
424  SetObjectScale(1.0f);
425 
426  ItemTemplate const* proto = GetTemplate();
427  if (!proto)
428  return false;
429 
430  _bonusData.Initialize(proto);
431 
432  // set owner (not if item is only loaded for gbank/auction/mail
433  if (!ownerGuid.IsEmpty())
434  SetOwnerGUID(ownerGuid);
435 
436  bool need_save = false; // need explicit save data at load fixes
437  if (uint64 creator = fields[2].GetUInt64())
438  SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid::Create<HighGuid::Player>(creator));
439  if (uint64 giftCreator = fields[3].GetUInt64())
440  SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Create<HighGuid::Player>(giftCreator));
441  SetCount(fields[4].GetUInt32());
442 
443  uint32 duration = fields[5].GetUInt32();
445  // update duration if need, and remove if not need
446  if ((proto->GetDuration() == 0) != (duration == 0))
447  {
449  need_save = true;
450  }
451 
452  Tokenizer tokens(fields[6].GetString(), ' ', proto->Effects.size());
453  if (tokens.size() == proto->Effects.size())
454  for (uint8 i = 0; i < proto->Effects.size(); ++i)
455  SetSpellCharges(i, atoi(tokens[i]));
456 
457  SetUInt32Value(ITEM_FIELD_FLAGS, fields[7].GetUInt32());
458  // Remove bind flag for items vs NO_BIND set
459  if (IsSoulBound() && proto->GetBonding() == NO_BIND)
460  {
462  need_save = true;
463  }
464 
465  std::string enchants = fields[8].GetString();
467  SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[9].GetInt16());
468  // recalculate suffix factor
469  if (GetItemRandomPropertyId() < 0)
471 
472  uint32 durability = fields[10].GetUInt16();
474  // update max durability (and durability) if need
476  if (durability > proto->MaxDurability)
477  {
479  need_save = true;
480  }
481 
482  SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[11].GetUInt32());
483  SetText(fields[12].GetString());
484 
485  if (uint32 transmogEntry = fields[13].GetUInt32())
486  {
487  SetModifier(ITEM_MODIFIER_TRANSMOG_APPEARANCE_MOD, (transmogEntry >> 24) & 0xFF);
488  SetModifier(ITEM_MODIFIER_TRANSMOG_ITEM_ID, transmogEntry & 0xFFFFFF);
489  }
490  SetModifier(ITEM_MODIFIER_UPGRADE_ID, fields[14].GetUInt32());
491  SetModifier(ITEM_MODIFIER_ENCHANT_ILLUSION, fields[15].GetUInt32());
492  SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, fields[16].GetUInt32());
493  SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, fields[17].GetUInt32());
494  SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, fields[18].GetUInt16());
495  SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, fields[19].GetUInt32());
496 
497  Tokenizer bonusListIDs(fields[20].GetString(), ' ');
498  for (char const* token : bonusListIDs)
499  {
500  uint32 bonusListID = atoul(token);
501  AddBonuses(bonusListID);
502  }
503 
504  if (need_save) // normal item changed state set not work at loading
505  {
510  stmt->setUInt64(3, guid);
512  }
513 
514  return true;
515 }
Definition: UpdateFields.h:47
void Execute(const char *sql)
Definition: DatabaseWorkerPool.h:87
Definition: UpdateFields.h:44
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: ItemTemplate.h:135
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:1941
bool IsSoulBound() const
Definition: Item.h:277
Definition: Util.h:45
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:983
Definition: UpdateFields.h:49
Definition: UpdateFields.h:53
uint32 GetDuration() const
Definition: ItemTemplate.h:699
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void SetCount(uint32 value)
Definition: Item.cpp:794
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
void SetEntry(uint32 entry)
Definition: Object.h:108
Definition: Item.h:190
int32 GetItemRandomPropertyId() const
Definition: Item.h:342
Definition: PreparedStatement.h:74
void UpdateItemSuffixFactor()
Definition: Item.cpp:678
Definition: ItemTemplate.h:119
Definition: Item.h:225
std::vector< ItemEffectEntry const * > Effects
Definition: ItemTemplate.h:707
void AddBonuses(uint32 bonusListID)
Definition: Item.cpp:1931
unsigned long atoul(char const *str)
Definition: Common.h:90
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
BonusData _bonusData
Definition: Item.h:444
uint16 GetUInt16() const
Definition: Field.h:108
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: UpdateFields.h:55
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:1909
uint32 MaxDurability
Definition: ItemTemplate.h:706
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:365
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:1247
ItemBondingType GetBonding() const
Definition: ItemTemplate.h:683
Definition: Item.h:226
Definition: ItemTemplate.h:647
virtual void SetObjectScale(float scale)
Definition: Object.h:111
uint32 GetUInt32() const
Definition: Field.h:146
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
Definition: Item.h:229
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:273
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Item.h:231
Definition: UpdateFields.h:45
Definition: UpdateFields.h:54
void _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
Definition: Object.cpp:966
std::string GetString() const
Definition: Field.h:276
Definition: UpdateFields.h:52
Definition: UpdateFields.h:50
Definition: CharacterDatabase.h:144
bool IsEmpty() const
Definition: ObjectGuid.h:242
void SetText(std::string const &text)
Definition: Item.h:356
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::RemoveFromObjectUpdate ( )
overridevirtual

Implements Object.

1207 {
1208  if (Player* owner = GetOwner())
1209  owner->GetMap()->RemoveUpdateObject(this);
1210 }
Player * GetOwner() const
Definition: Item.cpp:552

+ Here is the call graph for this function:

void Item::RemoveFromUpdateQueueOf ( Player player)
739 {
740  if (!IsInUpdateQueue())
741  return;
742 
743  ASSERT(player != NULL);
744 
745  if (player->GetGUID() != GetOwnerGUID())
746  {
747  TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
748  GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
749  return;
750  }
751 
752  if (player->m_itemUpdateQueueBlocked)
753  return;
754 
755  player->m_itemUpdateQueue[uQueuePos] = NULL;
756  uQueuePos = -1;
757 }
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::SaveRefundDataToDB ( )
1213 {
1215 
1217  stmt->setUInt64(0, GetGUID().GetCounter());
1218  trans->Append(stmt);
1219 
1221  stmt->setUInt64(0, GetGUID().GetCounter());
1222  stmt->setUInt64(1, GetRefundRecipient().GetCounter());
1223  stmt->setUInt32(2, GetPaidMoney());
1224  stmt->setUInt16(3, uint16(GetPaidExtendedCost()));
1225  trans->Append(stmt);
1226 
1228 }
Definition: CharacterDatabase.h:414
uint32 GetPaidExtendedCost() const
Definition: Item.h:409
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
uint16_t uint16
Definition: g3dmath.h:166
Definition: PreparedStatement.h:74
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
uint32 GetPaidMoney() const
Definition: Item.h:408
ObjectGuid const & GetRefundRecipient() const
Definition: Item.h:407
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
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
Definition: CharacterDatabase.h:415
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void Item::SaveToDB ( SQLTransaction trans)
virtual

Reimplemented in Bag.

312 {
313  bool isInTransaction = bool(trans);
314  if (!isInTransaction)
316 
317  switch (uState)
318  {
319  case ITEM_NEW:
320  case ITEM_CHANGED:
321  {
322  uint8 index = 0;
324  stmt->setUInt32( index, GetEntry());
325  stmt->setUInt64(++index, GetOwnerGUID().GetCounter());
326  stmt->setUInt64(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter());
327  stmt->setUInt64(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter());
328  stmt->setUInt32(++index, GetCount());
330 
331  std::ostringstream ssSpells;
332  if (ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(GetEntry()))
333  for (uint8 i = 0; i < itemProto->Effects.size(); ++i)
334  ssSpells << GetSpellCharges(i) << ' ';
335  stmt->setString(++index, ssSpells.str());
336 
337  stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_FLAGS));
338 
339  std::ostringstream ssEnchants;
340  for (uint8 i = 0; i < MAX_ENCHANTMENT_SLOT; ++i)
341  {
342  ssEnchants << GetEnchantmentId(EnchantmentSlot(i)) << ' ';
343  ssEnchants << GetEnchantmentDuration(EnchantmentSlot(i)) << ' ';
344  ssEnchants << GetEnchantmentCharges(EnchantmentSlot(i)) << ' ';
345  }
346  stmt->setString(++index, ssEnchants.str());
347 
348  stmt->setInt16 (++index, GetItemRandomPropertyId());
351  stmt->setString(++index, m_text);
359 
360  std::ostringstream bonusListIDs;
362  bonusListIDs << bonusListID << ' ';
363  stmt->setString(++index, bonusListIDs.str());
364 
365  stmt->setUInt64(++index, GetGUID().GetCounter());
366 
367  trans->Append(stmt);
368 
370  {
372  stmt->setUInt64(0, GetOwnerGUID().GetCounter());
373  stmt->setUInt64(1, GetGUID().GetCounter());
374  trans->Append(stmt);
375  }
376  break;
377  }
378  case ITEM_REMOVED:
379  {
381  stmt->setUInt64(0, GetGUID().GetCounter());
382  trans->Append(stmt);
383 
385  {
387  stmt->setUInt64(0, GetGUID().GetCounter());
388  trans->Append(stmt);
389  }
390 
391  if (!isInTransaction)
393 
394  // Delete the items if this is a container
395  if (!loot.isLooted())
397 
398  delete this;
399  return;
400  }
401  case ITEM_UNCHANGED:
402  break;
403  }
404 
406 
407  if (!isInTransaction)
409 }
uint32 GetCount() const
Definition: Item.h:322
Definition: UpdateFields.h:47
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
Definition: UpdateFields.h:44
int32 GetSpellCharges(uint8 index=0) const
Definition: Item.h:364
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: ItemTemplate.h:138
EnchantmentSlot
Definition: Item.h:172
void setInt16(const uint8 index, const int16 value)
Definition: PreparedStatement.cpp:142
Definition: UpdateFields.h:49
Definition: UpdateFields.h:53
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: Item.h:190
int32 GetItemRandomPropertyId() const
Definition: Item.h:342
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:352
Definition: CharacterDatabase.h:142
#define bool
Definition: CascPort.h:16
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
ItemUpdateState uState
Definition: Item.h:450
std::vector< uint32 > const & GetDynamicValues(uint16 index) const
Definition: Object.cpp:1338
Definition: CharacterDatabase.h:145
Definition: Item.h:225
std::string m_text
Definition: Item.h:447
Definition: UpdateFields.h:64
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.h:440
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: UpdateFields.h:55
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272
Definition: Item.h:216
void ItemContainerDeleteLootMoneyAndLootItemsFromDB()
Definition: Item.cpp:1864
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Item.h:217
Definition: Item.h:226
Definition: ItemTemplate.h:647
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:353
bool isLooted() const
Definition: LootMgr.h:375
Definition: CharacterDatabase.h:148
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
uint8_t uint8
Definition: Define.h:152
Definition: Item.h:229
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
Definition: Item.h:219
uint32 GetEntry() const
Definition: Object.h:107
Definition: Item.h:231
Definition: UpdateFields.h:45
Definition: Item.h:218
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
Definition: CharacterDatabase.h:147
Loot loot
Definition: Item.h:367
Definition: CharacterDatabase.h:143
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::SendTimeUpdate ( Player owner)
1057 {
1059  if (!duration)
1060  return;
1061 
1062  WorldPackets::Item::ItemTimeUpdate itemTimeUpdate;
1063  itemTimeUpdate.ItemGuid = GetGUID();
1064  itemTimeUpdate.DurationLeft = duration;
1065  owner->GetSession()->SendPacket(itemTimeUpdate.Write());
1066 }
uint32 DurationLeft
Definition: ItemPackets.h:214
Definition: UpdateFields.h:47
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
uint32_t uint32
Definition: Define.h:150
Definition: ItemPackets.h:206
ObjectGuid const & GetGUID() const
Definition: Object.h:105
ObjectGuid ItemGuid
Definition: ItemPackets.h:213
WorldPacket const * Write() override
Definition: ItemPackets.cpp:150

+ Here is the call graph for this function:

void Item::SendUpdateSockets ( )
1042 {
1044  socketGems.Item = GetGUID();
1045  for (uint32 i = 0; i < MAX_GEM_SOCKETS; ++i)
1047 
1049 
1050  GetOwner()->GetSession()->SendPacket(socketGems.Write());
1051 }
Definition: ItemPackets.h:516
#define MAX_GEM_SOCKETS
Definition: Item.h:195
int32 Sockets[MAX_GEM_SOCKETS]
Definition: ItemPackets.h:524
EnchantmentSlot
Definition: Item.h:172
WorldPacket const * Write() override
Definition: ItemPackets.cpp:539
int32 SocketMatch
Definition: ItemPackets.h:525
Player * GetOwner() const
Definition: Item.cpp:552
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: Item.h:176
ObjectGuid const & GetGUID() const
Definition: Object.h:105
int32_t int32
Definition: g3dmath.h:167
ObjectGuid Item
Definition: ItemPackets.h:523
Definition: Item.h:179
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::SetBinding ( bool  val)
inline
Definition: ItemTemplate.h:135
Definition: UpdateFields.h:49
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:1247

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetContainer ( Bag container)
inline
334 { m_container = container; }
Bag * m_container
Definition: Item.h:449

+ Here is the caller graph for this function:

void Item::SetCount ( uint32  value)
795 {
797 
798  if (Player* player = GetOwner())
799  {
800  if (TradeData* tradeData = player->GetTradeData())
801  {
802  TradeSlots slot = tradeData->GetTradeSlotForItem(GetGUID());
803 
804  if (slot != TRADE_SLOT_INVALID)
805  tradeData->SetItem(slot, this, true);
806  }
807  }
808 }
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Player * GetOwner() const
Definition: Item.cpp:552
Definition: TradeData.h:34
TradeSlots
Definition: TradeData.h:23
Definition: UpdateFields.h:46
ObjectGuid const & GetGUID() const
Definition: Object.h:105
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: TradeData.h:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetEnchantment ( EnchantmentSlot  slot,
uint32  id,
uint32  duration,
uint32  charges,
ObjectGuid  caster = ObjectGuid::Empty 
)
906 {
907  // Better lost small time at check in comparison lost time at item save to DB.
908  if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
909  return;
910 
911  Player* owner = GetOwner();
913  {
914  if (uint32 oldEnchant = GetEnchantmentId(slot))
915  owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), ObjectGuid::Empty, GetEntry(), oldEnchant);
916 
917  if (id)
918  owner->GetSession()->SendEnchantmentLog(GetOwnerGUID(), caster, GetEntry(), id);
919  }
920 
924  SetState(ITEM_CHANGED, owner);
925 }
Definition: Item.h:199
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:352
Definition: Item.h:200
Player * GetOwner() const
Definition: Item.cpp:552
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
uint32_t uint32
Definition: Define.h:150
Definition: Item.h:201
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272
Definition: Item.h:217
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:353
uint32 GetEntry() const
Definition: Object.h:107
Definition: Item.h:183
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::SetEnchantmentCharges ( EnchantmentSlot  slot,
uint32  charges 
)
938 {
939  if (GetEnchantmentCharges(slot) == charges)
940  return;
941 
944 }
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
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:201
Definition: Item.h:217
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:353
Definition: UpdateFields.h:50

+ Here is the call graph for this function:

void Item::SetEnchantmentDuration ( EnchantmentSlot  slot,
uint32  duration,
Player owner 
)
928 {
929  if (GetEnchantmentDuration(slot) == duration)
930  return;
931 
933  SetState(ITEM_CHANGED, owner);
934  // Cannot use GetOwner() here, has to be passed as an argument to avoid freeze due to hashtable locking
935 }
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:352
Definition: Item.h:200
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
Definition: Item.h:217
Definition: UpdateFields.h:50

+ Here is the call graph for this function:

void Item::SetInTrade ( bool  b = true)
inline
312 { mb_in_trade = b; }
bool mb_in_trade
Definition: Item.h:452

+ Here is the caller graph for this function:

void Item::SetItemRandomProperties ( int32  randomPropId)
641 {
642  if (!randomPropId)
643  return;
644 
645  if (randomPropId > 0)
646  {
647  ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId);
648  if (item_rand)
649  {
651  {
654  }
656  SetEnchantment(EnchantmentSlot(i), item_rand->Enchantment[i - PROP_ENCHANTMENT_SLOT_1], 0, 0);
657  }
658  }
659  else
660  {
661  ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId);
662  if (item_rand)
663  {
664  if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) ||
666  {
670  }
671 
674  }
675  }
676 }
Definition: Item.h:185
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
uint32 ID
Definition: DB2Structure.h:773
uint32 ID
Definition: DB2Structure.h:781
uint32 GetItemSuffixFactor() const
Definition: Item.h:343
DB2Storage< ItemRandomSuffixEntry > sItemRandomSuffixStore("ItemRandomSuffix.db2", ItemRandomSuffixFormat, HOTFIX_SEL_ITEM_RANDOM_SUFFIX)
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:983
EnchantmentSlot
Definition: Item.h:172
void UpdateItemSuffixFactor()
Definition: Item.cpp:678
Definition: Item.h:189
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:294
Player * GetOwner() const
Definition: Item.cpp:552
uint32 Enchantment[MAX_ITEM_RANDOM_PROPERTIES]
Definition: DB2Structure.h:784
uint32_t uint32
Definition: Define.h:150
Definition: DB2Structure.h:779
Definition: Item.h:186
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster=ObjectGuid::Empty)
Definition: Item.cpp:905
Definition: Item.h:217
DB2Storage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore("ItemRandomProperties.db2", ItemRandomPropertiesFormat, HOTFIX_SEL_ITEM_RANDOM_PROPERTIES)
int32_t int32
Definition: g3dmath.h:167
uint32 Enchantment[MAX_ITEM_RANDOM_PROPERTIES]
Definition: DB2Structure.h:775
Definition: UpdateFields.h:52
Definition: DB2Structure.h:771

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetModifier ( ItemModifier  modifier,
uint32  value 
)
1910 {
1911  _modifiers[modifier] = value;
1912  ApplyModFlag(ITEM_FIELD_MODIFIERS_MASK, 1 << modifier, value != 0);
1913 }
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:1247
const FieldDescriptor value
Definition: descriptor.h:1522
uint32 _modifiers[MAX_ITEM_MODIFIERS]
Definition: Item.h:458
Definition: UpdateFields.h:56

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetNotRefundable ( Player owner,
bool  changestate = true,
SQLTransaction trans = NULL 
)
1242 {
1244  return;
1245 
1246  WorldPackets::Item::ItemExpirePurchaseRefund itemExpirePurchaseRefund;
1247  itemExpirePurchaseRefund.ItemGUID = GetGUID();
1248  owner->SendDirectMessage(itemExpirePurchaseRefund.Write());
1249 
1251  // Following is not applicable in the trading procedure
1252  if (changestate)
1253  SetState(ITEM_CHANGED, owner);
1254 
1256  SetPaidMoney(0);
1258  DeleteRefundDataFromDB(trans);
1259 
1260  owner->DeleteRefundReference(GetGUID());
1261 }
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: UpdateFields.h:49
ObjectGuid ItemGUID
Definition: ItemPackets.h:179
WorldPacket const * Write() override
Definition: ItemPackets.cpp:129
void DeleteRefundDataFromDB(SQLTransaction *trans)
Definition: Item.cpp:1230
void SetRefundRecipient(ObjectGuid const &guid)
Definition: Item.h:403
void SetPaidExtendedCost(uint32 iece)
Definition: Item.h:405
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Item.h:217
Definition: ItemTemplate.h:147
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
void SetPaidMoney(uint32 money)
Definition: Item.h:404

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetOwnerGUID ( ObjectGuid  guid)
inline
273 { SetGuidValue(ITEM_FIELD_OWNER, guid); }
Definition: UpdateFields.h:42
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetPaidExtendedCost ( uint32  iece)
inline
405 { m_paidExtendedCost = iece; }
uint32 m_paidExtendedCost
Definition: Item.h:456

+ Here is the caller graph for this function:

void Item::SetPaidMoney ( uint32  money)
inline
404 { m_paidMoney = money; }
uint32 m_paidMoney
Definition: Item.h:455

+ Here is the caller graph for this function:

void Item::SetRefundRecipient ( ObjectGuid const guid)
inline
403 { m_refundRecipient = guid; }
ObjectGuid m_refundRecipient
Definition: Item.h:454

+ Here is the caller graph for this function:

void Item::SetSlot ( uint8  slot)
inline
332 { m_slot = slot; }
uint8 m_slot
Definition: Item.h:448

+ Here is the caller graph for this function:

void Item::SetSoulboundTradeable ( GuidSet const allowedLooters)
1304 {
1306  allowedGUIDs = allowedLooters;
1307 }
Definition: UpdateFields.h:49
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
Definition: ItemTemplate.h:143
GuidSet allowedGUIDs
Definition: Item.h:457

+ Here is the call graph for this function:

void Item::SetSpellCharges ( uint8  index,
int32  value 
)
inline
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:983
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: UpdateFields.h:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetState ( ItemUpdateState  state,
Player forplayer = NULL 
)
687 {
688  if (uState == ITEM_NEW && state == ITEM_REMOVED)
689  {
690  // pretend the item never existed
691  if (forplayer)
692  {
693  RemoveFromUpdateQueueOf(forplayer);
694  forplayer->DeleteRefundReference(GetGUID());
695  }
696  delete this;
697  return;
698  }
699  if (state != ITEM_UNCHANGED)
700  {
701  // new items must stay in new state until saved
702  if (uState != ITEM_NEW)
703  uState = state;
704 
705  if (forplayer)
706  AddToUpdateQueueOf(forplayer);
707  }
708  else
709  {
710  // unset in queue
711  // the item must be removed from the queue manually
712  uQueuePos = -1;
714  }
715 }
void AddToUpdateQueueOf(Player *player)
Definition: Item.cpp:717
ItemUpdateState uState
Definition: Item.h:450
void RemoveFromUpdateQueueOf(Player *player)
Definition: Item.cpp:738
int16 uQueuePos
Definition: Item.h:451
Definition: Item.h:216
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Item.h:219
Definition: Item.h:218

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Item::SetText ( std::string const text)
inline
356 { m_text = text; }
std::string m_text
Definition: Item.h:447

+ Here is the caller graph for this function:

Bag* Item::ToBag ( )
inline
303 { if (IsBag()) return reinterpret_cast<Bag*>(this); else return NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsBag() const
Definition: Item.h:307
Definition: Bag.h:28

+ Here is the caller graph for this function:

const Bag* Item::ToBag ( ) const
inline
304 { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsBag() const
Definition: Item.h:307
Definition: Bag.h:28
void Item::UpdateDuration ( Player owner,
uint32  diff 
)
294 {
296  return;
297 
298  TC_LOG_DEBUG("entities.player.items", "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
299 
300  if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff)
301  {
302  sScriptMgr->OnItemExpire(owner, GetTemplate());
303  owner->DestroyItem(GetBagSlot(), GetSlot(), true);
304  return;
305  }
306 
308  SetState(ITEM_CHANGED, owner); // save new time in database
309 }
Definition: UpdateFields.h:47
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
uint8 GetSlot() const
Definition: Item.h:329
Definition: Item.h:217
#define sScriptMgr
Definition: ScriptMgr.h:837
uint32 GetEntry() const
Definition: Object.h:107
uint8 GetBagSlot() const
Definition: Item.cpp:759
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

void Item::UpdateItemSuffixFactor ( )
679 {
680  uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
681  if (GetItemSuffixFactor() == suffixFactor)
682  return;
684 }
TC_GAME_API uint32 GenerateEnchSuffixFactor(uint32 item_id)
Definition: ItemEnchantmentMgr.cpp:121
uint32 GetItemSuffixFactor() const
Definition: Item.h:343
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: UpdateFields.h:51
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:

void Item::UpdatePlayedTime ( Player owner)
1264 {
1265  /* Here we update our played time
1266  We simply add a number to the current played time,
1267  based on the time elapsed since the last update hereof.
1268  */
1269  // Get current played time
1271  // Calculate time elapsed since last played time update
1272  time_t curtime = time(NULL);
1273  uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
1274  uint32 new_playtime = current_playtime + elapsed;
1275  // Check if the refund timer has expired yet
1276  if (new_playtime <= 2*HOUR)
1277  {
1278  // No? Proceed.
1279  // Update the data field
1281  // Flag as changed to get saved to DB
1282  SetState(ITEM_CHANGED, owner);
1283  // Speaks for itself
1284  m_lastPlayedTimeUpdate = curtime;
1285  return;
1286  }
1287  // Yes
1288  SetNotRefundable(owner);
1289 }
void SetState(ItemUpdateState state, Player *forplayer=NULL)
Definition: Item.cpp:686
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: Common.h:98
time_t m_lastPlayedTimeUpdate
Definition: Item.h:453
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
uint32_t uint32
Definition: Define.h:150
Definition: UpdateFields.h:55
Definition: Item.h:217
void SetNotRefundable(Player *owner, bool changestate=true, SQLTransaction *trans=NULL)
Definition: Item.cpp:1241
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

Member Data Documentation

BonusData Item::_bonusData
protected
uint32 Item::_modifiers[MAX_ITEM_MODIFIERS]
private
GuidSet Item::allowedGUIDs
private
Loot Item::loot
Bag* Item::m_container
private
time_t Item::m_lastPlayedTimeUpdate
private
bool Item::m_lootGenerated
uint32 Item::m_paidExtendedCost
private
uint32 Item::m_paidMoney
private
ObjectGuid Item::m_refundRecipient
private
uint8 Item::m_slot
private
std::string Item::m_text
private
bool Item::mb_in_trade
private
int16 Item::uQueuePos
private
ItemUpdateState Item::uState
private

The documentation for this class was generated from the following files: