1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-09 04:07:46 +00:00
sapphire/src/world/Inventory/ItemContainer.h

60 lines
1.1 KiB
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef _ITEMCONTAINER_H_
#define _ITEMCONTAINER_H_
#include <map>
2018-03-06 22:22:19 +01:00
#include <Common.h>
#include "ForwardsZone.h"
2017-08-08 13:53:47 +02:00
namespace Sapphire
2018-10-28 21:53:21 +01:00
{
using ItemMap = std::map< uint16_t, ItemPtr >;
2018-10-28 21:53:21 +01:00
class ItemContainer
{
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
public:
ItemContainer( uint16_t storageId, uint16_t maxSize, const std::string& tableName, bool isMultiStorage,
FrameworkPtr pFw, bool isPersistentStorage = true );
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
~ItemContainer();
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
uint16_t getId() const;
2017-08-08 13:53:47 +02:00
uint16_t getEntryCount() const;
2017-08-08 13:53:47 +02:00
void removeItem( uint16_t slotId, bool removeFromDb = true );
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
ItemMap& getItemMap();
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
const ItemMap& getItemMap() const;
2017-08-08 13:53:47 +02:00
ItemPtr getItem( uint16_t slotId );
2017-08-08 13:53:47 +02:00
void setItem( uint16_t slotId, ItemPtr item );
2017-08-08 13:53:47 +02:00
int16_t getFreeSlot();
2017-08-08 13:53:47 +02:00
uint16_t getMaxSize() const;
2017-08-08 13:53:47 +02:00
2018-10-28 21:53:21 +01:00
std::string getTableName() const;
2018-10-28 21:53:21 +01:00
bool isMultiStorage() const;
2018-10-28 21:53:21 +01:00
bool isPersistentStorage() const;
2018-10-28 21:53:21 +01:00
private:
uint16_t m_id;
uint16_t m_size;
2018-10-28 21:53:21 +01:00
std::string m_tableName;
bool m_bMultiStorage;
FrameworkPtr m_pFw;
2018-10-28 21:53:21 +01:00
bool m_isPersistentStorage;
ItemMap m_itemMap;
Entity::PlayerPtr m_pOwner;
};
2017-08-08 13:53:47 +02:00
}
#endif