diff options
Diffstat (limited to 'src/char')
-rw-r--r-- | src/char/char.cpp | 23 | ||||
-rw-r--r-- | src/char/char.hpp | 5 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp index ed9e369..7ad6dff 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -62,6 +62,7 @@ #include "../proto2/any-user.hpp" #include "../proto2/login-admin.hpp" #include "../proto2/login-char.hpp" +#include "../proto2/login-user.hpp" #include "../proto2/char-map.hpp" #include "../proto2/char-user.hpp" @@ -98,7 +99,7 @@ struct char_session_data : SessionData AccountId account_id; int login_id1, login_id2; SEX sex; - unsigned short packet_tmw_version; + unsigned short packet_client_version; AccountEmail email; }; } // namespace char_ @@ -1673,10 +1674,10 @@ void parse_frommap(Session *ms) payload_fd.account_id = account_id; payload_fd.login_id2 = afi.login_id2; cd->sex = afi.sex; - payload_fd.packet_tmw_version = afi.packet_tmw_version; + payload_fd.packet_client_version = afi.packet_client_version; FPRINTF(stderr, "From queue index %zd: recalling packet version %d\n"_fmt, - (&afi - &auth_fifo.front()), afi.packet_tmw_version); + (&afi - &auth_fifo.front()), afi.packet_client_version); payload_fd.char_key = *ck; payload_fd.char_data = *cd; send_ppacket<0x2afd>(ms, payload_fd); @@ -2180,7 +2181,7 @@ void handle_x0066(Session *s, struct char_session_data *sd, uint8_t rfifob_2, IP auth_fifo_iter->delflag = 0; auth_fifo_iter->sex = sd->sex; auth_fifo_iter->ip = s->client_ip; - auth_fifo_iter->packet_tmw_version = sd->packet_tmw_version; + auth_fifo_iter->packet_client_version = sd->packet_client_version; auth_fifo_iter++; } } @@ -2251,7 +2252,7 @@ void parse_char(Session *s) sd->account_id = account_id; sd->login_id1 = fixed.login_id1; sd->login_id2 = fixed.login_id2; - sd->packet_tmw_version = fixed.packet_tmw_version; + sd->packet_client_version = fixed.packet_client_version; sd->sex = fixed.sex; // formerly: send back account_id @@ -2259,6 +2260,14 @@ void parse_char(Session *s) special.magic_packet_length = 4; send_ppacket<0x8000>(s, special); + if(sd->packet_client_version < MIN_CLIENT_VERSION) + { + Packet_Fixed<0x006a> fixed_6a; + fixed_6a.error_code = 5; + send_fpacket<0x006a, 23>(s, fixed_6a); + goto x65_out; + } + // search authentification for (AuthFifoEntry& afi : auth_fifo) { @@ -2280,8 +2289,8 @@ void parse_char(Session *s) send_fpacket<0x2716, 6>(login_session, fixed_16); } // Record client version - afi.packet_tmw_version = - sd->packet_tmw_version; + afi.packet_client_version = + sd->packet_client_version; // send characters to player mmo_char_send006b(s, sd); } diff --git a/src/char/char.hpp b/src/char/char.hpp index 4f55c04..8adac4d 100644 --- a/src/char/char.hpp +++ b/src/char/char.hpp @@ -42,6 +42,9 @@ std::chrono::seconds DEFAULT_AUTOSAVE_INTERVAL = 5_min; constexpr GmLevel default_gm_level = GmLevel::from(0_u32); +// increase the min version when the protocol is incompatible with old m+ versions +#define MIN_CLIENT_VERSION 1 + struct AuthFifoEntry { AccountId account_id; @@ -50,7 +53,7 @@ struct AuthFifoEntry IP4Address ip; int delflag; SEX sex; - unsigned short packet_tmw_version; + unsigned short packet_client_version; }; struct mmo_map_server |