From 87f9bae4da0314e97f1a3e38513960998ee4d05d Mon Sep 17 00:00:00 2001 From: mekolat Date: Tue, 12 May 2015 21:40:18 -0400 Subject: use client version --- src/char/char.cpp | 14 +++++++------- src/char/char.hpp | 2 +- src/map/chrif.cpp | 4 ++-- src/map/clif.cpp | 2 +- src/map/map.hpp | 2 +- src/map/pc.cpp | 7 ++++--- src/map/pc.hpp | 2 +- src/map/script-fun.cpp | 8 ++++++++ tools/protocol.py | 4 ++-- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/char/char.cpp b/src/char/char.cpp index ed9e369..345265f 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -98,7 +98,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 +1673,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 +2180,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 +2251,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 @@ -2280,8 +2280,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..049875b 100644 --- a/src/char/char.hpp +++ b/src/char/char.hpp @@ -50,7 +50,7 @@ struct AuthFifoEntry IP4Address ip; int delflag; SEX sex; - unsigned short packet_tmw_version; + unsigned short packet_client_version; }; struct mmo_map_server diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 8127f20..ce5669e 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -867,11 +867,11 @@ void chrif_parse(Session *s) AccountId id = payload.account_id; int login_id2 = payload.login_id2; - short tmw_version = payload.packet_tmw_version; + short client_version = payload.packet_client_version; CharKey st_key = payload.char_key; CharData st_data = payload.char_data; pc_authok(id, login_id2, - tmw_version, + client_version, &st_key, &st_data); break; } diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 6074c43..f94c316 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -2654,7 +2654,7 @@ void clif_skillinfoblock(dumb_ptr sd) std::vector> repeat_10f; for (SkillID i : erange(SkillID(), MAX_SKILL)) { - if (sd->status.skill[i].lv && sd->tmw_version >= 1) + if (sd->status.skill[i].lv && sd->client_version >= 1) { Packet_Repeat<0x010f> info; // [Fate] Version 1 and later don't crash because of bad skill IDs anymore diff --git a/src/map/map.hpp b/src/map/map.hpp index f57dcee..ce434fa 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -153,7 +153,7 @@ struct map_session_data : block_list, SessionData CharId char_id_; int login_id1, login_id2; SEX sex; - unsigned char tmw_version; // tmw client version + int client_version; // tmw client version CharKey status_key; CharData status; GenericArray>, InventoryIndexing> inventory_data = diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 1179792..cb81e29 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -641,7 +641,7 @@ int pc_isequip(dumb_ptr sd, IOff0 n) *------------------------------------------ */ int pc_authok(AccountId id, int login_id2, - short tmw_version, const CharKey *st_key, const CharData *st_data) + short client_version, const CharKey *st_key, const CharData *st_data) { dumb_ptr sd = nullptr; @@ -652,7 +652,7 @@ int pc_authok(AccountId id, int login_id2, return 1; sd->login_id2 = login_id2; - sd->tmw_version = tmw_version; + sd->client_version = client_version; sd->status_key = *st_key; sd->status = *st_data; @@ -797,7 +797,8 @@ int pc_authok(AccountId id, int login_id2, pc_calcstatus(sd, 1); // Init Quest Log - clif_sendallquest(sd); + if(sd->client_version >= 2) + clif_sendallquest(sd); return 0; } diff --git a/src/map/pc.hpp b/src/map/pc.hpp index d100938..fc0bdb0 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -80,7 +80,7 @@ int pc_counttargeted(dumb_ptr sd, dumb_ptr src, int pc_setrestartvalue(dumb_ptr sd, int type); void pc_makesavestatus(dumb_ptr); int pc_setnewpc(dumb_ptr, AccountId, CharId, int, uint32_t /*tick_t*/, SEX); -int pc_authok(AccountId, int, short tmw_version, const CharKey *, const CharData *); +int pc_authok(AccountId, int, short client_version, const CharKey *, const CharData *); int pc_authfail(AccountId accid); EPOS pc_equippoint(dumb_ptr sd, IOff0 n); diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 744f2c3..9020203 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -971,6 +971,13 @@ void builtin_delitem(ScriptState *st) } +static +void builtin_getversion(ScriptState *st) +{ + dumb_ptr sd = script_rid2sd(st);; + push_int(st->stack, sd->client_version); +} + /*========================================== *キャラ関係のID取得 *------------------------------------------ @@ -3028,6 +3035,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(makeitem, "IiMxy"_s, '\0'), BUILTIN(delitem, "Ii"_s, '\0'), BUILTIN(getcharid, "i?"_s, 'i'), + BUILTIN(getversion, ""_s, 'i'), BUILTIN(strcharinfo, "i"_s, 's'), BUILTIN(getequipid, "i"_s, 'i'), BUILTIN(bonus, "ii"_s, '\0'), diff --git a/tools/protocol.py b/tools/protocol.py index 688821f..f13d627 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -1984,7 +1984,7 @@ def build_context(): at(2, account_id, 'account id'), at(6, u32, 'login id1'), at(10, u32, 'login id2'), - at(14, u16, 'packet tmw version'), + at(14, u16, 'packet client version'), at(16, sex, 'sex'), ], fixed_size=17, @@ -5124,7 +5124,7 @@ def build_context(): at(4, account_id, 'account id'), at(8, u32, 'login id2'), at(12, time32, 'unused connect until'), - at(16, u16, 'packet tmw version'), + at(16, u16, 'packet client version'), at(18, char_key, 'char key'), at(None, char_data, 'char data'), ], -- cgit v1.2.3-70-g09d2