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

#include <Bag.h>

Public Member Functions

 Bag ()
 
 ~Bag ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool Create (ObjectGuid::LowType guidlow, uint32 itemid, Player const *owner) override
 
void Clear ()
 
void StoreItem (uint8 slot, Item *pItem, bool update)
 
void RemoveItem (uint8 slot, bool update)
 
ItemGetItemByPos (uint8 slot) const
 
uint32 GetItemCount (uint32 item, Item *eItem=NULL) const
 
uint32 GetItemCountWithLimitCategory (uint32 limitCategory, Item *skipItem=NULL) const
 
uint8 GetSlotByItemGUID (ObjectGuid guid) const
 
bool IsEmpty () const
 
uint32 GetFreeSlots () const
 
uint32 GetBagSize () const
 
void SaveToDB (SQLTransaction &trans) override
 
bool LoadFromDB (ObjectGuid::LowType guid, ObjectGuid owner_guid, Field *fields, uint32 entry) override
 
void DeleteFromDB (SQLTransaction &trans) override
 
void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const override
 
- Public Member Functions inherited from Item
ItemCloneItem (uint32 count, Player const *player=NULL) const
 
 Item ()
 
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
 
void AddBonuses (uint32 bonusListID)
 
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
 
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
 
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
 

Protected Attributes

Itemm_bagslot [MAX_BAG_SIZE]
 
- Protected Attributes inherited from Item
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
 

Additional Inherited Members

- Static Public Member Functions inherited from Item
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 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
 
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

Bag::Bag ( )
28  : Item()
29 {
32 
35 
36  memset(m_bagslot, 0, sizeof(Item*) * MAX_BAG_SIZE);
37 }
Definition: ObjectGuid.h:31
#define MAX_BAG_SIZE
Definition: Bag.h:23
uint16 _dynamicValuesCount
Definition: Object.h:246
Item()
Definition: Item.cpp:230
uint16 m_objectType
Definition: Object.h:227
TypeID m_objectTypeId
Definition: Object.h:229
Definition: Item.h:259
uint16 m_valuesCount
Definition: Object.h:245
Definition: UpdateFields.h:72
Definition: ObjectGuid.h:48
Definition: UpdateFields.h:77
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66
Bag::~Bag ( )
40 {
41  for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
42  if (Item* item = m_bagslot[i])
43  {
44  if (item->IsInWorld())
45  {
46  TC_LOG_FATAL("entities.player.items", "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
47  item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
49  item->RemoveFromWorld();
50  }
51  delete m_bagslot[i];
52  }
53 }
#define MAX_BAG_SIZE
Definition: Bag.h:23
Definition: Item.h:259
uint8 GetSlot() const
Definition: Item.h:329
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
uint8_t uint8
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:107
uint32_t uint32
Definition: g3dmath.h:168
uint8 GetBagSlot() const
Definition: Item.cpp:759
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

Member Function Documentation

void Bag::AddToWorld ( )
overridevirtual

Reimplemented from Object.

56 {
58 
59  for (uint32 i = 0; i < GetBagSize(); ++i)
60  if (m_bagslot[i])
61  m_bagslot[i]->AddToWorld();
62 }
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
virtual void AddToWorld()
Definition: Object.cpp:142
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

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

Reimplemented from Object.

179 {
181 
182  for (uint32 i = 0; i < GetBagSize(); ++i)
183  if (m_bagslot[i])
184  m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target);
185 }
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:167
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

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

Reimplemented from Item.

