[7023] Remove not used useCharges for IsImmunedToSpell/IsImmunedToDamage
[getmangos.git] / src / game / Bag.h
blobad36b6aa011c62217450147d887cb6e0746c424d
1 /*
2 * Copyright (C) 2005-2009 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
19 #ifndef MANGOS_BAG_H
20 #define MANGOS_BAG_H
22 // Maximum 36 Slots ( (CONTAINER_END - CONTAINER_FIELD_SLOT_1)/2
23 #define MAX_BAG_SIZE 36 // 2.0.12
25 #include "Object.h"
26 #include "ItemPrototype.h"
27 #include "Unit.h"
28 #include "Creature.h"
29 #include "Item.h"
31 class Bag : public Item
33 public:
35 Bag();
36 ~Bag();
38 void AddToWorld();
39 void RemoveFromWorld();
41 bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
43 void Clear();
44 void StoreItem( uint8 slot, Item *pItem, bool update );
45 void RemoveItem( uint8 slot, bool update );
47 Item* GetItemByPos( uint8 slot ) const;
48 uint32 GetItemCount( uint32 item, Item* eItem = NULL ) const;
50 uint8 GetSlotByItemGUID(uint64 guid) const;
51 bool IsEmpty() const;
52 uint32 GetFreeSlots() const;
53 uint32 GetBagSize() const { return GetUInt32Value(CONTAINER_FIELD_NUM_SLOTS); }
55 // DB operations
56 // overwrite virtual Item::SaveToDB
57 void SaveToDB();
58 // overwrite virtual Item::LoadFromDB
59 bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL);
60 // overwrite virtual Item::DeleteFromDB
61 void DeleteFromDB();
63 void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const;
65 protected:
67 // Bag Storage space
68 Item* m_bagslot[MAX_BAG_SIZE];
71 inline Item* NewItemOrBag(ItemPrototype const * proto)
73 return (proto->InventoryType == INVTYPE_BAG) ? new Bag : new Item;
75 #endif