18#ifndef TRINITYCORE_ITEM_H
19#define TRINITYCORE_ITEM_H
40#define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS
49#define MAX_ENCHANTMENT_OFFSET 3
98 bool IsBindedNotWith(
Player const* player)
const;
99 bool IsBoundByEnchant()
const;
107 void SaveRefundDataToDB();
110 Bag*
ToBag() {
if (IsBag())
return reinterpret_cast<Bag*
>(
this);
else return nullptr; }
111 Bag const*
ToBag()
const {
if (IsBag())
return reinterpret_cast<Bag const*
>(
this);
else return nullptr; }
119 bool IsNotEmptyBag()
const;
123 bool CanBeTraded(
bool mail =
false,
bool trade =
false)
const;
127 uint32 CalculateDurabilityRepairCost(
float discount,
bool useRateConfig =
true)
const;
129 bool HasEnchantRequiredSkill(
Player const* player)
const;
130 uint32 GetEnchantRequiredLevel()
const;
132 bool IsFitToSpellRequirements(
SpellInfo const* spellInfo)
const;
133 bool IsLimitedToAnotherMapOrZone(
uint32 cur_mapId,
uint32 cur_zoneId)
const;
134 bool GemsFitSockets()
const;
137 void SetCount(
uint32 value);
140 uint8 GetGemCountWithLimitCategory(
uint32 limitCategory)
const;
145 uint8 GetBagSlot()
const;
150 bool IsInBag()
const {
return m_container !=
nullptr; }
151 bool IsEquipped()
const;
159 void SetItemRandomProperties(
int32 randomPropId);
160 void UpdateItemSuffixFactor();
169 std::string
const&
GetText()
const {
return m_text; }
170 void SetText(std::string
const& text) { m_text = text; }
172 void SendUpdateSockets();
174 void SendTimeUpdate(
Player* owner);
214 void UpdatePlayedTime(
Player* owner);
216 bool IsRefundExpired();
219 void SetSoulboundTradeable(
GuidSet const& allowedLooters);
220 void ClearSoulboundTradeable(
Player* currentOwner);
221 bool CheckSoulboundTradeExpire();
230 uint32 GetBuyPrice()
const;
232 uint32 GetSellPrice(
bool forVendor =
false)
const;
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
@ ITEM_FIELD_FLAG_REFUNDABLE
@ ITEM_FIELD_FLAG_UNLOCKED
@ ITEM_FIELD_FLAG_SOULBOUND
@ ITEM_FIELD_FLAG_WRAPPED
@ ITEM_FIELD_FLAG_BOP_TRADEABLE
@ ITEM_FLAG_IS_BOUND_TO_ACCOUNT
void RemoveItemFromUpdateQueueOf(Item *item, Player *player)
void AddItemToUpdateQueueOf(Item *item, Player *player)
#define MAX_ENCHANTMENT_OFFSET
@ ENCHANTMENT_CHARGES_OFFSET
@ ENCHANTMENT_DURATION_OFFSET
bool ItemCanGoIntoBag(ItemTemplate const *proto, ItemTemplate const *pBagProto)
std::set< ObjectGuid > GuidSet
std::unordered_map< Player *, UpdateData > UpdateDataMapType
static void SaveToDB(QuestPool const &pool, CharacterDatabaseTransaction trans)
@ ITEM_FIELD_MAXDURABILITY
@ ITEM_FIELD_RANDOM_PROPERTIES_ID
@ ITEM_FIELD_PROPERTY_SEED
@ ITEM_FIELD_ENCHANTMENT_1_1
@ ITEM_FIELD_CREATE_PLAYED_TIME
@ ITEM_FIELD_SPELL_CHARGES
Class used to access individual fields of database query result.
uint32 GetPaidExtendedCost() const
bool hasInvolvedQuest(uint32) const override
std::string const & GetText() const
void SetItemFlag(ItemFieldFlags flags)
bool IsCurrencyToken() const
uint32 GetScriptId() const
void SetSpellCharges(uint8 index, int32 value)
void SetText(std::string const &text)
void SetPetitionId(uint32 petitionId)
void ReplaceAllItemFlags(ItemFieldFlags flags)
void RemoveItemFlag(ItemFieldFlags flags)
ObjectGuid GetContainedIn() const
void SetBinding(bool val)
uint32 GetEnchantmentId(EnchantmentSlot slot) const
int32 GetSpellCharges(uint8 index=0) const
void SetPaidMoney(uint32 money)
bool IsBoundAccountWide() const
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
void SetDurability(uint32 durability)
int32 GetItemRandomPropertyId() const
ObjectGuid GetCreator() const
bool IsBOPTradeable() const
ItemUpdateState GetState() const
uint32 GetItemSuffixFactor() const
bool HasItemFlag(ItemFieldFlags flag) const
bool IsWeaponVellum() const
uint16 GetQueuePos() const
bool IsArmorVellum() const
uint32 GetItemLevel() const
ObjectGuid GetOwnerGUID() const
Bag const * ToBag() const
uint32 GetDisplayId() const
time_t m_lastPlayedTimeUpdate
bool IsRefundable() const
ObjectGuid m_refundRecipient
void SetContainedIn(ObjectGuid guid)
ObjectGuid GetGiftCreator() const
void SetPetitionNumSignatures(uint32 signatures)
void FSetState(ItemUpdateState state)
void SetMaxDurability(uint32 maxDurability)
uint32 m_paidExtendedCost
void SetCreator(ObjectGuid guid)
ObjectGuid const & GetRefundRecipient() const
void SetCreatePlayedTime(uint32 createPlayedTime)
void SetPaidExtendedCost(uint32 iece)
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
void SetRefundRecipient(ObjectGuid const &guid)
uint32 GetPaidMoney() const
void SetExpiration(uint32 expiration)
void SetOwnerGUID(ObjectGuid guid)
void SetContainer(Bag *container)
bool hasQuest(uint32 quest_id) const override
uint32 GetMaxStackCount() const
void SetGiftCreator(ObjectGuid guid)
bool IsConjuredConsumable() const
bool IsInUpdateQueue() const
void SetInTrade(bool b=true)
static ObjectGuid const Empty
int32 GetInt32Value(uint16 index) const
void SetInt32Value(uint16 index, int32 value)
uint32 GetUInt32Value(uint16 index) const
virtual std::string const & GetNameForLocaleIdx(LocaleConstant) const =0
virtual bool AddToObjectUpdate()=0
void SetFlag(uint16 index, uint32 newFlag)
void RemoveFlag(uint16 index, uint32 oldFlag)
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
void SetGuidValue(uint16 index, ObjectGuid value)
virtual std::string GetDebugInfo() const
virtual void BuildUpdate(UpdateDataMapType &)
virtual void RemoveFromObjectUpdate()=0
bool HasFlag(uint16 index, uint32 flag) const
void SetUInt32Value(uint16 index, uint32 value)
ObjectGuid GetGuidValue(uint16 index) const
SpellInfo const * spells[8]
uint32 GetBaseItemLevel() const
uint32 GetMaxStackSize() const
bool IsCurrencyToken() const
uint32 GetStartQuest() const
bool IsArmorVellum() const
uint32 GetDisplayId() const
bool IsConjuredConsumable() const
bool HasFlag(ItemFlags flag) const
::InventoryType GetInventoryType() const
bool IsWeaponVellum() const