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

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

#include <TransmittedPackets.hpp>

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

Public Member Functions

 HC_ACCEPT_ENTER (std::shared_ptr< CharSession > s)
 
virtual ~HC_ACCEPT_ENTER ()
 
bool prepare (uint32_t account_id, uint8_t max_char_slots, uint8_t permitted_slots, uint8_t total_premium_slots)
 HC_ACCEPT_ENTER. More...
 
void deliver ()
 
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

uint16_t _packet_length { 24 }
 
uint8_t _max_char_slots { MAX_CHARACTER_SLOTS }
 
uint8_t _permitted_slots { MAX_CHARACTER_SLOTS }
 
uint8_t _total_premium_slots { MAX_CHARACTER_SLOTS }
 
uint8_t _unknown_bytes [20] { 0 }
 20 Unknown bytes. More...
 
std::vector< s_hc_character_list_data_characters
 

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_ENTER.

Constructor & Destructor Documentation

◆ HC_ACCEPT_ENTER()

Horizon::Char::HC_ACCEPT_ENTER::HC_ACCEPT_ENTER ( std::shared_ptr< CharSession s)
inline
123 : NetworkPacket<CharSession>(ID_HC_ACCEPT_ENTER, s)
124 {}
@ ID_HC_ACCEPT_ENTER
Definition: TransmittedPackets.hpp:101

◆ ~HC_ACCEPT_ENTER()

virtual Horizon::Char::HC_ACCEPT_ENTER::~HC_ACCEPT_ENTER ( )
inlinevirtual
125{}

Member Function Documentation

◆ deliver()

void HC_ACCEPT_ENTER::deliver ( )
207{
208 transmit();
209}
void transmit()
Send an Asynchronous packet by queueing a buffer of a particular size to the connected session.
Definition: NetworkPacket.hpp:94

References Horizon::Base::NetworkPacket< CharSession >::transmit().

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

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

◆ prepare()

bool HC_ACCEPT_ENTER::prepare ( uint32_t  account_id,
uint8_t  max_char_slots,
uint8_t  permitted_slots,
uint8_t  total_premium_slots 
)

HC_ACCEPT_ENTER.

< 0

< 8

< 16

< 20 Probably OPT1 / 2

< 24

< 28

< 32

< 36

< 40

< 42

< 46

< 50

< 52

< 54

< 56

< 58

< 60 p->body in hercules.

< 62 OPTION_* in hercules.

< 64

< 66

< 68

< 70

< 72

< 74

< 76

< 78

< 80

< 104

< 110

< 112

< 114

< 130

< 134

< 138

< 142 1: Displays "Addon" on side-bar.

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

