diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-05-11 15:37:34 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-05-11 15:37:34 -0300 |
commit | 233f92cfeab355feebc4c0d6fc3e42c44bd54769 (patch) | |
tree | f0da675eea8d5d3805a7c68f6bf667a147316b80 /src | |
parent | 0b0f3da43d281b75cc04a9333332f2abc1eff0c7 (diff) |
TProtocol: Add, and match `send_chara_data_v2()`
Sorry for the long wait, was busy doing other things.
Diffstat (limited to 'src')
-rw-r--r-- | src/pso/TProtocol.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp index 1a992e3..3b7cbd3 100644 --- a/src/pso/TProtocol.cpp +++ b/src/pso/TProtocol.cpp @@ -24,6 +24,35 @@ void copy_packet(struct packet *pkt) { } +void TProtocol::send_chara_data_v2(TPlyCharData &char_data, TPlyChallenge &challenge, TPlyChoiceSearchConfig &choice_search_config, TBlockedSenders &blocked_senders, TPlyText<512> &auto_reply, char *info_board) { + if (m_connected) { + char_data.m_disp_data.m_disp_part2.is_valid(); + m_character_data = char_data; + TPlyJoinData tmp; + memset(&tmp, 0, sizeof(tmp)); + + + tmp.header.command = 0x61; + tmp.header.flags = 3; + tmp.header.size = sizeof(tmp); + tmp.char_data = m_character_data; + tmp.challenge = challenge; + tmp.choice_search_config = choice_search_config; + strncpy(tmp.info_board, info_board, sizeof(tmp.info_board)); + for (int i = 0; i < blocked_senders.header.flags; ++i) { + tmp.blocked_senders[i] = blocked_senders.blocked_senders[i]; + } + tmp.auto_reply_enabled = auto_reply.header.flags; + strncpy(tmp.auto_reply, auto_reply.text, sizeof(tmp.auto_reply)-1); + const int packet_size = strlen(tmp.auto_reply) + offsetof(TPlyJoinData, auto_reply) + sizeof(packet_header); + + tmp.header.size = packet_size & ~3; + tmp.char_data.some_stub(); + tmp.bswap(); + send(as(u8 *, &tmp), packet_size & ~3); + } +} + void TProtocol::send_text_list() { if (m_connected) { packet_header tmp; |