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

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

#include <TransmittedPackets.hpp>

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

Public Member Functions

 HC_ACK_CHARINFO_PER_PAGE (std::shared_ptr< CharSession > s)
 
virtual ~HC_ACK_CHARINFO_PER_PAGE ()
 
int32_t prepare (bool empty=false)
 HC_ACK_CHARINFO_PER_PAGE. 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 }
 
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_ACK_CHARINFO_PER_PAGE.

Constructor & Destructor Documentation

◆ HC_ACK_CHARINFO_PER_PAGE()

Horizon::Char::HC_ACK_CHARINFO_PER_PAGE::HC_ACK_CHARINFO_PER_PAGE ( std::shared_ptr< CharSession s)
inline
320 : NetworkPacket<CharSession>(ID_HC_ACK_CHARINFO_PER_PAGE, s)
321 {}
@ ID_HC_ACK_CHARINFO_PER_PAGE
Definition: TransmittedPackets.hpp:301

◆ ~HC_ACK_CHARINFO_PER_PAGE()

virtual Horizon::Char::HC_ACK_CHARINFO_PER_PAGE::~HC_ACK_CHARINFO_PER_PAGE ( )
inlinevirtual
322{}

Member Function Documentation

◆ deliver()

void HC_ACK_CHARINFO_PER_PAGE::deliver ( )
749{
750 transmit();
751}
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::character_delete_birthdate().

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

◆ prepare()

int32_t HC_ACK_CHARINFO_PER_PAGE::prepare ( bool  empty = false)

HC_ACK_CHARINFO_PER_PAGE.

< 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

< 134

< 138

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

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

