1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 16:37:45 +00:00
sapphire/src/world/Manager/InventoryMgr.h

67 lines
2.1 KiB
C
Raw Normal View History

#ifndef SAPPHIRE_INVENTORYMGR_H
#define SAPPHIRE_INVENTORYMGR_H
#include "ForwardsZone.h"
namespace Sapphire::World::Manager
{
class InventoryMgr
{
public:
/*!
* @brief Sends an item container to a player
*
* This does no checks on the container itself. You can send another players inventory to a different
* player if you so wish - not that you should
*
* Automagically manages inventory packet sequencing.
*
* @param player The player to send the container to
* @param container The container to send to the player
*/
void sendInventoryContainer( Sapphire::Entity::Player& player, Sapphire::ItemContainerPtr container );
/*!
* @brief Creates an item, saves it to the global item table and returns a ptr to the created item
* @param player The player that will 'own' the item
* @param catalogId The ID for the item, see item.exd
* @param quantity how much item to make
* @return An ItemPtr to the newly created item
*/
Sapphire::ItemPtr createItem( Entity::Player& player, uint32_t catalogId, uint32_t quantity = 1 );
/*!
* @brief Commits a housing containers contents to the db
* @param ident The identity of the owner of the container
* @param container The container to save to the db
*/
void saveHousingContainer( Common::LandIdent ident, Sapphire::ItemContainerPtr container );
/*!
* @brief Update an item in the db
* @param item The item to commit to the db
*/
void updateItem( Sapphire::ItemPtr item );
private:
/*!
* @brief Saves an individual item to the db.
*
* This will create a new row in the event the slot doesn't exist in the db, otherwise this
* will overwrite the itemid in the existing row.
*
* @param ident
* @param containerId
* @param slotId
* @param itemId
*/
void saveHousingContainerItem( uint64_t ident,
uint16_t containerId, uint16_t slotId,
uint64_t itemId );
};
}
#endif //SAPPHIRE_INVENTORYMGR_H