70{
71 std::shared_ptr<boost::mysql::tcp_ssl_connection> conn = sChar->get_database_connection();
72
73 try {
74 boost::mysql::statement stmt = conn->prepare_statement("SELECT "
75 "a.`id`, a.`account_id`, a.`slot`, a.`name`, a.`online`, a.`gender`, a.`delete_reserved_at`, a.`deleted_at`, a.`unban_time`, " // 0 - 8
76 "a.`rename_count`, a.`last_unique_id`, a.`hotkey_row_index`, a.`change_slot_count`, a.`font`, a.`show_equip`, a.`allow_party`, " // 9 - 15
77 "a.`partner_aid`, a.`father_aid`, a.`mother_aid`, a.`child_aid`, a.`party_id`, a.`guild_id`, a.`pet_id`, a.`homun_id`, " // 16 - 23
78 "a.`elemental_id`, a.`current_map`, a.`current_x`, a.`current_y`, a.`saved_map`, a.`saved_x`, a.`saved_y`, " // 24 - 30
79 "b.`job_id`, b.`base_level`, b.`job_level`, b.`base_experience`, b.`job_experience`, b.`zeny`, b.`strength`, " // 31 - 37
80 "b.`agility`, b.`vitality`, b.`intelligence`, b.`dexterity`, b.`luck`, b.`maximum_hp`, b.`hp`, b.`maximum_sp`, " // 38 - 45
81 "b.`sp`, b.`status_points`, b.`skill_points`, b.`body_state`, b.`virtue`, b.`honor`, b.`manner`, b.`hair_style_id`, " // 46 - 53
82 "b.`hair_color_id`, b.`cloth_color_id`, b.`body_id`, b.`weapon_view_id`, b.`shield_view_id`, b.`head_top_view_id`, b.`head_mid_view_id`, " // 54 - 60
83 "b.`head_bottom_view_id`, b.`robe_view_id` " // 61 - 62
84 "FROM `characters` as a LEFT JOIN `character_status` as b ON a.id = b.id WHERE a.account_id = ? AND a.deleted_at = ?");
85 auto a1 = stmt.bind(account_id, 0);
86 boost::mysql::results results;
87 conn->execute(a1, results);
88
89#if PACKET_VERSION >= 20100413
90 _max_char_slots = max_char_slots;
91 _permitted_slots = permitted_slots;
92 _total_premium_slots = total_premium_slots;
93#endif
94
96 for (auto r : results.rows()) {
98 c._character_id = r[0].as_uint64();
99 c._base_experience = r[34].as_uint64();
100 c._zeny = r[36].as_uint64();
101 c._job_experience = r[35].as_uint64();
102 c._job_level = r[33].as_uint64();
103 c._sc_opt1 = 0;
104 c._sc_opt2 = 0;
105 c._body_state = r[49].as_uint64();
106 c._virtue = r[50].as_int64();
107 c._honor = r[51].as_uint64();
108 c._status_points = r[47].as_uint64();
109 c._hp = r[44].as_uint64();
110 c._maximum_hp = r[43].as_uint64();
111 c._sp = r[46].as_uint64();
112 c._maximum_sp = r[45].as_uint64();
114 c._job_id = r[31].as_uint64();
115 c._hair_view_id = r[53].as_uint64();
116#if PACKET_VERSION >= 20141022
117 c._body_view_id = r[56].as_uint64();
118#endif
119 c._weapon_view_id = r[57].as_uint64();
120 c._base_level = r[32].as_uint64();
121 c._skill_point = r[48].as_uint64();
122 c._head_bottom_view_id = r[61].as_uint64();
123 c._shield_id = r[58].as_uint64();
124 c._head_top_view_id = r[59].as_uint64();
125 c._head_mid_view_id = r[60].as_uint64();
126 c._hair_color_id = r[61].as_uint64();
127 c._clothes_color_id = r[55].as_uint64();
128
129 std::string lname = r[3].as_string();
130 strncpy(c._name, lname.c_str(), MAX_UNIT_NAME_LENGTH);
131
132 c._strength = r[37].as_uint64();
133 c._agility = r[38].as_uint64();
134 c._vitality = r[39].as_uint64();
135 c._intelligence = r[40].as_uint64();
136 c._dexterity = r[41].as_uint64();
137 c._luck = r[42].as_uint64();
138 c._char_slot = r[2].as_int64();
139#if PACKET_VERSION >= 20061023
140 c._rename_count = r[9].as_uint64() ? 0 : 1;
141#endif
142#if (PACKET_VERSION >= 20100720 && PACKET_VERSION <= 20100727) || PACKET_VERSION >= 20100803
143 std::string current_map = r[25].as_string();
144 strncpy(c._map_name, current_map.c_str(), MAP_NAME_LENGTH_EXT);
145#endif
146#if PACKET_VERSION >= 20100803
147 if (r[6].as_int64() != 0) {
148 std::chrono::system_clock::duration dn = std::chrono::system_clock::duration(r[6].as_int64());
149 c._deleted_at = dn.count() * std::chrono::system_clock::period::num / std::chrono::system_clock::period::den;
150 }
151 else {
152 c._deleted_at = 0;
153 }
154#endif
155#if PACKET_VERSION >= 20110111
156 c._robe_view_id = r[62].as_uint64();
157#endif
158#if PACKET_VERSION != 20111116 //2011-11-16 wants 136, ask gravity.
159#if PACKET_VERSION >= 20110928
160 c._change_slot_count = r[12].as_uint64() ? 1 : 0;
161#endif
162#if PACKET_VERSION >= 20111025
163 c._addon_option = r[9].as_uint64() ? 1 : 0;
164#endif
165#if PACKET_VERSION >= 20141016
166 c._gender = r[5].as_string() == "M" ? 1 : r[5].as_string() == "F" ? 0 : 99;
167#endif
168#endif
169 _packet_length += sizeof(c);
170 _characters.push_back(c);
171 } // end for
172 }
173 catch (boost::mysql::error_with_diagnostics &error) {
174 HLog(error) << "HC_ACCEPT_ENTER::prepare: " << error.what();
175 return false;
176 }
177 catch (std::exception& error) {
178 HLog(error) << "HC_ACCEPT_ENTER::prepare: " << error.what();
179 return false;
180 }
181
182#if PACKET_VERSION >= 20100413
183 _packet_length += 27;
184#else
185 _packet_length += 24;
186#endif
187
188 buf() << _packet_id;
189 buf() << _packet_length;
190
191#if PACKET_VERSION >= 20100413
192 buf() << _max_char_slots;
195#endif
196
198
200 buf().append((uint8_t*)&c, sizeof(s_hc_character_list_data));
201
202 HLog(debug) << "Sending character list data size: " << (sizeof(s_hc_character_list_data) * _characters.size());
203 return true;
204}
#define sChar
Definition: Char.hpp:143
#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
#define HLog(type)
Definition: Logger.hpp:122
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
uint8_t _total_premium_slots
Definition: TransmittedPackets.hpp:137
uint8_t _max_char_slots
Definition: TransmittedPackets.hpp:134
uint8_t _permitted_slots
Definition: TransmittedPackets.hpp:135
uint8_t _unknown_bytes[20]
20 Unknown bytes.
Definition: TransmittedPackets.hpp:139
std::vector< s_hc_character_list_data > _characters
Definition: TransmittedPackets.hpp:141
uint16_t _packet_length
Definition: TransmittedPackets.hpp:132
Definition: Client.hpp:52
uint32_t _virtue
44
Definition: Client.hpp:69
char _name[MAX_UNIT_NAME_LENGTH]
112
Definition: Client.hpp:104
uint32_t _sc_opt1
32 Probably OPT1 / 2
Definition: Client.hpp:66
uint16_t _shield_id
Definition: Client.hpp:99
uint32_t _job_experience
Definition: Client.hpp:63
uint32_t _zeny
16
Definition: Client.hpp:59
uint8_t _strength
Definition: Client.hpp:105
uint16_t _skill_point
Definition: Client.hpp:97
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
uint32_t _honor
48
Definition: Client.hpp:70
uint8_t _luck
Definition: Client.hpp:110
uint32_t _base_experience
Definition: Client.hpp:57
uint32_t _body_state
40
Definition: Client.hpp:68
uint8_t _intelligence
Definition: Client.hpp:108
uint16_t _job_id
66
Definition: Client.hpp:90
uint16_t _base_level
74
Definition: Client.hpp:96
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
uint32_t _job_level
28
Definition: Client.hpp:65
uint16_t _hair_color_id
Definition: Client.hpp:102
uint16_t _char_slot
120
Definition: Client.hpp:111
uint16_t _clothes_color_id
88
Definition: Client.hpp:103
uint16_t _weapon_view_id
72 OPTION_* in hercules.
Definition: Client.hpp:95
uint8_t _agility
Definition: Client.hpp:106
uint32_t _sc_opt2
36
Definition: Client.hpp:67
uint16_t _maximum_hp
Definition: Client.hpp:80
uint16_t _head_bottom_view_id
Definition: Client.hpp:98
uint16_t _hp
Definition: Client.hpp:79
uint8_t _vitality
Definition: Client.hpp:107
uint8_t _dexterity
Definition: Client.hpp:109
uint16_t _head_top_view_id
Definition: Client.hpp:100
uint16_t _head_mid_view_id
Definition: Client.hpp:101