628{
629 _packet_length = 4;
630
631 if (!empty) {
632
633 std::shared_ptr<boost::mysql::tcp_ssl_connection> conn = sChar->get_database_connection();
634
635 boost::mysql::results results;
636 try {
637 boost::mysql::statement stmt = conn->prepare_statement("SELECT "
638 "a.`id`, a.`account_id`, a.`slot`, a.`name`, a.`online`, a.`gender`, a.`delete_reserved_at`, a.`deleted_at`, a.`unban_time`, "
639 "a.`rename_count`, a.`last_unique_id`, a.`hotkey_row_index`, a.`change_slot_count`, a.`font`, a.`show_equip`, a.`allow_party`, "
640 "a.`partner_aid`, a.`father_aid`, a.`mother_aid`, a.`child_aid`, a.`party_id`, a.`guild_id`, a.`pet_id`, a.`homun_id`, "
641 "a.`elemental_id`, a.`current_map`, a.`current_x`, a.`current_y`, a.`saved_map`, a.`saved_x`, a.`saved_y`, "
642 "b.`job_id`, b.`base_level`, b.`job_level`, b.`base_experience`, b.`job_experience`, b.`zeny`, b.`strength`, "
643 "b.`agility`, b.`vitality`, b.`intelligence`, b.`dexterity`, b.`luck`, b.`maximum_hp`, b.`hp`, b.`maximum_sp`, "
644 "b.`sp`, b.`status_points`, b.`skill_points`, b.`body_state`, b.`virtue`, b.`honor`, b.`manner`, b.`hair_style_id`, "
645 "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`, "
646 "b.`head_bottom_view_id`, b.`robe_view_id` "
647 "FROM `characters` as a LEFT JOIN `character_status` as b ON a.id = b.id WHERE a.account_id = ? AND a.deleted_at = ?");
648 auto a1 = stmt.bind(get_session()->get_session_data()._account_id, 0);
649 conn->execute(a1, results);
650 }
651 catch (boost::mysql::error_with_diagnostics &error) {
652 HLog(error) << "HC_ACK_CHARINFO_PER_PAGE::prepare:" << error.what();
653 return false;
654 }
655
656 for (auto r : results.rows())
657 {
659
660 c._character_id = r[0].as_uint64();
661 c._base_experience = r[34].as_uint64();
662 c._zeny = r[36].as_uint64();
663 c._job_experience = r[35].as_uint64();
664 c._job_level = r[33].as_uint64();
665 c._sc_opt1 = 0;
666 c._sc_opt2 = 0;
667 c._body_state = r[49].as_uint64();
668 c._virtue = r[50].as_int64();
669 c._honor = r[51].as_uint64();
670 c._status_points = r[47].as_uint64();
671 c._hp = r[44].as_uint64();
672 c._maximum_hp = r[43].as_uint64();
673 c._sp = r[46].as_uint64();
674 c._maximum_sp = r[45].as_uint64();
676 c._job_id = r[31].as_uint64();
677 c._hair_view_id = r[53].as_uint64();
678#if PACKET_VERSION >= 20141022
679 c._body_view_id = r[56].as_uint64();
680#endif
681 c._weapon_view_id = r[57].as_uint64();
682 c._base_level = r[32].as_uint64();
683 c._skill_point = r[48].as_uint64();
684 c._head_bottom_view_id = r[61].as_uint64();
685 c._shield_id = r[58].as_uint64();
686 c._head_top_view_id = r[59].as_uint64();
687 c._head_mid_view_id = r[60].as_uint64();
688 c._hair_color_id = r[54].as_uint64();
689 c._clothes_color_id = r[55].as_uint64();
690
691 std::string lname = r[3].as_string();
692 strncpy(c._name, lname.c_str(), MAX_UNIT_NAME_LENGTH);
693
694 c._strength = r[37].as_uint64();
695 c._agility = r[38].as_uint64();
696 c._vitality = r[39].as_uint64();
697 c._intelligence = r[40].as_uint64();
698 c._dexterity = r[41].as_uint64();
699 c._luck = r[42].as_uint64();
700 c._char_slot = r[2].as_int64();
701#if PACKET_VERSION >= 20061023
702 c._rename_count = r[9].as_uint64() ? 0 : 1;
703#endif
704#if (PACKET_VERSION >= 20100720 && PACKET_VERSION <= 20100727) || PACKET_VERSION >= 20100803
705 std::string current_map = r[25].as_string();
706 strncpy(c._map_name, current_map.c_str(), MAP_NAME_LENGTH_EXT);
707#endif
708#if PACKET_VERSION >= 20100803
709 if (r[6].as_int64() != 0) {
710 std::chrono::system_clock::duration dn = std::chrono::system_clock::duration(r[6].as_int64());
711 c._deleted_at = dn.count() * std::chrono::system_clock::period::num / std::chrono::system_clock::period::den;
712 }
713 else {
714 c._deleted_at = 0;
715 }
716#endif
717#if PACKET_VERSION >= 20110111
718 c._robe_view_id = r[62].as_uint64();
719#endif
720#if PACKET_VERSION != 20111116 //2011-11-16 wants 136, ask gravity.
721#if PACKET_VERSION >= 20110928
722 c._change_slot_count = r[12].as_uint64() ? 1 : 0;
723#endif
724#if PACKET_VERSION >= 20111025
725 c._addon_option = r[9].as_uint64() ? 1 : 0;
726#endif
727#if PACKET_VERSION >= 20141016
728 c._gender = r[5].as_string() == "M" ? 1 : r[5].as_string() == "F" ? 0 : 99;
729#endif
730#endif
731 _packet_length += sizeof(c);
732 _characters.push_back(c);
733 }
734 }
735
736 buf() << _packet_id;
737 buf() << _packet_length;
738
739 if (!empty)
741 buf().append((int8_t*)&c, sizeof(s_hc_character_list_data));
742
743 HLog(debug) << "Sending character list data size: " << (sizeof(s_hc_character_list_data) * _characters.size());
744
745 return _characters.size();
746}
#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
std::shared_ptr< CharSession > get_session()
Retrieves the session from this handler instance.
Definition: NetworkPacket.hpp:65
ByteBuffer & buf()
Definition: NetworkPacket.hpp:59
uint16_t _packet_length
Definition: TransmittedPackets.hpp:329
std::vector< s_hc_character_list_data > _characters
Definition: TransmittedPackets.hpp:330
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, 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, 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, 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, Horizon::Base::NetworkPacket< CharSession >::get_session(), HLog, MAP_NAME_LENGTH_EXT, MAX_UNIT_NAME_LENGTH, and sChar.

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

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

◆ serialize()

ByteBuffer & HC_ACK_CHARINFO_PER_PAGE::serialize ( )
754{
755 return buf();
756}

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_ACK_CHARINFO_PER_PAGE::_characters

Referenced by prepare().

◆ _packet_length

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

Referenced by prepare().


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