From 72d4d2df6918917a50c057fea3f5847f9e3750eb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 19 Apr 2017 23:53:07 +0300 Subject: Drop support for client protocol version 3 (Nov 28 2014). --- src/echar/char.c | 81 ++++++++++++++++++++++++------------------------------ src/elogin/parse.c | 4 +-- src/emap/clif.c | 12 -------- src/emap/send.c | 2 +- 4 files changed, 39 insertions(+), 60 deletions(-) diff --git a/src/echar/char.c b/src/echar/char.c index 6d16e56..d6a2c40 100644 --- a/src/echar/char.c +++ b/src/echar/char.c @@ -36,32 +36,29 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data **sdP if (!sd) return; - if (sd->version >= 4) + race = RFIFOW(fd, 31); + if (race < min_char_class || race > max_char_class) { - race = RFIFOW(fd, 31); - if (race < min_char_class || race > max_char_class) - { - chr->creation_failed(fd, -10); - RFIFOSKIP(fd, 31 + 5); - hookStop(); - return; - } - sex = RFIFOB(fd, 33); - if (sex != 0 && sex != 1 && sex != 3 && sex != 99) - { - chr->creation_failed(fd, -11); - RFIFOSKIP(fd, 31 + 5); - hookStop(); - return; - } - look = RFIFOW(fd, 34); - if (look < min_look || look > max_look) - { - chr->creation_failed(fd, -12); - RFIFOSKIP(fd, 31 + 5); - hookStop(); - return; - } + chr->creation_failed(fd, -10); + RFIFOSKIP(fd, 31 + 5); + hookStop(); + return; + } + sex = RFIFOB(fd, 33); + if (sex != 0 && sex != 1 && sex != 3 && sex != 99) + { + chr->creation_failed(fd, -11); + RFIFOSKIP(fd, 31 + 5); + hookStop(); + return; + } + look = RFIFOW(fd, 34); + if (look < min_look || look > max_look) + { + chr->creation_failed(fd, -12); + RFIFOSKIP(fd, 31 + 5); + hookStop(); + return; } // +++ need remove addition sql query after this line for set sex @@ -76,33 +73,27 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data **sdP struct mmo_charstatus char_dat; chr->mmo_char_fromsql(result, &char_dat, false); //Only the short data is needed. - if (sd->version >= 4) + char_dat.class = race; + char_dat.sex = sex; + char_dat.clothes_color = look; + + chr->mmo_char_tosql(result, &char_dat); + char cSex = 'U'; + if (sex == SEX_MALE) + cSex = 'M'; + else if (sex == SEX_FEMALE) + cSex = 'F'; + + if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", "char", cSex, char_dat.char_id)) { - char_dat.class = race; - char_dat.sex = sex; - char_dat.clothes_color = look; - - chr->mmo_char_tosql(result, &char_dat); - char cSex = 'U'; - if (sex == SEX_MALE) - cSex = 'M'; - else if (sex == SEX_FEMALE) - cSex = 'F'; - - if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `sex` = '%c' WHERE `char_id` = '%d'", "char", cSex, char_dat.char_id)) - { - Sql_ShowDebug(inter->sql_handle); - } + Sql_ShowDebug(inter->sql_handle); } chr->creation_ok(fd, &char_dat); // add new entry to the chars list sd->found_char[char_dat.slot] = result; // the char_id of the new char } - if (sd->version >= 4) - RFIFOSKIP(fd, 31 + 5); - else - RFIFOSKIP(fd, 31); + RFIFOSKIP(fd, 31 + 5); hookStop(); } diff --git a/src/elogin/parse.c b/src/elogin/parse.c index 1a53683..6a1052d 100644 --- a/src/elogin/parse.c +++ b/src/elogin/parse.c @@ -34,7 +34,7 @@ void login_parse_version(int fd) clientVersion = RFIFOL(fd, 2); - if (clientVersion < 3) + if (clientVersion < 4) { lclif->login_error(fd, 5); return; @@ -58,7 +58,7 @@ bool elogin_client_login_pre(int *fdPtr, char username[NAME_LENGTH]; safestrncpy(username, RFIFOP(fd, 6), NAME_LENGTH); int len = (int)safestrnlen(username, NAME_LENGTH); - if (clientVersion < 3) + if (clientVersion < 4) { lclif->login_error(fd, 5); hookStop(); diff --git a/src/emap/clif.c b/src/emap/clif.c index d9245a8..7d75a85 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -551,18 +551,6 @@ int eclif_send_actual_pre(int *fd, if (*len >= 2) { const int packet = RBUFW (buf, 0); - if (packet >= 0xb03 && packet <= 0xb0a) - { - struct SessionExt *data = session_get(*fd); - if (!data) - return 0; - if (data->clientVersion < 4) - { // not sending new packets to old clients -// ShowWarning("skip packet %d\n", packet); - hookStop(); - return 0; - } - } if (packet == 0xb0b) { struct SessionExt *data = session_get(*fd); diff --git a/src/emap/send.c b/src/emap/send.c index 2cbafe5..c3b9478 100644 --- a/src/emap/send.c +++ b/src/emap/send.c @@ -194,7 +194,7 @@ void send_pc_info(struct block_list* bl1, if (!tsd) return; struct SessionExt *tdata = session_get_bysd(tsd); - if (!tdata || (bl1 != bl2 && tdata->clientVersion < 4)) + if (!tdata) return; int len = 14; -- cgit v1.2.3-60-g2f50