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

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

#include <HandledPackets.hpp>

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

Public Member Functions

 CZ_ADD_EXCHANGE_ITEM (std::shared_ptr< ZoneSession > s)
 
virtual ~CZ_ADD_EXCHANGE_ITEM ()
 
void handle (ByteBuffer &&buf)
 CZ_ADD_EXCHANGE_ITEM. More...
 
void deserialize (ByteBuffer &buf)
 
- 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 _inventory_index { 0 }
 
int _amount { 0 }
 

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: CZ_ADD_EXCHANGE_ITEM.

Constructor & Destructor Documentation

◆ CZ_ADD_EXCHANGE_ITEM()

Horizon::Zone::CZ_ADD_EXCHANGE_ITEM::CZ_ADD_EXCHANGE_ITEM ( std::shared_ptr< ZoneSession s)
inline
1104 : NetworkPacket<ZoneSession>(ID_CZ_ADD_EXCHANGE_ITEM, s)
1105 {}
@ ID_CZ_ADD_EXCHANGE_ITEM
Definition: HandledPackets.hpp:1077

◆ ~CZ_ADD_EXCHANGE_ITEM()

virtual Horizon::Zone::CZ_ADD_EXCHANGE_ITEM::~CZ_ADD_EXCHANGE_ITEM ( )
inlinevirtual
1106{}

Member Function Documentation

◆ deserialize()

void CZ_ADD_EXCHANGE_ITEM::deserialize ( ByteBuffer buf)
virtual

Reimplemented from Horizon::Base::NetworkPacket< ZoneSession >.

317{
318 buf >> _packet_id;
320 buf >> _amount;
321}
uint16_t _packet_id
ID of the network packet.
Definition: NetworkPacket.hpp:87
ByteBuffer & buf()
Definition: NetworkPacket.hpp:59
int _amount
Definition: HandledPackets.hpp:1113
int16_t _inventory_index
Definition: HandledPackets.hpp:1112

References _amount, _inventory_index, Horizon::Base::NetworkPacket< ZoneSession >::_packet_id, and Horizon::Base::NetworkPacket< ZoneSession >::buf().

Referenced by handle().

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

◆ handle()

void CZ_ADD_EXCHANGE_ITEM::handle ( ByteBuffer &&  buf)
virtual

CZ_ADD_EXCHANGE_ITEM.

Reimplemented from Horizon::Base::NetworkPacket< ZoneSession >.

303{
305
306 switch (_inventory_index) {
307 case 0:
308 get_session()->clif()->trade().add_zeny(_amount);
309 break;
310 default:
311 get_session()->clif()->trade().add_item(_inventory_index, _amount);
312 break;
313 }
314}
std::shared_ptr< ZoneSession > get_session()
Retrieves the session from this handler instance.
Definition: NetworkPacket.hpp:65
void deserialize(ByteBuffer &buf)
Definition: HandledPackets.cpp:316

References _amount, _inventory_index, Horizon::Base::NetworkPacket< ZoneSession >::buf(), deserialize(), and Horizon::Base::NetworkPacket< ZoneSession >::get_session().

+ Here is the call graph for this function:

Member Data Documentation

◆ _amount

int Horizon::Zone::CZ_ADD_EXCHANGE_ITEM::_amount { 0 }

Referenced by deserialize(), and handle().

◆ _inventory_index

int16_t Horizon::Zone::CZ_ADD_EXCHANGE_ITEM::_inventory_index { 0 }

Referenced by deserialize(), and handle().


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