74 {
75  ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid);
76 
77  if (!itemProto || itemProto->GetContainerSlots() > MAX_BAG_SIZE)
78  return false;
79 
80  Object::_Create(ObjectGuid::Create<HighGuid::Item>(guidlow));
81 
82  _bonusData.Initialize(itemProto);
83 
84  SetEntry(itemid);
85  SetObjectScale(1.0f);
86 
87  if (owner)
88  {
89  SetGuidValue(ITEM_FIELD_OWNER, owner->GetGUID());
90  SetGuidValue(ITEM_FIELD_CONTAINED, owner->GetGUID());
91  }
92 
96 
97  // Setting the number of Slots the Container has
99 
100  // Cleaning 20 slots
101  for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
102  {
104  m_bagslot[i] = NULL;
105  }
106 
107  return true;
108 }
uint32 GetContainerSlots() const
Definition: ItemTemplate.h:675
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
void Initialize(ItemTemplate const *proto)
Definition: Item.cpp:1941
Definition: UpdateFields.h:71
#define MAX_BAG_SIZE
Definition: Bag.h:23
Definition: UpdateFields.h:43
Definition: UpdateFields.h:53
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: UpdateFields.h:42
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
BonusData _bonusData
Definition: Item.h:444
Definition: UpdateFields.h:46
uint32 MaxDurability
Definition: ItemTemplate.h:706
Definition: ItemTemplate.h:647
Definition: UpdateFields.h:70
virtual void SetObjectScale(float scale)
Definition: Object.h:111
uint8_t uint8
Definition: Define.h:152
Definition: UpdateFields.h:54
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

void Bag::DeleteFromDB ( SQLTransaction trans)
overridevirtual

Reimplemented from Item.

134 {
135  for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
136  if (m_bagslot[i])
137  m_bagslot[i]->DeleteFromDB(trans);
138 
139  Item::DeleteFromDB(trans);
140 }
#define MAX_BAG_SIZE
Definition: Bag.h:23
static void DeleteFromDB(SQLTransaction &trans, ObjectGuid::LowType itemGuid)
Definition: Item.cpp:518
uint8_t uint8
Definition: Define.h:152
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

uint32 Bag::GetBagSize ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:71

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Bag::GetFreeSlots ( ) const
143 {
144  uint32 slots = 0;
145  for (uint32 i=0; i < GetBagSize(); ++i)
146  if (!m_bagslot[i])
147  ++slots;
148 
149  return slots;
150 }
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

Item * Bag::GetItemByPos ( uint8  slot) const
245 {
246  if (slot < GetBagSize())
247  return m_bagslot[slot];
248 
249  return NULL;
250 }
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 GetBagSize() const
Definition: Bag.h:51
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

uint32 Bag::GetItemCount ( uint32  item,
Item eItem = NULL 
) const
198 {
199  Item* pItem;
200  uint32 count = 0;
201  for (uint32 i=0; i < GetBagSize(); ++i)
202  {
203  pItem = m_bagslot[i];
204  if (pItem && pItem != eItem && pItem->GetEntry() == item)
205  count += pItem->GetCount();
206  }
207 
208  if (eItem && eItem->GetTemplate()->GetGemProperties())
209  {
210  for (uint32 i=0; i < GetBagSize(); ++i)
211  {
212  pItem = m_bagslot[i];
213  if (pItem && pItem != eItem && pItem->GetSocketColor(0))
214  count += pItem->GetGemCountWithID(item);
215  }
216  }
217 
218  return count;
219 }
uint32 GetCount() const
Definition: Item.h:322
uint32 GetGemProperties() const
Definition: ItemTemplate.h:697
SocketColor GetSocketColor(uint32 index) const
Definition: Item.h:393
uint8 GetGemCountWithID(uint32 GemID) const
Definition: Item.cpp:993
Definition: Item.h:259
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
uint32 GetEntry() const
Definition: Object.h:107
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

uint32 Bag::GetItemCountWithLimitCategory ( uint32  limitCategory,
Item skipItem = NULL 
) const
222 {
223  uint32 count = 0;
224  for (uint32 i = 0; i < GetBagSize(); ++i)
225  if (Item* pItem = m_bagslot[i])
226  if (pItem != skipItem)
227  if (ItemTemplate const* pProto = pItem->GetTemplate())
228  if (pProto->GetItemLimitCategory() == limitCategory)
229  count += m_bagslot[i]->GetCount();
230 
231  return count;
232 }
uint32 GetCount() const
Definition: Item.h:322
Definition: Item.h:259
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
Definition: ItemTemplate.h:647
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

