From 2410aeb608329ed57a31315effdfd5a751788616 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 18 May 2014 02:43:55 -0700 Subject: Convert login/char and login/admin server components to proto-v2 --- src/admin/ladmin.cpp | 2 +- src/compat/iter.hpp | 54 + src/compat/iter_test.cpp | 53 + src/ints/little.hpp | 4 +- src/login/login.cpp | 1657 +++++++++++--------- src/map/pc.cpp | 2 +- src/mmo/enums.hpp | 13 + src/mmo/mmo.hpp | 2 +- src/mmo/version.hpp | 1 + src/net/packets.cpp | 89 ++ src/net/packets.hpp | 354 +++++ src/net/socket.cpp | 1 + src/net/socket.hpp | 13 - src/net/vomit.hpp | 17 + src/proto2/any-user.hpp | 102 +- src/proto2/any-user_test.cpp | 6 +- src/proto2/char-map.hpp | 8 +- src/proto2/char-map_test.cpp | 6 +- src/proto2/char-user.hpp | 8 +- src/proto2/char-user_test.cpp | 6 +- src/proto2/fwd.hpp | 172 ++- src/proto2/include_cstdint_test.cpp | 6 +- src/proto2/include_enums_test.cpp | 6 +- src/proto2/include_human_time_diff_test.cpp | 6 +- src/proto2/include_ids_test.cpp | 6 +- src/proto2/include_ip_test.cpp | 6 +- src/proto2/include_little_test.cpp | 6 +- src/proto2/include_strs_test.cpp | 6 +- src/proto2/include_utils_test.cpp | 6 +- src/proto2/include_version_test.cpp | 6 +- src/proto2/include_vstring_test.cpp | 6 +- src/proto2/login-admin.hpp | 2214 ++++++++++++++------------- src/proto2/login-admin_test.cpp | 6 +- src/proto2/login-char.hpp | 1140 +++++++------- src/proto2/login-char_test.cpp | 6 +- src/proto2/login-user.hpp | 8 +- src/proto2/login-user_test.cpp | 6 +- src/proto2/map-user.hpp | 52 +- src/proto2/map-user_test.cpp | 6 +- src/proto2/types.hpp | 52 +- tools/protocol.py | 273 ++-- 41 files changed, 3750 insertions(+), 2643 deletions(-) create mode 100644 src/net/packets.cpp create mode 100644 src/net/packets.hpp diff --git a/src/admin/ladmin.cpp b/src/admin/ladmin.cpp index b9819cd..f6c5985 100644 --- a/src/admin/ladmin.cpp +++ b/src/admin/ladmin.cpp @@ -2019,7 +2019,7 @@ void parse_fromlogin(Session *s) { AccountName userid = stringish(RFIFO_STRING<24>(s, i + 5)); VString<23> lower_userid = userid.to_lower(); - // what? + // this is ad-hoc block streaming list_first = next(wrap(RFIFOL(s, i))); // here are checks... if (list_type == 0 diff --git a/src/compat/iter.hpp b/src/compat/iter.hpp index 130bdf9..659aca9 100644 --- a/src/compat/iter.hpp +++ b/src/compat/iter.hpp @@ -94,4 +94,58 @@ IteratorPair> value_range(T b, T e) return {b, e}; } + +template +class FilterIterator +{ + C *container; + using InnerIterator = decltype(std::begin(*container)); + InnerIterator impl; +public: + void post_adv() + { + while (impl != std::end(*container)) + { + if (filter(*impl)) + break; + ++impl; + } + } + + FilterIterator(C *c) + : container(c), impl(std::begin(*c)) + { + post_adv(); + } + + void operator ++() + { + ++impl; + post_adv(); + } + + T operator *() + { + return *impl; + } + + friend + bool operator != (FilterIterator l, FilterIterator) + { + return l.impl != std::end(*l.container); + } +}; + +template +bool is_truthy(T v) +{ + return v; +} + +template +IteratorPair> filter_iterator(C *c) +{ + return {FilterIterator(c), FilterIterator(c)}; +} + #endif // TMWA_COMPAT_ITER_HPP diff --git a/src/compat/iter_test.cpp b/src/compat/iter_test.cpp index 2c3cdc8..f6f59d4 100644 --- a/src/compat/iter_test.cpp +++ b/src/compat/iter_test.cpp @@ -102,3 +102,56 @@ TEST(iterpair, unsigned8) }; EXPECT_TRUE(std::equal(pair.begin(), pair.end(), arr)); } + +static +bool is_odd_ref(int& i) +{ + return i % 2; +} + +TEST(iterpair, filter1) +{ + int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + + int expected_arr[] = {1, 3, 5, 7}; + int *expected_it = expected_arr; + int *expected_end = expected_arr + 4; + + for (int& i : filter_iterator(&arr)) + { + EXPECT_EQ(i, *expected_it); + ++expected_it; + } + EXPECT_EQ(expected_it, expected_end); +} + +TEST(iterpair, filter2) +{ + std::vector vals = {0, 1, 0, 2, 0, 3, 0}; + + int sum = 0, count = 0; + for (int i : filter_iterator(&vals)) + { + sum += i; + count++; + } + EXPECT_EQ(sum, 6); + EXPECT_EQ(count, 3); +} + +TEST(iterpair, filter3) +{ + int one = 1; + int two = 2; + int three = 3; + std::vector vals = {0, &one, 0, &two, 0, &three, 0}; + + int sum = 0, count = 0; + for (int *i : filter_iterator(&vals)) + { + sum += *i; + count++; + } + EXPECT_EQ(sum, 6); + EXPECT_EQ(count, 3); +} diff --git a/src/ints/little.hpp b/src/ints/little.hpp index d7d57ff..68f8683 100644 --- a/src/ints/little.hpp +++ b/src/ints/little.hpp @@ -73,7 +73,7 @@ namespace ints { if (__BYTE_ORDER == __BIG_ENDIAN) nat = __builtin_bswap32(nat); - __builtin_memcpy(net, &nat, 2); + __builtin_memcpy(net, &nat, 4); return true; } inline __attribute__((warn_unused_result)) @@ -81,7 +81,7 @@ namespace ints { if (__BYTE_ORDER == __BIG_ENDIAN) nat = __builtin_bswap64(nat); - __builtin_memcpy(net, &nat, 2); + __builtin_memcpy(net, &nat, 8); return true; } diff --git a/src/login/login.cpp b/src/login/login.cpp index 184272e..3f91025 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -50,6 +50,7 @@ #include "../io/tty.hpp" #include "../io/write.hpp" +#include "../net/packets.hpp" #include "../net/socket.hpp" #include "../net/timer.hpp" #include "../net/vomit.hpp" @@ -64,6 +65,11 @@ #include "../mmo/utils.hpp" #include "../mmo/version.hpp" +#include "../proto2/any-user.hpp" +#include "../proto2/login-admin.hpp" +#include "../proto2/login-char.hpp" +#include "../proto2/login-user.hpp" + #include "../poison.hpp" constexpr int MAX_SERVERS = 30; @@ -96,8 +102,6 @@ struct mmo_char_server static AccountId account_id_count = START_ACCOUNT_NUM; static -int server_num; -static int new_account = 0; static int login_port = 6900; @@ -222,7 +226,7 @@ AccountPass admin_pass; static AString gm_pass; static -int level_new_gm = 60; +GmLevel level_new_gm = GmLevel::from(60u); static Map gm_account_db; @@ -273,7 +277,7 @@ void delete_fromchar(Session *sess) IP4Address ip = sess->client_ip; PRINTF("Char-server '%s' has disconnected.\n"_fmt, server[id].name); LOGIN_LOG("Char-server '%s' has disconnected (ip: %s).\n"_fmt, - server[id].name, ip); + server[id].name, ip); server_session[id] = nullptr; server[id] = mmo_char_server{}; } @@ -318,7 +322,7 @@ int read_gm_account(void) gm_account_filename); PRINTF(" Actually, there is no GM accounts on the server.\n"_fmt); LOGIN_LOG("read_gm_account: GM accounts file [%s] not found.\n"_fmt, - gm_account_filename); + gm_account_filename); LOGIN_LOG(" Actually, there is no GM accounts on the server.\n"_fmt); return 1; } @@ -332,7 +336,7 @@ int read_gm_account(void) GM_Account p {}; if (!extract(line, record<' '>(&p.account_id, &p.level))) PRINTF("read_gm_account: file [%s], invalid 'id_acount level' format: '%s'\n"_fmt, - gm_account_filename, line); + gm_account_filename, line); else { GmLevel GM_level = isGM(p.account_id); @@ -340,10 +344,10 @@ int read_gm_account(void) { // if it's not a new account if (GM_level == p.level) PRINTF("read_gm_account: GM account %d defined twice (same level: %d).\n"_fmt, - p.account_id, p.level); + p.account_id, p.level); else PRINTF("read_gm_account: GM account %d defined twice (levels: %d and %d).\n"_fmt, - p.account_id, GM_level, p.level); + p.account_id, GM_level, p.level); } if (GM_level != p.level) { // if new account or new level @@ -364,7 +368,7 @@ int read_gm_account(void) PRINTF("read_gm_account: file '%s' readed (%d GM accounts found).\n"_fmt, gm_account_filename, c); LOGIN_LOG("read_gm_account: file '%s' readed (%d GM accounts found).\n"_fmt, - gm_account_filename, c); + gm_account_filename, c); return 0; } @@ -587,7 +591,7 @@ int mmo_auth_init(void) // no account file -> no account -> no login, including char-server (ERROR) // not anymore! :-) PRINTF(SGR_BOLD SGR_RED "mmo_auth_init: Accounts file [%s] not found." SGR_RESET "\n"_fmt, - account_filename); + account_filename); return 0; } @@ -645,26 +649,26 @@ void mmo_auth_sync(void) return; } FPRINTF(fp, - "// Accounts file: here are saved all information about the accounts.\n"_fmt); + "// Accounts file: here are saved all information about the accounts.\n"_fmt); FPRINTF(fp, - "// Structure: ID, account name, password, last login time, sex, # of logins, state, email, error message for state 7, validity time, last (accepted) login ip, memo field, ban timestamp, repeated(register text, register value)\n"_fmt); + "// Structure: ID, account name, password, last login time, sex, # of logins, state, email, error message for state 7, validity time, last (accepted) login ip, memo field, ban timestamp, repeated(register text, register value)\n"_fmt); FPRINTF(fp, "// Some explanations:\n"_fmt); FPRINTF(fp, - "// account name : between 4 to 23 char for a normal account (standard client can't send less than 4 char).\n"_fmt); + "// account name : between 4 to 23 char for a normal account (standard client can't send less than 4 char).\n"_fmt); FPRINTF(fp, "// account password: between 4 to 23 char\n"_fmt); FPRINTF(fp, - "// sex : M or F for normal accounts, S for server accounts\n"_fmt); + "// sex : M or F for normal accounts, S for server accounts\n"_fmt); FPRINTF(fp, - "// state : 0: account is ok, 1 to 256: error code of packet 0x006a + 1\n"_fmt); + "// state : 0: account is ok, 1 to 256: error code of packet 0x006a + 1\n"_fmt); FPRINTF(fp, - "// email : between 3 to 39 char (a@a.com is like no email)\n"_fmt); + "// email : between 3 to 39 char (a@a.com is like no email)\n"_fmt); FPRINTF(fp, - "// error message : text for the state 7: 'Your are Prohibited to login until '. Max 19 char\n"_fmt); + "// error message : text for the state 7: 'Your are Prohibited to login until '. Max 19 char\n"_fmt); FPRINTF(fp, - "// valitidy time : 0: unlimited account, : date calculated by addition of 1/1/1970 + value (number of seconds since the 1/1/1970)\n"_fmt); + "// valitidy time : 0: unlimited account, : date calculated by addition of 1/1/1970 + value (number of seconds since the 1/1/1970)\n"_fmt); FPRINTF(fp, "// memo field : max 254 char\n"_fmt); FPRINTF(fp, - "// ban time : 0: no ban, : banned until the date: date calculated by addition of 1/1/1970 + value (number of seconds since the 1/1/1970)\n"_fmt); + "// ban time : 0: no ban, : banned until the date: date calculated by addition of 1/1/1970 + value (number of seconds since the 1/1/1970)\n"_fmt); for (const AuthData& ad : auth_data) { if (!ad.account_id) @@ -714,21 +718,11 @@ void check_auth_sync(TimerData *, tick_t) return; } -//-------------------------------------------------------------------- -// Packet send to all char-servers, except one (wos: without our self) -//-------------------------------------------------------------------- + static -void charif_sendallwos(Session *ss, const uint8_t *buf, size_t len) +auto iter_char_sessions() -> decltype(filter_iterator(&server_session)) { - for (int i = 0; i < MAX_SERVERS; i++) - { - Session *s = server_session[i]; - if (s && s != ss) - { - WFIFO_BUF_CLONE(s, buf, len); - WFIFOSET(s, len); - } - } + return filter_iterator(&server_session); } //----------------------------------------------------- @@ -737,23 +731,23 @@ void charif_sendallwos(Session *ss, const uint8_t *buf, size_t len) static void send_GM_accounts(void) { - uint8_t buf[32000]; - int len; + std::vector tail; - len = 4; - WBUFW(buf, 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)) { - WBUFL(buf, len) = unwrap(ad.account_id); - WBUFB(buf, len + 4) = static_cast(GM_value.get_all_bits()); - len += 5; + SPacket_0x2732_Repeat item; + item.account_id = ad.account_id; + item.gm_level = GM_value; + tail.push_back(item); } } - WBUFW(buf, 2) = len; - charif_sendallwos(nullptr, buf, len); + for (Session *ss : iter_char_sessions()) + { + send_packet_repeatonly<0x2732, 4, 5>(ss, tail); + } } //----------------------------------------------------- @@ -852,14 +846,14 @@ int mmo_auth(struct mmo_account *account, Session *s) if (new_account_sex) { LOGIN_LOG("Attempt of creation of an already existant account (account: %s_%c, ip: %s)\n"_fmt, - account->userid, new_account_sex, ip); + account->userid, new_account_sex, ip); return 9; // 9 = Account already exists } if ((!pass_ok(account->passwd, ad->pass)) && !encpasswdok) { if (account->passwdenc == 0) LOGIN_LOG("Invalid password (account: %s, ip: %s)\n"_fmt, - account->userid, ip); + account->userid, ip); return 1; // 1 = Incorrect Password } @@ -867,8 +861,8 @@ int mmo_auth(struct mmo_account *account, Session *s) if (ad->state) { LOGIN_LOG("Connection refused (account: %s, state: %d, ip: %s)\n"_fmt, - account->userid, ad->state, - ip); + account->userid, ad->state, + ip); switch (ad->state) { // packet 0x006a value + 1 case 1: // 0 = Unregistered ID @@ -896,14 +890,14 @@ int mmo_auth(struct mmo_account *account, Session *s) { // always banned LOGIN_LOG("Connection refused (account: %s, banned until %s, ip: %s)\n"_fmt, - account->userid, tmpstr, ip); + account->userid, tmpstr, ip); return 6; // 6 = Your are Prohibited to log in until %s } else { // ban is finished LOGIN_LOG("End of ban (account: %s, previously banned until %s -> not more banned, ip: %s)\n"_fmt, - account->userid, tmpstr, ip); + account->userid, tmpstr, ip); ad->ban_until_time = TimeT(); // reset the ban time } } @@ -912,27 +906,27 @@ int mmo_auth(struct mmo_account *account, Session *s) && ad->connect_until_time < TimeT::now()) { LOGIN_LOG("Connection refused (account: %s, expired ID, ip: %s)\n"_fmt, - account->userid, ip); + account->userid, ip); return 2; // 2 = This ID is expired } LOGIN_LOG("Authentification accepted (account: %s (id: %d), ip: %s)\n"_fmt, - account->userid, ad->account_id, ip); + account->userid, ad->account_id, ip); } else { if (new_account_sex == '\0') { LOGIN_LOG("Unknown account (account: %s, ip: %s)\n"_fmt, - account->userid, ip); + account->userid, ip); return 0; // 0 = Unregistered ID } else { AccountId new_id = mmo_auth_new(account, sex_from_char(new_account_sex), DEFAULT_EMAIL); LOGIN_LOG("Account creation and authentification accepted (account %s (id: %d), sex: %c, connection with _F/_M, ip: %s)\n"_fmt, - account->userid, new_id, - new_account_sex, ip); + account->userid, new_id, + new_account_sex, ip); ad = &auth_data.back(); } } @@ -967,9 +961,9 @@ void char_anti_freeze_system(TimerData *, tick_t) if (server_freezeflag[i]-- < 1) { // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed PRINTF("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection.\n"_fmt, - i, server[i].name); + i, server[i].name); LOGIN_LOG("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection.\n"_fmt, - i, server[i].name); + i, server[i].name); server_session[i]->set_eof(); } } @@ -994,66 +988,81 @@ void parse_fromchar(Session *s) return; } - 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_fromchar == 2 || (display_parse_fromchar == 1 && RFIFOW(s, 0) != 0x2714)) // 0x2714 is done very often (number of players) + if (display_parse_fromchar == 2 || (display_parse_fromchar == 1 && packet_id != 0x2714)) // 0x2714 is done very often (number of players) PRINTF("parse_fromchar: connection #%d, packet: 0x%x (with being read: %zu bytes).\n"_fmt, - s, RFIFOW(s, 0), RFIFOREST(s)); + s, packet_id, packet_avail(s)); - switch (RFIFOW(s, 0)) + switch (packet_id) { // request from map-server via char-server to reload GM accounts (by Yor). case 0x2709: + { + RPacket_0x2709_Fixed fixed; + rv = recv_fpacket<0x2709, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("Char-server '%s': Request to re-load GM configuration file (ip: %s).\n"_fmt, - server[id].name, ip); + server[id].name, ip); read_gm_account(); // send GM accounts to all char-servers send_GM_accounts(); - RFIFOSKIP(s, 2); break; + } case 0x2712: // request from char-server to authentify an account - if (RFIFOREST(s) < 19) - return; + { + RPacket_0x2712_Fixed fixed; + rv = recv_fpacket<0x2712, 19>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); + AccountId acc = fixed.account_id; int i; for (i = 0; i < AUTH_FIFO_SIZE; i++) { if (auth_fifo[i].account_id == acc && - auth_fifo[i].login_id1 == RFIFOL(s, 6) && - auth_fifo[i].login_id2 == RFIFOL(s, 10) && // relate to the versions higher than 18 - auth_fifo[i].sex == static_cast(RFIFOB(s, 14)) && + auth_fifo[i].login_id1 == fixed.login_id1 && + auth_fifo[i].login_id2 == fixed.login_id2 && // relate to the versions higher than 18 + auth_fifo[i].sex == fixed.sex && (!check_ip_flag - || auth_fifo[i].ip == RFIFOIP(s, 15)) + || auth_fifo[i].ip == fixed.ip) && !auth_fifo[i].delflag) { - int p; auth_fifo[i].delflag = 1; LOGIN_LOG("Char-server '%s': authentification of the account %d accepted (ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); for (const AuthData& ad : auth_data) { if (ad.account_id == acc) { - WFIFOW(s, 0) = 0x2729; // Sending of the account_reg2 - WFIFOL(s, 4) = unwrap(acc); + SPacket_0x2729_Head head_29; + head_29.account_id = acc; + std::vector repeat_29; int j; - for (p = 8, j = 0; + for (j = 0; j < ad.account_reg2_num; - p += 36, j++) + j++) { - WFIFO_STRING(s, p, ad.account_reg2[j].str, 32); - WFIFOL(s, p + 32) = ad.account_reg2[j].value; + SPacket_0x2729_Repeat item; + item.name = ad.account_reg2[j].str; + item.value = ad.account_reg2[j].value; + repeat_29.push_back(item); } - WFIFOW(s, 2) = p; - WFIFOSET(s, p); - WFIFOW(s, 0) = 0x2713; - WFIFOL(s, 2) = unwrap(acc); - WFIFOB(s, 6) = 0; - WFIFO_STRING(s, 7, ad.email, 40); - WFIFOL(s, 47) = static_cast(ad.connect_until_time); - WFIFOSET(s, 51); + send_vpacket<0x2729, 8, 36>(s, head_29, repeat_29); + + SPacket_0x2713_Fixed fixed_13; + fixed_13.account_id = acc; + fixed_13.invalid = 0; + fixed_13.email = ad.email; + fixed_13.connect_until = ad.connect_until_time; + + send_fpacket<0x2713, 51>(s, fixed_13); break; } } @@ -1064,37 +1073,46 @@ void parse_fromchar(Session *s) if (i == AUTH_FIFO_SIZE) { LOGIN_LOG("Char-server '%s': authentification of the account %d REFUSED (ip: %s).\n"_fmt, - server[id].name, acc, ip); - WFIFOW(s, 0) = 0x2713; - WFIFOL(s, 2) = unwrap(acc); - WFIFOB(s, 6) = 1; - // It is unnecessary to send email - // It is unnecessary to send validity date of the account - WFIFOSET(s, 51); + server[id].name, acc, ip); + + SPacket_0x2713_Fixed fixed_13; + fixed_13.account_id = acc; + fixed_13.invalid = 1; + // fixed_13.email + // fixed_13.connect_until + + send_fpacket<0x2713, 51>(s, fixed_13); } } - RFIFOSKIP(s, 19); break; + } case 0x2714: - if (RFIFOREST(s) < 6) - return; - server[id].users = RFIFOL(s, 2); + { + RPacket_0x2714_Fixed fixed; + rv = recv_fpacket<0x2714, 6>(s, fixed); + if (rv != RecvResult::Complete) + break; + + server[id].users = fixed.users; if (anti_freeze_enable) server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed - RFIFOSKIP(s, 6); break; + } // we receive a e-mail creation of an account with a default e-mail (no answer) case 0x2715: - if (RFIFOREST(s) < 46) - return; { - AccountId acc = wrap(RFIFOL(s, 2)); - AccountEmail email = stringish(RFIFO_STRING<40>(s, 6)); + RPacket_0x2715_Fixed fixed; + rv = recv_fpacket<0x2715, 46>(s, fixed); + if (rv != RecvResult::Complete) + break; + + AccountId acc = fixed.account_id; + AccountEmail email = fixed.email; if (!e_mail_check(email)) LOGIN_LOG("Char-server '%s': Attempt to create an e-mail on an account with a default e-mail REFUSED - e-mail is invalid (account: %d, ip: %s)\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); else { for (AuthData& ad : auth_data) @@ -1104,7 +1122,7 @@ void parse_fromchar(Session *s) { ad.email = email; LOGIN_LOG("Char-server '%s': Create an e-mail on an account with a default e-mail (account: %d, new e-mail: %s, ip: %s).\n"_fmt, - server[id].name, acc, email, ip); + server[id].name, acc, email, ip); goto x2715_out; } } @@ -1112,48 +1130,57 @@ void parse_fromchar(Session *s) server[id].name, acc, ip); } x2715_out: - RFIFOSKIP(s, 46); break; - - // We receive an e-mail/limited time request, because a player comes back from a map-server to the char-server } + // We receive an e-mail/limited time request, because a player comes back from a map-server to the char-server case 0x2716: - if (RFIFOREST(s) < 6) - return; { - AccountId account_id = wrap(RFIFOL(s, 2)); + RPacket_0x2716_Fixed fixed; + rv = recv_fpacket<0x2716, 6>(s, fixed); + if (rv != RecvResult::Complete) + break; + + AccountId account_id = fixed.account_id; for (const AuthData& ad : auth_data) { if (ad.account_id == account_id) { LOGIN_LOG("Char-server '%s': e-mail of the account %d found (ip: %s).\n"_fmt, server[id].name, account_id, ip); - WFIFOW(s, 0) = 0x2717; - WFIFOL(s, 2) = unwrap(account_id); - WFIFO_STRING(s, 6, ad.email, 40); - WFIFOL(s, 46) = static_cast(ad.connect_until_time); - WFIFOSET(s, 50); + + SPacket_0x2717_Fixed fixed_17; + fixed_17.account_id = account_id; + fixed_17.email = ad.email; + fixed_17.connect_until = ad.connect_until_time; + + send_fpacket<0x2717, 50>(s, fixed_17); + if (rv != RecvResult::Complete) + break; goto x2716_end; } } LOGIN_LOG("Char-server '%s': e-mail of the account %d NOT found (ip: %s).\n"_fmt, server[id].name, account_id, ip); - } x2716_end: - RFIFOSKIP(s, 6); break; + } case 0x2720: // To become GM request - if (RFIFOREST(s) < 4 || RFIFOREST(s) < RFIFOW(s, 2)) - return; + { + RPacket_0x2720_Head head; + AString repeat; + rv = recv_vpacket<0x2720, 8, 1>(s, head, repeat); + if (rv != RecvResult::Complete) + break; + { - unsigned char buf[10]; - AccountId acc = wrap(RFIFOL(s, 4)); - WBUFW(buf, 0) = 0x2721; - WBUFL(buf, 2) = unwrap(acc); - WBUFL(buf, 6) = 0; - size_t len = RFIFOW(s, 2) - 8; - AString pass = RFIFO_STRING(s, 8, len); + AccountId acc = head.account_id; + + SPacket_0x2721_Fixed fixed_21; + fixed_21.account_id = acc; + fixed_21.gm_level = GmLevel(); + + AString pass = repeat; if (pass == gm_pass) { @@ -1170,75 +1197,82 @@ void parse_fromchar(Session *s) timestamp_seconds_buffer tmpstr; stamp_time(tmpstr); FPRINTF(fp, - "\n// %s: @GM command on account %d\n%d %d\n"_fmt, - tmpstr, - acc, acc, level_new_gm); + "\n// %s: @GM command on account %d\n%d %d\n"_fmt, + tmpstr, + acc, acc, level_new_gm); if (!fp.close()) { PRINTF("warning: didn't actually save GM file\n"_fmt); } - WBUFL(buf, 6) = level_new_gm; + fixed_21.gm_level = level_new_gm; read_gm_account(); send_GM_accounts(); PRINTF("GM Change of the account %d: level 0 -> %d.\n"_fmt, - acc, level_new_gm); + acc, level_new_gm); LOGIN_LOG("Char-server '%s': GM Change of the account %d: level 0 -> %d (ip: %s).\n"_fmt, - server[id].name, acc, - level_new_gm, ip); + server[id].name, acc, + level_new_gm, ip); } else { PRINTF("Error of GM change (suggested account: %d, correct password, unable to add a GM account in GM accounts file)\n"_fmt, - acc); + acc); LOGIN_LOG("Char-server '%s': Error of GM change (suggested account: %d, correct password, unable to add a GM account in GM accounts file, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } } else { PRINTF("Error of GM change (suggested account: %d, correct password, but GM creation is disable (level_new_gm = 0))\n"_fmt, - acc); + acc); LOGIN_LOG("Char-server '%s': Error of GM change (suggested account: %d, correct password, but GM creation is disable (level_new_gm = 0), ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } } else { PRINTF("Error of GM change (suggested account: %d (already GM), correct password).\n"_fmt, - acc); + acc); LOGIN_LOG("Char-server '%s': Error of GM change (suggested account: %d (already GM), correct password, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } } else { PRINTF("Error of GM change (suggested account: %d, invalid password).\n"_fmt, - acc); + acc); LOGIN_LOG("Char-server '%s': Error of GM change (suggested account: %d, invalid password, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); + } + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2721, 10>(ss, fixed_21); } - charif_sendallwos(nullptr, buf, 10); } - RFIFOSKIP(s, RFIFOW(s, 2)); - return; + break; + } // Map server send information to change an email of an account via char-server case 0x2722: // 0x2722 .L .40B .40B - if (RFIFOREST(s) < 86) - return; + { + RPacket_0x2722_Fixed fixed; + rv = recv_fpacket<0x2722, 86>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); - AccountEmail actual_email = stringish(RFIFO_STRING<40>(s, 6).to_print()); - AccountEmail new_email = stringish(RFIFO_STRING<40>(s, 46)); + AccountId acc = fixed.account_id; + AccountEmail actual_email = stringish(fixed.old_email.to_print()); + AccountEmail new_email = fixed.new_email; if (!e_mail_check(actual_email)) LOGIN_LOG("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual email is invalid (account: %d, ip: %s)\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); else if (!e_mail_check(new_email)) LOGIN_LOG("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a invalid new e-mail (account: %d, ip: %s)\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); else if (new_email == DEFAULT_EMAIL) LOGIN_LOG("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command) with a default e-mail (account: %d, ip: %s)\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); else { for (AuthData& ad : auth_data) @@ -1249,14 +1283,14 @@ void parse_fromchar(Session *s) { ad.email = new_email; LOGIN_LOG("Char-server '%s': Modify an e-mail on an account (@email GM command) (account: %d (%s), new e-mail: %s, ip: %s).\n"_fmt, - server[id].name, acc, - ad.userid, new_email, ip); + server[id].name, acc, + ad.userid, new_email, ip); } else LOGIN_LOG("Char-server '%s': Attempt to modify an e-mail on an account (@email GM command), but actual e-mail is incorrect (account: %d (%s), actual e-mail: %s, proposed e-mail: %s, ip: %s).\n"_fmt, - server[id].name, acc, - ad.userid, - ad.email, actual_email, ip); + server[id].name, acc, + ad.userid, + ad.email, actual_email, ip); goto x2722_out; } } @@ -1265,16 +1299,20 @@ void parse_fromchar(Session *s) } } x2722_out: - RFIFOSKIP(s, 86); break; + } // Receiving of map-server via char-server a status change resquest (by Yor) case 0x2724: - if (RFIFOREST(s) < 10) - return; + { + RPacket_0x2724_Fixed fixed; + rv = recv_fpacket<0x2724, 10>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); - int statut = RFIFOL(s, 6); + AccountId acc = fixed.account_id; + int statut = fixed.status; for (AuthData& ad : auth_data) { if (ad.account_id == acc) @@ -1282,41 +1320,52 @@ void parse_fromchar(Session *s) if (ad.state != statut) { LOGIN_LOG("Char-server '%s': Status change (account: %d, new status %d, ip: %s).\n"_fmt, - server[id].name, acc, statut, - ip); + server[id].name, acc, statut, + ip); if (statut != 0) { - unsigned char buf[16]; - WBUFW(buf, 0) = 0x2731; - WBUFL(buf, 2) = unwrap(acc); - WBUFB(buf, 6) = 0; // 0: change of statut, 1: ban - WBUFL(buf, 7) = statut; // status or final date of a banishment - charif_sendallwos(nullptr, buf, 11); + SPacket_0x2731_Fixed fixed_31; + fixed_31.account_id = acc; + fixed_31.ban_not_status = 0; + fixed_31.status_or_ban_until = static_cast(statut); + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2731, 11>(ss, fixed_31); + } + for (int j = 0; j < AUTH_FIFO_SIZE; j++) + { if (auth_fifo[j].account_id == acc) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentification) + } } ad.state = statut; } else LOGIN_LOG("Char-server '%s': Error of Status change - actual status is already the good status (account: %d, status %d, ip: %s).\n"_fmt, - server[id].name, acc, statut, - ip); + server[id].name, acc, statut, + ip); goto x2724_out; } } LOGIN_LOG("Char-server '%s': Error of Status change (account: %d not found, suggested status %d, ip: %s).\n"_fmt, server[id].name, acc, statut, ip); x2724_out: - RFIFOSKIP(s, 10); + ; } - return; + break; + } case 0x2725: // Receiving of map-server via char-server a ban resquest (by Yor) - if (RFIFOREST(s) < 18) - return; + { + RPacket_0x2725_Fixed fixed; + rv = recv_fpacket<0x2725, 18>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); + AccountId acc = fixed.account_id; for (AuthData& ad : auth_data) { if (ad.account_id == acc) @@ -1329,8 +1378,7 @@ void parse_fromchar(Session *s) else timestamp = ad.ban_until_time; struct tm tmtime = timestamp; - HumanTimeDiff ban_diff; - RFIFO_STRUCT(s, 6, ban_diff); + HumanTimeDiff ban_diff = fixed.deltas; tmtime.tm_year += ban_diff.year; tmtime.tm_mon += ban_diff.month; tmtime.tm_mday += ban_diff.day; @@ -1346,7 +1394,6 @@ void parse_fromchar(Session *s) { if (timestamp) { - unsigned char buf[16]; timestamp_seconds_buffer tmpstr; if (timestamp) stamp_time(tmpstr, ×tamp); @@ -1355,11 +1402,16 @@ void parse_fromchar(Session *s) timestamp, tmpstr, ip); - WBUFW(buf, 0) = 0x2731; - WBUFL(buf, 2) = unwrap(ad.account_id); - WBUFB(buf, 6) = 1; // 0: change of statut, 1: ban - WBUFL(buf, 7) = static_cast(timestamp); // status or final date of a banishment - charif_sendallwos(nullptr, buf, 11); + SPacket_0x2731_Fixed fixed_31; + fixed_31.account_id = ad.account_id; + fixed_31.ban_not_status = 1; + fixed_31.status_or_ban_until = timestamp; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2731, 11>(ss, fixed_31); + } + for (int j = 0; j < AUTH_FIFO_SIZE; j++) { if (auth_fifo[j].account_id == acc) @@ -1369,21 +1421,21 @@ void parse_fromchar(Session *s) else { LOGIN_LOG("Char-server '%s': Error of ban request (account: %d, new date unbans the account, ip: %s).\n"_fmt, - server[id].name, acc, - ip); + server[id].name, acc, + ip); } ad.ban_until_time = timestamp; } else { LOGIN_LOG("Char-server '%s': Error of ban request (account: %d, no change for ban date, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } } else { LOGIN_LOG("Char-server '%s': Error of ban request (account: %d, invalid date, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } goto x2725_out; } @@ -1391,40 +1443,49 @@ void parse_fromchar(Session *s) LOGIN_LOG("Char-server '%s': Error of ban request (account: %d not found, ip: %s).\n"_fmt, server[id].name, acc, ip); x2725_out: - RFIFOSKIP(s, 18); + ; } - return; + break; + } case 0x2727: // Change of sex (sex is reversed) - if (RFIFOREST(s) < 6) - return; + { + RPacket_0x2727_Fixed fixed; + rv = recv_fpacket<0x2727, 6>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); + AccountId acc = fixed.account_id; for (AuthData& ad : auth_data) { if (ad.account_id == acc) { { - unsigned char buf[16]; SEX sex; if (ad.sex == SEX::FEMALE) sex = SEX::MALE; else sex = SEX::FEMALE; LOGIN_LOG("Char-server '%s': Sex change (account: %d, new sex %c, ip: %s).\n"_fmt, - server[id].name, acc, - sex_to_char(sex), - ip); + server[id].name, acc, + sex_to_char(sex), + ip); for (int j = 0; j < AUTH_FIFO_SIZE; j++) { if (auth_fifo[j].account_id == acc) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentification) } ad.sex = sex; - WBUFW(buf, 0) = 0x2723; - WBUFL(buf, 2) = unwrap(acc); - WBUFB(buf, 6) = static_cast(sex); - charif_sendallwos(nullptr, buf, 7); + + SPacket_0x2723_Fixed fixed_23; + fixed_23.account_id = acc; + fixed_23.sex = sex; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2723, 7>(ss, fixed_23); + } } goto x2727_out; } @@ -1432,36 +1493,52 @@ void parse_fromchar(Session *s) LOGIN_LOG("Char-server '%s': Error of sex change (account: %d not found, sex would be reversed, ip: %s).\n"_fmt, server[id].name, acc, ip); x2727_out: - RFIFOSKIP(s, 6); + ; } - return; + break; + } case 0x2728: // We receive account_reg2 from a char-server, and we send them to other char-servers. - if (RFIFOREST(s) < 4 || RFIFOREST(s) < RFIFOW(s, 2)) - return; + { + RPacket_0x2728_Head head; + std::vector repeat; + rv = recv_vpacket<0x2728, 8, 36>(s, head, repeat); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 4)); + AccountId acc = head.account_id; for (AuthData& ad : auth_data) { if (ad.account_id == acc) { LOGIN_LOG("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d, ip: %s).\n"_fmt, - server[id].name, acc, ip); - size_t len = RFIFOW(s, 2); - int j, p; - for (p = 8, j = 0; - p < len && j < ACCOUNT_REG2_NUM; - p += 36, j++) + server[id].name, acc, ip); + + const size_t count = std::min(ACCOUNT_REG2_NUM, repeat.size()); + for (size_t j = 0; j < count; ++j) { - ad.account_reg2[j].str = stringish(RFIFO_STRING<32>(s, p).to_print()); - ad.account_reg2[j].value = RFIFOL(s, p + 32); + ad.account_reg2[j].str = repeat[j].name; + ad.account_reg2[j].value = repeat[j].value; } - ad.account_reg2_num = j; + ad.account_reg2_num = count; + // Sending information towards the other char-servers. - uint8_t buf[len]; - RFIFO_BUF_CLONE(s, buf, len); - WBUFW(buf, 0) = 0x2729; - charif_sendallwos(s, buf, WBUFW(buf, 2)); + SPacket_0x2729_Head head_29; + std::vector repeat_29(repeat.size()); + head_29.account_id = head.account_id; + for (size_t j = 0; j < count; ++j) + { + repeat_29[j].name = repeat[j].name; + repeat_29[j].value = repeat[j].value; + } + + for (Session *ss : iter_char_sessions()) + { + if (ss == s) + continue; + send_vpacket<0x2729, 8, 36>(ss, head_29, repeat_29); + } goto x2728_out; } } @@ -1469,14 +1546,18 @@ void parse_fromchar(Session *s) server[id].name, acc, ip); } x2728_out: - RFIFOSKIP(s, RFIFOW(s, 2)); break; + } case 0x272a: // Receiving of map-server via char-server a unban resquest (by Yor) - if (RFIFOREST(s) < 6) - return; + { + RPacket_0x272a_Fixed fixed; + rv = recv_fpacket<0x272a, 6>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); + AccountId acc = fixed.account_id; for (AuthData& ad : auth_data) { if (ad.account_id == acc) @@ -1485,12 +1566,12 @@ void parse_fromchar(Session *s) { ad.ban_until_time = TimeT(); LOGIN_LOG("Char-server '%s': UnBan request (account: %d, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } else { LOGIN_LOG("Char-server '%s': Error of UnBan request (account: %d, no change for unban date, ip: %s).\n"_fmt, - server[id].name, acc, ip); + server[id].name, acc, ip); } goto x272a_out; } @@ -1498,18 +1579,23 @@ void parse_fromchar(Session *s) LOGIN_LOG("Char-server '%s': Error of UnBan request (account: %d not found, ip: %s).\n"_fmt, server[id].name, acc, ip); x272a_out: - RFIFOSKIP(s, 6); + ; } - return; + break; + } // request from char-server to change account password case 0x2740: // 0x2740 .L .24B .24B - if (RFIFOREST(s) < 54) - return; + { + RPacket_0x2740_Fixed fixed; + rv = recv_fpacket<0x2740, 54>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId acc = wrap(RFIFOL(s, 2)); - AccountPass actual_pass = stringish(RFIFO_STRING<24>(s, 6).to_print()); - AccountPass new_pass = stringish(RFIFO_STRING<24>(s, 30).to_print()); + AccountId acc = fixed.account_id; + AccountPass actual_pass = stringish(fixed.old_pass.to_print()); + AccountPass new_pass = stringish(fixed.new_pass.to_print()); int status = 0; @@ -1526,29 +1612,29 @@ void parse_fromchar(Session *s) status = 1; ad.pass = MD5_saltcrypt(new_pass, make_salt()); LOGIN_LOG("Char-server '%s': Change pass success (account: %d (%s), ip: %s.\n"_fmt, - server[id].name, acc, - ad.userid, ip); + server[id].name, acc, + ad.userid, ip); } } else { status = 2; LOGIN_LOG("Char-server '%s': Attempt to modify a pass failed, wrong password. (account: %d (%s), ip: %s).\n"_fmt, - server[id].name, acc, - ad.userid, ip); + server[id].name, acc, + ad.userid, ip); } goto x2740_out; } } x2740_out: - WFIFOW(s, 0) = 0x2741; - WFIFOL(s, 2) = unwrap(acc); - WFIFOB(s, 6) = status; // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short - WFIFOSET(s, 7); + SPacket_0x2741_Fixed fixed_41; + fixed_41.account_id = acc; + fixed_41.status = status; + send_fpacket<0x2741, 7>(s, fixed_41); } - RFIFOSKIP(s, 54); break; + } default: { @@ -1558,53 +1644,24 @@ void parse_fromchar(Session *s) timestamp_milliseconds_buffer timestr; stamp_time(timestr); FPRINTF(logfp, - "%s: receiving of an unknown packet -> disconnection\n"_fmt, - timestr); + "%s: receiving of an unknown packet -> disconnection\n"_fmt, + timestr); FPRINTF(logfp, - "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, - s, ip, RFIFOW(s, 0), RFIFOREST(s)); + "parse_fromchar: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, + 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 (int 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); } - } PRINTF("parse_fromchar: Unknown packet 0x%x (from a char-server)! -> disconnection.\n"_fmt, - RFIFOW(s, 0)); + packet_id); s->set_eof(); PRINTF("Char-server has been disconnected (unknown packet).\n"_fmt); return; + } } } + if (rv == RecvResult::Error) + s->set_eof(); return; } @@ -1615,109 +1672,136 @@ static void parse_admin(Session *s) { 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_admin == 1) - PRINTF("parse_admin: connection #%d, packet: 0x%x (with being read: %zu).\n"_fmt, - s, RFIFOW(s, 0), RFIFOREST(s)); + PRINTF("parse_admin: connection #%d, packet: 0x%x (with being read: %zu bytes).\n"_fmt, + s, packet_id, packet_avail(s)); - switch (RFIFOW(s, 0)) + switch (packet_id) { case 0x7530: // Request of the server version + { + RPacket_0x7530_Fixed fixed; + rv = recv_fpacket<0x7530, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("'ladmin': Sending of the server version (ip: %s)\n"_fmt, - ip); - WFIFOW(s, 0) = 0x7531; - WFIFO_STRUCT(s, 2, CURRENT_LOGIN_SERVER_VERSION); - WFIFOSET(s, 10); - RFIFOSKIP(s, 2); + ip); + + SPacket_0x7531_Fixed fixed_31; + fixed_31.version = CURRENT_LOGIN_SERVER_VERSION; + send_fpacket<0x7531, 10>(s, fixed_31); break; + } case 0x7532: // Request of end of connection + { + RPacket_0x7532_Fixed fixed; + rv = recv_fpacket<0x7532, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("'ladmin': End of connection (ip: %s)\n"_fmt, - ip); - RFIFOSKIP(s, 2); + ip); s->set_eof(); - break; + return; + } case 0x7920: // Request of an accounts list - if (RFIFOREST(s) < 10) - return; + { + RPacket_0x7920_Fixed fixed; + rv = recv_fpacket<0x7920, 10>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - AccountId st = wrap(RFIFOL(s, 2)); - AccountId ed = wrap(RFIFOL(s, 6)); - RFIFOSKIP(s, 10); - WFIFOW(s, 0) = 0x7921; - if (!(ed < END_ACCOUNT_NUM) || ed < st) + AccountId st = fixed.start_account_id; + AccountId ed = fixed.end_account_id; + if (!(ed < END_ACCOUNT_NUM) || ed < st || !ed) ed = END_ACCOUNT_NUM; + LOGIN_LOG("'ladmin': Sending an accounts list (ask: from %d to %d, ip: %s)\n"_fmt, - st, ed, ip); + st, ed, ip); + // Sending accounts information - int len = 4; + std::vector repeat_21; + for (const AuthData& ad : auth_data) { - if (len >= 30000) - break; AccountId account_id = ad.account_id; if (!(account_id < st) && !(ed < account_id)) { - WFIFOL(s, len) = unwrap(account_id); - WFIFOB(s, len + 4) = static_cast(isGM(account_id).get_all_bits()); - WFIFO_STRING(s, len + 5, ad.userid, 24); - WFIFOB(s, len + 29) = static_cast(ad.sex); - WFIFOL(s, len + 30) = ad.logincount; + SPacket_0x7921_Repeat info; + info.account_id = account_id; + info.gm_level = isGM(account_id); + info.account_name = ad.userid; + info.sex = ad.sex; + info.login_count = ad.logincount; if (ad.state == 0 && ad.ban_until_time) // if no state and banished - WFIFOL(s, len + 34) = 7; // 6 = Your are Prohibited to log in until %s + info.status = 7; // 6 = Your are Prohibited to log in until %s else - WFIFOL(s, len + 34) = ad.state; - len += 38; + info.status = ad.state; + repeat_21.push_back(info); } } - WFIFOW(s, 2) = len; - WFIFOSET(s, len); + send_packet_repeatonly<0x7921, 4, 38>(s, repeat_21); } break; + } case 0x7924: { // [Fate] Itemfrob package: change item IDs - if (RFIFOREST(s) < 10) - return; - uint8_t buf[10]; - RFIFO_BUF_CLONE(s, buf, 10); - // forward package to char servers - charif_sendallwos(nullptr, buf, 10); - RFIFOSKIP(s, 10); - WFIFOW(s, 0) = 0x7925; - WFIFOSET(s, 2); + RPacket_0x7924_Fixed fixed; + rv = recv_fpacket<0x7924, 10>(s, fixed); + if (rv != RecvResult::Complete) + break; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x7924, 10>(ss, fixed); + } + + SPacket_0x7925_Fixed fixed_25; + send_fpacket<0x7925, 2>(s, fixed_25); break; } case 0x7930: // Request for an account creation - if (RFIFOREST(s) < 91) - return; + { + RPacket_0x7930_Fixed fixed; + rv = recv_fpacket<0x7930, 91>(s, fixed); + if (rv != RecvResult::Complete) + break; + { struct mmo_account ma; - ma.userid = stringish(RFIFO_STRING<24>(s, 2).to_print()); - ma.passwd = stringish(RFIFO_STRING<24>(s, 26).to_print()); + // TODO make this a 'return false' bit of the network_to_native + ma.userid = stringish(fixed.account_name.to_print()); + ma.passwd = stringish(fixed.password.to_print()); ma.lastlogin = stringish("-"_s); - ma.sex = sex_from_char(RFIFOB(s, 50)); - WFIFOW(s, 0) = 0x7931; - WFIFOL(s, 2) = unwrap(AccountId()); - WFIFO_STRING(s, 6, ma.userid, 24); + ma.sex = fixed.sex; + + SPacket_0x7931_Fixed fixed_31; + fixed_31.account_id = AccountId(); + fixed_31.account_name = ma.userid; if (ma.userid.size() < 4 || ma.passwd.size() < 4) { LOGIN_LOG("'ladmin': Attempt to create an invalid account (account or pass is too short, ip: %s)\n"_fmt, - ip); + ip); } else if (ma.sex != SEX::FEMALE && ma.sex != SEX::MALE) { LOGIN_LOG("'ladmin': Attempt to create an invalid account (account: %s, invalid sex, ip: %s)\n"_fmt, - ma.userid, ip); + ma.userid, ip); } else if (!(account_id_count < END_ACCOUNT_NUM)) { LOGIN_LOG("'ladmin': Attempt to create an account, but there is no more available id number (account: %s, sex: %c, ip: %s)\n"_fmt, - ma.userid, ma.sex, ip); + ma.userid, sex_to_char(ma.sex), ip); } else { @@ -1726,47 +1810,54 @@ void parse_admin(Session *s) if (ad.userid == ma.userid) { LOGIN_LOG("'ladmin': Attempt to create an already existing account (account: %s ip: %s)\n"_fmt, - ad.userid, ip); + ad.userid, ip); goto x7930_out; } } { - AccountEmail email = stringish(RFIFO_STRING<40>(s, 51)); + AccountEmail email = fixed.email; AccountId new_id = mmo_auth_new(&ma, ma.sex, email); LOGIN_LOG("'ladmin': Account creation (account: %s (id: %d), sex: %c, email: %s, ip: %s)\n"_fmt, - ma.userid, new_id, - ma.sex, auth_data.back().email, ip); - WFIFOL(s, 2) = unwrap(new_id); + ma.userid, new_id, + sex_to_char(ma.sex), auth_data.back().email, ip); + fixed_31.account_id = new_id; } } x7930_out: - WFIFOSET(s, 30); - RFIFOSKIP(s, 91); + send_fpacket<0x7931, 30>(s, fixed_31); } break; + } case 0x7932: // Request for an account deletion - if (RFIFOREST(s) < 26) - return; { - WFIFOW(s, 0) = 0x7933; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + RPacket_0x7932_Fixed fixed; + rv = recv_fpacket<0x7932, 26>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7933_Fixed fixed_33; + fixed_33.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); AuthData *ad = search_account(account_name); if (ad) { // Char-server is notified of deletion (for characters deletion). - uint8_t buf[6]; - WBUFW(buf, 0) = 0x2730; - WBUFL(buf, 2) = unwrap(ad->account_id); - charif_sendallwos(nullptr, buf, 6); + SPacket_0x2730_Fixed fixed_30; + fixed_30.account_id = ad->account_id; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2730, 6>(ss, fixed_30); + } + // send answer - WFIFO_STRING(s, 6, ad->userid, 24); - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_33.account_name = ad->userid; + fixed_33.account_id = ad->account_id; // save deleted account in log file LOGIN_LOG("'ladmin': Account deletion (account: %s, id: %d, ip: %s) - saved in next line:\n"_fmt, - ad->userid, ad->account_id, - ip); + ad->userid, ad->account_id, + ip); { AString buf2 = mmo_auth_tostr(ad); LOGIN_LOG("%s\n"_fmt, buf2); @@ -1777,52 +1868,57 @@ void parse_admin(Session *s) } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_33.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to delete an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); + account_name, ip); } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 26); + send_fpacket<0x7933, 30>(s, fixed_33); break; + } case 0x7934: // Request to change a password - if (RFIFOREST(s) < 50) - return; { - WFIFOW(s, 0) = 0x7935; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + RPacket_0x7934_Fixed fixed; + rv = recv_fpacket<0x7934, 50>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7935_Fixed fixed_35; + fixed_35.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); - AccountPass plain = stringish(RFIFO_STRING<24>(s, 26)); + fixed_35.account_name = ad->userid; + AccountPass plain = stringish(fixed.password); ad->pass = MD5_saltcrypt(plain, make_salt()); - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_35.account_id = ad->account_id; LOGIN_LOG("'ladmin': Modification of a password (account: %s, new password: %s, ip: %s)\n"_fmt, - ad->userid, ad->pass, ip); + ad->userid, ad->pass, ip); } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_35.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to modify the password of an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); + account_name, ip); } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 50); + send_fpacket<0x7935, 30>(s, fixed_35); break; + } case 0x7936: // Request to modify a state - if (RFIFOREST(s) < 50) - return; + { + RPacket_0x7936_Fixed fixed; + rv = recv_fpacket<0x7936, 50>(s, fixed); + if (rv != RecvResult::Complete) + break; + { - WFIFOW(s, 0) = 0x7937; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); - int statut = RFIFOL(s, 26); - timestamp_seconds_buffer error_message = stringish(RFIFO_STRING<20>(s, 30).to_print()); + SPacket_0x7937_Fixed fixed_37; + fixed_37.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); + int statut = fixed.status; + timestamp_seconds_buffer error_message = stringish(error_message.to_print()); if (statut != 7 || !error_message) { // 7: // 6 = Your are Prohibited to log in until %s @@ -1831,29 +1927,33 @@ void parse_admin(Session *s) AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_37.account_name = ad->userid; + fixed_37.account_id = ad->account_id; if (ad->state == statut && ad->error_message == error_message) LOGIN_LOG("'ladmin': Modification of a state, but the state of the account is already the good state (account: %s, received state: %d, ip: %s)\n"_fmt, - account_name, statut, ip); + account_name, statut, ip); else { if (statut == 7) LOGIN_LOG("'ladmin': Modification of a state (account: %s, new state: %d - prohibited to login until '%s', ip: %s)\n"_fmt, - ad->userid, statut, - error_message, ip); + ad->userid, statut, + error_message, ip); else LOGIN_LOG("'ladmin': Modification of a state (account: %s, new state: %d, ip: %s)\n"_fmt, - ad->userid, statut, ip); + ad->userid, statut, ip); if (ad->state == 0) { - unsigned char buf[16]; - WBUFW(buf, 0) = 0x2731; - WBUFL(buf, 2) = unwrap(ad->account_id); - WBUFB(buf, 6) = 0; // 0: change of statut, 1: ban - WBUFL(buf, 7) = statut; // status or final date of a banishment - charif_sendallwos(nullptr, buf, 11); + SPacket_0x2731_Fixed fixed_31; + fixed_31.account_id = ad->account_id; + fixed_31.ban_not_status = 0; + fixed_31.status_or_ban_until = static_cast(statut); + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2731, 11>(ss, fixed_31); + } + for (int j = 0; j < AUTH_FIFO_SIZE; j++) if (auth_fifo[j].account_id == ad->account_id) @@ -1865,84 +1965,95 @@ void parse_admin(Session *s) } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_37.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to modify the state of an unknown account (account: %s, received state: %d, ip: %s)\n"_fmt, - account_name, statut, ip); + account_name, statut, ip); } - WFIFOL(s, 30) = statut; + fixed_37.status = statut; + send_fpacket<0x7937, 34>(s, fixed_37); } - WFIFOSET(s, 34); - RFIFOSKIP(s, 50); break; + } case 0x7938: // Request for servers list and # of online players + { + RPacket_0x7938_Fixed fixed; + rv = recv_fpacket<0x7938, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("'ladmin': Sending of servers list (ip: %s)\n"_fmt, ip); - server_num = 0; + std::vector repeat_39; for (int i = 0; i < MAX_SERVERS; i++) { if (server_session[i]) { - WFIFOIP(s, 4 + server_num * 32) = server[i].ip; - WFIFOW(s, 4 + server_num * 32 + 4) = server[i].port; - WFIFO_STRING(s, 4 + server_num * 32 + 6, server[i].name, 20); - WFIFOW(s, 4 + server_num * 32 + 26) = server[i].users; - WFIFOW(s, 4 + server_num * 32 + 28) = 0; //maintenance; - WFIFOW(s, 4 + server_num * 32 + 30) = 0; //is_new; - server_num++; + SPacket_0x7939_Repeat info; + info.ip = server[i].ip; + info.port = server[i].port; + info.name = server[i].name; + info.users = server[i].users; + info.maintenance = 0; + info.is_new = 0; + repeat_39.push_back(info); } } - WFIFOW(s, 0) = 0x7939; - WFIFOW(s, 2) = 4 + 32 * server_num; - WFIFOSET(s, 4 + 32 * server_num); - RFIFOSKIP(s, 2); + send_packet_repeatonly<0x7939, 4, 32>(s, repeat_39); break; + } case 0x793a: // Request to password check - if (RFIFOREST(s) < 50) - return; { - WFIFOW(s, 0) = 0x793b; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + RPacket_0x793a_Fixed fixed; + rv = recv_fpacket<0x793a, 50>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x793b_Fixed fixed_3b; + fixed_3b.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); const AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); - AccountPass pass = stringish(RFIFO_STRING<24>(s, 26)); + fixed_3b.account_name = ad->userid; + AccountPass pass = stringish(fixed.password); if (pass_ok(pass, ad->pass)) { - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_3b.account_id = ad->account_id; LOGIN_LOG("'ladmin': Check of password OK (account: %s, password: %s, ip: %s)\n"_fmt, - ad->userid, ad->pass, - ip); + ad->userid, ad->pass, + ip); } else { LOGIN_LOG("'ladmin': Failure of password check (account: %s, proposed pass: %s, ip: %s)\n"_fmt, - ad->userid, pass.to_print(), ip); + ad->userid, pass.to_print(), ip); } } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_3b.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to check the password of an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); + account_name, ip); } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 50); + send_fpacket<0x793b, 30>(s, fixed_3b); break; + } case 0x793c: // Request to modify sex - if (RFIFOREST(s) < 27) - return; { - WFIFOW(s, 0) = 0x793d; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); - WFIFO_STRING(s, 6, account_name, 24); + RPacket_0x793c_Fixed fixed; + rv = recv_fpacket<0x793c, 27>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x793d_Fixed fixed_3d; + fixed_3d.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); + fixed_3d.account_name = account_name; + { - SEX sex = sex_from_char(RFIFOB(s, 26)); + SEX sex = fixed.sex; if (sex != SEX::FEMALE && sex != SEX::MALE) { LOGIN_LOG("'ladmin': Attempt to give an invalid sex (account: %s, received sex: %c, ip: %s)\n"_fmt, @@ -1953,59 +2064,67 @@ void parse_admin(Session *s) AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_3d.account_name = ad->userid; if (ad->sex != sex) { - unsigned char buf[16]; - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_3d.account_id = ad->account_id; for (int j = 0; j < AUTH_FIFO_SIZE; j++) + { if (auth_fifo[j].account_id == ad->account_id) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentification) + } ad->sex = sex; LOGIN_LOG("'ladmin': Modification of a sex (account: %s, new sex: %c, ip: %s)\n"_fmt, - ad->userid, sex_to_char(sex), ip); + ad->userid, sex_to_char(sex), ip); + // send to all char-server the change - WBUFW(buf, 0) = 0x2723; - WBUFL(buf, 2) = unwrap(ad->account_id); - WBUFB(buf, 6) = static_cast(ad->sex); - charif_sendallwos(nullptr, buf, 7); + SPacket_0x2723_Fixed fixed_23; + fixed_23.account_id = ad->account_id; + fixed_23.sex = ad->sex; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2723, 7>(ss, fixed_23); + } } else { LOGIN_LOG("'ladmin': Modification of a sex, but the sex is already the good sex (account: %s, sex: %c, ip: %s)\n"_fmt, - ad->userid, sex_to_char(sex), ip); + ad->userid, sex_to_char(sex), ip); } } else { LOGIN_LOG("'ladmin': Attempt to modify the sex of an unknown account (account: %s, received sex: %c, ip: %s)\n"_fmt, - account_name, sex_to_char(sex), ip); + account_name, sex_to_char(sex), ip); } } } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 27); + send_fpacket<0x793d, 30>(s, fixed_3d); break; + } case 0x793e: // Request to modify GM level - if (RFIFOREST(s) < 27) - return; { - WFIFOW(s, 0) = 0x793f; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); - WFIFO_STRING(s, 6, account_name, 24); + RPacket_0x793e_Fixed fixed; + rv = recv_fpacket<0x793e, 27>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x793f_Fixed fixed_3f; + fixed_3f.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); + fixed_3f.account_name = account_name; bool reread = false; { - GmLevel new_gm_level = GmLevel::from(static_cast(RFIFOB(s, 26))); + GmLevel new_gm_level = fixed.gm_level; { const AuthData *ad = search_account(account_name); if (ad) { AccountId acc = ad->account_id; - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_3f.account_name = ad->userid; if (isGM(acc) != new_gm_level) { // modification of the file @@ -2036,65 +2155,65 @@ void parse_admin(Session *s) else if (!new_gm_level) { FPRINTF(fp2, - "// %s: 'ladmin' GM level removed on account %d '%s' (previous level: %d)\n//%d %d\n"_fmt, - tmpstr, - acc, - ad->userid, - GM_level, acc, - new_gm_level); + "// %s: 'ladmin' GM level removed on account %d '%s' (previous level: %d)\n//%d %d\n"_fmt, + tmpstr, + acc, + ad->userid, + GM_level, acc, + new_gm_level); modify_flag = 1; } else { FPRINTF(fp2, - "// %s: 'ladmin' GM level on account %d '%s' (previous level: %d)\n%d %d\n"_fmt, - tmpstr, - acc, - ad->userid, - GM_level, acc, - new_gm_level); + "// %s: 'ladmin' GM level on account %d '%s' (previous level: %d)\n%d %d\n"_fmt, + tmpstr, + acc, + ad->userid, + GM_level, acc, + new_gm_level); modify_flag = 1; } } } if (modify_flag == 0) FPRINTF(fp2, - "// %s: 'ladmin' GM level on account %d '%s' (previous level: 0)\n%d %d\n"_fmt, - tmpstr, acc, - ad->userid, acc, - new_gm_level); + "// %s: 'ladmin' GM level on account %d '%s' (previous level: 0)\n%d %d\n"_fmt, + tmpstr, acc, + ad->userid, acc, + new_gm_level); } else { LOGIN_LOG("'ladmin': Attempt to modify of a GM level - impossible to read GM accounts file (account: %s (%d), received GM level: %d, ip: %s)\n"_fmt, - ad->userid, acc, - new_gm_level, ip); + ad->userid, acc, + new_gm_level, ip); } - WFIFOL(s, 2) = unwrap(acc); + fixed_3f.account_id = acc; LOGIN_LOG("'ladmin': Modification of a GM level (account: %s (%d), new GM level: %d, ip: %s)\n"_fmt, - ad->userid, acc, - new_gm_level, ip); + ad->userid, acc, + new_gm_level, ip); reread = true; } else { LOGIN_LOG("'ladmin': Attempt to modify of a GM level - impossible to write GM accounts file (account: %s (%d), received GM level: %d, ip: %s)\n"_fmt, - ad->userid, acc, - new_gm_level, ip); + ad->userid, acc, + new_gm_level, ip); } } else { LOGIN_LOG("'ladmin': Attempt to modify of a GM level, but the GM level is already the good GM level (account: %s (%d), GM level: %d, ip: %s)\n"_fmt, - ad->userid, acc, - new_gm_level, ip); + ad->userid, acc, + new_gm_level, ip); } } else { LOGIN_LOG("'ladmin': Attempt to modify the GM level of an unknown account (account: %s, received GM level: %d, ip: %s)\n"_fmt, - account_name, new_gm_level, - ip); + account_name, new_gm_level, + ip); } } } @@ -2104,128 +2223,135 @@ void parse_admin(Session *s) read_gm_account(); send_GM_accounts(); } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 27); + send_fpacket<0x793f, 30>(s, fixed_3f); break; + } case 0x7940: // Request to modify e-mail - if (RFIFOREST(s) < 66) - return; { - WFIFOW(s, 0) = 0x7941; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); - WFIFO_STRING(s, 6, account_name, 24); + RPacket_0x7940_Fixed fixed; + rv = recv_fpacket<0x7940, 66>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7941_Fixed fixed_41; + fixed_41.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); + fixed_41.account_name = account_name; { - AccountEmail email = stringish(RFIFO_STRING<40>(s, 26)); + AccountEmail email = stringish(fixed.email); if (!e_mail_check(email)) { LOGIN_LOG("'ladmin': Attempt to give an invalid e-mail (account: %s, ip: %s)\n"_fmt, - account_name, ip); + account_name, ip); } else { AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_41.account_name = ad->userid; ad->email = email; - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_41.account_id = ad->account_id; LOGIN_LOG("'ladmin': Modification of an email (account: %s, new e-mail: %s, ip: %s)\n"_fmt, - ad->userid, email, ip); + ad->userid, email, ip); } else { LOGIN_LOG("'ladmin': Attempt to modify the e-mail of an unknown account (account: %s, received e-mail: %s, ip: %s)\n"_fmt, - account_name, email, ip); + account_name, email, ip); } } } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 66); + send_fpacket<0x7941, 30>(s, fixed_41); break; + } case 0x7942: // Request to modify memo field - if (RFIFOREST(s) < 28 - || RFIFOREST(s) < (28 + RFIFOW(s, 26))) - return; { - WFIFOW(s, 0) = 0x7943; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + RPacket_0x7942_Head head; + AString repeat; + rv = recv_vpacket<0x7942, 28, 1>(s, head, repeat); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7943_Fixed fixed_43; + fixed_43.account_id = AccountId(); + AccountName account_name = stringish(head.account_name.to_print()); AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_43.account_name = ad->userid; ad->memo = ""_s; - if (RFIFOW(s, 26) == 0) + if (!repeat/*.startswith('!')*/) { ad->memo = "!"_s; } else { - size_t len = RFIFOW(s, 26); // may truncate - ad->memo = RFIFO_STRING(s, 28, len); + ad->memo = repeat; } ad->memo = ad->memo.to_print(); - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_43.account_id = ad->account_id; LOGIN_LOG("'ladmin': Modification of a memo field (account: %s, new memo: %s, ip: %s)\n"_fmt, - ad->userid, ad->memo, ip); + ad->userid, ad->memo, ip); } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_43.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to modify the memo field of an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); + account_name, ip); } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 28 + RFIFOW(s, 26)); + send_fpacket<0x7943, 30>(s, fixed_43); break; + } case 0x7944: // Request to found an account id - if (RFIFOREST(s) < 26) - return; { - WFIFOW(s, 0) = 0x7945; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + RPacket_0x7944_Fixed fixed; + rv = recv_fpacket<0x7944, 26>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7945_Fixed fixed_45; + fixed_45.account_id = AccountId(); + AccountName account_name = stringish(account_name.to_print()); const AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_45.account_name = ad->userid; + fixed_45.account_id = ad->account_id; LOGIN_LOG("'ladmin': Request (by the name) of an account id (account: %s, id: %d, ip: %s)\n"_fmt, ad->userid, ad->account_id, ip); } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_45.account_name = account_name; LOGIN_LOG("'ladmin': ID request (by the name) of an unknown account (account: %s, ip: %s)\n"_fmt, account_name, ip); } - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 26); + send_fpacket<0x7945, 30>(s, fixed_45); break; + } case 0x7946: // Request to found an account name - if (RFIFOREST(s) < 6) - return; { - AccountId account_id = wrap(RFIFOL(s, 2)); - WFIFOW(s, 0) = 0x7947; - WFIFOL(s, 2) = unwrap(account_id); - WFIFO_ZERO(s, 6, 24); + RPacket_0x7946_Fixed fixed; + rv = recv_fpacket<0x7946, 6>(s, fixed); + if (rv != RecvResult::Complete) + break; + + AccountId account_id = fixed.account_id; + SPacket_0x7947_Fixed fixed_47; + fixed_47.account_id = account_id; + fixed_47.account_name = {}; for (const AuthData& ad : auth_data) { if (ad.account_id == account_id) { - WFIFO_STRING(s, 6, ad.userid, 24); + fixed_47.account_name = ad.userid; LOGIN_LOG("'ladmin': Request (by id) of an account name (account: %s, id: %d, ip: %s)\n"_fmt, ad.userid, account_id, ip); goto x7946_out; @@ -2233,59 +2359,66 @@ void parse_admin(Session *s) } LOGIN_LOG("'ladmin': Name request (by id) of an unknown account (id: %d, ip: %s)\n"_fmt, account_id, ip); - WFIFO_STRING(s, 6, ""_s, 24); + fixed_47.account_name = stringish(""_s); x7946_out: - WFIFOSET(s, 30); - } - RFIFOSKIP(s, 6); + send_fpacket<0x7947, 30>(s, fixed_47); break; + } case 0x7948: // Request to change the validity limit (timestamp) (absolute value) - if (RFIFOREST(s) < 30) - return; + { + RPacket_0x7948_Fixed fixed; + rv = recv_fpacket<0x7948, 30>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7949_Fixed fixed_49; { - WFIFOW(s, 0) = 0x7949; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); - TimeT timestamp = static_cast(RFIFOL(s, 26)); + fixed_49.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); + TimeT timestamp = fixed.valid_until; timestamp_seconds_buffer tmpstr = stringish("unlimited"_s); if (timestamp) stamp_time(tmpstr, ×tamp); AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_49.account_name = ad->userid; LOGIN_LOG("'ladmin': Change of a validity limit (account: %s, new validity: %lld (%s), ip: %s)\n"_fmt, ad->userid, timestamp, tmpstr, ip); ad->connect_until_time = timestamp; - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_49.account_id = ad->account_id; } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_49.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to change the validity limit of an unknown account (account: %s, received validity: %lld (%s), ip: %s)\n"_fmt, account_name, timestamp, tmpstr, ip); } - WFIFOL(s, 30) = static_cast(timestamp); + fixed_49.valid_until = timestamp; } - WFIFOSET(s, 34); - RFIFOSKIP(s, 30); + send_fpacket<0x7949, 34>(s, fixed_49); break; + } case 0x794a: // Request to change the final date of a banishment (timestamp) (absolute value) - if (RFIFOREST(s) < 30) - return; + { + RPacket_0x794a_Fixed fixed; + rv = recv_fpacket<0x794a, 30>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x794b_Fixed fixed_4b; { - WFIFOW(s, 0) = 0x794b; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); - TimeT timestamp = static_cast(RFIFOL(s, 26)); + fixed_4b.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); + TimeT timestamp = fixed.ban_until; if (timestamp <= TimeT::now()) timestamp = TimeT(); timestamp_seconds_buffer tmpstr = stringish("no banishment"_s); @@ -2294,8 +2427,8 @@ void parse_admin(Session *s) AuthData *ad = search_account(account_name); if (ad) { - WFIFO_STRING(s, 6, ad->userid, 24); - WFIFOL(s, 2) = unwrap(ad->account_id); + fixed_4b.account_name = ad->userid; + fixed_4b.account_id = ad->account_id; LOGIN_LOG("'ladmin': Change of the final date of a banishment (account: %s, new final date of banishment: %lld (%s), ip: %s)\n"_fmt, ad->userid, timestamp, tmpstr, @@ -2304,46 +2437,56 @@ void parse_admin(Session *s) { if (timestamp) { - unsigned char buf[16]; - WBUFW(buf, 0) = 0x2731; - WBUFL(buf, 2) = unwrap(ad->account_id); - WBUFB(buf, 6) = 1; // 0: change of statut, 1: ban - WBUFL(buf, 7) = static_cast(timestamp); // status or final date of a banishment - charif_sendallwos(nullptr, buf, 11); + SPacket_0x2731_Fixed fixed_31; + fixed_31.account_id = ad->account_id; + fixed_31.ban_not_status = 1; + fixed_31.status_or_ban_until = timestamp; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2731, 11>(ss, fixed_31); + } + for (int j = 0; j < AUTH_FIFO_SIZE; j++) + { if (auth_fifo[j].account_id == ad->account_id) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentification) + } } ad->ban_until_time = timestamp; } } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_4b.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to change the final date of a banishment of an unknown account (account: %s, received final date of banishment: %lld (%s), ip: %s)\n"_fmt, account_name, timestamp, tmpstr, ip); } - WFIFOL(s, 30) = static_cast(timestamp); + fixed_4b.ban_until = timestamp; } - WFIFOSET(s, 34); - RFIFOSKIP(s, 30); + send_fpacket<0x794b, 34>(s, fixed_4b); break; + } case 0x794c: // Request to change the final date of a banishment (timestamp) (relative change) - if (RFIFOREST(s) < 38) - return; + { + RPacket_0x794c_Fixed fixed; + rv = recv_fpacket<0x794c, 38>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x794d_Fixed fixed_4d; { - WFIFOW(s, 0) = 0x794d; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + fixed_4d.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); AuthData *ad = search_account(account_name); if (ad) { - WFIFOL(s, 2) = unwrap(ad->account_id); - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_4d.account_id = ad->account_id; + fixed_4d.account_name = ad->userid; TimeT timestamp; TimeT now = TimeT::now(); if (!ad->ban_until_time @@ -2352,8 +2495,7 @@ void parse_admin(Session *s) else timestamp = ad->ban_until_time; struct tm tmtime = timestamp; - HumanTimeDiff ban_diff; - RFIFO_STRUCT(s, 26, ban_diff); + HumanTimeDiff ban_diff = fixed.ban_add; tmtime.tm_year += ban_diff.year; tmtime.tm_mon += ban_diff.month; tmtime.tm_mday += ban_diff.day; @@ -2380,16 +2522,22 @@ void parse_admin(Session *s) { if (timestamp) { - unsigned char buf[16]; - WBUFW(buf, 0) = 0x2731; - WBUFL(buf, 2) = unwrap(ad->account_id); - WBUFB(buf, 6) = 1; // 0: change of statut, 1: ban - WBUFL(buf, 7) = static_cast(timestamp); // status or final date of a banishment - charif_sendallwos(nullptr, buf, 11); + SPacket_0x2731_Fixed fixed_31; + fixed_31.account_id = ad->account_id; + fixed_31.ban_not_status = 1; + fixed_31.status_or_ban_until = timestamp; + + for (Session *ss : iter_char_sessions()) + { + send_fpacket<0x2731, 11>(ss, fixed_31); + } + for (int j = 0; j < AUTH_FIFO_SIZE; j++) + { if (auth_fifo[j].account_id == ad->account_id) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentification) + } } ad->ban_until_time = timestamp; } @@ -2408,30 +2556,34 @@ void parse_admin(Session *s) ban_diff.minute, ban_diff.second, ip); } - WFIFOL(s, 30) = static_cast(ad->ban_until_time); + fixed_4d.ban_until = ad->ban_until_time; } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_4d.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to adjust the final date of a banishment of an unknown account (account: %s, ip: %s)\n"_fmt, account_name, ip); - WFIFOL(s, 30) = 0; + fixed_4d.ban_until = TimeT(); } } - WFIFOSET(s, 34); - RFIFOSKIP(s, 38); + send_fpacket<0x794d, 34>(s, fixed_4d); break; + } case 0x794e: // Request to send a broadcast message - if (RFIFOREST(s) < 8 - || RFIFOREST(s) < (8 + RFIFOL(s, 4))) - return; - WFIFOW(s, 0) = 0x794f; - WFIFOW(s, 2) = -1; - if (RFIFOL(s, 4) < 1) + { + RPacket_0x794e_Head head; + AString repeat; + rv = recv_vpacket<0x794e, 8, 1>(s, head, repeat); + if (rv != RecvResult::Complete) + break; + + SPacket_0x794f_Fixed fixed_4f; + fixed_4f.error = -1; + if (!repeat) { LOGIN_LOG("'ladmin': Receiving a message for broadcast, but message is void (ip: %s)\n"_fmt, - ip); + ip); } else { @@ -2445,41 +2597,48 @@ void parse_admin(Session *s) { x794e_have_server: // overwrite the -1 - WFIFOW(s, 2) = 0; + fixed_4f.error = 0; - size_t len = RFIFOL(s, 4); - AString message = RFIFO_STRING(s, 8, len).to_print(); + AString& message = repeat; LOGIN_LOG("'ladmin': Receiving a message for broadcast (message: %s, ip: %s)\n"_fmt, message, ip); + // send same message to all char-servers (no answer) - uint8_t buf[len + 8]; - RFIFO_BUF_CLONE(s, buf, 8 + len); - WBUFW(buf, 0) = 0x2726; - charif_sendallwos(nullptr, buf, 8 + len); + SPacket_0x2726_Head head_26; + head_26.unused = head.unused; + + for (Session *ss : iter_char_sessions()) + { + send_vpacket<0x2726, 8, 1>(ss, head_26, message); + } } } x794e_have_no_server: - WFIFOSET(s, 4); - RFIFOSKIP(s, 8 + RFIFOL(s, 4)); + send_fpacket<0x794f, 4>(s, fixed_4f); break; + } case 0x7950: // Request to change the validity limite (timestamp) (relative change) - if (RFIFOREST(s) < 38) - return; + { + RPacket_0x7950_Fixed fixed; + rv = recv_fpacket<0x7950, 38>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7951_Fixed fixed_51; { - WFIFOW(s, 0) = 0x7951; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + fixed_51.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); AuthData *ad = search_account(account_name); if (ad) { - WFIFOL(s, 2) = unwrap(ad->account_id); - WFIFO_STRING(s, 6, ad->userid, 24); + fixed_51.account_id = ad->account_id; + fixed_51.account_name = ad->userid; if (add_to_unlimited_account == 0 && !ad->connect_until_time) { LOGIN_LOG("'ladmin': Attempt to adjust the validity limit of an unlimited account (account: %s, ip: %s)\n"_fmt, - ad->userid, ip); - WFIFOL(s, 30) = 0; + ad->userid, ip); + fixed_51.valid_until = TimeT(); } else { @@ -2488,8 +2647,7 @@ void parse_admin(Session *s) if (!timestamp || timestamp < now) timestamp = now; struct tm tmtime = timestamp; - HumanTimeDiff v_diff; - RFIFO_STRUCT(s, 26, v_diff); + HumanTimeDiff v_diff = fixed.valid_add; tmtime.tm_year += v_diff.year; tmtime.tm_mon += v_diff.month; tmtime.tm_mday += v_diff.day; @@ -2519,7 +2677,7 @@ void parse_admin(Session *s) tmpstr2, ip); ad->connect_until_time = timestamp; - WFIFOL(s, 30) = static_cast(timestamp); + fixed_51.valid_until = timestamp; } else { @@ -2537,117 +2695,122 @@ void parse_admin(Session *s) v_diff.minute, v_diff.second, ip); - WFIFOL(s, 30) = 0; + fixed_51.valid_until = TimeT(); } } } else { - WFIFO_STRING(s, 6, account_name, 24); + fixed_51.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to adjust the validity limit of an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); - WFIFOL(s, 30) = 0; + account_name, ip); + fixed_51.valid_until = TimeT(); } } - WFIFOSET(s, 34); - RFIFOSKIP(s, 38); + send_fpacket<0x7951, 34>(s, fixed_51); break; + } case 0x7952: // Request about informations of an account (by account name) - if (RFIFOREST(s) < 26) - return; { - WFIFOW(s, 0) = 0x7953; - WFIFOL(s, 2) = unwrap(AccountId()); - AccountName account_name = stringish(RFIFO_STRING<24>(s, 2).to_print()); + RPacket_0x7952_Fixed fixed; + rv = recv_fpacket<0x7952, 26>(s, fixed); + if (rv != RecvResult::Complete) + break; + + SPacket_0x7953_Head head_53; + head_53.account_id = AccountId(); + AccountName account_name = stringish(fixed.account_name.to_print()); const AuthData *ad = search_account(account_name); if (ad) { - WFIFOL(s, 2) = unwrap(ad->account_id); - // TODO fix size (there's a lot of other stuff wrong with this packet too) - WFIFOB(s, 6) = static_cast(isGM(ad->account_id).get_all_bits()); - WFIFO_STRING(s, 7, ad->userid, 24); - WFIFOB(s, 31) = static_cast(ad->sex); - WFIFOL(s, 32) = ad->logincount; - WFIFOL(s, 36) = ad->state; - WFIFO_STRING(s, 40, ad->error_message, 20); - WFIFO_STRING(s, 60, ad->lastlogin, 24); - WFIFO_STRING(s, 84, convert_for_printf(ad->last_ip), 16); - WFIFO_STRING(s, 100, ad->email, 40); - WFIFOL(s, 140) = static_cast(ad->connect_until_time); - WFIFOL(s, 144) = static_cast(ad->ban_until_time); - size_t len = ad->memo.size() + 1; - WFIFOW(s, 148) = len; - WFIFO_STRING(s, 150, ad->memo, len); + head_53.account_id = ad->account_id; + head_53.gm_level = isGM(ad->account_id); + head_53.account_name = ad->userid; + head_53.sex = ad->sex; + head_53.login_count = ad->logincount; + head_53.state = ad->state; + head_53.error_message = ad->error_message; + head_53.last_login_string = ad->lastlogin; + head_53.ip_string = convert_for_printf(ad->last_ip); + head_53.email = ad->email; + head_53.connect_until = ad->connect_until_time; + head_53.ban_until = ad->ban_until_time; + + XString repeat_53 = ad->memo; LOGIN_LOG("'ladmin': Sending information of an account (request by the name; account: %s, id: %d, ip: %s)\n"_fmt, - ad->userid, ad->account_id, - ip); - WFIFOSET(s, 150 + len); + ad->userid, ad->account_id, + ip); + + send_vpacket<0x7953, 150, 1>(s, head_53, repeat_53); } else { - WFIFO_STRING(s, 7, account_name, 24); - WFIFOW(s, 148) = 0; + head_53.account_name = account_name; LOGIN_LOG("'ladmin': Attempt to obtain information (by the name) of an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); - WFIFOSET(s, 150); + account_name, ip); + send_vpacket<0x7953, 150, 1>(s, head_53, ""_s); } - } - RFIFOSKIP(s, 26); break; + } case 0x7954: // Request about information of an account (by account id) - if (RFIFOREST(s) < 6) - return; { - AccountId account_id = wrap(RFIFOL(s, 2)); - WFIFOW(s, 0) = 0x7953; - WFIFOL(s, 2) = unwrap(account_id); - WFIFO_ZERO(s, 7, 24); + RPacket_0x7954_Fixed fixed; + rv = recv_fpacket<0x7954, 6>(s, fixed); + if (rv != RecvResult::Complete) + break; + + AccountId account_id = fixed.account_id; + SPacket_0x7953_Head head_53; + head_53.account_id = account_id; + head_53.account_name = AccountName(); for (const AuthData& ad : auth_data) { if (ad.account_id == account_id) { LOGIN_LOG("'ladmin': Sending information of an account (request by the id; account: %s, id: %d, ip: %s)\n"_fmt, - ad.userid, RFIFOL(s, 2), ip); - WFIFOB(s, 6) = static_cast(isGM(ad.account_id).get_all_bits()); - WFIFO_STRING(s, 7, ad.userid, 24); - WFIFOB(s, 31) = static_cast(ad.sex); - WFIFOL(s, 32) = ad.logincount; - WFIFOL(s, 36) = ad.state; - WFIFO_STRING(s, 40, ad.error_message, 20); - WFIFO_STRING(s, 60, ad.lastlogin, 24); - WFIFO_STRING(s, 84, convert_for_printf(ad.last_ip), 16); - WFIFO_STRING(s, 100, ad.email, 40); - WFIFOL(s, 140) = static_cast(ad.connect_until_time); - WFIFOL(s, 144) = static_cast(ad.ban_until_time); - size_t len = ad.memo.size() + 1; - WFIFOW(s, 148) = len; - WFIFO_STRING(s, 150, ad.memo, len); - WFIFOSET(s, 150 + len); + ad.userid, account_id, ip); + head_53.gm_level = isGM(ad.account_id); + head_53.account_name = ad.userid; + head_53.sex = ad.sex; + head_53.login_count = ad.logincount; + head_53.state = ad.state; + head_53.error_message = ad.error_message; + head_53.last_login_string = ad.lastlogin; + head_53.ip_string = convert_for_printf(ad.last_ip); + head_53.email = ad.email; + head_53.connect_until = ad.connect_until_time; + head_53.ban_until = ad.ban_until_time; + XString repeat_53 = ad.memo; + send_vpacket<0x7953, 150, 1>(s, head_53, repeat_53); goto x7954_out; } } { LOGIN_LOG("'ladmin': Attempt to obtain information (by the id) of an unknown account (id: %d, ip: %s)\n"_fmt, - RFIFOL(s, 2), ip); - WFIFO_STRING(s, 7, ""_s, 24); - WFIFOW(s, 148) = 0; - WFIFOSET(s, 150); + account_id, ip); + head_53.account_name = stringish(""_s); + send_vpacket<0x7953, 150, 1>(s, head_53, ""_s); } - } x7954_out: - RFIFOSKIP(s, 6); break; + } case 0x7955: // Request to reload GM file (no answer) + { + RPacket_0x7955_Fixed fixed; + rv = recv_fpacket<0x7955, 2>(s, fixed); + if (rv != RecvResult::Complete) + break; + LOGIN_LOG("'ladmin': Request to re-load GM configuration file (ip: %s).\n"_fmt, - ip); + ip); read_gm_account(); // send GM accounts to all char-servers send_GM_accounts(); - RFIFOSKIP(s, 2); break; + } default: { @@ -2657,55 +2820,24 @@ void parse_admin(Session *s) timestamp_milliseconds_buffer timestr; stamp_time(timestr); FPRINTF(logfp, - "%s: receiving of an unknown packet -> disconnection\n"_fmt, - timestr); + "%s: receiving of an unknown packet -> disconnection\n"_fmt, + timestr); FPRINTF(logfp, - "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, - s, ip, RFIFOW(s, 0), RFIFOREST(s)); + "parse_admin: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, + 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 (int 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("'ladmin': End of connection, unknown packet (ip: %s)\n"_fmt, - ip); + ip); s->set_eof(); PRINTF("Remote administration has been disconnected (unknown packet).\n"_fmt); return; + } } - //WFIFOW(fd,0) = 0x791f; - //WFIFOSET(fd,2); } + if (rv == RecvResult::Error) + s->set_eof(); return; } @@ -2743,8 +2875,8 @@ void parse_login(Session *s) { AccountName account_name = stringish(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); + s, RFIFOW(s, 0), RFIFOREST(s), + account_name); } } else if (RFIFOW(s, 0) == 0x2710) @@ -2753,13 +2885,13 @@ void parse_login(Session *s) { ServerName server_name = stringish(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); + s, RFIFOW(s, 0), RFIFOREST(s), + server_name); } } else PRINTF("parse_login: connection #%d, packet: 0x%x (with being read: %zu).\n"_fmt, - s, RFIFOW(s, 0), RFIFOREST(s)); + s, RFIFOW(s, 0), RFIFOREST(s)); } switch (RFIFOW(s, 0)) @@ -2785,12 +2917,12 @@ void parse_login(Session *s) account.passwdenc = 0; LOGIN_LOG("Request for connection (non encryption mode) of %s (ip: %s).\n"_fmt, - account.userid, ip); + account.userid, ip); if (!check_ip(ip)) { LOGIN_LOG("Connection refused: IP isn't authorised (deny/allow, ip: %s).\n"_fmt, - ip); + ip); WFIFOW(s, 0) = 0x6a; WFIFOB(s, 2) = 0x03; WFIFO_ZERO(s, 3, 20); @@ -2813,8 +2945,8 @@ void parse_login(Session *s) if (!(gm_level.satisfies(min_level_to_connect))) { 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); + min_level_to_connect, account.userid, + gm_level, ip); WFIFOW(s, 0) = 0x81; WFIFOB(s, 2) = 1; // 01 = Server closed WFIFOSET(s, 3); @@ -2825,10 +2957,10 @@ void parse_login(Session *s) if (gm_level) PRINTF("Connection of the GM (level:%d) account '%s' accepted.\n"_fmt, - gm_level, account.userid); + gm_level, account.userid); else PRINTF("Connection of the account '%s' accepted.\n"_fmt, - account.userid); + account.userid); /* * Add a 0x0063 packet, which contains the name of the update host. The packet will only @@ -2854,7 +2986,7 @@ void parse_login(Session *s) } // Load list of char servers into outbound packet - server_num = 0; + int server_num = 0; // if (version_2 & VERSION_2_SERVERORDER) for (int i = 0; i < MAX_SERVERS; i++) { @@ -2902,7 +3034,7 @@ void parse_login(Session *s) else { LOGIN_LOG("Connection refused: there is no char-server online (account: %s, ip: %s).\n"_fmt, - account.userid, ip); + account.userid, ip); WFIFOW(s, 0) = 0x81; WFIFOB(s, 2) = 1; // 01 = Server closed WFIFOSET(s, 3); @@ -2977,10 +3109,10 @@ void parse_login(Session *s) { x2710_okay: LOGIN_LOG("Connection of the char-server '%s' accepted (account: %s, pass: %s, ip: %s)\n"_fmt, - server_name, account.userid, - account.passwd, ip); + server_name, account.userid, + account.passwd, ip); PRINTF("Connection of the char-server '%s' accepted.\n"_fmt, - server_name); + server_name); server[unwrap(account.account_id)] = mmo_char_server{}; server[unwrap(account.account_id)].ip = RFIFOIP(s, 54); server[unwrap(account.account_id)].port = RFIFOW(s, 58); @@ -3014,8 +3146,8 @@ void parse_login(Session *s) { x2710_refused: LOGIN_LOG("Connexion of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s)\n"_fmt, - server_name, account.userid, - account.passwd, ip); + server_name, account.userid, + account.passwd, ip); WFIFOW(s, 0) = 0x2711; WFIFOB(s, 2) = 3; WFIFOSET(s, 3); @@ -3027,7 +3159,7 @@ void parse_login(Session *s) case 0x7530: // Request of the server version LOGIN_LOG("Sending of the server version (ip: %s)\n"_fmt, - ip); + ip); WFIFOW(s, 0) = 0x7531; { Version version = CURRENT_LOGIN_SERVER_VERSION; @@ -3052,7 +3184,7 @@ void parse_login(Session *s) 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, - ip); + ip); } else { @@ -3065,24 +3197,24 @@ void parse_login(Session *s) && (password == admin_pass)) { LOGIN_LOG("'ladmin'-login: Connection in administration mode accepted (non encrypted password: %s, ip: %s)\n"_fmt, - password, ip); + password, ip); PRINTF("Connection of a remote administration accepted (non encrypted password).\n"_fmt); WFIFOB(s, 2) = 0; s->set_parsers(SessionParsers{.func_parse= parse_admin, .func_delete= delete_admin}); } else if (admin_state != 1) LOGIN_LOG("'ladmin'-login: Connection in administration mode REFUSED - remote administration is disabled (non encrypted password: %s, ip: %s)\n"_fmt, - password, ip); + password, ip); else LOGIN_LOG("'ladmin'-login: Connection in administration mode REFUSED - invalid password (non encrypted password: %s, ip: %s)\n"_fmt, - password, ip); + password, ip); } else { // encrypted password { LOGIN_LOG("'ladmin'-login: Connection in administration mode REFUSED - encrypted login is disabled (ip: %s)\n"_fmt, - ip); + ip); } } } @@ -3099,15 +3231,15 @@ void parse_login(Session *s) timestamp_milliseconds_buffer timestr; stamp_time(timestr); FPRINTF(logfp, - "%s: receiving of an unknown packet -> disconnection\n"_fmt, - timestr); + "%s: receiving of an unknown packet -> disconnection\n"_fmt, + 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)); + "parse_login: connection #%d (ip: %s), packet: 0x%x (with being read: %zu).\n"_fmt, + s, ip, RFIFOW(s, 0), + RFIFOREST(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); + "---- 00-01-02-03-04-05-06-07 08-09-0A-0B-0C-0D-0E-0F\n"_fmt); char tmpstr[16 + 1] {}; @@ -3273,7 +3405,7 @@ bool login_config(XString w1, ZString w2) } else if (w1 == "level_new_gm"_s) { - level_new_gm = atoi(w2.c_str()); + level_new_gm = GmLevel::from(static_cast(atoi(w2.c_str()))); } else if (w1 == "new_account"_s) { @@ -3484,13 +3616,6 @@ bool display_conf_warnings(void) PRINTF(" We highly recommend that you change it.\n"_fmt); } - if (level_new_gm < 0 || level_new_gm > 99) - { - PRINTF("***WARNING: Invalid value for level_new_gm parameter -> set to 60 (default).\n"_fmt); - level_new_gm = 60; - rv = false; - } - if (new_account != 0 && new_account != 1) { PRINTF("***WARNING: Invalid value for new_account parameter -> set to 0 (no new account).\n"_fmt); @@ -3655,11 +3780,11 @@ void save_config_in_log(void) else LOGIN_LOG("- with a 'To GM become' password (gm_pass) of %zu character(s).\n"_fmt, gm_pass.size()); - if (level_new_gm == 0) + if (!level_new_gm) LOGIN_LOG("- to refuse any creation of GM with @gm.\n"_fmt); else LOGIN_LOG("- to create GM with level '%d' when @gm is used.\n"_fmt, - level_new_gm); + level_new_gm); if (new_account == 1) LOGIN_LOG("- to ALLOW new users (with _F/_M).\n"_fmt); @@ -3667,19 +3792,19 @@ void save_config_in_log(void) LOGIN_LOG("- to NOT ALLOW new users (with _F/_M).\n"_fmt); LOGIN_LOG("- with port: %d.\n"_fmt, login_port); LOGIN_LOG("- with the accounts file name: '%s'.\n"_fmt, - account_filename); + account_filename); LOGIN_LOG("- with the GM accounts file name: '%s'.\n"_fmt, - gm_account_filename); + gm_account_filename); if (gm_account_filename_check_timer == interval_t::zero()) LOGIN_LOG("- to NOT check GM accounts file modifications.\n"_fmt); else LOGIN_LOG("- to check GM accounts file modifications every %lld seconds.\n"_fmt, - maybe_cast(gm_account_filename_check_timer.count())); + maybe_cast(gm_account_filename_check_timer.count())); // not necessary to log the 'login_log_filename', we are inside :) LOGIN_LOG("- with the unknown packets file name: '%s'.\n"_fmt, - login_log_unknown_packets_filename); + login_log_unknown_packets_filename); if (save_unknown_packets) LOGIN_LOG("- to SAVE all unkown packets.\n"_fmt); else @@ -3701,7 +3826,7 @@ void save_config_in_log(void) LOGIN_LOG("- with no minimum level for connection.\n"_fmt); else LOGIN_LOG("- to accept only GM with level %d or more.\n"_fmt, - min_level_to_connect); + min_level_to_connect); if (add_to_unlimited_account) LOGIN_LOG("- to authorize adjustment (with timeadd ladmin) on an unlimited account.\n"_fmt); @@ -3714,7 +3839,7 @@ void save_config_in_log(void) LOGIN_LOG("- to create new accounts with a limited time: time of creation.\n"_fmt); else LOGIN_LOG("- to create new accounts with a limited time: time of creation + %d second(s).\n"_fmt, - start_limited_time); + start_limited_time); if (check_ip_flag) LOGIN_LOG("- with control of players IP between login-server and char-server.\n"_fmt); @@ -3896,10 +4021,10 @@ int do_init(Slice argv) j).detach(); LOGIN_LOG("The login-server is ready (Server is listening on the port %d).\n"_fmt, - login_port); + login_port); PRINTF("The login-server is " SGR_BOLD SGR_GREEN "ready" SGR_RESET " (Server is listening on the port %d).\n\n"_fmt, - login_port); + login_port); return 0; } diff --git a/src/map/pc.cpp b/src/map/pc.cpp index f3f56b1..44c401b 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -4312,7 +4312,7 @@ int pc_setaccountreg2(dumb_ptr sd, VarName reg, int val) return 0; } if (battle_config.error_log) - PRINTF("pc_setaccountreg2 : couldn't set %s (ACCOUNT_REG2_NUM = %d)\n"_fmt, + PRINTF("pc_setaccountreg2 : couldn't set %s (ACCOUNT_REG2_NUM = %zu)\n"_fmt, reg, ACCOUNT_REG2_NUM); return 1; diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp index a7dcc89..52e1009 100644 --- a/src/mmo/enums.hpp +++ b/src/mmo/enums.hpp @@ -145,4 +145,17 @@ SEX sex_from_char(char c) } } +inline +bool native_to_network(char *network, SEX native) +{ + *network = sex_to_char(native); + return true; +} +inline +bool network_to_native(SEX *native, char network) +{ + *native = sex_from_char(network); + return true; +} + #endif // TMWA_MMO_ENUMS_HPP diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index a0cee57..d96e619 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -45,7 +45,7 @@ constexpr int TRADE_MAX = 10; constexpr int GLOBAL_REG_NUM = 96; constexpr int ACCOUNT_REG_NUM = 16; -constexpr int ACCOUNT_REG2_NUM = 16; +constexpr size_t ACCOUNT_REG2_NUM = 16; constexpr interval_t DEFAULT_WALK_SPEED = std::chrono::milliseconds(150); constexpr interval_t MIN_WALK_SPEED = interval_t::zero(); constexpr interval_t MAX_WALK_SPEED = std::chrono::seconds(1); diff --git a/src/mmo/version.hpp b/src/mmo/version.hpp index 9e20bf1..5d28b5d 100644 --- a/src/mmo/version.hpp +++ b/src/mmo/version.hpp @@ -35,6 +35,7 @@ # define TMWA_SERVER_INTER 0x04 # define TMWA_SERVER_MAP 0x08 +// TODO now that I generate the protocol, split 'flags' out of the struct struct Version { uint8_t major; diff --git a/src/net/packets.cpp b/src/net/packets.cpp new file mode 100644 index 0000000..5595b1d --- /dev/null +++ b/src/net/packets.cpp @@ -0,0 +1,89 @@ +#include "packets.hpp" +// packets.cpp - palatable socket buffer accessors +// +// Copyright © 2014 Ben Longbons +// +// 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 . + +# include "../io/cxxstdio.hpp" +# include "../io/write.hpp" + +#include "vomit.hpp" + +#include "../poison.hpp" + +size_t packet_avail(Session *s) +{ + return RFIFOREST(s); +} + +bool packet_fetch(Session *s, size_t offset, Byte *data, size_t sz) +{ + if (RFIFOREST(s) < offset + sz) + return false; + const Byte *start = reinterpret_cast(RFIFOP(s, offset)); + const Byte *end = start + sz; + std::copy(start, end, data); + return true; +} +void packet_discard(Session *s, size_t sz) +{ + RFIFOSKIP(s, sz); +} +bool packet_send(Session *s, const Byte *data, size_t sz) +{ + WFIFOSET(s, sz); + Byte *end = reinterpret_cast(WFIFOP(s, 0)); + Byte *start = end - sz; + std::copy(data, data + sz, start); + return true; +} + +void packet_dump(io::WriteFile& logfp, Session *s) +{ + 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 (int 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); +} diff --git a/src/net/packets.hpp b/src/net/packets.hpp new file mode 100644 index 0000000..2e3d77c --- /dev/null +++ b/src/net/packets.hpp @@ -0,0 +1,354 @@ +#ifndef TMWA_NET_PACKETS_HPP +#define TMWA_NET_PACKETS_HPP +// packets.hpp - palatable socket buffer accessors +// +// Copyright © 2014 Ben Longbons +// +// 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 . + +# include "fwd.hpp" + +# include "../compat/cast.hpp" + +# include "../ints/little.hpp" + + #include "../io/fwd.hpp" + +# include "socket.hpp" + +enum class RecvResult +{ + Incomplete, + Complete, + Error, +}; + +enum class SendResult +{ + Success, + Fail, +}; + + +size_t packet_avail(Session *s); +void packet_dump(io::WriteFile& out, Session *s); + +bool packet_fetch(Session *s, size_t offset, Byte *data, size_t sz); +void packet_discard(Session *s, size_t sz); +bool packet_send(Session *s, const Byte *data, size_t sz); + +inline +bool packet_peek_id(Session *s, uint16_t *packet_id) +{ + Little16 id; + bool okay = packet_fetch(s, 0, reinterpret_cast(&id), 2); + if (okay) + { + if (!network_to_native(packet_id, id)) + { + s->set_eof(); + return false; + } + } + return okay; +} + +template +__attribute__((warn_unused_result)) +SendResult net_send_fpacket(Session *s, const F& fixed) +{ + bool ok = packet_send(s, reinterpret_cast(&fixed), sizeof(F)); + return ok ? SendResult::Success : SendResult::Fail; +} + +template +__attribute__((warn_unused_result)) +SendResult net_send_vpacket(Session *s, const H& head, const std::vector& repeat) +{ + bool ok = packet_send(s, reinterpret_cast(&head), sizeof(H)); + ok &= packet_send(s, reinterpret_cast(repeat.data()), repeat.size() * sizeof(R)); + return ok ? SendResult::Success : SendResult::Fail; +} + +template +__attribute__((warn_unused_result)) +RecvResult net_recv_fpacket(Session *s, F& fixed) +{ + bool ok = packet_fetch(s, 0, reinterpret_cast(&fixed), sizeof(F)); + if (ok) + { + packet_discard(s, sizeof(F)); + return RecvResult::Complete; + } + return RecvResult::Incomplete; +} + +template +__attribute__((warn_unused_result)) +RecvResult net_recv_vpacket(Session *s, H& head, std::vector& repeat) +{ + bool ok = packet_fetch(s, 0, reinterpret_cast(&head), sizeof(H)); + if (ok) + { + HNat nat; + if (!network_to_native(&nat, head)) + return RecvResult::Error; + if (packet_avail(s) < nat.magic_packet_length) + return RecvResult::Incomplete; + if (nat.magic_packet_length < sizeof(H)) + return RecvResult::Error; + size_t bytes_repeat = nat.magic_packet_length - sizeof(H); + if (bytes_repeat % sizeof(R)) + return RecvResult::Error; + repeat.resize(bytes_repeat / sizeof(R)); + if (packet_fetch(s, sizeof(H), reinterpret_cast(repeat.data()), bytes_repeat)) + { + packet_discard(s, nat.magic_packet_length); + return RecvResult::Complete; + } + return RecvResult::Incomplete; + } + return RecvResult::Incomplete; +} + + +template +void send_fpacket(Session *s, const F& fixed) +{ + static_assert(id == F::PACKET_ID, "F::PACKET_ID"); + static_assert(size == sizeof(typename F::NetType), "F::NetType"); + + typename F::NetType net_fixed; + if (!native_to_network(&net_fixed, fixed)) + { + s->set_eof(); + return; + } + SendResult rv = net_send_fpacket(s, net_fixed); + if (rv != SendResult::Success) + s->set_eof(); +} + +template +void send_vpacket(Session *s, H& head, const std::vector& repeat) +{ + static_assert(id == H::PACKET_ID, "H::PACKET_ID"); + static_assert(headsize == sizeof(typename H::NetType), "H::NetType"); + static_assert(id == R::PACKET_ID, "R::PACKET_ID"); + static_assert(repeatsize == sizeof(typename R::NetType), "R::NetType"); + + typename H::NetType net_head; + // since these are already allocated, can't overflow address space + size_t total_size = sizeof(typename H::NetType) + repeat.size() * sizeof(typename R::NetType); + // truncates + head.magic_packet_length = total_size; + if (head.magic_packet_length != total_size) + { + s->set_eof(); + return; + } + // TODO potentially avoid the allocation + std::vector net_repeat(repeat.size()); + if (!native_to_network(&net_head, head)) + { + s->set_eof(); + return; + } + for (size_t i = 0; i < repeat.size(); ++i) + { + if (!native_to_network(&net_repeat[i], repeat[i])) + { + s->set_eof(); + return; + } + } + SendResult rv = net_send_vpacket(s, net_head, net_repeat); + if (rv != SendResult::Success) + s->set_eof(); +} + +template +__attribute__((warn_unused_result)) +RecvResult recv_fpacket(Session *s, F& fixed) +{ + static_assert(id == F::PACKET_ID, "F::PACKET_ID"); + static_assert(size == sizeof(typename F::NetType), "F::NetType"); + + typename F::NetType net_fixed; + RecvResult rv = net_recv_fpacket(s, net_fixed); + assert (fixed.magic_packet_id == F::PACKET_ID); + if (rv == RecvResult::Complete) + { + if (!network_to_native(&fixed, net_fixed)) + return RecvResult::Error; + } + return rv; +} + +template +__attribute__((warn_unused_result)) +RecvResult recv_vpacket(Session *s, H& head, std::vector& repeat) +{ + static_assert(id == H::PACKET_ID, "H::PACKET_ID"); + static_assert(headsize == sizeof(typename H::NetType), "H::NetType"); + static_assert(id == R::PACKET_ID, "R::PACKET_ID"); + static_assert(repeatsize == sizeof(typename R::NetType), "R::NetType"); + + typename H::NetType net_head; + std::vector net_repeat; + RecvResult rv = net_recv_vpacket(s, net_head, net_repeat); + assert (head.magic_packet_id == H::PACKET_ID); + if (rv == RecvResult::Complete) + { + if (!network_to_native(&head, net_head)) + return RecvResult::Error; + repeat.resize(net_repeat.size()); + for (size_t i = 0; i < net_repeat.size(); ++i) + { + if (!network_to_native(&repeat[i], net_repeat[i])) + return RecvResult::Error; + } + } + return rv; +} + +// convenience for trailing strings + +struct VarStringNetType +{ + char c; +}; + +template +void send_vpacket(Session *s, H& head, const XString& repeat) +{ + static_assert(id == H::PACKET_ID, "H::PACKET_ID"); + static_assert(headsize == sizeof(typename H::NetType), "H::NetType"); + // static_assert(id == R::PACKET_ID, "R::PACKET_ID"); + static_assert(repeatsize == 1, "R::NetType"); + + typename H::NetType net_head; + // since it's already allocated, it can't overflow address space + size_t total_length = sizeof(typename H::NetType) + (repeat.size() + 1) * sizeof(VarStringNetType); + head.magic_packet_length = total_length; + if (head.magic_packet_length != total_length) + { + s->set_eof(); + return; + } + // TODO potentially avoid the allocation + std::vector net_repeat(repeat.size() + 1); + if (!native_to_network(&net_head, head)) + { + s->set_eof(); + return; + } + for (size_t i = 0; i < repeat.size(); ++i) + { + net_repeat[i].c = repeat[i]; + } + net_repeat[repeat.size()].c = '\0'; + SendResult rv = net_send_vpacket(s, net_head, net_repeat); + if (rv != SendResult::Success) + s->set_eof(); +} + +template +__attribute__((warn_unused_result)) +RecvResult recv_vpacket(Session *s, H& head, AString& repeat) +{ + static_assert(id == H::PACKET_ID, "H::PACKET_ID"); + static_assert(headsize == sizeof(typename H::NetType), "H::NetType"); + //static_assert(id == R::PACKET_ID, "R::PACKET_ID"); + static_assert(repeatsize == 1, "R::NetType"); + + typename H::NetType net_head; + std::vector net_repeat; + RecvResult rv = net_recv_vpacket(s, net_head, net_repeat); + assert (head.magic_packet_id == H::PACKET_ID); + if (rv == RecvResult::Complete) + { + if (!network_to_native(&head, net_head)) + return RecvResult::Error; + // reinterpret_cast is needed to correctly handle an empty vector + const char *begin = sign_cast(net_repeat.data()); + const char *end = begin + repeat.size(); + end = std::find(begin, end, '\0'); + repeat = XString(begin, end, nullptr); + } + return rv; +} + + +// if there is nothing in the head but the id and length, use the below + +// TODO make this go away with template specialization + +template +struct NetCommonPacketHead +{ + Little16 magic_packet_id; + Little16 magic_packet_length; +}; + +template +struct CommonPacketHead +{ + using NetType = NetCommonPacketHead; + static const uint16_t PACKET_ID = PKT_ID; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length; +}; + +template +bool native_to_network(NetCommonPacketHead *net, CommonPacketHead nat) +{ + return native_to_network(&net->magic_packet_id, nat.magic_packet_id) + && native_to_network(&net->magic_packet_length, nat.magic_packet_length); +} + +template +bool network_to_native(CommonPacketHead *nat, NetCommonPacketHead net) +{ + return network_to_native(&nat->magic_packet_id, net.magic_packet_id) + && network_to_native(&nat->magic_packet_length, net.magic_packet_length); +} + +template +void send_packet_repeatonly(Session *s, const std::vector& v) +{ + static_assert(headsize == 4, "repeat headsize"); + static_assert(id == R::PACKET_ID, "R::PACKET_ID"); + static_assert(repeatsize == sizeof(typename R::NetType), "R::NetType"); + + CommonPacketHead head; + send_vpacket(s, head, v); +} + +template +__attribute__((warn_unused_result)) +RecvResult recv_packet_repeatonly(Session *s, std::vector& v) +{ + static_assert(headsize == 4, "repeat headsize"); + static_assert(id == R::PACKET_ID, "R::PACKET_ID"); + static_assert(repeatsize == sizeof(typename R::NetType), "R::NetType"); + + CommonPacketHead head; + return recv_vpacket(s, head, v); +} + +#endif // TMWA_NET_PACKETS_HPP diff --git a/src/net/socket.cpp b/src/net/socket.cpp index 6880bfa..e9e819e 100644 --- a/src/net/socket.cpp +++ b/src/net/socket.cpp @@ -1,4 +1,5 @@ #include "socket.hpp" +#include "vomit.hpp" // for remaining FIFO functions // socket.cpp - Network event system. // // Copyright © ????-2004 Athena Dev Teams diff --git a/src/net/socket.hpp b/src/net/socket.hpp index aff8278..2b60ac6 100644 --- a/src/net/socket.hpp +++ b/src/net/socket.hpp @@ -173,17 +173,4 @@ void do_sendrecv(interval_t next); /// Call the parser function for every socket that has read data void do_parsepacket(void); -/// Check how much can be read -inline -size_t RFIFOREST(Session *s) -{ - return s->rdata_size - s->rdata_pos; -} - -/// Done reading -void RFIFOSKIP(Session *s, size_t len); - -/// Finish writing -void WFIFOSET(Session *s, size_t len); - #endif // TMWA_NET_SOCKET_HPP diff --git a/src/net/vomit.hpp b/src/net/vomit.hpp index 3d3a07f..84c54ac 100644 --- a/src/net/vomit.hpp +++ b/src/net/vomit.hpp @@ -25,6 +25,23 @@ # include "socket.hpp" +// these first three are really in socket.cpp +// but here for cleanliness + +/// Check how much can be read +inline +size_t RFIFOREST(Session *s) +{ + return s->rdata_size - s->rdata_pos; +} + +/// Done reading +void RFIFOSKIP(Session *s, size_t len); + +/// Finish writing +void WFIFOSET(Session *s, size_t len); + + template uint8_t *pod_addressof_m(T& structure) { diff --git a/src/proto2/any-user.hpp b/src/proto2/any-user.hpp index f2847ef..037171c 100644 --- a/src/proto2/any-user.hpp +++ b/src/proto2/any-user.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -27,85 +27,93 @@ // This is a public protocol, and changes require client cooperation -struct RPacket0x7530_Fixed +struct RPacket_0x7530_Fixed { - uint16_t packet_id; + using NetType = NetRPacket_0x7530_Fixed; + static const uint16_t PACKET_ID = 0x7530; + + uint16_t magic_packet_id = PACKET_ID; +}; +struct SPacket_0x7531_Fixed +{ + using NetType = NetSPacket_0x7531_Fixed; + static const uint16_t PACKET_ID = 0x7531; + + uint16_t magic_packet_id = PACKET_ID; + Version version = {}; +}; +struct RPacket_0x7532_Fixed +{ + using NetType = NetRPacket_0x7532_Fixed; + static const uint16_t PACKET_ID = 0x7532; + + uint16_t magic_packet_id = PACKET_ID; +}; + +struct NetRPacket_0x7530_Fixed +{ + Little16 magic_packet_id; +}; +static_assert(offsetof(NetRPacket_0x7530_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7530_Fixed, magic_packet_id) == 0"); +static_assert(sizeof(NetRPacket_0x7530_Fixed) == 2, "sizeof(NetRPacket_0x7530_Fixed) == 2"); +struct NetSPacket_0x7531_Fixed +{ + Little16 magic_packet_id; + NetVersion version; }; -struct NetRPacket0x7530_Fixed +static_assert(offsetof(NetSPacket_0x7531_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7531_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7531_Fixed, version) == 2, "offsetof(NetSPacket_0x7531_Fixed, version) == 2"); +static_assert(sizeof(NetSPacket_0x7531_Fixed) == 10, "sizeof(NetSPacket_0x7531_Fixed) == 10"); +struct NetRPacket_0x7532_Fixed { - Little16 packet_id; + Little16 magic_packet_id; }; -static_assert(offsetof(NetRPacket0x7530_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7530_Fixed, packet_id) == 0"); -static_assert(sizeof(NetRPacket0x7530_Fixed) == 2, "sizeof(NetRPacket0x7530_Fixed) == 2"); +static_assert(offsetof(NetRPacket_0x7532_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7532_Fixed, magic_packet_id) == 0"); +static_assert(sizeof(NetRPacket_0x7532_Fixed) == 2, "sizeof(NetRPacket_0x7532_Fixed) == 2"); + inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7530_Fixed *network, RPacket0x7530_Fixed native) +bool native_to_network(NetRPacket_0x7530_Fixed *network, RPacket_0x7530_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7530_Fixed *native, NetRPacket0x7530_Fixed network) +bool network_to_native(RPacket_0x7530_Fixed *native, NetRPacket_0x7530_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } - -struct SPacket0x7531_Fixed -{ - uint16_t packet_id; - Version version; -}; -struct NetSPacket0x7531_Fixed -{ - Little16 packet_id; - NetVersion version; -}; -static_assert(offsetof(NetSPacket0x7531_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7531_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7531_Fixed, version) == 2, "offsetof(NetSPacket0x7531_Fixed, version) == 2"); -static_assert(sizeof(NetSPacket0x7531_Fixed) == 10, "sizeof(NetSPacket0x7531_Fixed) == 10"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7531_Fixed *network, SPacket0x7531_Fixed native) +bool native_to_network(NetSPacket_0x7531_Fixed *network, SPacket_0x7531_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->version, native.version); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7531_Fixed *native, NetSPacket0x7531_Fixed network) +bool network_to_native(SPacket_0x7531_Fixed *native, NetSPacket_0x7531_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->version, network.version); return rv; } - -struct RPacket0x7532_Fixed -{ - uint16_t packet_id; -}; -struct NetRPacket0x7532_Fixed -{ - Little16 packet_id; -}; -static_assert(offsetof(NetRPacket0x7532_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7532_Fixed, packet_id) == 0"); -static_assert(sizeof(NetRPacket0x7532_Fixed) == 2, "sizeof(NetRPacket0x7532_Fixed) == 2"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7532_Fixed *network, RPacket0x7532_Fixed native) +bool native_to_network(NetRPacket_0x7532_Fixed *network, RPacket_0x7532_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7532_Fixed *native, NetRPacket0x7532_Fixed network) +bool network_to_native(RPacket_0x7532_Fixed *native, NetRPacket_0x7532_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } - #endif // TMWA_PROTO2_ANY_USER_HPP diff --git a/src/proto2/any-user_test.cpp b/src/proto2/any-user_test.cpp index 5096d24..5f9747c 100644 --- a/src/proto2/any-user_test.cpp +++ b/src/proto2/any-user_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/char-map.hpp b/src/proto2/char-map.hpp index 3caa2df..83f13a7 100644 --- a/src/proto2/char-map.hpp +++ b/src/proto2/char-map.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -28,4 +28,6 @@ // This is an internal protocol, and can be changed without notice + + #endif // TMWA_PROTO2_CHAR_MAP_HPP diff --git a/src/proto2/char-map_test.cpp b/src/proto2/char-map_test.cpp index 1b6ccb1..e941f1a 100644 --- a/src/proto2/char-map_test.cpp +++ b/src/proto2/char-map_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/char-user.hpp b/src/proto2/char-user.hpp index d85d768..b31d9f1 100644 --- a/src/proto2/char-user.hpp +++ b/src/proto2/char-user.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -28,4 +28,6 @@ // This is a public protocol, and changes require client cooperation + + #endif // TMWA_PROTO2_CHAR_USER_HPP diff --git a/src/proto2/char-user_test.cpp b/src/proto2/char-user_test.cpp index 952d196..696b6e4 100644 --- a/src/proto2/char-user_test.cpp +++ b/src/proto2/char-user_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/fwd.hpp b/src/proto2/fwd.hpp index 023ebe5..a18d0ef 100644 --- a/src/proto2/fwd.hpp +++ b/src/proto2/fwd.hpp @@ -7,20 +7,184 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . # include "../sanity.hpp" -// TODO put stuff here +struct RPacket_0x2709_Fixed; +struct NetRPacket_0x2709_Fixed; +struct RPacket_0x2712_Fixed; +struct NetRPacket_0x2712_Fixed; +struct SPacket_0x2713_Fixed; +struct NetSPacket_0x2713_Fixed; +struct RPacket_0x2714_Fixed; +struct NetRPacket_0x2714_Fixed; +struct RPacket_0x2715_Fixed; +struct NetRPacket_0x2715_Fixed; +struct RPacket_0x2716_Fixed; +struct NetRPacket_0x2716_Fixed; +struct SPacket_0x2717_Fixed; +struct NetSPacket_0x2717_Fixed; +struct RPacket_0x2720_Head; +struct NetRPacket_0x2720_Head; +struct RPacket_0x2720_Repeat; +struct NetRPacket_0x2720_Repeat; +struct SPacket_0x2721_Fixed; +struct NetSPacket_0x2721_Fixed; +struct RPacket_0x2722_Fixed; +struct NetRPacket_0x2722_Fixed; +struct SPacket_0x2723_Fixed; +struct NetSPacket_0x2723_Fixed; +struct RPacket_0x2724_Fixed; +struct NetRPacket_0x2724_Fixed; +struct RPacket_0x2725_Fixed; +struct NetRPacket_0x2725_Fixed; +struct RPacket_0x2727_Fixed; +struct NetRPacket_0x2727_Fixed; +struct RPacket_0x2728_Head; +struct NetRPacket_0x2728_Head; +struct RPacket_0x2728_Repeat; +struct NetRPacket_0x2728_Repeat; +struct SPacket_0x2729_Head; +struct NetSPacket_0x2729_Head; +struct SPacket_0x2729_Repeat; +struct NetSPacket_0x2729_Repeat; +struct RPacket_0x272a_Fixed; +struct NetRPacket_0x272a_Fixed; +struct SPacket_0x2730_Fixed; +struct NetSPacket_0x2730_Fixed; +struct SPacket_0x2731_Fixed; +struct NetSPacket_0x2731_Fixed; +struct SPacket_0x2732_Head; +struct NetSPacket_0x2732_Head; +struct SPacket_0x2732_Repeat; +struct NetSPacket_0x2732_Repeat; +struct RPacket_0x2740_Fixed; +struct NetRPacket_0x2740_Fixed; +struct SPacket_0x2741_Fixed; +struct NetSPacket_0x2741_Fixed; + +struct SPacket_0x2726_Head; +struct NetSPacket_0x2726_Head; +struct SPacket_0x2726_Repeat; +struct NetSPacket_0x2726_Repeat; +struct RPacket_0x7920_Fixed; +struct NetRPacket_0x7920_Fixed; +struct SPacket_0x7921_Head; +struct NetSPacket_0x7921_Head; +struct SPacket_0x7921_Repeat; +struct NetSPacket_0x7921_Repeat; +struct RPacket_0x7924_Fixed; +struct NetRPacket_0x7924_Fixed; +struct SPacket_0x7925_Fixed; +struct NetSPacket_0x7925_Fixed; +struct RPacket_0x7930_Fixed; +struct NetRPacket_0x7930_Fixed; +struct SPacket_0x7931_Fixed; +struct NetSPacket_0x7931_Fixed; +struct RPacket_0x7932_Fixed; +struct NetRPacket_0x7932_Fixed; +struct SPacket_0x7933_Fixed; +struct NetSPacket_0x7933_Fixed; +struct RPacket_0x7934_Fixed; +struct NetRPacket_0x7934_Fixed; +struct SPacket_0x7935_Fixed; +struct NetSPacket_0x7935_Fixed; +struct RPacket_0x7936_Fixed; +struct NetRPacket_0x7936_Fixed; +struct SPacket_0x7937_Fixed; +struct NetSPacket_0x7937_Fixed; +struct RPacket_0x7938_Fixed; +struct NetRPacket_0x7938_Fixed; +struct SPacket_0x7939_Head; +struct NetSPacket_0x7939_Head; +struct SPacket_0x7939_Repeat; +struct NetSPacket_0x7939_Repeat; +struct RPacket_0x793a_Fixed; +struct NetRPacket_0x793a_Fixed; +struct SPacket_0x793b_Fixed; +struct NetSPacket_0x793b_Fixed; +struct RPacket_0x793c_Fixed; +struct NetRPacket_0x793c_Fixed; +struct SPacket_0x793d_Fixed; +struct NetSPacket_0x793d_Fixed; +struct RPacket_0x793e_Fixed; +struct NetRPacket_0x793e_Fixed; +struct SPacket_0x793f_Fixed; +struct NetSPacket_0x793f_Fixed; +struct RPacket_0x7940_Fixed; +struct NetRPacket_0x7940_Fixed; +struct SPacket_0x7941_Fixed; +struct NetSPacket_0x7941_Fixed; +struct RPacket_0x7942_Head; +struct NetRPacket_0x7942_Head; +struct RPacket_0x7942_Repeat; +struct NetRPacket_0x7942_Repeat; +struct SPacket_0x7943_Fixed; +struct NetSPacket_0x7943_Fixed; +struct RPacket_0x7944_Fixed; +struct NetRPacket_0x7944_Fixed; +struct SPacket_0x7945_Fixed; +struct NetSPacket_0x7945_Fixed; +struct RPacket_0x7946_Fixed; +struct NetRPacket_0x7946_Fixed; +struct SPacket_0x7947_Fixed; +struct NetSPacket_0x7947_Fixed; +struct RPacket_0x7948_Fixed; +struct NetRPacket_0x7948_Fixed; +struct SPacket_0x7949_Fixed; +struct NetSPacket_0x7949_Fixed; +struct RPacket_0x794a_Fixed; +struct NetRPacket_0x794a_Fixed; +struct SPacket_0x794b_Fixed; +struct NetSPacket_0x794b_Fixed; +struct RPacket_0x794c_Fixed; +struct NetRPacket_0x794c_Fixed; +struct SPacket_0x794d_Fixed; +struct NetSPacket_0x794d_Fixed; +struct RPacket_0x794e_Head; +struct NetRPacket_0x794e_Head; +struct RPacket_0x794e_Repeat; +struct NetRPacket_0x794e_Repeat; +struct SPacket_0x794f_Fixed; +struct NetSPacket_0x794f_Fixed; +struct RPacket_0x7950_Fixed; +struct NetRPacket_0x7950_Fixed; +struct SPacket_0x7951_Fixed; +struct NetSPacket_0x7951_Fixed; +struct RPacket_0x7952_Fixed; +struct NetRPacket_0x7952_Fixed; +struct SPacket_0x7953_Head; +struct NetSPacket_0x7953_Head; +struct SPacket_0x7953_Repeat; +struct NetSPacket_0x7953_Repeat; +struct RPacket_0x7954_Fixed; +struct NetRPacket_0x7954_Fixed; +struct RPacket_0x7955_Fixed; +struct NetRPacket_0x7955_Fixed; + + + + +struct SPacket_0x0212_Fixed; +struct NetSPacket_0x0212_Fixed; + +struct RPacket_0x7530_Fixed; +struct NetRPacket_0x7530_Fixed; +struct SPacket_0x7531_Fixed; +struct NetSPacket_0x7531_Fixed; +struct RPacket_0x7532_Fixed; +struct NetRPacket_0x7532_Fixed; + #endif // TMWA_PROTO2_FWD_HPP diff --git a/src/proto2/include_cstdint_test.cpp b/src/proto2/include_cstdint_test.cpp index a067574..7462057 100644 --- a/src/proto2/include_cstdint_test.cpp +++ b/src/proto2/include_cstdint_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_enums_test.cpp b/src/proto2/include_enums_test.cpp index a335c81..2b9ed36 100644 --- a/src/proto2/include_enums_test.cpp +++ b/src/proto2/include_enums_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_human_time_diff_test.cpp b/src/proto2/include_human_time_diff_test.cpp index 25a111d..3a5cc49 100644 --- a/src/proto2/include_human_time_diff_test.cpp +++ b/src/proto2/include_human_time_diff_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_ids_test.cpp b/src/proto2/include_ids_test.cpp index 63e1753..7dc26dc 100644 --- a/src/proto2/include_ids_test.cpp +++ b/src/proto2/include_ids_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_ip_test.cpp b/src/proto2/include_ip_test.cpp index bae7c3a..a489d9a 100644 --- a/src/proto2/include_ip_test.cpp +++ b/src/proto2/include_ip_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_little_test.cpp b/src/proto2/include_little_test.cpp index 70cb5d2..5e62b33 100644 --- a/src/proto2/include_little_test.cpp +++ b/src/proto2/include_little_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_strs_test.cpp b/src/proto2/include_strs_test.cpp index 1087f3a..5bf516c 100644 --- a/src/proto2/include_strs_test.cpp +++ b/src/proto2/include_strs_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_utils_test.cpp b/src/proto2/include_utils_test.cpp index 840ed5f..106bb59 100644 --- a/src/proto2/include_utils_test.cpp +++ b/src/proto2/include_utils_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_version_test.cpp b/src/proto2/include_version_test.cpp index d635efc..ed31f49 100644 --- a/src/proto2/include_version_test.cpp +++ b/src/proto2/include_version_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/include_vstring_test.cpp b/src/proto2/include_vstring_test.cpp index f415127..24504ed 100644 --- a/src/proto2/include_vstring_test.cpp +++ b/src/proto2/include_vstring_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #include "../poison.hpp" diff --git a/src/proto2/login-admin.hpp b/src/proto2/login-admin.hpp index 635ed44..005ecfc 100644 --- a/src/proto2/login-admin.hpp +++ b/src/proto2/login-admin.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -27,183 +27,1016 @@ // This is an internal protocol, and can be changed without notice -struct RPacket0x2726_Head +struct SPacket_0x2726_Head { - uint16_t packet_id; - uint16_t unused; - uint32_t string_length; + using NetType = NetSPacket_0x2726_Head; + static const uint16_t PACKET_ID = 0x2726; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t unused = {}; + uint32_t magic_packet_length = {}; }; -struct NetRPacket0x2726_Head +struct SPacket_0x2726_Repeat { - Little16 packet_id; - Little16 unused; - Little32 string_length; + using NetType = NetSPacket_0x2726_Repeat; + static const uint16_t PACKET_ID = 0x2726; + + uint8_t c = {}; }; -static_assert(offsetof(NetRPacket0x2726_Head, packet_id) == 0, "offsetof(NetRPacket0x2726_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2726_Head, unused) == 2, "offsetof(NetRPacket0x2726_Head, unused) == 2"); -static_assert(offsetof(NetRPacket0x2726_Head, string_length) == 4, "offsetof(NetRPacket0x2726_Head, string_length) == 4"); -static_assert(sizeof(NetRPacket0x2726_Head) == 8, "sizeof(NetRPacket0x2726_Head) == 8"); -inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2726_Head *network, RPacket0x2726_Head native) +struct RPacket_0x7920_Fixed { - bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->unused, native.unused); - rv &= native_to_network(&network->string_length, native.string_length); - return rv; -} -inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2726_Head *native, NetRPacket0x2726_Head network) + using NetType = NetRPacket_0x7920_Fixed; + static const uint16_t PACKET_ID = 0x7920; + + uint16_t magic_packet_id = PACKET_ID; + AccountId start_account_id = {}; + AccountId end_account_id = {}; +}; +struct SPacket_0x7921_Head { - bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->unused, network.unused); - rv &= network_to_native(&native->string_length, network.string_length); - return rv; -} + using NetType = NetSPacket_0x7921_Head; + static const uint16_t PACKET_ID = 0x7921; -struct RPacket0x2726_Repeat + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length = {}; +}; +struct SPacket_0x7921_Repeat { - uint8_t c; + using NetType = NetSPacket_0x7921_Repeat; + static const uint16_t PACKET_ID = 0x7921; + + AccountId account_id = {}; + GmLevel gm_level = {}; + AccountName account_name = {}; + SEX sex = {}; + uint32_t login_count = {}; + uint32_t status = {}; }; -struct NetRPacket0x2726_Repeat +struct RPacket_0x7924_Fixed { - Byte c; + using NetType = NetRPacket_0x7924_Fixed; + static const uint16_t PACKET_ID = 0x7924; + + uint16_t magic_packet_id = PACKET_ID; + ItemNameId source_item_id = {}; + ItemNameId dest_item_id = {}; }; -static_assert(offsetof(NetRPacket0x2726_Repeat, c) == 0, "offsetof(NetRPacket0x2726_Repeat, c) == 0"); -static_assert(sizeof(NetRPacket0x2726_Repeat) == 1, "sizeof(NetRPacket0x2726_Repeat) == 1"); -inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2726_Repeat *network, RPacket0x2726_Repeat native) +struct SPacket_0x7925_Fixed { - bool rv = true; - rv &= native_to_network(&network->c, native.c); - return rv; -} -inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2726_Repeat *native, NetRPacket0x2726_Repeat network) + using NetType = NetSPacket_0x7925_Fixed; + static const uint16_t PACKET_ID = 0x7925; + + uint16_t magic_packet_id = PACKET_ID; +}; +struct RPacket_0x7930_Fixed { - bool rv = true; - rv &= network_to_native(&native->c, network.c); - return rv; -} + using NetType = NetRPacket_0x7930_Fixed; + static const uint16_t PACKET_ID = 0x7930; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + AccountPass password = {}; + SEX sex = {}; + AccountEmail email = {}; +}; +struct SPacket_0x7931_Fixed +{ + using NetType = NetSPacket_0x7931_Fixed; + static const uint16_t PACKET_ID = 0x7931; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7932_Fixed +{ + using NetType = NetRPacket_0x7932_Fixed; + static const uint16_t PACKET_ID = 0x7932; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; +}; +struct SPacket_0x7933_Fixed +{ + using NetType = NetSPacket_0x7933_Fixed; + static const uint16_t PACKET_ID = 0x7933; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7934_Fixed +{ + using NetType = NetRPacket_0x7934_Fixed; + static const uint16_t PACKET_ID = 0x7934; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + AccountPass password = {}; +}; +struct SPacket_0x7935_Fixed +{ + using NetType = NetSPacket_0x7935_Fixed; + static const uint16_t PACKET_ID = 0x7935; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7936_Fixed +{ + using NetType = NetRPacket_0x7936_Fixed; + static const uint16_t PACKET_ID = 0x7936; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + uint32_t status = {}; + timestamp_seconds_buffer error_message = {}; +}; +struct SPacket_0x7937_Fixed +{ + using NetType = NetSPacket_0x7937_Fixed; + static const uint16_t PACKET_ID = 0x7937; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; + uint32_t status = {}; +}; +struct RPacket_0x7938_Fixed +{ + using NetType = NetRPacket_0x7938_Fixed; + static const uint16_t PACKET_ID = 0x7938; + + uint16_t magic_packet_id = PACKET_ID; +}; +struct SPacket_0x7939_Head +{ + using NetType = NetSPacket_0x7939_Head; + static const uint16_t PACKET_ID = 0x7939; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length = {}; +}; +struct SPacket_0x7939_Repeat +{ + using NetType = NetSPacket_0x7939_Repeat; + static const uint16_t PACKET_ID = 0x7939; + + IP4Address ip = {}; + uint16_t port = {}; + ServerName name = {}; + uint16_t users = {}; + uint16_t maintenance = {}; + uint16_t is_new = {}; +}; +struct RPacket_0x793a_Fixed +{ + using NetType = NetRPacket_0x793a_Fixed; + static const uint16_t PACKET_ID = 0x793a; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + AccountPass password = {}; +}; +struct SPacket_0x793b_Fixed +{ + using NetType = NetSPacket_0x793b_Fixed; + static const uint16_t PACKET_ID = 0x793b; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x793c_Fixed +{ + using NetType = NetRPacket_0x793c_Fixed; + static const uint16_t PACKET_ID = 0x793c; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + SEX sex = {}; +}; +struct SPacket_0x793d_Fixed +{ + using NetType = NetSPacket_0x793d_Fixed; + static const uint16_t PACKET_ID = 0x793d; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x793e_Fixed +{ + using NetType = NetRPacket_0x793e_Fixed; + static const uint16_t PACKET_ID = 0x793e; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + GmLevel gm_level = {}; +}; +struct SPacket_0x793f_Fixed +{ + using NetType = NetSPacket_0x793f_Fixed; + static const uint16_t PACKET_ID = 0x793f; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7940_Fixed +{ + using NetType = NetRPacket_0x7940_Fixed; + static const uint16_t PACKET_ID = 0x7940; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + AccountEmail email = {}; +}; +struct SPacket_0x7941_Fixed +{ + using NetType = NetSPacket_0x7941_Fixed; + static const uint16_t PACKET_ID = 0x7941; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7942_Head +{ + using NetType = NetRPacket_0x7942_Head; + static const uint16_t PACKET_ID = 0x7942; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + uint16_t magic_packet_length = {}; +}; +struct RPacket_0x7942_Repeat +{ + using NetType = NetRPacket_0x7942_Repeat; + static const uint16_t PACKET_ID = 0x7942; + + uint8_t c = {}; +}; +struct SPacket_0x7943_Fixed +{ + using NetType = NetSPacket_0x7943_Fixed; + static const uint16_t PACKET_ID = 0x7943; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7944_Fixed +{ + using NetType = NetRPacket_0x7944_Fixed; + static const uint16_t PACKET_ID = 0x7944; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; +}; +struct SPacket_0x7945_Fixed +{ + using NetType = NetSPacket_0x7945_Fixed; + static const uint16_t PACKET_ID = 0x7945; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7946_Fixed +{ + using NetType = NetRPacket_0x7946_Fixed; + static const uint16_t PACKET_ID = 0x7946; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; +}; +struct SPacket_0x7947_Fixed +{ + using NetType = NetSPacket_0x7947_Fixed; + static const uint16_t PACKET_ID = 0x7947; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; +}; +struct RPacket_0x7948_Fixed +{ + using NetType = NetRPacket_0x7948_Fixed; + static const uint16_t PACKET_ID = 0x7948; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + TimeT valid_until = {}; +}; +struct SPacket_0x7949_Fixed +{ + using NetType = NetSPacket_0x7949_Fixed; + static const uint16_t PACKET_ID = 0x7949; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; + TimeT valid_until = {}; +}; +struct RPacket_0x794a_Fixed +{ + using NetType = NetRPacket_0x794a_Fixed; + static const uint16_t PACKET_ID = 0x794a; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + TimeT ban_until = {}; +}; +struct SPacket_0x794b_Fixed +{ + using NetType = NetSPacket_0x794b_Fixed; + static const uint16_t PACKET_ID = 0x794b; -struct RPacket0x7920_Head + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; + TimeT ban_until = {}; +}; +struct RPacket_0x794c_Fixed { - uint16_t packet_id; - uint32_t start_account_id; - uint32_t end_account_id; + using NetType = NetRPacket_0x794c_Fixed; + static const uint16_t PACKET_ID = 0x794c; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + HumanTimeDiff ban_add = {}; }; -struct NetRPacket0x7920_Head +struct SPacket_0x794d_Fixed { - Little16 packet_id; + using NetType = NetSPacket_0x794d_Fixed; + static const uint16_t PACKET_ID = 0x794d; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; + TimeT ban_until = {}; +}; +struct RPacket_0x794e_Head +{ + using NetType = NetRPacket_0x794e_Head; + static const uint16_t PACKET_ID = 0x794e; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t unused = {}; + uint32_t magic_packet_length = {}; +}; +struct RPacket_0x794e_Repeat +{ + using NetType = NetRPacket_0x794e_Repeat; + static const uint16_t PACKET_ID = 0x794e; + + uint8_t c = {}; +}; +struct SPacket_0x794f_Fixed +{ + using NetType = NetSPacket_0x794f_Fixed; + static const uint16_t PACKET_ID = 0x794f; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t error = {}; +}; +struct RPacket_0x7950_Fixed +{ + using NetType = NetRPacket_0x7950_Fixed; + static const uint16_t PACKET_ID = 0x7950; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; + HumanTimeDiff valid_add = {}; +}; +struct SPacket_0x7951_Fixed +{ + using NetType = NetSPacket_0x7951_Fixed; + static const uint16_t PACKET_ID = 0x7951; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountName account_name = {}; + TimeT valid_until = {}; +}; +struct RPacket_0x7952_Fixed +{ + using NetType = NetRPacket_0x7952_Fixed; + static const uint16_t PACKET_ID = 0x7952; + + uint16_t magic_packet_id = PACKET_ID; + AccountName account_name = {}; +}; +struct SPacket_0x7953_Head +{ + using NetType = NetSPacket_0x7953_Head; + static const uint16_t PACKET_ID = 0x7953; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + GmLevel gm_level = {}; + AccountName account_name = {}; + SEX sex = {}; + uint32_t login_count = {}; + uint32_t state = {}; + timestamp_seconds_buffer error_message = {}; + timestamp_milliseconds_buffer last_login_string = {}; + VString<15> ip_string = {}; + AccountEmail email = {}; + TimeT connect_until = {}; + TimeT ban_until = {}; + uint16_t magic_packet_length = {}; +}; +struct SPacket_0x7953_Repeat +{ + using NetType = NetSPacket_0x7953_Repeat; + static const uint16_t PACKET_ID = 0x7953; + + uint8_t c = {}; +}; +struct RPacket_0x7954_Fixed +{ + using NetType = NetRPacket_0x7954_Fixed; + static const uint16_t PACKET_ID = 0x7954; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; +}; +struct RPacket_0x7955_Fixed +{ + using NetType = NetRPacket_0x7955_Fixed; + static const uint16_t PACKET_ID = 0x7955; + + uint16_t magic_packet_id = PACKET_ID; +}; + +struct NetSPacket_0x2726_Head +{ + Little16 magic_packet_id; + Little16 unused; + SkewedLength magic_packet_length; +}; +static_assert(offsetof(NetSPacket_0x2726_Head, magic_packet_id) == 0, "offsetof(NetSPacket_0x2726_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2726_Head, unused) == 2, "offsetof(NetSPacket_0x2726_Head, unused) == 2"); +static_assert(offsetof(NetSPacket_0x2726_Head, magic_packet_length) == 4, "offsetof(NetSPacket_0x2726_Head, magic_packet_length) == 4"); +static_assert(sizeof(NetSPacket_0x2726_Head) == 8, "sizeof(NetSPacket_0x2726_Head) == 8"); +struct NetSPacket_0x2726_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetSPacket_0x2726_Repeat, c) == 0, "offsetof(NetSPacket_0x2726_Repeat, c) == 0"); +static_assert(sizeof(NetSPacket_0x2726_Repeat) == 1, "sizeof(NetSPacket_0x2726_Repeat) == 1"); +struct NetRPacket_0x7920_Fixed +{ + Little16 magic_packet_id; Little32 start_account_id; Little32 end_account_id; }; -static_assert(offsetof(NetRPacket0x7920_Head, packet_id) == 0, "offsetof(NetRPacket0x7920_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7920_Head, start_account_id) == 2, "offsetof(NetRPacket0x7920_Head, start_account_id) == 2"); -static_assert(offsetof(NetRPacket0x7920_Head, end_account_id) == 6, "offsetof(NetRPacket0x7920_Head, end_account_id) == 6"); -static_assert(sizeof(NetRPacket0x7920_Head) == 10, "sizeof(NetRPacket0x7920_Head) == 10"); +static_assert(offsetof(NetRPacket_0x7920_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7920_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7920_Fixed, start_account_id) == 2, "offsetof(NetRPacket_0x7920_Fixed, start_account_id) == 2"); +static_assert(offsetof(NetRPacket_0x7920_Fixed, end_account_id) == 6, "offsetof(NetRPacket_0x7920_Fixed, end_account_id) == 6"); +static_assert(sizeof(NetRPacket_0x7920_Fixed) == 10, "sizeof(NetRPacket_0x7920_Fixed) == 10"); +struct NetSPacket_0x7921_Head +{ + Little16 magic_packet_id; + Little16 magic_packet_length; +}; +static_assert(offsetof(NetSPacket_0x7921_Head, magic_packet_id) == 0, "offsetof(NetSPacket_0x7921_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7921_Head, magic_packet_length) == 2, "offsetof(NetSPacket_0x7921_Head, magic_packet_length) == 2"); +static_assert(sizeof(NetSPacket_0x7921_Head) == 4, "sizeof(NetSPacket_0x7921_Head) == 4"); +struct NetSPacket_0x7921_Repeat +{ + Little32 account_id; + Byte gm_level; + NetString account_name; + Byte sex; + Little32 login_count; + Little32 status; +}; +static_assert(offsetof(NetSPacket_0x7921_Repeat, account_id) == 0, "offsetof(NetSPacket_0x7921_Repeat, account_id) == 0"); +static_assert(offsetof(NetSPacket_0x7921_Repeat, gm_level) == 4, "offsetof(NetSPacket_0x7921_Repeat, gm_level) == 4"); +static_assert(offsetof(NetSPacket_0x7921_Repeat, account_name) == 5, "offsetof(NetSPacket_0x7921_Repeat, account_name) == 5"); +static_assert(offsetof(NetSPacket_0x7921_Repeat, sex) == 29, "offsetof(NetSPacket_0x7921_Repeat, sex) == 29"); +static_assert(offsetof(NetSPacket_0x7921_Repeat, login_count) == 30, "offsetof(NetSPacket_0x7921_Repeat, login_count) == 30"); +static_assert(offsetof(NetSPacket_0x7921_Repeat, status) == 34, "offsetof(NetSPacket_0x7921_Repeat, status) == 34"); +static_assert(sizeof(NetSPacket_0x7921_Repeat) == 38, "sizeof(NetSPacket_0x7921_Repeat) == 38"); +struct NetRPacket_0x7924_Fixed +{ + Little16 magic_packet_id; + Little32 source_item_id; + Little32 dest_item_id; +}; +static_assert(offsetof(NetRPacket_0x7924_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7924_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7924_Fixed, source_item_id) == 2, "offsetof(NetRPacket_0x7924_Fixed, source_item_id) == 2"); +static_assert(offsetof(NetRPacket_0x7924_Fixed, dest_item_id) == 6, "offsetof(NetRPacket_0x7924_Fixed, dest_item_id) == 6"); +static_assert(sizeof(NetRPacket_0x7924_Fixed) == 10, "sizeof(NetRPacket_0x7924_Fixed) == 10"); +struct NetSPacket_0x7925_Fixed +{ + Little16 magic_packet_id; +}; +static_assert(offsetof(NetSPacket_0x7925_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7925_Fixed, magic_packet_id) == 0"); +static_assert(sizeof(NetSPacket_0x7925_Fixed) == 2, "sizeof(NetSPacket_0x7925_Fixed) == 2"); +struct NetRPacket_0x7930_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + NetString password; + char sex; + NetString email; +}; +static_assert(offsetof(NetRPacket_0x7930_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7930_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7930_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7930_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7930_Fixed, password) == 26, "offsetof(NetRPacket_0x7930_Fixed, password) == 26"); +static_assert(offsetof(NetRPacket_0x7930_Fixed, sex) == 50, "offsetof(NetRPacket_0x7930_Fixed, sex) == 50"); +static_assert(offsetof(NetRPacket_0x7930_Fixed, email) == 51, "offsetof(NetRPacket_0x7930_Fixed, email) == 51"); +static_assert(sizeof(NetRPacket_0x7930_Fixed) == 91, "sizeof(NetRPacket_0x7930_Fixed) == 91"); +struct NetSPacket_0x7931_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7931_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7931_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7931_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7931_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7931_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7931_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7931_Fixed) == 30, "sizeof(NetSPacket_0x7931_Fixed) == 30"); +struct NetRPacket_0x7932_Fixed +{ + Little16 magic_packet_id; + NetString account_name; +}; +static_assert(offsetof(NetRPacket_0x7932_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7932_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7932_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7932_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket_0x7932_Fixed) == 26, "sizeof(NetRPacket_0x7932_Fixed) == 26"); +struct NetSPacket_0x7933_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7933_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7933_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7933_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7933_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7933_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7933_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7933_Fixed) == 30, "sizeof(NetSPacket_0x7933_Fixed) == 30"); +struct NetRPacket_0x7934_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + NetString password; +}; +static_assert(offsetof(NetRPacket_0x7934_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7934_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7934_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7934_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7934_Fixed, password) == 26, "offsetof(NetRPacket_0x7934_Fixed, password) == 26"); +static_assert(sizeof(NetRPacket_0x7934_Fixed) == 50, "sizeof(NetRPacket_0x7934_Fixed) == 50"); +struct NetSPacket_0x7935_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7935_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7935_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7935_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7935_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7935_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7935_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7935_Fixed) == 30, "sizeof(NetSPacket_0x7935_Fixed) == 30"); +struct NetRPacket_0x7936_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + Little32 status; + NetString error_message; +}; +static_assert(offsetof(NetRPacket_0x7936_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7936_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7936_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7936_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7936_Fixed, status) == 26, "offsetof(NetRPacket_0x7936_Fixed, status) == 26"); +static_assert(offsetof(NetRPacket_0x7936_Fixed, error_message) == 30, "offsetof(NetRPacket_0x7936_Fixed, error_message) == 30"); +static_assert(sizeof(NetRPacket_0x7936_Fixed) == 50, "sizeof(NetRPacket_0x7936_Fixed) == 50"); +struct NetSPacket_0x7937_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; + Little32 status; +}; +static_assert(offsetof(NetSPacket_0x7937_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7937_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7937_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7937_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7937_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7937_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket_0x7937_Fixed, status) == 30, "offsetof(NetSPacket_0x7937_Fixed, status) == 30"); +static_assert(sizeof(NetSPacket_0x7937_Fixed) == 34, "sizeof(NetSPacket_0x7937_Fixed) == 34"); +struct NetRPacket_0x7938_Fixed +{ + Little16 magic_packet_id; +}; +static_assert(offsetof(NetRPacket_0x7938_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7938_Fixed, magic_packet_id) == 0"); +static_assert(sizeof(NetRPacket_0x7938_Fixed) == 2, "sizeof(NetRPacket_0x7938_Fixed) == 2"); +struct NetSPacket_0x7939_Head +{ + Little16 magic_packet_id; + Little16 magic_packet_length; +}; +static_assert(offsetof(NetSPacket_0x7939_Head, magic_packet_id) == 0, "offsetof(NetSPacket_0x7939_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7939_Head, magic_packet_length) == 2, "offsetof(NetSPacket_0x7939_Head, magic_packet_length) == 2"); +static_assert(sizeof(NetSPacket_0x7939_Head) == 4, "sizeof(NetSPacket_0x7939_Head) == 4"); +struct NetSPacket_0x7939_Repeat +{ + IP4Address ip; + Little16 port; + NetString name; + Little16 users; + Little16 maintenance; + Little16 is_new; +}; +static_assert(offsetof(NetSPacket_0x7939_Repeat, ip) == 0, "offsetof(NetSPacket_0x7939_Repeat, ip) == 0"); +static_assert(offsetof(NetSPacket_0x7939_Repeat, port) == 4, "offsetof(NetSPacket_0x7939_Repeat, port) == 4"); +static_assert(offsetof(NetSPacket_0x7939_Repeat, name) == 6, "offsetof(NetSPacket_0x7939_Repeat, name) == 6"); +static_assert(offsetof(NetSPacket_0x7939_Repeat, users) == 26, "offsetof(NetSPacket_0x7939_Repeat, users) == 26"); +static_assert(offsetof(NetSPacket_0x7939_Repeat, maintenance) == 28, "offsetof(NetSPacket_0x7939_Repeat, maintenance) == 28"); +static_assert(offsetof(NetSPacket_0x7939_Repeat, is_new) == 30, "offsetof(NetSPacket_0x7939_Repeat, is_new) == 30"); +static_assert(sizeof(NetSPacket_0x7939_Repeat) == 32, "sizeof(NetSPacket_0x7939_Repeat) == 32"); +struct NetRPacket_0x793a_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + NetString password; +}; +static_assert(offsetof(NetRPacket_0x793a_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x793a_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x793a_Fixed, account_name) == 2, "offsetof(NetRPacket_0x793a_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x793a_Fixed, password) == 26, "offsetof(NetRPacket_0x793a_Fixed, password) == 26"); +static_assert(sizeof(NetRPacket_0x793a_Fixed) == 50, "sizeof(NetRPacket_0x793a_Fixed) == 50"); +struct NetSPacket_0x793b_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x793b_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x793b_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x793b_Fixed, account_id) == 2, "offsetof(NetSPacket_0x793b_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x793b_Fixed, account_name) == 6, "offsetof(NetSPacket_0x793b_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x793b_Fixed) == 30, "sizeof(NetSPacket_0x793b_Fixed) == 30"); +struct NetRPacket_0x793c_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + char sex; +}; +static_assert(offsetof(NetRPacket_0x793c_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x793c_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x793c_Fixed, account_name) == 2, "offsetof(NetRPacket_0x793c_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x793c_Fixed, sex) == 26, "offsetof(NetRPacket_0x793c_Fixed, sex) == 26"); +static_assert(sizeof(NetRPacket_0x793c_Fixed) == 27, "sizeof(NetRPacket_0x793c_Fixed) == 27"); +struct NetSPacket_0x793d_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x793d_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x793d_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x793d_Fixed, account_id) == 2, "offsetof(NetSPacket_0x793d_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x793d_Fixed, account_name) == 6, "offsetof(NetSPacket_0x793d_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x793d_Fixed) == 30, "sizeof(NetSPacket_0x793d_Fixed) == 30"); +struct NetRPacket_0x793e_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + Byte gm_level; +}; +static_assert(offsetof(NetRPacket_0x793e_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x793e_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x793e_Fixed, account_name) == 2, "offsetof(NetRPacket_0x793e_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x793e_Fixed, gm_level) == 26, "offsetof(NetRPacket_0x793e_Fixed, gm_level) == 26"); +static_assert(sizeof(NetRPacket_0x793e_Fixed) == 27, "sizeof(NetRPacket_0x793e_Fixed) == 27"); +struct NetSPacket_0x793f_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x793f_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x793f_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x793f_Fixed, account_id) == 2, "offsetof(NetSPacket_0x793f_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x793f_Fixed, account_name) == 6, "offsetof(NetSPacket_0x793f_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x793f_Fixed) == 30, "sizeof(NetSPacket_0x793f_Fixed) == 30"); +struct NetRPacket_0x7940_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + NetString email; +}; +static_assert(offsetof(NetRPacket_0x7940_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7940_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7940_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7940_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7940_Fixed, email) == 26, "offsetof(NetRPacket_0x7940_Fixed, email) == 26"); +static_assert(sizeof(NetRPacket_0x7940_Fixed) == 66, "sizeof(NetRPacket_0x7940_Fixed) == 66"); +struct NetSPacket_0x7941_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7941_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7941_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7941_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7941_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7941_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7941_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7941_Fixed) == 30, "sizeof(NetSPacket_0x7941_Fixed) == 30"); +struct NetRPacket_0x7942_Head +{ + Little16 magic_packet_id; + NetString account_name; + SkewedLength magic_packet_length; +}; +static_assert(offsetof(NetRPacket_0x7942_Head, magic_packet_id) == 0, "offsetof(NetRPacket_0x7942_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7942_Head, account_name) == 2, "offsetof(NetRPacket_0x7942_Head, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7942_Head, magic_packet_length) == 26, "offsetof(NetRPacket_0x7942_Head, magic_packet_length) == 26"); +static_assert(sizeof(NetRPacket_0x7942_Head) == 28, "sizeof(NetRPacket_0x7942_Head) == 28"); +struct NetRPacket_0x7942_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket_0x7942_Repeat, c) == 0, "offsetof(NetRPacket_0x7942_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket_0x7942_Repeat) == 1, "sizeof(NetRPacket_0x7942_Repeat) == 1"); +struct NetSPacket_0x7943_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7943_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7943_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7943_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7943_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7943_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7943_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7943_Fixed) == 30, "sizeof(NetSPacket_0x7943_Fixed) == 30"); +struct NetRPacket_0x7944_Fixed +{ + Little16 magic_packet_id; + NetString account_name; +}; +static_assert(offsetof(NetRPacket_0x7944_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7944_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7944_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7944_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket_0x7944_Fixed) == 26, "sizeof(NetRPacket_0x7944_Fixed) == 26"); +struct NetSPacket_0x7945_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7945_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7945_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7945_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7945_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7945_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7945_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7945_Fixed) == 30, "sizeof(NetSPacket_0x7945_Fixed) == 30"); +struct NetRPacket_0x7946_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x7946_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7946_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7946_Fixed, account_id) == 2, "offsetof(NetRPacket_0x7946_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket_0x7946_Fixed) == 6, "sizeof(NetRPacket_0x7946_Fixed) == 6"); +struct NetSPacket_0x7947_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; +}; +static_assert(offsetof(NetSPacket_0x7947_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7947_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7947_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7947_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7947_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7947_Fixed, account_name) == 6"); +static_assert(sizeof(NetSPacket_0x7947_Fixed) == 30, "sizeof(NetSPacket_0x7947_Fixed) == 30"); +struct NetRPacket_0x7948_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetRPacket_0x7948_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7948_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7948_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7948_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7948_Fixed, valid_until) == 26, "offsetof(NetRPacket_0x7948_Fixed, valid_until) == 26"); +static_assert(sizeof(NetRPacket_0x7948_Fixed) == 30, "sizeof(NetRPacket_0x7948_Fixed) == 30"); +struct NetSPacket_0x7949_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetSPacket_0x7949_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7949_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7949_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7949_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7949_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7949_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket_0x7949_Fixed, valid_until) == 30, "offsetof(NetSPacket_0x7949_Fixed, valid_until) == 30"); +static_assert(sizeof(NetSPacket_0x7949_Fixed) == 34, "sizeof(NetSPacket_0x7949_Fixed) == 34"); +struct NetRPacket_0x794a_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetRPacket_0x794a_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x794a_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x794a_Fixed, account_name) == 2, "offsetof(NetRPacket_0x794a_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x794a_Fixed, ban_until) == 26, "offsetof(NetRPacket_0x794a_Fixed, ban_until) == 26"); +static_assert(sizeof(NetRPacket_0x794a_Fixed) == 30, "sizeof(NetRPacket_0x794a_Fixed) == 30"); +struct NetSPacket_0x794b_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetSPacket_0x794b_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x794b_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x794b_Fixed, account_id) == 2, "offsetof(NetSPacket_0x794b_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x794b_Fixed, account_name) == 6, "offsetof(NetSPacket_0x794b_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket_0x794b_Fixed, ban_until) == 30, "offsetof(NetSPacket_0x794b_Fixed, ban_until) == 30"); +static_assert(sizeof(NetSPacket_0x794b_Fixed) == 34, "sizeof(NetSPacket_0x794b_Fixed) == 34"); +struct NetRPacket_0x794c_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + NetHumanTimeDiff ban_add; +}; +static_assert(offsetof(NetRPacket_0x794c_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x794c_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x794c_Fixed, account_name) == 2, "offsetof(NetRPacket_0x794c_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x794c_Fixed, ban_add) == 26, "offsetof(NetRPacket_0x794c_Fixed, ban_add) == 26"); +static_assert(sizeof(NetRPacket_0x794c_Fixed) == 38, "sizeof(NetRPacket_0x794c_Fixed) == 38"); +struct NetSPacket_0x794d_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; + Little32 ban_until; +}; +static_assert(offsetof(NetSPacket_0x794d_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x794d_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x794d_Fixed, account_id) == 2, "offsetof(NetSPacket_0x794d_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x794d_Fixed, account_name) == 6, "offsetof(NetSPacket_0x794d_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket_0x794d_Fixed, ban_until) == 30, "offsetof(NetSPacket_0x794d_Fixed, ban_until) == 30"); +static_assert(sizeof(NetSPacket_0x794d_Fixed) == 34, "sizeof(NetSPacket_0x794d_Fixed) == 34"); +struct NetRPacket_0x794e_Head +{ + Little16 magic_packet_id; + Little16 unused; + SkewedLength magic_packet_length; +}; +static_assert(offsetof(NetRPacket_0x794e_Head, magic_packet_id) == 0, "offsetof(NetRPacket_0x794e_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x794e_Head, unused) == 2, "offsetof(NetRPacket_0x794e_Head, unused) == 2"); +static_assert(offsetof(NetRPacket_0x794e_Head, magic_packet_length) == 4, "offsetof(NetRPacket_0x794e_Head, magic_packet_length) == 4"); +static_assert(sizeof(NetRPacket_0x794e_Head) == 8, "sizeof(NetRPacket_0x794e_Head) == 8"); +struct NetRPacket_0x794e_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket_0x794e_Repeat, c) == 0, "offsetof(NetRPacket_0x794e_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket_0x794e_Repeat) == 1, "sizeof(NetRPacket_0x794e_Repeat) == 1"); +struct NetSPacket_0x794f_Fixed +{ + Little16 magic_packet_id; + Little16 error; +}; +static_assert(offsetof(NetSPacket_0x794f_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x794f_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x794f_Fixed, error) == 2, "offsetof(NetSPacket_0x794f_Fixed, error) == 2"); +static_assert(sizeof(NetSPacket_0x794f_Fixed) == 4, "sizeof(NetSPacket_0x794f_Fixed) == 4"); +struct NetRPacket_0x7950_Fixed +{ + Little16 magic_packet_id; + NetString account_name; + NetHumanTimeDiff valid_add; +}; +static_assert(offsetof(NetRPacket_0x7950_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7950_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7950_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7950_Fixed, account_name) == 2"); +static_assert(offsetof(NetRPacket_0x7950_Fixed, valid_add) == 26, "offsetof(NetRPacket_0x7950_Fixed, valid_add) == 26"); +static_assert(sizeof(NetRPacket_0x7950_Fixed) == 38, "sizeof(NetRPacket_0x7950_Fixed) == 38"); +struct NetSPacket_0x7951_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString account_name; + Little32 valid_until; +}; +static_assert(offsetof(NetSPacket_0x7951_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x7951_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7951_Fixed, account_id) == 2, "offsetof(NetSPacket_0x7951_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7951_Fixed, account_name) == 6, "offsetof(NetSPacket_0x7951_Fixed, account_name) == 6"); +static_assert(offsetof(NetSPacket_0x7951_Fixed, valid_until) == 30, "offsetof(NetSPacket_0x7951_Fixed, valid_until) == 30"); +static_assert(sizeof(NetSPacket_0x7951_Fixed) == 34, "sizeof(NetSPacket_0x7951_Fixed) == 34"); +struct NetRPacket_0x7952_Fixed +{ + Little16 magic_packet_id; + NetString account_name; +}; +static_assert(offsetof(NetRPacket_0x7952_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7952_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7952_Fixed, account_name) == 2, "offsetof(NetRPacket_0x7952_Fixed, account_name) == 2"); +static_assert(sizeof(NetRPacket_0x7952_Fixed) == 26, "sizeof(NetRPacket_0x7952_Fixed) == 26"); +struct NetSPacket_0x7953_Head +{ + Little16 magic_packet_id; + Little32 account_id; + Byte gm_level; + NetString account_name; + Byte sex; + Little32 login_count; + Little32 state; + NetString error_message; + NetString last_login_string; + NetString)> ip_string; + NetString email; + Little32 connect_until; + Little32 ban_until; + SkewedLength magic_packet_length; +}; +static_assert(offsetof(NetSPacket_0x7953_Head, magic_packet_id) == 0, "offsetof(NetSPacket_0x7953_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x7953_Head, account_id) == 2, "offsetof(NetSPacket_0x7953_Head, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x7953_Head, gm_level) == 6, "offsetof(NetSPacket_0x7953_Head, gm_level) == 6"); +static_assert(offsetof(NetSPacket_0x7953_Head, account_name) == 7, "offsetof(NetSPacket_0x7953_Head, account_name) == 7"); +static_assert(offsetof(NetSPacket_0x7953_Head, sex) == 31, "offsetof(NetSPacket_0x7953_Head, sex) == 31"); +static_assert(offsetof(NetSPacket_0x7953_Head, login_count) == 32, "offsetof(NetSPacket_0x7953_Head, login_count) == 32"); +static_assert(offsetof(NetSPacket_0x7953_Head, state) == 36, "offsetof(NetSPacket_0x7953_Head, state) == 36"); +static_assert(offsetof(NetSPacket_0x7953_Head, error_message) == 40, "offsetof(NetSPacket_0x7953_Head, error_message) == 40"); +static_assert(offsetof(NetSPacket_0x7953_Head, last_login_string) == 60, "offsetof(NetSPacket_0x7953_Head, last_login_string) == 60"); +static_assert(offsetof(NetSPacket_0x7953_Head, ip_string) == 84, "offsetof(NetSPacket_0x7953_Head, ip_string) == 84"); +static_assert(offsetof(NetSPacket_0x7953_Head, email) == 100, "offsetof(NetSPacket_0x7953_Head, email) == 100"); +static_assert(offsetof(NetSPacket_0x7953_Head, connect_until) == 140, "offsetof(NetSPacket_0x7953_Head, connect_until) == 140"); +static_assert(offsetof(NetSPacket_0x7953_Head, ban_until) == 144, "offsetof(NetSPacket_0x7953_Head, ban_until) == 144"); +static_assert(offsetof(NetSPacket_0x7953_Head, magic_packet_length) == 148, "offsetof(NetSPacket_0x7953_Head, magic_packet_length) == 148"); +static_assert(sizeof(NetSPacket_0x7953_Head) == 150, "sizeof(NetSPacket_0x7953_Head) == 150"); +struct NetSPacket_0x7953_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetSPacket_0x7953_Repeat, c) == 0, "offsetof(NetSPacket_0x7953_Repeat, c) == 0"); +static_assert(sizeof(NetSPacket_0x7953_Repeat) == 1, "sizeof(NetSPacket_0x7953_Repeat) == 1"); +struct NetRPacket_0x7954_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x7954_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7954_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x7954_Fixed, account_id) == 2, "offsetof(NetRPacket_0x7954_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket_0x7954_Fixed) == 6, "sizeof(NetRPacket_0x7954_Fixed) == 6"); +struct NetRPacket_0x7955_Fixed +{ + Little16 magic_packet_id; +}; +static_assert(offsetof(NetRPacket_0x7955_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x7955_Fixed, magic_packet_id) == 0"); +static_assert(sizeof(NetRPacket_0x7955_Fixed) == 2, "sizeof(NetRPacket_0x7955_Fixed) == 2"); + inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7920_Head *network, RPacket0x7920_Head native) +bool native_to_network(NetSPacket_0x2726_Head *network, SPacket_0x2726_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->start_account_id, native.start_account_id); - rv &= native_to_network(&network->end_account_id, native.end_account_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->unused, native.unused); + rv &= native_to_network(&network->magic_packet_length, native.magic_packet_length); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7920_Head *native, NetRPacket0x7920_Head network) +bool network_to_native(SPacket_0x2726_Head *native, NetSPacket_0x2726_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->start_account_id, network.start_account_id); - rv &= network_to_native(&native->end_account_id, network.end_account_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->unused, network.unused); + rv &= network_to_native(&native->magic_packet_length, network.magic_packet_length); return rv; } - -struct RPacket0x7920_Repeat -{ - uint8_t c; -}; -struct NetRPacket0x7920_Repeat -{ - Byte c; -}; -static_assert(offsetof(NetRPacket0x7920_Repeat, c) == 0, "offsetof(NetRPacket0x7920_Repeat, c) == 0"); -static_assert(sizeof(NetRPacket0x7920_Repeat) == 1, "sizeof(NetRPacket0x7920_Repeat) == 1"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7920_Repeat *network, RPacket0x7920_Repeat native) +bool native_to_network(NetSPacket_0x2726_Repeat *network, SPacket_0x2726_Repeat native) { bool rv = true; rv &= native_to_network(&network->c, native.c); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7920_Repeat *native, NetRPacket0x7920_Repeat network) +bool network_to_native(SPacket_0x2726_Repeat *native, NetSPacket_0x2726_Repeat network) { bool rv = true; rv &= network_to_native(&native->c, network.c); return rv; } - -struct SPacket0x7921_Head -{ - uint16_t packet_id; - uint16_t packet_length; -}; -struct NetSPacket0x7921_Head -{ - Little16 packet_id; - Little16 packet_length; -}; -static_assert(offsetof(NetSPacket0x7921_Head, packet_id) == 0, "offsetof(NetSPacket0x7921_Head, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7921_Head, packet_length) == 2, "offsetof(NetSPacket0x7921_Head, packet_length) == 2"); -static_assert(sizeof(NetSPacket0x7921_Head) == 4, "sizeof(NetSPacket0x7921_Head) == 4"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7921_Head *network, SPacket0x7921_Head native) +bool native_to_network(NetRPacket_0x7920_Fixed *network, RPacket_0x7920_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->packet_length, native.packet_length); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->start_account_id, native.start_account_id); + rv &= native_to_network(&network->end_account_id, native.end_account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7921_Head *native, NetSPacket0x7921_Head network) +bool network_to_native(RPacket_0x7920_Fixed *native, NetRPacket_0x7920_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->packet_length, network.packet_length); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->start_account_id, network.start_account_id); + rv &= network_to_native(&native->end_account_id, network.end_account_id); return rv; } - -struct SPacket0x7921_Repeat +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket_0x7921_Head *network, SPacket_0x7921_Head native) { - uint32_t account_id; - GmLevel gm_level; - AccountName account_name; - SEX sex; - uint32_t login_count; - uint32_t status; -}; -struct NetSPacket0x7921_Repeat + 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(SPacket_0x7921_Head *native, NetSPacket_0x7921_Head network) { - Little32 account_id; - Byte gm_level; - NetString account_name; - Byte sex; - Little32 login_count; - Little32 status; -}; -static_assert(offsetof(NetSPacket0x7921_Repeat, account_id) == 0, "offsetof(NetSPacket0x7921_Repeat, account_id) == 0"); -static_assert(offsetof(NetSPacket0x7921_Repeat, gm_level) == 4, "offsetof(NetSPacket0x7921_Repeat, gm_level) == 4"); -static_assert(offsetof(NetSPacket0x7921_Repeat, account_name) == 5, "offsetof(NetSPacket0x7921_Repeat, account_name) == 5"); -static_assert(offsetof(NetSPacket0x7921_Repeat, sex) == 29, "offsetof(NetSPacket0x7921_Repeat, sex) == 29"); -static_assert(offsetof(NetSPacket0x7921_Repeat, login_count) == 30, "offsetof(NetSPacket0x7921_Repeat, login_count) == 30"); -static_assert(offsetof(NetSPacket0x7921_Repeat, status) == 34, "offsetof(NetSPacket0x7921_Repeat, status) == 34"); -static_assert(sizeof(NetSPacket0x7921_Repeat) == 38, "sizeof(NetSPacket0x7921_Repeat) == 38"); + 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(NetSPacket0x7921_Repeat *network, SPacket0x7921_Repeat native) +bool native_to_network(NetSPacket_0x7921_Repeat *network, SPacket_0x7921_Repeat native) { bool rv = true; rv &= native_to_network(&network->account_id, native.account_id); @@ -215,7 +1048,7 @@ bool native_to_network(NetSPacket0x7921_Repeat *network, SPacket0x7921_Repeat na return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7921_Repeat *native, NetSPacket0x7921_Repeat network) +bool network_to_native(SPacket_0x7921_Repeat *native, NetSPacket_0x7921_Repeat network) { bool rv = true; rv &= network_to_native(&native->account_id, network.account_id); @@ -226,94 +1059,43 @@ bool network_to_native(SPacket0x7921_Repeat *native, NetSPacket0x7921_Repeat net rv &= network_to_native(&native->status, network.status); return rv; } - -struct RPacket0x7924_Fixed -{ - uint16_t packet_id; - uint32_t source_item_id; - uint32_t dest_item_id; -}; -struct NetRPacket0x7924_Fixed -{ - Little16 packet_id; - Little32 source_item_id; - Little32 dest_item_id; -}; -static_assert(offsetof(NetRPacket0x7924_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7924_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7924_Fixed, source_item_id) == 2, "offsetof(NetRPacket0x7924_Fixed, source_item_id) == 2"); -static_assert(offsetof(NetRPacket0x7924_Fixed, dest_item_id) == 6, "offsetof(NetRPacket0x7924_Fixed, dest_item_id) == 6"); -static_assert(sizeof(NetRPacket0x7924_Fixed) == 10, "sizeof(NetRPacket0x7924_Fixed) == 10"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7924_Fixed *network, RPacket0x7924_Fixed native) +bool native_to_network(NetRPacket_0x7924_Fixed *network, RPacket_0x7924_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->source_item_id, native.source_item_id); rv &= native_to_network(&network->dest_item_id, native.dest_item_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7924_Fixed *native, NetRPacket0x7924_Fixed network) +bool network_to_native(RPacket_0x7924_Fixed *native, NetRPacket_0x7924_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->source_item_id, network.source_item_id); rv &= network_to_native(&native->dest_item_id, network.dest_item_id); return rv; } - -struct SPacket0x7925_Fixed -{ - uint16_t packet_id; -}; -struct NetSPacket0x7925_Fixed -{ - Little16 packet_id; -}; -static_assert(offsetof(NetSPacket0x7925_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7925_Fixed, packet_id) == 0"); -static_assert(sizeof(NetSPacket0x7925_Fixed) == 2, "sizeof(NetSPacket0x7925_Fixed) == 2"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7925_Fixed *network, SPacket0x7925_Fixed native) +bool native_to_network(NetSPacket_0x7925_Fixed *network, SPacket_0x7925_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7925_Fixed *native, NetSPacket0x7925_Fixed network) +bool network_to_native(SPacket_0x7925_Fixed *native, NetSPacket_0x7925_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } - -struct RPacket0x7930_Fixed -{ - uint16_t packet_id; - AccountName account_name; - AccountPass password; - SEX sex; - AccountEmail email; -}; -struct NetRPacket0x7930_Fixed -{ - Little16 packet_id; - NetString account_name; - NetString password; - Byte sex; - NetString email; -}; -static_assert(offsetof(NetRPacket0x7930_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7930_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7930_Fixed, account_name) == 2, "offsetof(NetRPacket0x7930_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7930_Fixed, password) == 26, "offsetof(NetRPacket0x7930_Fixed, password) == 26"); -static_assert(offsetof(NetRPacket0x7930_Fixed, sex) == 50, "offsetof(NetRPacket0x7930_Fixed, sex) == 50"); -static_assert(offsetof(NetRPacket0x7930_Fixed, email) == 51, "offsetof(NetRPacket0x7930_Fixed, email) == 51"); -static_assert(sizeof(NetRPacket0x7930_Fixed) == 91, "sizeof(NetRPacket0x7930_Fixed) == 91"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7930_Fixed *network, RPacket0x7930_Fixed native) +bool native_to_network(NetRPacket_0x7930_Fixed *network, RPacket_0x7930_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->password, native.password); rv &= native_to_network(&network->sex, native.sex); @@ -321,344 +1103,176 @@ bool native_to_network(NetRPacket0x7930_Fixed *network, RPacket0x7930_Fixed nati return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7930_Fixed *native, NetRPacket0x7930_Fixed network) +bool network_to_native(RPacket_0x7930_Fixed *native, NetRPacket_0x7930_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->password, network.password); rv &= network_to_native(&native->sex, network.sex); rv &= network_to_native(&native->email, network.email); return rv; } - -struct SPacket0x7931_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7931_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7931_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7931_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7931_Fixed, account_id) == 2, "offsetof(NetSPacket0x7931_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7931_Fixed, account_name) == 6, "offsetof(NetSPacket0x7931_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7931_Fixed) == 30, "sizeof(NetSPacket0x7931_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7931_Fixed *network, SPacket0x7931_Fixed native) +bool native_to_network(NetSPacket_0x7931_Fixed *network, SPacket_0x7931_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7931_Fixed *native, NetSPacket0x7931_Fixed network) +bool network_to_native(SPacket_0x7931_Fixed *native, NetSPacket_0x7931_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7932_Fixed -{ - uint16_t packet_id; - AccountName account_name; -}; -struct NetRPacket0x7932_Fixed -{ - Little16 packet_id; - NetString account_name; -}; -static_assert(offsetof(NetRPacket0x7932_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7932_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7932_Fixed, account_name) == 2, "offsetof(NetRPacket0x7932_Fixed, account_name) == 2"); -static_assert(sizeof(NetRPacket0x7932_Fixed) == 26, "sizeof(NetRPacket0x7932_Fixed) == 26"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7932_Fixed *network, RPacket0x7932_Fixed native) +bool native_to_network(NetRPacket_0x7932_Fixed *network, RPacket_0x7932_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7932_Fixed *native, NetRPacket0x7932_Fixed network) +bool network_to_native(RPacket_0x7932_Fixed *native, NetRPacket_0x7932_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct SPacket0x7933_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7933_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7933_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7933_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7933_Fixed, account_id) == 2, "offsetof(NetSPacket0x7933_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7933_Fixed, account_name) == 6, "offsetof(NetSPacket0x7933_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7933_Fixed) == 30, "sizeof(NetSPacket0x7933_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7933_Fixed *network, SPacket0x7933_Fixed native) +bool native_to_network(NetSPacket_0x7933_Fixed *network, SPacket_0x7933_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7933_Fixed *native, NetSPacket0x7933_Fixed network) +bool network_to_native(SPacket_0x7933_Fixed *native, NetSPacket_0x7933_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7934_Fixed -{ - uint16_t packet_id; - AccountName account_name; - AccountPass password; -}; -struct NetRPacket0x7934_Fixed -{ - Little16 packet_id; - NetString account_name; - NetString password; -}; -static_assert(offsetof(NetRPacket0x7934_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7934_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7934_Fixed, account_name) == 2, "offsetof(NetRPacket0x7934_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7934_Fixed, password) == 26, "offsetof(NetRPacket0x7934_Fixed, password) == 26"); -static_assert(sizeof(NetRPacket0x7934_Fixed) == 50, "sizeof(NetRPacket0x7934_Fixed) == 50"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7934_Fixed *network, RPacket0x7934_Fixed native) +bool native_to_network(NetRPacket_0x7934_Fixed *network, RPacket_0x7934_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->password, native.password); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7934_Fixed *native, NetRPacket0x7934_Fixed network) +bool network_to_native(RPacket_0x7934_Fixed *native, NetRPacket_0x7934_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->password, network.password); return rv; } - -struct SPacket0x7935_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7935_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7935_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7935_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7935_Fixed, account_id) == 2, "offsetof(NetSPacket0x7935_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7935_Fixed, account_name) == 6, "offsetof(NetSPacket0x7935_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7935_Fixed) == 30, "sizeof(NetSPacket0x7935_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7935_Fixed *network, SPacket0x7935_Fixed native) +bool native_to_network(NetSPacket_0x7935_Fixed *network, SPacket_0x7935_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7935_Fixed *native, NetSPacket0x7935_Fixed network) -{ - bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->account_id, network.account_id); - rv &= network_to_native(&native->account_name, network.account_name); - return rv; -} - -struct RPacket0x7936_Fixed -{ - uint16_t packet_id; - AccountName account_name; - uint32_t status; - timestamp_seconds_buffer error_message; -}; -struct NetRPacket0x7936_Fixed +bool network_to_native(SPacket_0x7935_Fixed *native, NetSPacket_0x7935_Fixed network) { - Little16 packet_id; - NetString account_name; - Little32 status; - NetString error_message; -}; -static_assert(offsetof(NetRPacket0x7936_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7936_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7936_Fixed, account_name) == 2, "offsetof(NetRPacket0x7936_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7936_Fixed, status) == 26, "offsetof(NetRPacket0x7936_Fixed, status) == 26"); -static_assert(offsetof(NetRPacket0x7936_Fixed, error_message) == 30, "offsetof(NetRPacket0x7936_Fixed, error_message) == 30"); -static_assert(sizeof(NetRPacket0x7936_Fixed) == 50, "sizeof(NetRPacket0x7936_Fixed) == 50"); + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->account_id, network.account_id); + rv &= network_to_native(&native->account_name, network.account_name); + return rv; +} inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7936_Fixed *network, RPacket0x7936_Fixed native) +bool native_to_network(NetRPacket_0x7936_Fixed *network, RPacket_0x7936_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->status, native.status); rv &= native_to_network(&network->error_message, native.error_message); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7936_Fixed *native, NetRPacket0x7936_Fixed network) +bool network_to_native(RPacket_0x7936_Fixed *native, NetRPacket_0x7936_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->status, network.status); rv &= network_to_native(&native->error_message, network.error_message); return rv; } - -struct SPacket0x7937_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7937_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7937_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7937_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7937_Fixed, account_id) == 2, "offsetof(NetSPacket0x7937_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7937_Fixed, account_name) == 6, "offsetof(NetSPacket0x7937_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7937_Fixed) == 30, "sizeof(NetSPacket0x7937_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7937_Fixed *network, SPacket0x7937_Fixed native) +bool native_to_network(NetSPacket_0x7937_Fixed *network, SPacket_0x7937_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); + rv &= native_to_network(&network->status, native.status); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7937_Fixed *native, NetSPacket0x7937_Fixed network) +bool network_to_native(SPacket_0x7937_Fixed *native, NetSPacket_0x7937_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); + rv &= network_to_native(&native->status, network.status); return rv; } - -struct RPacket0x7938_Fixed -{ - uint16_t packet_id; -}; -struct NetRPacket0x7938_Fixed -{ - Little16 packet_id; -}; -static_assert(offsetof(NetRPacket0x7938_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7938_Fixed, packet_id) == 0"); -static_assert(sizeof(NetRPacket0x7938_Fixed) == 2, "sizeof(NetRPacket0x7938_Fixed) == 2"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7938_Fixed *network, RPacket0x7938_Fixed native) +bool native_to_network(NetRPacket_0x7938_Fixed *network, RPacket_0x7938_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7938_Fixed *native, NetRPacket0x7938_Fixed network) +bool network_to_native(RPacket_0x7938_Fixed *native, NetRPacket_0x7938_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } - -struct SPacket0x7939_Head -{ - uint16_t packet_id; - uint16_t packet_length; -}; -struct NetSPacket0x7939_Head -{ - Little16 packet_id; - Little16 packet_length; -}; -static_assert(offsetof(NetSPacket0x7939_Head, packet_id) == 0, "offsetof(NetSPacket0x7939_Head, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7939_Head, packet_length) == 2, "offsetof(NetSPacket0x7939_Head, packet_length) == 2"); -static_assert(sizeof(NetSPacket0x7939_Head) == 4, "sizeof(NetSPacket0x7939_Head) == 4"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7939_Head *network, SPacket0x7939_Head native) +bool native_to_network(NetSPacket_0x7939_Head *network, SPacket_0x7939_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->packet_length, native.packet_length); + 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(SPacket0x7939_Head *native, NetSPacket0x7939_Head network) +bool network_to_native(SPacket_0x7939_Head *native, NetSPacket_0x7939_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->packet_length, network.packet_length); + 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; } - -struct SPacket0x7939_Repeat -{ - IP4Address ip; - uint16_t port; - ServerName name; - uint16_t users; - uint16_t maintenance; - uint16_t is_new; -}; -struct NetSPacket0x7939_Repeat -{ - IP4Address ip; - Little16 port; - NetString name; - Little16 users; - Little16 maintenance; - Little16 is_new; -}; -static_assert(offsetof(NetSPacket0x7939_Repeat, ip) == 0, "offsetof(NetSPacket0x7939_Repeat, ip) == 0"); -static_assert(offsetof(NetSPacket0x7939_Repeat, port) == 4, "offsetof(NetSPacket0x7939_Repeat, port) == 4"); -static_assert(offsetof(NetSPacket0x7939_Repeat, name) == 6, "offsetof(NetSPacket0x7939_Repeat, name) == 6"); -static_assert(offsetof(NetSPacket0x7939_Repeat, users) == 26, "offsetof(NetSPacket0x7939_Repeat, users) == 26"); -static_assert(offsetof(NetSPacket0x7939_Repeat, maintenance) == 28, "offsetof(NetSPacket0x7939_Repeat, maintenance) == 28"); -static_assert(offsetof(NetSPacket0x7939_Repeat, is_new) == 30, "offsetof(NetSPacket0x7939_Repeat, is_new) == 30"); -static_assert(sizeof(NetSPacket0x7939_Repeat) == 32, "sizeof(NetSPacket0x7939_Repeat) == 32"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7939_Repeat *network, SPacket0x7939_Repeat native) +bool native_to_network(NetSPacket_0x7939_Repeat *network, SPacket_0x7939_Repeat native) { bool rv = true; rv &= native_to_network(&network->ip, native.ip); @@ -670,7 +1284,7 @@ bool native_to_network(NetSPacket0x7939_Repeat *network, SPacket0x7939_Repeat na return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7939_Repeat *native, NetSPacket0x7939_Repeat network) +bool network_to_native(SPacket_0x7939_Repeat *native, NetSPacket_0x7939_Repeat network) { bool rv = true; rv &= network_to_native(&native->ip, network.ip); @@ -681,990 +1295,493 @@ bool network_to_native(SPacket0x7939_Repeat *native, NetSPacket0x7939_Repeat net rv &= network_to_native(&native->is_new, network.is_new); return rv; } - -struct RPacket0x793a_Fixed -{ - uint16_t packet_id; - AccountName account_name; - AccountPass password; -}; -struct NetRPacket0x793a_Fixed -{ - Little16 packet_id; - NetString account_name; - NetString password; -}; -static_assert(offsetof(NetRPacket0x793a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793a_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x793a_Fixed, account_name) == 2, "offsetof(NetRPacket0x793a_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x793a_Fixed, password) == 26, "offsetof(NetRPacket0x793a_Fixed, password) == 26"); -static_assert(sizeof(NetRPacket0x793a_Fixed) == 50, "sizeof(NetRPacket0x793a_Fixed) == 50"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x793a_Fixed *network, RPacket0x793a_Fixed native) +bool native_to_network(NetRPacket_0x793a_Fixed *network, RPacket_0x793a_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->password, native.password); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x793a_Fixed *native, NetRPacket0x793a_Fixed network) +bool network_to_native(RPacket_0x793a_Fixed *native, NetRPacket_0x793a_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->password, network.password); return rv; } - -struct SPacket0x793b_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x793b_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x793b_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793b_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x793b_Fixed, account_id) == 2, "offsetof(NetSPacket0x793b_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x793b_Fixed, account_name) == 6, "offsetof(NetSPacket0x793b_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x793b_Fixed) == 30, "sizeof(NetSPacket0x793b_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x793b_Fixed *network, SPacket0x793b_Fixed native) +bool native_to_network(NetSPacket_0x793b_Fixed *network, SPacket_0x793b_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x793b_Fixed *native, NetSPacket0x793b_Fixed network) +bool network_to_native(SPacket_0x793b_Fixed *native, NetSPacket_0x793b_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x793c_Fixed -{ - uint16_t packet_id; - AccountName account_name; - SEX sex; -}; -struct NetRPacket0x793c_Fixed -{ - Little16 packet_id; - NetString account_name; - Byte sex; -}; -static_assert(offsetof(NetRPacket0x793c_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793c_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x793c_Fixed, account_name) == 2, "offsetof(NetRPacket0x793c_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x793c_Fixed, sex) == 26, "offsetof(NetRPacket0x793c_Fixed, sex) == 26"); -static_assert(sizeof(NetRPacket0x793c_Fixed) == 27, "sizeof(NetRPacket0x793c_Fixed) == 27"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x793c_Fixed *network, RPacket0x793c_Fixed native) +bool native_to_network(NetRPacket_0x793c_Fixed *network, RPacket_0x793c_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->sex, native.sex); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x793c_Fixed *native, NetRPacket0x793c_Fixed network) +bool network_to_native(RPacket_0x793c_Fixed *native, NetRPacket_0x793c_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->sex, network.sex); return rv; } - -struct SPacket0x793d_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x793d_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x793d_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793d_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x793d_Fixed, account_id) == 2, "offsetof(NetSPacket0x793d_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x793d_Fixed, account_name) == 6, "offsetof(NetSPacket0x793d_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x793d_Fixed) == 30, "sizeof(NetSPacket0x793d_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x793d_Fixed *network, SPacket0x793d_Fixed native) +bool native_to_network(NetSPacket_0x793d_Fixed *network, SPacket_0x793d_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x793d_Fixed *native, NetSPacket0x793d_Fixed network) +bool network_to_native(SPacket_0x793d_Fixed *native, NetSPacket_0x793d_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x793e_Fixed -{ - uint16_t packet_id; - AccountName account_name; - GmLevel gm_level; -}; -struct NetRPacket0x793e_Fixed -{ - Little16 packet_id; - NetString account_name; - Byte gm_level; -}; -static_assert(offsetof(NetRPacket0x793e_Fixed, packet_id) == 0, "offsetof(NetRPacket0x793e_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x793e_Fixed, account_name) == 2, "offsetof(NetRPacket0x793e_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x793e_Fixed, gm_level) == 26, "offsetof(NetRPacket0x793e_Fixed, gm_level) == 26"); -static_assert(sizeof(NetRPacket0x793e_Fixed) == 27, "sizeof(NetRPacket0x793e_Fixed) == 27"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x793e_Fixed *network, RPacket0x793e_Fixed native) +bool native_to_network(NetRPacket_0x793e_Fixed *network, RPacket_0x793e_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->gm_level, native.gm_level); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x793e_Fixed *native, NetRPacket0x793e_Fixed network) +bool network_to_native(RPacket_0x793e_Fixed *native, NetRPacket_0x793e_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->gm_level, network.gm_level); return rv; } - -struct SPacket0x793f_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x793f_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x793f_Fixed, packet_id) == 0, "offsetof(NetSPacket0x793f_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x793f_Fixed, account_id) == 2, "offsetof(NetSPacket0x793f_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x793f_Fixed, account_name) == 6, "offsetof(NetSPacket0x793f_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x793f_Fixed) == 30, "sizeof(NetSPacket0x793f_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x793f_Fixed *network, SPacket0x793f_Fixed native) +bool native_to_network(NetSPacket_0x793f_Fixed *network, SPacket_0x793f_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x793f_Fixed *native, NetSPacket0x793f_Fixed network) +bool network_to_native(SPacket_0x793f_Fixed *native, NetSPacket_0x793f_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7940_Fixed -{ - uint16_t packet_id; - AccountName account_name; - AccountEmail email; -}; -struct NetRPacket0x7940_Fixed -{ - Little16 packet_id; - NetString account_name; - NetString email; -}; -static_assert(offsetof(NetRPacket0x7940_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7940_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7940_Fixed, account_name) == 2, "offsetof(NetRPacket0x7940_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7940_Fixed, email) == 26, "offsetof(NetRPacket0x7940_Fixed, email) == 26"); -static_assert(sizeof(NetRPacket0x7940_Fixed) == 66, "sizeof(NetRPacket0x7940_Fixed) == 66"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7940_Fixed *network, RPacket0x7940_Fixed native) +bool native_to_network(NetRPacket_0x7940_Fixed *network, RPacket_0x7940_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->email, native.email); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7940_Fixed *native, NetRPacket0x7940_Fixed network) +bool network_to_native(RPacket_0x7940_Fixed *native, NetRPacket_0x7940_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->email, network.email); return rv; } - -struct SPacket0x7941_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7941_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7941_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7941_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7941_Fixed, account_id) == 2, "offsetof(NetSPacket0x7941_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7941_Fixed, account_name) == 6, "offsetof(NetSPacket0x7941_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7941_Fixed) == 30, "sizeof(NetSPacket0x7941_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7941_Fixed *network, SPacket0x7941_Fixed native) +bool native_to_network(NetSPacket_0x7941_Fixed *network, SPacket_0x7941_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7941_Fixed *native, NetSPacket0x7941_Fixed network) +bool network_to_native(SPacket_0x7941_Fixed *native, NetSPacket_0x7941_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7942_Head -{ - uint16_t packet_id; - AccountName account_name; - uint16_t string_length; -}; -struct NetRPacket0x7942_Head -{ - Little16 packet_id; - NetString account_name; - Little16 string_length; -}; -static_assert(offsetof(NetRPacket0x7942_Head, packet_id) == 0, "offsetof(NetRPacket0x7942_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7942_Head, account_name) == 2, "offsetof(NetRPacket0x7942_Head, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7942_Head, string_length) == 26, "offsetof(NetRPacket0x7942_Head, string_length) == 26"); -static_assert(sizeof(NetRPacket0x7942_Head) == 28, "sizeof(NetRPacket0x7942_Head) == 28"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7942_Head *network, RPacket0x7942_Head native) +bool native_to_network(NetRPacket_0x7942_Head *network, RPacket_0x7942_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->string_length, native.string_length); + rv &= native_to_network(&network->magic_packet_length, native.magic_packet_length); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7942_Head *native, NetRPacket0x7942_Head network) +bool network_to_native(RPacket_0x7942_Head *native, NetRPacket_0x7942_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->string_length, network.string_length); + rv &= network_to_native(&native->magic_packet_length, network.magic_packet_length); return rv; } - -struct RPacket0x7942_Repeat -{ - uint8_t c; -}; -struct NetRPacket0x7942_Repeat -{ - Byte c; -}; -static_assert(offsetof(NetRPacket0x7942_Repeat, c) == 0, "offsetof(NetRPacket0x7942_Repeat, c) == 0"); -static_assert(sizeof(NetRPacket0x7942_Repeat) == 1, "sizeof(NetRPacket0x7942_Repeat) == 1"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7942_Repeat *network, RPacket0x7942_Repeat native) +bool native_to_network(NetRPacket_0x7942_Repeat *network, RPacket_0x7942_Repeat native) { bool rv = true; rv &= native_to_network(&network->c, native.c); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7942_Repeat *native, NetRPacket0x7942_Repeat network) +bool network_to_native(RPacket_0x7942_Repeat *native, NetRPacket_0x7942_Repeat network) { bool rv = true; rv &= network_to_native(&native->c, network.c); return rv; } - -struct SPacket0x7943_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7943_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7943_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7943_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7943_Fixed, account_id) == 2, "offsetof(NetSPacket0x7943_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7943_Fixed, account_name) == 6, "offsetof(NetSPacket0x7943_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7943_Fixed) == 30, "sizeof(NetSPacket0x7943_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7943_Fixed *network, SPacket0x7943_Fixed native) +bool native_to_network(NetSPacket_0x7943_Fixed *network, SPacket_0x7943_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7943_Fixed *native, NetSPacket0x7943_Fixed network) +bool network_to_native(SPacket_0x7943_Fixed *native, NetSPacket_0x7943_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7944_Fixed -{ - uint16_t packet_id; - AccountName account_name; -}; -struct NetRPacket0x7944_Fixed -{ - Little16 packet_id; - NetString account_name; -}; -static_assert(offsetof(NetRPacket0x7944_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7944_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7944_Fixed, account_name) == 2, "offsetof(NetRPacket0x7944_Fixed, account_name) == 2"); -static_assert(sizeof(NetRPacket0x7944_Fixed) == 26, "sizeof(NetRPacket0x7944_Fixed) == 26"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7944_Fixed *network, RPacket0x7944_Fixed native) +bool native_to_network(NetRPacket_0x7944_Fixed *network, RPacket_0x7944_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7944_Fixed *native, NetRPacket0x7944_Fixed network) +bool network_to_native(RPacket_0x7944_Fixed *native, NetRPacket_0x7944_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct SPacket0x7945_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7945_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7945_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7945_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7945_Fixed, account_id) == 2, "offsetof(NetSPacket0x7945_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7945_Fixed, account_name) == 6, "offsetof(NetSPacket0x7945_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7945_Fixed) == 30, "sizeof(NetSPacket0x7945_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7945_Fixed *network, SPacket0x7945_Fixed native) +bool native_to_network(NetSPacket_0x7945_Fixed *network, SPacket_0x7945_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7945_Fixed *native, NetSPacket0x7945_Fixed network) +bool network_to_native(SPacket_0x7945_Fixed *native, NetSPacket_0x7945_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7946_Fixed -{ - uint16_t packet_id; - uint32_t account_id; -}; -struct NetRPacket0x7946_Fixed -{ - Little16 packet_id; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x7946_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7946_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7946_Fixed, account_id) == 2, "offsetof(NetRPacket0x7946_Fixed, account_id) == 2"); -static_assert(sizeof(NetRPacket0x7946_Fixed) == 6, "sizeof(NetRPacket0x7946_Fixed) == 6"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7946_Fixed *network, RPacket0x7946_Fixed native) +bool native_to_network(NetRPacket_0x7946_Fixed *network, RPacket_0x7946_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7946_Fixed *native, NetRPacket0x7946_Fixed network) +bool network_to_native(RPacket_0x7946_Fixed *native, NetRPacket_0x7946_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); return rv; } - -struct SPacket0x7947_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; -}; -struct NetSPacket0x7947_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; -}; -static_assert(offsetof(NetSPacket0x7947_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7947_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7947_Fixed, account_id) == 2, "offsetof(NetSPacket0x7947_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7947_Fixed, account_name) == 6, "offsetof(NetSPacket0x7947_Fixed, account_name) == 6"); -static_assert(sizeof(NetSPacket0x7947_Fixed) == 30, "sizeof(NetSPacket0x7947_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7947_Fixed *network, SPacket0x7947_Fixed native) +bool native_to_network(NetSPacket_0x7947_Fixed *network, SPacket_0x7947_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7947_Fixed *native, NetSPacket0x7947_Fixed network) +bool network_to_native(SPacket_0x7947_Fixed *native, NetSPacket_0x7947_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct RPacket0x7948_Fixed -{ - uint16_t packet_id; - AccountName account_name; - TimeT valid_until; -}; -struct NetRPacket0x7948_Fixed -{ - Little16 packet_id; - NetString account_name; - Little32 valid_until; -}; -static_assert(offsetof(NetRPacket0x7948_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7948_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7948_Fixed, account_name) == 2, "offsetof(NetRPacket0x7948_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7948_Fixed, valid_until) == 26, "offsetof(NetRPacket0x7948_Fixed, valid_until) == 26"); -static_assert(sizeof(NetRPacket0x7948_Fixed) == 30, "sizeof(NetRPacket0x7948_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7948_Fixed *network, RPacket0x7948_Fixed native) +bool native_to_network(NetRPacket_0x7948_Fixed *network, RPacket_0x7948_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->valid_until, native.valid_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7948_Fixed *native, NetRPacket0x7948_Fixed network) +bool network_to_native(RPacket_0x7948_Fixed *native, NetRPacket_0x7948_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->valid_until, network.valid_until); return rv; } - -struct SPacket0x7949_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; - TimeT valid_until; -}; -struct NetSPacket0x7949_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; - Little32 valid_until; -}; -static_assert(offsetof(NetSPacket0x7949_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7949_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7949_Fixed, account_id) == 2, "offsetof(NetSPacket0x7949_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7949_Fixed, account_name) == 6, "offsetof(NetSPacket0x7949_Fixed, account_name) == 6"); -static_assert(offsetof(NetSPacket0x7949_Fixed, valid_until) == 30, "offsetof(NetSPacket0x7949_Fixed, valid_until) == 30"); -static_assert(sizeof(NetSPacket0x7949_Fixed) == 34, "sizeof(NetSPacket0x7949_Fixed) == 34"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7949_Fixed *network, SPacket0x7949_Fixed native) +bool native_to_network(NetSPacket_0x7949_Fixed *network, SPacket_0x7949_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); rv &= native_to_network(&network->valid_until, native.valid_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7949_Fixed *native, NetSPacket0x7949_Fixed network) +bool network_to_native(SPacket_0x7949_Fixed *native, NetSPacket_0x7949_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); rv &= network_to_native(&native->valid_until, network.valid_until); return rv; } - -struct RPacket0x794a_Fixed -{ - uint16_t packet_id; - AccountName account_name; - TimeT ban_until; -}; -struct NetRPacket0x794a_Fixed -{ - Little16 packet_id; - NetString account_name; - Little32 ban_until; -}; -static_assert(offsetof(NetRPacket0x794a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x794a_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x794a_Fixed, account_name) == 2, "offsetof(NetRPacket0x794a_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x794a_Fixed, ban_until) == 26, "offsetof(NetRPacket0x794a_Fixed, ban_until) == 26"); -static_assert(sizeof(NetRPacket0x794a_Fixed) == 30, "sizeof(NetRPacket0x794a_Fixed) == 30"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x794a_Fixed *network, RPacket0x794a_Fixed native) +bool native_to_network(NetRPacket_0x794a_Fixed *network, RPacket_0x794a_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->ban_until, native.ban_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x794a_Fixed *native, NetRPacket0x794a_Fixed network) +bool network_to_native(RPacket_0x794a_Fixed *native, NetRPacket_0x794a_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->ban_until, network.ban_until); return rv; } - -struct SPacket0x794b_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; - TimeT ban_until; -}; -struct NetSPacket0x794b_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; - Little32 ban_until; -}; -static_assert(offsetof(NetSPacket0x794b_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794b_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x794b_Fixed, account_id) == 2, "offsetof(NetSPacket0x794b_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x794b_Fixed, account_name) == 6, "offsetof(NetSPacket0x794b_Fixed, account_name) == 6"); -static_assert(offsetof(NetSPacket0x794b_Fixed, ban_until) == 30, "offsetof(NetSPacket0x794b_Fixed, ban_until) == 30"); -static_assert(sizeof(NetSPacket0x794b_Fixed) == 34, "sizeof(NetSPacket0x794b_Fixed) == 34"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x794b_Fixed *network, SPacket0x794b_Fixed native) +bool native_to_network(NetSPacket_0x794b_Fixed *network, SPacket_0x794b_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); rv &= native_to_network(&network->ban_until, native.ban_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x794b_Fixed *native, NetSPacket0x794b_Fixed network) +bool network_to_native(SPacket_0x794b_Fixed *native, NetSPacket_0x794b_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); rv &= network_to_native(&native->ban_until, network.ban_until); return rv; } - -struct RPacket0x794c_Fixed -{ - uint16_t packet_id; - AccountName account_name; - HumanTimeDiff ban_add; -}; -struct NetRPacket0x794c_Fixed -{ - Little16 packet_id; - NetString account_name; - NetHumanTimeDiff ban_add; -}; -static_assert(offsetof(NetRPacket0x794c_Fixed, packet_id) == 0, "offsetof(NetRPacket0x794c_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x794c_Fixed, account_name) == 2, "offsetof(NetRPacket0x794c_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x794c_Fixed, ban_add) == 26, "offsetof(NetRPacket0x794c_Fixed, ban_add) == 26"); -static_assert(sizeof(NetRPacket0x794c_Fixed) == 38, "sizeof(NetRPacket0x794c_Fixed) == 38"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x794c_Fixed *network, RPacket0x794c_Fixed native) +bool native_to_network(NetRPacket_0x794c_Fixed *network, RPacket_0x794c_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->ban_add, native.ban_add); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x794c_Fixed *native, NetRPacket0x794c_Fixed network) +bool network_to_native(RPacket_0x794c_Fixed *native, NetRPacket_0x794c_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->ban_add, network.ban_add); return rv; } - -struct SPacket0x794d_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; - TimeT ban_until; -}; -struct NetSPacket0x794d_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; - Little32 ban_until; -}; -static_assert(offsetof(NetSPacket0x794d_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794d_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x794d_Fixed, account_id) == 2, "offsetof(NetSPacket0x794d_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x794d_Fixed, account_name) == 6, "offsetof(NetSPacket0x794d_Fixed, account_name) == 6"); -static_assert(offsetof(NetSPacket0x794d_Fixed, ban_until) == 30, "offsetof(NetSPacket0x794d_Fixed, ban_until) == 30"); -static_assert(sizeof(NetSPacket0x794d_Fixed) == 34, "sizeof(NetSPacket0x794d_Fixed) == 34"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x794d_Fixed *network, SPacket0x794d_Fixed native) +bool native_to_network(NetSPacket_0x794d_Fixed *network, SPacket_0x794d_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); rv &= native_to_network(&network->ban_until, native.ban_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x794d_Fixed *native, NetSPacket0x794d_Fixed network) +bool network_to_native(SPacket_0x794d_Fixed *native, NetSPacket_0x794d_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); rv &= network_to_native(&native->ban_until, network.ban_until); return rv; } - -struct RPacket0x794e_Head -{ - uint16_t packet_id; - uint16_t unused; - uint32_t string_length; -}; -struct NetRPacket0x794e_Head -{ - Little16 packet_id; - Little16 unused; - Little32 string_length; -}; -static_assert(offsetof(NetRPacket0x794e_Head, packet_id) == 0, "offsetof(NetRPacket0x794e_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x794e_Head, unused) == 2, "offsetof(NetRPacket0x794e_Head, unused) == 2"); -static_assert(offsetof(NetRPacket0x794e_Head, string_length) == 4, "offsetof(NetRPacket0x794e_Head, string_length) == 4"); -static_assert(sizeof(NetRPacket0x794e_Head) == 8, "sizeof(NetRPacket0x794e_Head) == 8"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x794e_Head *network, RPacket0x794e_Head native) +bool native_to_network(NetRPacket_0x794e_Head *network, RPacket_0x794e_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->unused, native.unused); - rv &= native_to_network(&network->string_length, native.string_length); + rv &= native_to_network(&network->magic_packet_length, native.magic_packet_length); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x794e_Head *native, NetRPacket0x794e_Head network) +bool network_to_native(RPacket_0x794e_Head *native, NetRPacket_0x794e_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->unused, network.unused); - rv &= network_to_native(&native->string_length, network.string_length); + rv &= network_to_native(&native->magic_packet_length, network.magic_packet_length); return rv; } - -struct RPacket0x794e_Repeat -{ - uint8_t c; -}; -struct NetRPacket0x794e_Repeat -{ - Byte c; -}; -static_assert(offsetof(NetRPacket0x794e_Repeat, c) == 0, "offsetof(NetRPacket0x794e_Repeat, c) == 0"); -static_assert(sizeof(NetRPacket0x794e_Repeat) == 1, "sizeof(NetRPacket0x794e_Repeat) == 1"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x794e_Repeat *network, RPacket0x794e_Repeat native) +bool native_to_network(NetRPacket_0x794e_Repeat *network, RPacket_0x794e_Repeat native) { bool rv = true; rv &= native_to_network(&network->c, native.c); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x794e_Repeat *native, NetRPacket0x794e_Repeat network) +bool network_to_native(RPacket_0x794e_Repeat *native, NetRPacket_0x794e_Repeat network) { bool rv = true; rv &= network_to_native(&native->c, network.c); return rv; } - -struct SPacket0x794f_Fixed -{ - uint16_t packet_id; - uint16_t error; -}; -struct NetSPacket0x794f_Fixed -{ - Little16 packet_id; - Little16 error; -}; -static_assert(offsetof(NetSPacket0x794f_Fixed, packet_id) == 0, "offsetof(NetSPacket0x794f_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x794f_Fixed, error) == 2, "offsetof(NetSPacket0x794f_Fixed, error) == 2"); -static_assert(sizeof(NetSPacket0x794f_Fixed) == 4, "sizeof(NetSPacket0x794f_Fixed) == 4"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x794f_Fixed *network, SPacket0x794f_Fixed native) +bool native_to_network(NetSPacket_0x794f_Fixed *network, SPacket_0x794f_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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(SPacket0x794f_Fixed *native, NetSPacket0x794f_Fixed network) +bool network_to_native(SPacket_0x794f_Fixed *native, NetSPacket_0x794f_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->error, network.error); return rv; } - -struct RPacket0x7950_Fixed -{ - uint16_t packet_id; - AccountName account_name; - HumanTimeDiff valid_add; -}; -struct NetRPacket0x7950_Fixed -{ - Little16 packet_id; - NetString account_name; - NetHumanTimeDiff valid_add; -}; -static_assert(offsetof(NetRPacket0x7950_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7950_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7950_Fixed, account_name) == 2, "offsetof(NetRPacket0x7950_Fixed, account_name) == 2"); -static_assert(offsetof(NetRPacket0x7950_Fixed, valid_add) == 26, "offsetof(NetRPacket0x7950_Fixed, valid_add) == 26"); -static_assert(sizeof(NetRPacket0x7950_Fixed) == 38, "sizeof(NetRPacket0x7950_Fixed) == 38"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7950_Fixed *network, RPacket0x7950_Fixed native) +bool native_to_network(NetRPacket_0x7950_Fixed *network, RPacket_0x7950_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + 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->valid_add, native.valid_add); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7950_Fixed *native, NetRPacket0x7950_Fixed network) +bool network_to_native(RPacket_0x7950_Fixed *native, NetRPacket_0x7950_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + 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->valid_add, network.valid_add); return rv; } - -struct SPacket0x7951_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountName account_name; - TimeT valid_until; -}; -struct NetSPacket0x7951_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString account_name; - Little32 valid_until; -}; -static_assert(offsetof(NetSPacket0x7951_Fixed, packet_id) == 0, "offsetof(NetSPacket0x7951_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7951_Fixed, account_id) == 2, "offsetof(NetSPacket0x7951_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7951_Fixed, account_name) == 6, "offsetof(NetSPacket0x7951_Fixed, account_name) == 6"); -static_assert(offsetof(NetSPacket0x7951_Fixed, valid_until) == 30, "offsetof(NetSPacket0x7951_Fixed, valid_until) == 30"); -static_assert(sizeof(NetSPacket0x7951_Fixed) == 34, "sizeof(NetSPacket0x7951_Fixed) == 34"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7951_Fixed *network, SPacket0x7951_Fixed native) +bool native_to_network(NetSPacket_0x7951_Fixed *network, SPacket_0x7951_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->account_name, native.account_name); rv &= native_to_network(&network->valid_until, native.valid_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7951_Fixed *native, NetSPacket0x7951_Fixed network) +bool network_to_native(SPacket_0x7951_Fixed *native, NetSPacket_0x7951_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->account_name, network.account_name); rv &= network_to_native(&native->valid_until, network.valid_until); return rv; } - -struct RPacket0x7952_Fixed -{ - uint16_t packet_id; - AccountName account_name; -}; -struct NetRPacket0x7952_Fixed -{ - Little16 packet_id; - NetString account_name; -}; -static_assert(offsetof(NetRPacket0x7952_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7952_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7952_Fixed, account_name) == 2, "offsetof(NetRPacket0x7952_Fixed, account_name) == 2"); -static_assert(sizeof(NetRPacket0x7952_Fixed) == 26, "sizeof(NetRPacket0x7952_Fixed) == 26"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7952_Fixed *network, RPacket0x7952_Fixed native) +bool native_to_network(NetRPacket_0x7952_Fixed *network, RPacket_0x7952_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_name, native.account_name); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7952_Fixed *native, NetRPacket0x7952_Fixed network) +bool network_to_native(RPacket_0x7952_Fixed *native, NetRPacket_0x7952_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_name, network.account_name); return rv; } - -struct SPacket0x7953_Head -{ - uint16_t packet_id; - uint32_t account_id; - GmLevel gm_level; - AccountName account_name; - SEX id; - uint32_t login_count; - uint32_t state; - timestamp_seconds_buffer error_message; - timestamp_milliseconds_buffer last_login_string; - VString<15> ip_string; - AccountEmail email; - TimeT connect_until; - TimeT ban_until; - uint16_t string_length; -}; -struct NetSPacket0x7953_Head -{ - Little16 packet_id; - Little32 account_id; - Byte gm_level; - NetString account_name; - Byte id; - Little32 login_count; - Little32 state; - NetString error_message; - NetString last_login_string; - NetString)> ip_string; - NetString email; - Little32 connect_until; - Little32 ban_until; - Little16 string_length; -}; -static_assert(offsetof(NetSPacket0x7953_Head, packet_id) == 0, "offsetof(NetSPacket0x7953_Head, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x7953_Head, account_id) == 2, "offsetof(NetSPacket0x7953_Head, account_id) == 2"); -static_assert(offsetof(NetSPacket0x7953_Head, gm_level) == 6, "offsetof(NetSPacket0x7953_Head, gm_level) == 6"); -static_assert(offsetof(NetSPacket0x7953_Head, account_name) == 7, "offsetof(NetSPacket0x7953_Head, account_name) == 7"); -static_assert(offsetof(NetSPacket0x7953_Head, id) == 31, "offsetof(NetSPacket0x7953_Head, id) == 31"); -static_assert(offsetof(NetSPacket0x7953_Head, login_count) == 32, "offsetof(NetSPacket0x7953_Head, login_count) == 32"); -static_assert(offsetof(NetSPacket0x7953_Head, state) == 36, "offsetof(NetSPacket0x7953_Head, state) == 36"); -static_assert(offsetof(NetSPacket0x7953_Head, error_message) == 40, "offsetof(NetSPacket0x7953_Head, error_message) == 40"); -static_assert(offsetof(NetSPacket0x7953_Head, last_login_string) == 60, "offsetof(NetSPacket0x7953_Head, last_login_string) == 60"); -static_assert(offsetof(NetSPacket0x7953_Head, ip_string) == 84, "offsetof(NetSPacket0x7953_Head, ip_string) == 84"); -static_assert(offsetof(NetSPacket0x7953_Head, email) == 100, "offsetof(NetSPacket0x7953_Head, email) == 100"); -static_assert(offsetof(NetSPacket0x7953_Head, connect_until) == 140, "offsetof(NetSPacket0x7953_Head, connect_until) == 140"); -static_assert(offsetof(NetSPacket0x7953_Head, ban_until) == 144, "offsetof(NetSPacket0x7953_Head, ban_until) == 144"); -static_assert(offsetof(NetSPacket0x7953_Head, string_length) == 148, "offsetof(NetSPacket0x7953_Head, string_length) == 148"); -static_assert(sizeof(NetSPacket0x7953_Head) == 150, "sizeof(NetSPacket0x7953_Head) == 150"); -inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7953_Head *network, SPacket0x7953_Head native) -{ - bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); +inline __attribute__((warn_unused_result)) +bool native_to_network(NetSPacket_0x7953_Head *network, SPacket_0x7953_Head native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->gm_level, native.gm_level); rv &= native_to_network(&network->account_name, native.account_name); - rv &= native_to_network(&network->id, native.id); + rv &= native_to_network(&network->sex, native.sex); rv &= native_to_network(&network->login_count, native.login_count); rv &= native_to_network(&network->state, native.state); rv &= native_to_network(&network->error_message, native.error_message); @@ -1673,18 +1790,18 @@ bool native_to_network(NetSPacket0x7953_Head *network, SPacket0x7953_Head native rv &= native_to_network(&network->email, native.email); rv &= native_to_network(&network->connect_until, native.connect_until); rv &= native_to_network(&network->ban_until, native.ban_until); - rv &= native_to_network(&network->string_length, native.string_length); + rv &= native_to_network(&network->magic_packet_length, native.magic_packet_length); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7953_Head *native, NetSPacket0x7953_Head network) +bool network_to_native(SPacket_0x7953_Head *native, NetSPacket_0x7953_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->gm_level, network.gm_level); rv &= network_to_native(&native->account_name, network.account_name); - rv &= network_to_native(&native->id, network.id); + rv &= network_to_native(&native->sex, network.sex); rv &= network_to_native(&native->login_count, network.login_count); rv &= network_to_native(&native->state, network.state); rv &= network_to_native(&native->error_message, network.error_message); @@ -1693,89 +1810,52 @@ bool network_to_native(SPacket0x7953_Head *native, NetSPacket0x7953_Head network rv &= network_to_native(&native->email, network.email); rv &= network_to_native(&native->connect_until, network.connect_until); rv &= network_to_native(&native->ban_until, network.ban_until); - rv &= network_to_native(&native->string_length, network.string_length); + rv &= network_to_native(&native->magic_packet_length, network.magic_packet_length); return rv; } - -struct SPacket0x7953_Repeat -{ - uint8_t c; -}; -struct NetSPacket0x7953_Repeat -{ - Byte c; -}; -static_assert(offsetof(NetSPacket0x7953_Repeat, c) == 0, "offsetof(NetSPacket0x7953_Repeat, c) == 0"); -static_assert(sizeof(NetSPacket0x7953_Repeat) == 1, "sizeof(NetSPacket0x7953_Repeat) == 1"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x7953_Repeat *network, SPacket0x7953_Repeat native) +bool native_to_network(NetSPacket_0x7953_Repeat *network, SPacket_0x7953_Repeat native) { bool rv = true; rv &= native_to_network(&network->c, native.c); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x7953_Repeat *native, NetSPacket0x7953_Repeat network) +bool network_to_native(SPacket_0x7953_Repeat *native, NetSPacket_0x7953_Repeat network) { bool rv = true; rv &= network_to_native(&native->c, network.c); return rv; } - -struct RPacket0x7954_Fixed -{ - uint16_t packet_id; - uint32_t account_id; -}; -struct NetRPacket0x7954_Fixed -{ - Little16 packet_id; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x7954_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7954_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x7954_Fixed, account_id) == 2, "offsetof(NetRPacket0x7954_Fixed, account_id) == 2"); -static_assert(sizeof(NetRPacket0x7954_Fixed) == 6, "sizeof(NetRPacket0x7954_Fixed) == 6"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7954_Fixed *network, RPacket0x7954_Fixed native) +bool native_to_network(NetRPacket_0x7954_Fixed *network, RPacket_0x7954_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7954_Fixed *native, NetRPacket0x7954_Fixed network) +bool network_to_native(RPacket_0x7954_Fixed *native, NetRPacket_0x7954_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); return rv; } - -struct RPacket0x7955_Fixed -{ - uint16_t packet_id; -}; -struct NetRPacket0x7955_Fixed -{ - Little16 packet_id; -}; -static_assert(offsetof(NetRPacket0x7955_Fixed, packet_id) == 0, "offsetof(NetRPacket0x7955_Fixed, packet_id) == 0"); -static_assert(sizeof(NetRPacket0x7955_Fixed) == 2, "sizeof(NetRPacket0x7955_Fixed) == 2"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x7955_Fixed *network, RPacket0x7955_Fixed native) +bool native_to_network(NetRPacket_0x7955_Fixed *network, RPacket_0x7955_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x7955_Fixed *native, NetRPacket0x7955_Fixed network) +bool network_to_native(RPacket_0x7955_Fixed *native, NetRPacket_0x7955_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); return rv; } - #endif // TMWA_PROTO2_LOGIN_ADMIN_HPP diff --git a/src/proto2/login-admin_test.cpp b/src/proto2/login-admin_test.cpp index 5bd9566..2cccef2 100644 --- a/src/proto2/login-admin_test.cpp +++ b/src/proto2/login-admin_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/login-char.hpp b/src/proto2/login-char.hpp index a594207..9c0ba74 100644 --- a/src/proto2/login-char.hpp +++ b/src/proto2/login-char.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -27,61 +27,509 @@ // This is an internal protocol, and can be changed without notice -struct RPacket0x2709_Fixed +struct RPacket_0x2709_Fixed { - uint16_t packet_id; + using NetType = NetRPacket_0x2709_Fixed; + static const uint16_t PACKET_ID = 0x2709; + + uint16_t magic_packet_id = PACKET_ID; }; -struct NetRPacket0x2709_Fixed +struct RPacket_0x2712_Fixed { - Little16 packet_id; + using NetType = NetRPacket_0x2712_Fixed; + static const uint16_t PACKET_ID = 0x2712; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + uint32_t login_id1 = {}; + uint32_t login_id2 = {}; + SEX sex = {}; + IP4Address ip = {}; }; -static_assert(offsetof(NetRPacket0x2709_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2709_Fixed, packet_id) == 0"); -static_assert(sizeof(NetRPacket0x2709_Fixed) == 2, "sizeof(NetRPacket0x2709_Fixed) == 2"); -inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2709_Fixed *network, RPacket0x2709_Fixed native) +struct SPacket_0x2713_Fixed { - bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - return rv; -} -inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2709_Fixed *native, NetRPacket0x2709_Fixed network) + using NetType = NetSPacket_0x2713_Fixed; + static const uint16_t PACKET_ID = 0x2713; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + uint8_t invalid = {}; + AccountEmail email = {}; + TimeT connect_until = {}; +}; +struct RPacket_0x2714_Fixed { - bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - return rv; -} + using NetType = NetRPacket_0x2714_Fixed; + static const uint16_t PACKET_ID = 0x2714; -struct RPacket0x2712_Fixed + uint16_t magic_packet_id = PACKET_ID; + uint32_t users = {}; +}; +struct RPacket_0x2715_Fixed { - uint16_t packet_id; - uint32_t account_id; - uint32_t login_id1; - uint32_t login_id2; - SEX sex; - IP4Address ip; + using NetType = NetRPacket_0x2715_Fixed; + static const uint16_t PACKET_ID = 0x2715; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountEmail email = {}; +}; +struct RPacket_0x2716_Fixed +{ + using NetType = NetRPacket_0x2716_Fixed; + static const uint16_t PACKET_ID = 0x2716; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; +}; +struct SPacket_0x2717_Fixed +{ + using NetType = NetSPacket_0x2717_Fixed; + static const uint16_t PACKET_ID = 0x2717; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountEmail email = {}; + TimeT connect_until = {}; +}; +struct RPacket_0x2720_Head +{ + using NetType = NetRPacket_0x2720_Head; + static const uint16_t PACKET_ID = 0x2720; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length = {}; + AccountId account_id = {}; +}; +struct RPacket_0x2720_Repeat +{ + using NetType = NetRPacket_0x2720_Repeat; + static const uint16_t PACKET_ID = 0x2720; + + uint8_t c = {}; +}; +struct SPacket_0x2721_Fixed +{ + using NetType = NetSPacket_0x2721_Fixed; + static const uint16_t PACKET_ID = 0x2721; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + GmLevel gm_level = {}; +}; +struct RPacket_0x2722_Fixed +{ + using NetType = NetRPacket_0x2722_Fixed; + static const uint16_t PACKET_ID = 0x2722; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountEmail old_email = {}; + AccountEmail new_email = {}; +}; +struct SPacket_0x2723_Fixed +{ + using NetType = NetSPacket_0x2723_Fixed; + static const uint16_t PACKET_ID = 0x2723; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + SEX sex = {}; +}; +struct RPacket_0x2724_Fixed +{ + using NetType = NetRPacket_0x2724_Fixed; + static const uint16_t PACKET_ID = 0x2724; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + uint32_t status = {}; +}; +struct RPacket_0x2725_Fixed +{ + using NetType = NetRPacket_0x2725_Fixed; + static const uint16_t PACKET_ID = 0x2725; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + HumanTimeDiff deltas = {}; +}; +struct RPacket_0x2727_Fixed +{ + using NetType = NetRPacket_0x2727_Fixed; + static const uint16_t PACKET_ID = 0x2727; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; +}; +struct RPacket_0x2728_Head +{ + using NetType = NetRPacket_0x2728_Head; + static const uint16_t PACKET_ID = 0x2728; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length = {}; + AccountId account_id = {}; +}; +struct RPacket_0x2728_Repeat +{ + using NetType = NetRPacket_0x2728_Repeat; + static const uint16_t PACKET_ID = 0x2728; + + VarName name = {}; + uint32_t value = {}; +}; +struct SPacket_0x2729_Head +{ + using NetType = NetSPacket_0x2729_Head; + static const uint16_t PACKET_ID = 0x2729; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length = {}; + AccountId account_id = {}; +}; +struct SPacket_0x2729_Repeat +{ + using NetType = NetSPacket_0x2729_Repeat; + static const uint16_t PACKET_ID = 0x2729; + + VarName name = {}; + uint32_t value = {}; +}; +struct RPacket_0x272a_Fixed +{ + using NetType = NetRPacket_0x272a_Fixed; + static const uint16_t PACKET_ID = 0x272a; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; +}; +struct SPacket_0x2730_Fixed +{ + using NetType = NetSPacket_0x2730_Fixed; + static const uint16_t PACKET_ID = 0x2730; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; +}; +struct SPacket_0x2731_Fixed +{ + using NetType = NetSPacket_0x2731_Fixed; + static const uint16_t PACKET_ID = 0x2731; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + uint8_t ban_not_status = {}; + TimeT status_or_ban_until = {}; +}; +struct SPacket_0x2732_Head +{ + using NetType = NetSPacket_0x2732_Head; + static const uint16_t PACKET_ID = 0x2732; + + uint16_t magic_packet_id = PACKET_ID; + uint16_t magic_packet_length = {}; }; -struct NetRPacket0x2712_Fixed +struct SPacket_0x2732_Repeat { - Little16 packet_id; + using NetType = NetSPacket_0x2732_Repeat; + static const uint16_t PACKET_ID = 0x2732; + + AccountId account_id = {}; + GmLevel gm_level = {}; +}; +struct RPacket_0x2740_Fixed +{ + using NetType = NetRPacket_0x2740_Fixed; + static const uint16_t PACKET_ID = 0x2740; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + AccountPass old_pass = {}; + AccountPass new_pass = {}; +}; +struct SPacket_0x2741_Fixed +{ + using NetType = NetSPacket_0x2741_Fixed; + static const uint16_t PACKET_ID = 0x2741; + + uint16_t magic_packet_id = PACKET_ID; + AccountId account_id = {}; + uint8_t status = {}; +}; + +struct NetRPacket_0x2709_Fixed +{ + Little16 magic_packet_id; +}; +static_assert(offsetof(NetRPacket_0x2709_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2709_Fixed, magic_packet_id) == 0"); +static_assert(sizeof(NetRPacket_0x2709_Fixed) == 2, "sizeof(NetRPacket_0x2709_Fixed) == 2"); +struct NetRPacket_0x2712_Fixed +{ + Little16 magic_packet_id; Little32 account_id; Little32 login_id1; Little32 login_id2; Byte sex; IP4Address ip; }; -static_assert(offsetof(NetRPacket0x2712_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2712_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2712_Fixed, account_id) == 2, "offsetof(NetRPacket0x2712_Fixed, account_id) == 2"); -static_assert(offsetof(NetRPacket0x2712_Fixed, login_id1) == 6, "offsetof(NetRPacket0x2712_Fixed, login_id1) == 6"); -static_assert(offsetof(NetRPacket0x2712_Fixed, login_id2) == 10, "offsetof(NetRPacket0x2712_Fixed, login_id2) == 10"); -static_assert(offsetof(NetRPacket0x2712_Fixed, sex) == 14, "offsetof(NetRPacket0x2712_Fixed, sex) == 14"); -static_assert(offsetof(NetRPacket0x2712_Fixed, ip) == 15, "offsetof(NetRPacket0x2712_Fixed, ip) == 15"); -static_assert(sizeof(NetRPacket0x2712_Fixed) == 19, "sizeof(NetRPacket0x2712_Fixed) == 19"); +static_assert(offsetof(NetRPacket_0x2712_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2712_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2712_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2712_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket_0x2712_Fixed, login_id1) == 6, "offsetof(NetRPacket_0x2712_Fixed, login_id1) == 6"); +static_assert(offsetof(NetRPacket_0x2712_Fixed, login_id2) == 10, "offsetof(NetRPacket_0x2712_Fixed, login_id2) == 10"); +static_assert(offsetof(NetRPacket_0x2712_Fixed, sex) == 14, "offsetof(NetRPacket_0x2712_Fixed, sex) == 14"); +static_assert(offsetof(NetRPacket_0x2712_Fixed, ip) == 15, "offsetof(NetRPacket_0x2712_Fixed, ip) == 15"); +static_assert(sizeof(NetRPacket_0x2712_Fixed) == 19, "sizeof(NetRPacket_0x2712_Fixed) == 19"); +struct NetSPacket_0x2713_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + Byte invalid; + NetString email; + Little32 connect_until; +}; +static_assert(offsetof(NetSPacket_0x2713_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2713_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2713_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2713_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x2713_Fixed, invalid) == 6, "offsetof(NetSPacket_0x2713_Fixed, invalid) == 6"); +static_assert(offsetof(NetSPacket_0x2713_Fixed, email) == 7, "offsetof(NetSPacket_0x2713_Fixed, email) == 7"); +static_assert(offsetof(NetSPacket_0x2713_Fixed, connect_until) == 47, "offsetof(NetSPacket_0x2713_Fixed, connect_until) == 47"); +static_assert(sizeof(NetSPacket_0x2713_Fixed) == 51, "sizeof(NetSPacket_0x2713_Fixed) == 51"); +struct NetRPacket_0x2714_Fixed +{ + Little16 magic_packet_id; + Little32 users; +}; +static_assert(offsetof(NetRPacket_0x2714_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2714_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2714_Fixed, users) == 2, "offsetof(NetRPacket_0x2714_Fixed, users) == 2"); +static_assert(sizeof(NetRPacket_0x2714_Fixed) == 6, "sizeof(NetRPacket_0x2714_Fixed) == 6"); +struct NetRPacket_0x2715_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString email; +}; +static_assert(offsetof(NetRPacket_0x2715_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2715_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2715_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2715_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket_0x2715_Fixed, email) == 6, "offsetof(NetRPacket_0x2715_Fixed, email) == 6"); +static_assert(sizeof(NetRPacket_0x2715_Fixed) == 46, "sizeof(NetRPacket_0x2715_Fixed) == 46"); +struct NetRPacket_0x2716_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x2716_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2716_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2716_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2716_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket_0x2716_Fixed) == 6, "sizeof(NetRPacket_0x2716_Fixed) == 6"); +struct NetSPacket_0x2717_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString email; + Little32 connect_until; +}; +static_assert(offsetof(NetSPacket_0x2717_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2717_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2717_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2717_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x2717_Fixed, email) == 6, "offsetof(NetSPacket_0x2717_Fixed, email) == 6"); +static_assert(offsetof(NetSPacket_0x2717_Fixed, connect_until) == 46, "offsetof(NetSPacket_0x2717_Fixed, connect_until) == 46"); +static_assert(sizeof(NetSPacket_0x2717_Fixed) == 50, "sizeof(NetSPacket_0x2717_Fixed) == 50"); +struct NetRPacket_0x2720_Head +{ + Little16 magic_packet_id; + Little16 magic_packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x2720_Head, magic_packet_id) == 0, "offsetof(NetRPacket_0x2720_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2720_Head, magic_packet_length) == 2, "offsetof(NetRPacket_0x2720_Head, magic_packet_length) == 2"); +static_assert(offsetof(NetRPacket_0x2720_Head, account_id) == 4, "offsetof(NetRPacket_0x2720_Head, account_id) == 4"); +static_assert(sizeof(NetRPacket_0x2720_Head) == 8, "sizeof(NetRPacket_0x2720_Head) == 8"); +struct NetRPacket_0x2720_Repeat +{ + Byte c; +}; +static_assert(offsetof(NetRPacket_0x2720_Repeat, c) == 0, "offsetof(NetRPacket_0x2720_Repeat, c) == 0"); +static_assert(sizeof(NetRPacket_0x2720_Repeat) == 1, "sizeof(NetRPacket_0x2720_Repeat) == 1"); +struct NetSPacket_0x2721_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + Little32 gm_level; +}; +static_assert(offsetof(NetSPacket_0x2721_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2721_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2721_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2721_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x2721_Fixed, gm_level) == 6, "offsetof(NetSPacket_0x2721_Fixed, gm_level) == 6"); +static_assert(sizeof(NetSPacket_0x2721_Fixed) == 10, "sizeof(NetSPacket_0x2721_Fixed) == 10"); +struct NetRPacket_0x2722_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString old_email; + NetString new_email; +}; +static_assert(offsetof(NetRPacket_0x2722_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2722_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2722_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2722_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket_0x2722_Fixed, old_email) == 6, "offsetof(NetRPacket_0x2722_Fixed, old_email) == 6"); +static_assert(offsetof(NetRPacket_0x2722_Fixed, new_email) == 46, "offsetof(NetRPacket_0x2722_Fixed, new_email) == 46"); +static_assert(sizeof(NetRPacket_0x2722_Fixed) == 86, "sizeof(NetRPacket_0x2722_Fixed) == 86"); +struct NetSPacket_0x2723_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + Byte sex; +}; +static_assert(offsetof(NetSPacket_0x2723_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2723_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2723_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2723_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x2723_Fixed, sex) == 6, "offsetof(NetSPacket_0x2723_Fixed, sex) == 6"); +static_assert(sizeof(NetSPacket_0x2723_Fixed) == 7, "sizeof(NetSPacket_0x2723_Fixed) == 7"); +struct NetRPacket_0x2724_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + Little32 status; +}; +static_assert(offsetof(NetRPacket_0x2724_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2724_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2724_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2724_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket_0x2724_Fixed, status) == 6, "offsetof(NetRPacket_0x2724_Fixed, status) == 6"); +static_assert(sizeof(NetRPacket_0x2724_Fixed) == 10, "sizeof(NetRPacket_0x2724_Fixed) == 10"); +struct NetRPacket_0x2725_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetHumanTimeDiff deltas; +}; +static_assert(offsetof(NetRPacket_0x2725_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2725_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2725_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2725_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket_0x2725_Fixed, deltas) == 6, "offsetof(NetRPacket_0x2725_Fixed, deltas) == 6"); +static_assert(sizeof(NetRPacket_0x2725_Fixed) == 18, "sizeof(NetRPacket_0x2725_Fixed) == 18"); +struct NetRPacket_0x2727_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x2727_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2727_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2727_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2727_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket_0x2727_Fixed) == 6, "sizeof(NetRPacket_0x2727_Fixed) == 6"); +struct NetRPacket_0x2728_Head +{ + Little16 magic_packet_id; + Little16 magic_packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x2728_Head, magic_packet_id) == 0, "offsetof(NetRPacket_0x2728_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2728_Head, magic_packet_length) == 2, "offsetof(NetRPacket_0x2728_Head, magic_packet_length) == 2"); +static_assert(offsetof(NetRPacket_0x2728_Head, account_id) == 4, "offsetof(NetRPacket_0x2728_Head, account_id) == 4"); +static_assert(sizeof(NetRPacket_0x2728_Head) == 8, "sizeof(NetRPacket_0x2728_Head) == 8"); +struct NetRPacket_0x2728_Repeat +{ + NetString name; + Little32 value; +}; +static_assert(offsetof(NetRPacket_0x2728_Repeat, name) == 0, "offsetof(NetRPacket_0x2728_Repeat, name) == 0"); +static_assert(offsetof(NetRPacket_0x2728_Repeat, value) == 32, "offsetof(NetRPacket_0x2728_Repeat, value) == 32"); +static_assert(sizeof(NetRPacket_0x2728_Repeat) == 36, "sizeof(NetRPacket_0x2728_Repeat) == 36"); +struct NetSPacket_0x2729_Head +{ + Little16 magic_packet_id; + Little16 magic_packet_length; + Little32 account_id; +}; +static_assert(offsetof(NetSPacket_0x2729_Head, magic_packet_id) == 0, "offsetof(NetSPacket_0x2729_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2729_Head, magic_packet_length) == 2, "offsetof(NetSPacket_0x2729_Head, magic_packet_length) == 2"); +static_assert(offsetof(NetSPacket_0x2729_Head, account_id) == 4, "offsetof(NetSPacket_0x2729_Head, account_id) == 4"); +static_assert(sizeof(NetSPacket_0x2729_Head) == 8, "sizeof(NetSPacket_0x2729_Head) == 8"); +struct NetSPacket_0x2729_Repeat +{ + NetString name; + Little32 value; +}; +static_assert(offsetof(NetSPacket_0x2729_Repeat, name) == 0, "offsetof(NetSPacket_0x2729_Repeat, name) == 0"); +static_assert(offsetof(NetSPacket_0x2729_Repeat, value) == 32, "offsetof(NetSPacket_0x2729_Repeat, value) == 32"); +static_assert(sizeof(NetSPacket_0x2729_Repeat) == 36, "sizeof(NetSPacket_0x2729_Repeat) == 36"); +struct NetRPacket_0x272a_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetRPacket_0x272a_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x272a_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x272a_Fixed, account_id) == 2, "offsetof(NetRPacket_0x272a_Fixed, account_id) == 2"); +static_assert(sizeof(NetRPacket_0x272a_Fixed) == 6, "sizeof(NetRPacket_0x272a_Fixed) == 6"); +struct NetSPacket_0x2730_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; +}; +static_assert(offsetof(NetSPacket_0x2730_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2730_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2730_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2730_Fixed, account_id) == 2"); +static_assert(sizeof(NetSPacket_0x2730_Fixed) == 6, "sizeof(NetSPacket_0x2730_Fixed) == 6"); +struct NetSPacket_0x2731_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + Byte ban_not_status; + Little32 status_or_ban_until; +}; +static_assert(offsetof(NetSPacket_0x2731_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2731_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2731_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2731_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x2731_Fixed, ban_not_status) == 6, "offsetof(NetSPacket_0x2731_Fixed, ban_not_status) == 6"); +static_assert(offsetof(NetSPacket_0x2731_Fixed, status_or_ban_until) == 7, "offsetof(NetSPacket_0x2731_Fixed, status_or_ban_until) == 7"); +static_assert(sizeof(NetSPacket_0x2731_Fixed) == 11, "sizeof(NetSPacket_0x2731_Fixed) == 11"); +struct NetSPacket_0x2732_Head +{ + Little16 magic_packet_id; + Little16 magic_packet_length; +}; +static_assert(offsetof(NetSPacket_0x2732_Head, magic_packet_id) == 0, "offsetof(NetSPacket_0x2732_Head, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2732_Head, magic_packet_length) == 2, "offsetof(NetSPacket_0x2732_Head, magic_packet_length) == 2"); +static_assert(sizeof(NetSPacket_0x2732_Head) == 4, "sizeof(NetSPacket_0x2732_Head) == 4"); +struct NetSPacket_0x2732_Repeat +{ + Little32 account_id; + Byte gm_level; +}; +static_assert(offsetof(NetSPacket_0x2732_Repeat, account_id) == 0, "offsetof(NetSPacket_0x2732_Repeat, account_id) == 0"); +static_assert(offsetof(NetSPacket_0x2732_Repeat, gm_level) == 4, "offsetof(NetSPacket_0x2732_Repeat, gm_level) == 4"); +static_assert(sizeof(NetSPacket_0x2732_Repeat) == 5, "sizeof(NetSPacket_0x2732_Repeat) == 5"); +struct NetRPacket_0x2740_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + NetString old_pass; + NetString new_pass; +}; +static_assert(offsetof(NetRPacket_0x2740_Fixed, magic_packet_id) == 0, "offsetof(NetRPacket_0x2740_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetRPacket_0x2740_Fixed, account_id) == 2, "offsetof(NetRPacket_0x2740_Fixed, account_id) == 2"); +static_assert(offsetof(NetRPacket_0x2740_Fixed, old_pass) == 6, "offsetof(NetRPacket_0x2740_Fixed, old_pass) == 6"); +static_assert(offsetof(NetRPacket_0x2740_Fixed, new_pass) == 30, "offsetof(NetRPacket_0x2740_Fixed, new_pass) == 30"); +static_assert(sizeof(NetRPacket_0x2740_Fixed) == 54, "sizeof(NetRPacket_0x2740_Fixed) == 54"); +struct NetSPacket_0x2741_Fixed +{ + Little16 magic_packet_id; + Little32 account_id; + Byte status; +}; +static_assert(offsetof(NetSPacket_0x2741_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x2741_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x2741_Fixed, account_id) == 2, "offsetof(NetSPacket_0x2741_Fixed, account_id) == 2"); +static_assert(offsetof(NetSPacket_0x2741_Fixed, status) == 6, "offsetof(NetSPacket_0x2741_Fixed, status) == 6"); +static_assert(sizeof(NetSPacket_0x2741_Fixed) == 7, "sizeof(NetSPacket_0x2741_Fixed) == 7"); + +inline __attribute__((warn_unused_result)) +bool native_to_network(NetRPacket_0x2709_Fixed *network, RPacket_0x2709_Fixed native) +{ + bool rv = true; + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(RPacket_0x2709_Fixed *native, NetRPacket_0x2709_Fixed network) +{ + bool rv = true; + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + return rv; +} inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2712_Fixed *network, RPacket0x2712_Fixed native) +bool native_to_network(NetRPacket_0x2712_Fixed *network, RPacket_0x2712_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->login_id1, native.login_id1); rv &= native_to_network(&network->login_id2, native.login_id2); @@ -90,10 +538,10 @@ bool native_to_network(NetRPacket0x2712_Fixed *network, RPacket0x2712_Fixed nati return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2712_Fixed *native, NetRPacket0x2712_Fixed network) +bool network_to_native(RPacket_0x2712_Fixed *native, NetRPacket_0x2712_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->login_id1, network.login_id1); rv &= network_to_native(&native->login_id2, network.login_id2); @@ -101,34 +549,11 @@ bool network_to_native(RPacket0x2712_Fixed *native, NetRPacket0x2712_Fixed netwo rv &= network_to_native(&native->ip, network.ip); return rv; } - -struct SPacket0x2713_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - uint8_t invalid; - AccountEmail email; - TimeT connect_until; -}; -struct NetSPacket0x2713_Fixed -{ - Little16 packet_id; - Little32 account_id; - Byte invalid; - NetString email; - Little32 connect_until; -}; -static_assert(offsetof(NetSPacket0x2713_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2713_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2713_Fixed, account_id) == 2, "offsetof(NetSPacket0x2713_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x2713_Fixed, invalid) == 6, "offsetof(NetSPacket0x2713_Fixed, invalid) == 6"); -static_assert(offsetof(NetSPacket0x2713_Fixed, email) == 7, "offsetof(NetSPacket0x2713_Fixed, email) == 7"); -static_assert(offsetof(NetSPacket0x2713_Fixed, connect_until) == 47, "offsetof(NetSPacket0x2713_Fixed, connect_until) == 47"); -static_assert(sizeof(NetSPacket0x2713_Fixed) == 51, "sizeof(NetSPacket0x2713_Fixed) == 51"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2713_Fixed *network, SPacket0x2713_Fixed native) +bool native_to_network(NetSPacket_0x2713_Fixed *network, SPacket_0x2713_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->invalid, native.invalid); rv &= native_to_network(&network->email, native.email); @@ -136,497 +561,246 @@ bool native_to_network(NetSPacket0x2713_Fixed *network, SPacket0x2713_Fixed nati return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2713_Fixed *native, NetSPacket0x2713_Fixed network) +bool network_to_native(SPacket_0x2713_Fixed *native, NetSPacket_0x2713_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->invalid, network.invalid); rv &= network_to_native(&native->email, network.email); rv &= network_to_native(&native->connect_until, network.connect_until); return rv; } - -struct RPacket0x2714_Fixed -{ - uint16_t packet_id; - uint32_t users; -}; -struct NetRPacket0x2714_Fixed -{ - Little16 packet_id; - Little32 users; -}; -static_assert(offsetof(NetRPacket0x2714_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2714_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2714_Fixed, users) == 2, "offsetof(NetRPacket0x2714_Fixed, users) == 2"); -static_assert(sizeof(NetRPacket0x2714_Fixed) == 6, "sizeof(NetRPacket0x2714_Fixed) == 6"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2714_Fixed *network, RPacket0x2714_Fixed native) +bool native_to_network(NetRPacket_0x2714_Fixed *network, RPacket_0x2714_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->users, native.users); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2714_Fixed *native, NetRPacket0x2714_Fixed network) +bool network_to_native(RPacket_0x2714_Fixed *native, NetRPacket_0x2714_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->users, network.users); return rv; } - -struct RPacket0x2715_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountEmail email; -}; -struct NetRPacket0x2715_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString email; -}; -static_assert(offsetof(NetRPacket0x2715_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2715_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2715_Fixed, account_id) == 2, "offsetof(NetRPacket0x2715_Fixed, account_id) == 2"); -static_assert(offsetof(NetRPacket0x2715_Fixed, email) == 6, "offsetof(NetRPacket0x2715_Fixed, email) == 6"); -static_assert(sizeof(NetRPacket0x2715_Fixed) == 46, "sizeof(NetRPacket0x2715_Fixed) == 46"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2715_Fixed *network, RPacket0x2715_Fixed native) +bool native_to_network(NetRPacket_0x2715_Fixed *network, RPacket_0x2715_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->email, native.email); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2715_Fixed *native, NetRPacket0x2715_Fixed network) +bool network_to_native(RPacket_0x2715_Fixed *native, NetRPacket_0x2715_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->email, network.email); return rv; } - -struct RPacket0x2716_Fixed -{ - uint16_t packet_id; - uint32_t account_id; -}; -struct NetRPacket0x2716_Fixed -{ - Little16 packet_id; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x2716_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2716_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2716_Fixed, account_id) == 2, "offsetof(NetRPacket0x2716_Fixed, account_id) == 2"); -static_assert(sizeof(NetRPacket0x2716_Fixed) == 6, "sizeof(NetRPacket0x2716_Fixed) == 6"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2716_Fixed *network, RPacket0x2716_Fixed native) +bool native_to_network(NetRPacket_0x2716_Fixed *network, RPacket_0x2716_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2716_Fixed *native, NetRPacket0x2716_Fixed network) +bool network_to_native(RPacket_0x2716_Fixed *native, NetRPacket_0x2716_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); return rv; } - -struct SPacket0x2717_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountEmail email; - TimeT connect_until; -}; -struct NetSPacket0x2717_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString email; - Little32 connect_until; -}; -static_assert(offsetof(NetSPacket0x2717_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2717_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2717_Fixed, account_id) == 2, "offsetof(NetSPacket0x2717_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x2717_Fixed, email) == 6, "offsetof(NetSPacket0x2717_Fixed, email) == 6"); -static_assert(offsetof(NetSPacket0x2717_Fixed, connect_until) == 46, "offsetof(NetSPacket0x2717_Fixed, connect_until) == 46"); -static_assert(sizeof(NetSPacket0x2717_Fixed) == 50, "sizeof(NetSPacket0x2717_Fixed) == 50"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2717_Fixed *network, SPacket0x2717_Fixed native) +bool native_to_network(NetSPacket_0x2717_Fixed *network, SPacket_0x2717_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->email, native.email); rv &= native_to_network(&network->connect_until, native.connect_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2717_Fixed *native, NetSPacket0x2717_Fixed network) +bool network_to_native(SPacket_0x2717_Fixed *native, NetSPacket_0x2717_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->email, network.email); rv &= network_to_native(&native->connect_until, network.connect_until); return rv; } - -struct RPacket0x2720_Head -{ - uint16_t packet_id; - uint16_t packet_length; - uint32_t account_id; -}; -struct NetRPacket0x2720_Head -{ - Little16 packet_id; - Little16 packet_length; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x2720_Head, packet_id) == 0, "offsetof(NetRPacket0x2720_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2720_Head, packet_length) == 2, "offsetof(NetRPacket0x2720_Head, packet_length) == 2"); -static_assert(offsetof(NetRPacket0x2720_Head, account_id) == 4, "offsetof(NetRPacket0x2720_Head, account_id) == 4"); -static_assert(sizeof(NetRPacket0x2720_Head) == 8, "sizeof(NetRPacket0x2720_Head) == 8"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2720_Head *network, RPacket0x2720_Head native) +bool native_to_network(NetRPacket_0x2720_Head *network, RPacket_0x2720_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->packet_length, native.packet_length); + 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->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2720_Head *native, NetRPacket0x2720_Head network) +bool network_to_native(RPacket_0x2720_Head *native, NetRPacket_0x2720_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->packet_length, network.packet_length); + 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->account_id, network.account_id); return rv; } - -struct RPacket0x2720_Repeat -{ - uint8_t c; -}; -struct NetRPacket0x2720_Repeat -{ - Byte c; -}; -static_assert(offsetof(NetRPacket0x2720_Repeat, c) == 0, "offsetof(NetRPacket0x2720_Repeat, c) == 0"); -static_assert(sizeof(NetRPacket0x2720_Repeat) == 1, "sizeof(NetRPacket0x2720_Repeat) == 1"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2720_Repeat *network, RPacket0x2720_Repeat native) +bool native_to_network(NetRPacket_0x2720_Repeat *network, RPacket_0x2720_Repeat native) { bool rv = true; rv &= native_to_network(&network->c, native.c); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2720_Repeat *native, NetRPacket0x2720_Repeat network) +bool network_to_native(RPacket_0x2720_Repeat *native, NetRPacket_0x2720_Repeat network) { bool rv = true; rv &= network_to_native(&native->c, network.c); return rv; } - -struct SPacket0x2721_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - GmLevel gm_level; -}; -struct NetSPacket0x2721_Fixed -{ - Little16 packet_id; - Little32 account_id; - Little32 gm_level; -}; -static_assert(offsetof(NetSPacket0x2721_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2721_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2721_Fixed, account_id) == 2, "offsetof(NetSPacket0x2721_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x2721_Fixed, gm_level) == 6, "offsetof(NetSPacket0x2721_Fixed, gm_level) == 6"); -static_assert(sizeof(NetSPacket0x2721_Fixed) == 10, "sizeof(NetSPacket0x2721_Fixed) == 10"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2721_Fixed *network, SPacket0x2721_Fixed native) +bool native_to_network(NetSPacket_0x2721_Fixed *network, SPacket_0x2721_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->gm_level, native.gm_level); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2721_Fixed *native, NetSPacket0x2721_Fixed network) +bool network_to_native(SPacket_0x2721_Fixed *native, NetSPacket_0x2721_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->gm_level, network.gm_level); return rv; } - -struct RPacket0x2722_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountEmail old_email; - AccountEmail new_email; -}; -struct NetRPacket0x2722_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString old_email; - NetString new_email; -}; -static_assert(offsetof(NetRPacket0x2722_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2722_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2722_Fixed, account_id) == 2, "offsetof(NetRPacket0x2722_Fixed, account_id) == 2"); -static_assert(offsetof(NetRPacket0x2722_Fixed, old_email) == 6, "offsetof(NetRPacket0x2722_Fixed, old_email) == 6"); -static_assert(offsetof(NetRPacket0x2722_Fixed, new_email) == 46, "offsetof(NetRPacket0x2722_Fixed, new_email) == 46"); -static_assert(sizeof(NetRPacket0x2722_Fixed) == 86, "sizeof(NetRPacket0x2722_Fixed) == 86"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2722_Fixed *network, RPacket0x2722_Fixed native) +bool native_to_network(NetRPacket_0x2722_Fixed *network, RPacket_0x2722_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->old_email, native.old_email); rv &= native_to_network(&network->new_email, native.new_email); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2722_Fixed *native, NetRPacket0x2722_Fixed network) +bool network_to_native(RPacket_0x2722_Fixed *native, NetRPacket_0x2722_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->old_email, network.old_email); rv &= network_to_native(&native->new_email, network.new_email); return rv; } - -struct SPacket0x2723_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - SEX sex; -}; -struct NetSPacket0x2723_Fixed -{ - Little16 packet_id; - Little32 account_id; - Byte sex; -}; -static_assert(offsetof(NetSPacket0x2723_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2723_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2723_Fixed, account_id) == 2, "offsetof(NetSPacket0x2723_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x2723_Fixed, sex) == 6, "offsetof(NetSPacket0x2723_Fixed, sex) == 6"); -static_assert(sizeof(NetSPacket0x2723_Fixed) == 7, "sizeof(NetSPacket0x2723_Fixed) == 7"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2723_Fixed *network, SPacket0x2723_Fixed native) +bool native_to_network(NetSPacket_0x2723_Fixed *network, SPacket_0x2723_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->sex, native.sex); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2723_Fixed *native, NetSPacket0x2723_Fixed network) +bool network_to_native(SPacket_0x2723_Fixed *native, NetSPacket_0x2723_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->sex, network.sex); return rv; } - -struct RPacket0x2724_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - uint32_t status; -}; -struct NetRPacket0x2724_Fixed -{ - Little16 packet_id; - Little32 account_id; - Little32 status; -}; -static_assert(offsetof(NetRPacket0x2724_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2724_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2724_Fixed, account_id) == 2, "offsetof(NetRPacket0x2724_Fixed, account_id) == 2"); -static_assert(offsetof(NetRPacket0x2724_Fixed, status) == 6, "offsetof(NetRPacket0x2724_Fixed, status) == 6"); -static_assert(sizeof(NetRPacket0x2724_Fixed) == 10, "sizeof(NetRPacket0x2724_Fixed) == 10"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2724_Fixed *network, RPacket0x2724_Fixed native) +bool native_to_network(NetRPacket_0x2724_Fixed *network, RPacket_0x2724_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->status, native.status); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2724_Fixed *native, NetRPacket0x2724_Fixed network) +bool network_to_native(RPacket_0x2724_Fixed *native, NetRPacket_0x2724_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->status, network.status); return rv; } - -struct RPacket0x2725_Head -{ - uint16_t packet_id; - uint32_t account_id; - HumanTimeDiff deltas; -}; -struct NetRPacket0x2725_Head -{ - Little16 packet_id; - Little32 account_id; - NetHumanTimeDiff deltas; -}; -static_assert(offsetof(NetRPacket0x2725_Head, packet_id) == 0, "offsetof(NetRPacket0x2725_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2725_Head, account_id) == 2, "offsetof(NetRPacket0x2725_Head, account_id) == 2"); -static_assert(offsetof(NetRPacket0x2725_Head, deltas) == 6, "offsetof(NetRPacket0x2725_Head, deltas) == 6"); -static_assert(sizeof(NetRPacket0x2725_Head) == 18, "sizeof(NetRPacket0x2725_Head) == 18"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2725_Head *network, RPacket0x2725_Head native) +bool native_to_network(NetRPacket_0x2725_Fixed *network, RPacket_0x2725_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->deltas, native.deltas); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2725_Head *native, NetRPacket0x2725_Head network) +bool network_to_native(RPacket_0x2725_Fixed *native, NetRPacket_0x2725_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->deltas, network.deltas); return rv; } - -struct RPacket0x2725_Repeat -{ - uint8_t c; -}; -struct NetRPacket0x2725_Repeat -{ - Byte c; -}; -static_assert(offsetof(NetRPacket0x2725_Repeat, c) == 0, "offsetof(NetRPacket0x2725_Repeat, c) == 0"); -static_assert(sizeof(NetRPacket0x2725_Repeat) == 1, "sizeof(NetRPacket0x2725_Repeat) == 1"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2725_Repeat *network, RPacket0x2725_Repeat native) +bool native_to_network(NetRPacket_0x2727_Fixed *network, RPacket_0x2727_Fixed native) { bool rv = true; - rv &= native_to_network(&network->c, native.c); - return rv; -} -inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2725_Repeat *native, NetRPacket0x2725_Repeat network) -{ - bool rv = true; - rv &= network_to_native(&native->c, network.c); - return rv; -} - -struct RPacket0x2727_Fixed -{ - uint16_t packet_id; - uint32_t account_id; -}; -struct NetRPacket0x2727_Fixed -{ - Little16 packet_id; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x2727_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2727_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2727_Fixed, account_id) == 2, "offsetof(NetRPacket0x2727_Fixed, account_id) == 2"); -static_assert(sizeof(NetRPacket0x2727_Fixed) == 6, "sizeof(NetRPacket0x2727_Fixed) == 6"); -inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2727_Fixed *network, RPacket0x2727_Fixed native) -{ - bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2727_Fixed *native, NetRPacket0x2727_Fixed network) +bool network_to_native(RPacket_0x2727_Fixed *native, NetRPacket_0x2727_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); return rv; } - -struct RPacket0x2728_Head -{ - uint16_t packet_id; - uint16_t packet_length; - uint32_t account_id; -}; -struct NetRPacket0x2728_Head -{ - Little16 packet_id; - Little16 packet_length; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x2728_Head, packet_id) == 0, "offsetof(NetRPacket0x2728_Head, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2728_Head, packet_length) == 2, "offsetof(NetRPacket0x2728_Head, packet_length) == 2"); -static_assert(offsetof(NetRPacket0x2728_Head, account_id) == 4, "offsetof(NetRPacket0x2728_Head, account_id) == 4"); -static_assert(sizeof(NetRPacket0x2728_Head) == 8, "sizeof(NetRPacket0x2728_Head) == 8"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2728_Head *network, RPacket0x2728_Head native) +bool native_to_network(NetRPacket_0x2728_Head *network, RPacket_0x2728_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->packet_length, native.packet_length); + 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->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2728_Head *native, NetRPacket0x2728_Head network) +bool network_to_native(RPacket_0x2728_Head *native, NetRPacket_0x2728_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->packet_length, network.packet_length); + 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->account_id, network.account_id); return rv; } - -struct RPacket0x2728_Repeat -{ - VarName name; - uint32_t value; -}; -struct NetRPacket0x2728_Repeat -{ - NetString name; - Little32 value; -}; -static_assert(offsetof(NetRPacket0x2728_Repeat, name) == 0, "offsetof(NetRPacket0x2728_Repeat, name) == 0"); -static_assert(offsetof(NetRPacket0x2728_Repeat, value) == 32, "offsetof(NetRPacket0x2728_Repeat, value) == 32"); -static_assert(sizeof(NetRPacket0x2728_Repeat) == 36, "sizeof(NetRPacket0x2728_Repeat) == 36"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2728_Repeat *network, RPacket0x2728_Repeat native) +bool native_to_network(NetRPacket_0x2728_Repeat *network, RPacket_0x2728_Repeat native) { bool rv = true; rv &= native_to_network(&network->name, native.name); @@ -634,64 +808,33 @@ bool native_to_network(NetRPacket0x2728_Repeat *network, RPacket0x2728_Repeat na return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2728_Repeat *native, NetRPacket0x2728_Repeat network) +bool network_to_native(RPacket_0x2728_Repeat *native, NetRPacket_0x2728_Repeat network) { bool rv = true; rv &= network_to_native(&native->name, network.name); rv &= network_to_native(&native->value, network.value); return rv; } - -struct SPacket0x2729_Head -{ - uint16_t packet_id; - uint16_t packet_length; - uint32_t account_id; -}; -struct NetSPacket0x2729_Head -{ - Little16 packet_id; - Little16 packet_length; - Little32 account_id; -}; -static_assert(offsetof(NetSPacket0x2729_Head, packet_id) == 0, "offsetof(NetSPacket0x2729_Head, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2729_Head, packet_length) == 2, "offsetof(NetSPacket0x2729_Head, packet_length) == 2"); -static_assert(offsetof(NetSPacket0x2729_Head, account_id) == 4, "offsetof(NetSPacket0x2729_Head, account_id) == 4"); -static_assert(sizeof(NetSPacket0x2729_Head) == 8, "sizeof(NetSPacket0x2729_Head) == 8"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2729_Head *network, SPacket0x2729_Head native) +bool native_to_network(NetSPacket_0x2729_Head *network, SPacket_0x2729_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->packet_length, native.packet_length); + 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->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2729_Head *native, NetSPacket0x2729_Head network) +bool network_to_native(SPacket_0x2729_Head *native, NetSPacket_0x2729_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->packet_length, network.packet_length); + 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->account_id, network.account_id); return rv; } - -struct SPacket0x2729_Repeat -{ - VarName name; - uint32_t value; -}; -struct NetSPacket0x2729_Repeat -{ - NetString name; - Little32 value; -}; -static_assert(offsetof(NetSPacket0x2729_Repeat, name) == 0, "offsetof(NetSPacket0x2729_Repeat, name) == 0"); -static_assert(offsetof(NetSPacket0x2729_Repeat, value) == 32, "offsetof(NetSPacket0x2729_Repeat, value) == 32"); -static_assert(sizeof(NetSPacket0x2729_Repeat) == 36, "sizeof(NetSPacket0x2729_Repeat) == 36"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2729_Repeat *network, SPacket0x2729_Repeat native) +bool native_to_network(NetSPacket_0x2729_Repeat *network, SPacket_0x2729_Repeat native) { bool rv = true; rv &= native_to_network(&network->name, native.name); @@ -699,154 +842,83 @@ bool native_to_network(NetSPacket0x2729_Repeat *network, SPacket0x2729_Repeat na return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2729_Repeat *native, NetSPacket0x2729_Repeat network) +bool network_to_native(SPacket_0x2729_Repeat *native, NetSPacket_0x2729_Repeat network) { bool rv = true; rv &= network_to_native(&native->name, network.name); rv &= network_to_native(&native->value, network.value); return rv; } - -struct RPacket0x272a_Fixed -{ - uint16_t packet_id; - uint32_t account_id; -}; -struct NetRPacket0x272a_Fixed -{ - Little16 packet_id; - Little32 account_id; -}; -static_assert(offsetof(NetRPacket0x272a_Fixed, packet_id) == 0, "offsetof(NetRPacket0x272a_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x272a_Fixed, account_id) == 2, "offsetof(NetRPacket0x272a_Fixed, account_id) == 2"); -static_assert(sizeof(NetRPacket0x272a_Fixed) == 6, "sizeof(NetRPacket0x272a_Fixed) == 6"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x272a_Fixed *network, RPacket0x272a_Fixed native) +bool native_to_network(NetRPacket_0x272a_Fixed *network, RPacket_0x272a_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x272a_Fixed *native, NetRPacket0x272a_Fixed network) +bool network_to_native(RPacket_0x272a_Fixed *native, NetRPacket_0x272a_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); return rv; } - -struct SPacket0x2730_Fixed -{ - uint16_t packet_id; -}; -struct NetSPacket0x2730_Fixed -{ - Little16 packet_id; -}; -static_assert(offsetof(NetSPacket0x2730_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2730_Fixed, packet_id) == 0"); -static_assert(sizeof(NetSPacket0x2730_Fixed) == 2, "sizeof(NetSPacket0x2730_Fixed) == 2"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2730_Fixed *network, SPacket0x2730_Fixed native) +bool native_to_network(NetSPacket_0x2730_Fixed *network, SPacket_0x2730_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); + rv &= native_to_network(&network->account_id, native.account_id); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2730_Fixed *native, NetSPacket0x2730_Fixed network) +bool network_to_native(SPacket_0x2730_Fixed *native, NetSPacket_0x2730_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); + rv &= network_to_native(&native->account_id, network.account_id); return rv; } - -struct SPacket0x2731_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - uint8_t ban_not_status; - TimeT status_or_ban_until; -}; -struct NetSPacket0x2731_Fixed -{ - Little16 packet_id; - Little32 account_id; - Byte ban_not_status; - Little32 status_or_ban_until; -}; -static_assert(offsetof(NetSPacket0x2731_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2731_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2731_Fixed, account_id) == 2, "offsetof(NetSPacket0x2731_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x2731_Fixed, ban_not_status) == 6, "offsetof(NetSPacket0x2731_Fixed, ban_not_status) == 6"); -static_assert(offsetof(NetSPacket0x2731_Fixed, status_or_ban_until) == 7, "offsetof(NetSPacket0x2731_Fixed, status_or_ban_until) == 7"); -static_assert(sizeof(NetSPacket0x2731_Fixed) == 11, "sizeof(NetSPacket0x2731_Fixed) == 11"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2731_Fixed *network, SPacket0x2731_Fixed native) +bool native_to_network(NetSPacket_0x2731_Fixed *network, SPacket_0x2731_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->ban_not_status, native.ban_not_status); rv &= native_to_network(&network->status_or_ban_until, native.status_or_ban_until); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2731_Fixed *native, NetSPacket0x2731_Fixed network) +bool network_to_native(SPacket_0x2731_Fixed *native, NetSPacket_0x2731_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->ban_not_status, network.ban_not_status); rv &= network_to_native(&native->status_or_ban_until, network.status_or_ban_until); return rv; } - -struct SPacket0x2732_Head -{ - uint16_t packet_id; - uint16_t packet_length; -}; -struct NetSPacket0x2732_Head -{ - Little16 packet_id; - Little16 packet_length; -}; -static_assert(offsetof(NetSPacket0x2732_Head, packet_id) == 0, "offsetof(NetSPacket0x2732_Head, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2732_Head, packet_length) == 2, "offsetof(NetSPacket0x2732_Head, packet_length) == 2"); -static_assert(sizeof(NetSPacket0x2732_Head) == 4, "sizeof(NetSPacket0x2732_Head) == 4"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2732_Head *network, SPacket0x2732_Head native) +bool native_to_network(NetSPacket_0x2732_Head *network, SPacket_0x2732_Head native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); - rv &= native_to_network(&network->packet_length, native.packet_length); + 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(SPacket0x2732_Head *native, NetSPacket0x2732_Head network) +bool network_to_native(SPacket_0x2732_Head *native, NetSPacket_0x2732_Head network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); - rv &= network_to_native(&native->packet_length, network.packet_length); + 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; } - -struct SPacket0x2732_Repeat -{ - uint32_t account_id; - GmLevel gm_level; -}; -struct NetSPacket0x2732_Repeat -{ - Little32 account_id; - Byte gm_level; -}; -static_assert(offsetof(NetSPacket0x2732_Repeat, account_id) == 0, "offsetof(NetSPacket0x2732_Repeat, account_id) == 0"); -static_assert(offsetof(NetSPacket0x2732_Repeat, gm_level) == 4, "offsetof(NetSPacket0x2732_Repeat, gm_level) == 4"); -static_assert(sizeof(NetSPacket0x2732_Repeat) == 5, "sizeof(NetSPacket0x2732_Repeat) == 5"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2732_Repeat *network, SPacket0x2732_Repeat native) +bool native_to_network(NetSPacket_0x2732_Repeat *network, SPacket_0x2732_Repeat native) { bool rv = true; rv &= native_to_network(&network->account_id, native.account_id); @@ -854,88 +926,50 @@ bool native_to_network(NetSPacket0x2732_Repeat *network, SPacket0x2732_Repeat na return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2732_Repeat *native, NetSPacket0x2732_Repeat network) +bool network_to_native(SPacket_0x2732_Repeat *native, NetSPacket_0x2732_Repeat network) { bool rv = true; rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->gm_level, network.gm_level); return rv; } - -struct RPacket0x2740_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - AccountPass old_pass; - AccountPass new_pass; -}; -struct NetRPacket0x2740_Fixed -{ - Little16 packet_id; - Little32 account_id; - NetString old_pass; - NetString new_pass; -}; -static_assert(offsetof(NetRPacket0x2740_Fixed, packet_id) == 0, "offsetof(NetRPacket0x2740_Fixed, packet_id) == 0"); -static_assert(offsetof(NetRPacket0x2740_Fixed, account_id) == 2, "offsetof(NetRPacket0x2740_Fixed, account_id) == 2"); -static_assert(offsetof(NetRPacket0x2740_Fixed, old_pass) == 6, "offsetof(NetRPacket0x2740_Fixed, old_pass) == 6"); -static_assert(offsetof(NetRPacket0x2740_Fixed, new_pass) == 30, "offsetof(NetRPacket0x2740_Fixed, new_pass) == 30"); -static_assert(sizeof(NetRPacket0x2740_Fixed) == 54, "sizeof(NetRPacket0x2740_Fixed) == 54"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetRPacket0x2740_Fixed *network, RPacket0x2740_Fixed native) +bool native_to_network(NetRPacket_0x2740_Fixed *network, RPacket_0x2740_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->old_pass, native.old_pass); rv &= native_to_network(&network->new_pass, native.new_pass); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(RPacket0x2740_Fixed *native, NetRPacket0x2740_Fixed network) +bool network_to_native(RPacket_0x2740_Fixed *native, NetRPacket_0x2740_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->old_pass, network.old_pass); rv &= network_to_native(&native->new_pass, network.new_pass); return rv; } - -struct SPacket0x2741_Fixed -{ - uint16_t packet_id; - uint32_t account_id; - uint8_t status; -}; -struct NetSPacket0x2741_Fixed -{ - Little16 packet_id; - Little32 account_id; - Byte status; -}; -static_assert(offsetof(NetSPacket0x2741_Fixed, packet_id) == 0, "offsetof(NetSPacket0x2741_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x2741_Fixed, account_id) == 2, "offsetof(NetSPacket0x2741_Fixed, account_id) == 2"); -static_assert(offsetof(NetSPacket0x2741_Fixed, status) == 6, "offsetof(NetSPacket0x2741_Fixed, status) == 6"); -static_assert(sizeof(NetSPacket0x2741_Fixed) == 7, "sizeof(NetSPacket0x2741_Fixed) == 7"); inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x2741_Fixed *network, SPacket0x2741_Fixed native) +bool native_to_network(NetSPacket_0x2741_Fixed *network, SPacket_0x2741_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->account_id, native.account_id); rv &= native_to_network(&network->status, native.status); return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x2741_Fixed *native, NetSPacket0x2741_Fixed network) +bool network_to_native(SPacket_0x2741_Fixed *native, NetSPacket_0x2741_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->account_id, network.account_id); rv &= network_to_native(&native->status, network.status); return rv; } - #endif // TMWA_PROTO2_LOGIN_CHAR_HPP diff --git a/src/proto2/login-char_test.cpp b/src/proto2/login-char_test.cpp index 9ae0f5a..ec25fb5 100644 --- a/src/proto2/login-char_test.cpp +++ b/src/proto2/login-char_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/login-user.hpp b/src/proto2/login-user.hpp index 4c71e8a..ee00e9a 100644 --- a/src/proto2/login-user.hpp +++ b/src/proto2/login-user.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -28,4 +28,6 @@ // This is a public protocol, and changes require client cooperation + + #endif // TMWA_PROTO2_LOGIN_USER_HPP diff --git a/src/proto2/login-user_test.cpp b/src/proto2/login-user_test.cpp index 3b623b6..293a458 100644 --- a/src/proto2/login-user_test.cpp +++ b/src/proto2/login-user_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/map-user.hpp b/src/proto2/map-user.hpp index da59c40..90102f7 100644 --- a/src/proto2/map-user.hpp +++ b/src/proto2/map-user.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead @@ -27,36 +27,41 @@ // This is a public protocol, and changes require client cooperation -struct SPacket0x0212_Fixed +struct SPacket_0x0212_Fixed { - uint16_t packet_id; - BlockId npc_id; - uint16_t command; - BlockId id; - uint16_t x; - uint16_t y; + using NetType = NetSPacket_0x0212_Fixed; + static const uint16_t PACKET_ID = 0x0212; + + uint16_t magic_packet_id = PACKET_ID; + BlockId npc_id = {}; + uint16_t command = {}; + BlockId id = {}; + uint16_t x = {}; + uint16_t y = {}; }; -struct NetSPacket0x0212_Fixed + +struct NetSPacket_0x0212_Fixed { - Little16 packet_id; + Little16 magic_packet_id; Little32 npc_id; Little16 command; Little32 id; Little16 x; Little16 y; }; -static_assert(offsetof(NetSPacket0x0212_Fixed, packet_id) == 0, "offsetof(NetSPacket0x0212_Fixed, packet_id) == 0"); -static_assert(offsetof(NetSPacket0x0212_Fixed, npc_id) == 2, "offsetof(NetSPacket0x0212_Fixed, npc_id) == 2"); -static_assert(offsetof(NetSPacket0x0212_Fixed, command) == 6, "offsetof(NetSPacket0x0212_Fixed, command) == 6"); -static_assert(offsetof(NetSPacket0x0212_Fixed, id) == 8, "offsetof(NetSPacket0x0212_Fixed, id) == 8"); -static_assert(offsetof(NetSPacket0x0212_Fixed, x) == 12, "offsetof(NetSPacket0x0212_Fixed, x) == 12"); -static_assert(offsetof(NetSPacket0x0212_Fixed, y) == 14, "offsetof(NetSPacket0x0212_Fixed, y) == 14"); -static_assert(sizeof(NetSPacket0x0212_Fixed) == 16, "sizeof(NetSPacket0x0212_Fixed) == 16"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, magic_packet_id) == 0, "offsetof(NetSPacket_0x0212_Fixed, magic_packet_id) == 0"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, npc_id) == 2, "offsetof(NetSPacket_0x0212_Fixed, npc_id) == 2"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, command) == 6, "offsetof(NetSPacket_0x0212_Fixed, command) == 6"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, id) == 8, "offsetof(NetSPacket_0x0212_Fixed, id) == 8"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, x) == 12, "offsetof(NetSPacket_0x0212_Fixed, x) == 12"); +static_assert(offsetof(NetSPacket_0x0212_Fixed, y) == 14, "offsetof(NetSPacket_0x0212_Fixed, y) == 14"); +static_assert(sizeof(NetSPacket_0x0212_Fixed) == 16, "sizeof(NetSPacket_0x0212_Fixed) == 16"); + inline __attribute__((warn_unused_result)) -bool native_to_network(NetSPacket0x0212_Fixed *network, SPacket0x0212_Fixed native) +bool native_to_network(NetSPacket_0x0212_Fixed *network, SPacket_0x0212_Fixed native) { bool rv = true; - rv &= native_to_network(&network->packet_id, native.packet_id); + rv &= native_to_network(&network->magic_packet_id, native.magic_packet_id); rv &= native_to_network(&network->npc_id, native.npc_id); rv &= native_to_network(&network->command, native.command); rv &= native_to_network(&network->id, native.id); @@ -65,10 +70,10 @@ bool native_to_network(NetSPacket0x0212_Fixed *network, SPacket0x0212_Fixed nati return rv; } inline __attribute__((warn_unused_result)) -bool network_to_native(SPacket0x0212_Fixed *native, NetSPacket0x0212_Fixed network) +bool network_to_native(SPacket_0x0212_Fixed *native, NetSPacket_0x0212_Fixed network) { bool rv = true; - rv &= network_to_native(&native->packet_id, network.packet_id); + rv &= network_to_native(&native->magic_packet_id, network.magic_packet_id); rv &= network_to_native(&native->npc_id, network.npc_id); rv &= network_to_native(&native->command, network.command); rv &= network_to_native(&native->id, network.id); @@ -77,5 +82,4 @@ bool network_to_native(SPacket0x0212_Fixed *native, NetSPacket0x0212_Fixed netwo return rv; } - #endif // TMWA_PROTO2_MAP_USER_HPP diff --git a/src/proto2/map-user_test.cpp b/src/proto2/map-user_test.cpp index adbdf6f..7d404fe 100644 --- a/src/proto2/map-user_test.cpp +++ b/src/proto2/map-user_test.cpp @@ -6,16 +6,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // This is a generated file, edit tools/protocol.py instead diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp index f69d943..b047865 100644 --- a/src/proto2/types.hpp +++ b/src/proto2/types.hpp @@ -7,16 +7,16 @@ // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . # include "fwd.hpp" @@ -32,24 +32,24 @@ # include "../mmo/strs.hpp" # include "../mmo/utils.hpp" # include "../mmo/version.hpp" -template +template bool native_to_network(T *network, T native) { *network = native; return true; } -template +template bool network_to_native(T *native, T network) { *native = network; return true; } -template +template struct NetString { char data[N]; }; -template +template bool native_to_network(NetString *network, VString native) { // basically WBUF_STRING @@ -59,7 +59,7 @@ bool native_to_network(NetString *network, VString native) std::fill(mid, end, '\0'); return true; } -template +template bool network_to_native(VString *native, NetString network) { // basically RBUF_STRING @@ -70,6 +70,25 @@ bool network_to_native(VString *native, NetString network) return true; } +template +struct SkewedLength +{ + T data; +}; +template +bool native_to_network(SkewedLength *network, U native) +{ + native -= N; + return native_to_network(&network->data, native); +} +template +bool network_to_native(U *native, SkewedLength network) +{ + bool rv = network_to_native(native, network.data); + *native += N; + return rv; +} + inline __attribute__((warn_unused_result)) bool native_to_network(Byte *network, SEX native) { @@ -174,6 +193,23 @@ bool network_to_native(ItemNameId *native, Little16 network) return rv; } inline __attribute__((warn_unused_result)) +bool native_to_network(Little32 *network, ItemNameId native) +{ + bool rv = true; + uint32_t tmp = unwrap(native); + rv &= native_to_network(network, tmp); + return rv; +} +inline __attribute__((warn_unused_result)) +bool network_to_native(ItemNameId *native, Little32 network) +{ + bool rv = true; + uint32_t tmp; + rv &= network_to_native(&tmp, network); + *native = wrap(tmp); + return rv; +} +inline __attribute__((warn_unused_result)) bool native_to_network(Little32 *network, BlockId native) { bool rv = true; diff --git a/tools/protocol.py b/tools/protocol.py index d51f242..e3d6529 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -8,16 +8,16 @@ # 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 +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . import glob @@ -36,16 +36,16 @@ copyright = '''// {filename} - {description} // 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 +// 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 General Public License for more details. +// GNU Affero General Public License for more details. // -// You should have received a copy of the GNU General Public License +// You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . ''' @@ -187,25 +187,50 @@ class WrappedType(Type): f.write(' return rv;\n') f.write('}\n') +class SkewLengthType(Type): + __slots__ = ('type', 'skew') + + def __init__(self, ty, skew): + self.type = ty + self.skew = skew + + def native_tag(self): + return self.type.native_tag() + + def network_tag(self): + return 'SkewedLength<%s, %d>' % (self.type.network_tag(), self.skew) + + def dumpx(self): + # not registered properly, so the method name is wrong + # TODO remind myself to kill this code with fire before release + # not implemented properly, uses a template in the meta instead + # insert another comment here so that it lines up properly + pass + class StructType(Type): - __slots__ = ('name', 'fields', 'size') + __slots__ = ('id', 'name', 'fields', 'size') - def __init__(self, name, fields, size): + def __init__(self, id, name, fields, size): + self.id = id self.name = name self.fields = fields self.size = size - def dump(self, f): - self.dump_native(f) - self.dump_network(f) - self.dump_convert(f) - f.write('\n') + def dump_fwd(self, fwd): + fwd.write('struct %s;\n' % self.name) + fwd.write('struct Net%s;\n' % self.name) def dump_native(self, f): name = self.name f.write('struct %s\n{\n' % name) + if self.id is not None: + f.write(' using NetType = Net%s;\n' % name) + f.write(' static const uint16_t PACKET_ID = 0x%04x;\n\n' % self.id) for (o, l, n) in self.fields: - f.write(' %s %s;\n' % (l.native_tag(), n)) + if n == 'magic_packet_id': + f.write(' %s %s = PACKET_ID;\n' % (l.native_tag(), n)) + else: + f.write(' %s %s = {};\n' % (l.native_tag(), n)) f.write('};\n') def dump_network(self, f): @@ -328,8 +353,17 @@ class FixedPacket(object): def __init__(self, fixed_struct): self.fixed_struct = fixed_struct - def dump(self, f): - self.fixed_struct.dump(f) + def dump_fwd(self, fwd): + self.fixed_struct.dump_fwd(fwd) + + def dump_native(self, f): + self.fixed_struct.dump_native(f) + + def dump_network(self, f): + self.fixed_struct.dump_network(f) + + def dump_convert(self, f): + self.fixed_struct.dump_convert(f) class VarPacket(object): __slots__ = ('head_struct', 'repeat_struct') @@ -338,11 +372,23 @@ class VarPacket(object): self.head_struct = head_struct self.repeat_struct = repeat_struct - def dump(self, f): - self.head_struct.dump(f) - self.repeat_struct.dump(f) + def dump_fwd(self, fwd): + self.head_struct.dump_fwd(fwd) + self.repeat_struct.dump_fwd(fwd) -def packet(name, + def dump_native(self, f): + self.head_struct.dump_native(f) + self.repeat_struct.dump_native(f) + + def dump_network(self, f): + self.head_struct.dump_network(f) + self.repeat_struct.dump_network(f) + + def dump_convert(self, f): + self.head_struct.dump_convert(f) + self.repeat_struct.dump_convert(f) + +def packet(id, name, fixed=None, fixed_size=None, head=None, head_size=None, repeat=None, repeat_size=None, @@ -354,12 +400,12 @@ def packet(name, if fixed is not None: assert not head and not repeat return FixedPacket( - StructType('%s_Fixed' % name, fixed, fixed_size)) + StructType(id, '%s_Fixed' % name, fixed, fixed_size)) else: assert head and repeat return VarPacket( - StructType('%s_Head' % name, head, head_size), - StructType('%s_Repeat' % name, repeat, repeat_size)) + StructType(id, '%s_Head' % name, head, head_size), + StructType(id, '%s_Repeat' % name, repeat, repeat_size)) class Channel(object): @@ -371,14 +417,14 @@ class Channel(object): self.packets = [] def s(self, id, **kwargs): - name = 'SPacket0x%04x' % id - self.packets.append(packet(name, **kwargs)) + name = 'SPacket_0x%04x' % id + self.packets.append(packet(id, name, **kwargs)) def r(self, id, **kwargs): - name = 'RPacket0x%04x' % id - self.packets.append(packet(name, **kwargs)) + name = 'RPacket_0x%04x' % id + self.packets.append(packet(id, name, **kwargs)) - def dump(self, outdir): + def dump(self, outdir, fwd): server = self.server client = self.client header = '%s-%s.hpp' % (server, client) @@ -402,7 +448,16 @@ class Channel(object): f.write('// This is an internal protocol, and can be changed without notice\n') f.write('\n') for p in self.packets: - p.dump(f) + p.dump_fwd(fwd) + fwd.write('\n') + for p in self.packets: + p.dump_native(f) + f.write('\n') + for p in self.packets: + p.dump_network(f) + f.write('\n') + for p in self.packets: + p.dump_convert(f) f.write('\n') f.write('#endif // %s\n' % define) @@ -419,6 +474,10 @@ class Channel(object): ident_translation = ''.join(chr(c) if chr(c).isalnum() else '_' for c in range(256)) def ident(s): + if s == 'packet id': + return 'magic_packet_id' + if s == 'packet length': + return 'magic_packet_length' return s.translate(ident_translation) @@ -466,9 +525,13 @@ class Context(object): f.write(copyright.format(filename=header, description=desc)) f.write('\n') f.write('# include "%s"\n\n' % sanity) - f.write('// TODO put stuff here\n') + + for ch in self._channels: + ch.dump(outdir, f) + f.write('\n') f.write('#endif // %s\n' % define) + with open(os.path.join(outdir, 'types.hpp'), 'w') as f: header = '%s/types.hpp' % proto2 desc = 'Forward declarations of packet component types' @@ -484,22 +547,22 @@ class Context(object): # this is writing another file inc.testcase(outdir) - f.write('template \n') + f.write('template\n') f.write('bool native_to_network(T *network, T native)\n{\n') f.write(' *network = native;\n') f.write(' return true;\n') f.write('}\n') - f.write('template \n') + f.write('template\n') f.write('bool network_to_native(T *native, T network)\n{\n') f.write(' *native = network;\n') f.write(' return true;\n') f.write('}\n') - f.write('template \n') + f.write('template\n') f.write('struct NetString\n{\n') f.write(' char data[N];\n') f.write('};\n') - f.write('template \n') + f.write('template\n') f.write('bool native_to_network(NetString *network, VString native)\n{\n') f.write(' // basically WBUF_STRING\n') f.write(' char *const begin = network->data;\n') @@ -508,7 +571,7 @@ class Context(object): f.write(' std::fill(mid, end, \'\\0\');\n') f.write(' return true;\n') f.write('}\n') - f.write('template \n') + f.write('template\n') f.write('bool network_to_native(VString *native, NetString network)\n{\n') f.write(' // basically RBUF_STRING\n') f.write(' const char *const begin = network.data;\n') @@ -518,11 +581,27 @@ class Context(object): f.write(' return true;\n') f.write('}\n') f.write('\n') + + f.write('template\n') + f.write('struct SkewedLength\n{\n') + f.write(' T data;\n') + f.write('};\n') + f.write('template\n') + f.write('bool native_to_network(SkewedLength *network, U native)\n{\n') + f.write(' native -= N;\n') + f.write(' return native_to_network(&network->data, native);\n') + f.write('}\n') + f.write('template\n') + f.write('bool network_to_native(U *native, SkewedLength network)\n{\n') + f.write(' bool rv = network_to_native(native, network.data);\n') + f.write(' *native += N;\n') + f.write(' return rv;\n') + f.write('}\n') + f.write('\n') + for ty in self._types: ty.dump(f) f.write('#endif // %s\n' % define) - for ch in self._channels: - ch.dump(outdir) # types @@ -547,6 +626,7 @@ class Context(object): return rv def struct(self, name, body): + # TODO fix this rv = StructType(name, body) self._types.append(rv) return rv @@ -643,12 +723,15 @@ def main(): u32 = ctx.provided(uint32_t, Little32) u64 = ctx.provided(uint64_t, Little64) + sex_char = ctx.provided(SEX, NeutralType('char')) + sex = ctx.enum(SEX, u8) species = ctx.wrap(Species, u16) account_id = ctx.wrap(AccountId, u32) char_id = ctx.wrap(CharId, u32) party_id = ctx.wrap(PartyId, u32) item_name_id = ctx.wrap(ItemNameId, u16) + item_name_id4 = ctx.wrap(ItemNameId, u32) block_id = ctx.wrap(BlockId, u32) time32 = ctx.provided(TimeT, Little32) @@ -746,7 +829,7 @@ def main(): login_char.r(0x2712, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, u32, 'login id1'), at(10, u32, 'login id2'), at(14, sex, 'sex'), @@ -757,7 +840,7 @@ def main(): login_char.s(0x2713, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, u8, 'invalid'), at(7, account_email, 'email'), at(47, time32, 'connect until'), @@ -774,7 +857,7 @@ def main(): login_char.r(0x2715, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_email, 'email'), ], fixed_size=46, @@ -782,14 +865,14 @@ def main(): login_char.r(0x2716, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), ], fixed_size=6, ) login_char.s(0x2717, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_email, 'email'), at(46, time32, 'connect until'), ], @@ -799,7 +882,7 @@ def main(): head=[ at(0, u16, 'packet id'), at(2, u16, 'packet length'), - at(4, u32, 'account id'), + at(4, account_id, 'account id'), ], head_size=8, repeat=[at(0, u8, 'c')], @@ -808,7 +891,7 @@ def main(): login_char.s(0x2721, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, gm, 'gm level'), ], fixed_size=10, @@ -816,7 +899,7 @@ def main(): login_char.r(0x2722, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_email, 'old email'), at(46, account_email, 'new email'), ], @@ -825,7 +908,7 @@ def main(): login_char.s(0x2723, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, sex, 'sex'), ], fixed_size=7, @@ -833,27 +916,25 @@ def main(): login_char.r(0x2724, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, u32, 'status'), ], fixed_size=10, ) login_char.r(0x2725, - head=[ + fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, human_time_diff, 'deltas'), ], - head_size=18, - repeat=[at(0, u8, 'c')], - repeat_size=1, + fixed_size=18, ) # evil packet, see also 0x794e - login_admin.r(0x2726, + login_admin.s(0x2726, head=[ at(0, u16, 'packet id'), at(2, u16, 'unused'), - at(4, u32, 'string length'), + at(4, SkewLengthType(u32, 8), 'magic packet length'), ], head_size=8, repeat=[ @@ -864,7 +945,7 @@ def main(): login_char.r(0x2727, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), ], fixed_size=6, ) @@ -876,7 +957,7 @@ def main(): head=[ at(0, u16, 'packet id'), at(2, u16, 'packet length'), - at(4, u32, 'account id'), + at(4, account_id, 'account id'), ], head_size=8, repeat=[ @@ -888,20 +969,21 @@ def main(): login_char.r(0x272a, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), ], fixed_size=6, ) login_char.s(0x2730, fixed=[ at(0, u16, 'packet id'), + at(2, account_id, 'account id'), ], - fixed_size=2, + fixed_size=6, ) login_char.s(0x2731, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, u8, 'ban not status'), at(7, time32, 'status or ban until'), ], @@ -914,7 +996,7 @@ def main(): ], head_size=4, repeat=[ - at(0, u32, 'account id'), + at(0, account_id, 'account id'), at(4, gm1, 'gm level'), ], repeat_size=5, @@ -922,7 +1004,7 @@ def main(): login_char.r(0x2740, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_pass, 'old pass'), at(30, account_pass, 'new pass'), ], @@ -931,7 +1013,7 @@ def main(): login_char.s(0x2741, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, u8, 'status'), ], fixed_size=7, @@ -960,14 +1042,12 @@ def main(): # login admin login_admin.r(0x7920, - head=[ + fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'start account id'), - at(6, u32, 'end account id'), + at(2, account_id, 'start account id'), + at(6, account_id, 'end account id'), ], - head_size=10, - repeat=[at(0, u8, 'c')], - repeat_size=1, + fixed_size=10, ) login_admin.s(0x7921, head=[ @@ -976,7 +1056,7 @@ def main(): ], head_size=4, repeat=[ - at(0, u32, 'account id'), + at(0, account_id, 'account id'), at(4, gm1, 'gm level'), at(5, account_name, 'account name'), at(29, sex, 'sex'), @@ -988,8 +1068,8 @@ def main(): login_admin.r(0x7924, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'source item id'), - at(6, u32, 'dest item id'), + at(2, item_name_id4, 'source item id'), + at(6, item_name_id4, 'dest item id'), ], fixed_size=10, ) @@ -1004,7 +1084,7 @@ def main(): at(0, u16, 'packet id'), at(2, account_name, 'account name'), at(26, account_pass, 'password'), - at(50, sex, 'sex'), + at(50, sex_char, 'sex'), at(51, account_email, 'email'), ], fixed_size=91, @@ -1012,7 +1092,7 @@ def main(): login_admin.s(0x7931, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1027,7 +1107,7 @@ def main(): login_admin.s(0x7933, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1043,7 +1123,7 @@ def main(): login_admin.s(0x7935, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1060,10 +1140,11 @@ def main(): login_admin.s(0x7937, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), + at(30, u32, 'status'), ], - fixed_size=30, + fixed_size=34, ) login_admin.r(0x7938, fixed=[ @@ -1098,7 +1179,7 @@ def main(): login_admin.s(0x793b, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1107,14 +1188,14 @@ def main(): fixed=[ at(0, u16, 'packet id'), at(2, account_name, 'account name'), - at(26, sex, 'sex'), + at(26, sex_char, 'sex'), ], fixed_size=27, ) login_admin.s(0x793d, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1130,7 +1211,7 @@ def main(): login_admin.s(0x793f, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1146,7 +1227,7 @@ def main(): login_admin.s(0x7941, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1156,7 +1237,7 @@ def main(): head=[ at(0, u16, 'packet id'), at(2, account_name, 'account name'), - at(26, u16, 'string length'), + at(26, SkewLengthType(u16, 28), 'magic packet length'), ], head_size=28, repeat=[ @@ -1167,7 +1248,7 @@ def main(): login_admin.s(0x7943, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1182,7 +1263,7 @@ def main(): login_admin.s(0x7945, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1190,14 +1271,14 @@ def main(): login_admin.r(0x7946, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), ], fixed_size=6, ) login_admin.s(0x7947, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), ], fixed_size=30, @@ -1213,7 +1294,7 @@ def main(): login_admin.s(0x7949, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), at(30, time32, 'valid until'), ], @@ -1230,7 +1311,7 @@ def main(): login_admin.s(0x794b, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), at(30, time32, 'ban until'), ], @@ -1247,7 +1328,7 @@ def main(): login_admin.s(0x794d, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), at(30, time32, 'ban until'), ], @@ -1258,7 +1339,7 @@ def main(): head=[ at(0, u16, 'packet id'), at(2, u16, 'unused'), - at(4, u32, 'string length'), + at(4, SkewLengthType(u32, 8), 'magic packet length'), ], head_size=8, repeat=[ @@ -1284,7 +1365,7 @@ def main(): login_admin.s(0x7951, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, account_name, 'account name'), at(30, time32, 'valid until'), ], @@ -1301,10 +1382,10 @@ def main(): login_admin.s(0x7953, head=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), at(6, gm1, 'gm level'), at(7, account_name, 'account name'), - at(31, sex, 'id'), + at(31, sex, 'sex'), at(32, u32, 'login count'), at(36, u32, 'state'), at(40, seconds, 'error message'), @@ -1313,7 +1394,7 @@ def main(): at(100, account_email, 'email'), at(140, time32, 'connect until'), at(144, time32, 'ban until'), - at(148, u16, 'string length'), + at(148, SkewLengthType(u16, 150), 'magic packet length'), ], head_size=150, repeat=[ @@ -1324,7 +1405,7 @@ def main(): login_admin.r(0x7954, fixed=[ at(0, u16, 'packet id'), - at(2, u32, 'account id'), + at(2, account_id, 'account id'), ], fixed_size=6, ) -- cgit v1.2.3-60-g2f50