19 #ifndef TRINITYCORE_ITEM_H
20 #define TRINITYCORE_ITEM_H
193 #define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment)
195 #define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected
204 #define MAX_ENCHANTMENT_OFFSET 3
236 #define MAX_ITEM_SPELLS 5
280 bool IsBindedNotWith(
Player const* player)
const;
281 bool IsBoundByEnchant()
const;
285 void AddBonuses(
uint32 bonusListID);
292 void ItemContainerSaveLootToDB();
293 bool ItemContainerLoadLootFromDB();
294 void ItemContainerDeleteLootItemsFromDB();
295 void ItemContainerDeleteLootItemFromDB(
uint32 itemID);
296 void ItemContainerDeleteLootMoneyFromDB();
297 void ItemContainerDeleteLootMoneyAndLootItemsFromDB();
300 void SaveRefundDataToDB();
304 const Bag*
ToBag()
const {
if (IsBag())
return reinterpret_cast<const Bag*
>(
this);
else return NULL; }
309 bool IsNotEmptyBag()
const;
311 bool CanBeTraded(
bool mail =
false,
bool trade =
false)
const;
315 bool HasEnchantRequiredSkill(
const Player* player)
const;
316 uint32 GetEnchantRequiredLevel()
const;
318 bool IsFitToSpellRequirements(
SpellInfo const* spellInfo)
const;
319 bool IsLimitedToAnotherMapOrZone(
uint32 cur_mapId,
uint32 cur_zoneId)
const;
320 bool GemsFitSockets()
const;
326 uint8 GetGemCountWithLimitCategory(
uint32 limitCategory)
const;
331 uint8 GetBagSlot()
const;
337 bool IsEquipped()
const;
344 void SetItemRandomProperties(
int32 randomPropId);
345 void UpdateItemSuffixFactor();
346 static int32 GenerateItemRandomPropertyId(
uint32 item_id);
355 std::string
const&
GetText()
const {
return m_text; }
356 void SetText(std::string
const& text) { m_text = text; }
358 void SendUpdateSockets();
360 void SendTimeUpdate(
Player* owner);
373 void AddToUpdateQueueOf(
Player* player);
374 void RemoveFromUpdateQueueOf(
Player* player);
396 void GetDamage(
Player const* owner,
float& minDamage,
float& maxDamage)
const { GetTemplate()->
GetDamage(GetItemLevel(owner), minDamage, maxDamage); }
397 uint32 GetDisplayId()
const;
411 void UpdatePlayedTime(
Player* owner);
413 bool IsRefundExpired();
416 void SetSoulboundTradeable(
GuidSet const& allowedLooters);
417 void ClearSoulboundTradeable(
Player* currentOwner);
418 bool CheckSoulboundTradeExpire();
427 bool IsValidTransmogrificationTarget()
const;
429 bool HasStats()
const;
435 uint32 GetVisibleEntry()
const;
436 uint32 GetVisibleAppearanceModId()
const;
bool IsVellum() const
Definition: Item.h:385
uint32 GetCount() const
Definition: Item.h:322
uint32 Quality
Definition: Item.h:242
uint32 GetQuality() const
Definition: Item.h:388
int32 GetSpellCharges(uint8 index=0) const
Definition: Item.h:364
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: ItemTemplate.h:135
SellResult
Definition: Item.h:161
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: ByteBuffer.h:70
bool mb_in_trade
Definition: Item.h:452
void SetContainer(Bag *container)
Definition: Item.h:334
void SetBinding(bool val)
Definition: Item.h:276
uint32 GetPaidExtendedCost() const
Definition: Item.h:409
bool IsConjuredConsumable() const
Definition: Item.h:386
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:1941
ObjectGuid m_refundRecipient
Definition: Item.h:454
uint32 GetAppearanceModId() const
Definition: Item.h:394
int32 ItemStatAllocation[MAX_ITEM_PROTO_STATS]
Definition: Item.h:247
uint32 GetItemSuffixFactor() const
Definition: Item.h:343
Definition: SpellInfo.h:326
bool IsSoulBound() const
Definition: Item.h:277
Bag * GetContainer()
Definition: Item.h:330
EnchantmentOffset
Definition: Item.h:197
uint32 GetMaxStackCount() const
Definition: Item.h:324
virtual void BuildUpdate(UpdateDataMapType &)
Definition: Object.h:182
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]
Definition: Item.h:248
void FSetState(ItemUpdateState state)
Definition: Item.h:377
BuyResult
Definition: Item.h:148
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:983
Class used to access individual fields of database query result.
Definition: Field.h:56
EnchantmentSlot
Definition: Item.h:172
bool IsPotion() const
Definition: ItemTemplate.h:750
void LoadFromDB()
Definition: AddonMgr.cpp:40
float GetRepairCostMultiplier() const
Definition: Item.h:398
Definition: UpdateFields.h:49
Definition: UpdateFields.h:53
bool IsLocked() const
Definition: Item.h:306
ItemUpdateState GetState() const
Definition: Item.h:371
void SetInTrade(bool b=true)
Definition: Item.h:312
bool m_lootGenerated
Definition: Item.h:368
time_t m_lastPlayedTimeUpdate
Definition: Item.h:453
Definition: ItemTemplate.h:226
uint32 GetSpecialPrice(uint32 minimumPrice=10000) const
Definition: Item.h:433
uint16 GetPos() const
Definition: Item.h:333
uint32 EquippedItemCount
Definition: Item.h:42
arena_t NULL
Definition: jemalloc_internal.h:624
void AddBonus(uint32 type, int32 const (&values)[2])
Definition: Item.cpp:1981
virtual void BuildDynamicValuesUpdate(uint8 updatetype, ByteBuffer *data, Player *target) const
Definition: Object.cpp:777
bool IsBattlenetAccountBound() const
Definition: Item.h:279
Definition: UpdateFields.h:42
int32 RequiredLevel
Definition: Item.h:244
uint32 m_paidExtendedCost
Definition: Item.h:456
float RepairCostMultiplier
Definition: Item.h:251
uint16 GetQueuePos() const
Definition: Item.h:376
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
int32 ItemStatType[MAX_ITEM_PROTO_STATS]
Definition: Item.h:245
Bag * m_container
Definition: Item.h:449
void GetDamage(uint32 itemLevel, float &minDamage, float &maxDamage) const
Definition: ItemTemplate.cpp:74
ItemModifier
Definition: Item.h:222
bool IsBag() const
Definition: Item.h:307
int32 GetItemRandomPropertyId() const
Definition: Item.h:342
uint64 LowType
Definition: ObjectGuid.h:199
uint16_t uint16
Definition: g3dmath.h:166
SocketColor GetSocketColor(uint32 index) const
Definition: Item.h:393
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:352
bool IsVellum() const
Definition: ItemTemplate.h:751
static uint32 GetSpecialPrice(ItemTemplate const *proto, uint32 minimumPrice=10000)
Definition: Item.cpp:1661
SocketColor
Definition: ItemTemplate.h:318
ItemUpdateState uState
Definition: Item.h:450
InventoryType GetInventoryType() const
Definition: ItemTemplate.h:664
virtual void RemoveFromObjectUpdate()=0
uint32 ItemSetID
Definition: Item.h:41
std::string const & GetText() const
Definition: Item.h:355
bool IsBoundAccountWide() const
Definition: Item.h:278
bool ItemCanGoIntoBag(ItemTemplate const *proto, ItemTemplate const *pBagProto)
Definition: Item.cpp:157
bool IsPotion() const
Definition: Item.h:384
std::unordered_map< Player *, UpdateData > UpdateDataMapType
Definition: Object.h:91
std::string m_text
Definition: Item.h:447
const Bag * ToBag() const
Definition: Item.h:304
#define MAX_ITEM_PROTO_STATS
Definition: DB2Structure.h:790
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:294
bool IsCurrencyToken() const
Definition: Item.h:308
void SetSlot(uint8 slot)
Definition: Item.h:332
Definition: LootMgr.h:314
uint32 GetPaidMoney() const
Definition: Item.h:408
void SetRefundRecipient(ObjectGuid const &guid)
Definition: Item.h:403
uint32 GetScalingStatDistribution() const
Definition: Item.h:399
#define MAX_ENCHANTMENT_OFFSET
Definition: Item.h:204
Definition: UpdateFields.h:51
ObjectGuid const & GetRefundRecipient() const
Definition: Item.h:407
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.h:440
int32_t int32
Definition: Define.h:146
bool hasQuest(uint32 quest_id) const override
Definition: Item.h:382
void SetPaidExtendedCost(uint32 iece)
Definition: Item.h:405
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
uint16_t uint16
Definition: Define.h:151
Definition: ItemTemplate.h:200
uint32 GetArmor(Player const *owner) const
Definition: Item.h:395
uint32 GetStartQuest() const
Definition: ItemTemplate.h:686
BonusData _bonusData
Definition: Item.h:444
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:745
Definition: ItemTemplate.h:350
Definition: UpdateFields.h:46
uint32 m_paidMoney
Definition: Item.h:455
bool IsConjuredConsumable() const
Definition: ItemTemplate.h:752
Bag * ToBag()
Definition: Item.h:303
uint8 m_slot
Definition: Item.h:448
int16 uQueuePos
Definition: Item.h:451
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272
uint8 GetSlot() const
Definition: Item.h:329
Definition: BattlegroundMgr.h:57
void SetSpellCharges(uint8 index, int32 value)
Definition: Item.h:365
bool IsCurrencyToken() const
Definition: ItemTemplate.h:743
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
Definition: Object.cpp:1247
BonusData const * GetBonus() const
Definition: Item.h:270
bool IsBroken() const
Definition: Item.h:310
uint32 GetScriptId() const
Definition: Item.h:425
bool IsInTrade() const
Definition: Item.h:313
uint32 AppearanceModID
Definition: Item.h:250
int32 ItemLevel
Definition: Item.h:243
ItemUpdateState
Definition: Item.h:214
Definition: ItemTemplate.h:647
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:353
bool IsRangedWeapon() const
Definition: Item.h:387
#define MAX_ITEM_PROTO_SOCKETS
Definition: DB2Structure.h:789
int32 GetItemStatType(uint32 index) const
Definition: Item.h:391
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:332
#define TC_GAME_API
Definition: Define.h:134
void GetDamage(Player const *owner, float &minDamage, float &maxDamage) const
Definition: Item.h:396
uint32 ScalingStatDistribution
Definition: Item.h:252
int32 ItemStatValue[MAX_ITEM_PROTO_STATS]
Definition: Item.h:246
uint8_t uint8
Definition: Define.h:152
void SetOwnerGUID(ObjectGuid guid)
Definition: Item.h:273
bool IsRangedWeapon() const
Definition: ItemTemplate.h:754
int32 GetRequiredLevel() const
Definition: Item.h:390
#define ASSERT
Definition: Errors.h:55
EnchantmentSlotMask
Definition: Item.h:206
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: ItemPackets.h:40
int16_t int16
Definition: Define.h:147
Definition: ObjectGuid.h:189
Definition: UpdateFields.h:48
bool IsInBag() const
Definition: Item.h:336
bool hasInvolvedQuest(uint32) const override
Definition: Item.h:383
InventoryResult
Definition: Item.h:46
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
bool IsInUpdateQueue() const
Definition: Item.h:375
Definition: UpdateFields.h:54
std::unordered_set< ItemSetSpellEntry const * > SetBonuses
Definition: Item.h:43
virtual void AddToObjectUpdate()=0
uint32 ScriptId
Definition: ItemTemplate.h:710
Definition: UpdateFields.h:52
void SetPaidMoney(uint32 money)
Definition: Item.h:404
Loot loot
Definition: Item.h:367
Definition: UpdateFields.h:50
uint32 GetArmor(uint32 itemLevel) const
Definition: ItemTemplate.cpp:38
void SetText(std::string const &text)
Definition: Item.h:356
Definition: ItemTemplate.h:137
GuidSet allowedGUIDs
Definition: Item.h:457
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:351