1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 23:57:46 +00:00
sapphire/src/world/Network/PacketWrappers/UpdateInventorySlotPacket.h

42 lines
1.2 KiB
C
Raw Normal View History

#ifndef _INVENTORY_SLOT_UPDATE_PACKET_H
#define _INVENTORY_SLOT_UPDATE_PACKET_H
2019-03-08 15:34:38 +01:00
#include <Network/GamePacket.h>
#include "Actor/Player.h"
#include "Inventory/Item.h"
#include "Forwards.h"
namespace Sapphire::Network::Packets::WorldPackets::Server
{
2018-10-28 21:53:21 +01:00
/**
* @brief The update inventory-slot packet.
*/
class UpdateInventorySlotPacket : public ZoneChannelPacket< FFXIVIpcNormalItem >
{
2018-10-28 21:53:21 +01:00
public:
UpdateInventorySlotPacket( uint32_t playerId, uint16_t slot, uint16_t storageId, const Item& item, uint32_t contextId ) :
ZoneChannelPacket< FFXIVIpcNormalItem >( playerId, playerId )
2018-10-28 21:53:21 +01:00
{
initialize( slot, storageId, item, contextId );
};
2018-10-28 21:53:21 +01:00
private:
void initialize( uint16_t slot, uint16_t storageId, const Item& item, uint32_t contextId )
{
m_data.contextId = contextId;
m_data.item.storageId = storageId;
m_data.item.catalogId = item.getId();
m_data.item.stack = item.getStackSize();
m_data.item.containerIndex = slot;
m_data.item.flags = static_cast< uint8_t >( item.isHq() ? 1 : 0 );
m_data.item.refine = item.getSpiritbond();
m_data.item.stain = static_cast< uint8_t >( item.getStain() );
m_data.item.signatureId = 0;
};
};
}
#endif /*_MODELEQUIPPACKET_H*/