diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-06-21 21:21:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-06-29 19:46:09 +0300 |
commit | eacfb4ffc82a5dbe01284738544394bec7cc8c24 (patch) | |
tree | b1c482b58e17b94d9d056051694f7cb6bd1e10de | |
parent | 272c02ba0e4b4b1c752b26e33e1aa4b80eef4600 (diff) | |
download | hercules-eacfb4ffc82a5dbe01284738544394bec7cc8c24.tar.gz hercules-eacfb4ffc82a5dbe01284738544394bec7cc8c24.tar.bz2 hercules-eacfb4ffc82a5dbe01284738544394bec7cc8c24.tar.xz hercules-eacfb4ffc82a5dbe01284738544394bec7cc8c24.zip |
Add packet 0xae5 for send pincode login state.
-rw-r--r-- | src/char/pincode.c | 31 | ||||
-rw-r--r-- | src/char/pincode.h | 6 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/char/pincode.c b/src/char/pincode.c index 9f78444a1..8fc4e6c36 100644 --- a/src/char/pincode.c +++ b/src/char/pincode.c @@ -95,7 +95,11 @@ void pincode_check(int fd, struct char_session_data* sd) character->pincode_enable = pincode->charselect * 2; pincode->loginstate(fd, sd, PINCODE_LOGIN_OK); } else { +#if PACKETVER_MAIN_NUM >= 20180124 || PACKETVER_RE_NUM >= 20180124 || PACKETVER_ZERO_NUM >= 20180131 + pincode->loginstate2(fd, sd, PINCODE_LOGIN_WRONG, PINCODE_LOGIN_FLAG_WRONG); +#else pincode->loginstate(fd, sd, PINCODE_LOGIN_WRONG); +#endif } } @@ -250,6 +254,32 @@ void pincode_loginstate(int fd, struct char_session_data* sd, enum pincode_login WFIFOSET(fd, 12); } +// 0 = pin is correct +// 1 = ask for pin - client sends 0x8b8 +// 2 = create new pin - client sends 0x8ba +// 3 = pin must be changed - client 0x8be +// 4 = create new pin ?? - client sends 0x8ba +// 5 = client shows msgstr(1896) +// 6 = client shows msgstr(1897) Unable to use your KSSN number +// 7 = char select window shows a button - client sends 0x8c5 +// 8 = pincode was incorrect +// [4144] pincode_loginstate2 can replace pincode_loginstate, +// but kro using pincode_loginstate2 only for send wrong pin error or locked after 3 pins wrong +void pincode_loginstate2(int fd, struct char_session_data* sd, enum pincode_login_response state, enum pincode_login_response2 flag) +{ +#if PACKETVER_MAIN_NUM >= 20180124 || PACKETVER_RE_NUM >= 20180124 || PACKETVER_ZERO_NUM >= 20180131 + nullpo_retv(sd); + + WFIFOHEAD(fd, 13); + WFIFOW(fd, 0) = 0xae9; + WFIFOL(fd, 2) = sd->pincode_seed = rnd() % 0xFFFF; + WFIFOL(fd, 6) = sd->account_id; + WFIFOW(fd, 10) = state; + WFIFOW(fd, 12) = flag; + WFIFOSET(fd, 13); +#endif +} + void pincode_notifyLoginPinUpdate(int account_id, char* pin) { nullpo_retv(pin); @@ -431,6 +461,7 @@ void pincode_defaults(void) pincode->makestate = pincode_makestate; pincode->editstate = pincode_editstate; pincode->loginstate = pincode_loginstate; + pincode->loginstate2 = pincode_loginstate2; pincode->setnew = pincode_setnew; pincode->change = pincode_change; pincode->isBlacklisted = pincode_isBlacklisted; diff --git a/src/char/pincode.h b/src/char/pincode.h index cfa6e83e6..699758179 100644 --- a/src/char/pincode.h +++ b/src/char/pincode.h @@ -53,6 +53,11 @@ enum pincode_login_response { PINCODE_LOGIN_WRONG = 8, }; +enum pincode_login_response2 { + PINCODE_LOGIN_FLAG_LOCKED = 0, + PINCODE_LOGIN_FLAG_WRONG = 2, +}; + /** * pincode interface **/ @@ -74,6 +79,7 @@ struct pincode_interface { void (*makestate) (int fd, struct char_session_data *sd, enum pincode_make_response state); void (*editstate) (int fd, struct char_session_data *sd, enum pincode_edit_response state); void (*loginstate) (int fd, struct char_session_data *sd, enum pincode_login_response state); + void (*loginstate2) (int fd, struct char_session_data *sd, enum pincode_login_response state, enum pincode_login_response2 flag); void (*setnew) (int fd, struct char_session_data* sd); void (*change) (int fd, struct char_session_data* sd); bool (*isBlacklisted) (const char *pin); |