diff options
Diffstat (limited to 'src')
34 files changed, 988 insertions, 504 deletions
diff --git a/src/char/char.c b/src/char/char.c index 84cc1b688..de4c4c8f0 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -3803,41 +3803,6 @@ void char_parse_frommap_update_ip(int fd, int id) RFIFOSKIP(fd,6); } -void char_parse_frommap_request_stats_report(int fd) -{ - int sfd;/* stat server fd */ - struct hSockOpt opt; - RFIFOSKIP(fd, 2);/* we skip first 2 bytes which are the 0x3008, so we end up with a buffer equal to the one we send */ - - opt.silent = 1; - opt.setTimeo = 1; - - if ((sfd = sockt->make_connection(sockt->host2ip("stats.herc.ws"),(uint16)25427,&opt) ) == -1) { - RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ - RFIFOFLUSH(fd); - return;/* connection not possible, we drop the report */ - } - - sockt->session[sfd]->flag.server = 1;/* to ensure we won't drop our own packet */ - sockt->realloc_fifo(sfd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); - - WFIFOHEAD(sfd, RFIFOW(fd,2) ); - - memcpy(WFIFOP(sfd,0), RFIFOP(fd, 0), RFIFOW(fd,2)); - - WFIFOSET(sfd, RFIFOW(fd,2) ); - - do { - sockt->flush(sfd); - HSleep(1); - } while( !sockt->session[sfd]->flag.eof && sockt->session[sfd]->wdata_size ); - - sockt->close(sfd); - - RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */ - RFIFOFLUSH(fd); -} - void char_parse_frommap_scdata_update(int fd) { int account_id = RFIFOL(fd, 2); @@ -4068,14 +4033,6 @@ int char_parse_frommap(int fd) chr->parse_frommap_update_ip(fd, id); break; - case 0x3008: - if( RFIFOREST(fd) < RFIFOW(fd,4) ) - return 0;/* packet wasn't fully received yet (still fragmented) */ - else { - chr->parse_frommap_request_stats_report(fd); - } - break; - /* individual sc data insertion/update */ case 0x2740: if( RFIFOREST(fd) < 28 ) @@ -5012,7 +4969,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 +6116,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 +6263,7 @@ int do_init(int argc, char **argv) { //Read map indexes mapindex->init(); + pincode->init(); #ifdef RENEWAL start_point.map = mapindex->name2id("iz_int"); @@ -6575,7 +6534,6 @@ void char_defaults(void) chr->map_auth_failed = char_map_auth_failed; chr->parse_frommap_auth_request = char_parse_frommap_auth_request; chr->parse_frommap_update_ip = char_parse_frommap_update_ip; - chr->parse_frommap_request_stats_report = char_parse_frommap_request_stats_report; chr->parse_frommap_scdata_update = char_parse_frommap_scdata_update; chr->parse_frommap_scdata_delete = char_parse_frommap_scdata_delete; chr->parse_frommap = char_parse_frommap; diff --git a/src/char/char.h b/src/char/char.h index 3689690c7..93b236966 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -225,7 +225,6 @@ struct char_interface { void (*map_auth_failed) (int fd, int account_id, int char_id, int login_id1, char sex, uint32 ip); void (*parse_frommap_auth_request) (int fd, int id); void (*parse_frommap_update_ip) (int fd, int id); - void (*parse_frommap_request_stats_report) (int fd); void (*parse_frommap_scdata_update) (int fd); void (*parse_frommap_scdata_delete) (int fd); int (*parse_frommap) (int fd); diff --git a/src/char/inter.c b/src/char/inter.c index b095a046d..cd363e8a2 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -1411,7 +1411,6 @@ int inter_parse_frommap(int fd) case 0x3005: mapif->parse_RegistryRequest(fd); break; case 0x3006: mapif->parse_NameChangeRequest(fd); break; case 0x3007: mapif->parse_accinfo(fd); break; - /* 0x3008 is used by the report stuff */ default: if( inter_party->parse_frommap(fd) || inter_guild->parse_frommap(fd) 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/config/core.h b/src/config/core.h index bdc7f3eee..a22d47324 100644 --- a/src/config/core.h +++ b/src/config/core.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -58,10 +58,6 @@ /// Maximum number of characters 'CONSOLE_INPUT' will support per line. #define MAX_CONSOLE_INPUT 150 -/// Uncomment to disable Hercules' anonymous stat report -/// We kindly ask you to consider keeping it enabled, it helps us improve Hercules. -//#define STATS_OPT_OUT - /// Uncomment to enable the Cell Stack Limit mod. /// It's only config is the battle_config custom_cell_stack_limit. /// Only chars affected are those defined in BL_CHAR diff --git a/src/map/battle.c b/src/map/battle.c index 5f56599d7..f257f3c84 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -20,11 +20,10 @@ */ #define HERCULES_CORE -#include "config/core.h" // CELL_NOSTACK, CIRCULAR_AREA, CONSOLE_INPUT, HMAP_ZONE_DAMAGE_CAP_TYPE, OFFICIAL_WALKPATH, RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EDP, RENEWAL_EXP, RENEWAL_LVDMG, RE_LVL_DMOD(), RE_LVL_MDMOD(), RE_LVL_TMDMOD(), RE_SKILL_REDUCTION(), SCRIPT_CALLFUNC_CHECK, SECURE_NPCTIMEOUT, STATS_OPT_OUT +#include "config/core.h" // CELL_NOSTACK, CIRCULAR_AREA, CONSOLE_INPUT, HMAP_ZONE_DAMAGE_CAP_TYPE, OFFICIAL_WALKPATH, RENEWAL, RENEWAL_ASPD, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EDP, RENEWAL_EXP, RENEWAL_LVDMG, RE_LVL_DMOD(), RE_LVL_MDMOD(), RE_LVL_TMDMOD(), RE_SKILL_REDUCTION(), SCRIPT_CALLFUNC_CHECK, SECURE_NPCTIMEOUT #include "battle.h" #include "map/battleground.h" -#include "map/chrif.h" #include "map/clan.h" #include "map/clif.h" #include "map/elemental.h" @@ -6955,7 +6954,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, }, @@ -7324,168 +7323,6 @@ static const struct battle_data { { "features/enable_attendance_system", &battle_config.feature_enable_attendance_system,1, 0, 1, }, { "features/feature_attendance_endtime",&battle_config.feature_attendance_endtime, 1, 0, 99999999, }, }; -#ifndef STATS_OPT_OUT -/** - * Hercules anonymous statistic usage report -- packet is built here, and sent to char server to report. - **/ -void Hercules_report(char* date, char *time_c) { - int i, bd_size = ARRAYLENGTH(battle_data); - unsigned int config = 0; - char timestring[25]; - time_t curtime; - char* buf; - - enum config_table { - C_CIRCULAR_AREA = 0x0001, - C_CELLNOSTACK = 0x0002, - C_CONSOLE_INPUT = 0x0004, - C_SCRIPT_CALLFUNC_CHECK = 0x0008, - C_OFFICIAL_WALKPATH = 0x0010, - C_RENEWAL = 0x0020, - C_RENEWAL_CAST = 0x0040, - C_RENEWAL_DROP = 0x0080, - C_RENEWAL_EXP = 0x0100, - C_RENEWAL_LVDMG = 0x0200, - C_RENEWAL_EDP = 0x0400, - C_RENEWAL_ASPD = 0x0800, - C_SECURE_NPCTIMEOUT = 0x1000, - //C_SQL_DB_ITEM = 0x2000, - C_SQL_LOGS = 0x4000, - C_MEMWATCH = 0x8000, - C_DMALLOC = 0x10000, - C_GCOLLECT = 0x20000, - C_SEND_SHORTLIST = 0x40000, - //C_SQL_DB_MOB = 0x80000, - //C_SQL_DB_MOBSKILL = 0x100000, - C_PACKETVER_RE = 0x200000, - }; - - /* we get the current time */ - time(&curtime); - strftime(timestring, 24, "%Y-%m-%d %H:%M:%S", localtime(&curtime)); - -#ifdef CIRCULAR_AREA - config |= C_CIRCULAR_AREA; -#endif - -#ifdef CELL_NOSTACK - config |= C_CELLNOSTACK; -#endif - -#ifdef CONSOLE_INPUT - config |= C_CONSOLE_INPUT; -#endif - -#ifdef SCRIPT_CALLFUNC_CHECK - config |= C_SCRIPT_CALLFUNC_CHECK; -#endif - -#ifdef OFFICIAL_WALKPATH - config |= C_OFFICIAL_WALKPATH; -#endif - -#ifdef RENEWAL - config |= C_RENEWAL; -#endif - -#ifdef RENEWAL_CAST - config |= C_RENEWAL_CAST; -#endif - -#ifdef RENEWAL_DROP - config |= C_RENEWAL_DROP; -#endif - -#ifdef RENEWAL_EXP - config |= C_RENEWAL_EXP; -#endif - -#ifdef RENEWAL_LVDMG - config |= C_RENEWAL_LVDMG; -#endif - -#ifdef RENEWAL_EDP - config |= C_RENEWAL_EDP; -#endif - -#ifdef RENEWAL_ASPD - config |= C_RENEWAL_ASPD; -#endif - -#ifdef SECURE_NPCTIMEOUT - config |= C_SECURE_NPCTIMEOUT; -#endif - -#ifdef PACKETVER_RE - config |= C_PACKETVER_RE; -#endif - - /* non-define part */ - if( logs->config.sql_logs ) - config |= C_SQL_LOGS; - -#ifdef MEMWATCH - config |= C_MEMWATCH; -#endif -#ifdef DMALLOC - config |= C_DMALLOC; -#endif -#ifdef GCOLLECT - config |= C_GCOLLECT; -#endif - -#ifdef SEND_SHORTLIST - config |= C_SEND_SHORTLIST; -#endif - -#define BFLAG_LENGTH 35 - - CREATE(buf, char, 262 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) + 1 ); - - /* build packet */ - - WBUFW(buf,0) = 0x3000; - WBUFW(buf,2) = 262 + ( bd_size * ( BFLAG_LENGTH + 4 ) ); - WBUFW(buf,4) = 0x9f; - - safestrncpy(WBUFP(buf,6), date, 12); - safestrncpy(WBUFP(buf,18), time_c, 9); - safestrncpy(WBUFP(buf,27), timestring, 24); - - safestrncpy(WBUFP(buf,51), sysinfo->platform(), 16); - safestrncpy(WBUFP(buf,67), sysinfo->osversion(), 50); - safestrncpy(WBUFP(buf,117), sysinfo->cpu(), 32); - WBUFL(buf,149) = sysinfo->cpucores(); - safestrncpy(WBUFP(buf,153), sysinfo->arch(), 8); - WBUFB(buf,161) = sysinfo->vcstypeid(); - WBUFB(buf,162) = sysinfo->is64bit(); - safestrncpy(WBUFP(buf,163), sysinfo->vcsrevision_src(), 41); - safestrncpy(WBUFP(buf,204), sysinfo->vcsrevision_scripts(), 41); - WBUFB(buf,245) = (sysinfo->is_superuser()? 1 : 0); - WBUFL(buf,246) = map->getusers(); - - WBUFL(buf,250) = config; - WBUFL(buf,254) = PACKETVER; - - WBUFL(buf,258) = bd_size; - for( i = 0; i < bd_size; i++ ) { - safestrncpy(WBUFP(buf,262 + ( i * ( BFLAG_LENGTH + 4 ) ) ), battle_data[i].str, BFLAG_LENGTH); - WBUFL(buf,262 + BFLAG_LENGTH + ( i * ( BFLAG_LENGTH + 4 ) ) ) = *battle_data[i].val; - } - - chrif->send_report(buf, 262 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) ); - - aFree(buf); - -#undef BFLAG_LENGTH -} -static int Hercules_report_timer(int tid, int64 tick, int id, intptr_t data) { - if( chrif->isconnected() ) {/* char server relays it, so it must be online. */ - Hercules_report(__DATE__,__TIME__); - } - return 0; -} -#endif bool battle_set_value_sub(int index, int value) { @@ -7694,12 +7531,6 @@ void do_init_battle(bool minimal) { battle->delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.c::delay_damage_ers",ERS_OPT_CLEAR); timer->add_func_list(battle->delay_damage_sub, "battle_delay_damage_sub"); - -#ifndef STATS_OPT_OUT - timer->add_func_list(Hercules_report_timer, "Hercules_report_timer"); - timer->add_interval(timer->gettick()+30000, Hercules_report_timer, 0, 0, 60000 * 30); -#endif - } void do_final_battle(void) { diff --git a/src/map/chrif.c b/src/map/chrif.c index 96f144523..13e88b15b 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -20,7 +20,7 @@ */ #define HERCULES_CORE -#include "config/core.h" // AUTOTRADE_PERSISTENCY, STATS_OPT_OUT +#include "config/core.h" // AUTOTRADE_PERSISTENCY #include "chrif.h" #include "map/battle.h" @@ -1561,22 +1561,6 @@ bool chrif_removefriend(int char_id, int friend_id) return true; } -void chrif_send_report(char* buf, int len) { -#ifndef STATS_OPT_OUT - if( chrif->fd > 0 ) { - nullpo_retv(buf); - WFIFOHEAD(chrif->fd,len + 2); - - WFIFOW(chrif->fd,0) = 0x3008; - memcpy(WFIFOP(chrif->fd,2), buf, len); - - WFIFOSET(chrif->fd,len + 2); - - sockt->flush(chrif->fd); /* ensure it's sent now. */ - } -#endif -} - /** * Sends a single scdata for saving into char server, meant to ensure integrity of duration-less conditions **/ @@ -1756,7 +1740,6 @@ void chrif_defaults(void) { chrif->divorce = chrif_divorce; chrif->removefriend = chrif_removefriend; - chrif->send_report = chrif_send_report; chrif->flush = chrif_flush; chrif->skillid2idx = chrif_skillid2idx; diff --git a/src/map/chrif.h b/src/map/chrif.h index 615521e0f..78910d24b 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team + * Copyright (C) 2012-2018 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -124,7 +124,6 @@ struct chrif_interface { bool (*divorce) (int partner_id1, int partner_id2); bool (*removefriend) (int char_id, int friend_id); - void (*send_report) (char* buf, int len); bool (*flush) (void); void (*skillid2idx) (int fd); 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/map.c b/src/map/map.c index 780e6f535..90b304865 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3166,13 +3166,13 @@ void map_iwall_get(struct map_session_data *sd) dbi_destroy(iter); } -void map_iwall_remove(const char *wall_name) +bool map_iwall_remove(const char *wall_name) { struct iwall_data *iwall; int16 i, x1, y1; if( (iwall = (struct iwall_data *)strdb_get(map->iwall_db, wall_name)) == NULL ) - return; // Nothing to do + return false; for( i = 0; i < iwall->size; i++ ) { map->iwall_nextxy(iwall->x, iwall->y, iwall->dir, i, &x1, &y1); @@ -3185,6 +3185,7 @@ void map_iwall_remove(const char *wall_name) map->list[iwall->m].iwall_num--; strdb_remove(map->iwall_db, iwall->wall_name); + return true; } /** diff --git a/src/map/map.h b/src/map/map.h index 5c4c6d59d..d6afdc160 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1293,7 +1293,7 @@ END_ZEROED_BLOCK; bool (*iwall_set) (int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name); void (*iwall_get) (struct map_session_data *sd); - void (*iwall_remove) (const char *wall_name); + bool (*iwall_remove) (const char *wall_name); int (*addmobtolist) (unsigned short m, struct spawn_data *spawn); // [Wizputer] void (*spawnmobs) (int16 m); // [Wizputer] 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/pc.c b/src/map/pc.c index ee1fcd7da..8dd216f55 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -249,11 +249,18 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max) memmove(sd->spirit_timer+i+1, sd->spirit_timer+i, (sd->spiritball-i)*sizeof(int)); sd->spirit_timer[i] = tid; sd->spiritball++; + pc->addspiritball_sub(sd); + + return 0; +} + +int pc_addspiritball_sub(struct map_session_data *sd) +{ + nullpo_ret(sd); if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) clif->millenniumshield(&sd->bl,sd->spiritball); else clif->spiritball(&sd->bl); - return 0; } @@ -287,14 +294,22 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type) sd->spirit_timer[i] = INVALID_TIMER; } - if(!type) { - if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) - clif->millenniumshield(&sd->bl,sd->spiritball); - else - clif->spiritball(&sd->bl); + if (!type) { + pc->delspiritball_sub(sd); } return 0; } + +int pc_delspiritball_sub(struct map_session_data *sd) +{ + nullpo_ret(sd); + if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) + clif->millenniumshield(&sd->bl,sd->spiritball); + else + clif->spiritball(&sd->bl); + return 0; +} + int pc_check_banding(struct block_list *bl, va_list ap) { int *c, *b_sd; @@ -1586,6 +1601,30 @@ int pc_calc_skillpoint(struct map_session_data* sd) { return skill_point; } +void pc_calc_skilltree_clear(struct map_session_data *sd) +{ + int i; + + nullpo_retv(sd); + + for (i = 0; i < MAX_SKILL_DB; i++) { + if (sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED) //Don't touch these + sd->status.skill[i].id = 0; //First clear skills. + /* permanent skills that must be re-checked */ + if (sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) { + switch (skill->dbs->db[i].nameid) { + case NV_TRICKDEAD: + if ((sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { + sd->status.skill[i].id = 0; + sd->status.skill[i].lv = 0; + sd->status.skill[i].flag = 0; + } + break; + } + } + } +} + /*========================================== * Calculation of skill level. *------------------------------------------*/ @@ -1604,22 +1643,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } classidx = pc->class2idx(class); - for (i = 0; i < MAX_SKILL_DB; i++) { - if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these - sd->status.skill[i].id = 0; //First clear skills. - /* permanent skills that must be re-checked */ - if( sd->status.skill[i].flag == SKILL_FLAG_PERMANENT ) { - switch( skill->dbs->db[i].nameid ) { - case NV_TRICKDEAD: - if ((sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { - sd->status.skill[i].id = 0; - sd->status.skill[i].lv = 0; - sd->status.skill[i].flag = 0; - } - break; - } - } - } + pc->calc_skilltree_clear(sd); for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) @@ -1746,6 +1770,19 @@ int pc_calc_skilltree(struct map_session_data *sd) } } while(flag); + pc->calc_skilltree_bonus(sd, classidx); + + return 0; +} + +void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) +{ + int i; + int id = 0; + + nullpo_retv(sd); + Assert_retv(classidx >= 0 && classidx < CLASS_COUNT); + // if (classidx > 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 @@ -1771,8 +1808,6 @@ int pc_calc_skilltree(struct map_session_data *sd) sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class); } } - - return 0; } //Checks if you can learn a new skill after having leveled up a skill. @@ -6788,18 +6823,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) status_calc_pc(sd,SCO_FORCE); status_percent_heal(&sd->bl,100,100); - if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { - sc_start(NULL,&sd->bl,status->skill2sc(PR_KYRIE),100,1,skill->get_time(PR_KYRIE,1)); - sc_start(NULL,&sd->bl,status->skill2sc(PR_IMPOSITIO),100,1,skill->get_time(PR_IMPOSITIO,1)); - sc_start(NULL,&sd->bl,status->skill2sc(PR_MAGNIFICAT),100,1,skill->get_time(PR_MAGNIFICAT,1)); - sc_start(NULL,&sd->bl,status->skill2sc(PR_GLORIA),100,1,skill->get_time(PR_GLORIA,1)); - sc_start(NULL,&sd->bl,status->skill2sc(PR_SUFFRAGIUM),100,1,skill->get_time(PR_SUFFRAGIUM,1)); - if (sd->state.snovice_dead_flag) - sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead. - } else if ((sd->job & MAPID_BASEMASK) == MAPID_TAEKWON) { - sc_start(NULL,&sd->bl,status->skill2sc(AL_INCAGI),100,10,600000); - sc_start(NULL,&sd->bl,status->skill2sc(AL_BLESSING),100,10,600000); - } + pc->checkbaselevelup_sc(sd); clif->misceffect(&sd->bl,0); npc->script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT @@ -6810,6 +6834,24 @@ int pc_checkbaselevelup(struct map_session_data *sd) return 1; } +void pc_checkbaselevelup_sc(struct map_session_data *sd) +{ + nullpo_retv(sd); + + if ((sd->job & MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { + sc_start(NULL, &sd->bl, status->skill2sc(PR_KYRIE), 100, 1, skill->get_time(PR_KYRIE, 1)); + sc_start(NULL, &sd->bl, status->skill2sc(PR_IMPOSITIO), 100, 1, skill->get_time(PR_IMPOSITIO, 1)); + sc_start(NULL, &sd->bl, status->skill2sc(PR_MAGNIFICAT), 100, 1, skill->get_time(PR_MAGNIFICAT, 1)); + sc_start(NULL, &sd->bl, status->skill2sc(PR_GLORIA), 100, 1, skill->get_time(PR_GLORIA, 1)); + sc_start(NULL, &sd->bl, status->skill2sc(PR_SUFFRAGIUM), 100, 1, skill->get_time(PR_SUFFRAGIUM, 1)); + if (sd->state.snovice_dead_flag) + sd->state.snovice_dead_flag = 0; //Reenable steelbody resurrection on dead. + } else if ((sd->job & MAPID_BASEMASK) == MAPID_TAEKWON) { + sc_start(NULL, &sd->bl, status->skill2sc(AL_INCAGI), 100, 10, 600000); + sc_start(NULL, &sd->bl, status->skill2sc(AL_BLESSING), 100, 10, 600000); + } +} + void pc_baselevelchanged(struct map_session_data *sd) { int i; nullpo_retv(sd); @@ -7597,7 +7639,6 @@ int pc_resetskill(struct map_session_data* sd, int flag) } for (i = 1; i < MAX_SKILL_DB; i++) { - uint16 skill_id = 0; int lv = sd->status.skill[i].lv; if (lv < 1) continue; @@ -7606,19 +7647,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL) ) //Avoid reseting wedding/linker skills. continue; - skill_id = skill->dbs->db[i].nameid; - - // Don't reset trick dead if not a novice/baby - if (skill_id == NV_TRICKDEAD && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { - sd->status.skill[i].lv = 0; - sd->status.skill[i].flag = 0; - continue; - } - - // do not reset basic skill - if (skill_id == NV_BASIC && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) - continue; - if (skill_id == SU_BASIC_SKILL && (sd->job & MAPID_BASEMASK) != MAPID_SUMMONER) + if (pc->resetskill_job(sd, i)) continue; if( sd->status.skill[i].flag == SKILL_FLAG_PERM_GRANTED ) @@ -7673,6 +7702,30 @@ int pc_resetskill(struct map_session_data* sd, int flag) return skill_point; } +bool pc_resetskill_job(struct map_session_data* sd, int index) +{ + uint16 skill_id; + + nullpo_retr(false, sd); + Assert_retr(false, index >= 0 && index < MAX_SKILL_DB); + + skill_id = skill->dbs->db[index].nameid; + + // Don't reset trick dead if not a novice/baby + if (skill_id == NV_TRICKDEAD && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { + sd->status.skill[index].lv = 0; + sd->status.skill[index].flag = 0; + return true; + } + + // do not reset basic skill + if (skill_id == NV_BASIC && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) + return true; + if (skill_id == SU_BASIC_SKILL && (sd->job & MAPID_BASEMASK) != MAPID_SUMMONER) + return true; + return false; +} + /*========================================== * /resetfeel [Komurka] *------------------------------------------*/ @@ -8035,8 +8088,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { } // changed penalty options, added death by player if pk_mode [Valaris] - if( battle_config.death_penalty_type - && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty + if (battle_config.death_penalty_type + && pc->isDeathPenaltyJob(sd->job) && !map->list[sd->bl.m].flag.noexppenalty && !map_flag_gvg2(sd->bl.m) && !sd->sc.data[SC_BABY] && !sd->sc.data[SC_CASH_DEATHPENALTY] ) { @@ -8184,6 +8237,11 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { return 1; } +bool pc_isDeathPenaltyJob(uint16 job) +{ + return (job & MAPID_UPPERMASK) != MAPID_NOVICE; // only novices will receive no penalty +} + void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { nullpo_retv(sd); if(hp) clif->updatestatus(sd,SP_HP); @@ -11077,6 +11135,11 @@ int pc_split_atoui64(char* str, uint64* val, char sep, int max) return i; } +bool pc_read_skill_job_skip(short skill_id, int job_id) +{ + return skill_id == NV_TRICKDEAD && ((pc->jobid2mapid(job_id) & (MAPID_BASEMASK | JOBL_2)) != MAPID_NOVICE); // skip trickdead for non-novices +} + /** * Parses the skill tree config file. * @@ -11157,8 +11220,8 @@ void pc_read_skill_tree(void) ShowWarning("pc_read_skill_tree: '%s' can't inherit '%s', skill tree is full!\n", job_name, ijob_name); break; } - if (src->id == NV_TRICKDEAD && ((pc->jobid2mapid(job_id)&(MAPID_BASEMASK | JOBL_2)) != MAPID_NOVICE)) - continue; // skip trickdead for non-novices + if (pc->read_skill_job_skip(src->id, job_id)) + continue; dst = &pc->skill_tree[job_idx][cur]; dst->inherited = 1; if (dst->id == 0) { @@ -12211,6 +12274,8 @@ void pc_defaults(void) { pc->checkequip = pc_checkequip; pc->calc_skilltree = pc_calc_skilltree; + pc->calc_skilltree_bonus = pc_calc_skilltree_bonus; + pc->calc_skilltree_clear = pc_calc_skilltree_clear; pc->calc_skilltree_normalize_job = pc_calc_skilltree_normalize_job; pc->clean_skilltree = pc_clean_skilltree; @@ -12273,6 +12338,7 @@ void pc_defaults(void) { pc->maxbaselv = pc_maxbaselv; pc->maxjoblv = pc_maxjoblv; pc->checkbaselevelup = pc_checkbaselevelup; + pc->checkbaselevelup_sc = pc_checkbaselevelup_sc; pc->checkjoblevelup = pc_checkjoblevelup; pc->gainexp = pc_gainexp; pc->nextbaseexp = pc_nextbaseexp; @@ -12289,6 +12355,7 @@ void pc_defaults(void) { pc->resetlvl = pc_resetlvl; pc->resetstate = pc_resetstate; pc->resetskill = pc_resetskill; + pc->resetskill_job = pc_resetskill_job; pc->resetfeel = pc_resetfeel; pc->resethate = pc_resethate; pc->equipitem = pc_equipitem; @@ -12363,7 +12430,9 @@ void pc_defaults(void) { pc->delinvincibletimer = pc_delinvincibletimer; pc->addspiritball = pc_addspiritball; + pc->addspiritball_sub = pc_addspiritball_sub; pc->delspiritball = pc_delspiritball; + pc->delspiritball_sub = pc_delspiritball_sub; pc->addfame = pc_addfame; pc->fame_rank = pc_fame_rank; pc->famelist_type = pc_famelist_type; @@ -12417,6 +12486,7 @@ void pc_defaults(void) { pc->autosave = pc_autosave; pc->follow_timer = pc_follow_timer; pc->read_skill_tree = pc_read_skill_tree; + pc->read_skill_job_skip = pc_read_skill_job_skip; pc->clear_skill_tree = pc_clear_skill_tree; pc->isUseitem = pc_isUseitem; pc->show_steal = pc_show_steal; @@ -12458,4 +12528,6 @@ void pc_defaults(void) { pc->have_magnifier = pc_have_magnifier; pc->check_basicskill = pc_check_basicskill; + + pc->isDeathPenaltyJob = pc_isDeathPenaltyJob; } diff --git a/src/map/pc.h b/src/map/pc.h index e699e5750..49c102206 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -889,6 +889,8 @@ END_ZEROED_BLOCK; /* End */ int (*checkequip) (struct map_session_data *sd,int pos); int (*calc_skilltree) (struct map_session_data *sd); + void (*calc_skilltree_clear) (struct map_session_data *sd); + void (*calc_skilltree_bonus) (struct map_session_data *sd, int classidx); int (*calc_skilltree_normalize_job) (struct map_session_data *sd); int (*clean_skilltree) (struct map_session_data *sd); @@ -952,6 +954,7 @@ END_ZEROED_BLOCK; /* End */ int (*maxbaselv) (const struct map_session_data *sd); int (*maxjoblv) (const struct map_session_data *sd); int (*checkbaselevelup) (struct map_session_data *sd); + void (*checkbaselevelup_sc) (struct map_session_data *sd); int (*checkjoblevelup) (struct map_session_data *sd); bool (*gainexp) (struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest); uint64 (*nextbaseexp) (const struct map_session_data *sd); @@ -968,6 +971,7 @@ END_ZEROED_BLOCK; /* End */ int (*resetlvl) (struct map_session_data *sd,int type); int (*resetstate) (struct map_session_data *sd); int (*resetskill) (struct map_session_data *sd, int flag); + bool (*resetskill_job) (struct map_session_data *sd, int index); int (*resetfeel) (struct map_session_data *sd); int (*resethate) (struct map_session_data *sd); int (*equipitem) (struct map_session_data *sd,int n,int req_pos); @@ -1040,7 +1044,9 @@ END_ZEROED_BLOCK; /* End */ void (*delinvincibletimer) (struct map_session_data* sd); int (*addspiritball) (struct map_session_data *sd,int interval,int max); + int (*addspiritball_sub) (struct map_session_data *sd); int (*delspiritball) (struct map_session_data *sd,int count,int type); + int (*delspiritball_sub) (struct map_session_data *sd); int (*getmaxspiritball) (struct map_session_data *sd, int min); void (*addfame) (struct map_session_data *sd, int ranktype, int count); int (*fame_rank) (int char_id, int ranktype); @@ -1095,6 +1101,7 @@ END_ZEROED_BLOCK; /* End */ int (*autosave) (int tid, int64 tick, int id, intptr_t data); int (*follow_timer) (int tid, int64 tick, int id, intptr_t data); void (*read_skill_tree) (void); + bool (*read_skill_job_skip) (short skill_id, int job_id); void (*clear_skill_tree) (void); int (*isUseitem) (struct map_session_data *sd,int n); int (*show_steal) (struct block_list *bl,va_list ap); @@ -1137,6 +1144,7 @@ END_ZEROED_BLOCK; /* End */ bool (*process_chat_message) (struct map_session_data *sd, const char *message); void (*check_supernovice_call) (struct map_session_data *sd, const char *message); bool (*check_basicskill) (struct map_session_data *sd, int level); + bool (*isDeathPenaltyJob) (uint16 job); }; #ifdef HERCULES_CORE diff --git a/src/map/script.c b/src/map/script.c index f71eae012..8e6ad5dcf 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -13998,9 +13998,15 @@ BUILDIN(setwall) { map->iwall_set(m, x, y, size, dir, shootable, name); return true; } -BUILDIN(delwall) { + +BUILDIN(delwall) +{ const char *name = script_getstr(st,2); - map->iwall_remove(name); + + if (!map->iwall_remove(name)) { + ShowWarning("buildin_delwall: Non-existent '%s' provided.\n", name); + return false; + } return true; } 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..972d1eca9 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2333,6 +2333,18 @@ void status_calc_pc_additional(struct map_session_data* sd, enum e_status_calc_o return; } +void status_calc_pc_recover_hp(struct map_session_data* sd, struct status_data *bstatus) +{ + nullpo_retv(sd); + nullpo_retv(bstatus); + + if ((sd->job & MAPID_BASEMASK) == MAPID_NOVICE && (sd->job & JOBL_2) == 0 + && battle_config.restart_hp_rate < 50) + bstatus->hp = bstatus->max_hp>>1; + else + bstatus->hp = APPLY_RATE(bstatus->max_hp, battle_config.restart_hp_rate); +} + //Calculates player data from scratch without counting SC adjustments. //Should be invoked whenever players raise stats, learn passive skills or change equipment. int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) @@ -2874,11 +2886,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) bstatus->hp = bstatus->max_hp; bstatus->sp = bstatus->max_sp; } else { - if ((sd->job & MAPID_BASEMASK) == MAPID_NOVICE && (sd->job & JOBL_2) == 0 - && battle_config.restart_hp_rate < 50) - bstatus->hp = bstatus->max_hp>>1; - else - bstatus->hp = APPLY_RATE(bstatus->max_hp, battle_config.restart_hp_rate); + status->calc_pc_recover_hp(sd, bstatus); if(!bstatus->hp) bstatus->hp = 1; @@ -10189,8 +10197,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 +10208,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: @@ -13650,6 +13666,7 @@ void status_defaults(void) status->calc_pet_ = status_calc_pet_; status->calc_pc_ = status_calc_pc_; status->calc_pc_additional = status_calc_pc_additional; + status->calc_pc_recover_hp = status_calc_pc_recover_hp; status->calc_homunculus_ = status_calc_homunculus_; status->calc_mercenary_ = status_calc_mercenary_; status->calc_elemental_ = status_calc_elemental_; diff --git a/src/map/status.h b/src/map/status.h index 5a031fa48..5df439237 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2355,6 +2355,7 @@ struct status_interface { int (*calc_pet_) (struct pet_data* pd, enum e_status_calc_opt opt); int (*calc_pc_) (struct map_session_data* sd, enum e_status_calc_opt opt); void (*calc_pc_additional) (struct map_session_data* sd, enum e_status_calc_opt opt); + void (*calc_pc_recover_hp) (struct map_session_data* sd, struct status_data *bstatus); int (*calc_homunculus_) (struct homun_data *hd, enum e_status_calc_opt opt); int (*calc_mercenary_) (struct mercenary_data *md, enum e_status_calc_opt opt); int (*calc_elemental_) (struct elemental_data *ed, enum e_status_calc_opt opt); diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 3abef2b05..90d6945c2 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -592,8 +592,6 @@ typedef void (*HPMHOOK_pre_chr_parse_frommap_auth_request) (int *fd, int *id); typedef void (*HPMHOOK_post_chr_parse_frommap_auth_request) (int fd, int id); typedef void (*HPMHOOK_pre_chr_parse_frommap_update_ip) (int *fd, int *id); typedef void (*HPMHOOK_post_chr_parse_frommap_update_ip) (int fd, int id); -typedef void (*HPMHOOK_pre_chr_parse_frommap_request_stats_report) (int *fd); -typedef void (*HPMHOOK_post_chr_parse_frommap_request_stats_report) (int fd); typedef void (*HPMHOOK_pre_chr_parse_frommap_scdata_update) (int *fd); typedef void (*HPMHOOK_post_chr_parse_frommap_scdata_update) (int fd); typedef void (*HPMHOOK_pre_chr_parse_frommap_scdata_delete) (int *fd); @@ -832,8 +830,6 @@ typedef bool (*HPMHOOK_pre_chrif_divorce) (int *partner_id1, int *partner_id2); typedef bool (*HPMHOOK_post_chrif_divorce) (bool retVal___, int partner_id1, int partner_id2); typedef bool (*HPMHOOK_pre_chrif_removefriend) (int *char_id, int *friend_id); typedef bool (*HPMHOOK_post_chrif_removefriend) (bool retVal___, int char_id, int friend_id); -typedef void (*HPMHOOK_pre_chrif_send_report) (char **buf, int *len); -typedef void (*HPMHOOK_post_chrif_send_report) (char *buf, int len); typedef bool (*HPMHOOK_pre_chrif_flush) (void); typedef bool (*HPMHOOK_post_chrif_flush) (bool retVal___); typedef void (*HPMHOOK_pre_chrif_skillid2idx) (int *fd); @@ -4286,8 +4282,8 @@ typedef bool (*HPMHOOK_pre_map_iwall_set) (int16 *m, int16 *x, int16 *y, int *si typedef bool (*HPMHOOK_post_map_iwall_set) (bool retVal___, int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char *wall_name); typedef void (*HPMHOOK_pre_map_iwall_get) (struct map_session_data **sd); typedef void (*HPMHOOK_post_map_iwall_get) (struct map_session_data *sd); -typedef void (*HPMHOOK_pre_map_iwall_remove) (const char **wall_name); -typedef void (*HPMHOOK_post_map_iwall_remove) (const char *wall_name); +typedef bool (*HPMHOOK_pre_map_iwall_remove) (const char **wall_name); +typedef bool (*HPMHOOK_post_map_iwall_remove) (bool retVal___, const char *wall_name); typedef int (*HPMHOOK_pre_map_addmobtolist) (unsigned short *m, struct spawn_data **spawn); typedef int (*HPMHOOK_post_map_addmobtolist) (int retVal___, unsigned short m, struct spawn_data *spawn); typedef void (*HPMHOOK_pre_map_spawnmobs) (int16 *m); @@ -5562,6 +5558,10 @@ typedef int (*HPMHOOK_pre_pc_checkequip) (struct map_session_data **sd, int *pos typedef int (*HPMHOOK_post_pc_checkequip) (int retVal___, struct map_session_data *sd, int pos); typedef int (*HPMHOOK_pre_pc_calc_skilltree) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_calc_skilltree) (int retVal___, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_pc_calc_skilltree_clear) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_pc_calc_skilltree_clear) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_pc_calc_skilltree_bonus) (struct map_session_data **sd, int *classidx); +typedef void (*HPMHOOK_post_pc_calc_skilltree_bonus) (struct map_session_data *sd, int classidx); typedef int (*HPMHOOK_pre_pc_calc_skilltree_normalize_job) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_calc_skilltree_normalize_job) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_clean_skilltree) (struct map_session_data **sd); @@ -5658,6 +5658,8 @@ typedef int (*HPMHOOK_pre_pc_maxjoblv) (const struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_maxjoblv) (int retVal___, const struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_checkbaselevelup) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_checkbaselevelup) (int retVal___, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_pc_checkbaselevelup_sc) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_pc_checkbaselevelup_sc) (struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_checkjoblevelup) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_checkjoblevelup) (int retVal___, struct map_session_data *sd); typedef bool (*HPMHOOK_pre_pc_gainexp) (struct map_session_data **sd, struct block_list **src, uint64 *base_exp, uint64 *job_exp, bool *is_quest); @@ -5690,6 +5692,8 @@ typedef int (*HPMHOOK_pre_pc_resetstate) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_resetstate) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_resetskill) (struct map_session_data **sd, int *flag); typedef int (*HPMHOOK_post_pc_resetskill) (int retVal___, struct map_session_data *sd, int flag); +typedef bool (*HPMHOOK_pre_pc_resetskill_job) (struct map_session_data **sd, int *index); +typedef bool (*HPMHOOK_post_pc_resetskill_job) (bool retVal___, struct map_session_data *sd, int index); typedef int (*HPMHOOK_pre_pc_resetfeel) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_resetfeel) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_resethate) (struct map_session_data **sd); @@ -5810,8 +5814,12 @@ typedef void (*HPMHOOK_pre_pc_delinvincibletimer) (struct map_session_data **sd) typedef void (*HPMHOOK_post_pc_delinvincibletimer) (struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_addspiritball) (struct map_session_data **sd, int *interval, int *max); typedef int (*HPMHOOK_post_pc_addspiritball) (int retVal___, struct map_session_data *sd, int interval, int max); +typedef int (*HPMHOOK_pre_pc_addspiritball_sub) (struct map_session_data **sd); +typedef int (*HPMHOOK_post_pc_addspiritball_sub) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_delspiritball) (struct map_session_data **sd, int *count, int *type); typedef int (*HPMHOOK_post_pc_delspiritball) (int retVal___, struct map_session_data *sd, int count, int type); +typedef int (*HPMHOOK_pre_pc_delspiritball_sub) (struct map_session_data **sd); +typedef int (*HPMHOOK_post_pc_delspiritball_sub) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_getmaxspiritball) (struct map_session_data **sd, int *min); typedef int (*HPMHOOK_post_pc_getmaxspiritball) (int retVal___, struct map_session_data *sd, int min); typedef void (*HPMHOOK_pre_pc_addfame) (struct map_session_data **sd, int *ranktype, int *count); @@ -5900,6 +5908,8 @@ typedef int (*HPMHOOK_pre_pc_follow_timer) (int *tid, int64 *tick, int *id, intp typedef int (*HPMHOOK_post_pc_follow_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); typedef void (*HPMHOOK_pre_pc_read_skill_tree) (void); typedef void (*HPMHOOK_post_pc_read_skill_tree) (void); +typedef bool (*HPMHOOK_pre_pc_read_skill_job_skip) (short *skill_id, int *job_id); +typedef bool (*HPMHOOK_post_pc_read_skill_job_skip) (bool retVal___, short skill_id, int job_id); typedef void (*HPMHOOK_pre_pc_clear_skill_tree) (void); typedef void (*HPMHOOK_post_pc_clear_skill_tree) (void); typedef int (*HPMHOOK_pre_pc_isUseitem) (struct map_session_data **sd, int *n); @@ -5958,6 +5968,8 @@ typedef void (*HPMHOOK_pre_pc_check_supernovice_call) (struct map_session_data * typedef void (*HPMHOOK_post_pc_check_supernovice_call) (struct map_session_data *sd, const char *message); typedef bool (*HPMHOOK_pre_pc_check_basicskill) (struct map_session_data **sd, int *level); typedef bool (*HPMHOOK_post_pc_check_basicskill) (bool retVal___, struct map_session_data *sd, int level); +typedef bool (*HPMHOOK_pre_pc_isDeathPenaltyJob) (uint16 *job); +typedef bool (*HPMHOOK_post_pc_isDeathPenaltyJob) (bool retVal___, uint16 job); #endif // MAP_PC_H #ifdef MAP_NPC_H /* libpcre */ typedef pcre* (*HPMHOOK_pre_libpcre_compile) (const char **pattern, int *options, const char ***errptr, int **erroffset, const unsigned char **tableptr); @@ -6072,18 +6084,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); @@ -7298,6 +7320,8 @@ typedef int (*HPMHOOK_pre_status_calc_pc_) (struct map_session_data **sd, enum e typedef int (*HPMHOOK_post_status_calc_pc_) (int retVal___, struct map_session_data *sd, enum e_status_calc_opt opt); typedef void (*HPMHOOK_pre_status_calc_pc_additional) (struct map_session_data **sd, enum e_status_calc_opt *opt); typedef void (*HPMHOOK_post_status_calc_pc_additional) (struct map_session_data *sd, enum e_status_calc_opt opt); +typedef void (*HPMHOOK_pre_status_calc_pc_recover_hp) (struct map_session_data **sd, struct status_data **bstatus); +typedef void (*HPMHOOK_post_status_calc_pc_recover_hp) (struct map_session_data *sd, struct status_data *bstatus); typedef int (*HPMHOOK_pre_status_calc_homunculus_) (struct homun_data **hd, enum e_status_calc_opt *opt); typedef int (*HPMHOOK_post_status_calc_homunculus_) (int retVal___, struct homun_data *hd, enum e_status_calc_opt opt); typedef int (*HPMHOOK_pre_status_calc_mercenary_) (struct mercenary_data **md, enum e_status_calc_opt *opt); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index d0b4ac5ce..be39bf2ea 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -234,8 +234,6 @@ struct { struct HPMHookPoint *HP_chr_parse_frommap_auth_request_post; struct HPMHookPoint *HP_chr_parse_frommap_update_ip_pre; struct HPMHookPoint *HP_chr_parse_frommap_update_ip_post; - struct HPMHookPoint *HP_chr_parse_frommap_request_stats_report_pre; - struct HPMHookPoint *HP_chr_parse_frommap_request_stats_report_post; struct HPMHookPoint *HP_chr_parse_frommap_scdata_update_pre; struct HPMHookPoint *HP_chr_parse_frommap_scdata_update_post; struct HPMHookPoint *HP_chr_parse_frommap_scdata_delete_pre; @@ -1248,18 +1246,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; @@ -1763,8 +1771,6 @@ struct { int HP_chr_parse_frommap_auth_request_post; int HP_chr_parse_frommap_update_ip_pre; int HP_chr_parse_frommap_update_ip_post; - int HP_chr_parse_frommap_request_stats_report_pre; - int HP_chr_parse_frommap_request_stats_report_post; int HP_chr_parse_frommap_scdata_update_pre; int HP_chr_parse_frommap_scdata_update_post; int HP_chr_parse_frommap_scdata_delete_pre; @@ -2777,18 +2783,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..3ba47102c 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -132,7 +132,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chr->map_auth_failed, HP_chr_map_auth_failed) }, { HP_POP(chr->parse_frommap_auth_request, HP_chr_parse_frommap_auth_request) }, { HP_POP(chr->parse_frommap_update_ip, HP_chr_parse_frommap_update_ip) }, - { HP_POP(chr->parse_frommap_request_stats_report, HP_chr_parse_frommap_request_stats_report) }, { HP_POP(chr->parse_frommap_scdata_update, HP_chr_parse_frommap_scdata_update) }, { HP_POP(chr->parse_frommap_scdata_delete, HP_chr_parse_frommap_scdata_delete) }, { HP_POP(chr->parse_frommap, HP_chr_parse_frommap) }, @@ -666,12 +665,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..a15eccc0c 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -2788,32 +2788,6 @@ void HP_chr_parse_frommap_update_ip(int fd, int id) { } return; } -void HP_chr_parse_frommap_request_stats_report(int fd) { - int hIndex = 0; - if (HPMHooks.count.HP_chr_parse_frommap_request_stats_report_pre > 0) { - void (*preHookFunc) (int *fd); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_request_stats_report_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_chr_parse_frommap_request_stats_report_pre[hIndex].func; - preHookFunc(&fd); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.chr.parse_frommap_request_stats_report(fd); - } - if (HPMHooks.count.HP_chr_parse_frommap_request_stats_report_post > 0) { - void (*postHookFunc) (int fd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_parse_frommap_request_stats_report_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_chr_parse_frommap_request_stats_report_post[hIndex].func; - postHookFunc(fd); - } - } - return; -} void HP_chr_parse_frommap_scdata_update(int fd) { int hIndex = 0; if (HPMHooks.count.HP_chr_parse_frommap_scdata_update_pre > 0) { @@ -16353,13 +16327,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 +16342,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 +16457,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 +16564,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; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 1dcbdfa4c..d07c83187 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -430,8 +430,6 @@ struct { struct HPMHookPoint *HP_chrif_divorce_post; struct HPMHookPoint *HP_chrif_removefriend_pre; struct HPMHookPoint *HP_chrif_removefriend_post; - struct HPMHookPoint *HP_chrif_send_report_pre; - struct HPMHookPoint *HP_chrif_send_report_post; struct HPMHookPoint *HP_chrif_flush_pre; struct HPMHookPoint *HP_chrif_flush_post; struct HPMHookPoint *HP_chrif_skillid2idx_pre; @@ -4216,6 +4214,10 @@ struct { struct HPMHookPoint *HP_pc_checkequip_post; struct HPMHookPoint *HP_pc_calc_skilltree_pre; struct HPMHookPoint *HP_pc_calc_skilltree_post; + struct HPMHookPoint *HP_pc_calc_skilltree_clear_pre; + struct HPMHookPoint *HP_pc_calc_skilltree_clear_post; + struct HPMHookPoint *HP_pc_calc_skilltree_bonus_pre; + struct HPMHookPoint *HP_pc_calc_skilltree_bonus_post; struct HPMHookPoint *HP_pc_calc_skilltree_normalize_job_pre; struct HPMHookPoint *HP_pc_calc_skilltree_normalize_job_post; struct HPMHookPoint *HP_pc_clean_skilltree_pre; @@ -4312,6 +4314,8 @@ struct { struct HPMHookPoint *HP_pc_maxjoblv_post; struct HPMHookPoint *HP_pc_checkbaselevelup_pre; struct HPMHookPoint *HP_pc_checkbaselevelup_post; + struct HPMHookPoint *HP_pc_checkbaselevelup_sc_pre; + struct HPMHookPoint *HP_pc_checkbaselevelup_sc_post; struct HPMHookPoint *HP_pc_checkjoblevelup_pre; struct HPMHookPoint *HP_pc_checkjoblevelup_post; struct HPMHookPoint *HP_pc_gainexp_pre; @@ -4344,6 +4348,8 @@ struct { struct HPMHookPoint *HP_pc_resetstate_post; struct HPMHookPoint *HP_pc_resetskill_pre; struct HPMHookPoint *HP_pc_resetskill_post; + struct HPMHookPoint *HP_pc_resetskill_job_pre; + struct HPMHookPoint *HP_pc_resetskill_job_post; struct HPMHookPoint *HP_pc_resetfeel_pre; struct HPMHookPoint *HP_pc_resetfeel_post; struct HPMHookPoint *HP_pc_resethate_pre; @@ -4464,8 +4470,12 @@ struct { struct HPMHookPoint *HP_pc_delinvincibletimer_post; struct HPMHookPoint *HP_pc_addspiritball_pre; struct HPMHookPoint *HP_pc_addspiritball_post; + struct HPMHookPoint *HP_pc_addspiritball_sub_pre; + struct HPMHookPoint *HP_pc_addspiritball_sub_post; struct HPMHookPoint *HP_pc_delspiritball_pre; struct HPMHookPoint *HP_pc_delspiritball_post; + struct HPMHookPoint *HP_pc_delspiritball_sub_pre; + struct HPMHookPoint *HP_pc_delspiritball_sub_post; struct HPMHookPoint *HP_pc_getmaxspiritball_pre; struct HPMHookPoint *HP_pc_getmaxspiritball_post; struct HPMHookPoint *HP_pc_addfame_pre; @@ -4554,6 +4564,8 @@ struct { struct HPMHookPoint *HP_pc_follow_timer_post; struct HPMHookPoint *HP_pc_read_skill_tree_pre; struct HPMHookPoint *HP_pc_read_skill_tree_post; + struct HPMHookPoint *HP_pc_read_skill_job_skip_pre; + struct HPMHookPoint *HP_pc_read_skill_job_skip_post; struct HPMHookPoint *HP_pc_clear_skill_tree_pre; struct HPMHookPoint *HP_pc_clear_skill_tree_post; struct HPMHookPoint *HP_pc_isUseitem_pre; @@ -4612,6 +4624,8 @@ struct { struct HPMHookPoint *HP_pc_check_supernovice_call_post; struct HPMHookPoint *HP_pc_check_basicskill_pre; struct HPMHookPoint *HP_pc_check_basicskill_post; + struct HPMHookPoint *HP_pc_isDeathPenaltyJob_pre; + struct HPMHookPoint *HP_pc_isDeathPenaltyJob_post; struct HPMHookPoint *HP_libpcre_compile_pre; struct HPMHookPoint *HP_libpcre_compile_post; struct HPMHookPoint *HP_libpcre_study_pre; @@ -5906,6 +5920,8 @@ struct { struct HPMHookPoint *HP_status_calc_pc__post; struct HPMHookPoint *HP_status_calc_pc_additional_pre; struct HPMHookPoint *HP_status_calc_pc_additional_post; + struct HPMHookPoint *HP_status_calc_pc_recover_hp_pre; + struct HPMHookPoint *HP_status_calc_pc_recover_hp_post; struct HPMHookPoint *HP_status_calc_homunculus__pre; struct HPMHookPoint *HP_status_calc_homunculus__post; struct HPMHookPoint *HP_status_calc_mercenary__pre; @@ -6753,8 +6769,6 @@ struct { int HP_chrif_divorce_post; int HP_chrif_removefriend_pre; int HP_chrif_removefriend_post; - int HP_chrif_send_report_pre; - int HP_chrif_send_report_post; int HP_chrif_flush_pre; int HP_chrif_flush_post; int HP_chrif_skillid2idx_pre; @@ -10539,6 +10553,10 @@ struct { int HP_pc_checkequip_post; int HP_pc_calc_skilltree_pre; int HP_pc_calc_skilltree_post; + int HP_pc_calc_skilltree_clear_pre; + int HP_pc_calc_skilltree_clear_post; + int HP_pc_calc_skilltree_bonus_pre; + int HP_pc_calc_skilltree_bonus_post; int HP_pc_calc_skilltree_normalize_job_pre; int HP_pc_calc_skilltree_normalize_job_post; int HP_pc_clean_skilltree_pre; @@ -10635,6 +10653,8 @@ struct { int HP_pc_maxjoblv_post; int HP_pc_checkbaselevelup_pre; int HP_pc_checkbaselevelup_post; + int HP_pc_checkbaselevelup_sc_pre; + int HP_pc_checkbaselevelup_sc_post; int HP_pc_checkjoblevelup_pre; int HP_pc_checkjoblevelup_post; int HP_pc_gainexp_pre; @@ -10667,6 +10687,8 @@ struct { int HP_pc_resetstate_post; int HP_pc_resetskill_pre; int HP_pc_resetskill_post; + int HP_pc_resetskill_job_pre; + int HP_pc_resetskill_job_post; int HP_pc_resetfeel_pre; int HP_pc_resetfeel_post; int HP_pc_resethate_pre; @@ -10787,8 +10809,12 @@ struct { int HP_pc_delinvincibletimer_post; int HP_pc_addspiritball_pre; int HP_pc_addspiritball_post; + int HP_pc_addspiritball_sub_pre; + int HP_pc_addspiritball_sub_post; int HP_pc_delspiritball_pre; int HP_pc_delspiritball_post; + int HP_pc_delspiritball_sub_pre; + int HP_pc_delspiritball_sub_post; int HP_pc_getmaxspiritball_pre; int HP_pc_getmaxspiritball_post; int HP_pc_addfame_pre; @@ -10877,6 +10903,8 @@ struct { int HP_pc_follow_timer_post; int HP_pc_read_skill_tree_pre; int HP_pc_read_skill_tree_post; + int HP_pc_read_skill_job_skip_pre; + int HP_pc_read_skill_job_skip_post; int HP_pc_clear_skill_tree_pre; int HP_pc_clear_skill_tree_post; int HP_pc_isUseitem_pre; @@ -10935,6 +10963,8 @@ struct { int HP_pc_check_supernovice_call_post; int HP_pc_check_basicskill_pre; int HP_pc_check_basicskill_post; + int HP_pc_isDeathPenaltyJob_pre; + int HP_pc_isDeathPenaltyJob_post; int HP_libpcre_compile_pre; int HP_libpcre_compile_post; int HP_libpcre_study_pre; @@ -12229,6 +12259,8 @@ struct { int HP_status_calc_pc__post; int HP_status_calc_pc_additional_pre; int HP_status_calc_pc_additional_post; + int HP_status_calc_pc_recover_hp_pre; + int HP_status_calc_pc_recover_hp_post; int HP_status_calc_homunculus__pre; int HP_status_calc_homunculus__post; int HP_status_calc_mercenary__pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 7e10a4bad..488792200 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -236,7 +236,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chrif->changesex, HP_chrif_changesex) }, { HP_POP(chrif->divorce, HP_chrif_divorce) }, { HP_POP(chrif->removefriend, HP_chrif_removefriend) }, - { HP_POP(chrif->send_report, HP_chrif_send_report) }, { HP_POP(chrif->flush, HP_chrif_flush) }, { HP_POP(chrif->skillid2idx, HP_chrif_skillid2idx) }, { HP_POP(chrif->sd_to_auth, HP_chrif_sd_to_auth) }, @@ -2164,6 +2163,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->checkallowskill, HP_pc_checkallowskill) }, { HP_POP(pc->checkequip, HP_pc_checkequip) }, { HP_POP(pc->calc_skilltree, HP_pc_calc_skilltree) }, + { HP_POP(pc->calc_skilltree_clear, HP_pc_calc_skilltree_clear) }, + { HP_POP(pc->calc_skilltree_bonus, HP_pc_calc_skilltree_bonus) }, { HP_POP(pc->calc_skilltree_normalize_job, HP_pc_calc_skilltree_normalize_job) }, { HP_POP(pc->clean_skilltree, HP_pc_clean_skilltree) }, { HP_POP(pc->setpos, HP_pc_setpos) }, @@ -2212,6 +2213,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->maxbaselv, HP_pc_maxbaselv) }, { HP_POP(pc->maxjoblv, HP_pc_maxjoblv) }, { HP_POP(pc->checkbaselevelup, HP_pc_checkbaselevelup) }, + { HP_POP(pc->checkbaselevelup_sc, HP_pc_checkbaselevelup_sc) }, { HP_POP(pc->checkjoblevelup, HP_pc_checkjoblevelup) }, { HP_POP(pc->gainexp, HP_pc_gainexp) }, { HP_POP(pc->nextbaseexp, HP_pc_nextbaseexp) }, @@ -2228,6 +2230,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->resetlvl, HP_pc_resetlvl) }, { HP_POP(pc->resetstate, HP_pc_resetstate) }, { HP_POP(pc->resetskill, HP_pc_resetskill) }, + { HP_POP(pc->resetskill_job, HP_pc_resetskill_job) }, { HP_POP(pc->resetfeel, HP_pc_resetfeel) }, { HP_POP(pc->resethate, HP_pc_resethate) }, { HP_POP(pc->equipitem, HP_pc_equipitem) }, @@ -2288,7 +2291,9 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->setinvincibletimer, HP_pc_setinvincibletimer) }, { HP_POP(pc->delinvincibletimer, HP_pc_delinvincibletimer) }, { HP_POP(pc->addspiritball, HP_pc_addspiritball) }, + { HP_POP(pc->addspiritball_sub, HP_pc_addspiritball_sub) }, { HP_POP(pc->delspiritball, HP_pc_delspiritball) }, + { HP_POP(pc->delspiritball_sub, HP_pc_delspiritball_sub) }, { HP_POP(pc->getmaxspiritball, HP_pc_getmaxspiritball) }, { HP_POP(pc->addfame, HP_pc_addfame) }, { HP_POP(pc->fame_rank, HP_pc_fame_rank) }, @@ -2333,6 +2338,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->autosave, HP_pc_autosave) }, { HP_POP(pc->follow_timer, HP_pc_follow_timer) }, { HP_POP(pc->read_skill_tree, HP_pc_read_skill_tree) }, + { HP_POP(pc->read_skill_job_skip, HP_pc_read_skill_job_skip) }, { HP_POP(pc->clear_skill_tree, HP_pc_clear_skill_tree) }, { HP_POP(pc->isUseitem, HP_pc_isUseitem) }, { HP_POP(pc->show_steal, HP_pc_show_steal) }, @@ -2362,6 +2368,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->process_chat_message, HP_pc_process_chat_message) }, { HP_POP(pc->check_supernovice_call, HP_pc_check_supernovice_call) }, { HP_POP(pc->check_basicskill, HP_pc_check_basicskill) }, + { HP_POP(pc->isDeathPenaltyJob, HP_pc_isDeathPenaltyJob) }, /* pcre_interface */ { HP_POP(libpcre->compile, HP_libpcre_compile) }, { HP_POP(libpcre->study, HP_libpcre_study) }, @@ -3021,6 +3028,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(status->calc_pet_, HP_status_calc_pet_) }, { HP_POP(status->calc_pc_, HP_status_calc_pc_) }, { HP_POP(status->calc_pc_additional, HP_status_calc_pc_additional) }, + { HP_POP(status->calc_pc_recover_hp, HP_status_calc_pc_recover_hp) }, { HP_POP(status->calc_homunculus_, HP_status_calc_homunculus_) }, { HP_POP(status->calc_mercenary_, HP_status_calc_mercenary_) }, { HP_POP(status->calc_elemental_, HP_status_calc_elemental_) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 288d5ec52..718aa77d7 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -5499,32 +5499,6 @@ bool HP_chrif_removefriend(int char_id, int friend_id) { } return retVal___; } -void HP_chrif_send_report(char *buf, int len) { - int hIndex = 0; - if (HPMHooks.count.HP_chrif_send_report_pre > 0) { - void (*preHookFunc) (char **buf, int *len); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_chrif_send_report_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_chrif_send_report_pre[hIndex].func; - preHookFunc(&buf, &len); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.chrif.send_report(buf, len); - } - if (HPMHooks.count.HP_chrif_send_report_post > 0) { - void (*postHookFunc) (char *buf, int len); - for (hIndex = 0; hIndex < HPMHooks.count.HP_chrif_send_report_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_chrif_send_report_post[hIndex].func; - postHookFunc(buf, len); - } - } - return; -} bool HP_chrif_flush(void) { int hIndex = 0; bool retVal___ = false; @@ -26230,7 +26204,6 @@ bool HP_clif_attendance_timediff(struct map_session_data *sd) { return retVal___; } time_t HP_clif_attendance_getendtime(void) { -/* Unknown return type 'time_t'. Initializing to '0'. */ int hIndex = 0; time_t retVal___ = 0; if (HPMHooks.count.HP_clif_attendance_getendtime_pre > 0) { @@ -44099,31 +44072,32 @@ void HP_map_iwall_get(struct map_session_data *sd) { } return; } -void HP_map_iwall_remove(const char *wall_name) { +bool HP_map_iwall_remove(const char *wall_name) { int hIndex = 0; + bool retVal___ = false; if (HPMHooks.count.HP_map_iwall_remove_pre > 0) { - void (*preHookFunc) (const char **wall_name); + bool (*preHookFunc) (const char **wall_name); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_map_iwall_remove_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_map_iwall_remove_pre[hIndex].func; - preHookFunc(&wall_name); + retVal___ = preHookFunc(&wall_name); } if (*HPMforce_return) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.map.iwall_remove(wall_name); + retVal___ = HPMHooks.source.map.iwall_remove(wall_name); } if (HPMHooks.count.HP_map_iwall_remove_post > 0) { - void (*postHookFunc) (const char *wall_name); + bool (*postHookFunc) (bool retVal___, const char *wall_name); for (hIndex = 0; hIndex < HPMHooks.count.HP_map_iwall_remove_post; hIndex++) { postHookFunc = HPMHooks.list.HP_map_iwall_remove_post[hIndex].func; - postHookFunc(wall_name); + retVal___ = postHookFunc(retVal___, wall_name); } } - return; + return retVal___; } int HP_map_addmobtolist(unsigned short m, struct spawn_data *spawn) { int hIndex = 0; @@ -56094,6 +56068,58 @@ int HP_pc_calc_skilltree(struct map_session_data *sd) { } return retVal___; } +void HP_pc_calc_skilltree_clear(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_pc_calc_skilltree_clear_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_calc_skilltree_clear_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_calc_skilltree_clear_pre[hIndex].func; + preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pc.calc_skilltree_clear(sd); + } + if (HPMHooks.count.HP_pc_calc_skilltree_clear_post > 0) { + void (*postHookFunc) (struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_calc_skilltree_clear_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_calc_skilltree_clear_post[hIndex].func; + postHookFunc(sd); + } + } + return; +} +void HP_pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) { + int hIndex = 0; + if (HPMHooks.count.HP_pc_calc_skilltree_bonus_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, int *classidx); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_calc_skilltree_bonus_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_calc_skilltree_bonus_pre[hIndex].func; + preHookFunc(&sd, &classidx); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pc.calc_skilltree_bonus(sd, classidx); + } + if (HPMHooks.count.HP_pc_calc_skilltree_bonus_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, int classidx); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_calc_skilltree_bonus_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_calc_skilltree_bonus_post[hIndex].func; + postHookFunc(sd, classidx); + } + } + return; +} int HP_pc_calc_skilltree_normalize_job(struct map_session_data *sd) { int hIndex = 0; int retVal___ = 0; @@ -57390,6 +57416,32 @@ int HP_pc_checkbaselevelup(struct map_session_data *sd) { } return retVal___; } +void HP_pc_checkbaselevelup_sc(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_pc_checkbaselevelup_sc_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_checkbaselevelup_sc_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_checkbaselevelup_sc_pre[hIndex].func; + preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pc.checkbaselevelup_sc(sd); + } + if (HPMHooks.count.HP_pc_checkbaselevelup_sc_post > 0) { + void (*postHookFunc) (struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_checkbaselevelup_sc_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_checkbaselevelup_sc_post[hIndex].func; + postHookFunc(sd); + } + } + return; +} int HP_pc_checkjoblevelup(struct map_session_data *sd) { int hIndex = 0; int retVal___ = 0; @@ -57822,6 +57874,33 @@ int HP_pc_resetskill(struct map_session_data *sd, int flag) { } return retVal___; } +bool HP_pc_resetskill_job(struct map_session_data *sd, int index) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_pc_resetskill_job_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, int *index); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_resetskill_job_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_resetskill_job_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &index); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.resetskill_job(sd, index); + } + if (HPMHooks.count.HP_pc_resetskill_job_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int index); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_resetskill_job_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_resetskill_job_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, index); + } + } + return retVal___; +} int HP_pc_resetfeel(struct map_session_data *sd) { int hIndex = 0; int retVal___ = 0; @@ -59425,6 +59504,33 @@ int HP_pc_addspiritball(struct map_session_data *sd, int interval, int max) { } return retVal___; } +int HP_pc_addspiritball_sub(struct map_session_data *sd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_pc_addspiritball_sub_pre > 0) { + int (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_addspiritball_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_addspiritball_sub_pre[hIndex].func; + retVal___ = preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.addspiritball_sub(sd); + } + if (HPMHooks.count.HP_pc_addspiritball_sub_post > 0) { + int (*postHookFunc) (int retVal___, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_addspiritball_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_addspiritball_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd); + } + } + return retVal___; +} int HP_pc_delspiritball(struct map_session_data *sd, int count, int type) { int hIndex = 0; int retVal___ = 0; @@ -59452,6 +59558,33 @@ int HP_pc_delspiritball(struct map_session_data *sd, int count, int type) { } return retVal___; } +int HP_pc_delspiritball_sub(struct map_session_data *sd) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_pc_delspiritball_sub_pre > 0) { + int (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_delspiritball_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_delspiritball_sub_pre[hIndex].func; + retVal___ = preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.delspiritball_sub(sd); + } + if (HPMHooks.count.HP_pc_delspiritball_sub_post > 0) { + int (*postHookFunc) (int retVal___, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_delspiritball_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_delspiritball_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd); + } + } + return retVal___; +} int HP_pc_getmaxspiritball(struct map_session_data *sd, int min) { int hIndex = 0; int retVal___ = 0; @@ -60647,6 +60780,33 @@ void HP_pc_read_skill_tree(void) { } return; } +bool HP_pc_read_skill_job_skip(short skill_id, int job_id) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_pc_read_skill_job_skip_pre > 0) { + bool (*preHookFunc) (short *skill_id, int *job_id); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_read_skill_job_skip_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_read_skill_job_skip_pre[hIndex].func; + retVal___ = preHookFunc(&skill_id, &job_id); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.read_skill_job_skip(skill_id, job_id); + } + if (HPMHooks.count.HP_pc_read_skill_job_skip_post > 0) { + bool (*postHookFunc) (bool retVal___, short skill_id, int job_id); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_read_skill_job_skip_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_read_skill_job_skip_post[hIndex].func; + retVal___ = postHookFunc(retVal___, skill_id, job_id); + } + } + return retVal___; +} void HP_pc_clear_skill_tree(void) { int hIndex = 0; if (HPMHooks.count.HP_pc_clear_skill_tree_pre > 0) { @@ -61426,6 +61586,33 @@ bool HP_pc_check_basicskill(struct map_session_data *sd, int level) { } return retVal___; } +bool HP_pc_isDeathPenaltyJob(uint16 job) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_pc_isDeathPenaltyJob_pre > 0) { + bool (*preHookFunc) (uint16 *job); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_isDeathPenaltyJob_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_isDeathPenaltyJob_pre[hIndex].func; + retVal___ = preHookFunc(&job); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.isDeathPenaltyJob(job); + } + if (HPMHooks.count.HP_pc_isDeathPenaltyJob_post > 0) { + bool (*postHookFunc) (bool retVal___, uint16 job); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_isDeathPenaltyJob_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_isDeathPenaltyJob_post[hIndex].func; + retVal___ = postHookFunc(retVal___, job); + } + } + return retVal___; +} /* pcre_interface */ pcre* HP_libpcre_compile(const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr) { int hIndex = 0; @@ -79080,6 +79267,32 @@ void HP_status_calc_pc_additional(struct map_session_data *sd, enum e_status_cal } return; } +void HP_status_calc_pc_recover_hp(struct map_session_data *sd, struct status_data *bstatus) { + int hIndex = 0; + if (HPMHooks.count.HP_status_calc_pc_recover_hp_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, struct status_data **bstatus); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_pc_recover_hp_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_status_calc_pc_recover_hp_pre[hIndex].func; + preHookFunc(&sd, &bstatus); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.status.calc_pc_recover_hp(sd, bstatus); + } + if (HPMHooks.count.HP_status_calc_pc_recover_hp_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, struct status_data *bstatus); + for (hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_pc_recover_hp_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_status_calc_pc_recover_hp_post[hIndex].func; + postHookFunc(sd, bstatus); + } + } + return; +} int HP_status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt) { int hIndex = 0; int retVal___ = 0; diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index 42d6d821c..ef3f1124b 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -33,7 +33,7 @@ # # # Note: DO NOT include the .c extension!!! # -MYPLUGINS = +MYPLUGINS := $(MYPLUGINS) # # ######### DO NOT EDIT ANYTHING BELOW THIS LINE!!! ################## |