diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/login/login.cpp | 318 | ||||
-rw-r--r-- | src/login/types.cpp | 21 | ||||
-rw-r--r-- | src/login/types.hpp | 43 | ||||
-rw-r--r-- | src/net/packets.hpp | 33 | ||||
-rw-r--r-- | src/proto2/any-user.hpp | 9 | ||||
-rw-r--r-- | src/proto2/fwd.hpp | 122 | ||||
-rw-r--r-- | src/proto2/include_types_test.cpp | 23 | ||||
-rw-r--r-- | src/proto2/login-admin.hpp | 208 | ||||
-rw-r--r-- | src/proto2/login-char.hpp | 180 | ||||
-rw-r--r-- | src/proto2/login-user.hpp | 323 | ||||
-rw-r--r-- | src/proto2/map-user.hpp | 3 | ||||
-rw-r--r-- | src/proto2/types.hpp | 19 |
12 files changed, 1127 insertions, 175 deletions
diff --git a/src/login/login.cpp b/src/login/login.cpp index 7170a59..98f0c1e 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -53,7 +53,6 @@ #include "../net/packets.hpp" #include "../net/socket.hpp" #include "../net/timer.hpp" -#include "../net/vomit.hpp" #include "../mmo/config_parse.hpp" #include "../mmo/core.hpp" @@ -70,6 +69,8 @@ #include "../proto2/login-char.hpp" #include "../proto2/login-user.hpp" +#include "types.hpp" + #include "../poison.hpp" constexpr int MAX_SERVERS = 30; @@ -195,6 +196,7 @@ struct AuthFifo }; static Array<AuthFifo, AUTH_FIFO_SIZE> auth_fifo; +// TODO replace with auto_fifo_it static int auth_fifo_pos = 0; @@ -235,19 +237,6 @@ static pid_t pid = 0; // For forked DB writes -namespace e -{ -enum class VERSION_2 : uint8_t -{ - /// client supports updatehost - UPDATEHOST = 0x01, - /// send servers in forward order - SERVERORDER = 0x02, -}; -ENUM_BITWISE_OPERATORS(VERSION_2) -} -using e::VERSION_2; - //------------------------------ // Writing function of logs file //------------------------------ @@ -729,7 +718,7 @@ auto iter_char_sessions() -> decltype(filter_iterator<Session *>(&server_session // Send GM accounts to all char-server //----------------------------------------------------- static -void send_GM_accounts(void) +void send_GM_accounts(Session *only=nullptr) { std::vector<Packet_Repeat<0x2732>> tail; @@ -744,6 +733,11 @@ void send_GM_accounts(void) tail.push_back(item); } } + if (only) + { + send_packet_repeatonly<0x2732, 4, 5>(only, tail); + return; + } for (Session *ss : iter_char_sessions()) { send_packet_repeatonly<0x2732, 4, 5>(ss, tail); @@ -2861,59 +2855,47 @@ static void parse_login(Session *s) { struct mmo_account account; - int result, j; + int result; IP4Address ip = s->client_ip; - - while (RFIFOREST(s) >= 2) + RecvResult rv = RecvResult::Complete; + uint16_t packet_id; + while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id)) { if (display_parse_login == 1) { - if (RFIFOW(s, 0) == 0x64 || RFIFOW(s, 0) == 0x01dd) + if (packet_id == 0x64) { - if (RFIFOREST(s) >= ((RFIFOW(s, 0) == 0x64) ? 55 : 47)) - { - AccountName account_name = stringish<AccountName>(RFIFO_STRING<24>(s, 6)); - PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu), account: %s.\n"_fmt, - s, RFIFOW(s, 0), RFIFOREST(s), - account_name); - } + // handled below to handle account name } - else if (RFIFOW(s, 0) == 0x2710) + else if (packet_id == 0x2710) { - if (RFIFOREST(s) >= 86) - { - ServerName server_name = stringish<ServerName>(RFIFO_STRING<20>(s, 60)); - PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu), server: %s.\n"_fmt, - s, RFIFOW(s, 0), RFIFOREST(s), - server_name); - } + // handled below to handle server name } else PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu).\n"_fmt, - s, RFIFOW(s, 0), RFIFOREST(s)); + s, packet_id, packet_avail(s)); } - switch (RFIFOW(s, 0)) + switch (packet_id) { - case 0x200: // New alive packet: structure: 0x200 <account.userid>.24B. used to verify if client is always alive. - if (RFIFOREST(s) < 26) - return; - RFIFOSKIP(s, 26); - break; - - case 0x204: // New alive packet: structure: 0x204 <encrypted.account.userid>.16B. (new ragexe from 22 june 2004) - if (RFIFOREST(s) < 18) - return; - RFIFOSKIP(s, 18); - break; - case 0x64: // Ask connection of a client - if (RFIFOREST(s) < 55) - return; + { + Packet_Fixed<0x0064> fixed; + rv = recv_fpacket<0x0064, 55>(s, fixed); + if (rv != RecvResult::Complete) + break; - account.userid = stringish<AccountName>(RFIFO_STRING<24>(s, 6).to_print()); - account.passwd = stringish<AccountPass>(RFIFO_STRING<24>(s, 30).to_print()); + // formerly at top of while + { + AccountName account_name = fixed.account_name; + PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu), account: %s.\n"_fmt, + s, packet_id, packet_avail(s), + account_name); + } + + account.userid = fixed.account_name; + account.passwd = fixed.account_pass; account.passwdenc = 0; LOGIN_LOG("Request for connection (non encryption mode) of %s (ip: %s).\n"_fmt, @@ -2923,18 +2905,18 @@ void parse_login(Session *s) { LOGIN_LOG("Connection refused: IP isn't authorised (deny/allow, ip: %s).\n"_fmt, ip); - WFIFOW(s, 0) = 0x6a; - WFIFOB(s, 2) = 0x03; - WFIFO_ZERO(s, 3, 20); - WFIFOSET(s, 23); - RFIFOSKIP(s, 55); + + Packet_Fixed<0x006a> fixed_6a; + fixed_6a.error_code = 0x03; + fixed_6a.error_message = {}; + send_fpacket<0x006a, 23>(s, fixed_6a); break; } result = mmo_auth(&account, s); if (result == -1) { - VERSION_2 version_2 = static_cast<VERSION_2>(RFIFOB(s, 54)); + VERSION_2 version_2 = fixed.version_2_flags; if (!bool(version_2 & VERSION_2::UPDATEHOST) || !bool(version_2 & VERSION_2::SERVERORDER)) result = 5; // client too old @@ -2947,9 +2929,9 @@ void parse_login(Session *s) LOGIN_LOG("Connection refused: the minimum GM level for connection is %d (account: %s, GM level: %d, ip: %s).\n"_fmt, min_level_to_connect, account.userid, gm_level, ip); - WFIFOW(s, 0) = 0x81; - WFIFOB(s, 2) = 1; // 01 = Server closed - WFIFOSET(s, 3); + Packet_Fixed<0x0081> fixed_81; + fixed_81.error_code = 1; // 01 = Server closed + send_fpacket<0x0081, 3>(s, fixed_81); } else { @@ -2977,45 +2959,43 @@ void parse_login(Session *s) { if (update_host) { - size_t host_len = update_host.size() + 1; - WFIFOW(s, 0) = 0x63; - WFIFOW(s, 2) = 4 + host_len; - WFIFO_STRING(s, 4, update_host, host_len); - WFIFOSET(s, 4 + host_len); + send_packet_repeatonly<0x0063, 4, 1>(s, update_host); } } // Load list of char servers into outbound packet - int server_num = 0; + std::vector<Packet_Repeat<0x0069>> repeat_69; // if (version_2 & VERSION_2_SERVERORDER) for (int i = 0; i < MAX_SERVERS; i++) { if (server_session[i]) { + Packet_Repeat<0x0069> info; if (lan_ip_check(ip)) - WFIFOIP(s, 47 + server_num * 32) = lan_char_ip; + info.ip = lan_char_ip; else - WFIFOIP(s, 47 + server_num * 32) = server[i].ip; - WFIFOW(s, 47 + server_num * 32 + 4) = server[i].port; - WFIFO_STRING(s, 47 + server_num * 32 + 6, server[i].name, 20); - WFIFOW(s, 47 + server_num * 32 + 26) = server[i].users; - WFIFOW(s, 47 + server_num * 32 + 28) = 0; //maintenance; - WFIFOW(s, 47 + server_num * 32 + 30) = 0; //is_new; - server_num++; + info.ip = server[i].ip; + info.port = server[i].port; + info.server_name = server[i].name; + info.users = server[i].users; + info.maintenance = 0; //maintenance; + info.is_new = 0; //is_new; + repeat_69.push_back(info); } } // if at least 1 char-server - if (server_num > 0) + if (repeat_69.size()) { - WFIFOW(s, 0) = 0x69; - WFIFOW(s, 2) = 47 + 32 * server_num; - WFIFOL(s, 4) = account.login_id1; - WFIFOL(s, 8) = unwrap<AccountId>(account.account_id); - WFIFOL(s, 12) = account.login_id2; - WFIFOL(s, 16) = 0; // in old version, that was for ip (not more used) - WFIFO_STRING(s, 20, account.lastlogin, 24); // in old version, that was for name (not more used) - WFIFOB(s, 46) = static_cast<uint8_t>(account.sex); - WFIFOSET(s, 47 + 32 * server_num); + Packet_Head<0x0069> head_69; + head_69.login_id1 = account.login_id1; + head_69.account_id = account.account_id; + head_69.login_id2 = account.login_id2; + head_69.unused = 0; // in old version, that was for ip (not more used) + head_69.last_login_string = account.lastlogin; // in old version, that was for name (not more used) + head_69.unused2 = 0; + head_69.sex = account.sex; + send_vpacket<0x0069, 47, 32>(s, head_69, repeat_69); + if (auth_fifo_pos >= AUTH_FIFO_SIZE) auth_fifo_pos = 0; auth_fifo[auth_fifo_pos].account_id = @@ -3035,17 +3015,16 @@ void parse_login(Session *s) { LOGIN_LOG("Connection refused: there is no char-server online (account: %s, ip: %s).\n"_fmt, account.userid, ip); - WFIFOW(s, 0) = 0x81; - WFIFOB(s, 2) = 1; // 01 = Server closed - WFIFOSET(s, 3); + Packet_Fixed<0x0081> fixed_81; + fixed_81.error_code = 1; // 01 = Server closed + send_fpacket<0x0081, 3>(s, fixed_81); } } } else { - WFIFO_ZERO(s, 0, 23); - WFIFOW(s, 0) = 0x6a; - WFIFOB(s, 2) = result; + Packet_Fixed<0x006a> fixed_6a; + fixed_6a.error_code = result; if (result == 6) { // 6 = Your are Prohibited to log in until %s @@ -3057,31 +3036,42 @@ void parse_login(Session *s) // if account is banned, we send ban timestamp timestamp_seconds_buffer tmpstr; stamp_time(tmpstr, &ad->ban_until_time); - WFIFO_STRING(s, 3, tmpstr, 20); + fixed_6a.error_message = tmpstr; } else { // we send error message - WFIFO_STRING(s, 3, ad->error_message, 20); + fixed_6a.error_message = ad->error_message; } } } - WFIFOSET(s, 23); + send_fpacket<0x006a, 23>(s, fixed_6a); } - RFIFOSKIP(s, (RFIFOW(s, 0) == 0x64) ? 55 : 47); break; + } case 0x2710: // Connection request of a char-server - if (RFIFOREST(s) < 86) - return; + { + Packet_Fixed<0x2710> fixed; + rv = recv_fpacket<0x2710, 86>(s, fixed); + if (rv != RecvResult::Complete) + break; + + // formerly at top of while + { + ServerName server_name = stringish<ServerName>(fixed.server_name); + PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu), server: %s.\n"_fmt, + s, packet_id, packet_avail(s), + server_name); + } + { // TODO: this is exceptionally silly. Fix it. - int len; - account.userid = stringish<AccountName>(RFIFO_STRING<24>(s, 2).to_print()); - account.passwd = stringish<AccountPass>(RFIFO_STRING<24>(s, 26).to_print()); + account.userid = stringish<AccountName>(fixed.account_name.to_print()); + account.passwd = stringish<AccountPass>(fixed.account_pass.to_print()); account.passwdenc = 0; - ServerName server_name = stringish<ServerName>(RFIFO_STRING<20>(s, 60).to_print()); + ServerName server_name = stringish<ServerName>(fixed.server_name.to_print()); LOGIN_LOG("Connection request of the char-server '%s' @ %s:%d (ip: %s)\n"_fmt, - server_name, RFIFOIP(s, 54), RFIFOW(s, 58), ip); + server_name, fixed.ip, fixed.port, ip); if (account.userid == userid && account.passwd == passwd) { // If this is the main server, and we don't already have a main server @@ -3114,8 +3104,8 @@ void parse_login(Session *s) PRINTF("Connection of the char-server '%s' accepted.\n"_fmt, server_name); server[unwrap<AccountId>(account.account_id)] = mmo_char_server{}; - server[unwrap<AccountId>(account.account_id)].ip = RFIFOIP(s, 54); - server[unwrap<AccountId>(account.account_id)].port = RFIFOW(s, 58); + server[unwrap<AccountId>(account.account_id)].ip = fixed.ip; + server[unwrap<AccountId>(account.account_id)].port = fixed.port; server[unwrap<AccountId>(account.account_id)].name = server_name; server[unwrap<AccountId>(account.account_id)].users = 0; //maintenance = RFIFOW(fd, 82); @@ -3123,24 +3113,16 @@ void parse_login(Session *s) server_session[unwrap<AccountId>(account.account_id)] = s; if (anti_freeze_enable) server_freezeflag[unwrap<AccountId>(account.account_id)] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed - WFIFOW(s, 0) = 0x2711; - WFIFOB(s, 2) = 0; - WFIFOSET(s, 3); + + Packet_Fixed<0x2711> fixed_11; + fixed_11.code = 0; + send_fpacket<0x2711, 3>(s, fixed_11); + s->set_parsers(SessionParsers{.func_parse= parse_fromchar, .func_delete= delete_fromchar}); realloc_fifo(s, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); + // send GM account to char-server - len = 4; - WFIFOW(s, 0) = 0x2732; - for (const AuthData& ad : auth_data) - // send only existing accounts. We can not create a GM account when server is online. - if (GmLevel GM_value = isGM(ad.account_id)) - { - WFIFOL(s, len) = unwrap<AccountId>(ad.account_id); - WFIFOB(s, len + 4) = static_cast<uint8_t>(GM_value.get_all_bits()); - len += 5; - } - WFIFOW(s, 2) = len; - WFIFOSET(s, len); + send_GM_accounts(s); goto x2710_done; } { @@ -3148,39 +3130,56 @@ void parse_login(Session *s) LOGIN_LOG("Connexion of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s)\n"_fmt, server_name, account.userid, account.passwd, ip); - WFIFOW(s, 0) = 0x2711; - WFIFOB(s, 2) = 3; - WFIFOSET(s, 3); + Packet_Fixed<0x2711> fixed_11; + fixed_11.code = 3; + send_fpacket<0x2711, 3>(s, fixed_11); } } x2710_done: - RFIFOSKIP(s, 86); + // justification: we switching the packet parser + parse_fromchar(s); return; + } case 0x7530: // Request of the server version + { + Packet_Fixed<0x7530> fixed; + rv = recv_fpacket<0x7530, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("Sending of the server version (ip: %s)\n"_fmt, ip); - WFIFOW(s, 0) = 0x7531; - { + + Packet_Fixed<0x7531> fixed_31; Version version = CURRENT_LOGIN_SERVER_VERSION; version.flags = new_account ? 1 : 0; - WFIFO_STRUCT(s, 2, version); - WFIFOSET(s, 10); - } - RFIFOSKIP(s, 2); + fixed_31.version = version; + send_fpacket<0x7531, 10>(s, fixed_31); break; + } case 0x7532: // Request to end connection + { + Packet_Fixed<0x7532> fixed; + rv = recv_fpacket<0x7532, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("End of connection (ip: %s)\n"_fmt, ip); s->set_eof(); return; + } case 0x7918: // Request for administation login - if (RFIFOREST(s) < 4 - || RFIFOREST(s) < ((RFIFOW(s, 2) == 0) ? 28 : 20)) - return; - WFIFOW(s, 0) = 0x7919; - WFIFOB(s, 2) = 1; + { + Packet_Fixed<0x7918> fixed; + rv = recv_fpacket<0x7918, 28>(s, fixed); + if (rv != RecvResult::Complete) + break; + + Packet_Fixed<0x7919> fixed_19; + fixed_19.error = 1; if (!check_ladminip(s->client_ip)) { LOGIN_LOG("'ladmin'-login: Connection in administration mode refused: IP isn't authorised (ladmin_allow, ip: %s).\n"_fmt, @@ -3188,10 +3187,10 @@ void parse_login(Session *s) } else { - if (RFIFOW(s, 2) == 0) + if (fixed.encryption_zero == 0) { // non encrypted password - AccountPass password = stringish<AccountPass>(RFIFO_STRING<24>(s, 4).to_print()); + AccountPass password = stringish<AccountPass>(fixed.account_pass.to_print()); // If remote administration is enabled and password sent by client matches password read from login server configuration file if ((admin_state == 1) && (password == admin_pass)) @@ -3199,7 +3198,7 @@ void parse_login(Session *s) LOGIN_LOG("'ladmin'-login: Connection in administration mode accepted (non encrypted password: %s, ip: %s)\n"_fmt, password, ip); PRINTF("Connection of a remote administration accepted (non encrypted password).\n"_fmt); - WFIFOB(s, 2) = 0; + fixed_19.error = 0; s->set_parsers(SessionParsers{.func_parse= parse_admin, .func_delete= delete_admin}); } else if (admin_state != 1) @@ -3218,11 +3217,12 @@ void parse_login(Session *s) } } } - WFIFOSET(s, 3); - RFIFOSKIP(s, (RFIFOW(s, 2) == 0) ? 28 : 20); + send_fpacket<0x7919, 3>(s, fixed_19); break; + } default: + { if (save_unknown_packets) { io::AppendFile logfp(login_log_unknown_packets_filename); @@ -3235,48 +3235,16 @@ void parse_login(Session *s) timestr); FPRINTF(logfp, "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, - s, ip, RFIFOW(s, 0), - RFIFOREST(s)); + s, ip, packet_id, + packet_avail(s)); FPRINTF(logfp, "Detail (in hex):\n"_fmt); - FPRINTF(logfp, - "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F\n"_fmt); - - char tmpstr[16 + 1] {}; - - int i; - for (i = 0; i < RFIFOREST(s); i++) - { - if ((i & 15) == 0) - FPRINTF(logfp, "%04X "_fmt, i); - FPRINTF(logfp, "%02x "_fmt, RFIFOB(s, i)); - if (RFIFOB(s, i) > 0x1f) - tmpstr[i % 16] = RFIFOB(s, i); - else - tmpstr[i % 16] = '.'; - if ((i - 7) % 16 == 0) // -8 + 1 - FPRINTF(logfp, " "_fmt); - else if ((i + 1) % 16 == 0) - { - FPRINTF(logfp, " %s\n"_fmt, tmpstr); - std::fill(tmpstr + 0, tmpstr + 17, '\0'); - } - } - if (i % 16 != 0) - { - for (j = i; j % 16 != 0; j++) - { - FPRINTF(logfp, " "_fmt); - if ((j - 7) % 16 == 0) // -8 + 1 - FPRINTF(logfp, " "_fmt); - } - FPRINTF(logfp, " %s\n"_fmt, tmpstr); - } - FPRINTF(logfp, "\n"_fmt); + packet_dump(logfp, s); } } LOGIN_LOG("End of connection, unknown packet (ip: %s)\n"_fmt, ip); s->set_eof(); return; + } } } return; diff --git a/src/login/types.cpp b/src/login/types.cpp new file mode 100644 index 0000000..854220b --- /dev/null +++ b/src/login/types.cpp @@ -0,0 +1,21 @@ +#include "types.hpp" +// types.cpp - externally useful types from login +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" diff --git a/src/login/types.hpp b/src/login/types.hpp new file mode 100644 index 0000000..ef12f36 --- /dev/null +++ b/src/login/types.hpp @@ -0,0 +1,43 @@ +#ifndef TMWA_LOGIN_TYPES_HPP +#define TMWA_LOGIN_TYPES_HPP +// types.hpp - externally useful types from login +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +# include "fwd.hpp" + +# include <cstdint> + +# include "../generic/enum.hpp" + +namespace e +{ +enum class VERSION_2 : uint8_t +{ + /// client supports updatehost + UPDATEHOST = 0x01, + /// send servers in forward order + SERVERORDER = 0x02, +}; +ENUM_BITWISE_OPERATORS(VERSION_2) +} +using e::VERSION_2; + +#endif // TMWA_LOGIN_TYPES_HPP diff --git a/src/net/packets.hpp b/src/net/packets.hpp index c0f3ecb..6146b90 100644 --- a/src/net/packets.hpp +++ b/src/net/packets.hpp @@ -228,6 +228,7 @@ RecvResult recv_vpacket(Session *s, Packet_Head<id>& head, std::vector<Packet_Re return rv; } + // convenience for trailing strings template<uint16_t id, uint16_t headsize, uint16_t repeatsize> @@ -322,4 +323,36 @@ RecvResult recv_packet_repeatonly(Session *s, std::vector<Packet_Repeat<id>>& v) return recv_vpacket<id, 4, repeatsize>(s, head, v); } + +// and the combination of both of the above + +template<uint16_t id, uint16_t headsize, uint16_t repeatsize> +void send_packet_repeatonly(Session *s, const XString& repeat) +{ + static_assert(id == Packet_Head<id>::PACKET_ID, "Packet_Head<id>::PACKET_ID"); + static_assert(headsize == sizeof(NetPacket_Head<id>), "repeat headsize"); + static_assert(headsize == 4, "repeat headsize"); + static_assert(id == Packet_Repeat<id>::PACKET_ID, "Packet_Repeat<id>::PACKET_ID"); + static_assert(repeatsize == sizeof(NetPacket_Repeat<id>), "sizeof(NetPacket_Repeat<id>)"); + static_assert(repeatsize == 1, "repeatsize"); + + Packet_Head<id> head; + send_vpacket<id, 4, repeatsize>(s, head, repeat); +} + +template<uint16_t id, uint16_t headsize, uint16_t repeatsize> +__attribute__((warn_unused_result)) +RecvResult recv_packet_repeatonly(Session *s, AString& repeat) +{ + static_assert(id == Packet_Head<id>::PACKET_ID, "Packet_Head<id>::PACKET_ID"); + static_assert(headsize == sizeof(NetPacket_Head<id>), "repeat headsize"); + static_assert(headsize == 4, "repeat headsize"); + static_assert(id == Packet_Repeat<id>::PACKET_ID, "Packet_Repeat<id>::PACKET_ID"); + static_assert(repeatsize == sizeof(NetPacket_Repeat<id>), "sizeof(NetPacket_Repeat<id>)"); + static_assert(repeatsize == 1, "repeatsize"); + + Packet_Head<id> head; + return recv_vpacket<id, 4, repeatsize>(s, head, repeat); +} + #endif // TMWA_NET_PACKETS_HPP diff --git a/src/proto2/any-user.hpp b/src/proto2/any-user.hpp index ea2e20d..d704233 100644 --- a/src/proto2/any-user.hpp +++ b/src/proto2/any-user.hpp @@ -35,6 +35,7 @@ struct Packet_Fixed<0x7530> // TODO remove this uint16_t magic_packet_id = PACKET_ID; }; + template<> struct Packet_Fixed<0x7531> { @@ -44,6 +45,7 @@ struct Packet_Fixed<0x7531> uint16_t magic_packet_id = PACKET_ID; Version version = {}; }; + template<> struct Packet_Fixed<0x7532> { @@ -53,6 +55,7 @@ struct Packet_Fixed<0x7532> uint16_t magic_packet_id = PACKET_ID; }; + template<> struct NetPacket_Fixed<0x7530> { @@ -60,6 +63,7 @@ struct NetPacket_Fixed<0x7530> }; static_assert(offsetof(NetPacket_Fixed<0x7530>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7530>, magic_packet_id) == 0"); static_assert(sizeof(NetPacket_Fixed<0x7530>) == 2, "sizeof(NetPacket_Fixed<0x7530>) == 2"); + template<> struct NetPacket_Fixed<0x7531> { @@ -69,6 +73,7 @@ struct NetPacket_Fixed<0x7531> static_assert(offsetof(NetPacket_Fixed<0x7531>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7531>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x7531>, version) == 2, "offsetof(NetPacket_Fixed<0x7531>, version) == 2"); static_assert(sizeof(NetPacket_Fixed<0x7531>) == 10, "sizeof(NetPacket_Fixed<0x7531>) == 10"); + template<> struct NetPacket_Fixed<0x7532> { @@ -77,6 +82,7 @@ struct NetPacket_Fixed<0x7532> static_assert(offsetof(NetPacket_Fixed<0x7532>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7532>, magic_packet_id) == 0"); static_assert(sizeof(NetPacket_Fixed<0x7532>) == 2, "sizeof(NetPacket_Fixed<0x7532>) == 2"); + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7530> *network, Packet_Fixed<0x7530> native) { @@ -91,6 +97,7 @@ bool network_to_native(Packet_Fixed<0x7530> *native, NetPacket_Fixed<0x7530> net rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7531> *network, Packet_Fixed<0x7531> native) { @@ -107,6 +114,7 @@ bool network_to_native(Packet_Fixed<0x7531> *native, NetPacket_Fixed<0x7531> net rv &= network_to_native(&native->version, network.version); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7532> *network, Packet_Fixed<0x7532> native) { @@ -122,4 +130,5 @@ bool network_to_native(Packet_Fixed<0x7532> *native, NetPacket_Fixed<0x7532> net return rv; } + #endif // TMWA_PROTO2_ANY_USER_HPP diff --git a/src/proto2/fwd.hpp b/src/proto2/fwd.hpp index f8dc786..f050ab4 100644 --- a/src/proto2/fwd.hpp +++ b/src/proto2/fwd.hpp @@ -34,30 +34,47 @@ template<> struct Packet_Fixed<0x2709>; template<> struct NetPacket_Fixed<0x2709>; + +template<> +struct Packet_Fixed<0x2710>; +template<> +struct NetPacket_Fixed<0x2710>; + +template<> +struct Packet_Fixed<0x2711>; +template<> +struct NetPacket_Fixed<0x2711>; + template<> struct Packet_Fixed<0x2712>; template<> struct NetPacket_Fixed<0x2712>; + template<> struct Packet_Fixed<0x2713>; template<> struct NetPacket_Fixed<0x2713>; + template<> struct Packet_Fixed<0x2714>; template<> struct NetPacket_Fixed<0x2714>; + template<> struct Packet_Fixed<0x2715>; template<> struct NetPacket_Fixed<0x2715>; + template<> struct Packet_Fixed<0x2716>; template<> struct NetPacket_Fixed<0x2716>; + template<> struct Packet_Fixed<0x2717>; template<> struct NetPacket_Fixed<0x2717>; + template<> struct Packet_Head<0x2720>; template<> @@ -66,30 +83,37 @@ template<> struct Packet_Repeat<0x2720>; template<> struct NetPacket_Repeat<0x2720>; + template<> struct Packet_Fixed<0x2721>; template<> struct NetPacket_Fixed<0x2721>; + template<> struct Packet_Fixed<0x2722>; template<> struct NetPacket_Fixed<0x2722>; + template<> struct Packet_Fixed<0x2723>; template<> struct NetPacket_Fixed<0x2723>; + template<> struct Packet_Fixed<0x2724>; template<> struct NetPacket_Fixed<0x2724>; + template<> struct Packet_Fixed<0x2725>; template<> struct NetPacket_Fixed<0x2725>; + template<> struct Packet_Fixed<0x2727>; template<> struct NetPacket_Fixed<0x2727>; + template<> struct Packet_Head<0x2728>; template<> @@ -98,6 +122,7 @@ template<> struct Packet_Repeat<0x2728>; template<> struct NetPacket_Repeat<0x2728>; + template<> struct Packet_Head<0x2729>; template<> @@ -106,18 +131,22 @@ template<> struct Packet_Repeat<0x2729>; template<> struct NetPacket_Repeat<0x2729>; + template<> struct Packet_Fixed<0x272a>; template<> struct NetPacket_Fixed<0x272a>; + template<> struct Packet_Fixed<0x2730>; template<> struct NetPacket_Fixed<0x2730>; + template<> struct Packet_Fixed<0x2731>; template<> struct NetPacket_Fixed<0x2731>; + template<> struct Packet_Head<0x2732>; template<> @@ -126,15 +155,18 @@ template<> struct Packet_Repeat<0x2732>; template<> struct NetPacket_Repeat<0x2732>; + template<> struct Packet_Fixed<0x2740>; template<> struct NetPacket_Fixed<0x2740>; + template<> struct Packet_Fixed<0x2741>; template<> struct NetPacket_Fixed<0x2741>; + template<> struct Packet_Head<0x2726>; template<> @@ -143,10 +175,22 @@ template<> struct Packet_Repeat<0x2726>; template<> struct NetPacket_Repeat<0x2726>; + +template<> +struct Packet_Fixed<0x7918>; +template<> +struct NetPacket_Fixed<0x7918>; + +template<> +struct Packet_Fixed<0x7919>; +template<> +struct NetPacket_Fixed<0x7919>; + template<> struct Packet_Fixed<0x7920>; template<> struct NetPacket_Fixed<0x7920>; + template<> struct Packet_Head<0x7921>; template<> @@ -155,50 +199,62 @@ template<> struct Packet_Repeat<0x7921>; template<> struct NetPacket_Repeat<0x7921>; + template<> struct Packet_Fixed<0x7924>; template<> struct NetPacket_Fixed<0x7924>; + template<> struct Packet_Fixed<0x7925>; template<> struct NetPacket_Fixed<0x7925>; + template<> struct Packet_Fixed<0x7930>; template<> struct NetPacket_Fixed<0x7930>; + template<> struct Packet_Fixed<0x7931>; template<> struct NetPacket_Fixed<0x7931>; + template<> struct Packet_Fixed<0x7932>; template<> struct NetPacket_Fixed<0x7932>; + template<> struct Packet_Fixed<0x7933>; template<> struct NetPacket_Fixed<0x7933>; + template<> struct Packet_Fixed<0x7934>; template<> struct NetPacket_Fixed<0x7934>; + template<> struct Packet_Fixed<0x7935>; template<> struct NetPacket_Fixed<0x7935>; + template<> struct Packet_Fixed<0x7936>; template<> struct NetPacket_Fixed<0x7936>; + template<> struct Packet_Fixed<0x7937>; template<> struct NetPacket_Fixed<0x7937>; + template<> struct Packet_Fixed<0x7938>; template<> struct NetPacket_Fixed<0x7938>; + template<> struct Packet_Head<0x7939>; template<> @@ -207,38 +263,47 @@ template<> struct Packet_Repeat<0x7939>; template<> struct NetPacket_Repeat<0x7939>; + template<> struct Packet_Fixed<0x793a>; template<> struct NetPacket_Fixed<0x793a>; + template<> struct Packet_Fixed<0x793b>; template<> struct NetPacket_Fixed<0x793b>; + template<> struct Packet_Fixed<0x793c>; template<> struct NetPacket_Fixed<0x793c>; + template<> struct Packet_Fixed<0x793d>; template<> struct NetPacket_Fixed<0x793d>; + template<> struct Packet_Fixed<0x793e>; template<> struct NetPacket_Fixed<0x793e>; + template<> struct Packet_Fixed<0x793f>; template<> struct NetPacket_Fixed<0x793f>; + template<> struct Packet_Fixed<0x7940>; template<> struct NetPacket_Fixed<0x7940>; + template<> struct Packet_Fixed<0x7941>; template<> struct NetPacket_Fixed<0x7941>; + template<> struct Packet_Head<0x7942>; template<> @@ -247,50 +312,62 @@ template<> struct Packet_Repeat<0x7942>; template<> struct NetPacket_Repeat<0x7942>; + template<> struct Packet_Fixed<0x7943>; template<> struct NetPacket_Fixed<0x7943>; + template<> struct Packet_Fixed<0x7944>; template<> struct NetPacket_Fixed<0x7944>; + template<> struct Packet_Fixed<0x7945>; template<> struct NetPacket_Fixed<0x7945>; + template<> struct Packet_Fixed<0x7946>; template<> struct NetPacket_Fixed<0x7946>; + template<> struct Packet_Fixed<0x7947>; template<> struct NetPacket_Fixed<0x7947>; + template<> struct Packet_Fixed<0x7948>; template<> struct NetPacket_Fixed<0x7948>; + template<> struct Packet_Fixed<0x7949>; template<> struct NetPacket_Fixed<0x7949>; + template<> struct Packet_Fixed<0x794a>; template<> struct NetPacket_Fixed<0x794a>; + template<> struct Packet_Fixed<0x794b>; template<> struct NetPacket_Fixed<0x794b>; + template<> struct Packet_Fixed<0x794c>; template<> struct NetPacket_Fixed<0x794c>; + template<> struct Packet_Fixed<0x794d>; template<> struct NetPacket_Fixed<0x794d>; + template<> struct Packet_Head<0x794e>; template<> @@ -299,22 +376,27 @@ template<> struct Packet_Repeat<0x794e>; template<> struct NetPacket_Repeat<0x794e>; + template<> struct Packet_Fixed<0x794f>; template<> struct NetPacket_Fixed<0x794f>; + template<> struct Packet_Fixed<0x7950>; template<> struct NetPacket_Fixed<0x7950>; + template<> struct Packet_Fixed<0x7951>; template<> struct NetPacket_Fixed<0x7951>; + template<> struct Packet_Fixed<0x7952>; template<> struct NetPacket_Fixed<0x7952>; + template<> struct Packet_Head<0x7953>; template<> @@ -323,16 +405,52 @@ template<> struct Packet_Repeat<0x7953>; template<> struct NetPacket_Repeat<0x7953>; + template<> struct Packet_Fixed<0x7954>; template<> struct NetPacket_Fixed<0x7954>; + template<> struct Packet_Fixed<0x7955>; template<> struct NetPacket_Fixed<0x7955>; +template<> +struct Packet_Head<0x0063>; +template<> +struct NetPacket_Head<0x0063>; +template<> +struct Packet_Repeat<0x0063>; +template<> +struct NetPacket_Repeat<0x0063>; + +template<> +struct Packet_Fixed<0x0064>; +template<> +struct NetPacket_Fixed<0x0064>; + +template<> +struct Packet_Head<0x0069>; +template<> +struct NetPacket_Head<0x0069>; +template<> +struct Packet_Repeat<0x0069>; +template<> +struct NetPacket_Repeat<0x0069>; + +template<> +struct Packet_Fixed<0x006a>; +template<> +struct NetPacket_Fixed<0x006a>; + +template<> +struct Packet_Fixed<0x0081>; +template<> +struct NetPacket_Fixed<0x0081>; + + template<> @@ -340,18 +458,22 @@ struct Packet_Fixed<0x0212>; template<> struct NetPacket_Fixed<0x0212>; + template<> struct Packet_Fixed<0x7530>; template<> struct NetPacket_Fixed<0x7530>; + template<> struct Packet_Fixed<0x7531>; template<> struct NetPacket_Fixed<0x7531>; + template<> struct Packet_Fixed<0x7532>; template<> struct NetPacket_Fixed<0x7532>; + #endif // TMWA_PROTO2_FWD_HPP diff --git a/src/proto2/include_types_test.cpp b/src/proto2/include_types_test.cpp new file mode 100644 index 0000000..7927f37 --- /dev/null +++ b/src/proto2/include_types_test.cpp @@ -0,0 +1,23 @@ +#include "../login/types.hpp" +// include_types_test.cpp - testsuite for protocol includes +// +// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> +// +// This file is part of The Mana World (Athena server) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include "../poison.hpp" + +using Test_VERSION_2 = VERSION_2; diff --git a/src/proto2/login-admin.hpp b/src/proto2/login-admin.hpp index fed3ad6..f5cf0f7 100644 --- a/src/proto2/login-admin.hpp +++ b/src/proto2/login-admin.hpp @@ -45,6 +45,28 @@ struct Packet_Repeat<0x2726> uint8_t c = {}; }; + +template<> +struct Packet_Fixed<0x7918> +{ + static const uint16_t PACKET_ID = 0x7918; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + uint16_t encryption_zero = {}; + AccountPass account_pass = {}; +}; + +template<> +struct Packet_Fixed<0x7919> +{ + static const uint16_t PACKET_ID = 0x7919; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + uint8_t error = {}; +}; + template<> struct Packet_Fixed<0x7920> { @@ -55,6 +77,7 @@ struct Packet_Fixed<0x7920> AccountId start_account_id = {}; AccountId end_account_id = {}; }; + template<> struct Packet_Head<0x7921> { @@ -77,6 +100,7 @@ struct Packet_Repeat<0x7921> uint32_t login_count = {}; uint32_t status = {}; }; + template<> struct Packet_Fixed<0x7924> { @@ -87,6 +111,7 @@ struct Packet_Fixed<0x7924> ItemNameId source_item_id = {}; ItemNameId dest_item_id = {}; }; + template<> struct Packet_Fixed<0x7925> { @@ -95,6 +120,7 @@ struct Packet_Fixed<0x7925> // TODO remove this uint16_t magic_packet_id = PACKET_ID; }; + template<> struct Packet_Fixed<0x7930> { @@ -107,6 +133,7 @@ struct Packet_Fixed<0x7930> SEX sex = {}; AccountEmail email = {}; }; + template<> struct Packet_Fixed<0x7931> { @@ -117,6 +144,7 @@ struct Packet_Fixed<0x7931> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7932> { @@ -126,6 +154,7 @@ struct Packet_Fixed<0x7932> uint16_t magic_packet_id = PACKET_ID; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7933> { @@ -136,6 +165,7 @@ struct Packet_Fixed<0x7933> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7934> { @@ -146,6 +176,7 @@ struct Packet_Fixed<0x7934> AccountName account_name = {}; AccountPass password = {}; }; + template<> struct Packet_Fixed<0x7935> { @@ -156,6 +187,7 @@ struct Packet_Fixed<0x7935> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7936> { @@ -167,6 +199,7 @@ struct Packet_Fixed<0x7936> uint32_t status = {}; timestamp_seconds_buffer error_message = {}; }; + template<> struct Packet_Fixed<0x7937> { @@ -178,6 +211,7 @@ struct Packet_Fixed<0x7937> AccountName account_name = {}; uint32_t status = {}; }; + template<> struct Packet_Fixed<0x7938> { @@ -186,6 +220,7 @@ struct Packet_Fixed<0x7938> // TODO remove this uint16_t magic_packet_id = PACKET_ID; }; + template<> struct Packet_Head<0x7939> { @@ -208,6 +243,7 @@ struct Packet_Repeat<0x7939> uint16_t maintenance = {}; uint16_t is_new = {}; }; + template<> struct Packet_Fixed<0x793a> { @@ -218,6 +254,7 @@ struct Packet_Fixed<0x793a> AccountName account_name = {}; AccountPass password = {}; }; + template<> struct Packet_Fixed<0x793b> { @@ -228,6 +265,7 @@ struct Packet_Fixed<0x793b> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x793c> { @@ -238,6 +276,7 @@ struct Packet_Fixed<0x793c> AccountName account_name = {}; SEX sex = {}; }; + template<> struct Packet_Fixed<0x793d> { @@ -248,6 +287,7 @@ struct Packet_Fixed<0x793d> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x793e> { @@ -258,6 +298,7 @@ struct Packet_Fixed<0x793e> AccountName account_name = {}; GmLevel gm_level = {}; }; + template<> struct Packet_Fixed<0x793f> { @@ -268,6 +309,7 @@ struct Packet_Fixed<0x793f> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7940> { @@ -278,6 +320,7 @@ struct Packet_Fixed<0x7940> AccountName account_name = {}; AccountEmail email = {}; }; + template<> struct Packet_Fixed<0x7941> { @@ -288,6 +331,7 @@ struct Packet_Fixed<0x7941> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Head<0x7942> { @@ -306,6 +350,7 @@ struct Packet_Repeat<0x7942> uint8_t c = {}; }; + template<> struct Packet_Fixed<0x7943> { @@ -316,6 +361,7 @@ struct Packet_Fixed<0x7943> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7944> { @@ -325,6 +371,7 @@ struct Packet_Fixed<0x7944> uint16_t magic_packet_id = PACKET_ID; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7945> { @@ -335,6 +382,7 @@ struct Packet_Fixed<0x7945> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7946> { @@ -344,6 +392,7 @@ struct Packet_Fixed<0x7946> uint16_t magic_packet_id = PACKET_ID; AccountId account_id = {}; }; + template<> struct Packet_Fixed<0x7947> { @@ -354,6 +403,7 @@ struct Packet_Fixed<0x7947> AccountId account_id = {}; AccountName account_name = {}; }; + template<> struct Packet_Fixed<0x7948> { @@ -364,6 +414,7 @@ struct Packet_Fixed<0x7948> AccountName account_name = {}; TimeT valid_until = {}; }; + template<> struct Packet_Fixed<0x7949> { @@ -375,6 +426,7 @@ struct Packet_Fixed<0x7949> AccountName account_name = {}; TimeT valid_until = {}; }; + template<> struct Packet_Fixed<0x794a> { @@ -385,6 +437,7 @@ struct Packet_Fixed<0x794a> AccountName account_name = {}; TimeT ban_until = {}; }; + template<> struct Packet_Fixed<0x794b> { @@ -396,6 +449,7 @@ struct Packet_Fixed<0x794b> AccountName account_name = {}; TimeT ban_until = {}; }; + template<> struct Packet_Fixed<0x794c> { @@ -406,6 +460,7 @@ struct Packet_Fixed<0x794c> AccountName account_name = {}; HumanTimeDiff ban_add = {}; }; + template<> struct Packet_Fixed<0x794d> { @@ -417,6 +472,7 @@ struct Packet_Fixed<0x794d> AccountName account_name = {}; TimeT ban_until = {}; }; + template<> struct Packet_Head<0x794e> { @@ -435,6 +491,7 @@ struct Packet_Repeat<0x794e> uint8_t c = {}; }; + template<> struct Packet_Fixed<0x794f> { @@ -444,6 +501,7 @@ struct Packet_Fixed<0x794f> uint16_t magic_packet_id = PACKET_ID; uint16_t error = {}; }; + template<> struct Packet_Fixed<0x7950> { @@ -454,6 +512,7 @@ struct Packet_Fixed<0x7950> AccountName account_name = {}; HumanTimeDiff valid_add = {}; }; + template<> struct Packet_Fixed<0x7951> { @@ -465,6 +524,7 @@ struct Packet_Fixed<0x7951> AccountName account_name = {}; TimeT valid_until = {}; }; + template<> struct Packet_Fixed<0x7952> { @@ -474,6 +534,7 @@ struct Packet_Fixed<0x7952> uint16_t magic_packet_id = PACKET_ID; AccountName account_name = {}; }; + template<> struct Packet_Head<0x7953> { @@ -503,6 +564,7 @@ struct Packet_Repeat<0x7953> uint8_t c = {}; }; + template<> struct Packet_Fixed<0x7954> { @@ -512,6 +574,7 @@ struct Packet_Fixed<0x7954> uint16_t magic_packet_id = PACKET_ID; AccountId account_id = {}; }; + template<> struct Packet_Fixed<0x7955> { @@ -521,6 +584,7 @@ struct Packet_Fixed<0x7955> uint16_t magic_packet_id = PACKET_ID; }; + template<> struct NetPacket_Head<0x2726> { @@ -539,6 +603,29 @@ struct NetPacket_Repeat<0x2726> }; static_assert(offsetof(NetPacket_Repeat<0x2726>, c) == 0, "offsetof(NetPacket_Repeat<0x2726>, c) == 0"); static_assert(sizeof(NetPacket_Repeat<0x2726>) == 1, "sizeof(NetPacket_Repeat<0x2726>) == 1"); + +template<> +struct NetPacket_Fixed<0x7918> +{ + Little16 magic_packet_id; + Little16 encryption_zero; + NetString<sizeof(AccountPass)> account_pass; +}; +static_assert(offsetof(NetPacket_Fixed<0x7918>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7918>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x7918>, encryption_zero) == 2, "offsetof(NetPacket_Fixed<0x7918>, encryption_zero) == 2"); +static_assert(offsetof(NetPacket_Fixed<0x7918>, account_pass) == 4, "offsetof(NetPacket_Fixed<0x7918>, account_pass) == 4"); +static_assert(sizeof(NetPacket_Fixed<0x7918>) == 28, "sizeof(NetPacket_Fixed<0x7918>) == 28"); + +template<> +struct NetPacket_Fixed<0x7919> +{ + Little16 magic_packet_id; + Byte error; +}; +static_assert(offsetof(NetPacket_Fixed<0x7919>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7919>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x7919>, error) == 2, "offsetof(NetPacket_Fixed<0x7919>, error) == 2"); +static_assert(sizeof(NetPacket_Fixed<0x7919>) == 3, "sizeof(NetPacket_Fixed<0x7919>) == 3"); + template<> struct NetPacket_Fixed<0x7920> { @@ -550,6 +637,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7920>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7920>, start_account_id) == 2, "offsetof(NetPacket_Fixed<0x7920>, start_account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7920>, end_account_id) == 6, "offsetof(NetPacket_Fixed<0x7920>, end_account_id) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7920>) == 10, "sizeof(NetPacket_Fixed<0x7920>) == 10"); + template<> struct NetPacket_Head<0x7921> { @@ -576,6 +664,7 @@ static_assert(offsetof(NetPacket_Repeat<0x7921>, sex) == 29, "offsetof(NetPacket static_assert(offsetof(NetPacket_Repeat<0x7921>, login_count) == 30, "offsetof(NetPacket_Repeat<0x7921>, login_count) == 30"); static_assert(offsetof(NetPacket_Repeat<0x7921>, status) == 34, "offsetof(NetPacket_Repeat<0x7921>, status) == 34"); static_assert(sizeof(NetPacket_Repeat<0x7921>) == 38, "sizeof(NetPacket_Repeat<0x7921>) == 38"); + template<> struct NetPacket_Fixed<0x7924> { @@ -587,6 +676,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7924>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7924>, source_item_id) == 2, "offsetof(NetPacket_Fixed<0x7924>, source_item_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7924>, dest_item_id) == 6, "offsetof(NetPacket_Fixed<0x7924>, dest_item_id) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7924>) == 10, "sizeof(NetPacket_Fixed<0x7924>) == 10"); + template<> struct NetPacket_Fixed<0x7925> { @@ -594,6 +684,7 @@ struct NetPacket_Fixed<0x7925> }; static_assert(offsetof(NetPacket_Fixed<0x7925>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7925>, magic_packet_id) == 0"); static_assert(sizeof(NetPacket_Fixed<0x7925>) == 2, "sizeof(NetPacket_Fixed<0x7925>) == 2"); + template<> struct NetPacket_Fixed<0x7930> { @@ -609,6 +700,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7930>, password) == 26, "offsetof(NetPa static_assert(offsetof(NetPacket_Fixed<0x7930>, sex) == 50, "offsetof(NetPacket_Fixed<0x7930>, sex) == 50"); static_assert(offsetof(NetPacket_Fixed<0x7930>, email) == 51, "offsetof(NetPacket_Fixed<0x7930>, email) == 51"); static_assert(sizeof(NetPacket_Fixed<0x7930>) == 91, "sizeof(NetPacket_Fixed<0x7930>) == 91"); + template<> struct NetPacket_Fixed<0x7931> { @@ -620,6 +712,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7931>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7931>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7931>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7931>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7931>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7931>) == 30, "sizeof(NetPacket_Fixed<0x7931>) == 30"); + template<> struct NetPacket_Fixed<0x7932> { @@ -629,6 +722,7 @@ struct NetPacket_Fixed<0x7932> static_assert(offsetof(NetPacket_Fixed<0x7932>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7932>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x7932>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7932>, account_name) == 2"); static_assert(sizeof(NetPacket_Fixed<0x7932>) == 26, "sizeof(NetPacket_Fixed<0x7932>) == 26"); + template<> struct NetPacket_Fixed<0x7933> { @@ -640,6 +734,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7933>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7933>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7933>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7933>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7933>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7933>) == 30, "sizeof(NetPacket_Fixed<0x7933>) == 30"); + template<> struct NetPacket_Fixed<0x7934> { @@ -651,6 +746,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7934>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7934>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7934>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7934>, password) == 26, "offsetof(NetPacket_Fixed<0x7934>, password) == 26"); static_assert(sizeof(NetPacket_Fixed<0x7934>) == 50, "sizeof(NetPacket_Fixed<0x7934>) == 50"); + template<> struct NetPacket_Fixed<0x7935> { @@ -662,6 +758,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7935>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7935>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7935>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7935>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7935>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7935>) == 30, "sizeof(NetPacket_Fixed<0x7935>) == 30"); + template<> struct NetPacket_Fixed<0x7936> { @@ -675,6 +772,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7936>, account_name) == 2, "offsetof(Ne static_assert(offsetof(NetPacket_Fixed<0x7936>, status) == 26, "offsetof(NetPacket_Fixed<0x7936>, status) == 26"); static_assert(offsetof(NetPacket_Fixed<0x7936>, error_message) == 30, "offsetof(NetPacket_Fixed<0x7936>, error_message) == 30"); static_assert(sizeof(NetPacket_Fixed<0x7936>) == 50, "sizeof(NetPacket_Fixed<0x7936>) == 50"); + template<> struct NetPacket_Fixed<0x7937> { @@ -688,6 +786,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7937>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x7937>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7937>, account_name) == 6"); static_assert(offsetof(NetPacket_Fixed<0x7937>, status) == 30, "offsetof(NetPacket_Fixed<0x7937>, status) == 30"); static_assert(sizeof(NetPacket_Fixed<0x7937>) == 34, "sizeof(NetPacket_Fixed<0x7937>) == 34"); + template<> struct NetPacket_Fixed<0x7938> { @@ -695,6 +794,7 @@ struct NetPacket_Fixed<0x7938> }; static_assert(offsetof(NetPacket_Fixed<0x7938>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7938>, magic_packet_id) == 0"); static_assert(sizeof(NetPacket_Fixed<0x7938>) == 2, "sizeof(NetPacket_Fixed<0x7938>) == 2"); + template<> struct NetPacket_Head<0x7939> { @@ -721,6 +821,7 @@ static_assert(offsetof(NetPacket_Repeat<0x7939>, users) == 26, "offsetof(NetPack static_assert(offsetof(NetPacket_Repeat<0x7939>, maintenance) == 28, "offsetof(NetPacket_Repeat<0x7939>, maintenance) == 28"); static_assert(offsetof(NetPacket_Repeat<0x7939>, is_new) == 30, "offsetof(NetPacket_Repeat<0x7939>, is_new) == 30"); static_assert(sizeof(NetPacket_Repeat<0x7939>) == 32, "sizeof(NetPacket_Repeat<0x7939>) == 32"); + template<> struct NetPacket_Fixed<0x793a> { @@ -732,6 +833,7 @@ static_assert(offsetof(NetPacket_Fixed<0x793a>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x793a>, account_name) == 2, "offsetof(NetPacket_Fixed<0x793a>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x793a>, password) == 26, "offsetof(NetPacket_Fixed<0x793a>, password) == 26"); static_assert(sizeof(NetPacket_Fixed<0x793a>) == 50, "sizeof(NetPacket_Fixed<0x793a>) == 50"); + template<> struct NetPacket_Fixed<0x793b> { @@ -743,6 +845,7 @@ static_assert(offsetof(NetPacket_Fixed<0x793b>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x793b>, account_id) == 2, "offsetof(NetPacket_Fixed<0x793b>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x793b>, account_name) == 6, "offsetof(NetPacket_Fixed<0x793b>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x793b>) == 30, "sizeof(NetPacket_Fixed<0x793b>) == 30"); + template<> struct NetPacket_Fixed<0x793c> { @@ -754,6 +857,7 @@ static_assert(offsetof(NetPacket_Fixed<0x793c>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x793c>, account_name) == 2, "offsetof(NetPacket_Fixed<0x793c>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x793c>, sex) == 26, "offsetof(NetPacket_Fixed<0x793c>, sex) == 26"); static_assert(sizeof(NetPacket_Fixed<0x793c>) == 27, "sizeof(NetPacket_Fixed<0x793c>) == 27"); + template<> struct NetPacket_Fixed<0x793d> { @@ -765,6 +869,7 @@ static_assert(offsetof(NetPacket_Fixed<0x793d>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x793d>, account_id) == 2, "offsetof(NetPacket_Fixed<0x793d>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x793d>, account_name) == 6, "offsetof(NetPacket_Fixed<0x793d>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x793d>) == 30, "sizeof(NetPacket_Fixed<0x793d>) == 30"); + template<> struct NetPacket_Fixed<0x793e> { @@ -776,6 +881,7 @@ static_assert(offsetof(NetPacket_Fixed<0x793e>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x793e>, account_name) == 2, "offsetof(NetPacket_Fixed<0x793e>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x793e>, gm_level) == 26, "offsetof(NetPacket_Fixed<0x793e>, gm_level) == 26"); static_assert(sizeof(NetPacket_Fixed<0x793e>) == 27, "sizeof(NetPacket_Fixed<0x793e>) == 27"); + template<> struct NetPacket_Fixed<0x793f> { @@ -787,6 +893,7 @@ static_assert(offsetof(NetPacket_Fixed<0x793f>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x793f>, account_id) == 2, "offsetof(NetPacket_Fixed<0x793f>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x793f>, account_name) == 6, "offsetof(NetPacket_Fixed<0x793f>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x793f>) == 30, "sizeof(NetPacket_Fixed<0x793f>) == 30"); + template<> struct NetPacket_Fixed<0x7940> { @@ -798,6 +905,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7940>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7940>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7940>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7940>, email) == 26, "offsetof(NetPacket_Fixed<0x7940>, email) == 26"); static_assert(sizeof(NetPacket_Fixed<0x7940>) == 66, "sizeof(NetPacket_Fixed<0x7940>) == 66"); + template<> struct NetPacket_Fixed<0x7941> { @@ -809,6 +917,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7941>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7941>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7941>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7941>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7941>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7941>) == 30, "sizeof(NetPacket_Fixed<0x7941>) == 30"); + template<> struct NetPacket_Head<0x7942> { @@ -827,6 +936,7 @@ struct NetPacket_Repeat<0x7942> }; static_assert(offsetof(NetPacket_Repeat<0x7942>, c) == 0, "offsetof(NetPacket_Repeat<0x7942>, c) == 0"); static_assert(sizeof(NetPacket_Repeat<0x7942>) == 1, "sizeof(NetPacket_Repeat<0x7942>) == 1"); + template<> struct NetPacket_Fixed<0x7943> { @@ -838,6 +948,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7943>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7943>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7943>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7943>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7943>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7943>) == 30, "sizeof(NetPacket_Fixed<0x7943>) == 30"); + template<> struct NetPacket_Fixed<0x7944> { @@ -847,6 +958,7 @@ struct NetPacket_Fixed<0x7944> static_assert(offsetof(NetPacket_Fixed<0x7944>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7944>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x7944>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7944>, account_name) == 2"); static_assert(sizeof(NetPacket_Fixed<0x7944>) == 26, "sizeof(NetPacket_Fixed<0x7944>) == 26"); + template<> struct NetPacket_Fixed<0x7945> { @@ -858,6 +970,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7945>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7945>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7945>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7945>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7945>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7945>) == 30, "sizeof(NetPacket_Fixed<0x7945>) == 30"); + template<> struct NetPacket_Fixed<0x7946> { @@ -867,6 +980,7 @@ struct NetPacket_Fixed<0x7946> static_assert(offsetof(NetPacket_Fixed<0x7946>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7946>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x7946>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7946>, account_id) == 2"); static_assert(sizeof(NetPacket_Fixed<0x7946>) == 6, "sizeof(NetPacket_Fixed<0x7946>) == 6"); + template<> struct NetPacket_Fixed<0x7947> { @@ -878,6 +992,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7947>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7947>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7947>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7947>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7947>, account_name) == 6"); static_assert(sizeof(NetPacket_Fixed<0x7947>) == 30, "sizeof(NetPacket_Fixed<0x7947>) == 30"); + template<> struct NetPacket_Fixed<0x7948> { @@ -889,6 +1004,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7948>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7948>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7948>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7948>, valid_until) == 26, "offsetof(NetPacket_Fixed<0x7948>, valid_until) == 26"); static_assert(sizeof(NetPacket_Fixed<0x7948>) == 30, "sizeof(NetPacket_Fixed<0x7948>) == 30"); + template<> struct NetPacket_Fixed<0x7949> { @@ -902,6 +1018,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7949>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x7949>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7949>, account_name) == 6"); static_assert(offsetof(NetPacket_Fixed<0x7949>, valid_until) == 30, "offsetof(NetPacket_Fixed<0x7949>, valid_until) == 30"); static_assert(sizeof(NetPacket_Fixed<0x7949>) == 34, "sizeof(NetPacket_Fixed<0x7949>) == 34"); + template<> struct NetPacket_Fixed<0x794a> { @@ -913,6 +1030,7 @@ static_assert(offsetof(NetPacket_Fixed<0x794a>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x794a>, account_name) == 2, "offsetof(NetPacket_Fixed<0x794a>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x794a>, ban_until) == 26, "offsetof(NetPacket_Fixed<0x794a>, ban_until) == 26"); static_assert(sizeof(NetPacket_Fixed<0x794a>) == 30, "sizeof(NetPacket_Fixed<0x794a>) == 30"); + template<> struct NetPacket_Fixed<0x794b> { @@ -926,6 +1044,7 @@ static_assert(offsetof(NetPacket_Fixed<0x794b>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x794b>, account_name) == 6, "offsetof(NetPacket_Fixed<0x794b>, account_name) == 6"); static_assert(offsetof(NetPacket_Fixed<0x794b>, ban_until) == 30, "offsetof(NetPacket_Fixed<0x794b>, ban_until) == 30"); static_assert(sizeof(NetPacket_Fixed<0x794b>) == 34, "sizeof(NetPacket_Fixed<0x794b>) == 34"); + template<> struct NetPacket_Fixed<0x794c> { @@ -937,6 +1056,7 @@ static_assert(offsetof(NetPacket_Fixed<0x794c>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x794c>, account_name) == 2, "offsetof(NetPacket_Fixed<0x794c>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x794c>, ban_add) == 26, "offsetof(NetPacket_Fixed<0x794c>, ban_add) == 26"); static_assert(sizeof(NetPacket_Fixed<0x794c>) == 38, "sizeof(NetPacket_Fixed<0x794c>) == 38"); + template<> struct NetPacket_Fixed<0x794d> { @@ -950,6 +1070,7 @@ static_assert(offsetof(NetPacket_Fixed<0x794d>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x794d>, account_name) == 6, "offsetof(NetPacket_Fixed<0x794d>, account_name) == 6"); static_assert(offsetof(NetPacket_Fixed<0x794d>, ban_until) == 30, "offsetof(NetPacket_Fixed<0x794d>, ban_until) == 30"); static_assert(sizeof(NetPacket_Fixed<0x794d>) == 34, "sizeof(NetPacket_Fixed<0x794d>) == 34"); + template<> struct NetPacket_Head<0x794e> { @@ -968,6 +1089,7 @@ struct NetPacket_Repeat<0x794e> }; static_assert(offsetof(NetPacket_Repeat<0x794e>, c) == 0, "offsetof(NetPacket_Repeat<0x794e>, c) == 0"); static_assert(sizeof(NetPacket_Repeat<0x794e>) == 1, "sizeof(NetPacket_Repeat<0x794e>) == 1"); + template<> struct NetPacket_Fixed<0x794f> { @@ -977,6 +1099,7 @@ struct NetPacket_Fixed<0x794f> static_assert(offsetof(NetPacket_Fixed<0x794f>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x794f>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x794f>, error) == 2, "offsetof(NetPacket_Fixed<0x794f>, error) == 2"); static_assert(sizeof(NetPacket_Fixed<0x794f>) == 4, "sizeof(NetPacket_Fixed<0x794f>) == 4"); + template<> struct NetPacket_Fixed<0x7950> { @@ -988,6 +1111,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7950>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x7950>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7950>, account_name) == 2"); static_assert(offsetof(NetPacket_Fixed<0x7950>, valid_add) == 26, "offsetof(NetPacket_Fixed<0x7950>, valid_add) == 26"); static_assert(sizeof(NetPacket_Fixed<0x7950>) == 38, "sizeof(NetPacket_Fixed<0x7950>) == 38"); + template<> struct NetPacket_Fixed<0x7951> { @@ -1001,6 +1125,7 @@ static_assert(offsetof(NetPacket_Fixed<0x7951>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x7951>, account_name) == 6, "offsetof(NetPacket_Fixed<0x7951>, account_name) == 6"); static_assert(offsetof(NetPacket_Fixed<0x7951>, valid_until) == 30, "offsetof(NetPacket_Fixed<0x7951>, valid_until) == 30"); static_assert(sizeof(NetPacket_Fixed<0x7951>) == 34, "sizeof(NetPacket_Fixed<0x7951>) == 34"); + template<> struct NetPacket_Fixed<0x7952> { @@ -1010,6 +1135,7 @@ struct NetPacket_Fixed<0x7952> static_assert(offsetof(NetPacket_Fixed<0x7952>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7952>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x7952>, account_name) == 2, "offsetof(NetPacket_Fixed<0x7952>, account_name) == 2"); static_assert(sizeof(NetPacket_Fixed<0x7952>) == 26, "sizeof(NetPacket_Fixed<0x7952>) == 26"); + template<> struct NetPacket_Head<0x7953> { @@ -1050,6 +1176,7 @@ struct NetPacket_Repeat<0x7953> }; static_assert(offsetof(NetPacket_Repeat<0x7953>, c) == 0, "offsetof(NetPacket_Repeat<0x7953>, c) == 0"); static_assert(sizeof(NetPacket_Repeat<0x7953>) == 1, "sizeof(NetPacket_Repeat<0x7953>) == 1"); + template<> struct NetPacket_Fixed<0x7954> { @@ -1059,6 +1186,7 @@ struct NetPacket_Fixed<0x7954> static_assert(offsetof(NetPacket_Fixed<0x7954>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7954>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x7954>, account_id) == 2, "offsetof(NetPacket_Fixed<0x7954>, account_id) == 2"); static_assert(sizeof(NetPacket_Fixed<0x7954>) == 6, "sizeof(NetPacket_Fixed<0x7954>) == 6"); + template<> struct NetPacket_Fixed<0x7955> { @@ -1067,6 +1195,7 @@ struct NetPacket_Fixed<0x7955> static_assert(offsetof(NetPacket_Fixed<0x7955>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x7955>, magic_packet_id) == 0"); static_assert(sizeof(NetPacket_Fixed<0x7955>) == 2, "sizeof(NetPacket_Fixed<0x7955>) == 2"); + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x2726> *network, Packet_Head<0x2726> native) { @@ -1099,6 +1228,43 @@ bool network_to_native(Packet_Repeat<0x2726> *native, NetPacket_Repeat<0x2726> n rv &= network_to_native(&native->c, network.c); return rv; } + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x7918> *network, Packet_Fixed<0x7918> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->encryption_zero, native.encryption_zero); + rv &= native_to_network(&network->account_pass, native.account_pass); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x7918> *native, NetPacket_Fixed<0x7918> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->encryption_zero, network.encryption_zero); + rv &= network_to_native(&native->account_pass, network.account_pass); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x7919> *network, Packet_Fixed<0x7919> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->error, native.error); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x7919> *native, NetPacket_Fixed<0x7919> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->error, network.error); + return rv; +} + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7920> *network, Packet_Fixed<0x7920> native) { @@ -1117,6 +1283,7 @@ bool network_to_native(Packet_Fixed<0x7920> *native, NetPacket_Fixed<0x7920> net rv &= network_to_native(&native->end_account_id, network.end_account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x7921> *network, Packet_Head<0x7921> native) { @@ -1157,6 +1324,7 @@ bool network_to_native(Packet_Repeat<0x7921> *native, NetPacket_Repeat<0x7921> n rv &= network_to_native(&native->status, network.status); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7924> *network, Packet_Fixed<0x7924> native) { @@ -1175,6 +1343,7 @@ bool network_to_native(Packet_Fixed<0x7924> *native, NetPacket_Fixed<0x7924> net rv &= network_to_native(&native->dest_item_id, network.dest_item_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7925> *network, Packet_Fixed<0x7925> native) { @@ -1189,6 +1358,7 @@ bool network_to_native(Packet_Fixed<0x7925> *native, NetPacket_Fixed<0x7925> net rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7930> *network, Packet_Fixed<0x7930> native) { @@ -1211,6 +1381,7 @@ bool network_to_native(Packet_Fixed<0x7930> *native, NetPacket_Fixed<0x7930> net rv &= network_to_native(&native->email, network.email); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7931> *network, Packet_Fixed<0x7931> native) { @@ -1229,6 +1400,7 @@ bool network_to_native(Packet_Fixed<0x7931> *native, NetPacket_Fixed<0x7931> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7932> *network, Packet_Fixed<0x7932> native) { @@ -1245,6 +1417,7 @@ bool network_to_native(Packet_Fixed<0x7932> *native, NetPacket_Fixed<0x7932> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7933> *network, Packet_Fixed<0x7933> native) { @@ -1263,6 +1436,7 @@ bool network_to_native(Packet_Fixed<0x7933> *native, NetPacket_Fixed<0x7933> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7934> *network, Packet_Fixed<0x7934> native) { @@ -1281,6 +1455,7 @@ bool network_to_native(Packet_Fixed<0x7934> *native, NetPacket_Fixed<0x7934> net rv &= network_to_native(&native->password, network.password); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7935> *network, Packet_Fixed<0x7935> native) { @@ -1299,6 +1474,7 @@ bool network_to_native(Packet_Fixed<0x7935> *native, NetPacket_Fixed<0x7935> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7936> *network, Packet_Fixed<0x7936> native) { @@ -1319,6 +1495,7 @@ bool network_to_native(Packet_Fixed<0x7936> *native, NetPacket_Fixed<0x7936> net rv &= network_to_native(&native->error_message, network.error_message); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7937> *network, Packet_Fixed<0x7937> native) { @@ -1339,6 +1516,7 @@ bool network_to_native(Packet_Fixed<0x7937> *native, NetPacket_Fixed<0x7937> net rv &= network_to_native(&native->status, network.status); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7938> *network, Packet_Fixed<0x7938> native) { @@ -1353,6 +1531,7 @@ bool network_to_native(Packet_Fixed<0x7938> *native, NetPacket_Fixed<0x7938> net rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x7939> *network, Packet_Head<0x7939> native) { @@ -1393,6 +1572,7 @@ bool network_to_native(Packet_Repeat<0x7939> *native, NetPacket_Repeat<0x7939> n rv &= network_to_native(&native->is_new, network.is_new); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x793a> *network, Packet_Fixed<0x793a> native) { @@ -1411,6 +1591,7 @@ bool network_to_native(Packet_Fixed<0x793a> *native, NetPacket_Fixed<0x793a> net rv &= network_to_native(&native->password, network.password); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x793b> *network, Packet_Fixed<0x793b> native) { @@ -1429,6 +1610,7 @@ bool network_to_native(Packet_Fixed<0x793b> *native, NetPacket_Fixed<0x793b> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x793c> *network, Packet_Fixed<0x793c> native) { @@ -1447,6 +1629,7 @@ bool network_to_native(Packet_Fixed<0x793c> *native, NetPacket_Fixed<0x793c> net rv &= network_to_native(&native->sex, network.sex); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x793d> *network, Packet_Fixed<0x793d> native) { @@ -1465,6 +1648,7 @@ bool network_to_native(Packet_Fixed<0x793d> *native, NetPacket_Fixed<0x793d> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x793e> *network, Packet_Fixed<0x793e> native) { @@ -1483,6 +1667,7 @@ bool network_to_native(Packet_Fixed<0x793e> *native, NetPacket_Fixed<0x793e> net rv &= network_to_native(&native->gm_level, network.gm_level); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x793f> *network, Packet_Fixed<0x793f> native) { @@ -1501,6 +1686,7 @@ bool network_to_native(Packet_Fixed<0x793f> *native, NetPacket_Fixed<0x793f> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7940> *network, Packet_Fixed<0x7940> native) { @@ -1519,6 +1705,7 @@ bool network_to_native(Packet_Fixed<0x7940> *native, NetPacket_Fixed<0x7940> net rv &= network_to_native(&native->email, network.email); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7941> *network, Packet_Fixed<0x7941> native) { @@ -1537,6 +1724,7 @@ bool network_to_native(Packet_Fixed<0x7941> *native, NetPacket_Fixed<0x7941> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x7942> *network, Packet_Head<0x7942> native) { @@ -1569,6 +1757,7 @@ bool network_to_native(Packet_Repeat<0x7942> *native, NetPacket_Repeat<0x7942> n rv &= network_to_native(&native->c, network.c); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7943> *network, Packet_Fixed<0x7943> native) { @@ -1587,6 +1776,7 @@ bool network_to_native(Packet_Fixed<0x7943> *native, NetPacket_Fixed<0x7943> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7944> *network, Packet_Fixed<0x7944> native) { @@ -1603,6 +1793,7 @@ bool network_to_native(Packet_Fixed<0x7944> *native, NetPacket_Fixed<0x7944> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7945> *network, Packet_Fixed<0x7945> native) { @@ -1621,6 +1812,7 @@ bool network_to_native(Packet_Fixed<0x7945> *native, NetPacket_Fixed<0x7945> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7946> *network, Packet_Fixed<0x7946> native) { @@ -1637,6 +1829,7 @@ bool network_to_native(Packet_Fixed<0x7946> *native, NetPacket_Fixed<0x7946> net rv &= network_to_native(&native->account_id, network.account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7947> *network, Packet_Fixed<0x7947> native) { @@ -1655,6 +1848,7 @@ bool network_to_native(Packet_Fixed<0x7947> *native, NetPacket_Fixed<0x7947> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7948> *network, Packet_Fixed<0x7948> native) { @@ -1673,6 +1867,7 @@ bool network_to_native(Packet_Fixed<0x7948> *native, NetPacket_Fixed<0x7948> net rv &= network_to_native(&native->valid_until, network.valid_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7949> *network, Packet_Fixed<0x7949> native) { @@ -1693,6 +1888,7 @@ bool network_to_native(Packet_Fixed<0x7949> *native, NetPacket_Fixed<0x7949> net rv &= network_to_native(&native->valid_until, network.valid_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x794a> *network, Packet_Fixed<0x794a> native) { @@ -1711,6 +1907,7 @@ bool network_to_native(Packet_Fixed<0x794a> *native, NetPacket_Fixed<0x794a> net rv &= network_to_native(&native->ban_until, network.ban_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x794b> *network, Packet_Fixed<0x794b> native) { @@ -1731,6 +1928,7 @@ bool network_to_native(Packet_Fixed<0x794b> *native, NetPacket_Fixed<0x794b> net rv &= network_to_native(&native->ban_until, network.ban_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x794c> *network, Packet_Fixed<0x794c> native) { @@ -1749,6 +1947,7 @@ bool network_to_native(Packet_Fixed<0x794c> *native, NetPacket_Fixed<0x794c> net rv &= network_to_native(&native->ban_add, network.ban_add); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x794d> *network, Packet_Fixed<0x794d> native) { @@ -1769,6 +1968,7 @@ bool network_to_native(Packet_Fixed<0x794d> *native, NetPacket_Fixed<0x794d> net rv &= network_to_native(&native->ban_until, network.ban_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x794e> *network, Packet_Head<0x794e> native) { @@ -1801,6 +2001,7 @@ bool network_to_native(Packet_Repeat<0x794e> *native, NetPacket_Repeat<0x794e> n rv &= network_to_native(&native->c, network.c); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x794f> *network, Packet_Fixed<0x794f> native) { @@ -1817,6 +2018,7 @@ bool network_to_native(Packet_Fixed<0x794f> *native, NetPacket_Fixed<0x794f> net rv &= network_to_native(&native->error, network.error); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7950> *network, Packet_Fixed<0x7950> native) { @@ -1835,6 +2037,7 @@ bool network_to_native(Packet_Fixed<0x7950> *native, NetPacket_Fixed<0x7950> net rv &= network_to_native(&native->valid_add, network.valid_add); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7951> *network, Packet_Fixed<0x7951> native) { @@ -1855,6 +2058,7 @@ bool network_to_native(Packet_Fixed<0x7951> *native, NetPacket_Fixed<0x7951> net rv &= network_to_native(&native->valid_until, network.valid_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7952> *network, Packet_Fixed<0x7952> native) { @@ -1871,6 +2075,7 @@ bool network_to_native(Packet_Fixed<0x7952> *native, NetPacket_Fixed<0x7952> net rv &= network_to_native(&native->account_name, network.account_name); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x7953> *network, Packet_Head<0x7953> native) { @@ -1925,6 +2130,7 @@ bool network_to_native(Packet_Repeat<0x7953> *native, NetPacket_Repeat<0x7953> n rv &= network_to_native(&native->c, network.c); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7954> *network, Packet_Fixed<0x7954> native) { @@ -1941,6 +2147,7 @@ bool network_to_native(Packet_Fixed<0x7954> *native, NetPacket_Fixed<0x7954> net rv &= network_to_native(&native->account_id, network.account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x7955> *network, Packet_Fixed<0x7955> native) { @@ -1956,4 +2163,5 @@ bool network_to_native(Packet_Fixed<0x7955> *native, NetPacket_Fixed<0x7955> net return rv; } + #endif // TMWA_PROTO2_LOGIN_ADMIN_HPP diff --git a/src/proto2/login-char.hpp b/src/proto2/login-char.hpp index 8f3a99e..6b2004d 100644 --- a/src/proto2/login-char.hpp +++ b/src/proto2/login-char.hpp @@ -35,6 +35,35 @@ struct Packet_Fixed<0x2709> // TODO remove this uint16_t magic_packet_id = PACKET_ID; }; + +template<> +struct Packet_Fixed<0x2710> +{ + static const uint16_t PACKET_ID = 0x2710; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + AccountPass account_pass = {}; + uint32_t unknown = {}; + IP4Address ip = {}; + uint16_t port = {}; + ServerName server_name = {}; + uint16_t unknown2 = {}; + uint16_t maintenance = {}; + uint16_t is_new = {}; +}; + +template<> +struct Packet_Fixed<0x2711> +{ + static const uint16_t PACKET_ID = 0x2711; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + uint8_t code = {}; +}; + template<> struct Packet_Fixed<0x2712> { @@ -48,6 +77,7 @@ struct Packet_Fixed<0x2712> SEX sex = {}; IP4Address ip = {}; }; + template<> struct Packet_Fixed<0x2713> { @@ -60,6 +90,7 @@ struct Packet_Fixed<0x2713> AccountEmail email = {}; TimeT connect_until = {}; }; + template<> struct Packet_Fixed<0x2714> { @@ -69,6 +100,7 @@ struct Packet_Fixed<0x2714> uint16_t magic_packet_id = PACKET_ID; uint32_t users = {}; }; + template<> struct Packet_Fixed<0x2715> { @@ -79,6 +111,7 @@ struct Packet_Fixed<0x2715> AccountId account_id = {}; AccountEmail email = {}; }; + template<> struct Packet_Fixed<0x2716> { @@ -88,6 +121,7 @@ struct Packet_Fixed<0x2716> uint16_t magic_packet_id = PACKET_ID; AccountId account_id = {}; }; + template<> struct Packet_Fixed<0x2717> { @@ -99,6 +133,7 @@ struct Packet_Fixed<0x2717> AccountEmail email = {}; TimeT connect_until = {}; }; + template<> struct Packet_Head<0x2720> { @@ -117,6 +152,7 @@ struct Packet_Repeat<0x2720> uint8_t c = {}; }; + template<> struct Packet_Fixed<0x2721> { @@ -127,6 +163,7 @@ struct Packet_Fixed<0x2721> AccountId account_id = {}; GmLevel gm_level = {}; }; + template<> struct Packet_Fixed<0x2722> { @@ -138,6 +175,7 @@ struct Packet_Fixed<0x2722> AccountEmail old_email = {}; AccountEmail new_email = {}; }; + template<> struct Packet_Fixed<0x2723> { @@ -148,6 +186,7 @@ struct Packet_Fixed<0x2723> AccountId account_id = {}; SEX sex = {}; }; + template<> struct Packet_Fixed<0x2724> { @@ -158,6 +197,7 @@ struct Packet_Fixed<0x2724> AccountId account_id = {}; uint32_t status = {}; }; + template<> struct Packet_Fixed<0x2725> { @@ -168,6 +208,7 @@ struct Packet_Fixed<0x2725> AccountId account_id = {}; HumanTimeDiff deltas = {}; }; + template<> struct Packet_Fixed<0x2727> { @@ -177,6 +218,7 @@ struct Packet_Fixed<0x2727> uint16_t magic_packet_id = PACKET_ID; AccountId account_id = {}; }; + template<> struct Packet_Head<0x2728> { @@ -196,6 +238,7 @@ struct Packet_Repeat<0x2728> VarName name = {}; uint32_t value = {}; }; + template<> struct Packet_Head<0x2729> { @@ -215,6 +258,7 @@ struct Packet_Repeat<0x2729> VarName name = {}; uint32_t value = {}; }; + template<> struct Packet_Fixed<0x272a> { @@ -224,6 +268,7 @@ struct Packet_Fixed<0x272a> uint16_t magic_packet_id = PACKET_ID; AccountId account_id = {}; }; + template<> struct Packet_Fixed<0x2730> { @@ -233,6 +278,7 @@ struct Packet_Fixed<0x2730> uint16_t magic_packet_id = PACKET_ID; AccountId account_id = {}; }; + template<> struct Packet_Fixed<0x2731> { @@ -244,6 +290,7 @@ struct Packet_Fixed<0x2731> uint8_t ban_not_status = {}; TimeT status_or_ban_until = {}; }; + template<> struct Packet_Head<0x2732> { @@ -262,6 +309,7 @@ struct Packet_Repeat<0x2732> AccountId account_id = {}; GmLevel gm_level = {}; }; + template<> struct Packet_Fixed<0x2740> { @@ -273,6 +321,7 @@ struct Packet_Fixed<0x2740> AccountPass old_pass = {}; AccountPass new_pass = {}; }; + template<> struct Packet_Fixed<0x2741> { @@ -284,6 +333,7 @@ struct Packet_Fixed<0x2741> uint8_t status = {}; }; + template<> struct NetPacket_Fixed<0x2709> { @@ -291,6 +341,43 @@ struct NetPacket_Fixed<0x2709> }; static_assert(offsetof(NetPacket_Fixed<0x2709>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2709>, magic_packet_id) == 0"); static_assert(sizeof(NetPacket_Fixed<0x2709>) == 2, "sizeof(NetPacket_Fixed<0x2709>) == 2"); + +template<> +struct NetPacket_Fixed<0x2710> +{ + Little16 magic_packet_id; + NetString<sizeof(AccountName)> account_name; + NetString<sizeof(AccountPass)> account_pass; + Little32 unknown; + IP4Address ip; + Little16 port; + NetString<sizeof(ServerName)> server_name; + Little16 unknown2; + Little16 maintenance; + Little16 is_new; +}; +static_assert(offsetof(NetPacket_Fixed<0x2710>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2710>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, account_name) == 2, "offsetof(NetPacket_Fixed<0x2710>, account_name) == 2"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, account_pass) == 26, "offsetof(NetPacket_Fixed<0x2710>, account_pass) == 26"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, unknown) == 50, "offsetof(NetPacket_Fixed<0x2710>, unknown) == 50"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, ip) == 54, "offsetof(NetPacket_Fixed<0x2710>, ip) == 54"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, port) == 58, "offsetof(NetPacket_Fixed<0x2710>, port) == 58"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, server_name) == 60, "offsetof(NetPacket_Fixed<0x2710>, server_name) == 60"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, unknown2) == 80, "offsetof(NetPacket_Fixed<0x2710>, unknown2) == 80"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, maintenance) == 82, "offsetof(NetPacket_Fixed<0x2710>, maintenance) == 82"); +static_assert(offsetof(NetPacket_Fixed<0x2710>, is_new) == 84, "offsetof(NetPacket_Fixed<0x2710>, is_new) == 84"); +static_assert(sizeof(NetPacket_Fixed<0x2710>) == 86, "sizeof(NetPacket_Fixed<0x2710>) == 86"); + +template<> +struct NetPacket_Fixed<0x2711> +{ + Little16 magic_packet_id; + Byte code; +}; +static_assert(offsetof(NetPacket_Fixed<0x2711>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2711>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x2711>, code) == 2, "offsetof(NetPacket_Fixed<0x2711>, code) == 2"); +static_assert(sizeof(NetPacket_Fixed<0x2711>) == 3, "sizeof(NetPacket_Fixed<0x2711>) == 3"); + template<> struct NetPacket_Fixed<0x2712> { @@ -308,6 +395,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2712>, login_id2) == 10, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x2712>, sex) == 14, "offsetof(NetPacket_Fixed<0x2712>, sex) == 14"); static_assert(offsetof(NetPacket_Fixed<0x2712>, ip) == 15, "offsetof(NetPacket_Fixed<0x2712>, ip) == 15"); static_assert(sizeof(NetPacket_Fixed<0x2712>) == 19, "sizeof(NetPacket_Fixed<0x2712>) == 19"); + template<> struct NetPacket_Fixed<0x2713> { @@ -323,6 +411,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2713>, invalid) == 6, "offsetof(NetPack static_assert(offsetof(NetPacket_Fixed<0x2713>, email) == 7, "offsetof(NetPacket_Fixed<0x2713>, email) == 7"); static_assert(offsetof(NetPacket_Fixed<0x2713>, connect_until) == 47, "offsetof(NetPacket_Fixed<0x2713>, connect_until) == 47"); static_assert(sizeof(NetPacket_Fixed<0x2713>) == 51, "sizeof(NetPacket_Fixed<0x2713>) == 51"); + template<> struct NetPacket_Fixed<0x2714> { @@ -332,6 +421,7 @@ struct NetPacket_Fixed<0x2714> static_assert(offsetof(NetPacket_Fixed<0x2714>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2714>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x2714>, users) == 2, "offsetof(NetPacket_Fixed<0x2714>, users) == 2"); static_assert(sizeof(NetPacket_Fixed<0x2714>) == 6, "sizeof(NetPacket_Fixed<0x2714>) == 6"); + template<> struct NetPacket_Fixed<0x2715> { @@ -343,6 +433,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2715>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x2715>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2715>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x2715>, email) == 6, "offsetof(NetPacket_Fixed<0x2715>, email) == 6"); static_assert(sizeof(NetPacket_Fixed<0x2715>) == 46, "sizeof(NetPacket_Fixed<0x2715>) == 46"); + template<> struct NetPacket_Fixed<0x2716> { @@ -352,6 +443,7 @@ struct NetPacket_Fixed<0x2716> static_assert(offsetof(NetPacket_Fixed<0x2716>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2716>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x2716>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2716>, account_id) == 2"); static_assert(sizeof(NetPacket_Fixed<0x2716>) == 6, "sizeof(NetPacket_Fixed<0x2716>) == 6"); + template<> struct NetPacket_Fixed<0x2717> { @@ -365,6 +457,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2717>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x2717>, email) == 6, "offsetof(NetPacket_Fixed<0x2717>, email) == 6"); static_assert(offsetof(NetPacket_Fixed<0x2717>, connect_until) == 46, "offsetof(NetPacket_Fixed<0x2717>, connect_until) == 46"); static_assert(sizeof(NetPacket_Fixed<0x2717>) == 50, "sizeof(NetPacket_Fixed<0x2717>) == 50"); + template<> struct NetPacket_Head<0x2720> { @@ -383,6 +476,7 @@ struct NetPacket_Repeat<0x2720> }; static_assert(offsetof(NetPacket_Repeat<0x2720>, c) == 0, "offsetof(NetPacket_Repeat<0x2720>, c) == 0"); static_assert(sizeof(NetPacket_Repeat<0x2720>) == 1, "sizeof(NetPacket_Repeat<0x2720>) == 1"); + template<> struct NetPacket_Fixed<0x2721> { @@ -394,6 +488,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2721>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x2721>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2721>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x2721>, gm_level) == 6, "offsetof(NetPacket_Fixed<0x2721>, gm_level) == 6"); static_assert(sizeof(NetPacket_Fixed<0x2721>) == 10, "sizeof(NetPacket_Fixed<0x2721>) == 10"); + template<> struct NetPacket_Fixed<0x2722> { @@ -407,6 +502,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2722>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x2722>, old_email) == 6, "offsetof(NetPacket_Fixed<0x2722>, old_email) == 6"); static_assert(offsetof(NetPacket_Fixed<0x2722>, new_email) == 46, "offsetof(NetPacket_Fixed<0x2722>, new_email) == 46"); static_assert(sizeof(NetPacket_Fixed<0x2722>) == 86, "sizeof(NetPacket_Fixed<0x2722>) == 86"); + template<> struct NetPacket_Fixed<0x2723> { @@ -418,6 +514,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2723>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x2723>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2723>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x2723>, sex) == 6, "offsetof(NetPacket_Fixed<0x2723>, sex) == 6"); static_assert(sizeof(NetPacket_Fixed<0x2723>) == 7, "sizeof(NetPacket_Fixed<0x2723>) == 7"); + template<> struct NetPacket_Fixed<0x2724> { @@ -429,6 +526,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2724>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x2724>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2724>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x2724>, status) == 6, "offsetof(NetPacket_Fixed<0x2724>, status) == 6"); static_assert(sizeof(NetPacket_Fixed<0x2724>) == 10, "sizeof(NetPacket_Fixed<0x2724>) == 10"); + template<> struct NetPacket_Fixed<0x2725> { @@ -440,6 +538,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2725>, magic_packet_id) == 0, "offsetof static_assert(offsetof(NetPacket_Fixed<0x2725>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2725>, account_id) == 2"); static_assert(offsetof(NetPacket_Fixed<0x2725>, deltas) == 6, "offsetof(NetPacket_Fixed<0x2725>, deltas) == 6"); static_assert(sizeof(NetPacket_Fixed<0x2725>) == 18, "sizeof(NetPacket_Fixed<0x2725>) == 18"); + template<> struct NetPacket_Fixed<0x2727> { @@ -449,6 +548,7 @@ struct NetPacket_Fixed<0x2727> static_assert(offsetof(NetPacket_Fixed<0x2727>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2727>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x2727>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2727>, account_id) == 2"); static_assert(sizeof(NetPacket_Fixed<0x2727>) == 6, "sizeof(NetPacket_Fixed<0x2727>) == 6"); + template<> struct NetPacket_Head<0x2728> { @@ -469,6 +569,7 @@ struct NetPacket_Repeat<0x2728> static_assert(offsetof(NetPacket_Repeat<0x2728>, name) == 0, "offsetof(NetPacket_Repeat<0x2728>, name) == 0"); static_assert(offsetof(NetPacket_Repeat<0x2728>, value) == 32, "offsetof(NetPacket_Repeat<0x2728>, value) == 32"); static_assert(sizeof(NetPacket_Repeat<0x2728>) == 36, "sizeof(NetPacket_Repeat<0x2728>) == 36"); + template<> struct NetPacket_Head<0x2729> { @@ -489,6 +590,7 @@ struct NetPacket_Repeat<0x2729> static_assert(offsetof(NetPacket_Repeat<0x2729>, name) == 0, "offsetof(NetPacket_Repeat<0x2729>, name) == 0"); static_assert(offsetof(NetPacket_Repeat<0x2729>, value) == 32, "offsetof(NetPacket_Repeat<0x2729>, value) == 32"); static_assert(sizeof(NetPacket_Repeat<0x2729>) == 36, "sizeof(NetPacket_Repeat<0x2729>) == 36"); + template<> struct NetPacket_Fixed<0x272a> { @@ -498,6 +600,7 @@ struct NetPacket_Fixed<0x272a> static_assert(offsetof(NetPacket_Fixed<0x272a>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x272a>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x272a>, account_id) == 2, "offsetof(NetPacket_Fixed<0x272a>, account_id) == 2"); static_assert(sizeof(NetPacket_Fixed<0x272a>) == 6, "sizeof(NetPacket_Fixed<0x272a>) == 6"); + template<> struct NetPacket_Fixed<0x2730> { @@ -507,6 +610,7 @@ struct NetPacket_Fixed<0x2730> static_assert(offsetof(NetPacket_Fixed<0x2730>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x2730>, magic_packet_id) == 0"); static_assert(offsetof(NetPacket_Fixed<0x2730>, account_id) == 2, "offsetof(NetPacket_Fixed<0x2730>, account_id) == 2"); static_assert(sizeof(NetPacket_Fixed<0x2730>) == 6, "sizeof(NetPacket_Fixed<0x2730>) == 6"); + template<> struct NetPacket_Fixed<0x2731> { @@ -520,6 +624,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2731>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x2731>, ban_not_status) == 6, "offsetof(NetPacket_Fixed<0x2731>, ban_not_status) == 6"); static_assert(offsetof(NetPacket_Fixed<0x2731>, status_or_ban_until) == 7, "offsetof(NetPacket_Fixed<0x2731>, status_or_ban_until) == 7"); static_assert(sizeof(NetPacket_Fixed<0x2731>) == 11, "sizeof(NetPacket_Fixed<0x2731>) == 11"); + template<> struct NetPacket_Head<0x2732> { @@ -538,6 +643,7 @@ struct NetPacket_Repeat<0x2732> static_assert(offsetof(NetPacket_Repeat<0x2732>, account_id) == 0, "offsetof(NetPacket_Repeat<0x2732>, account_id) == 0"); static_assert(offsetof(NetPacket_Repeat<0x2732>, gm_level) == 4, "offsetof(NetPacket_Repeat<0x2732>, gm_level) == 4"); static_assert(sizeof(NetPacket_Repeat<0x2732>) == 5, "sizeof(NetPacket_Repeat<0x2732>) == 5"); + template<> struct NetPacket_Fixed<0x2740> { @@ -551,6 +657,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2740>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x2740>, old_pass) == 6, "offsetof(NetPacket_Fixed<0x2740>, old_pass) == 6"); static_assert(offsetof(NetPacket_Fixed<0x2740>, new_pass) == 30, "offsetof(NetPacket_Fixed<0x2740>, new_pass) == 30"); static_assert(sizeof(NetPacket_Fixed<0x2740>) == 54, "sizeof(NetPacket_Fixed<0x2740>) == 54"); + template<> struct NetPacket_Fixed<0x2741> { @@ -563,6 +670,7 @@ static_assert(offsetof(NetPacket_Fixed<0x2741>, account_id) == 2, "offsetof(NetP static_assert(offsetof(NetPacket_Fixed<0x2741>, status) == 6, "offsetof(NetPacket_Fixed<0x2741>, status) == 6"); static_assert(sizeof(NetPacket_Fixed<0x2741>) == 7, "sizeof(NetPacket_Fixed<0x2741>) == 7"); + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2709> *network, Packet_Fixed<0x2709> native) { @@ -577,6 +685,57 @@ bool network_to_native(Packet_Fixed<0x2709> *native, NetPacket_Fixed<0x2709> net rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x2710> *network, Packet_Fixed<0x2710> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->account_pass, native.account_pass); + rv &= native_to_network(&network->unknown, native.unknown); + rv &= native_to_network(&network->ip, native.ip); + rv &= native_to_network(&network->port, native.port); + rv &= native_to_network(&network->server_name, native.server_name); + rv &= native_to_network(&network->unknown2, native.unknown2); + rv &= native_to_network(&network->maintenance, native.maintenance); + rv &= native_to_network(&network->is_new, native.is_new); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x2710> *native, NetPacket_Fixed<0x2710> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->account_pass, network.account_pass); + rv &= network_to_native(&native->unknown, network.unknown); + rv &= network_to_native(&native->ip, network.ip); + rv &= network_to_native(&native->port, network.port); + rv &= network_to_native(&native->server_name, network.server_name); + rv &= network_to_native(&native->unknown2, network.unknown2); + rv &= network_to_native(&native->maintenance, network.maintenance); + rv &= network_to_native(&native->is_new, network.is_new); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x2711> *network, Packet_Fixed<0x2711> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->code, native.code); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x2711> *native, NetPacket_Fixed<0x2711> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->code, network.code); + return rv; +} + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2712> *network, Packet_Fixed<0x2712> native) { @@ -601,6 +760,7 @@ bool network_to_native(Packet_Fixed<0x2712> *native, NetPacket_Fixed<0x2712> net rv &= network_to_native(&native->ip, network.ip); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2713> *network, Packet_Fixed<0x2713> native) { @@ -623,6 +783,7 @@ bool network_to_native(Packet_Fixed<0x2713> *native, NetPacket_Fixed<0x2713> net rv &= network_to_native(&native->connect_until, network.connect_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2714> *network, Packet_Fixed<0x2714> native) { @@ -639,6 +800,7 @@ bool network_to_native(Packet_Fixed<0x2714> *native, NetPacket_Fixed<0x2714> net rv &= network_to_native(&native->users, network.users); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2715> *network, Packet_Fixed<0x2715> native) { @@ -657,6 +819,7 @@ bool network_to_native(Packet_Fixed<0x2715> *native, NetPacket_Fixed<0x2715> net rv &= network_to_native(&native->email, network.email); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2716> *network, Packet_Fixed<0x2716> native) { @@ -673,6 +836,7 @@ bool network_to_native(Packet_Fixed<0x2716> *native, NetPacket_Fixed<0x2716> net rv &= network_to_native(&native->account_id, network.account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2717> *network, Packet_Fixed<0x2717> native) { @@ -693,6 +857,7 @@ bool network_to_native(Packet_Fixed<0x2717> *native, NetPacket_Fixed<0x2717> net rv &= network_to_native(&native->connect_until, network.connect_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x2720> *network, Packet_Head<0x2720> native) { @@ -725,6 +890,7 @@ bool network_to_native(Packet_Repeat<0x2720> *native, NetPacket_Repeat<0x2720> n rv &= network_to_native(&native->c, network.c); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2721> *network, Packet_Fixed<0x2721> native) { @@ -743,6 +909,7 @@ bool network_to_native(Packet_Fixed<0x2721> *native, NetPacket_Fixed<0x2721> net rv &= network_to_native(&native->gm_level, network.gm_level); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2722> *network, Packet_Fixed<0x2722> native) { @@ -763,6 +930,7 @@ bool network_to_native(Packet_Fixed<0x2722> *native, NetPacket_Fixed<0x2722> net rv &= network_to_native(&native->new_email, network.new_email); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2723> *network, Packet_Fixed<0x2723> native) { @@ -781,6 +949,7 @@ bool network_to_native(Packet_Fixed<0x2723> *native, NetPacket_Fixed<0x2723> net rv &= network_to_native(&native->sex, network.sex); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2724> *network, Packet_Fixed<0x2724> native) { @@ -799,6 +968,7 @@ bool network_to_native(Packet_Fixed<0x2724> *native, NetPacket_Fixed<0x2724> net rv &= network_to_native(&native->status, network.status); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2725> *network, Packet_Fixed<0x2725> native) { @@ -817,6 +987,7 @@ bool network_to_native(Packet_Fixed<0x2725> *native, NetPacket_Fixed<0x2725> net rv &= network_to_native(&native->deltas, network.deltas); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2727> *network, Packet_Fixed<0x2727> native) { @@ -833,6 +1004,7 @@ bool network_to_native(Packet_Fixed<0x2727> *native, NetPacket_Fixed<0x2727> net rv &= network_to_native(&native->account_id, network.account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x2728> *network, Packet_Head<0x2728> native) { @@ -867,6 +1039,7 @@ bool network_to_native(Packet_Repeat<0x2728> *native, NetPacket_Repeat<0x2728> n rv &= network_to_native(&native->value, network.value); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x2729> *network, Packet_Head<0x2729> native) { @@ -901,6 +1074,7 @@ bool network_to_native(Packet_Repeat<0x2729> *native, NetPacket_Repeat<0x2729> n rv &= network_to_native(&native->value, network.value); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x272a> *network, Packet_Fixed<0x272a> native) { @@ -917,6 +1091,7 @@ bool network_to_native(Packet_Fixed<0x272a> *native, NetPacket_Fixed<0x272a> net rv &= network_to_native(&native->account_id, network.account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2730> *network, Packet_Fixed<0x2730> native) { @@ -933,6 +1108,7 @@ bool network_to_native(Packet_Fixed<0x2730> *native, NetPacket_Fixed<0x2730> net rv &= network_to_native(&native->account_id, network.account_id); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2731> *network, Packet_Fixed<0x2731> native) { @@ -953,6 +1129,7 @@ bool network_to_native(Packet_Fixed<0x2731> *native, NetPacket_Fixed<0x2731> net rv &= network_to_native(&native->status_or_ban_until, network.status_or_ban_until); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Head<0x2732> *network, Packet_Head<0x2732> native) { @@ -985,6 +1162,7 @@ bool network_to_native(Packet_Repeat<0x2732> *native, NetPacket_Repeat<0x2732> n rv &= network_to_native(&native->gm_level, network.gm_level); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2740> *network, Packet_Fixed<0x2740> native) { @@ -1005,6 +1183,7 @@ bool network_to_native(Packet_Fixed<0x2740> *native, NetPacket_Fixed<0x2740> net rv &= network_to_native(&native->new_pass, network.new_pass); return rv; } + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x2741> *network, Packet_Fixed<0x2741> native) { @@ -1024,4 +1203,5 @@ bool network_to_native(Packet_Fixed<0x2741> *native, NetPacket_Fixed<0x2741> net return rv; } + #endif // TMWA_PROTO2_LOGIN_CHAR_HPP diff --git a/src/proto2/login-user.hpp b/src/proto2/login-user.hpp index ee00e9a..dbdf322 100644 --- a/src/proto2/login-user.hpp +++ b/src/proto2/login-user.hpp @@ -27,7 +27,330 @@ // This is a public protocol, and changes require client cooperation +template<> +struct Packet_Head<0x0063> +{ + static const uint16_t PACKET_ID = 0x0063; + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + // TODO remove this + uint16_t magic_packet_length = {}; +}; +template<> +struct Packet_Repeat<0x0063> +{ + static const uint16_t PACKET_ID = 0x0063; + + uint8_t c = {}; +}; + +template<> +struct Packet_Fixed<0x0064> +{ + static const uint16_t PACKET_ID = 0x0064; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + uint32_t unknown = {}; + AccountName account_name = {}; + AccountPass account_pass = {}; + VERSION_2 version_2_flags = {}; +}; + +template<> +struct Packet_Head<0x0069> +{ + static const uint16_t PACKET_ID = 0x0069; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + // TODO remove this + uint16_t magic_packet_length = {}; + uint32_t login_id1 = {}; + AccountId account_id = {}; + uint32_t login_id2 = {}; + uint32_t unused = {}; + timestamp_milliseconds_buffer last_login_string = {}; + uint16_t unused2 = {}; + SEX sex = {}; +}; +template<> +struct Packet_Repeat<0x0069> +{ + static const uint16_t PACKET_ID = 0x0069; + + IP4Address ip = {}; + uint16_t port = {}; + ServerName server_name = {}; + uint16_t users = {}; + uint16_t maintenance = {}; + uint16_t is_new = {}; +}; + +template<> +struct Packet_Fixed<0x006a> +{ + static const uint16_t PACKET_ID = 0x006a; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + uint8_t error_code = {}; + timestamp_seconds_buffer error_message = {}; +}; + +template<> +struct Packet_Fixed<0x0081> +{ + static const uint16_t PACKET_ID = 0x0081; + + // TODO remove this + uint16_t magic_packet_id = PACKET_ID; + uint8_t error_code = {}; +}; + + +template<> +struct NetPacket_Head<0x0063> +{ + Little16 magic_packet_id; + Little16 magic_packet_length; +}; +static_assert(offsetof(NetPacket_Head<0x0063>, magic_packet_id) == 0, "offsetof(NetPacket_Head<0x0063>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Head<0x0063>, magic_packet_length) == 2, "offsetof(NetPacket_Head<0x0063>, magic_packet_length) == 2"); +static_assert(sizeof(NetPacket_Head<0x0063>) == 4, "sizeof(NetPacket_Head<0x0063>) == 4"); +template<> +struct NetPacket_Repeat<0x0063> +{ + Byte c; +}; +static_assert(offsetof(NetPacket_Repeat<0x0063>, c) == 0, "offsetof(NetPacket_Repeat<0x0063>, c) == 0"); +static_assert(sizeof(NetPacket_Repeat<0x0063>) == 1, "sizeof(NetPacket_Repeat<0x0063>) == 1"); + +template<> +struct NetPacket_Fixed<0x0064> +{ + Little16 magic_packet_id; + Little32 unknown; + NetString<sizeof(AccountName)> account_name; + NetString<sizeof(AccountPass)> account_pass; + Byte version_2_flags; +}; +static_assert(offsetof(NetPacket_Fixed<0x0064>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x0064>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x0064>, unknown) == 2, "offsetof(NetPacket_Fixed<0x0064>, unknown) == 2"); +static_assert(offsetof(NetPacket_Fixed<0x0064>, account_name) == 6, "offsetof(NetPacket_Fixed<0x0064>, account_name) == 6"); +static_assert(offsetof(NetPacket_Fixed<0x0064>, account_pass) == 30, "offsetof(NetPacket_Fixed<0x0064>, account_pass) == 30"); +static_assert(offsetof(NetPacket_Fixed<0x0064>, version_2_flags) == 54, "offsetof(NetPacket_Fixed<0x0064>, version_2_flags) == 54"); +static_assert(sizeof(NetPacket_Fixed<0x0064>) == 55, "sizeof(NetPacket_Fixed<0x0064>) == 55"); + +template<> +struct NetPacket_Head<0x0069> +{ + Little16 magic_packet_id; + Little16 magic_packet_length; + Little32 login_id1; + Little32 account_id; + Little32 login_id2; + Little32 unused; + NetString<sizeof(timestamp_milliseconds_buffer)> last_login_string; + Little16 unused2; + Byte sex; +}; +static_assert(offsetof(NetPacket_Head<0x0069>, magic_packet_id) == 0, "offsetof(NetPacket_Head<0x0069>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Head<0x0069>, magic_packet_length) == 2, "offsetof(NetPacket_Head<0x0069>, magic_packet_length) == 2"); +static_assert(offsetof(NetPacket_Head<0x0069>, login_id1) == 4, "offsetof(NetPacket_Head<0x0069>, login_id1) == 4"); +static_assert(offsetof(NetPacket_Head<0x0069>, account_id) == 8, "offsetof(NetPacket_Head<0x0069>, account_id) == 8"); +static_assert(offsetof(NetPacket_Head<0x0069>, login_id2) == 12, "offsetof(NetPacket_Head<0x0069>, login_id2) == 12"); +static_assert(offsetof(NetPacket_Head<0x0069>, unused) == 16, "offsetof(NetPacket_Head<0x0069>, unused) == 16"); +static_assert(offsetof(NetPacket_Head<0x0069>, last_login_string) == 20, "offsetof(NetPacket_Head<0x0069>, last_login_string) == 20"); +static_assert(offsetof(NetPacket_Head<0x0069>, unused2) == 44, "offsetof(NetPacket_Head<0x0069>, unused2) == 44"); +static_assert(offsetof(NetPacket_Head<0x0069>, sex) == 46, "offsetof(NetPacket_Head<0x0069>, sex) == 46"); +static_assert(sizeof(NetPacket_Head<0x0069>) == 47, "sizeof(NetPacket_Head<0x0069>) == 47"); +template<> +struct NetPacket_Repeat<0x0069> +{ + IP4Address ip; + Little16 port; + NetString<sizeof(ServerName)> server_name; + Little16 users; + Little16 maintenance; + Little16 is_new; +}; +static_assert(offsetof(NetPacket_Repeat<0x0069>, ip) == 0, "offsetof(NetPacket_Repeat<0x0069>, ip) == 0"); +static_assert(offsetof(NetPacket_Repeat<0x0069>, port) == 4, "offsetof(NetPacket_Repeat<0x0069>, port) == 4"); +static_assert(offsetof(NetPacket_Repeat<0x0069>, server_name) == 6, "offsetof(NetPacket_Repeat<0x0069>, server_name) == 6"); +static_assert(offsetof(NetPacket_Repeat<0x0069>, users) == 26, "offsetof(NetPacket_Repeat<0x0069>, users) == 26"); +static_assert(offsetof(NetPacket_Repeat<0x0069>, maintenance) == 28, "offsetof(NetPacket_Repeat<0x0069>, maintenance) == 28"); +static_assert(offsetof(NetPacket_Repeat<0x0069>, is_new) == 30, "offsetof(NetPacket_Repeat<0x0069>, is_new) == 30"); +static_assert(sizeof(NetPacket_Repeat<0x0069>) == 32, "sizeof(NetPacket_Repeat<0x0069>) == 32"); + +template<> +struct NetPacket_Fixed<0x006a> +{ + Little16 magic_packet_id; + Byte error_code; + NetString<sizeof(timestamp_seconds_buffer)> error_message; +}; +static_assert(offsetof(NetPacket_Fixed<0x006a>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x006a>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x006a>, error_code) == 2, "offsetof(NetPacket_Fixed<0x006a>, error_code) == 2"); +static_assert(offsetof(NetPacket_Fixed<0x006a>, error_message) == 3, "offsetof(NetPacket_Fixed<0x006a>, error_message) == 3"); +static_assert(sizeof(NetPacket_Fixed<0x006a>) == 23, "sizeof(NetPacket_Fixed<0x006a>) == 23"); + +template<> +struct NetPacket_Fixed<0x0081> +{ + Little16 magic_packet_id; + Byte error_code; +}; +static_assert(offsetof(NetPacket_Fixed<0x0081>, magic_packet_id) == 0, "offsetof(NetPacket_Fixed<0x0081>, magic_packet_id) == 0"); +static_assert(offsetof(NetPacket_Fixed<0x0081>, error_code) == 2, "offsetof(NetPacket_Fixed<0x0081>, error_code) == 2"); +static_assert(sizeof(NetPacket_Fixed<0x0081>) == 3, "sizeof(NetPacket_Fixed<0x0081>) == 3"); + + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Head<0x0063> *network, Packet_Head<0x0063> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->magic_packet_length, native.magic_packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Head<0x0063> *native, NetPacket_Head<0x0063> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->magic_packet_length, network.magic_packet_length); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Repeat<0x0063> *network, Packet_Repeat<0x0063> native) +{ + bool rv = true; + rv &= native_to_network(&network->c, native.c); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Repeat<0x0063> *native, NetPacket_Repeat<0x0063> network) +{ + bool rv = true; + rv &= network_to_native(&native->c, network.c); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x0064> *network, Packet_Fixed<0x0064> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->unknown, native.unknown); + rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->account_pass, native.account_pass); + rv &= native_to_network(&network->version_2_flags, native.version_2_flags); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x0064> *native, NetPacket_Fixed<0x0064> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->unknown, network.unknown); + rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->account_pass, network.account_pass); + rv &= network_to_native(&native->version_2_flags, network.version_2_flags); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Head<0x0069> *network, Packet_Head<0x0069> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->magic_packet_length, native.magic_packet_length); + rv &= native_to_network(&network->login_id1, native.login_id1); + rv &= native_to_network(&network->account_id, native.account_id); + rv &= native_to_network(&network->login_id2, native.login_id2); + rv &= native_to_network(&network->unused, native.unused); + rv &= native_to_network(&network->last_login_string, native.last_login_string); + rv &= native_to_network(&network->unused2, native.unused2); + rv &= native_to_network(&network->sex, native.sex); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Head<0x0069> *native, NetPacket_Head<0x0069> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->magic_packet_length, network.magic_packet_length); + rv &= network_to_native(&native->login_id1, network.login_id1); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->login_id2, network.login_id2); + rv &= network_to_native(&native->unused, network.unused); + rv &= network_to_native(&native->last_login_string, network.last_login_string); + rv &= network_to_native(&native->unused2, network.unused2); + rv &= network_to_native(&native->sex, network.sex); + return rv; +} +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Repeat<0x0069> *network, Packet_Repeat<0x0069> native) +{ + bool rv = true; + rv &= native_to_network(&network->ip, native.ip); + rv &= native_to_network(&network->port, native.port); + rv &= native_to_network(&network->server_name, native.server_name); + rv &= native_to_network(&network->users, native.users); + rv &= native_to_network(&network->maintenance, native.maintenance); + rv &= native_to_network(&network->is_new, native.is_new); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Repeat<0x0069> *native, NetPacket_Repeat<0x0069> network) +{ + bool rv = true; + rv &= network_to_native(&native->ip, network.ip); + rv &= network_to_native(&native->port, network.port); + rv &= network_to_native(&native->server_name, network.server_name); + rv &= network_to_native(&native->users, network.users); + rv &= network_to_native(&native->maintenance, network.maintenance); + rv &= network_to_native(&native->is_new, network.is_new); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x006a> *network, Packet_Fixed<0x006a> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->error_code, native.error_code); + rv &= native_to_network(&network->error_message, native.error_message); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x006a> *native, NetPacket_Fixed<0x006a> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->error_code, network.error_code); + rv &= network_to_native(&native->error_message, network.error_message); + return rv; +} + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetPacket_Fixed<0x0081> *network, Packet_Fixed<0x0081> native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->error_code, native.error_code); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(Packet_Fixed<0x0081> *native, NetPacket_Fixed<0x0081> network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->error_code, network.error_code); + return rv; +} #endif // TMWA_PROTO2_LOGIN_USER_HPP diff --git a/src/proto2/map-user.hpp b/src/proto2/map-user.hpp index 4da94cf..d68f436 100644 --- a/src/proto2/map-user.hpp +++ b/src/proto2/map-user.hpp @@ -41,6 +41,7 @@ struct Packet_Fixed<0x0212> uint16_t y = {}; }; + template<> struct NetPacket_Fixed<0x0212> { @@ -59,6 +60,7 @@ static_assert(offsetof(NetPacket_Fixed<0x0212>, x) == 12, "offsetof(NetPacket_Fi static_assert(offsetof(NetPacket_Fixed<0x0212>, y) == 14, "offsetof(NetPacket_Fixed<0x0212>, y) == 14"); static_assert(sizeof(NetPacket_Fixed<0x0212>) == 16, "sizeof(NetPacket_Fixed<0x0212>) == 16"); + inline __attribute__((warn_unused_result)) bool native_to_network(NetPacket_Fixed<0x0212> *network, Packet_Fixed<0x0212> native) { @@ -84,4 +86,5 @@ bool network_to_native(Packet_Fixed<0x0212> *native, NetPacket_Fixed<0x0212> net return rv; } + #endif // TMWA_PROTO2_MAP_USER_HPP diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp index b047865..92413e3 100644 --- a/src/proto2/types.hpp +++ b/src/proto2/types.hpp @@ -32,6 +32,7 @@ # include "../mmo/strs.hpp" # include "../mmo/utils.hpp" # include "../mmo/version.hpp" +# include "../login/types.hpp" template<class T> bool native_to_network(T *network, T native) { @@ -297,4 +298,22 @@ bool network_to_native(Version *native, NetVersion network) return rv; } +inline __attribute__((warn_unused_result)) +bool native_to_network(Byte *network, VERSION_2 native) +{ + bool rv = true; + uint8_t tmp = static_cast<uint8_t>(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(VERSION_2 *native, Byte network) +{ + bool rv = true; + uint8_t tmp; + rv &= network_to_native(&tmp, network); + *native = static_cast<VERSION_2>(tmp); + // TODO this is what really should be doing a checked cast + return rv; +} #endif // TMWA_PROTO2_TYPES_HPP |