Horizon Official Technical Documentation
Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5 Class Reference

Main object for the aegis packet: ZC_STORE_ITEMLIST_NORMAL_V5. More...

#include <TransmittedPackets.hpp>

+ Inheritance diagram for Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5:
+ Collaboration diagram for Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5:

Public Member Functions

 ZC_STORE_ITEMLIST_NORMAL_V5 (std::shared_ptr< ZoneSession > s)
 
virtual ~ZC_STORE_ITEMLIST_NORMAL_V5 ()
 
void deliver (std::string name, std::vector< std::shared_ptr< const item_entry_data > > const &items)
 ZC_STORE_ITEMLIST_NORMAL_V5. More...
 
ByteBufferserialize ()
 
- Public Member Functions inherited from Horizon::Base::NetworkPacket< ZoneSession >
 NetworkPacket (uint16_t packet_id, std::shared_ptr< ZoneSession > s)
 
virtual ~NetworkPacket ()
 
void set_packet_id (uint16_t id)
 
uint16_t get_packet_id ()
 
ByteBufferbuf ()
 
std::shared_ptr< ZoneSession > get_session ()
 Retrieves the session from this handler instance. More...
 
virtual void handle (ByteBuffer &&buf)
 
virtual void deserialize (ByteBuffer &buf)
 
void transmit ()
 Send an Asynchronous packet by queueing a buffer of a particular size to the connected session. More...
 
void transmit (std::size_t size)
 Send an Asynchronous packet by queueing a buffer of a particular size to the connected session. More...
 

Public Attributes

int16_t _packet_length { 0 }
 
char _name [MAX_UNIT_NAME_LENGTH] { 0 }
 
std::vector< std::shared_ptr< const item_entry_data > > _items
 

Additional Inherited Members

- Protected Attributes inherited from Horizon::Base::NetworkPacket< ZoneSession >
ByteBuffer _buffer
 Buffer storage facility for the packet stream. More...
 
uint16_t _packet_id
 ID of the network packet. More...
 

Detailed Description

Main object for the aegis packet: ZC_STORE_ITEMLIST_NORMAL_V5.

Constructor & Destructor Documentation

◆ ZC_STORE_ITEMLIST_NORMAL_V5()

Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5::ZC_STORE_ITEMLIST_NORMAL_V5 ( std::shared_ptr< ZoneSession s)
inline
44920 : NetworkPacket<ZoneSession>(ID_ZC_STORE_ITEMLIST_NORMAL_V5, s)
44921 {}
@ ID_ZC_STORE_ITEMLIST_NORMAL_V5
Definition: TransmittedPackets.hpp:44896

◆ ~ZC_STORE_ITEMLIST_NORMAL_V5()

virtual Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5::~ZC_STORE_ITEMLIST_NORMAL_V5 ( )
inlinevirtual
44922{}

Member Function Documentation

◆ deliver()

void ZC_STORE_ITEMLIST_NORMAL_V5::deliver ( std::string  name,
std::vector< std::shared_ptr< const item_entry_data > > const &  items 
)

ZC_STORE_ITEMLIST_NORMAL_V5.

4820{
4821 _packet_length = 4 + MAX_UNIT_NAME_LENGTH + (items.size() * 24);
4822 std::strncpy(_name, name.c_str(), MAX_UNIT_NAME_LENGTH);
4823 _items = items;
4824
4825 serialize();
4826 transmit();
4827}
#define MAX_UNIT_NAME_LENGTH
Definition: Client.hpp:34
void transmit()
Send an Asynchronous packet by queueing a buffer of a particular size to the connected session.
Definition: NetworkPacket.hpp:94
std::vector< std::shared_ptr< const item_entry_data > > _items
Definition: TransmittedPackets.hpp:44930
ByteBuffer & serialize()
Definition: TransmittedPackets.cpp:4829
int16_t _packet_length
Definition: TransmittedPackets.hpp:44928
char _name[MAX_UNIT_NAME_LENGTH]
Definition: TransmittedPackets.hpp:44929

References _items, _name, _packet_length, MAX_UNIT_NAME_LENGTH, serialize(), and Horizon::Base::NetworkPacket< ZoneSession >::transmit().

Referenced by Horizon::Zone::ZoneClientInterface::notify_storage_normal_items().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

ByteBuffer & ZC_STORE_ITEMLIST_NORMAL_V5::serialize ( )
4830{
4831 buf() << _packet_id;
4832 buf() << _packet_length;
4834
4835 for (auto it = _items.begin(); it != _items.end(); it++) {
4836 std::shared_ptr<const item_entry_data> id = *it;
4837 uint8_t config = 0;
4838
4839 buf() << id->index.inventory;
4840 buf() << id->item_id; // 4 / > 2019: 6
4841 buf() << (uint8_t) id->type;
4842 buf() << id->amount;
4843 buf() << id->current_equip_location_mask; // 11 / 13
4844
4845 for (int i = 0; i < MAX_ITEM_SLOTS; i++)
4846 buf() << id->slot_item_id[i]; // 4 * 2 / > 2019: 4 * 4
4847
4848 buf() << id->hire_expire_date; // 23
4849
4850 config |= id->info.is_identified;
4851 config |= id->info.is_favorite << 1;
4852 buf() << config; // 24 / 34
4853 }
4854
4855 return buf();
4856}
#define MAX_ITEM_SLOTS
Definition: ItemDefinitions.hpp:42
void append(T value)
Definition: ByteBuffer.hpp:140
uint16_t _packet_id
ID of the network packet.
Definition: NetworkPacket.hpp:87
ByteBuffer & buf()
Definition: NetworkPacket.hpp:59

References _items, _name, Horizon::Base::NetworkPacket< ZoneSession >::_packet_id, _packet_length, ByteBuffer::append(), Horizon::Base::NetworkPacket< ZoneSession >::buf(), MAX_ITEM_SLOTS, and MAX_UNIT_NAME_LENGTH.

Referenced by deliver().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _items

std::vector<std::shared_ptr<const item_entry_data> > Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5::_items

Referenced by deliver(), and serialize().

◆ _name

char Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5::_name[MAX_UNIT_NAME_LENGTH] { 0 }

Referenced by deliver(), and serialize().

◆ _packet_length

int16_t Horizon::Zone::ZC_STORE_ITEMLIST_NORMAL_V5::_packet_length { 0 }

Referenced by deliver(), and serialize().


The documentation for this class was generated from the following files: