2 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 // Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2
23 #define MAX_BAG_SIZE 36 // 2.0.12
25 #include "ItemPrototype.h"
28 class Bag
: public Item
36 void RemoveFromWorld();
38 bool Create(uint32 guidlow
, uint32 itemid
, Player
const* owner
);
41 void StoreItem( uint8 slot
, Item
*pItem
, bool update
);
42 void RemoveItem( uint8 slot
, bool update
);
44 Item
* GetItemByPos( uint8 slot
) const;
45 uint32
GetItemCount( uint32 item
, Item
* eItem
= NULL
) const;
47 uint8
GetSlotByItemGUID(uint64 guid
) const;
49 uint32
GetFreeSlots() const;
50 uint32
GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS
); }
53 // overwrite virtual Item::SaveToDB
55 // overwrite virtual Item::LoadFromDB
56 bool LoadFromDB(uint32 guid
, uint64 owner_guid
, QueryResult
*result
= NULL
);
57 // overwrite virtual Item::DeleteFromDB
60 void BuildCreateUpdateBlockForPlayer(UpdateData
*data
, Player
*target
) const;
65 Item
* m_bagslot
[MAX_BAG_SIZE
];
68 inline Item
* NewItemOrBag(ItemPrototype
const * proto
)
70 return (proto
->InventoryType
== INVTYPE_BAG
) ? new Bag
: new Item
;