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

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

#include <TransmittedPackets.hpp>

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

Public Member Functions

 ZC_NOTIFY_PLAYERMOVE (std::shared_ptr< ZoneSession > s)
 
virtual ~ZC_NOTIFY_PLAYERMOVE ()
 
void deliver (int32_t time, int16_t from_x, int16_t from_y, int16_t to_x, int16_t to_y)
 ZC_NOTIFY_PLAYERMOVE. 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

unsigned int _timestamp {0}
 
int8_t _packed_pos [6] {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: ZC_NOTIFY_PLAYERMOVE.

Constructor & Destructor Documentation

◆ ZC_NOTIFY_PLAYERMOVE()

Horizon::Zone::ZC_NOTIFY_PLAYERMOVE::ZC_NOTIFY_PLAYERMOVE ( std::shared_ptr< ZoneSession s)
inline
34359 : NetworkPacket<ZoneSession>(ID_ZC_NOTIFY_PLAYERMOVE, s)
34360 {}
@ ID_ZC_NOTIFY_PLAYERMOVE
Definition: TransmittedPackets.hpp:34332

◆ ~ZC_NOTIFY_PLAYERMOVE()

virtual Horizon::Zone::ZC_NOTIFY_PLAYERMOVE::~ZC_NOTIFY_PLAYERMOVE ( )
inlinevirtual
34361{}

Member Function Documentation

◆ deliver()

void ZC_NOTIFY_PLAYERMOVE::deliver ( int32_t  time,
int16_t  from_x,
int16_t  from_y,
int16_t  to_x,
int16_t  to_y 
)

ZC_NOTIFY_PLAYERMOVE.

2114{
2115 //std::chrono::milliseconds ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
2116 PackPosition(_packed_pos, from_x, from_y, to_x, to_y, 8, 8);
2117 _timestamp = time;
2118
2119 serialize();
2120 transmit();
2121}
void PackPosition(int8_t *p, uint16_t x, uint16_t y, uint8_t dir)
Definition: Utility.cpp:141
void transmit()
Send an Asynchronous packet by queueing a buffer of a particular size to the connected session.
Definition: NetworkPacket.hpp:94
ByteBuffer & serialize()
Definition: TransmittedPackets.cpp:2123
unsigned int _timestamp
Definition: TransmittedPackets.hpp:34367
int8_t _packed_pos[6]
Definition: TransmittedPackets.hpp:34368

References _packed_pos, _timestamp, PackPosition(), serialize(), and Horizon::Base::NetworkPacket< ZoneSession >::transmit().

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

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

◆ serialize()

ByteBuffer & ZC_NOTIFY_PLAYERMOVE::serialize ( )
2124{
2125 buf() << _packet_id;
2126 buf() << _timestamp;
2127 buf().append((char *) _packed_pos, sizeof(_packed_pos));
2128 return buf();
2129}
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 _packed_pos, Horizon::Base::NetworkPacket< ZoneSession >::_packet_id, _timestamp, ByteBuffer::append(), and Horizon::Base::NetworkPacket< ZoneSession >::buf().

Referenced by deliver().

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

Member Data Documentation

◆ _packed_pos

int8_t Horizon::Zone::ZC_NOTIFY_PLAYERMOVE::_packed_pos[6] {0}

Referenced by deliver(), and serialize().

◆ _timestamp

unsigned int Horizon::Zone::ZC_NOTIFY_PLAYERMOVE::_timestamp {0}

Referenced by deliver(), and serialize().


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