References s_hc_character_list_data::_agility, s_hc_character_list_data::_base_experience, s_hc_character_list_data::_base_level, s_hc_character_list_data::_body_state, s_hc_character_list_data::_char_slot, s_hc_character_list_data::_character_id, _characters, s_hc_character_list_data::_clothes_color_id, s_hc_character_list_data::_dexterity, s_hc_character_list_data::_hair_color_id, s_hc_character_list_data::_hair_view_id, s_hc_character_list_data::_head_bottom_view_id, s_hc_character_list_data::_head_mid_view_id, s_hc_character_list_data::_head_top_view_id, s_hc_character_list_data::_honor, s_hc_character_list_data::_hp, s_hc_character_list_data::_intelligence, s_hc_character_list_data::_job_experience, s_hc_character_list_data::_job_id, s_hc_character_list_data::_job_level, s_hc_character_list_data::_luck, _max_char_slots, s_hc_character_list_data::_maximum_hp, s_hc_character_list_data::_maximum_sp, s_hc_character_list_data::_name, Horizon::Base::NetworkPacket< CharSession >::_packet_id, _packet_length, _permitted_slots, s_hc_character_list_data::_sc_opt1, s_hc_character_list_data::_sc_opt2, s_hc_character_list_data::_shield_id, s_hc_character_list_data::_skill_point, s_hc_character_list_data::_sp, s_hc_character_list_data::_status_points, s_hc_character_list_data::_strength, _total_premium_slots, _unknown_bytes, s_hc_character_list_data::_virtue, s_hc_character_list_data::_vitality, s_hc_character_list_data::_walk_speed, s_hc_character_list_data::_weapon_view_id, s_hc_character_list_data::_zeny, ByteBuffer::append(), Horizon::Base::NetworkPacket< CharSession >::buf(), DEFAULT_MOVEMENT_SPEED, HLog, MAP_NAME_LENGTH_EXT, MAX_UNIT_NAME_LENGTH, and sChar.

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

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

◆ serialize()

ByteBuffer & HC_ACCEPT_ENTER::serialize ( )
212{
213 return buf();
214}

References Horizon::Base::NetworkPacket< CharSession >::buf().

+ Here is the call graph for this function:

Member Data Documentation

◆ _characters

std::vector<s_hc_character_list_data> Horizon::Char::HC_ACCEPT_ENTER::_characters

Referenced by prepare().

◆ _max_char_slots

uint8_t Horizon::Char::HC_ACCEPT_ENTER::_max_char_slots { MAX_CHARACTER_SLOTS }

Referenced by prepare().

◆ _packet_length

uint16_t Horizon::Char::HC_ACCEPT_ENTER::_packet_length { 24 }

Referenced by prepare().

◆ _permitted_slots

uint8_t Horizon::Char::HC_ACCEPT_ENTER::_permitted_slots { MAX_CHARACTER_SLOTS }

Referenced by prepare().

◆ _total_premium_slots

uint8_t Horizon::Char::HC_ACCEPT_ENTER::_total_premium_slots { MAX_CHARACTER_SLOTS }

Referenced by prepare().

◆ _unknown_bytes

uint8_t Horizon::Char::HC_ACCEPT_ENTER::_unknown_bytes[20] { 0 }

20 Unknown bytes.

Referenced by prepare().


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