diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-20 14:02:23 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-20 14:02:23 -0300 |
commit | 769c041207521e8b5fd46a616b499fe21088c9a7 (patch) | |
tree | 079a2cf414909b04a9ae3668c054c8988d7938fd /src/pso | |
parent | 0d2f9f05d2fdf31ca21e6e5795880f98dc38821a (diff) |
TProtocol: Start work on the command senders
Diffstat (limited to 'src/pso')
-rw-r--r-- | src/pso/TProtocol.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp index e9b3226..5638a4d 100644 --- a/src/pso/TProtocol.cpp +++ b/src/pso/TProtocol.cpp @@ -24,6 +24,35 @@ void copy_packet(struct packet *pkt) { } +void TProtocol::send_chat(TPlyGuildCardTag &tag, char *mesg) { + if (m_connected) { + TMessageBox tmp; + + memset(&tmp, 0, sizeof(tmp)); + tmp.header.command = 0x06; + tmp.header.flags = 0; + tmp.tag = tag; + strncpy(tmp.mesg, mesg, sizeof(tmp.mesg) - 1); + tmp.header.size = (strlen(tmp.mesg) + 16) & ~3; + // NOTE: Both the `const`ness of it, and it's placement + // here are required to match. + const u16 size = tmp.header.size; + + tmp.bswap(); + + send(as(u8 *, &tmp), size); + } +} +void TProtocol::send_logout() { + packet_header tmp; + tmp.command = 0x05; + tmp.flags = 0; + tmp.size = sizeof(tmp); + tmp.bswap(); + + send(as(u8 *, &tmp), sizeof(tmp)); +} + int TProtocol::send_login3() { int ret; set_ip_address(new_ip_addr); @@ -41,6 +70,40 @@ int TProtocol::send_login3() { return ret; } +void TProtocol::send_login2(int disable_udp) { + m_udp_disabled = disable_udp; + TRegister tmp; + + memset(&tmp, 0, sizeof(tmp)); + tmp.header.command = 0x04; + tmp.header.flags = m_udp_disabled; + tmp.header.size = sizeof(tmp); + tmp.smth = m_smth; + tmp.sub_version = m_sub_version; + tmp.language = m_language; + strncpy(tmp.serial_number, m_serial_number, sizeof(tmp.serial_number)); + strncpy(tmp.access_key, m_access_key, sizeof(tmp.access_key)); + + tmp.bswap(); + send(as(u8 *, &tmp), sizeof(tmp)); +} + +void TProtocol::send_regist() { + TRegister tmp; + + memset(&tmp, 0, sizeof(tmp)); + tmp.header.command = 0x03; + tmp.header.size = sizeof(tmp); + tmp.smth = m_smth; + tmp.sub_version = m_sub_version; + tmp.language = m_language; + strncpy(tmp.serial_number, m_serial_number, sizeof(tmp.serial_number)); + strncpy(tmp.access_key, m_access_key, sizeof(tmp.access_key)); + + tmp.bswap(); + send(as(u8 *, &tmp), sizeof(tmp)); +} + void TProtocol::recv_emergency_call(packet &pkt) { TMessageBox tmp = as(TMessageBox &, pkt); tmp.bswap(); |