Horizon Official Technical Documentation
Horizon::Char::HC_ACCEPT_MAKECHAR Class Reference

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

#include <TransmittedPackets.hpp>

+ Inheritance diagram for Horizon::Char::HC_ACCEPT_MAKECHAR:
+ Collaboration diagram for Horizon::Char::HC_ACCEPT_MAKECHAR:

Public Member Functions

 HC_ACCEPT_MAKECHAR (std::shared_ptr< CharSession > s)
 
virtual ~HC_ACCEPT_MAKECHAR ()
 
void deliver (uint32_t char_id, uint32_t start_zeny, std::string map_name, std::string name, uint8_t slot, uint32_t hair_color, uint32_t hair_style, uint32_t job_class, uint8_t gender)
 HC_ACCEPT_MAKECHAR. More...
 
ByteBufferserialize ()
 
- Public Member Functions inherited from Horizon::Base::NetworkPacket< CharSession >
 NetworkPacket (uint16_t packet_id, std::shared_ptr< CharSession > s)
 
virtual ~NetworkPacket ()
 
void set_packet_id (uint16_t id)
 
uint16_t get_packet_id ()
 
ByteBufferbuf ()
 
std::shared_ptr< CharSession > 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

s_hc_character_list_data _c
 

Additional Inherited Members

- Protected Attributes inherited from Horizon::Base::NetworkPacket< CharSession >
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: HC_ACCEPT_MAKECHAR.

Constructor & Destructor Documentation

◆ HC_ACCEPT_MAKECHAR()

Horizon::Char::HC_ACCEPT_MAKECHAR::HC_ACCEPT_MAKECHAR ( std::shared_ptr< CharSession s)
inline
214 : NetworkPacket<CharSession>(ID_HC_ACCEPT_MAKECHAR, s)
215 {}
@ ID_HC_ACCEPT_MAKECHAR
Definition: TransmittedPackets.hpp:192

◆ ~HC_ACCEPT_MAKECHAR()

virtual Horizon::Char::HC_ACCEPT_MAKECHAR::~HC_ACCEPT_MAKECHAR ( )
inlinevirtual
216{}

Member Function Documentation

◆ deliver()

void HC_ACCEPT_MAKECHAR::deliver ( uint32_t  char_id,
uint32_t  start_zeny,
std::string  map_name,
std::string  name,
uint8_t  slot,
uint32_t  hair_color,
uint32_t  hair_style,
uint32_t  job_class,
uint8_t  gender 
)

HC_ACCEPT_MAKECHAR.

< len: 16

< 146 0: Female, 1: Male, 99: Account-based.

219{
220 _c._character_id = char_id;
221 _c._zeny = start_zeny;
222 _c._status_points = 48;
223 _c._hp = 40;
224 _c._maximum_hp = 40;
225 _c._sp = 11; // Maximum SP set to 11 for novice because some clients crash if it exceeds 11.
226 _c._maximum_sp = 11;
228 _c._job_id = job_class;
229 _c._hair_view_id = hair_style;
230 std::strncpy(_c._name, name.c_str(), MAX_UNIT_NAME_LENGTH);
231 _c._char_slot = slot;
232#if (PACKET_VERSION >= 20100720 && PACKET_VERSION <= 20100727) || PACKET_VERSION >= 20100803
233 std::strncpy(_c._map_name, map_name.c_str(), MAP_NAME_LENGTH_EXT);
234#endif
235#if PACKET_VERSION >= 20141016
236 _c._gender = gender;
237#endif
238
239 serialize();
240 transmit();
241}
#define MAX_UNIT_NAME_LENGTH
Definition: Client.hpp:34
#define MAP_NAME_LENGTH_EXT
Definition: Client.hpp:47
#define DEFAULT_MOVEMENT_SPEED
Definition: Horizon.hpp:58
void transmit()
Send an Asynchronous packet by queueing a buffer of a particular size to the connected session.
Definition: NetworkPacket.hpp:94
s_hc_character_list_data _c
Definition: TransmittedPackets.hpp:222
ByteBuffer & serialize()
Definition: TransmittedPackets.cpp:243
char _name[MAX_UNIT_NAME_LENGTH]
112
Definition: Client.hpp:104
uint32_t _zeny
16
Definition: Client.hpp:59
uint32_t _character_id
4
Definition: Client.hpp:53
uint16_t _maximum_sp
62
Definition: Client.hpp:87
uint16_t _walk_speed
64
Definition: Client.hpp:89
uint16_t _job_id
66
Definition: Client.hpp:90
uint16_t _hair_view_id
68
Definition: Client.hpp:91
uint16_t _sp
60
Definition: Client.hpp:86
uint16_t _status_points
50
Definition: Client.hpp:71
uint16_t _char_slot
120
Definition: Client.hpp:111
uint16_t _maximum_hp
Definition: Client.hpp:80
uint16_t _hp
Definition: Client.hpp:79

References _c, s_hc_character_list_data::_char_slot, s_hc_character_list_data::_character_id, s_hc_character_list_data::_hair_view_id, s_hc_character_list_data::_hp, s_hc_character_list_data::_job_id, s_hc_character_list_data::_maximum_hp, s_hc_character_list_data::_maximum_sp, s_hc_character_list_data::_name, s_hc_character_list_data::_sp, s_hc_character_list_data::_status_points, s_hc_character_list_data::_walk_speed, s_hc_character_list_data::_zeny, DEFAULT_MOVEMENT_SPEED, MAP_NAME_LENGTH_EXT, MAX_UNIT_NAME_LENGTH, serialize(), and Horizon::Base::NetworkPacket< CharSession >::transmit().

Referenced by Horizon::Char::CharClientInterface::make_new_character().

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

◆ serialize()

ByteBuffer & HC_ACCEPT_MAKECHAR::serialize ( )
244{
245 buf() << _packet_id;
246 buf().append((uint8_t*)&_c, sizeof(s_hc_character_list_data));
247 return buf();
248}
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
Definition: Client.hpp:52

References _c, Horizon::Base::NetworkPacket< CharSession >::_packet_id, ByteBuffer::append(), and Horizon::Base::NetworkPacket< CharSession >::buf().

Referenced by deliver().

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

Member Data Documentation

◆ _c

s_hc_character_list_data Horizon::Char::HC_ACCEPT_MAKECHAR::_c

Referenced by deliver(), and serialize().


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