diff --git a/.github/workflows/gccold1.yml b/.github/workflows/gccold1.yml new file mode 100644 index 00000000000..3cc9d6deab6 --- /dev/null +++ b/.github/workflows/gccold1.yml @@ -0,0 +1,70 @@ +name: gcc_old1 + +on: [push, pull_request] + +env: + MYSQL_DATABASE: 'ragnarok' + MYSQL_USER: 'ragnarok' + MYSQL_PASSWORD: 'ragnarok' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + DEBIAN_COMMON_PACKAGES: make zlib1g-dev libpcre3-dev git python2 libzstd-dev + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + CC: ["gcc-10", "gcc-9", "gcc-8"] + RENEWAL: [""] + CLIENT_TYPE: ["", "--enable-packetver-re", "--enable-packetver-zero"] + SANITIZER: ["--disable-manager --enable-sanitize=full"] + PACKET_VERSION: ["--enable-packetver=20100105", "--enable-packetver=20171018"] + LTO: [""] + exclude: + - PACKET_VERSION: "--enable-packetver=20100105" + CLIENT_TYPE: "--enable-packetver-zero" + container: + image: ubuntu:21.10 + services: + mariadb: + image: mariadb:latest + ports: + - 33306:3306 + env: + MYSQL_DATABASE: 'ragnarok' + MYSQL_USER: 'ragnarok' + MYSQL_PASSWORD: 'ragnarok' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 + env: + INSTALL_PACKAGES: ${{ matrix.CC }} mariadb-client libmariadbclient-dev-compat + SQLHOST: mariadb + CC: ${{ matrix.CC }} + CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} --enable-epoll + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: info + run: | + uname -a + + - name: install packages + run: | + ./tools/ci/retry.sh apt-get update + ./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES + + - name: init database + run: | + ./tools/ci/travis.sh importdb ragnarok ragnarok ragnarok $SQLHOST + + - name: get plugins + run: | + ./tools/ci/travis.sh getplugins || true + + - name: build + run: | + ./tools/ci/travis.sh build $CONFIGURE_FLAGS + + # for run default config will show warnings diff --git a/.github/workflows/gccold2.yml b/.github/workflows/gccold2.yml new file mode 100644 index 00000000000..9aa4bc33b8c --- /dev/null +++ b/.github/workflows/gccold2.yml @@ -0,0 +1,70 @@ +name: gcc_old2 + +on: [push, pull_request] + +env: + MYSQL_DATABASE: 'ragnarok' + MYSQL_USER: 'ragnarok' + MYSQL_PASSWORD: 'ragnarok' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + DEBIAN_COMMON_PACKAGES: make zlib1g-dev libpcre3-dev git python libzstd-dev + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + CC: ["gcc-7", "gcc-6", "gcc-5", "gcc-4.8"] + RENEWAL: [""] + CLIENT_TYPE: ["", "--enable-packetver-re", "--enable-packetver-zero"] + SANITIZER: ["--disable-manager --enable-sanitize=full"] + PACKET_VERSION: ["--enable-packetver=20100105", "--enable-packetver=20171018"] + LTO: [""] + exclude: + - PACKET_VERSION: "--enable-packetver=20100105" + CLIENT_TYPE: "--enable-packetver-zero" + container: + image: ubuntu:18.04 + services: + mariadb: + image: mariadb:latest + ports: + - 33306:3306 + env: + MYSQL_DATABASE: 'ragnarok' + MYSQL_USER: 'ragnarok' + MYSQL_PASSWORD: 'ragnarok' + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 + env: + INSTALL_PACKAGES: ${{ matrix.CC }} mariadb-client libmariadbclient-dev-compat + SQLHOST: mariadb + CC: ${{ matrix.CC }} + CONFIGURE_FLAGS: CC=${{ matrix.CC }} --enable-debug --enable-Werror --enable-buildbot ${{ matrix.RENEWAL }} ${{ matrix.CLIENT_TYPE }} ${{ matrix.SANITIZER }} ${{ matrix.PACKET_VERSION }} --enable-epoll + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: info + run: | + uname -a + + - name: install packages + run: | + ./tools/ci/retry.sh apt-get update + ./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES + + - name: init database + run: | + ./tools/ci/travis.sh importdb ragnarok ragnarok ragnarok $SQLHOST + + - name: get plugins + run: | + ./tools/ci/travis.sh getplugins || true + + - name: build + run: | + ./tools/ci/travis.sh build $CONFIGURE_FLAGS + + # for run default config will show warnings diff --git a/src/char/char.c b/src/char/char.c index 3ad28f9bfc8..2511db30153 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2668,7 +2668,7 @@ static int char_parse_fromlogin_changesex_reply(int fd) } for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) { - char_change_sex_sub(sex, acc, char_id, class, guild_id); + chr->change_sex_sub(sex, acc, char_id, class, guild_id); } SQL->StmtFree(stmt); @@ -3621,7 +3621,7 @@ static int char_changecharsex(int char_id, int sex) } SQL->StmtFree(stmt); - char_change_sex_sub(sex, account_id, char_id, class, guild_id); + chr->change_sex_sub(sex, account_id, char_id, class, guild_id); chr->disconnect_player(account_id); // Disconnect player if online on char-server. chr->changesex(account_id, sex); // Notify all mapservers about this change. @@ -6716,6 +6716,7 @@ void char_defaults(void) chr->check_connect_login_server = char_check_connect_login_server; chr->online_data_cleanup_sub = char_online_data_cleanup_sub; chr->online_data_cleanup = char_online_data_cleanup; + chr->change_sex_sub = char_change_sex_sub; chr->sql_config_read = char_sql_config_read; chr->sql_config_read_registry = char_sql_config_read_registry; chr->sql_config_read_pc = char_sql_config_read_pc; diff --git a/src/char/char.h b/src/char/char.h index 2e35053a25e..ff287db2971 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -283,6 +283,7 @@ struct char_interface { int (*check_connect_login_server) (int tid, int64 tick, int id, intptr_t data); int (*online_data_cleanup_sub) (union DBKey key, struct DBData *data, va_list ap); int (*online_data_cleanup) (int tid, int64 tick, int id, intptr_t data); + void (*change_sex_sub) (int sex, int acc, int char_id, int class, int guild_id); bool (*sql_config_read) (const char *filename, bool imported); bool (*sql_config_read_registry) (const char *filename, const struct config_t *config, bool imported); diff --git a/src/char/mapif.c b/src/char/mapif.c index 9cfaec15793..8cabde962ec 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -2531,6 +2531,9 @@ void mapif_defaults(void) mapif->parse_ItemBoundRetrieve = mapif_parse_ItemBoundRetrieve; mapif->parse_accinfo = mapif_parse_accinfo; mapif->account_reg_reply = mapif_account_reg_reply; +#if 0 + mapif->account_reg = mapif_account_reg; +#endif mapif->disconnectplayer = mapif_disconnectplayer; mapif->parse_Registry = mapif_parse_Registry; mapif->parse_RegistryRequest = mapif_parse_RegistryRequest; diff --git a/src/char/mapif.h b/src/char/mapif.h index c59a9325380..737ac95a1b4 100644 --- a/src/char/mapif.h +++ b/src/char/mapif.h @@ -178,6 +178,9 @@ struct mapif_interface { void (*parse_ItemBoundRetrieve) (int fd); void (*parse_accinfo) (int fd); int (*account_reg_reply) (int fd,int account_id,int char_id, int type); +#if 0 + void (*account_reg) (int fd, unsigned char *src); +#endif int (*disconnectplayer) (int fd, int account_id, int char_id, int reason); int (*parse_Registry) (int fd); int (*parse_RegistryRequest) (int fd); diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 46e28b48527..34615d6dc3c 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -522,8 +522,8 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #define MAP_INTIF_H #endif // MAP_INTIF_H #ifdef MAP_IRC_BOT_H - { "irc_bot_interface", sizeof(struct irc_bot_interface), SERVER_TYPE_MAP }, { "irc_func", sizeof(struct irc_func), SERVER_TYPE_MAP }, + { "ircbot_interface", sizeof(struct ircbot_interface), SERVER_TYPE_MAP }, { "message_flood", sizeof(struct message_flood), SERVER_TYPE_MAP }, #else #define MAP_IRC_BOT_H diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 9e6f417c4cd..16470426f3b 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -156,7 +156,7 @@ struct intif_interface *intif; struct ipban_interface *ipban; #endif // LOGIN_IPBAN_H #ifdef MAP_IRC_BOT_H /* ircbot */ -struct irc_bot_interface *ircbot; +struct ircbot_interface *ircbot; #endif // MAP_IRC_BOT_H #ifdef MAP_ITEMDB_H /* itemdb */ struct itemdb_interface *itemdb; diff --git a/src/map/clif.c b/src/map/clif.c index 29c8ea3081a..8da57e8dc90 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -264,26 +264,6 @@ static void clif_setport(uint16 port) clif->map_port = port; } -#if 0 // Unused function -/*========================================== - * Returns map server IP - *------------------------------------------*/ -static uint32 clif_getip(void) -{ - return clif->map_ip; -} -#endif // 0 - -#if 0 // Unused function -/*========================================== - * Returns map port which is set by clif_setport() - *------------------------------------------*/ -static uint16 clif_getport(void) -{ - return clif->map_port; -} -#endif // 0 - /*========================================== * Updates server ip resolution and returns it *------------------------------------------*/ @@ -1029,7 +1009,7 @@ static int clif_setlevel(struct block_list *bl) int lv = status->get_lv(bl); nullpo_retr(0, bl); if( battle_config.client_limit_unit_lv&bl->type ) - return clif_setlevel_sub(lv); + return clif->setlevel_sub(lv); switch (bl->type) { case BL_NPC: case BL_PET: @@ -1098,7 +1078,7 @@ static void clif_set_unit_idle2(struct block_list *bl, struct map_session_data * WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); p.xSize = p.ySize = (sd) ? 5 : 0; p.state = vd->dead_sit; - p.clevel = clif_setlevel(bl); + p.clevel = clif->setlevel(bl); clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); #else @@ -1174,7 +1154,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); p.xSize = p.ySize = (sd) ? 5 : 0; p.state = vd->dead_sit; - p.clevel = clif_setlevel(bl); + p.clevel = clif->setlevel(bl); #if PACKETVER >= 20080102 p.font = (sd) ? sd->status.font : 0; #endif @@ -1332,7 +1312,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) p.sex = vd->sex; WBUFPOS(&p.PosDir[0],0,bl->x,bl->y,unit->getdir(bl)); p.xSize = p.ySize = (sd) ? 5 : 0; - p.clevel = clif_setlevel(bl); + p.clevel = clif->setlevel(bl); #if PACKETVER >= 20080102 p.font = (sd) ? sd->status.font : 0; #endif @@ -1436,7 +1416,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data p.sex = vd->sex; WBUFPOS2(&p.MoveData[0],0,bl->x,bl->y,ud->to_x,ud->to_y,8,8); p.xSize = p.ySize = (sd) ? 5 : 0; - p.clevel = clif_setlevel(bl); + p.clevel = clif->setlevel(bl); #if PACKETVER >= 20080102 p.font = (sd) ? sd->status.font : 0; #endif @@ -4313,7 +4293,7 @@ static void clif_changeoption2(struct block_list *bl) WBUFW(buf,0) = 0x28a; WBUFL(buf,2) = bl->id; WBUFL(buf,6) = (sc != NULL) ? sc->option : ((bl->type == BL_NPC) ? BL_UCCAST(BL_NPC, bl)->option : 0); - WBUFL(buf,10) = clif_setlevel(bl); + WBUFL(buf,10) = clif->setlevel(bl); WBUFL(buf,14) = (sc) ? sc->opt3 : 0; if (clif->isdisguised(bl)) { clif->send(buf,packet_len(0x28a),bl,AREA_WOS); @@ -11128,7 +11108,7 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) map->addblock(&sd->bl); // Add the character to the map. clif->spawn(&sd->bl); // Spawn character client side. - clif_load_end_ack_sub_messages(sd, (sd->state.connect_new != 0), (sd->state.changemap != 0)); + clif->load_end_ack_sub_messages(sd, (sd->state.connect_new != 0), (sd->state.changemap != 0)); struct party_data *p = NULL; @@ -15569,7 +15549,7 @@ static void clif_parse_GuildInvite(int fd, struct map_session_data *sd) struct map_session_data *t_sd = map->id2sd(RFIFOL(fd,2)); - if (!clif_sub_guild_invite(fd, sd, t_sd)) + if (!clif->sub_guild_invite(fd, sd, t_sd)) return; } @@ -15584,7 +15564,7 @@ static void clif_parse_GuildInvite2(int fd, struct map_session_data *sd) safestrncpy(nick, RFIFOP(fd, 2), NAME_LENGTH); t_sd = map->nick2sd(nick, true); - clif_sub_guild_invite(fd, sd, t_sd); + clif->sub_guild_invite(fd, sd, t_sd); } static void clif_parse_GuildReplyInvite(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); @@ -22082,7 +22062,7 @@ static bool clif_parse_roulette_db(void) struct config_setting_t *level; char entry_name[10]; - sprintf(entry_name,"level_%d",i+1); + safesnprintf(entry_name, 10, "level_%d", i + 1); if( (level = libconfig->setting_get_member(levels, entry_name)) != NULL ) { int k, item_count = libconfig->setting_length(level); @@ -22619,10 +22599,10 @@ static unsigned short clif_parse_cmd_optional(int fd, struct map_session_data *s // filter out invalid / unsupported packets if( cmd > MAX_PACKET_DB || cmd < MIN_PACKET_DB || packets->db[cmd] == 0 ) { if( sd ) - sd->parse_cmd_func = clif_parse_cmd_decrypt; - return clif_parse_cmd_decrypt(fd, sd); + sd->parse_cmd_func = clif->parse_cmd_decrypt; + return clif->parse_cmd_decrypt(fd, sd); } else if( sd ) { - sd->parse_cmd_func = clif_parse_cmd_normal; + sd->parse_cmd_func = clif->parse_cmd_normal; } return cmd; @@ -25319,7 +25299,7 @@ static int clif_parse(int fd) if ((int)RFIFOREST(fd) < packet_len) return 0; // not enough data received to form the packet - if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif_parse_cmd_decrypt) ) { + if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif->parse_cmd_decrypt) ) { // Note: Overriding const qualifier to re-inject the decoded packet ID. #define RFIFOP_mutable(fd, pos) ((void *)(sockt->session[fd]->rdata + sockt->session[fd]->rdata_pos + (pos))) int16 *packet_id = RFIFOP_mutable(fd, 0); @@ -25469,18 +25449,18 @@ static void clif_bc_ready(void) if( battle_config.display_status_timers ) clif->status_change_sub = clif_status_change_sub; else - clif->status_change_sub = clif_status_change_notick; + clif->status_change_sub = clif->status_change_notick; switch( battle_config.packet_obfuscation ) { case 0: - clif->parse_cmd = clif_parse_cmd_normal; + clif->parse_cmd = clif->parse_cmd_normal; break; default: case 1: - clif->parse_cmd = clif_parse_cmd_optional; + clif->parse_cmd = clif->parse_cmd_optional; break; case 2: - clif->parse_cmd = clif_parse_cmd_decrypt; + clif->parse_cmd = clif->parse_cmd_decrypt; break; } } @@ -25693,6 +25673,7 @@ void clif_defaults(void) clif->combo_delay = clif_combo_delay; clif->status_change = clif_status_change; clif->status_change_sub = clif_status_change_sub; + clif->status_change_notick = clif_status_change_notick; clif->insert_card = clif_insert_card; clif->inventoryList = clif_inventoryList; clif->inventoryItems = clif_inventoryItems; @@ -25796,6 +25777,9 @@ void clif_defaults(void) clif->divorced = clif_divorced; clif->callpartner = clif_callpartner; clif->skill_damage = clif_skill_damage; +#if 0 + clif->skill_damage2 = clif_skill_damage2; +#endif clif->skill_nodamage = clif_skill_nodamage; clif->skill_poseffect = clif_skill_poseffect; clif->skill_estimation = clif_skill_estimation; @@ -25952,6 +25936,9 @@ void clif_defaults(void) clif->guild_set_position = clif_guild_set_position; clif->guild_position_selected = clif_guild_position_selected; clif->validate_emblem = clif_validate_emblem; +#if 0 + clif->guild_allianceadded = clif_guild_allianceadded; +#endif /* battleground-specific */ clif->bg_hp = clif_bg_hp; clif->bg_xy = clif_bg_xy; @@ -26518,4 +26505,25 @@ void clif_defaults(void) clif->grade_enchant_add_item_result_fail = clif_grade_enchant_add_item_result_fail; clif->grade_enchant_result = clif_grade_enchant_result; clif->announce_grade_status = clif_announce_grade_status; + clif->setlevel = clif_setlevel; + clif->setlevel_sub = clif_setlevel_sub; + clif->load_end_ack_sub_messages = clif_load_end_ack_sub_messages; + clif->sub_guild_invite = clif_sub_guild_invite; + clif->parse_cmd_normal = clif_parse_cmd_normal; + clif->parse_cmd_decrypt = clif_parse_cmd_decrypt; + clif->parse_cmd_optional = clif_parse_cmd_optional; +#if 0 + clif->marriage_process = clif_marriage_process; + clif->marriage_proposal = clif_marriage_proposal; + clif->storagepassword = clif_storagepassword; + clif->storagepassword_result = clif_storagepassword_result; + clif->PartyBookingPersonalSetting = clif_PartyBookingPersonalSetting; + clif->pPartyBookingShowEquipment = clif_parse_PartyBookingShowEquipment; + clif->pPartyBookingReqRecall = clif_parse_PartyBookingReqRecall; + clif->PartyBookingRecallCost = clif_PartyBookingRecallCost; + clif->pPartyBookingAckRecall = clif_parse_PartyBookingAckRecall; + clif->PartyBookingFailedRecall = clif_PartyBookingFailedRecall; + clif->PartyBookingCancelVolunteerToPM = clif_PartyBookingCancelVolunteerToPM; + clif->PartyBookingRefuseVolunteerToPM = clif_PartyBookingRefuseVolunteerToPM; +#endif } diff --git a/src/map/clif.h b/src/map/clif.h index bc953752aba..d33603b1a36 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -980,6 +980,7 @@ struct clif_interface { void (*combo_delay) (struct block_list *bl,int wait); void (*status_change) (struct block_list *bl, int relevant_bl, int type, int flag, int total_tick, int val1, int val2, int val3); void (*status_change_sub) (struct block_list *bl, int type, int relevant_bl, int flag, int tick, int total_tick, int val1, int val2, int val3); + void (*status_change_notick) (struct block_list *bl, int type, int relevant_bl, int flag, int tick, int total_tick, int val1, int val2, int val3); void (*insert_card) (struct map_session_data *sd,int idx_equip,int idx_card,int flag); void (*inventoryList) (struct map_session_data *sd); void (*inventoryItems) (struct map_session_data *sd, enum inventory_type type); @@ -1083,6 +1084,9 @@ struct clif_interface { void (*divorced) (struct map_session_data* sd, const char* name); void (*callpartner) (struct map_session_data *sd); int (*skill_damage) (struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int64 damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type); +#if 0 + int (*skill_damage2) (struct block_list *src, struct block_list *dst, int64 tick, int sdelay, int ddelay, int damage, int div, uint16 skill_id, uint16 skill_lv, enum battle_dmg_type type); +#endif int (*skill_nodamage) (struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail); void (*skill_poseffect) (struct block_list *src, uint16 skill_id, int val, int x, int y, int64 tick); void (*skill_estimation) (struct map_session_data *sd,struct block_list *dst); @@ -1239,7 +1243,9 @@ struct clif_interface { void (*guild_expulsionlist) (struct map_session_data* sd); void (*guild_set_position) (struct map_session_data *sd); void (*guild_position_selected) (struct map_session_data *sd); - +#if 0 + void (*guild_allianceadded) (struct guild *g, int idx); +#endif bool (*validate_emblem) (const uint8* emblem, unsigned long emblem_len); /* battleground-specific */ void (*bg_hp) (struct map_session_data *sd); @@ -1802,6 +1808,27 @@ struct clif_interface { void (*grade_enchant_add_item_result_fail) (struct map_session_data *sd); void (*grade_enchant_result) (struct map_session_data *sd, int16 index, enum grade_level gl, enum grade_ui_result result); void (*announce_grade_status) (struct map_session_data *sd, int item_id, enum grade_level gl, bool success, enum send_target target); + int (*setlevel) (struct block_list *bl); + int (*setlevel_sub) (int lv); + void (*load_end_ack_sub_messages) (struct map_session_data *sd, bool connect_new, bool change_map); + bool (*sub_guild_invite) (int fd, struct map_session_data *sd, struct map_session_data *t_sd); + unsigned short (*parse_cmd_normal) (int fd, struct map_session_data *sd); + unsigned short (*parse_cmd_decrypt) (int fd, struct map_session_data *sd); + unsigned short (*parse_cmd_optional) (int fd, struct map_session_data *sd); +#if 0 + void (*marriage_process) (struct map_session_data *sd); + void (*marriage_proposal) (int fd, struct map_session_data *sd, struct map_session_data *ssd); + void (*storagepassword) (struct map_session_data *sd, short info); + void (*storagepassword_result) (struct map_session_data *sd, short result, short error_count); + void (*PartyBookingPersonalSetting) (int fd, struct map_session_data *sd); + void (*pPartyBookingShowEquipment) (int fd, struct map_session_data *sd); + void (*pPartyBookingReqRecall) (int fd, struct map_session_data *sd); + void (*PartyBookingRecallCost) (int fd, struct map_session_data *sd); + void (*pPartyBookingAckRecall) (int fd, struct map_session_data *sd); + void (*PartyBookingFailedRecall) (int fd, struct map_session_data *sd); + void (*PartyBookingCancelVolunteerToPM) (struct map_session_data *sd); + void (*PartyBookingRefuseVolunteerToPM) (struct map_session_data *sd); +#endif }; #ifdef HERCULES_CORE diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index f86816be872..bca070fab8e 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -43,12 +43,12 @@ //#define IRCBOT_DEBUG -static struct irc_bot_interface irc_bot_s; -struct irc_bot_interface *ircbot; +static struct ircbot_interface ircbot_s; +struct ircbot_interface *ircbot; static char send_string[IRC_MESSAGE_LENGTH]; -/// @copydoc irc_bot_interface::connect_timer() +/// @copydoc ircbot_interface::connect_timer() static int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) { struct hSockOpt opt; @@ -70,7 +70,7 @@ static int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -/// @copydoc irc_bot_interface::identify_timer() +/// @copydoc ircbot_interface::identify_timer() static int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) { if( !ircbot->isOn ) @@ -86,7 +86,7 @@ static int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -/// @copydoc irc_bot_interface::join_timer() +/// @copydoc ircbot_interface::join_timer() static int irc_join_timer(int tid, int64 tick, int id, intptr_t data) { if( !ircbot->isOn ) @@ -108,7 +108,7 @@ static int irc_join_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -/// @copydoc irc_bot_interface::func_search() +/// @copydoc ircbot_interface::func_search() static struct irc_func *irc_func_search(char *function_name) { int i; @@ -121,7 +121,7 @@ static struct irc_func *irc_func_search(char *function_name) return NULL; } -/// @copydoc irc_bot_interface::parse() +/// @copydoc ircbot_interface::parse() static int irc_parse(int fd) { char *parse_string = NULL, *p = NULL, *str_safe = NULL; @@ -156,7 +156,7 @@ static int irc_parse(int fd) return 0; } -/// @copydoc irc_bot_interface::parse_source() +/// @copydoc ircbot_interface::parse_source() static void irc_parse_source(char *source, char *nick, char *ident, char *host) { int i, pos = 0; @@ -181,7 +181,7 @@ static void irc_parse_source(char *source, char *nick, char *ident, char *host) } } -/// @copydoc irc_bot_interface::parse_sub() +/// @copydoc ircbot_interface::parse_sub() static void irc_parse_sub(int fd, char *str) { char source[180], command[60], buf1[IRC_MESSAGE_LENGTH], buf2[IRC_MESSAGE_LENGTH]; @@ -212,7 +212,7 @@ static void irc_parse_sub(int fd, char *str) func->func(fd,command,source,target,message); } -/// @copydoc irc_bot_interface::queue() +/// @copydoc ircbot_interface::queue() static void irc_queue(char *str) { struct message_flood *queue_entry = NULL; @@ -249,7 +249,7 @@ static void irc_queue(char *str) } } -/// @copydoc irc_bot_interface::queue_timer() +/// @copydoc ircbot_interface::queue_timer() static int irc_queue_timer(int tid, int64 tick, int id, intptr_t data) { struct message_flood *queue_entry = ircbot->message_current; @@ -270,7 +270,7 @@ static int irc_queue_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -/// @copydoc irc_bot_interface::send() +/// @copydoc ircbot_interface::send() static void irc_send(char *str, bool force) { size_t len; @@ -345,7 +345,7 @@ static void irc_privmsg_ctcp(int fd, char *cmd, char *source, char *target, char } } -/// @copydoc irc_bot_interface::privmsg() +/// @copydoc ircbot_interface::privmsg() static void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { size_t len = msg ? strlen(msg) : 0; @@ -384,7 +384,7 @@ static void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg } } -/// @copydoc irc_bot_interface::userjoin() +/// @copydoc ircbot_interface::userjoin() static void irc_userjoin(int fd, char *cmd, char *source, char *target, char *msg) { char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; @@ -401,7 +401,7 @@ static void irc_userjoin(int fd, char *cmd, char *source, char *target, char *ms } } -/// @copydoc irc_bot_interface::userleave() +/// @copydoc ircbot_interface::userleave() static void irc_userleave(int fd, char *cmd, char *source, char *target, char *msg) { char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; @@ -421,7 +421,7 @@ static void irc_userleave(int fd, char *cmd, char *source, char *target, char *m } } -/// @copydoc irc_bot_interface::usernick() +/// @copydoc ircbot_interface::usernick() static void irc_usernick(int fd, char *cmd, char *source, char *target, char *msg) { char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH]; @@ -438,7 +438,7 @@ static void irc_usernick(int fd, char *cmd, char *source, char *target, char *ms } } -/// @copydoc irc_bot_interface::relay() +/// @copydoc ircbot_interface::relay() static void irc_relay(const char *name, const char *msg) { if (!ircbot->isIn) @@ -453,8 +453,8 @@ static void irc_relay(const char *name, const char *msg) ircbot->send(send_string, false); } -/// @copydoc irc_bot_interface::init() -static void irc_bot_init(bool minimal) +/// @copydoc ircbot_interface::init() +static void ircbot_init(bool minimal) { /// Command handlers const struct irc_func irc_func_base[] = { @@ -505,8 +505,8 @@ static void irc_bot_init(bool minimal) timer->add(timer->gettick() + 7000, ircbot->connect_timer, 0, 0); } -/// @copydoc irc_bot_interface::final() -static void irc_bot_final(void) +/// @copydoc ircbot_interface::final() +static void ircbot_final(void) { int i; @@ -537,7 +537,7 @@ static void irc_bot_final(void) */ void ircbot_defaults(void) { - ircbot = &irc_bot_s; + ircbot = &ircbot_s; ircbot->channel = NULL; @@ -550,8 +550,8 @@ void ircbot_defaults(void) ircbot->message_current = NULL; ircbot->message_last = NULL; - ircbot->init = irc_bot_init; - ircbot->final = irc_bot_final; + ircbot->init = ircbot_init; + ircbot->final = ircbot_final; ircbot->parse = irc_parse; ircbot->parse_sub = irc_parse_sub; diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index 979fabd8b26..6d9fe9744ea 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -44,7 +44,7 @@ struct message_flood { struct message_flood *next; }; -struct irc_bot_interface { +struct ircbot_interface { int fd; bool isIn, isOn; int64 last_try; @@ -158,40 +158,40 @@ struct irc_bot_interface { /** * Handler for the PING IRC command (send back a PONG) - * @see irc_bot_interface::parse_sub + * @see ircbot_interface::parse_sub */ void (*pong) (int fd, char *cmd, char *source, char *target, char *msg); /** * Handler for the PRIVMSG IRC command (action depends on the message contents) - * @see irc_bot_interface::parse_sub + * @see ircbot_interface::parse_sub */ void (*privmsg) (int fd, char *cmd, char *source, char *target, char *msg); /** * Handler for CTCP commands received via PRIVMSG - * @see irc_bot_interface::privmsg + * @see ircbot_interface::privmsg */ void (*privmsg_ctcp) (int fd, char *cmd, char *source, char *target, char *msg); /** * Handler for the JOIN IRC command (notify an in-game channel of users joining * the IRC channel) - * @see irc_bot_interface::parse_sub + * @see ircbot_interface::parse_sub */ void (*userjoin) (int fd, char *cmd, char *source, char *target, char *msg); /** * Handler for the PART and QUIT IRC commands (notify an in-game channel of * users leaving the IRC channel) - * @see irc_bot_interface::parse_sub + * @see ircbot_interface::parse_sub */ void (*userleave) (int fd, char *cmd, char *source, char *target, char *msg); /** * Handler for the NICK IRC commands (notify an in-game channel of users * changing their name while in the IRC channel) - * @see irc_bot_interface::parse_sub + * @see ircbot_interface::parse_sub */ void (*usernick) (int fd, char *cmd, char *source, char *target, char *msg); }; @@ -200,6 +200,6 @@ struct irc_bot_interface { void ircbot_defaults(void); #endif // HERCULES_CORE -HPShared struct irc_bot_interface *ircbot; +HPShared struct ircbot_interface *ircbot; #endif /* MAP_IRC_BOT_H */ diff --git a/src/map/map.c b/src/map/map.c index cf7f8f671ed..9359c4662f1 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -4401,15 +4401,15 @@ static bool map_config_read(const char *filename, bool imported) libconfig->setting_lookup_bool(setting, "use_grf", &map->enable_grf); libconfig->setting_lookup_mutable_string(setting, "default_language", map->default_lang_str, sizeof(map->default_lang_str)); - if (!map_config_read_console(filename, &config, imported)) + if (!map->config_read_console(filename, &config, imported)) retval = false; - if (!map_config_read_connection(filename, &config, imported)) + if (!map->config_read_connection(filename, &config, imported)) retval = false; - if (!map_config_read_inter(filename, &config, imported)) + if (!map->config_read_inter(filename, &config, imported)) retval = false; - if (!map_config_read_database(filename, &config, imported)) + if (!map->config_read_database(filename, &config, imported)) retval = false; - if (!map_config_read_map_list(filename, &config, imported)) + if (!map->config_read_map_list(filename, &config, imported)) retval = false; // import should overwrite any previous configuration, so it should be called last @@ -6679,6 +6679,7 @@ static void map_load_defaults(void) { mapindex_defaults(); map_defaults(); + mapit_defaults(); /* */ atcommand_defaults(); battle_defaults(); @@ -7356,6 +7357,13 @@ PRAGMA_GCC9(GCC diagnostic pop) map->readgat = map_readgat; map->readallmaps = map_readallmaps; map->config_read = map_config_read; + + map->config_read_console = map_config_read_console; + map->config_read_connection = map_config_read_connection; + map->config_read_inter = map_config_read_inter; + map->config_read_database = map_config_read_database; + map->config_read_map_list = map_config_read_map_list; + map->read_npclist = map_read_npclist; map->inter_config_read = inter_config_read; map->inter_config_read_database_names = inter_config_read_database_names; @@ -7382,7 +7390,10 @@ PRAGMA_GCC9(GCC diagnostic pop) map->zone_clear_single = map_zone_clear_single; map->lock_check = map_lock_check; +} +void mapit_defaults(void) +{ /** * mapit interface **/ diff --git a/src/map/map.h b/src/map/map.h index 0312574c668..c7cfa092bc6 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1512,6 +1512,12 @@ END_ZEROED_BLOCK; int (*readgat) (struct map_data *m); int (*readallmaps) (void); bool (*config_read) (const char *filename, bool imported); + bool (*config_read_console) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_connection) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_inter) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_database) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_map_list) (const char *filename, struct config_t *config, bool imported); + bool (*read_npclist) (const char *filename, bool imported); bool (*inter_config_read) (const char *filename, bool imported); bool (*inter_config_read_database_names) (const char *filename, const struct config_t *config, bool imported); @@ -1538,6 +1544,7 @@ END_ZEROED_BLOCK; #ifdef HERCULES_CORE void map_defaults(void); +void mapit_defaults(void); #endif // HERCULES_CORE HPShared struct mapit_interface *mapit; diff --git a/src/map/npc.c b/src/map/npc.c index 60efc198376..76c1582526f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -5768,7 +5768,7 @@ static int npc_reload(void) map->flags_init(); itemdb->name_constants(); clan->set_constants(); - npc_process_files(npc_new_min); + npc->process_files(npc_new_min); instance->reload(); map->zone_init(); npc->motd = npc->name2id("HerculesMOTD"); /// [Ind/Hercules] @@ -5946,7 +5946,7 @@ static int do_init_npc(bool minimal) if (!minimal) { npc->timer_event_ers = ers_new(sizeof(struct timer_event_data),"clif.c::timer_event_ers",ERS_OPT_NONE); - npc_process_files(START_NPC_NUM); + npc->process_files(START_NPC_NUM); } if (!minimal) { @@ -6139,4 +6139,5 @@ void npc_defaults(void) npc->db_checkid = npc_db_checkid; npc->refresh = npc_refresh; npc->questinfo_clear = npc_questinfo_clear; + npc->process_files = npc_process_files; } diff --git a/src/map/npc.h b/src/map/npc.h index 51e9d4f820f..5c07a3b393e 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -352,6 +352,7 @@ struct npc_interface { * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ int (*secure_timeout_timer) (int tid, int64 tick, int id, intptr_t data); + void (*process_files) (int npc_min); }; #ifdef HERCULES_CORE diff --git a/src/map/pc.c b/src/map/pc.c index 6d3e6fe9fa1..377fbdedcda 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -11991,7 +11991,7 @@ static int pc_read_attr_fix_db_entry(struct config_setting_t *def_attr, enum ele int count = 0; for (int i = 1; i <= 4; ++i) { char name[5]; - sprintf(name, "Lv%d", i); + safesnprintf(name, 5, "Lv%d", i); struct config_setting_t *def_lv = libconfig->setting_lookup(def_attr, name); if (def_lv != NULL) { diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 61c5a55b1bb..4355c893992 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -816,6 +816,8 @@ typedef int (*HPMHOOK_pre_chr_online_data_cleanup_sub) (union DBKey *key, struct typedef int (*HPMHOOK_post_chr_online_data_cleanup_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef int (*HPMHOOK_pre_chr_online_data_cleanup) (int *tid, int64 *tick, int *id, intptr_t *data); typedef int (*HPMHOOK_post_chr_online_data_cleanup) (int retVal___, int tid, int64 tick, int id, intptr_t data); +typedef void (*HPMHOOK_pre_chr_change_sex_sub) (int *sex, int *acc, int *char_id, int *class, int *guild_id); +typedef void (*HPMHOOK_post_chr_change_sex_sub) (int sex, int acc, int char_id, int class, int guild_id); typedef bool (*HPMHOOK_pre_chr_sql_config_read) (const char **filename, bool *imported); typedef bool (*HPMHOOK_post_chr_sql_config_read) (bool retVal___, const char *filename, bool imported); typedef bool (*HPMHOOK_pre_chr_sql_config_read_registry) (const char **filename, const struct config_t **config, bool *imported); @@ -1344,6 +1346,8 @@ typedef void (*HPMHOOK_pre_clif_status_change) (struct block_list **bl, int *rel typedef void (*HPMHOOK_post_clif_status_change) (struct block_list *bl, int relevant_bl, int type, int flag, int total_tick, int val1, int val2, int val3); typedef void (*HPMHOOK_pre_clif_status_change_sub) (struct block_list **bl, int *type, int *relevant_bl, int *flag, int *tick, int *total_tick, int *val1, int *val2, int *val3); typedef void (*HPMHOOK_post_clif_status_change_sub) (struct block_list *bl, int type, int relevant_bl, int flag, int tick, int total_tick, int val1, int val2, int val3); +typedef void (*HPMHOOK_pre_clif_status_change_notick) (struct block_list **bl, int *type, int *relevant_bl, int *flag, int *tick, int *total_tick, int *val1, int *val2, int *val3); +typedef void (*HPMHOOK_post_clif_status_change_notick) (struct block_list *bl, int type, int relevant_bl, int flag, int tick, int total_tick, int val1, int val2, int val3); typedef void (*HPMHOOK_pre_clif_insert_card) (struct map_session_data **sd, int *idx_equip, int *idx_card, int *flag); typedef void (*HPMHOOK_post_clif_insert_card) (struct map_session_data *sd, int idx_equip, int idx_card, int flag); typedef void (*HPMHOOK_pre_clif_inventoryList) (struct map_session_data **sd); @@ -2850,6 +2854,20 @@ typedef void (*HPMHOOK_pre_clif_grade_enchant_result) (struct map_session_data * typedef void (*HPMHOOK_post_clif_grade_enchant_result) (struct map_session_data *sd, int16 index, enum grade_level gl, enum grade_ui_result result); typedef void (*HPMHOOK_pre_clif_announce_grade_status) (struct map_session_data **sd, int *item_id, enum grade_level *gl, bool *success, enum send_target *target); typedef void (*HPMHOOK_post_clif_announce_grade_status) (struct map_session_data *sd, int item_id, enum grade_level gl, bool success, enum send_target target); +typedef int (*HPMHOOK_pre_clif_setlevel) (struct block_list **bl); +typedef int (*HPMHOOK_post_clif_setlevel) (int retVal___, struct block_list *bl); +typedef int (*HPMHOOK_pre_clif_setlevel_sub) (int *lv); +typedef int (*HPMHOOK_post_clif_setlevel_sub) (int retVal___, int lv); +typedef void (*HPMHOOK_pre_clif_load_end_ack_sub_messages) (struct map_session_data **sd, bool *connect_new, bool *change_map); +typedef void (*HPMHOOK_post_clif_load_end_ack_sub_messages) (struct map_session_data *sd, bool connect_new, bool change_map); +typedef bool (*HPMHOOK_pre_clif_sub_guild_invite) (int *fd, struct map_session_data **sd, struct map_session_data **t_sd); +typedef bool (*HPMHOOK_post_clif_sub_guild_invite) (bool retVal___, int fd, struct map_session_data *sd, struct map_session_data *t_sd); +typedef unsigned short (*HPMHOOK_pre_clif_parse_cmd_normal) (int *fd, struct map_session_data **sd); +typedef unsigned short (*HPMHOOK_post_clif_parse_cmd_normal) (unsigned short retVal___, int fd, struct map_session_data *sd); +typedef unsigned short (*HPMHOOK_pre_clif_parse_cmd_decrypt) (int *fd, struct map_session_data **sd); +typedef unsigned short (*HPMHOOK_post_clif_parse_cmd_decrypt) (unsigned short retVal___, int fd, struct map_session_data *sd); +typedef unsigned short (*HPMHOOK_pre_clif_parse_cmd_optional) (int *fd, struct map_session_data **sd); +typedef unsigned short (*HPMHOOK_post_clif_parse_cmd_optional) (unsigned short retVal___, int fd, struct map_session_data *sd); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); @@ -4992,6 +5010,16 @@ typedef int (*HPMHOOK_pre_map_readallmaps) (void); typedef int (*HPMHOOK_post_map_readallmaps) (int retVal___); typedef bool (*HPMHOOK_pre_map_config_read) (const char **filename, bool *imported); typedef bool (*HPMHOOK_post_map_config_read) (bool retVal___, const char *filename, bool imported); +typedef bool (*HPMHOOK_pre_map_config_read_console) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_map_config_read_console) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_map_config_read_connection) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_map_config_read_connection) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_map_config_read_inter) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_map_config_read_inter) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_map_config_read_database) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_map_config_read_database) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_map_config_read_map_list) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_map_config_read_map_list) (bool retVal___, const char *filename, struct config_t *config, bool imported); typedef bool (*HPMHOOK_pre_map_read_npclist) (const char **filename, bool *imported); typedef bool (*HPMHOOK_post_map_read_npclist) (bool retVal___, const char *filename, bool imported); typedef bool (*HPMHOOK_pre_map_inter_config_read) (const char **filename, bool *imported); @@ -6036,6 +6064,8 @@ typedef void (*HPMHOOK_pre_npc_questinfo_clear) (struct npc_data **nd); typedef void (*HPMHOOK_post_npc_questinfo_clear) (struct npc_data *nd); typedef int (*HPMHOOK_pre_npc_secure_timeout_timer) (int *tid, int64 *tick, int *id, intptr_t *data); typedef int (*HPMHOOK_post_npc_secure_timeout_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); +typedef void (*HPMHOOK_pre_npc_process_files) (int *npc_min); +typedef void (*HPMHOOK_post_npc_process_files) (int npc_min); #endif // MAP_NPC_H #ifdef COMMON_NULLPO_H /* nullpo */ typedef void (*HPMHOOK_pre_nullpo_init) (void); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 95c380a9786..b975c77f86a 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -346,6 +346,8 @@ struct { struct HPMHookPoint *HP_chr_online_data_cleanup_sub_post; struct HPMHookPoint *HP_chr_online_data_cleanup_pre; struct HPMHookPoint *HP_chr_online_data_cleanup_post; + struct HPMHookPoint *HP_chr_change_sex_sub_pre; + struct HPMHookPoint *HP_chr_change_sex_sub_post; struct HPMHookPoint *HP_chr_sql_config_read_pre; struct HPMHookPoint *HP_chr_sql_config_read_post; struct HPMHookPoint *HP_chr_sql_config_read_registry_pre; @@ -1987,6 +1989,8 @@ struct { int HP_chr_online_data_cleanup_sub_post; int HP_chr_online_data_cleanup_pre; int HP_chr_online_data_cleanup_post; + int HP_chr_change_sex_sub_pre; + int HP_chr_change_sex_sub_post; int HP_chr_sql_config_read_pre; int HP_chr_sql_config_read_post; int HP_chr_sql_config_read_registry_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 016cf707872..10e2c7031b5 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -188,6 +188,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chr->check_connect_login_server, HP_chr_check_connect_login_server) }, { HP_POP(chr->online_data_cleanup_sub, HP_chr_online_data_cleanup_sub) }, { HP_POP(chr->online_data_cleanup, HP_chr_online_data_cleanup) }, + { HP_POP(chr->change_sex_sub, HP_chr_change_sex_sub) }, { HP_POP(chr->sql_config_read, HP_chr_sql_config_read) }, { HP_POP(chr->sql_config_read_registry, HP_chr_sql_config_read_registry) }, { HP_POP(chr->sql_config_read_pc, HP_chr_sql_config_read_pc) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 59af0e449d6..69550eca0de 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -4270,6 +4270,32 @@ int HP_chr_online_data_cleanup(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } +void HP_chr_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id) { + int hIndex = 0; + if (HPMHooks.count.HP_chr_change_sex_sub_pre > 0) { + void (*preHookFunc) (int *sex, int *acc, int *char_id, int *class, int *guild_id); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_sex_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_chr_change_sex_sub_pre[hIndex].func; + preHookFunc(&sex, &acc, &char_id, &class, &guild_id); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.chr.change_sex_sub(sex, acc, char_id, class, guild_id); + } + if (HPMHooks.count.HP_chr_change_sex_sub_post > 0) { + void (*postHookFunc) (int sex, int acc, int char_id, int class, int guild_id); + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_change_sex_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_chr_change_sex_sub_post[hIndex].func; + postHookFunc(sex, acc, char_id, class, guild_id); + } + } + return; +} bool HP_chr_sql_config_read(const char *filename, bool imported) { int hIndex = 0; bool retVal___ = false; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 6f02614debe..09704349151 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -934,6 +934,8 @@ struct { struct HPMHookPoint *HP_clif_status_change_post; struct HPMHookPoint *HP_clif_status_change_sub_pre; struct HPMHookPoint *HP_clif_status_change_sub_post; + struct HPMHookPoint *HP_clif_status_change_notick_pre; + struct HPMHookPoint *HP_clif_status_change_notick_post; struct HPMHookPoint *HP_clif_insert_card_pre; struct HPMHookPoint *HP_clif_insert_card_post; struct HPMHookPoint *HP_clif_inventoryList_pre; @@ -2440,6 +2442,20 @@ struct { struct HPMHookPoint *HP_clif_grade_enchant_result_post; struct HPMHookPoint *HP_clif_announce_grade_status_pre; struct HPMHookPoint *HP_clif_announce_grade_status_post; + struct HPMHookPoint *HP_clif_setlevel_pre; + struct HPMHookPoint *HP_clif_setlevel_post; + struct HPMHookPoint *HP_clif_setlevel_sub_pre; + struct HPMHookPoint *HP_clif_setlevel_sub_post; + struct HPMHookPoint *HP_clif_load_end_ack_sub_messages_pre; + struct HPMHookPoint *HP_clif_load_end_ack_sub_messages_post; + struct HPMHookPoint *HP_clif_sub_guild_invite_pre; + struct HPMHookPoint *HP_clif_sub_guild_invite_post; + struct HPMHookPoint *HP_clif_parse_cmd_normal_pre; + struct HPMHookPoint *HP_clif_parse_cmd_normal_post; + struct HPMHookPoint *HP_clif_parse_cmd_decrypt_pre; + struct HPMHookPoint *HP_clif_parse_cmd_decrypt_post; + struct HPMHookPoint *HP_clif_parse_cmd_optional_pre; + struct HPMHookPoint *HP_clif_parse_cmd_optional_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -3910,6 +3926,16 @@ struct { struct HPMHookPoint *HP_map_readallmaps_post; struct HPMHookPoint *HP_map_config_read_pre; struct HPMHookPoint *HP_map_config_read_post; + struct HPMHookPoint *HP_map_config_read_console_pre; + struct HPMHookPoint *HP_map_config_read_console_post; + struct HPMHookPoint *HP_map_config_read_connection_pre; + struct HPMHookPoint *HP_map_config_read_connection_post; + struct HPMHookPoint *HP_map_config_read_inter_pre; + struct HPMHookPoint *HP_map_config_read_inter_post; + struct HPMHookPoint *HP_map_config_read_database_pre; + struct HPMHookPoint *HP_map_config_read_database_post; + struct HPMHookPoint *HP_map_config_read_map_list_pre; + struct HPMHookPoint *HP_map_config_read_map_list_post; struct HPMHookPoint *HP_map_read_npclist_pre; struct HPMHookPoint *HP_map_read_npclist_post; struct HPMHookPoint *HP_map_inter_config_read_pre; @@ -4622,6 +4648,8 @@ struct { struct HPMHookPoint *HP_npc_questinfo_clear_post; struct HPMHookPoint *HP_npc_secure_timeout_timer_pre; struct HPMHookPoint *HP_npc_secure_timeout_timer_post; + struct HPMHookPoint *HP_npc_process_files_pre; + struct HPMHookPoint *HP_npc_process_files_post; struct HPMHookPoint *HP_nullpo_init_pre; struct HPMHookPoint *HP_nullpo_init_post; struct HPMHookPoint *HP_nullpo_final_pre; @@ -8213,6 +8241,8 @@ struct { int HP_clif_status_change_post; int HP_clif_status_change_sub_pre; int HP_clif_status_change_sub_post; + int HP_clif_status_change_notick_pre; + int HP_clif_status_change_notick_post; int HP_clif_insert_card_pre; int HP_clif_insert_card_post; int HP_clif_inventoryList_pre; @@ -9719,6 +9749,20 @@ struct { int HP_clif_grade_enchant_result_post; int HP_clif_announce_grade_status_pre; int HP_clif_announce_grade_status_post; + int HP_clif_setlevel_pre; + int HP_clif_setlevel_post; + int HP_clif_setlevel_sub_pre; + int HP_clif_setlevel_sub_post; + int HP_clif_load_end_ack_sub_messages_pre; + int HP_clif_load_end_ack_sub_messages_post; + int HP_clif_sub_guild_invite_pre; + int HP_clif_sub_guild_invite_post; + int HP_clif_parse_cmd_normal_pre; + int HP_clif_parse_cmd_normal_post; + int HP_clif_parse_cmd_decrypt_pre; + int HP_clif_parse_cmd_decrypt_post; + int HP_clif_parse_cmd_optional_pre; + int HP_clif_parse_cmd_optional_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; @@ -11189,6 +11233,16 @@ struct { int HP_map_readallmaps_post; int HP_map_config_read_pre; int HP_map_config_read_post; + int HP_map_config_read_console_pre; + int HP_map_config_read_console_post; + int HP_map_config_read_connection_pre; + int HP_map_config_read_connection_post; + int HP_map_config_read_inter_pre; + int HP_map_config_read_inter_post; + int HP_map_config_read_database_pre; + int HP_map_config_read_database_post; + int HP_map_config_read_map_list_pre; + int HP_map_config_read_map_list_post; int HP_map_read_npclist_pre; int HP_map_read_npclist_post; int HP_map_inter_config_read_pre; @@ -11901,6 +11955,8 @@ struct { int HP_npc_questinfo_clear_post; int HP_npc_secure_timeout_timer_pre; int HP_npc_secure_timeout_timer_post; + int HP_npc_process_files_pre; + int HP_npc_process_files_post; int HP_nullpo_init_pre; int HP_nullpo_init_post; int HP_nullpo_final_pre; @@ -14609,7 +14665,7 @@ struct { struct homunculus_interface homun; struct instance_interface instance; struct intif_interface intif; - struct irc_bot_interface ircbot; + struct ircbot_interface ircbot; struct itemdb_interface itemdb; struct libconfig_interface libconfig; struct log_interface logs; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3f942916836..7d658b2e62e 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -491,6 +491,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->combo_delay, HP_clif_combo_delay) }, { HP_POP(clif->status_change, HP_clif_status_change) }, { HP_POP(clif->status_change_sub, HP_clif_status_change_sub) }, + { HP_POP(clif->status_change_notick, HP_clif_status_change_notick) }, { HP_POP(clif->insert_card, HP_clif_insert_card) }, { HP_POP(clif->inventoryList, HP_clif_inventoryList) }, { HP_POP(clif->inventoryItems, HP_clif_inventoryItems) }, @@ -1244,6 +1245,13 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->grade_enchant_add_item_result_fail, HP_clif_grade_enchant_add_item_result_fail) }, { HP_POP(clif->grade_enchant_result, HP_clif_grade_enchant_result) }, { HP_POP(clif->announce_grade_status, HP_clif_announce_grade_status) }, + { HP_POP(clif->setlevel, HP_clif_setlevel) }, + { HP_POP(clif->setlevel_sub, HP_clif_setlevel_sub) }, + { HP_POP(clif->load_end_ack_sub_messages, HP_clif_load_end_ack_sub_messages) }, + { HP_POP(clif->sub_guild_invite, HP_clif_sub_guild_invite) }, + { HP_POP(clif->parse_cmd_normal, HP_clif_parse_cmd_normal) }, + { HP_POP(clif->parse_cmd_decrypt, HP_clif_parse_cmd_decrypt) }, + { HP_POP(clif->parse_cmd_optional, HP_clif_parse_cmd_optional) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, @@ -1670,7 +1678,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(intif->pRodexCheckName, HP_intif_pRodexCheckName) }, { HP_POP(intif->pRecvClanMemberAction, HP_intif_pRecvClanMemberAction) }, { HP_POP(intif->pAchievementsLoad, HP_intif_pAchievementsLoad) }, -/* irc_bot_interface */ +/* ircbot_interface */ { HP_POP(ircbot->init, HP_ircbot_init) }, { HP_POP(ircbot->final, HP_ircbot_final) }, { HP_POP(ircbot->parse, HP_ircbot_parse) }, @@ -2000,6 +2008,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(map->readgat, HP_map_readgat) }, { HP_POP(map->readallmaps, HP_map_readallmaps) }, { HP_POP(map->config_read, HP_map_config_read) }, + { HP_POP(map->config_read_console, HP_map_config_read_console) }, + { HP_POP(map->config_read_connection, HP_map_config_read_connection) }, + { HP_POP(map->config_read_inter, HP_map_config_read_inter) }, + { HP_POP(map->config_read_database, HP_map_config_read_database) }, + { HP_POP(map->config_read_map_list, HP_map_config_read_map_list) }, { HP_POP(map->read_npclist, HP_map_read_npclist) }, { HP_POP(map->inter_config_read, HP_map_inter_config_read) }, { HP_POP(map->inter_config_read_database_names, HP_map_inter_config_read_database_names) }, @@ -2365,6 +2378,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(npc->refresh, HP_npc_refresh) }, { HP_POP(npc->questinfo_clear, HP_npc_questinfo_clear) }, { HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) }, + { HP_POP(npc->process_files, HP_npc_process_files) }, /* nullpo_interface */ { HP_POP(nullpo->init, HP_nullpo_init) }, { HP_POP(nullpo->final, HP_nullpo_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 0059eeb8c06..a33fab42d96 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -12177,6 +12177,32 @@ void HP_clif_status_change_sub(struct block_list *bl, int type, int relevant_bl, } return; } +void HP_clif_status_change_notick(struct block_list *bl, int type, int relevant_bl, int flag, int tick, int total_tick, int val1, int val2, int val3) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_status_change_notick_pre > 0) { + void (*preHookFunc) (struct block_list **bl, int *type, int *relevant_bl, int *flag, int *tick, int *total_tick, int *val1, int *val2, int *val3); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_status_change_notick_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_status_change_notick_pre[hIndex].func; + preHookFunc(&bl, &type, &relevant_bl, &flag, &tick, &total_tick, &val1, &val2, &val3); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.status_change_notick(bl, type, relevant_bl, flag, tick, total_tick, val1, val2, val3); + } + if (HPMHooks.count.HP_clif_status_change_notick_post > 0) { + void (*postHookFunc) (struct block_list *bl, int type, int relevant_bl, int flag, int tick, int total_tick, int val1, int val2, int val3); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_status_change_notick_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_status_change_notick_post[hIndex].func; + postHookFunc(bl, type, relevant_bl, flag, tick, total_tick, val1, val2, val3); + } + } + return; +} void HP_clif_insert_card(struct map_session_data *sd, int idx_equip, int idx_card, int flag) { int hIndex = 0; if (HPMHooks.count.HP_clif_insert_card_pre > 0) { @@ -31810,6 +31836,194 @@ void HP_clif_announce_grade_status(struct map_session_data *sd, int item_id, enu } return; } +int HP_clif_setlevel(struct block_list *bl) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_clif_setlevel_pre > 0) { + int (*preHookFunc) (struct block_list **bl); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_setlevel_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_setlevel_pre[hIndex].func; + retVal___ = preHookFunc(&bl); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.setlevel(bl); + } + if (HPMHooks.count.HP_clif_setlevel_post > 0) { + int (*postHookFunc) (int retVal___, struct block_list *bl); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_setlevel_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_setlevel_post[hIndex].func; + retVal___ = postHookFunc(retVal___, bl); + } + } + return retVal___; +} +int HP_clif_setlevel_sub(int lv) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_clif_setlevel_sub_pre > 0) { + int (*preHookFunc) (int *lv); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_setlevel_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_setlevel_sub_pre[hIndex].func; + retVal___ = preHookFunc(&lv); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.setlevel_sub(lv); + } + if (HPMHooks.count.HP_clif_setlevel_sub_post > 0) { + int (*postHookFunc) (int retVal___, int lv); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_setlevel_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_setlevel_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, lv); + } + } + return retVal___; +} +void HP_clif_load_end_ack_sub_messages(struct map_session_data *sd, bool connect_new, bool change_map) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_load_end_ack_sub_messages_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, bool *connect_new, bool *change_map); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_load_end_ack_sub_messages_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_load_end_ack_sub_messages_pre[hIndex].func; + preHookFunc(&sd, &connect_new, &change_map); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.load_end_ack_sub_messages(sd, connect_new, change_map); + } + if (HPMHooks.count.HP_clif_load_end_ack_sub_messages_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, bool connect_new, bool change_map); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_load_end_ack_sub_messages_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_load_end_ack_sub_messages_post[hIndex].func; + postHookFunc(sd, connect_new, change_map); + } + } + return; +} +bool HP_clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_data *t_sd) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_clif_sub_guild_invite_pre > 0) { + bool (*preHookFunc) (int *fd, struct map_session_data **sd, struct map_session_data **t_sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_sub_guild_invite_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_sub_guild_invite_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sd, &t_sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.sub_guild_invite(fd, sd, t_sd); + } + if (HPMHooks.count.HP_clif_sub_guild_invite_post > 0) { + bool (*postHookFunc) (bool retVal___, int fd, struct map_session_data *sd, struct map_session_data *t_sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_sub_guild_invite_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_sub_guild_invite_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, sd, t_sd); + } + } + return retVal___; +} +unsigned short HP_clif_parse_cmd_normal(int fd, struct map_session_data *sd) { + int hIndex = 0; + unsigned short retVal___ = 0; + if (HPMHooks.count.HP_clif_parse_cmd_normal_pre > 0) { + unsigned short (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_parse_cmd_normal_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_parse_cmd_normal_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.parse_cmd_normal(fd, sd); + } + if (HPMHooks.count.HP_clif_parse_cmd_normal_post > 0) { + unsigned short (*postHookFunc) (unsigned short retVal___, int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_parse_cmd_normal_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_parse_cmd_normal_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, sd); + } + } + return retVal___; +} +unsigned short HP_clif_parse_cmd_decrypt(int fd, struct map_session_data *sd) { + int hIndex = 0; + unsigned short retVal___ = 0; + if (HPMHooks.count.HP_clif_parse_cmd_decrypt_pre > 0) { + unsigned short (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_parse_cmd_decrypt_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_parse_cmd_decrypt_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.parse_cmd_decrypt(fd, sd); + } + if (HPMHooks.count.HP_clif_parse_cmd_decrypt_post > 0) { + unsigned short (*postHookFunc) (unsigned short retVal___, int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_parse_cmd_decrypt_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_parse_cmd_decrypt_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, sd); + } + } + return retVal___; +} +unsigned short HP_clif_parse_cmd_optional(int fd, struct map_session_data *sd) { + int hIndex = 0; + unsigned short retVal___ = 0; + if (HPMHooks.count.HP_clif_parse_cmd_optional_pre > 0) { + unsigned short (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_parse_cmd_optional_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_parse_cmd_optional_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.parse_cmd_optional(fd, sd); + } + if (HPMHooks.count.HP_clif_parse_cmd_optional_post > 0) { + unsigned short (*postHookFunc) (unsigned short retVal___, int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_parse_cmd_optional_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_parse_cmd_optional_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, sd); + } + } + return retVal___; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; @@ -42893,7 +43107,7 @@ void HP_intif_pAchievementsLoad(int fd) { } return; } -/* irc_bot_interface */ +/* ircbot_interface */ void HP_ircbot_init(bool minimal) { int hIndex = 0; if (HPMHooks.count.HP_ircbot_init_pre > 0) { @@ -51673,6 +51887,141 @@ bool HP_map_config_read(const char *filename, bool imported) { } return retVal___; } +bool HP_map_config_read_console(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_map_config_read_console_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_console_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_map_config_read_console_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.map.config_read_console(filename, config, imported); + } + if (HPMHooks.count.HP_map_config_read_console_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_console_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_map_config_read_console_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_map_config_read_connection(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_map_config_read_connection_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_connection_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_map_config_read_connection_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.map.config_read_connection(filename, config, imported); + } + if (HPMHooks.count.HP_map_config_read_connection_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_connection_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_map_config_read_connection_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_map_config_read_inter(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_map_config_read_inter_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_inter_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_map_config_read_inter_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.map.config_read_inter(filename, config, imported); + } + if (HPMHooks.count.HP_map_config_read_inter_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_inter_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_map_config_read_inter_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_map_config_read_database(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_map_config_read_database_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_database_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_map_config_read_database_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.map.config_read_database(filename, config, imported); + } + if (HPMHooks.count.HP_map_config_read_database_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_database_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_map_config_read_database_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_map_config_read_map_list(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_map_config_read_map_list_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_map_list_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_map_config_read_map_list_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.map.config_read_map_list(filename, config, imported); + } + if (HPMHooks.count.HP_map_config_read_map_list_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_map_config_read_map_list_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_map_config_read_map_list_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} bool HP_map_read_npclist(const char *filename, bool imported) { int hIndex = 0; bool retVal___ = false; @@ -61400,6 +61749,32 @@ int HP_npc_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } +void HP_npc_process_files(int npc_min) { + int hIndex = 0; + if (HPMHooks.count.HP_npc_process_files_pre > 0) { + void (*preHookFunc) (int *npc_min); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_process_files_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_npc_process_files_pre[hIndex].func; + preHookFunc(&npc_min); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc.process_files(npc_min); + } + if (HPMHooks.count.HP_npc_process_files_post > 0) { + void (*postHookFunc) (int npc_min); + for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_process_files_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_npc_process_files_post[hIndex].func; + postHookFunc(npc_min); + } + } + return; +} /* nullpo_interface */ void HP_nullpo_init(void) { int hIndex = 0; diff --git a/tools/validateinterfaces.py b/tools/validateinterfaces.py index b2558996da9..21735484d27 100755 --- a/tools/validateinterfaces.py +++ b/tools/validateinterfaces.py @@ -24,62 +24,236 @@ import re import sys +debug = False + interfaceRe = re.compile("struct (?P[a-z_]+)_interface (?P[a-z_]+)_s;") +# known methods what must be not added to interfaces +ignoreMethods = ( + "cmdline_args_init_local", + "map_bl_list_expand", + "map_block_free_expand", + "map_zone_mf_cache_add", + "mob_parse_dbrow_cap_value", + "clif_calc_delay", +) + +# need fix all this names, or add them to ignoreMethods +skipBeforeFix = ( + "atcommand_command_type2idx", + "atcommand_help_string", + "chrif_reset", + "console_handler", + "console_parse", + "console_parse_create", + "console_parse_final", + "console_parse_init", + "console_parse_key_pressed", + "console_parse_list_subs", + "console_parse_sub", + "console_parse_timer", + "console_setSQL", + "des_E", + "des_FP", + "des_IP", + "des_RoundFunction", + "des_SBOX", + "des_TP", + "duel_leave_sub", + "duel_savetime", + "duel_showinfo_sub", + "grfio_add", + "grfio_entryread", + "grfio_filelist_add", + "grfio_filelist_compact", + "grfio_filelist_find", + "grfio_filelist_modify", + "grfio_is_full_encrypt", + "grfio_localpath_create", + "grfio_parse_restable_row", + "grfio_resourcecheck", + "guild_storage_additem", + "guild_storage_delete", + "guild_storage_delitem", + "instance_cleanup_sub", + "instance_del_load", + "lclif_parse_CA_ACK_MOBILE_OTP", + "lclif_parse_CA_CHARSERVERCONNECT", + "lclif_parse_CA_CONNECT_INFO_CHANGED", + "lclif_parse_CA_EXE_HASHCHECK", + "lclif_parse_CA_LOGIN", + "lclif_parse_CA_LOGIN2", + "lclif_parse_CA_LOGIN3", + "lclif_parse_CA_LOGIN4", + "lclif_parse_CA_LOGIN_HAN", + "lclif_parse_CA_LOGIN_OTP", + "lclif_parse_CA_LOGIN_PCBANG", + "lclif_parse_CA_OTP_CODE", + "lclif_parse_CA_REQ_HASH", + "lclif_parse_CA_SSO_LOGIN_REQ", + "lclif_parse_sub", + "log_atcommand_sub_sql", + "log_branch_sub_sql", + "log_chat_sub_sql", + "log_config_read_database", + "log_config_read_filter", + "log_config_read_filter_chat", + "log_config_read_filter_item", + "log_mvpdrop_sub_sql", + "log_npc_sub_sql", + "log_pick", + "log_pick_sub_sql", + "log_zeny_sub_sql", + "npc_chat_def_pattern", + "npc_chat_finalize", + "npc_chat_sub", + "nullpo_backtrace_get_executable_path", + "nullpo_backtrace_print", + "nullpo_error_callback", + "nullpo_print_callback", + "pc_bonus_addele", + "pc_bonus_subele", + "pc_group_exists", + "pc_group_get_dummy_group", + "pc_group_get_idx", + "pc_group_get_level", + "pc_group_get_name", + "pc_group_has_permission", + "pc_group_id2group", + "pc_groups_add_permission", + "pc_group_should_log_commands", + "pc_groups_reload", + "pc_setequipindex", + "quest_reload_check_sub", + "refine_announce_behavior_string2enum", + "refine_failure_behavior_string2enum", + "refine_is_refinable", + "refine_readdb_refine_libconfig", + "refine_readdb_refine_libconfig_sub", + "refine_readdb_refinery_ui_settings", + "refine_readdb_refinery_ui_settings_items", + "refine_readdb_refinery_ui_settings_sub", + "rodex_refresh_stamps", + "script_array_index_cmp", + "script_casecheck_add_str_sub", + "script_casecheck_clear_sub", + "script_dump_stack", + "script_global_casecheck_add_str", + "script_global_casecheck_clear", + "script_load_translation_sub", + "script_local_casecheck_add_str", + "script_local_casecheck_clear", + "searchstore_getsearchallfunc", + "searchstore_getsearchfunc", + "searchstore_getstoreid", + "searchstore_hasstore", + "skill_reveal_trap", + "skill_validate_unit_id_array", + "skill_validate_unit_id_group", + "skill_validate_unit_id_value", + "status_get_matk_sub", + "status_get_rand_matk", + "storage_guild_storageadd", + "storage_guild_storageaddfromcart", + "storage_guild_storageclose", + "storage_guild_storageget", + "storage_guild_storagegettocart", + "storage_guild_storageopen", + "storage_guild_storage_quit", + "storage_guild_storagesave", + "storage_guild_storagesaved", + "sysinfo_arch_retrieve", + "sysinfo_cpu_retrieve", + "sysinfo_git_get_revision", + "sysinfo_osversion_retrieve", + "sysinfo_svn_get_revision", + "sysinfo_systeminfo_retrieve", + "sysinfo_vcsrevision_src_retrieve", + "sysinfo_vcstype_name_retrieve", + "thread_main_redirector", + "thread_terminated", +) + class Tracker: pass + def searchDefault(r, ifname): defaultStr = "void {0}_defaults(void)".format(ifname); + defaultStr2 = "static void {0}_defaults(void)".format(ifname); for line in r: - if line.find(defaultStr) == 0: + if line.find(defaultStr) == 0 or line.find(defaultStr2) == 0: return True return False + def searchStructStart(r, ifname): for line in r: if line.find("struct {0}_interface".format(ifname)) == 0: return True return False -def readCFile(tracker, cFile): - methods = set() - shortIfName = "" + +def searchPossibleInterfacesInCFile(tracker, cFile): + possibleInterfaces = [] with open(cFile, "r") as r: for line in r: -# print "cline1: " + line m = interfaceRe.search(line) - if m != None and m.group("name1") == m.group("name2"): - # found C file with interface - ifname = m.group("name1") - if searchDefault(r, ifname) == False: - return (None, shortIfName, methods) - lineRe = re.compile("(?P[a-z_]+)->(?P[\w_]+)[ ][=][ ](?P[^;]+);") - for line in r: -# print "cline2: " + line - test = line.strip() - if len(test) > 2 and test[0:2] == "//": - continue - if len(line) > 0 and line[0] == "}": - break - m = lineRe.search(line) - if m != None: - tmp = m.group("ifname") - if len(tmp) < 2 or tmp[0] != ifname[0]: - continue - if shortIfName == "": - shortIfName = m.group("ifname") -# print "{2}: add {0}, from: {1}".format(m.group("method"), line, ifname) - methods.add(m.group("method")) - tracker.interfaces.add(ifname); - tracker.fullmethods.add(m.group("fullmethod")); - return (ifname, shortIfName, methods) - return (None, shortIfName, methods) + if m != None: + name1 = m.group("name1") + if name1 == m.group("name2"): + if debug: + line = line.replace("\n", "") + print("{0}: Found interface var {1}_interface at line:\n {2}".format(cFile, name1, line)) + possibleInterfaces.append(name1) + return possibleInterfaces + + +def addCInterfaceMethods(tracker, r, ifname): + methods = set() + shortIfName = "" + lineRe = re.compile("(?P[a-z_]+)->(?P[\w_]+)[ ][=][ ](?P[^;]+);") + for line in r: + test = line.strip() + if len(test) > 2 and test[0:2] == "//": + continue + if len(line) > 0 and line[0] == "}": + break + m = lineRe.search(line) + if m != None: + tmp = m.group("ifname") + if len(tmp) < 2 or tmp[0] != ifname[0]: + continue + if shortIfName == "": + shortIfName = m.group("ifname") + # print "{2}: add {0}, from: {1}".format(m.group("method"), line, ifname) + methods.add(m.group("method")) + tracker.interfaces.add(ifname); + tracker.fullmethods.add(m.group("fullmethod")); + return (ifname, shortIfName, methods) + + +def readCFile(tracker, cFile): + possibleInterfaces = searchPossibleInterfacesInCFile(tracker, cFile) + interfaces = [] + for ifname in possibleInterfaces: + with open(cFile, "r") as r: + if searchDefault(r, ifname) == False: + if debug: + print("{0}: Error: no defaults function found: {1}_defaults".format(cFile, ifname)) + tracker.retCode = 1 + continue + info = addCInterfaceMethods(tracker, r, ifname) + interfaces.append(info) + return interfaces + def readHFile(tracker, hFile, ifname): methods = set() with open(hFile, "r") as r: if searchStructStart(r, ifname) == False: + print("{0}: Error: No struct found: {1}".format(cFile, ifname)) + tracker.retCode = 1 return methods lineRe = re.compile("[(][*](?P[^)]+)[)]".format(ifname)) for line in r: @@ -96,22 +270,24 @@ def readHFile(tracker, hFile, ifname): tracker.fullmethods.add(ifname + "_" + m.group("method")) return methods + def checkIfFile(tracker, cFile, hFile): - data = readCFile(tracker, cFile) - cMethods = data[2] - ifname = data[0] - shortIfName = data[1] - if len(cMethods) > 0: - hMethods = readHFile(tracker, hFile, ifname) - for method in hMethods: - tracker.arr[ifname + "_" + method] = list() - tracker.methods.add(ifname + "_" + method) - if method not in cMethods: - print("Missing initialisation in file {0}: {1}".format(cFile, method)) - tracker.retCode = 1 -# for method in cMethods: -# if method not in hMethods: -# print "Extra method in file {0}: {1}".format(cFile, method) + interfaces = readCFile(tracker, cFile) + for data in interfaces: + cMethods = data[2] + ifname = data[0] + shortIfName = data[1] + if len(cMethods) > 0: + hMethods = readHFile(tracker, hFile, ifname) + for method in hMethods: + if method in ignoreMethods: + continue + tracker.arr[ifname + "_" + method] = list() + tracker.methods.add(ifname + "_" + method) + if method not in cMethods: + print("{0} Error: missing initialisation {1}".format(cFile, method)) + tracker.retCode = 1 + def processIfDir(tracker, srcDir): files = os.listdir(srcDir) @@ -134,6 +310,7 @@ def checkChr(ch): return True return False + def checkFile(tracker, cFile): # print "Checking: " + cFile with open(cFile, "r") as r: @@ -161,6 +338,7 @@ def checkFile(tracker, cFile): continue tracker.arr[part].append(line) + def processDir(tracker, srcDir): files = os.listdir(srcDir) for file1 in files: @@ -173,9 +351,12 @@ def processDir(tracker, srcDir): # elif file1[-2:] == ".c": checkFile(tracker, cPath) + def reportMethods(tracker): print("\n") for method in tracker.methods: + if method in ignoreMethods: + continue if len(tracker.arr[method]) > 2: print(method) for t in tracker.arr[method]: @@ -195,9 +376,13 @@ def checkLostFile(tracker, cFile): name = "{0}_{1}".format(m.group("ifname"), m.group("method")) if name[:name.find("_")] not in tracker.interfaces and m.group("ifname") not in tracker.interfaces: continue - if name not in tracker.fullmethods: + if name in ignoreMethods: + continue + if name not in tracker.fullmethods and name not in tracker.skipMethods: # print "src : " + line print(name) + tracker.retCode = 1 + def processLostDir(tracker, srcDir): files = os.listdir(srcDir) @@ -210,18 +395,21 @@ def processLostDir(tracker, srcDir): elif file1[-2:] == ".c": checkLostFile(tracker, cPath) + def runIf(): processIfDir(tracker, "../src/char"); processIfDir(tracker, "../src/map"); processIfDir(tracker, "../src/login"); processIfDir(tracker, "../src/common"); + def runLost(): processLostDir(tracker, "../src/char"); processLostDir(tracker, "../src/map"); processLostDir(tracker, "../src/login"); processLostDir(tracker, "../src/common"); + def runLong(): processDir(tracker, "../src/char"); processDir(tracker, "../src/map"); @@ -229,6 +417,7 @@ def runLong(): processDir(tracker, "../src/common"); reportMethods(tracker) + tracker = Tracker() tracker.arr = dict() tracker.methods = set() @@ -241,12 +430,17 @@ def runLong(): else: cmd = "default" +tracker.skipMethods = [] if cmd == "silent": runIf() + tracker.skipMethods = skipBeforeFix + runLost(); elif cmd == "init": print("Checking interfaces initialisation") runIf() elif cmd == "lost": + print("Checking interfaces initialisation") + runIf() print("Checking not added functions to interfaces") runLost(); elif cmd == "long":