TrinityCore
Loading...
Searching...
No Matches
Bag Class Reference

#include <Bag.h>

+ Inheritance diagram for Bag:

Public Member Functions

 Bag ()
 
 ~Bag ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool Create (ObjectGuid::LowType guidlow, uint32 itemid, Player const *owner) override
 
void StoreItem (uint8 slot, Item *pItem, bool update)
 
void RemoveItem (uint8 slot, bool update)
 
ItemGetItemByPos (uint8 slot) const
 
uint32 GetItemCount (uint32 item, Item *eItem=nullptr) const
 
uint32 GetItemCountWithLimitCategory (uint32 limitCategory, Item *skipItem=nullptr) const
 
uint8 GetSlotByItemGUID (ObjectGuid guid) const
 
bool IsEmpty () const
 
uint32 GetFreeSlots () const
 
uint32 GetBagSize () const
 
void SaveToDB (CharacterDatabaseTransaction trans) override
 
bool LoadFromDB (ObjectGuid::LowType guid, ObjectGuid owner_guid, Field *fields, uint32 entry) override
 
void DeleteFromDB (CharacterDatabaseTransaction trans) override
 
void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const override
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Item
ItemCloneItem (uint32 count, Player const *player=nullptr) const
 
 Item ()
 
ItemTemplate const * GetTemplate () const
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid guid)
 
PlayerGetOwner () const
 
void SetBinding (bool val)
 
bool IsSoulBound () const
 
bool IsBoundAccountWide () const
 
bool IsBindedNotWith (Player const *player) const
 
bool IsBoundByEnchant () const
 
void DeleteFromInventoryDB (CharacterDatabaseTransaction trans)
 
void SaveRefundDataToDB ()
 
void DeleteRefundDataFromDB (CharacterDatabaseTransaction *trans)
 
BagToBag ()
 
Bag const * ToBag () const
 
bool IsRefundable () const
 
bool IsBOPTradeable () const
 
bool IsWrapped () 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
 
uint32 CalculateDurabilityRepairCost (float discount) const
 
bool HasEnchantRequiredSkill (Player const *player) const
 
uint32 GetEnchantRequiredLevel () const
 
bool IsFitToSpellRequirements (SpellInfo const *spellInfo) const
 
bool IsLimitedToAnotherMapOrZone (uint32 cur_mapId, uint32 cur_zoneId) const
 
bool GemsFitSockets () const
 
uint32 GetCount () const
 
void SetCount (uint32 value)
 
uint32 GetMaxStackCount () const
 
uint8 GetGemCountWithID (uint32 GemID) const
 
uint8 GetGemCountWithLimitCategory (uint32 limitCategory) const
 
InventoryResult CanBeMergedPartlyWith (ItemTemplate const *proto) const
 
uint8 GetSlot () const
 
BagGetContainer ()
 
uint8 GetBagSlot () const
 
void SetSlot (uint8 slot)
 
uint16 GetPos () const
 
void SetContainer (Bag *container)
 
bool IsInBag () const
 
bool IsEquipped () const
 
uint32 GetSkill ()
 
uint32 GetSpell ()
 
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 const & GetText () 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=nullptr)
 
bool IsInUpdateQueue () const
 
uint16 GetQueuePos () const
 
void FSetState (ItemUpdateState state)
 
bool hasQuest (uint32 quest_id) const override
 
bool hasInvolvedQuest (uint32) const override
 
bool IsPotion () const
 
bool IsWeaponVellum () const
 
bool IsArmorVellum () const
 
bool IsConjuredConsumable () const
 
void SetNotRefundable (Player *owner, bool changestate=true, CharacterDatabaseTransaction *trans=nullptr)
 
void SetRefundRecipient (ObjectGuid const &guid)
 
void SetPaidMoney (uint32 money)
 
void SetPaidExtendedCost (uint32 iece)
 
ObjectGuid const & GetRefundRecipient () 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
 
