diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 4 | ||||
-rw-r--r-- | src/char/pincode.c | 283 | ||||
-rw-r--r-- | src/char/pincode.h | 40 | ||||
-rw-r--r-- | src/map/battle.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 10 | ||||
-rw-r--r-- | src/map/guild.c | 4 | ||||
-rw-r--r-- | src/map/packets.h | 9 | ||||
-rw-r--r-- | src/map/packets_keys_main.h | 5 | ||||
-rw-r--r-- | src/map/packets_keys_zero.h | 5 | ||||
-rw-r--r-- | src/map/packets_shuffle_main.h | 5 | ||||
-rw-r--r-- | src/map/packets_shuffle_zero.h | 5 | ||||
-rw-r--r-- | src/map/packets_struct.h | 4 | ||||
-rw-r--r-- | src/map/skill.c | 16 | ||||
-rw-r--r-- | src/map/skill.h | 4 | ||||
-rw-r--r-- | src/map/status.c | 24 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 14 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc | 28 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc | 7 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 151 |
19 files changed, 504 insertions, 116 deletions
diff --git a/src/char/char.c b/src/char/char.c index 84cc1b688..7e5b7e0dc 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -5012,7 +5012,7 @@ void char_parse_char_pincode_window(int fd, struct char_session_data* sd) __attr void char_parse_char_pincode_window(int fd, struct char_session_data* sd) { if (RFIFOL(fd,2) == sd->account_id) - pincode->sendstate(fd, sd, PINCODE_NOTSET); + pincode->loginstate(fd, sd, PINCODE_LOGIN_NOTSET); RFIFOSKIP(fd, 6); } @@ -6159,6 +6159,7 @@ int do_final(void) { do_final_mapif(); loginif->final(); + pincode->final(); if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s`", ragsrvinfo_db) ) Sql_ShowDebug(inter->sql_handle); @@ -6305,6 +6306,7 @@ int do_init(int argc, char **argv) { //Read map indexes mapindex->init(); + pincode->init(); #ifdef RENEWAL start_point.map = mapindex->name2id("iz_int"); diff --git a/src/char/pincode.c b/src/char/pincode.c index bca1b4394..01c1f482c 100644 --- a/src/char/pincode.c +++ b/src/char/pincode.c @@ -26,6 +26,7 @@ #include "common/cbasetypes.h" #include "common/conf.h" #include "common/db.h" +#include "common/memmgr.h" #include "common/mmo.h" #include "common/nullpo.h" #include "common/random.h" @@ -39,56 +40,95 @@ struct pincode_interface pincode_s; struct pincode_interface *pincode; -void pincode_handle (int fd, struct char_session_data* sd) { +void pincode_handle (int fd, struct char_session_data* sd) +{ struct online_char_data* character; nullpo_retv(sd); + character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id); - if( character && character->pincode_enable > pincode->charselect ){ + + if (character && character->pincode_enable > pincode->charselect) { character->pincode_enable = pincode->charselect * 2; - }else{ - pincode->sendstate( fd, sd, PINCODE_OK ); + } else { + pincode->loginstate(fd, sd, PINCODE_LOGIN_OK); return; } - if( strlen(sd->pincode) == 4 ){ - if( pincode->changetime && time(NULL) > (sd->pincode_change+pincode->changetime) ){ // User hasn't changed his PIN code for a long time - pincode->sendstate( fd, sd, PINCODE_EXPIRED ); + if (strlen(sd->pincode) == 4) { + if (pincode->check_blacklist && pincode->isBlacklisted(sd->pincode)) { + // Ask player to change pincode to be able to connect + pincode->loginstate(fd, sd, PINCODE_LOGIN_EXPIRED); + } else if (pincode->changetime && time(NULL) > (sd->pincode_change + pincode->changetime)) { + // User hasn't changed his PIN code for a long time + pincode->loginstate(fd, sd, PINCODE_LOGIN_EXPIRED); } else { // Ask user for his PIN code - pincode->sendstate( fd, sd, PINCODE_ASK ); + pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK); } } else // No PIN code has been set yet - pincode->sendstate( fd, sd, PINCODE_NOTSET ); + pincode->loginstate(fd, sd, PINCODE_LOGIN_NOTSET); - if( character ) + if (character) character->pincode_enable = -1; } -void pincode_check(int fd, struct char_session_data* sd) { +void pincode_check(int fd, struct char_session_data* sd) +{ char pin[5] = "\0\0\0\0"; nullpo_retv(sd); + if (strlen(sd->pincode) != 4) return; + safestrncpy(pin, RFIFOP(fd, 6), sizeof(pin)); - pincode->decrypt(sd->pincode_seed, pin); - if( pincode->compare( fd, sd, pin ) ){ + + if (pincode->check_blacklist && pincode->isBlacklisted(pin)) { + pincode->loginstate(fd, sd, PINCODE_LOGIN_RESTRICT_PW); + return; + } + + if (pincode->compare(fd, sd, pin)) { struct online_char_data* character; - if( (character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id)) ) + if ((character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id))) character->pincode_enable = pincode->charselect * 2; - pincode->sendstate( fd, sd, PINCODE_OK ); + pincode->loginstate(fd, sd, PINCODE_LOGIN_OK); + } else { + pincode->loginstate(fd, sd, PINCODE_LOGIN_WRONG); } } -int pincode_compare(int fd, struct char_session_data* sd, char* pin) { +/** +* Check if this pincode is blacklisted or not +* +* @param (const char *) pin The pin to be verified +* @return bool +*/ +bool pincode_isBlacklisted(const char *pin) +{ + int i; + + nullpo_retr(false, pin); + + ARR_FIND(0, VECTOR_LENGTH(pincode->blacklist), i, strcmp(VECTOR_INDEX(pincode->blacklist, i), pin) == 0); + + if (i < VECTOR_LENGTH(pincode->blacklist)) { + return true; + } + + return false; +} + +int pincode_compare(int fd, struct char_session_data* sd, char* pin) +{ nullpo_ret(sd); nullpo_ret(pin); - if( strcmp( sd->pincode, pin ) == 0 ){ + + if (strcmp(sd->pincode, pin) == 0) { sd->pincode_try = 0; return 1; } else { - pincode->sendstate( fd, sd, PINCODE_WRONG ); - if( pincode->maxtry && ++sd->pincode_try >= pincode->maxtry ){ + if (pincode->maxtry && ++sd->pincode_try >= pincode->maxtry) { pincode->error(sd->account_id); chr->authfail_fd(fd, 0); chr->disconnect_player(sd->account_id); @@ -97,35 +137,94 @@ int pincode_compare(int fd, struct char_session_data* sd, char* pin) { } } -void pincode_change(int fd, struct char_session_data* sd) { +void pincode_change(int fd, struct char_session_data* sd) +{ char oldpin[5] = "\0\0\0\0", newpin[5] = "\0\0\0\0"; nullpo_retv(sd); + if (strlen(sd->pincode) != 4) return; - safestrncpy(oldpin, RFIFOP(fd,6), sizeof(oldpin)); - pincode->decrypt(sd->pincode_seed,oldpin); - if( !pincode->compare( fd, sd, oldpin ) ) + + safestrncpy(oldpin, RFIFOP(fd, 6), sizeof(oldpin)); + pincode->decrypt(sd->pincode_seed, oldpin); + + if (!pincode->compare(fd, sd, oldpin)) { + pincode->editstate(fd, sd, PINCODE_EDIT_FAILED); + pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK); return; + } - safestrncpy(newpin, RFIFOP(fd,10), sizeof(newpin)); - pincode->decrypt(sd->pincode_seed,newpin); - pincode->update( sd->account_id, newpin ); - safestrncpy(sd->pincode, newpin, sizeof(sd->pincode)); - pincode->sendstate( fd, sd, PINCODE_ASK ); + safestrncpy(newpin, RFIFOP(fd, 10), sizeof(newpin)); + pincode->decrypt(sd->pincode_seed, newpin); + + if (pincode->check_blacklist && pincode->isBlacklisted(newpin)) { + pincode->editstate(fd, sd, PINCODE_EDIT_RESTRICT_PW); + } else { + pincode->update(sd->account_id, newpin); + safestrncpy(sd->pincode, newpin, sizeof(sd->pincode)); + pincode->editstate(fd, sd, PINCODE_EDIT_SUCCESS); + } + + pincode->loginstate(fd, sd, PINCODE_LOGIN_ASK); } -void pincode_setnew(int fd, struct char_session_data* sd) { +void pincode_setnew(int fd, struct char_session_data* sd) +{ char newpin[5] = "\0\0\0\0"; nullpo_retv(sd); + if (strlen(sd->pincode) == 4) return; - safestrncpy(newpin, RFIFOP(fd,6), sizeof(newpin)); - pincode->decrypt(sd->pincode_seed,newpin); - pincode->update( sd->account_id, newpin ); + + safestrncpy(newpin, RFIFOP(fd, 6), sizeof(newpin)); + pincode->decrypt(sd->pincode_seed, newpin); + + if (pincode->check_blacklist && pincode->isBlacklisted(newpin)) { + pincode->makestate(fd, sd, PINCODE_MAKE_RESTRICT_PW); + return; + } + + pincode->update(sd->account_id, newpin); safestrncpy(sd->pincode, newpin, sizeof(sd->pincode)); - pincode->sendstate( fd, sd, PINCODE_ASK ); + pincode->makestate(fd, sd, PINCODE_MAKE_SUCCESS); +} + +/** +* Send state of making new pincode +* +* @param[in] fd +* @param[in, out] sd Session Data +* @param[in] state Pincode Edit State +*/ +void pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state) +{ + nullpo_retv(sd); + + WFIFOHEAD(fd, 8); + WFIFOW(fd, 0) = 0x8bb; + WFIFOW(fd, 2) = state; + WFIFOW(fd, 4) = 0; + WFIFOSET(fd, 8); +} + +/** +* Send state of editing pincode +* +* @param[in] fd +* @param[in, out] sd Session Data +* @param[in] state Pincode Edit State +*/ +void pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state) +{ + nullpo_retv(sd); + + WFIFOHEAD(fd, 8); + WFIFOW(fd, 0) = 0x8bf; + WFIFOW(fd, 2) = state; + WFIFOW(fd, 4) = sd->pincode_seed = rnd() % 0xFFFF; + WFIFOSET(fd, 8); } // 0 = pin is correct @@ -137,50 +236,57 @@ void pincode_setnew(int fd, struct char_session_data* sd) { // 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 -void pincode_sendstate(int fd, struct char_session_data* sd, uint16 state) { +void pincode_loginstate(int fd, struct char_session_data* sd, enum pincode_login_response state) +{ nullpo_retv(sd); + WFIFOHEAD(fd, 12); WFIFOW(fd, 0) = 0x8b9; WFIFOL(fd, 2) = sd->pincode_seed = rnd() % 0xFFFF; WFIFOL(fd, 6) = sd->account_id; - WFIFOW(fd,10) = state; - WFIFOSET(fd,12); + WFIFOW(fd, 10) = state; + WFIFOSET(fd, 12); } -void pincode_notifyLoginPinUpdate(int account_id, char* pin) { +void pincode_notifyLoginPinUpdate(int account_id, char* pin) +{ nullpo_retv(pin); + Assert_retv(chr->login_fd != -1); - WFIFOHEAD(chr->login_fd,11); - WFIFOW(chr->login_fd,0) = 0x2738; - WFIFOL(chr->login_fd,2) = account_id; - safestrncpy(WFIFOP(chr->login_fd,6), pin, 5); - WFIFOSET(chr->login_fd,11); + WFIFOHEAD(chr->login_fd, 11); + WFIFOW(chr->login_fd, 0) = 0x2738; + WFIFOL(chr->login_fd, 2) = account_id; + safestrncpy(WFIFOP(chr->login_fd, 6), pin, 5); + WFIFOSET(chr->login_fd, 11); } -void pincode_notifyLoginPinError(int account_id) { - WFIFOHEAD(chr->login_fd,6); - WFIFOW(chr->login_fd,0) = 0x2739; - WFIFOL(chr->login_fd,2) = account_id; - WFIFOSET(chr->login_fd,6); +void pincode_notifyLoginPinError(int account_id) +{ + WFIFOHEAD(chr->login_fd, 6); + WFIFOW(chr->login_fd, 0) = 0x2739; + WFIFOL(chr->login_fd, 2) = account_id; + WFIFOSET(chr->login_fd, 6); } -void pincode_decrypt(unsigned int userSeed, char* pin) { +void pincode_decrypt(unsigned int userSeed, char* pin) +{ int i; - char tab[10] = {0,1,2,3,4,5,6,7,8,9}; + char tab[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; nullpo_retv(pin); + for (i = 1; i < 10; i++) { int pos; userSeed = pincode->baseSeed + userSeed * pincode->multiplier; pos = userSeed % (i + 1); - if( i != pos ){ + if (i != pos) { tab[i] ^= tab[pos]; tab[pos] ^= tab[i]; tab[i] ^= tab[pos]; } } - for (i = 0; i < 4; i++ ) { + for (i = 0; i < 4; i++) { if (pin[i] < '0' || pin[i] > '9') pin[i] = '0'; else @@ -202,6 +308,8 @@ void pincode_decrypt(unsigned int userSeed, char* pin) { bool pincode_config_read(const char *filename, const struct config_t *config, bool imported) { const struct config_setting_t *setting = NULL; + const struct config_setting_t *temp = NULL; + nullpo_retr(false, filename); nullpo_retr(false, config); @@ -238,28 +346,93 @@ bool pincode_config_read(const char *filename, const struct config_t *config, bo } } + if (libconfig->setting_lookup_bool_real(setting, "check_blacklisted", &pincode->check_blacklist) == CONFIG_FALSE) { + if (!imported) { + ShowWarning("pincode 'check_blaclisted' not found, defaulting to false...\n"); + pincode->check_blacklist = false; + } + } + + if (pincode->check_blacklist) { + if ((temp = libconfig->setting_get_member(setting, "blacklist")) != NULL) { + VECTOR_DECL(char *) duplicate; + int i, j, size = libconfig->setting_length(temp); + VECTOR_INIT(duplicate); + VECTOR_ENSURE(duplicate, size, 1); + for (i = 0; i < size; i++) { + const char *pin = libconfig->setting_get_string_elem(temp, i); + + if (pin == NULL) + continue; + + if (strlen(pin) != 4) { + ShowError("Wrong size on element %d of blacklist. Desired size = 4, received = %d\n", i, (int)strlen(pin)); + continue; + } + + ARR_FIND(0, VECTOR_LENGTH(duplicate), j, strcmp(VECTOR_INDEX(duplicate, j), pin) == 0); + + if (j < VECTOR_LENGTH(duplicate)) { + ShowWarning("Duplicate pin on pincode blacklist. Item #%d\n", i); + continue; + } + + VECTOR_ENSURE(pincode->blacklist, 1, 1); + VECTOR_PUSH(pincode->blacklist, aStrdup(pin)); + VECTOR_PUSH(duplicate, aStrdup(pin)); + } + while (VECTOR_LENGTH(duplicate) > 0) { + aFree(VECTOR_POP(duplicate)); + } + VECTOR_CLEAR(duplicate); + } else if (!imported) { + ShowError("Pincode Blacklist Check is enabled but there's no blacklist setting! Disabling check.\n"); + pincode->check_blacklist = false; + } + } + return true; } -void pincode_defaults(void) { +void do_pincode_init(void) +{ + VECTOR_INIT(pincode->blacklist); +} + +void do_pincode_final(void) +{ + while (VECTOR_LENGTH(pincode->blacklist) > 0) { + aFree(VECTOR_POP(pincode->blacklist)); + } + VECTOR_CLEAR(pincode->blacklist); +} + +void pincode_defaults(void) +{ pincode = &pincode_s; - pincode->enabled = PINCODE_OK; + pincode->enabled = 0; pincode->changetime = 0; pincode->maxtry = 3; pincode->charselect = 0; + pincode->check_blacklist = false; pincode->multiplier = 0x3498; pincode->baseSeed = 0x881234; + pincode->init = do_pincode_init; + pincode->final = do_pincode_final; + pincode->handle = pincode_handle; pincode->decrypt = pincode_decrypt; pincode->error = pincode_notifyLoginPinError; pincode->update = pincode_notifyLoginPinUpdate; - pincode->sendstate = pincode_sendstate; + pincode->makestate = pincode_makestate; + pincode->editstate = pincode_editstate; + pincode->loginstate = pincode_loginstate; pincode->setnew = pincode_setnew; pincode->change = pincode_change; + pincode->isBlacklisted = pincode_isBlacklisted; pincode->compare = pincode_compare; pincode->check = pincode_check; pincode->config_read = pincode_config_read; - } diff --git a/src/char/pincode.h b/src/char/pincode.h index cffaa3054..8e4f67c2d 100644 --- a/src/char/pincode.h +++ b/src/char/pincode.h @@ -22,18 +22,35 @@ #define CHAR_PINCODE_H #include "common/hercules.h" +#include "common/db.h" /* Forward Declarations */ struct char_session_data; struct config_t; // common/conf.h -enum PincodeResponseCode { - PINCODE_OK = 0, - PINCODE_ASK = 1, - PINCODE_NOTSET = 2, - PINCODE_EXPIRED = 3, - PINCODE_UNUSED = 7, - PINCODE_WRONG = 8, +enum pincode_make_response { + PINCODE_MAKE_SUCCESS = 0, + PINCODE_MAKE_DUPLICATED = 1, + PINCODE_MAKE_RESTRICT_PW = 2, + PINCODE_MAKE_PERSONALNUM_PW = 3, + PINCODE_MAKE_FAILED = 4, +}; + +enum pincode_edit_response { + PINCODE_EDIT_SUCCESS = 0x0, + PINCODE_EDIT_FAILED = 0x1, + PINCODE_EDIT_RESTRICT_PW = 0x2, + PINCODE_EDIT_PERSONALNUM_PW = 0x3, +}; + +enum pincode_login_response { + PINCODE_LOGIN_OK = 0, + PINCODE_LOGIN_ASK = 1, + PINCODE_LOGIN_NOTSET = 2, + PINCODE_LOGIN_EXPIRED = 3, + PINCODE_LOGIN_RESTRICT_PW = 5, + PINCODE_LOGIN_UNUSED = 7, + PINCODE_LOGIN_WRONG = 8, }; /** @@ -45,6 +62,8 @@ struct pincode_interface { int changetime; int maxtry; int charselect; + bool check_blacklist; + VECTOR_DECL(char *) blacklist; unsigned int multiplier; unsigned int baseSeed; /* handler */ @@ -52,12 +71,17 @@ struct pincode_interface { void (*decrypt) (unsigned int userSeed, char* pin); void (*error) (int account_id); void (*update) (int account_id, char* pin); - void (*sendstate) (int fd, struct char_session_data* sd, uint16 state); + 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 (*setnew) (int fd, struct char_session_data* sd); void (*change) (int fd, struct char_session_data* sd); + bool (*isBlacklisted) (const char *pin); int (*compare) (int fd, struct char_session_data* sd, char* pin); void (*check) (int fd, struct char_session_data* sd); bool (*config_read) (const char *filename, const struct config_t *config, bool imported); + void (*init) (void); + void (*final) (void); }; #ifdef HERCULES_CORE diff --git a/src/map/battle.c b/src/map/battle.c index 5f56599d7..49cc78f7e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6955,7 +6955,7 @@ static const struct battle_data { { "chase_range_rate", &battle_config.chase_range_rate, 100, 0, INT_MAX, }, { "gtb_sc_immunity", &battle_config.gtb_sc_immunity, 50, 0, INT_MAX, }, { "guild_max_castles", &battle_config.guild_max_castles, 0, 0, INT_MAX, }, - { "guild_skill_relog_delay", &battle_config.guild_skill_relog_delay, 0, 0, 1, }, + { "guild_skill_relog_delay", &battle_config.guild_skill_relog_delay, 0, 0, 2, }, { "emergency_call", &battle_config.emergency_call, 11, 0, 31, }, { "atcommand_spawn_quantity_limit", &battle_config.atc_spawn_quantity_limit, 100, 0, INT_MAX, }, { "atcommand_slave_clone_limit", &battle_config.atc_slave_clone_limit, 25, 0, INT_MAX, }, diff --git a/src/map/clif.c b/src/map/clif.c index 60f4b18c0..47d5a1586 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -819,7 +819,7 @@ void clif_dropflooritem(struct flooritem_data* fitem) { p.subX = fitem->subx; p.subY = fitem->suby; p.count = fitem->item_data.amount; -#ifdef PACKETVER_ZERO +#if defined(PACKETVER_ZERO) || PACKETVER >= 20180418 if (fitem->showdropeffect) { p.showdropeffect = itemdb_showdropeffect(fitem->item_data.nameid); p.dropeffectmode = itemdb_dropeffectmode(fitem->item_data.nameid); @@ -20519,7 +20519,7 @@ void clif_parse_open_ui_request(int fd, struct map_session_data *sd) void clif_open_ui(struct map_session_data *sd, int8 UIType) { -#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 +#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411 int claimed = 0; struct PACKET_ZC_OPEN_UI p; @@ -20542,14 +20542,14 @@ void clif_open_ui(struct map_session_data *sd, int8 UIType) clif->send(&p, sizeof(p), &sd->bl, SELF); #else - ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404.\n"); + ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411.\n"); #endif } void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) { -#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 +#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411 struct rodex_message msg = { 0 }; struct attendance_entry *entry; @@ -20593,7 +20593,7 @@ void clif_parse_attendance_reward_request(int fd, struct map_session_data *sd) intif->rodex_sendmail(&msg); clif->ui_action(sd, 0, sd->status.attendance_count); #else - ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404.\n"); + ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411.\n"); #endif } diff --git a/src/map/guild.c b/src/map/guild.c index d33df5e08..d9833a2f4 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -552,7 +552,7 @@ int guild_recv_info(const struct guild *sg) if ((sd = map->nick2sd(sg->master)) != NULL) { //If the guild master is online the first time the guild_info is received, //that means he was the first to join, so apply guild skill blocking here. - if( battle_config.guild_skill_relog_delay ) + if( battle_config.guild_skill_relog_delay == 1) guild->block_skill(sd, 300000); //Also set the guild master flag. @@ -760,7 +760,7 @@ void guild_member_joined(struct map_session_data *sd) // set the Guild Master flag sd->state.gmaster_flag = 1; // prevent Guild Skills from being used directly after relog - if( battle_config.guild_skill_relog_delay ) + if( battle_config.guild_skill_relog_delay == 1 ) guild->block_skill(sd, 300000); } i = guild->getindex(g, sd->status.account_id, sd->status.char_id); diff --git a/src/map/packets.h b/src/map/packets.h index db98cdc28..a723463b4 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -4087,4 +4087,13 @@ packet(0x96e,-1,clif->ackmergeitems); #endif #endif +#ifndef PACKETVER_ZERO +// 2018-04-18aRagexe, 2018-04-18bRagexeRE +#if PACKETVER >= 20180418 +// new packets + packet(0x0afb,-1,clif->pDull/*,XXX*/); +// changed packet sizes +#endif +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_keys_main.h b/src/map/packets_keys_main.h index 150fb486a..1f6a3ca6d 100644 --- a/src/map/packets_keys_main.h +++ b/src/map/packets_keys_main.h @@ -874,7 +874,7 @@ packetKeys(0x6A596301,0x76866D0E,0x32294A45); #endif -// 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE +// 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE #if PACKETVER == 20131223 || \ PACKETVER == 20140508 || \ PACKETVER == 20140611 || \ @@ -882,7 +882,8 @@ PACKETVER == 20180315 || \ PACKETVER == 20180321 || \ PACKETVER == 20180328 || \ - PACKETVER >= 20180404 + PACKETVER == 20180404 || \ + PACKETVER >= 20180418 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_keys_zero.h b/src/map/packets_keys_zero.h index 2bd6f1604..d9625f716 100644 --- a/src/map/packets_keys_zero.h +++ b/src/map/packets_keys_zero.h @@ -29,7 +29,7 @@ /* This file is autogenerated, please do not commit manual changes */ -// 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero +// 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero #if PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ PACKETVER == 20171024 || \ @@ -41,7 +41,8 @@ PACKETVER == 20171113 || \ PACKETVER == 20180315 || \ PACKETVER == 20180321 || \ - PACKETVER == 20180328 + PACKETVER == 20180328 || \ + PACKETVER >= 20180411 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_shuffle_main.h b/src/map/packets_shuffle_main.h index 16d480893..4bb998652 100644 --- a/src/map/packets_shuffle_main.h +++ b/src/map/packets_shuffle_main.h @@ -3345,13 +3345,14 @@ packet(0x0969,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE #endif -// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE +// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE #if PACKETVER == 20140611 || \ PACKETVER == 20150225 || \ PACKETVER == 20180315 || \ PACKETVER == 20180321 || \ PACKETVER == 20180328 || \ - PACKETVER >= 20180404 + PACKETVER == 20180404 || \ + PACKETVER >= 20180418 packet(0x0202,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS packet(0x022d,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER packet(0x023b,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD diff --git a/src/map/packets_shuffle_zero.h b/src/map/packets_shuffle_zero.h index 7cd52d971..087eb119f 100644 --- a/src/map/packets_shuffle_zero.h +++ b/src/map/packets_shuffle_zero.h @@ -36,7 +36,7 @@ /* This file is autogenerated, please do not commit manual changes */ -// 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero +// 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero #if PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ PACKETVER == 20171024 || \ @@ -48,7 +48,8 @@ PACKETVER == 20171113 || \ PACKETVER == 20180315 || \ PACKETVER == 20180321 || \ - PACKETVER == 20180328 + PACKETVER == 20180328 || \ + PACKETVER >= 20180411 packet(0x0202,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS packet(0x022d,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER packet(0x023b,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 438084778..5b9a4344a 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -191,7 +191,7 @@ enum packet_headers { skill_entryType = 0x9ca, #endif graffiti_entryType = 0x1c9, -#ifdef PACKETVER_ZERO +#if defined(PACKETVER_ZERO) || PACKETVER >= 20180418 dropflooritemType = 0xadd, #elif PACKETVER > 20130000 /* not sure date */ dropflooritemType = 0x84b, @@ -530,7 +530,7 @@ struct packet_dropflooritem { uint8 subX; uint8 subY; int16 count; -#ifdef PACKETVER_ZERO +#if defined(PACKETVER_ZERO) || PACKETVER >= 20180418 int8 showdropeffect; int16 dropeffectmode; #endif diff --git a/src/map/skill.c b/src/map/skill.c index 9108b6575..87e869ec7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -19030,9 +19030,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) if (DIFF_TICK32(cd->entry[i]->started + cd->entry[i]->duration, now) > tick) return 0; cd->entry[i]->duration = tick; -#if PACKETVER >= 20120604 cd->entry[i]->total = tick; -#endif cd->entry[i]->started = now; if( timer->settick(cd->entry[i]->timer,now+tick) != -1 ) return 0; @@ -19064,9 +19062,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) cd->entry[cd->cursor] = ers_alloc(skill->cd_entry_ers,struct skill_cd_entry); cd->entry[cd->cursor]->duration = tick; -#if PACKETVER >= 20120604 cd->entry[cd->cursor]->total = tick; -#endif cd->entry[cd->cursor]->skidx = idx; cd->entry[cd->cursor]->skill_id = skill_id; cd->entry[cd->cursor]->started = now; @@ -19715,8 +19711,16 @@ void skill_cooldown_load(struct map_session_data * sd) // process each individual cooldown associated with the character for( i = 0; i < cd->cursor; i++ ) { - cd->entry[i]->started = now; - cd->entry[i]->timer = timer->add(timer->gettick()+cd->entry[i]->duration,skill->blockpc_end,sd->bl.id,cd->entry[i]->skidx); + int64 remaining; + + if (battle_config.guild_skill_relog_delay == 2 && cd->entry[i]->skill_id >= GD_SKILLBASE && cd->entry[i]->skill_id < GD_MAX) { + remaining = cd->entry[i]->started + cd->entry[i]->total - now; + remaining = max(1, remaining); // expired cooldowns will be 1, so they'll expire in the normal way just after this. + } else { + cd->entry[i]->started = now; + remaining = cd->entry[i]->duration; + } + cd->entry[i]->timer = timer->add(timer->gettick() + remaining, skill->blockpc_end, sd->bl.id, cd->entry[i]->skidx); sd->blockskill[cd->entry[i]->skidx] = true; } } diff --git a/src/map/skill.h b/src/map/skill.h index d7590921a..3de7f7bdf 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1842,9 +1842,7 @@ struct s_skill_magicmushroom_db { struct skill_cd_entry { int duration;//milliseconds -#if PACKETVER >= 20120604 - int total;/* used for display on newer clients */ -#endif + int total;/* used when reducing offline cooldown and for display on newer clients */ short skidx;//the skill index entries belong to int64 started;/* gettick() of when it started, used vs duration to measure how much left upon logout */ int timer;/* timer id */ diff --git a/src/map/status.c b/src/map/status.c index b2f67735b..a39449b11 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -10189,8 +10189,8 @@ void status_change_start_stop_action(struct block_list *bl, enum sc_type type) * @param val3 Additional value (meaning depends on type). * @param val4 Additional value (meaning depends on type). * - * @retval 0 if no status change happened. - * @retval 1 if the status change was successfully applied. + * @retval false if no status change happened, or the other sc can be started regardless. + * @retval true if the status change was successfully applied and the other sc shouldn't be started. */ bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, struct status_change* sc, enum sc_type type, int undead_flag, int val1, int val2, int val3, int val4) { @@ -10200,14 +10200,22 @@ bool status_end_sc_before_start(struct block_list *bl, struct status_data *st, s switch (type) { case SC_BLESSING: - //TO-DO Blessing and Agi up should do 1 damage against players on Undead Status, even on PvM - //but cannot be plagiarized (this requires aegis investigation on packets and official behavior) [Brainstorm] - if ((!undead_flag && st->race != RC_DEMON) || bl->type == BL_PC) { - status_change_end(bl, SC_CURSE, INVALID_TIMER); - if (sc->data[SC_STONE] && sc->opt1 == OPT1_STONE) + // TODO: Blessing and Agi up should do 1 damage against players on Undead Status, even on PvM + // but cannot be plagiarized (this requires aegis investigation on packets and official behavior) [Brainstorm] + if ((undead_flag == 0 && st->race != RC_DEMON) || bl->type == BL_PC) { + bool prevent_start = false; + if (sc->data[SC_CURSE] != NULL) { + prevent_start = true; + status_change_end(bl, SC_CURSE, INVALID_TIMER); + } + if (sc->data[SC_STONE] != NULL && sc->opt1 == OPT1_STONE) { + prevent_start = true; status_change_end(bl, SC_STONE, INVALID_TIMER); + } + if (prevent_start) + return true; } - if (sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_HIGH) + if (sc->data[SC_SOULLINK] != NULL && sc->data[SC_SOULLINK]->val2 == SL_HIGH) status_change_end(bl, SC_SOULLINK, INVALID_TIMER); break; case SC_INC_AGI: diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index c11c9c3c0..d2b03c16c 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6068,18 +6068,28 @@ typedef void (*HPMHOOK_pre_pincode_error) (int *account_id); typedef void (*HPMHOOK_post_pincode_error) (int account_id); typedef void (*HPMHOOK_pre_pincode_update) (int *account_id, char **pin); typedef void (*HPMHOOK_post_pincode_update) (int account_id, char *pin); -typedef void (*HPMHOOK_pre_pincode_sendstate) (int *fd, struct char_session_data **sd, uint16 *state); -typedef void (*HPMHOOK_post_pincode_sendstate) (int fd, struct char_session_data *sd, uint16 state); +typedef void (*HPMHOOK_pre_pincode_makestate) (int *fd, struct char_session_data **sd, enum pincode_make_response *state); +typedef void (*HPMHOOK_post_pincode_makestate) (int fd, struct char_session_data *sd, enum pincode_make_response state); +typedef void (*HPMHOOK_pre_pincode_editstate) (int *fd, struct char_session_data **sd, enum pincode_edit_response *state); +typedef void (*HPMHOOK_post_pincode_editstate) (int fd, struct char_session_data *sd, enum pincode_edit_response state); +typedef void (*HPMHOOK_pre_pincode_loginstate) (int *fd, struct char_session_data **sd, enum pincode_login_response *state); +typedef void (*HPMHOOK_post_pincode_loginstate) (int fd, struct char_session_data *sd, enum pincode_login_response state); typedef void (*HPMHOOK_pre_pincode_setnew) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_pincode_setnew) (int fd, struct char_session_data *sd); typedef void (*HPMHOOK_pre_pincode_change) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_pincode_change) (int fd, struct char_session_data *sd); +typedef bool (*HPMHOOK_pre_pincode_isBlacklisted) (const char **pin); +typedef bool (*HPMHOOK_post_pincode_isBlacklisted) (bool retVal___, const char *pin); typedef int (*HPMHOOK_pre_pincode_compare) (int *fd, struct char_session_data **sd, char **pin); typedef int (*HPMHOOK_post_pincode_compare) (int retVal___, int fd, struct char_session_data *sd, char *pin); typedef void (*HPMHOOK_pre_pincode_check) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_pincode_check) (int fd, struct char_session_data *sd); typedef bool (*HPMHOOK_pre_pincode_config_read) (const char **filename, const struct config_t **config, bool *imported); typedef bool (*HPMHOOK_post_pincode_config_read) (bool retVal___, const char *filename, const struct config_t *config, bool imported); +typedef void (*HPMHOOK_pre_pincode_init) (void); +typedef void (*HPMHOOK_post_pincode_init) (void); +typedef void (*HPMHOOK_pre_pincode_final) (void); +typedef void (*HPMHOOK_post_pincode_final) (void); #endif // CHAR_PINCODE_H #ifdef MAP_QUEST_H /* quest */ typedef void (*HPMHOOK_pre_quest_init) (bool *minimal); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index d0b4ac5ce..d81709ff3 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1248,18 +1248,28 @@ struct { struct HPMHookPoint *HP_pincode_error_post; struct HPMHookPoint *HP_pincode_update_pre; struct HPMHookPoint *HP_pincode_update_post; - struct HPMHookPoint *HP_pincode_sendstate_pre; - struct HPMHookPoint *HP_pincode_sendstate_post; + struct HPMHookPoint *HP_pincode_makestate_pre; + struct HPMHookPoint *HP_pincode_makestate_post; + struct HPMHookPoint *HP_pincode_editstate_pre; + struct HPMHookPoint *HP_pincode_editstate_post; + struct HPMHookPoint *HP_pincode_loginstate_pre; + struct HPMHookPoint *HP_pincode_loginstate_post; struct HPMHookPoint *HP_pincode_setnew_pre; struct HPMHookPoint *HP_pincode_setnew_post; struct HPMHookPoint *HP_pincode_change_pre; struct HPMHookPoint *HP_pincode_change_post; + struct HPMHookPoint *HP_pincode_isBlacklisted_pre; + struct HPMHookPoint *HP_pincode_isBlacklisted_post; struct HPMHookPoint *HP_pincode_compare_pre; struct HPMHookPoint *HP_pincode_compare_post; struct HPMHookPoint *HP_pincode_check_pre; struct HPMHookPoint *HP_pincode_check_post; struct HPMHookPoint *HP_pincode_config_read_pre; struct HPMHookPoint *HP_pincode_config_read_post; + struct HPMHookPoint *HP_pincode_init_pre; + struct HPMHookPoint *HP_pincode_init_post; + struct HPMHookPoint *HP_pincode_final_pre; + struct HPMHookPoint *HP_pincode_final_post; struct HPMHookPoint *HP_rnd_init_pre; struct HPMHookPoint *HP_rnd_init_post; struct HPMHookPoint *HP_rnd_final_pre; @@ -2777,18 +2787,28 @@ struct { int HP_pincode_error_post; int HP_pincode_update_pre; int HP_pincode_update_post; - int HP_pincode_sendstate_pre; - int HP_pincode_sendstate_post; + int HP_pincode_makestate_pre; + int HP_pincode_makestate_post; + int HP_pincode_editstate_pre; + int HP_pincode_editstate_post; + int HP_pincode_loginstate_pre; + int HP_pincode_loginstate_post; int HP_pincode_setnew_pre; int HP_pincode_setnew_post; int HP_pincode_change_pre; int HP_pincode_change_post; + int HP_pincode_isBlacklisted_pre; + int HP_pincode_isBlacklisted_post; int HP_pincode_compare_pre; int HP_pincode_compare_post; int HP_pincode_check_pre; int HP_pincode_check_post; int HP_pincode_config_read_pre; int HP_pincode_config_read_post; + int HP_pincode_init_pre; + int HP_pincode_init_post; + int HP_pincode_final_pre; + int HP_pincode_final_post; int HP_rnd_init_pre; int HP_rnd_init_post; int HP_rnd_final_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 36a115e1b..26ee54453 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -666,12 +666,17 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pincode->decrypt, HP_pincode_decrypt) }, { HP_POP(pincode->error, HP_pincode_error) }, { HP_POP(pincode->update, HP_pincode_update) }, - { HP_POP(pincode->sendstate, HP_pincode_sendstate) }, + { HP_POP(pincode->makestate, HP_pincode_makestate) }, + { HP_POP(pincode->editstate, HP_pincode_editstate) }, + { HP_POP(pincode->loginstate, HP_pincode_loginstate) }, { HP_POP(pincode->setnew, HP_pincode_setnew) }, { HP_POP(pincode->change, HP_pincode_change) }, + { HP_POP(pincode->isBlacklisted, HP_pincode_isBlacklisted) }, { HP_POP(pincode->compare, HP_pincode_compare) }, { HP_POP(pincode->check, HP_pincode_check) }, { HP_POP(pincode->config_read, HP_pincode_config_read) }, + { HP_POP(pincode->init, HP_pincode_init) }, + { HP_POP(pincode->final, HP_pincode_final) }, /* rnd_interface */ { HP_POP(rnd->init, HP_rnd_init) }, { HP_POP(rnd->final, HP_rnd_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 6ea10f78f..fdec7feea 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -16353,13 +16353,13 @@ void HP_pincode_update(int account_id, char *pin) { } return; } -void HP_pincode_sendstate(int fd, struct char_session_data *sd, uint16 state) { +void HP_pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state) { int hIndex = 0; - if (HPMHooks.count.HP_pincode_sendstate_pre > 0) { - void (*preHookFunc) (int *fd, struct char_session_data **sd, uint16 *state); + if (HPMHooks.count.HP_pincode_makestate_pre > 0) { + void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_make_response *state); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_sendstate_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_pincode_sendstate_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_makestate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_makestate_pre[hIndex].func; preHookFunc(&fd, &sd, &state); } if (*HPMforce_return) { @@ -16368,12 +16368,64 @@ void HP_pincode_sendstate(int fd, struct char_session_data *sd, uint16 state) { } } { - HPMHooks.source.pincode.sendstate(fd, sd, state); + HPMHooks.source.pincode.makestate(fd, sd, state); } - if (HPMHooks.count.HP_pincode_sendstate_post > 0) { - void (*postHookFunc) (int fd, struct char_session_data *sd, uint16 state); - for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_sendstate_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_pincode_sendstate_post[hIndex].func; + if (HPMHooks.count.HP_pincode_makestate_post > 0) { + void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_make_response state); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_makestate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_makestate_post[hIndex].func; + postHookFunc(fd, sd, state); + } + } + return; +} +void HP_pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_editstate_pre > 0) { + void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_edit_response *state); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_editstate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_editstate_pre[hIndex].func; + preHookFunc(&fd, &sd, &state); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.editstate(fd, sd, state); + } + if (HPMHooks.count.HP_pincode_editstate_post > 0) { + void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_edit_response state); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_editstate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_editstate_post[hIndex].func; + postHookFunc(fd, sd, state); + } + } + return; +} +void HP_pincode_loginstate(int fd, struct char_session_data *sd, enum pincode_login_response state) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_loginstate_pre > 0) { + void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_login_response *state); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_loginstate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_loginstate_pre[hIndex].func; + preHookFunc(&fd, &sd, &state); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.loginstate(fd, sd, state); + } + if (HPMHooks.count.HP_pincode_loginstate_post > 0) { + void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_login_response state); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_loginstate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_loginstate_post[hIndex].func; postHookFunc(fd, sd, state); } } @@ -16431,6 +16483,33 @@ void HP_pincode_change(int fd, struct char_session_data *sd) { } return; } +bool HP_pincode_isBlacklisted(const char *pin) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_pincode_isBlacklisted_pre > 0) { + bool (*preHookFunc) (const char **pin); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_isBlacklisted_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_isBlacklisted_pre[hIndex].func; + retVal___ = preHookFunc(&pin); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pincode.isBlacklisted(pin); + } + if (HPMHooks.count.HP_pincode_isBlacklisted_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *pin); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_isBlacklisted_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_isBlacklisted_post[hIndex].func; + retVal___ = postHookFunc(retVal___, pin); + } + } + return retVal___; +} int HP_pincode_compare(int fd, struct char_session_data *sd, char *pin) { int hIndex = 0; int retVal___ = 0; @@ -16511,6 +16590,58 @@ bool HP_pincode_config_read(const char *filename, const struct config_t *config, } return retVal___; } +void HP_pincode_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.init(); + } + if (HPMHooks.count.HP_pincode_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_pincode_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.final(); + } + if (HPMHooks.count.HP_pincode_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* rnd_interface */ void HP_rnd_init(void) { int hIndex = 0; |