Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
Bag.h
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#ifndef SKYFIRE_BAG_H
7
#define SKYFIRE_BAG_H
8
9
// Maximum 36 Slots ((CONTAINER_END - CONTAINER_FIELD_SLOTS)/2
10
#define MAX_BAG_SIZE 36
// 2.0.12
11
12
#include "
Item.h
"
13
#include "
ItemPrototype.h
"
14
15
class
Bag
:
public
Item
16
{
17
public
:
18
Bag
();
19
~Bag
();
20
21
void
AddToWorld
()
OVERRIDE
;
22
void
RemoveFromWorld
()
OVERRIDE
;
23
24
bool
Create
(
uint32
guidlow,
uint32
itemid,
Player
const
* owner)
OVERRIDE
;
25
26
void
StoreItem
(
uint8
slot,
Item
* pItem,
bool
update);
27
void
RemoveItem
(
uint8
slot,
bool
update);
28
29
Item
*
GetItemByPos
(
uint8
slot)
const
;
30
uint32
GetItemCount
(
uint32
item,
Item
* eItem = NULL)
const
;
31
uint32
GetItemCountWithLimitCategory
(
uint32
limitCategory,
Item
* skipItem = NULL)
const
;
32
33
uint8
GetSlotByItemGUID
(
uint64
guid)
const
;
34
bool
IsEmpty
()
const
;
35
uint32
GetFreeSlots
()
const
;
36
uint32
GetBagSize
()
const
{
return
GetUInt32Value
(
CONTAINER_FIELD_NUM_SLOTS
); }
37
38
// DB operations
39
// overwrite virtual Item::SaveToDB
40
void
SaveToDB
(
SQLTransaction
& trans)
OVERRIDE
;
41
// overwrite virtual Item::LoadFromDB
42
bool
LoadFromDB
(
uint32
guid,
uint64
owner_guid,
Field
* fields,
uint32
entry)
OVERRIDE
;
43
// overwrite virtual Item::DeleteFromDB
44
void
DeleteFromDB
(
SQLTransaction
& trans)
OVERRIDE
;
45
46
void
BuildCreateUpdateBlockForPlayer
(
UpdateData
* data,
Player
* target)
const
OVERRIDE
;
47
48
protected
:
49
// Bag Storage space
50
Item
*
m_bagslot
[
MAX_BAG_SIZE
];
51
};
52
53
inline
Item
*
NewItemOrBag
(
ItemTemplate
const
* proto)
54
{
55
return
(proto->
InventoryType
==
INVTYPE_BAG
) ?
new
Bag
:
new
Item
;
56
}
57
#endif
MAX_BAG_SIZE
#define MAX_BAG_SIZE
Definition
Bag.h:10
NewItemOrBag
Item * NewItemOrBag(ItemTemplate const *proto)
Definition
Bag.h:53
uint8
std::uint8_t uint8
Definition
Define.h:79
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
uint64
std::uint64_t uint64
Definition
Define.h:76
Item.h
ItemPrototype.h
INVTYPE_BAG
@ INVTYPE_BAG
Definition
ItemPrototype.h:272
SQLTransaction
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
Definition
Transaction.h:42
CONTAINER_FIELD_NUM_SLOTS
@ CONTAINER_FIELD_NUM_SLOTS
Definition
UpdateFields.h:51
Bag
Definition
Bag.h:16
Bag::GetBagSize
uint32 GetBagSize() const
Definition
Bag.h:36
Bag::StoreItem
void StoreItem(uint8 slot, Item *pItem, bool update)
Definition
Bag.cpp:144
Bag::Create
bool Create(uint32 guidlow, uint32 itemid, Player const *owner) OVERRIDE
Definition
Bag.cpp:59
Bag::IsEmpty
bool IsEmpty() const
Definition
Bag.cpp:169
Bag::GetSlotByItemGUID
uint8 GetSlotByItemGUID(uint64 guid) const
Definition
Bag.cpp:215
Bag::GetItemCountWithLimitCategory
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item *skipItem=NULL) const
Definition
Bag.cpp:202
Bag::BuildCreateUpdateBlockForPlayer
void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const OVERRIDE
Definition
Bag.cpp:159
Bag::~Bag
~Bag()
Definition
Bag.cpp:25
Bag::RemoveFromWorld
void RemoveFromWorld() OVERRIDE
Definition
Bag.cpp:50
Bag::GetItemByPos
Item * GetItemByPos(uint8 slot) const
Definition
Bag.cpp:225
Bag::LoadFromDB
bool LoadFromDB(uint32 guid, uint64 owner_guid, Field *fields, uint32 entry) OVERRIDE
Definition
Bag.cpp:96
Bag::AddToWorld
void AddToWorld() OVERRIDE
Definition
Bag.cpp:41
Bag::SaveToDB
void SaveToDB(SQLTransaction &trans) OVERRIDE
Definition
Bag.cpp:91
Bag::DeleteFromDB
void DeleteFromDB(SQLTransaction &trans) OVERRIDE
Definition
Bag.cpp:114
Bag::GetItemCount
uint32 GetItemCount(uint32 item, Item *eItem=NULL) const
Definition
Bag.cpp:178
Bag::RemoveItem
void RemoveItem(uint8 slot, bool update)
Definition
Bag.cpp:133
Bag::m_bagslot
Item * m_bagslot[MAX_BAG_SIZE]
Definition
Bag.h:50
Bag::GetFreeSlots
uint32 GetFreeSlots() const
Definition
Bag.cpp:123
Bag::Bag
Bag()
Definition
Bag.cpp:15
Field
Definition
Field.h:16
Item
Definition
Item.h:202
Item::Item
Item()
Definition
Item.cpp:233
Object::GetUInt32Value
uint32 GetUInt32Value(uint16 index) const
Definition
Object.cpp:325
Player
Definition
Player.h:1289
UpdateData
Definition
UpdateData.h:42
ItemTemplate
Definition
ItemPrototype.h:628
ItemTemplate::InventoryType
uint32 InventoryType
Definition
ItemPrototype.h:653
src
server
game
Entities
Item
Container
Bag.h
Generated on
for Project SkyFire Core by
1.17.0