diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-15 11:49:51 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-15 11:49:51 -0300 |
commit | eaea67f74ecbec186a12a819c3f000631346208c (patch) | |
tree | 9c1513f9a861513b0621f50231e17bf1e6bc2836 /src/pso | |
parent | 741af37a4fe17d0340b221b2cb64e4c68e12464c (diff) |
TProtocol: Add (and match) more command handlers
Diffstat (limited to 'src/pso')
-rw-r--r-- | src/pso/TProtocol.cpp | 72 |
1 files changed, 62 insertions, 10 deletions
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp index 58eaa56..408214b 100644 --- a/src/pso/TProtocol.cpp +++ b/src/pso/TProtocol.cpp @@ -41,6 +41,58 @@ int TProtocol::send_login3() { return ret; } +void TProtocol::recv_emergency_call(packet &pkt) { + TMessageBox tmp = as(TMessageBox &, pkt); + tmp.bswap(); + if (m_recv_handlers.handle_B0_recv_emergency_call != nullptr) { + m_recv_handlers.handle_B0_recv_emergency_call(tmp.mesg); + } +}; + +void TProtocol::recv_quest_info(packet &pkt) { + TPlyText<288> tmp = as(TPlyText<288> &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_A5_recv_quest_info != nullptr) { + m_recv_handlers.handle_A5_recv_quest_info(tmp); + } +}; + +void TProtocol::recv_quest_list(packet &pkt) { + typedef TMenuList<QuestListEntry, 30, 0> quest_list; + quest_list tmp = as(quest_list &, pkt); + tmp.bswap(); + + m_entry_count = tmp.header.flags; + + for (int i = 0; i < m_entry_count; ++i) { + m_quest_entries[i] = tmp.entries[i]; + } + + if (m_recv_handlers.handle_A4_recv_quest_list != nullptr) { + m_recv_handlers.handle_A4_recv_quest_list(tmp.header.flags, tmp); + } +}; + +void TProtocol::recv_quest_menu_info(packet &pkt) { + TPlyText<288> tmp = as(TPlyText<288> &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_A3_recv_quest_menu_info != nullptr) { + m_recv_handlers.handle_A3_recv_quest_menu_info(tmp); + } +}; + +void TProtocol::recv_quest_menu_list(packet &pkt) { + typedef TMenuList<QuestListEntry, 30, 0> quest_list; + quest_list tmp = as(quest_list &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_A2_recv_quest_menu_list != nullptr) { + m_recv_handlers.handle_A2_recv_quest_menu_list(tmp); + } +}; + void TProtocol::recv_chat_message(packet &pkt) { TChatMessage tmp = as(TChatMessage &, pkt); tmp.bswap(); @@ -423,14 +475,14 @@ int TProtocol::handle_command(struct packet *pkt) { // 0x95 { 0xA0, &recv_dir_list }, { 0xA1, &recv_dir_list }, - // 0xA2 - // 0xA3 - // 0xA4 - // 0xA5 + { 0xA2, &recv_quest_menu_list }, + { 0xA3, &recv_quest_menu_info }, + { 0xA4, &recv_quest_list }, + { 0xA5, &recv_quest_info }, { 0xA6, &recv_vm_download_head }, { 0xA7, &recv_vm_download }, // 0x97 - // 0xB0 + { 0xB0, &recv_emergency_call }, { 0x1F, &recv_text_list }, // 0xB1 // 0xC0 @@ -606,15 +658,15 @@ TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *seria m_recv_handlers.unused10 = nullptr; m_recv_handlers.handle_81_recv_chat_message = nullptr; m_recv_handlers.handle_41_recv_user_ans = nullptr; - m_recv_handlers.handle_A2_quest_list_packet = nullptr; - m_recv_handlers.handle_A3_quest_info_packet = nullptr; + m_recv_handlers.handle_A2_recv_quest_menu_list = nullptr; + m_recv_handlers.handle_A3_recv_quest_menu_info = nullptr; m_recv_handlers.handle_44_recv_download_head = nullptr; m_recv_handlers.handle_13_recv_download = nullptr; - m_recv_handlers.handle_A4_downloadable_quest_menu_packet = nullptr; - m_recv_handlers.handle_A5_downloadable_quest_info_packet = nullptr; + m_recv_handlers.handle_A4_recv_quest_list = nullptr; + m_recv_handlers.handle_A5_recv_quest_info = nullptr; m_recv_handlers.unused11 = nullptr; m_recv_handlers.handle_97_checksum_reply_packet = nullptr; - m_recv_handlers.handle_B0_server_message_packet = nullptr; + m_recv_handlers.handle_B0_recv_emergency_call = nullptr; m_recv_handlers.handle_1F_recv_text_list = nullptr; m_recv_handlers.handle_88_player_arrow_color_list_packet = nullptr; m_recv_handlers.handle_8A_lobby_name_packet = nullptr; |