uint8 Bag::GetSlotByItemGUID ( ObjectGuid  guid) const
235 {
236  for (uint32 i = 0; i < GetBagSize(); ++i)
237  if (m_bagslot[i] != 0)
238  if (m_bagslot[i]->GetGUID() == guid)
239  return i;
240 
241  return NULL_SLOT;
242 }
Definition: Unit.h:379
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

bool Bag::IsEmpty ( ) const
189 {
190  for (uint32 i = 0; i < GetBagSize(); ++i)
191  if (m_bagslot[i])
192  return false;
193 
194  return true;
195 }
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

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

Reimplemented from Item.

116 {
117  if (!Item::LoadFromDB(guid, owner_guid, fields, entry))
118  return false;
119 
120  ItemTemplate const* itemProto = GetTemplate(); // checked in Item::LoadFromDB
122  // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
123  for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
124  {
126  delete m_bagslot[i];
127  m_bagslot[i] = NULL;
128  }
129 
130  return true;
131 }
uint32 GetContainerSlots() const
Definition: ItemTemplate.h:675
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
Definition: UpdateFields.h:71
#define MAX_BAG_SIZE
Definition: Bag.h:23
arena_t NULL
Definition: jemalloc_internal.h:624
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
virtual bool LoadFromDB(ObjectGuid::LowType guid, ObjectGuid ownerGuid, Field *fields, uint32 entry)
Definition: Item.cpp:411
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
Definition: ItemTemplate.h:647
Definition: UpdateFields.h:70
uint8_t uint8
Definition: Define.h:152
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

void Bag::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

65 {
66  for (uint32 i = 0; i < GetBagSize(); ++i)
67  if (m_bagslot[i])
69 
71 }
uint32_t uint32
Definition: Define.h:150
uint32 GetBagSize() const
Definition: Bag.h:51
virtual void RemoveFromWorld()
Definition: Object.cpp:156
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

void Bag::RemoveItem ( uint8  slot,
bool  update 
)
153 {
154  ASSERT(slot < MAX_BAG_SIZE);
155 
156  if (m_bagslot[slot])
157  m_bagslot[slot]->SetContainer(NULL);
158 
159  m_bagslot[slot] = NULL;
161 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
void SetContainer(Bag *container)
Definition: Item.h:334
#define MAX_BAG_SIZE
Definition: Bag.h:23
arena_t NULL
Definition: jemalloc_internal.h:624
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
Definition: UpdateFields.h:70
#define ASSERT
Definition: Errors.h:55
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

void Bag::SaveToDB ( SQLTransaction trans)
overridevirtual

Reimplemented from Item.

111 {
112  Item::SaveToDB(trans);
113 }
virtual void SaveToDB(SQLTransaction &trans)
Definition: Item.cpp:311

+ Here is the call graph for this function:

void Bag::StoreItem ( uint8  slot,
Item pItem,
bool  update 
)
164 {
165  ASSERT(slot < MAX_BAG_SIZE);
166 
167  if (pItem && pItem->GetGUID() != this->GetGUID())
168  {
169  m_bagslot[slot] = pItem;
170  SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 4), pItem->GetGUID());
173  pItem->SetContainer(this);
174  pItem->SetSlot(slot);
175  }
176 }
void SetContainer(Bag *container)
Definition: Item.h:334
#define MAX_BAG_SIZE
Definition: Bag.h:23
Definition: UpdateFields.h:43
Definition: UpdateFields.h:42
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
void SetSlot(uint8 slot)
Definition: Item.h:332
ObjectGuid GetOwnerGUID() const
Definition: Item.h:272
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: UpdateFields.h:70
#define ASSERT
Definition: Errors.h:55
Item * m_bagslot[MAX_BAG_SIZE]
Definition: Bag.h:66

+ Here is the call graph for this function:

Member Data Documentation

Item* Bag::m_bagslot[MAX_BAG_SIZE]
protected

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