bool AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
uint32 GetScriptId () const
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player const *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) 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 GetGuidValue (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 SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (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 ApplyModByteFlag (uint16 index, uint8 offset, uint8 flag, bool apply)
 
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)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
void SetIsNewObject (bool enable)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsWorldObject () const
 
WorldObjectToWorldObject ()
 
WorldObject const * ToWorldObject () const
 
bool IsItem () const
 
ItemToItem ()
 
Item const * ToItem () const
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
Trinity::unique_weak_ptr< ObjectGetWeakPtr () const
 

Protected Attributes

Itemm_bagslot [MAX_BAG_SIZE]
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union { 
 
   int32 *   m_int32Values 
 
   uint32 *   m_uint32Values 
 
   float *   m_floatValues 
 
};  
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Additional Inherited Members

- Static Public Member Functions inherited from Item
static ItemCreateItem (uint32 itemEntry, uint32 count, Player const *player=nullptr)
 
static void DeleteFromDB (CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
 
static void DeleteFromInventoryDB (CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
static WorldObjectToWorldObject (Object *o)
 
static WorldObject const * ToWorldObject (Object const *o)
 
static ItemToItem (Object *o)
 
static Item const * ToItem (Object const *o)
 
static PlayerToPlayer (Object *o)
 
static Player const * ToPlayer (Object const *o)
 
static CreatureToCreature (Object *o)
 
static Creature const * ToCreature (Object const *o)
 
static UnitToUnit (Object *o)
 
static Unit const * ToUnit (Object const *o)
 
static GameObjectToGameObject (Object *o)
 
static GameObject const * ToGameObject (Object const *o)
 
static CorpseToCorpse (Object *o)
 
static Corpse const * ToCorpse (Object const *o)
 
static DynamicObjectToDynObject (Object *o)
 
static DynamicObject const * ToDynObject (Object const *o)
 
- Public Attributes inherited from Item
Loot loot
 
bool m_lootGenerated
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player const *target) const
 
void AddToObjectUpdateIfNeeded ()
 

Detailed Description

Definition at line 26 of file Bag.h.

Constructor & Destructor Documentation

◆ Bag()

Bag::Bag ( )

Definition at line 27 of file Bag.cpp.

◆ ~Bag()

Bag::~Bag ( )

Definition at line 37 of file Bag.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ AddToWorld()

void Bag::AddToWorld ( )
overridevirtual

Reimplemented from Object.

Definition at line 53 of file Bag.cpp.

+ Here is the call graph for this function:

◆ BuildCreateUpdateBlockForPlayer()

void Bag::BuildCreateUpdateBlockForPlayer ( UpdateData data,
Player target 
) const
overridevirtual

Reimplemented from Object.

Definition at line 174 of file Bag.cpp.

+ Here is the call graph for this function:

◆ Create()

bool Bag::Create ( ObjectGuid::LowType  guidlow,
uint32  itemid,
Player const *  owner 
)
overridevirtual

Reimplemented from Item.

Definition at line 71 of file Bag.cpp.

+ Here is the call graph for this function:

◆ DeleteFromDB()

void Bag::DeleteFromDB ( CharacterDatabaseTransaction  trans)
overridevirtual

Reimplemented from Item.

Definition at line 129 of file Bag.cpp.

+ Here is the call graph for this function:

◆ GetBagSize()

uint32 Bag::GetBagSize ( ) const
inline

Definition at line 47 of file Bag.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDebugInfo()

std::string Bag::GetDebugInfo ( ) const
overridevirtual

Reimplemented from Object.

Definition at line 248 of file Bag.cpp.

+ Here is the call graph for this function:

◆ GetFreeSlots()

uint32 Bag::GetFreeSlots ( ) const

Definition at line 138 of file Bag.cpp.

+ Here is the call graph for this function:

◆ GetItemByPos()

Item * Bag::GetItemByPos ( uint8  slot) const

Definition at line 240 of file Bag.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetItemCount()

uint32 Bag::GetItemCount ( uint32  item,
Item eItem = nullptr 
) const

Definition at line 193 of file Bag.cpp.

+ Here is the call graph for this function:

◆ GetItemCountWithLimitCategory()

uint32 Bag::GetItemCountWithLimitCategory ( uint32  limitCategory,
Item skipItem = nullptr 
) const

Definition at line 217 of file Bag.cpp.

+ Here is the call graph for this function:

◆ GetSlotByItemGUID()

uint8 Bag::GetSlotByItemGUID ( ObjectGuid  guid) const

Definition at line 230 of file Bag.cpp.

+ Here is the call graph for this function:

◆ IsEmpty()

bool Bag::IsEmpty ( ) const

Definition at line 184 of file Bag.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadFromDB()

bool Bag::LoadFromDB ( ObjectGuid::LowType  guid,
ObjectGuid  owner_guid,
Field fields,
uint32  entry 
)
overridevirtual

Reimplemented from Item.

Definition at line 111 of file Bag.cpp.

+ Here is the call graph for this function:

◆ RemoveFromWorld()

void Bag::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

Definition at line 62 of file Bag.cpp.

+ Here is the call graph for this function:

◆ RemoveItem()

void Bag::RemoveItem ( uint8  slot,
bool  update 
)

Definition at line 148 of file Bag.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SaveToDB()

void Bag::SaveToDB ( CharacterDatabaseTransaction  trans)
overridevirtual

Reimplemented from Item.

Definition at line 106 of file Bag.cpp.

+ Here is the call graph for this function:

◆ StoreItem()

void Bag::StoreItem ( uint8  slot,
Item pItem,
bool  update 
)

Definition at line 159 of file Bag.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bagslot

Item* Bag::m_bagslot[MAX_BAG_SIZE]
protected

Definition at line 64 of file Bag.h.


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