diff options
Diffstat (limited to 'src')
60 files changed, 1601 insertions, 493 deletions
diff --git a/src/char/HPMchar.c b/src/char/HPMchar.c index 43a94604d..9f075d909 100644 --- a/src/char/HPMchar.c +++ b/src/char/HPMchar.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2014-2015 Hercules Dev Team + * Copyright (C) 2014-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/char/HPMchar.h b/src/char/HPMchar.h index 2bf2820f8..0de3b88b8 100644 --- a/src/char/HPMchar.h +++ b/src/char/HPMchar.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2014-2015 Hercules Dev Team + * Copyright (C) 2014-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/char/char.c b/src/char/char.c index 914017092..99198fa50 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -767,7 +767,7 @@ static int char_getitemdata_from_sql(struct item *items, int max, int guid, enum } if (SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, sizeof item.id, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, sizeof item.nameid, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &item.nameid, sizeof item.nameid, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, sizeof item.amount, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, sizeof item.equip, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, sizeof item.identify, NULL, NULL) @@ -781,7 +781,7 @@ static int char_getitemdata_from_sql(struct item *items, int max, int guid, enum } for (i = 0; i < MAX_SLOTS; i++) { - if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + i, SQLDT_SHORT, &item.card[i], sizeof item.card[i], NULL, NULL)) + if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + i, SQLDT_INT, &item.card[i], sizeof item.card[i], NULL, NULL)) SqlStmt_ShowDebug(stmt); } @@ -872,7 +872,7 @@ static int char_memitemdata_to_sql(const struct item *p_items, int guid, enum in && p_items[j].nameid != 0 && cp_it->nameid == p_items[j].nameid && cp_it->unique_id == p_items[j].unique_id - && memcmp(p_items[j].card, cp_it->card, sizeof(short) * MAX_SLOTS) == 0 + && memcmp(p_items[j].card, cp_it->card, sizeof(int) * MAX_SLOTS) == 0 && memcmp(p_items[j].option, cp_it->option, 5 * MAX_ITEM_OPTIONS) == 0); if (j < item_count) { // Item found. @@ -1099,16 +1099,16 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) || SQL_ERROR == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, sizeof p.hair, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, sizeof p.hair_color, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, sizeof p.clothes_color, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, sizeof p.body, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.look.weapon, sizeof p.look.weapon, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.look.shield, sizeof p.look.shield, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.look.head_top, sizeof p.look.head_top, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.look.head_mid, sizeof p.look.head_mid, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.look.head_bottom, sizeof p.look.head_bottom, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p.body, sizeof p.body, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p.look.weapon, sizeof p.look.weapon, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p.look.shield, sizeof p.look.shield, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_INT, &p.look.head_top, sizeof p.look.head_top, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_INT, &p.look.head_mid, sizeof p.look.head_mid, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_INT, &p.look.head_bottom, sizeof p.look.head_bottom, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_STRING, &last_map, sizeof last_map, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_USHORT, &p.rename, sizeof p.rename, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_TIME, &p.delete_date, sizeof p.delete_date, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.look.robe, sizeof p.look.robe, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_INT, &p.look.robe, sizeof p.look.robe, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, sizeof p.slotchange, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_TIME, &unban_time, sizeof unban_time, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof sex, NULL, NULL) @@ -1213,12 +1213,12 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, sizeof p->hair, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, sizeof p->hair_color, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, sizeof p->clothes_color, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, sizeof p->body, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->look.weapon, sizeof p->look.weapon, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->look.shield, sizeof p->look.shield, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->look.head_top, sizeof p->look.head_top, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->look.head_mid, sizeof p->look.head_mid, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->look.head_bottom, sizeof p->look.head_bottom, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_INT, &p->body, sizeof p->body, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_INT, &p->look.weapon, sizeof p->look.weapon, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_INT, &p->look.shield, sizeof p->look.shield, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_INT, &p->look.head_top, sizeof p->look.head_top, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_INT, &p->look.head_mid, sizeof p->look.head_mid, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_INT, &p->look.head_bottom, sizeof p->look.head_bottom, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof last_map, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 40, SQLDT_INT16, &p->last_point.x, sizeof p->last_point.x, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 41, SQLDT_INT16, &p->last_point.y, sizeof p->last_point.y, NULL, NULL) @@ -1232,7 +1232,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa || SQL_ERROR == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, sizeof p->fame, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, sizeof p->rename, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 51, SQLDT_TIME, &p->delete_date, sizeof p->delete_date, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->look.robe, sizeof p->look.robe, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 52, SQLDT_INT, &p->look.robe, sizeof p->look.robe, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, sizeof p->slotchange, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, sizeof opt, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, sizeof p->font, NULL, NULL) diff --git a/src/char/int_pet.c b/src/char/int_pet.c index e824d7b58..8f87becff 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -160,8 +160,8 @@ static int inter_pet_delete(int pet_id) return 0; } //------------------------------------------------------ -static struct s_pet *inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name) +static struct s_pet *inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, + int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name) { nullpo_ret(pet_name); memset(inter_pet->pt, 0, sizeof(struct s_pet)); diff --git a/src/char/int_pet.h b/src/char/int_pet.h index 9e3a2ac59..104771735 100644 --- a/src/char/int_pet.h +++ b/src/char/int_pet.h @@ -37,8 +37,8 @@ struct inter_pet_interface { int (*delete_) (int pet_id); int (*parse_frommap) (int fd); - struct s_pet *(*create) (int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + struct s_pet *(*create) (int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, + int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); struct s_pet *(*load) (int account_id, int char_id, int pet_id); }; diff --git a/src/char/int_rodex.c b/src/char/int_rodex.c index e70a6bbf5..18c277574 100644 --- a/src/char/int_rodex.c +++ b/src/char/int_rodex.c @@ -164,7 +164,7 @@ static int inter_rodex_fromsql(int char_id, int account_id, int8 opentype, int64 if (msg.type & MAIL_TYPE_ITEM) { if (SQL_ERROR == SQL->StmtExecute(stmt_items) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 0, SQLDT_SHORT, &it.nameid, sizeof it.nameid, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 0, SQLDT_INT, &it.nameid, sizeof it.nameid, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 1, SQLDT_SHORT, &it.amount, sizeof it.amount, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 2, SQLDT_UINT, &it.equip, sizeof it.equip, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 3, SQLDT_CHAR, &it.identify, sizeof it.identify, NULL, NULL) @@ -177,7 +177,7 @@ static int inter_rodex_fromsql(int char_id, int account_id, int8 opentype, int64 SqlStmt_ShowDebug(stmt_items); } for (i = 0; i < MAX_SLOTS; i++) { - if (SQL_ERROR == SQL->StmtBindColumn(stmt_items, 9 + i, SQLDT_SHORT, &it.card[i], sizeof it.card[i], NULL, NULL)) + if (SQL_ERROR == SQL->StmtBindColumn(stmt_items, 9 + i, SQLDT_INT, &it.card[i], sizeof it.card[i], NULL, NULL)) SqlStmt_ShowDebug(stmt_items); } for (i = 0; i < MAX_ITEM_OPTIONS; i++) { diff --git a/src/char/int_storage.c b/src/char/int_storage.c index da4522971..130df5515 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -71,7 +71,7 @@ static int inter_storage_tosql(int account_id, const struct storage_data *p) && (p_it = &VECTOR_INDEX(p->item, j)) != NULL && cp_it->nameid == p_it->nameid && cp_it->unique_id == p_it->unique_id - && memcmp(p_it->card, cp_it->card, sizeof(short) * MAX_SLOTS) == 0 + && memcmp(p_it->card, cp_it->card, sizeof(int) * MAX_SLOTS) == 0 && memcmp(p_it->option, cp_it->option, 5 * MAX_ITEM_OPTIONS) == 0); if (j < VECTOR_LENGTH(p->item)) { @@ -373,7 +373,7 @@ static bool inter_storage_retrieve_bound_items(int char_id, int account_id, int memset(&item, 0, sizeof(item)); SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, sizeof item.id, NULL, NULL); - SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, sizeof item.nameid, NULL, NULL); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &item.nameid, sizeof item.nameid, NULL, NULL); SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, sizeof item.amount, NULL, NULL); SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, sizeof item.equip, NULL, NULL); SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, sizeof item.identify, NULL, NULL); @@ -384,7 +384,7 @@ static bool inter_storage_retrieve_bound_items(int char_id, int account_id, int SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, sizeof item.unique_id, NULL, NULL); /* Card Slots */ for (j = 0; j < MAX_SLOTS; ++j) - SQL->StmtBindColumn(stmt, 10 + j, SQLDT_SHORT, &item.card[j], sizeof item.card[j], NULL, NULL); + SQL->StmtBindColumn(stmt, 10 + j, SQLDT_INT, &item.card[j], sizeof item.card[j], NULL, NULL); /* Item Options */ for (j = 0; j < MAX_ITEM_OPTIONS; ++j) { SQL->StmtBindColumn(stmt, 10 + MAX_SLOTS + j * 2, SQLDT_INT16, &item.option[j].index, sizeof item.option[j].index, NULL, NULL); diff --git a/src/char/inter.c b/src/char/inter.c index 718dfd60d..7269009a7 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -77,7 +77,7 @@ static int inter_recv_packet_length[] = { -1,-1,10,10, 0,-1,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3050- Auction System [Zephyrus], Item Bound [Mhalicot] 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3060- Quest system [Kevin] [Inkfish] -1,10, 6,-1, 0, 0, 0, 0, 0, 0, 0, 0, -1,10, 6,-1, // 3070- Mercenary packets [Zephyrus], Elemental packets [pakpil] - 48,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080- + 52,14,-1, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3080- -1,10,-1, 6, 0, 20,10,11, -1,6 + NAME_LENGTH, 0, 0, 0, 0, 0, 0, // 3090- Homunculus packets [albator], RoDEX packets }; diff --git a/src/char/mapif.c b/src/char/mapif.c index 6acf803e2..30f8c1178 100644 --- a/src/char/mapif.c +++ b/src/char/mapif.c @@ -1518,8 +1518,17 @@ static int mapif_parse_CreatePet(int fd) RFIFOHEAD(fd); account_id = RFIFOL(fd, 2); - pet = inter_pet->create(account_id, RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), - RFIFOW(fd, 16), RFIFOW(fd, 18), RFIFOW(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), RFIFOP(fd, 24)); + pet = inter_pet->create(account_id, + RFIFOL(fd, 6), + RFIFOW(fd, 10), + RFIFOW(fd, 12), + RFIFOL(fd, 14), + RFIFOL(fd, 18), + RFIFOW(fd, 22), + RFIFOW(fd, 24), + RFIFOB(fd, 26), + RFIFOB(fd, 27), + RFIFOP(fd, 28)); if (pet != NULL) mapif->pet_created(fd, account_id, pet); diff --git a/src/common/HPM.c b/src/common/HPM.c index 300edf60a..014c947b6 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/common/HPM.h b/src/common/HPM.h index efa5d8370..a4e3e46cc 100644 --- a/src/common/HPM.h +++ b/src/common/HPM.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 7d865c908..7f96954bc 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -541,6 +541,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "mapflag_skill_adjust", sizeof(struct mapflag_skill_adjust), SERVER_TYPE_MAP }, { "mapit_interface", sizeof(struct mapit_interface), SERVER_TYPE_MAP }, { "questinfo", sizeof(struct questinfo), SERVER_TYPE_MAP }, + { "questinfo_qreq", sizeof(struct questinfo_qreq), SERVER_TYPE_MAP }, { "spawn_data", sizeof(struct spawn_data), SERVER_TYPE_MAP }, #else #define MAP_MAP_H diff --git a/src/common/mmo.h b/src/common/mmo.h index 4a79245a1..1b9562e9d 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -371,13 +371,13 @@ struct item_option { struct item { int id; - short nameid; + int nameid; short amount; unsigned int equip; // Location(s) where item is equipped (using enum equip_pos for bitmasking). char identify; char refine; char attribute; - short card[MAX_SLOTS]; + int card[MAX_SLOTS]; unsigned int expire_time; char favorite; unsigned char bound; @@ -538,8 +538,8 @@ struct s_pet { int pet_id; short class_; short level; - short egg_id;//pet egg id - short equip;//pet equip name_id + int egg_id;//pet egg id + int equip;//pet equip name_id short intimate;//pet friendly short hungry;//pet hungry char name[NAME_LENGTH]; @@ -634,7 +634,8 @@ struct mmo_charstatus { unsigned int option; short manner; // Defines how many minutes a char will be muted, each negative point is equivalent to a minute. unsigned char karma; - short hair,hair_color,clothes_color,body; + short hair, hair_color, clothes_color; + int body; int party_id,guild_id,clan_id,pet_id,hom_id,mer_id,ele_id; int fame; @@ -644,12 +645,12 @@ struct mmo_charstatus { int sword_faith, sword_calls; struct { - short weapon; ///< Weapon view sprite id. - short shield; ///< Shield view sprite id. - short head_top; ///< Top headgear view sprite id. - short head_mid; ///< Middle headgear view sprite id. - short head_bottom; ///< Bottom headgear view sprite id. - short robe; ///< Robe view sprite id. + int weapon; ///< Weapon view sprite id. + int shield; ///< Shield view sprite id. + int head_top; ///< Top headgear view sprite id. + int head_mid; ///< Middle headgear view sprite id. + int head_bottom; ///< Bottom headgear view sprite id. + int robe; ///< Robe view sprite id. } look; char name[NAME_LENGTH]; @@ -1270,6 +1271,20 @@ enum hz_char_ask_name_answer { CHAR_ASK_NAME_ANS_OFFLINE = 3, // login-server offline }; +/** + * Quest Info Types + */ +enum questinfo_type { + QINFO_JOB, + QINFO_SEX, + QINFO_BASE_LEVEL, + QINFO_JOB_LEVEL, + QINFO_ITEM, + QINFO_HOMUN_LEVEL, + QINFO_HOMUN_TYPE, + QINFO_QUEST +}; + /* packet size constant for itemlist */ #if MAX_INVENTORY > MAX_STORAGE && MAX_INVENTORY > MAX_CART #define MAX_ITEMLIST MAX_INVENTORY diff --git a/src/login/HPMlogin.c b/src/login/HPMlogin.c index 4f63da6ac..c13bd96a3 100644 --- a/src/login/HPMlogin.c +++ b/src/login/HPMlogin.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2014-2015 Hercules Dev Team + * Copyright (C) 2014-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/login/HPMlogin.h b/src/login/HPMlogin.h index 5e059aa7e..e16edb6b8 100644 --- a/src/login/HPMlogin.h +++ b/src/login/HPMlogin.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2014-2015 Hercules Dev Team + * Copyright (C) 2014-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2d17f7ae7..3ec709b57 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2665,7 +2665,7 @@ ACMD(makeegg) intif->create_pet( sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); } else { clif->message(fd, msg_fd(fd,180)); // The monster/egg name/id doesn't exist. @@ -4222,6 +4222,8 @@ ACMD(repairall) count = 0; for (i = 0; i < MAX_INVENTORY; i++) { + if (sd->status.inventory[i].card[0] == CARD0_PET) + continue; if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { sd->status.inventory[i].attribute |= ATTR_BROKEN; sd->status.inventory[i].attribute ^= ATTR_BROKEN; diff --git a/src/map/battle.c b/src/map/battle.c index e571977fe..fceb30be1 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -7205,6 +7205,7 @@ static const struct battle_data { { "vcast_stat_scale", &battle_config.vcast_stat_scale, 530, 1, INT_MAX, }, { "area_size", &battle_config.area_size, 14, 0, INT_MAX, }, { "chat_area_size", &battle_config.chat_area_size, 9, 0, INT_MAX, }, + { "dead_area_size", &battle_config.dead_area_size, 32, 0, INT_MAX, }, { "zeny_from_mobs", &battle_config.zeny_from_mobs, 0, 0, 1, }, { "mobs_level_up", &battle_config.mobs_level_up, 0, 0, 1, }, { "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate, 1, 1, INT_MAX, }, diff --git a/src/map/battle.h b/src/map/battle.h index f4176f142..9f5207e95 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -366,6 +366,7 @@ struct Battle_Config { int castrate_dex_scale; // added by [MouseJstr] int area_size; // added by [MouseJstr] int chat_area_size; // added by [gumi] + int dead_area_size; // Monster die area [KirieZ] int max_def, over_def_bonus; //added by [Skotlex] diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 4b853bf75..df622e4ab 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -128,7 +128,8 @@ static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsig // check item list for (i = 0; i < count; i++) { // itemlist: <name id>.W <amount>.W <price>.L - unsigned short nameid, amount; + int nameid; + unsigned short amount; int price, idx; struct item_data* id; @@ -162,7 +163,8 @@ static void buyingstore_create(struct map_session_data *sd, int zenylimit, unsig ARR_FIND( 0, i, listidx, sd->buyingstore.items[listidx].nameid == nameid ); if( listidx != i ) {// duplicate - ShowWarning("buyingstore_create: Found duplicate item on buying list (nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", nameid, amount, sd->status.account_id, sd->status.char_id); + ShowWarning("buyingstore_create: Found duplicate item on buying list (nameid=%d, amount=%hu, account_id=%d, char_id=%d).\n", + nameid, amount, sd->status.account_id, sd->status.char_id); break; } } @@ -289,20 +291,21 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig // check item list for( i = 0; i < count; i++ ) {// itemlist: <index>.W <name id>.W <amount>.W - unsigned short nameid, amount; + int nameid; + unsigned short amount; int index; index = itemlist[i].index - 2; nameid = itemlist[i].itemId; amount = itemlist[i].amount; - if( i ) + if (i) {// duplicate check. as the client does this too, only malicious intent should be caught here - ARR_FIND( 0, i, k, RBUFW(itemlist,k*6+0)-2 == index ); - if( k != i ) + ARR_FIND(0, i, k, itemlist[k].index - 2 == index); + if (k != i) {// duplicate - ShowWarning("buyingstore_trade: Found duplicate item on selling list (prevnameid=%hu, prevamount=%hu, nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", - RBUFW(itemlist,k*6+2), RBUFW(itemlist,k*6+4), nameid, amount, sd->status.account_id, sd->status.char_id); + ShowWarning("buyingstore_trade: Found duplicate item on selling list (prevnameid=%d, prevamount=%d, nameid=%d, amount=%hu, account_id=%d, char_id=%d).\n", + (int)itemlist[k].itemId, (int)itemlist[k].amount, nameid, amount, sd->status.account_id, sd->status.char_id); clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid); return; } @@ -361,14 +364,15 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig // process item list for( i = 0; i < count; i++ ) {// itemlist: <index>.W <name id>.W <amount>.W - unsigned short nameid, amount; + int nameid; + unsigned short amount; int index; - index = RBUFW(itemlist,i*6+0)-2; - nameid = RBUFW(itemlist,i*6+2); - amount = RBUFW(itemlist,i*6+4); + index = itemlist[i].index - 2; + nameid = itemlist[i].itemId; + amount = itemlist[i].amount; - ARR_FIND( 0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == nameid ); + ARR_FIND(0, pl_sd->buyingstore.slots, listidx, pl_sd->buyingstore.items[listidx].nameid == nameid ); zeny = amount*pl_sd->buyingstore.items[listidx].price; // move item @@ -416,7 +420,7 @@ static void buyingstore_trade(struct map_session_data* sd, int account_id, unsig } /// Checks if an item is being bought in given player's buying store. -static bool buyingstore_search(struct map_session_data *sd, unsigned short nameid) +static bool buyingstore_search(struct map_session_data *sd, int nameid) { unsigned int i; diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h index e96cc832d..63762f321 100644 --- a/src/map/buyingstore.h +++ b/src/map/buyingstore.h @@ -63,7 +63,7 @@ enum e_buyingstore_failure { struct s_buyingstore_item { int price; unsigned short amount; - unsigned short nameid; + int nameid; }; struct s_buyingstore { @@ -77,7 +77,7 @@ struct s_buyingstore { **/ struct buyingstore_interface { unsigned int nextid; - short blankslots[MAX_SLOTS]; // used when checking whether or not an item's card slots are blank + int blankslots[MAX_SLOTS]; // used when checking whether or not an item's card slots are blank struct item_option blankoptions[MAX_ITEM_OPTIONS]; // used for search result temporary. /* */ bool (*setup) (struct map_session_data* sd, unsigned char slots); @@ -85,7 +85,7 @@ struct buyingstore_interface { void (*close) (struct map_session_data* sd); void (*open) (struct map_session_data* sd, int account_id); void (*trade) (struct map_session_data* sd, int account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count); - bool (*search) (struct map_session_data* sd, unsigned short nameid); + bool (*search) (struct map_session_data* sd, int nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); unsigned int (*getuid) (void); }; diff --git a/src/map/chrif.c b/src/map/chrif.c index 2aa76ca2d..cd24c5fea 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1419,7 +1419,7 @@ static void chrif_skillid2idx(int fd) WFIFOW(fd,0) = 0x2b0b; for (i = 0; i < MAX_SKILL_DB; i++) { if (skill->dbs->db[i].nameid != 0) { - WFIFOW(fd, 4 + (count*4)) = skill->dbs->db[i].nameid; + WFIFOW(fd, 4 + (count*4)) = skill->dbs->db[i].nameid; // really skill id WFIFOW(fd, 6 + (count*4)) = i; count++; } diff --git a/src/map/clif.c b/src/map/clif.c index 5d8e84a74..82507a84a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -434,6 +434,7 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send struct battleground_data *bgd = NULL; int x0 = 0, x1 = 0, y0 = 0, y1 = 0, fd; struct s_mapiterator* iter; + int area_size; if( type != ALL_CLIENT ) nullpo_ret(bl); @@ -472,13 +473,18 @@ static bool clif_send(const void *buf, int len, struct block_list *bl, enum send case AREA: case AREA_WOSC: + case AREA_DEAD: if (sd && bl->prev == NULL) //Otherwise source misses the packet.[Skotlex] clif->send (buf, len, bl, SELF); /* Fall through */ case AREA_WOC: case AREA_WOS: + if (type == AREA_DEAD) + area_size = DEAD_AREA_SIZE; + else + area_size = AREA_SIZE; nullpo_retr(true, bl); - map->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE, + map->foreachinarea(clif->send_sub, bl->m, bl->x - area_size, bl->y - area_size, bl->x + area_size, bl->y + area_size, BL_PC, buf, len, bl, type); break; case AREA_CHAT_WOC: @@ -909,7 +915,12 @@ static void clif_clearunit_area(struct block_list *bl, clr_type type) WBUFL(buf,2) = bl->id; WBUFB(buf,6) = type; - clif->send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA : AREA_WOS); + /** + * When monster dies, there's a delay before the packet is sent, + * so we send it to a bigger area to avoid clients at the edge + * walking out of the area and missing it [KirieZ] + */ + clif->send(buf, packet_len(0x80), bl, type == CLR_DEAD ? AREA_DEAD : AREA_WOS); if (clif->isdisguised(bl)) { WBUFL(buf,2) = -bl->id; @@ -939,7 +950,7 @@ static void clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 t } /// Gets weapon view info from sd's inventory_data and points (*rhand,*lhand) -static void clif_get_weapon_view(struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand) +static void clif_get_weapon_view(struct map_session_data *sd, int *rhand, int *lhand) { nullpo_retv(sd); nullpo_retv(rhand); @@ -7233,6 +7244,7 @@ static void clif_sendegg(struct map_session_data *sd) /// 3 = accessory /// 4 = performance (data = 1~3: normal, 4: special) /// 5 = hairstyle +/// 6 = close egg selection ui and update egg in inventory (PACKETVER >= 20180704) /// /// If sd is null, the update is sent to nearby objects, otherwise it is sent only to that player. static void clif_send_petdata(struct map_session_data *sd, struct pet_data *pd, int type, int param) @@ -10055,16 +10067,11 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) #if PACKETVER >= 20090218 { int i; - for(i = 0; i < map->list[sd->bl.m].qi_count; i++) { - struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; - if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) {// Check if quest is not started - if( qi->hasJob ) { // Check if quest is job-specific, check is user is said job class. - if (sd->status.class == qi->job) - clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); - } else { - clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); - } - } + for (i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_data); i++) { + struct questinfo *qi = &VECTOR_INDEX(map->list[sd->bl.m].qi_data, i); + + if (quest->questinfo_validate(sd, qi)) + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); } } #endif @@ -14022,7 +14029,7 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) intif->create_pet( sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); clif->petEvolutionResult(fd, PET_EVOL_SUCCESS); } else { @@ -17862,7 +17869,7 @@ static void clif_buyingstore_trade_failed_buyer(struct map_session_data *sd, sho /// Updates the zeny limit and an item in the buying store item list (ZC_UPDATE_ITEM_FROM_BUYING_STORE). /// 081b <name id>.W <amount>.W <limit zeny>.L -static void clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) +static void clif_buyingstore_update_item(struct map_session_data *sd, int nameid, unsigned short amount, uint32 char_id, int zeny) { int fd; struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE p; @@ -17913,7 +17920,7 @@ static void clif_buyingstore_delete_item(struct map_session_data *sd, short inde /// 6 = "The trade failed, because the entered amount of item %s is higher, than the buyer is willing to buy." (0x6d3, MSI_BUYINGSTORE_TRADE_OVERCOUNT) /// 7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY) /// ? = nothing -static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, unsigned short nameid) +static void clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, int nameid) { #if PACKETVER >= 20100420 int fd; @@ -18509,7 +18516,7 @@ static void clif_cashshop_db(void) continue; } - if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) { if( !( data = itemdb->exists(atoi(name+2))) ) { ShowWarning("cashshop_db: unknown item id '%s' in category '%s'\n", name+2, entry_name); continue; @@ -19038,7 +19045,7 @@ static void clif_scriptclear(struct map_session_data *sd, int npcid) } /* Made Possible Thanks to Yommy! */ -static void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) +static void clif_package_item_announce(struct map_session_data *sd, int nameid, int containerid) { struct packet_package_item_announce p; @@ -19056,7 +19063,7 @@ static void clif_package_item_announce(struct map_session_data *sd, unsigned sho } /* Made Possible Thanks to Yommy! */ -static void clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) +static void clif_item_drop_announce(struct map_session_data *sd, int nameid, char *monsterName) { struct packet_item_drop_announce p; @@ -19700,7 +19707,7 @@ static bool clif_parse_roulette_db(void) continue; } - if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) { + if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) { if( !( data = itemdb->exists(atoi(name+2))) ) { ShowWarning("roulette_db: unknown item id '%s' in category '%s'\n", name+2, entry_name); continue; @@ -19757,7 +19764,7 @@ static bool clif_parse_roulette_db(void) /** * **/ -static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) +static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID) { #if PACKETVER >= 20140612 struct packet_roulette_generate_ack p; @@ -19843,7 +19850,8 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd) { #if PACKETVER > 20120228 int i = 0, n = 0, length = 0, count = 0; - int16 nameid = 0, indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; + int nameid = 0; + int16 indexes[MAX_INVENTORY] = {0}, amounts[MAX_INVENTORY] = {0}; struct item item_data; nullpo_retv(sd); @@ -20642,12 +20650,14 @@ static void clif_rodex_read_mail(struct map_session_data *sd, int8 opentype, str size += body_len; for (i = 0; i < RODEX_MAX_ITEM; ++i) { struct item *it = &msg->items[i].item; - struct item_data* data = itemdb->search(it->nameid); + struct item_data *data; int j, k; - if (it->nameid == 0 || data == NULL) { + if (it->nameid == 0) + continue; + data = itemdb->search(it->nameid); + if (data == NULL) continue; - } item = WFIFOP(fd, size); memset(item, 0x0, sizeof(*item)); @@ -21246,7 +21256,7 @@ static bool clif_style_change_validate_requirements(struct map_session_data *sd, } return false; } -static void clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) +static void clif_stylist_send_rodexitem(struct map_session_data *sd, int itemid) { struct rodex_message msg = { 0 }; diff --git a/src/map/clif.h b/src/map/clif.h index 53a97f484..0077566b5 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -92,6 +92,7 @@ typedef enum send_target { AREA_WOC, // area, without chatrooms AREA_WOSC, // area, without own chatrooms AREA_CHAT_WOC, // hearable area, without chatrooms + AREA_DEAD, // area, for clear unit (monster death) CHAT, // current chatroom CHAT_WOS, // current chatroom, without self PARTY, @@ -618,7 +619,7 @@ struct s_packet_db { }; struct hCSData { - unsigned short id; + int id; unsigned int price; }; @@ -629,7 +630,7 @@ struct cdelayed_damage { struct merge_item { int16 position; - int16 nameid; + int nameid; }; /* attendance data */ @@ -642,8 +643,8 @@ struct attendance_entry { struct stylist_data_entry { int16 id; int32 zeny; - int16 itemid; - int16 boxid; + int itemid; + int boxid; }; VECTOR_DECL(struct stylist_data_entry) stylist_data[MAX_STYLIST_TYPE]; @@ -729,8 +730,8 @@ struct clif_interface { void (*cart_additem_ack) (struct map_session_data *sd, int flag); void (*cashshop_load) (void); void (*cashShopSchedule) (int fd, struct map_session_data *sd); - void (*package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid); - void (*item_drop_announce) (struct map_session_data *sd, unsigned short nameid, char *monsterName); + void (*package_announce) (struct map_session_data *sd, int nameid, int containerid); + void (*item_drop_announce) (struct map_session_data *sd, int nameid, char *monsterName); /* unit-related */ void (*clearunit_single) (int id, clr_type type, int fd); void (*clearunit_area) (struct block_list* bl, clr_type type); @@ -843,7 +844,7 @@ struct clif_interface { void (*hpmeter_single) (int fd, int id, unsigned int hp, unsigned int maxhp); int (*hpmeter_sub) (struct block_list *bl, va_list ap); void (*upgrademessage) (int fd, int result, int item_id); - void (*get_weapon_view) (struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand); + void (*get_weapon_view) (struct map_session_data* sd, int *rhand, int *lhand); void (*gospel_info) (struct map_session_data *sd, int type); void (*feel_req) (int fd, struct map_session_data *sd, uint16 skill_lv); void (*starskill) (struct map_session_data* sd, const char* mapname, int monster_id, unsigned char star, unsigned char result); @@ -1141,9 +1142,9 @@ struct clif_interface { void (*buyingstore_disappear_entry_single) (struct map_session_data* sd, struct map_session_data* pl_sd); void (*buyingstore_itemlist) (struct map_session_data* sd, struct map_session_data* pl_sd); void (*buyingstore_trade_failed_buyer) (struct map_session_data* sd, short result); - void (*buyingstore_update_item) (struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny); + void (*buyingstore_update_item) (struct map_session_data* sd, int nameid, unsigned short amount, uint32 char_id, int zeny); void (*buyingstore_delete_item) (struct map_session_data* sd, short index, unsigned short amount, int price); - void (*buyingstore_trade_failed_seller) (struct map_session_data* sd, short result, unsigned short nameid); + void (*buyingstore_trade_failed_seller) (struct map_session_data* sd, short result, int nameid); /* search store-related */ void (*search_store_info_ack) (struct map_session_data* sd); void (*search_store_info_failed) (struct map_session_data* sd, unsigned char reason); @@ -1186,7 +1187,7 @@ struct clif_interface { void (*npc_market_purchase_ack) (struct map_session_data *sd, const struct itemlist *item_list, unsigned char response); /* */ bool (*parse_roulette_db) (void); - void (*roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID); + void (*roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); /* Merge Items */ void (*openmergeitem) (int fd, struct map_session_data *sd); void (*cancelmergeitem) (int fd, struct map_session_data *sd); @@ -1500,7 +1501,7 @@ struct clif_interface { bool (*stylist_read_db_libconfig) (void); bool (*stylist_read_db_libconfig_sub) (struct config_setting_t *it, int idx, const char *source); bool (*style_change_validate_requirements) (struct map_session_data *sd, int type, int16 idx); - void (*stylist_send_rodexitem) (struct map_session_data *sd, int16 itemid); + void (*stylist_send_rodexitem) (struct map_session_data *sd, int itemid); void (*pReqStyleChange) (int fd, struct map_session_data *sd); void (*cz_req_style_change_sub) (struct map_session_data *sd, int type, int16 idx, bool isitem); void (*style_change_response) (struct map_session_data *sd, enum stylist_shop flag); diff --git a/src/map/homunculus.c b/src/map/homunculus.c index a6e7bb71c..6df272243 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -37,6 +37,7 @@ #include "map/party.h" #include "map/pc.h" #include "map/pet.h" +#include "map/quest.h" #include "map/script.h" #include "map/skill.h" #include "map/status.h" @@ -406,6 +407,7 @@ static bool homunculus_levelup(struct homun_data *hd) growth_int/10.0, growth_dex/10.0, growth_luk/10.0); clif_disp_onlyself(hd->master, output); } + quest->questinfo_refresh(hd->master); return true; } @@ -419,6 +421,7 @@ static int homunculus_change_class(struct homun_data *hd, short class_) hd->homunculus.class_ = class_; status->set_viewdata(&hd->bl, class_); homun->calc_skilltree(hd, 1); + quest->questinfo_refresh(hd->master); return 1; } @@ -471,7 +474,7 @@ static bool homunculus_evolve(struct homun_data *hd) if (!(battle_config.hom_setting&0x2)) skill->unit_move(&sd->hd->bl,timer->gettick(),1); // apply land skills immediately - + quest->questinfo_refresh(sd); return true; } diff --git a/src/map/instance.c b/src/map/instance.c index 2c40449ad..8bd45ba50 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -30,6 +30,7 @@ #include "map/npc.h" #include "map/party.h" #include "map/pc.h" +#include "map/quest.h" #include "common/HPM.h" #include "common/cbasetypes.h" #include "common/db.h" @@ -295,10 +296,10 @@ static int instance_add_map(const char *name, int instance_id, bool usebasename, } //Mimic questinfo - if( map->list[m].qi_count ) { - map->list[im].qi_count = map->list[m].qi_count; - CREATE( map->list[im].qi_data, struct questinfo, map->list[im].qi_count ); - memcpy( map->list[im].qi_data, map->list[m].qi_data, map->list[im].qi_count * sizeof(struct questinfo) ); + VECTOR_INIT(map->list[im].qi_data); + VECTOR_ENSURE(map->list[im].qi_data, VECTOR_LENGTH(map->list[m].qi_data), 1); + for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) { + VECTOR_PUSH(map->list[im].qi_data, VECTOR_INDEX(map->list[m].qi_data, i)); } map->list[im].m = im; @@ -517,8 +518,7 @@ static void instance_del_map(int16 m) aFree(map->list[m].zone_mf); } - if( map->list[m].qi_data ) - aFree(map->list[m].qi_data); + quest->questinfo_vector_clear(m); // Remove from instance for( i = 0; i < instance->list[map->list[m].instance_id].num_map; i++ ) { diff --git a/src/map/intif.c b/src/map/intif.c index 6dc4b3a0a..393058a8a 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -69,26 +69,26 @@ static int CheckForCharServer(void) } // pet -static int intif_create_pet(int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) +static int intif_create_pet(int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, + int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) { if (intif->CheckForCharServer()) return 0; nullpo_ret(pet_name); - WFIFOHEAD(inter_fd, 24 + NAME_LENGTH); - WFIFOW(inter_fd,0) = 0x3080; - WFIFOL(inter_fd,2) = account_id; - WFIFOL(inter_fd,6) = char_id; - WFIFOW(inter_fd,10) = pet_class; - WFIFOW(inter_fd,12) = pet_lv; - WFIFOW(inter_fd,14) = pet_egg_id; - WFIFOW(inter_fd,16) = pet_equip; - WFIFOW(inter_fd,18) = intimate; - WFIFOW(inter_fd,20) = hungry; - WFIFOB(inter_fd,22) = rename_flag; - WFIFOB(inter_fd,23) = incubate; - memcpy(WFIFOP(inter_fd,24),pet_name,NAME_LENGTH); - WFIFOSET(inter_fd,24+NAME_LENGTH); + WFIFOHEAD(inter_fd, 28 + NAME_LENGTH); + WFIFOW(inter_fd, 0) = 0x3080; + WFIFOL(inter_fd, 2) = account_id; + WFIFOL(inter_fd, 6) = char_id; + WFIFOW(inter_fd, 10) = pet_class; + WFIFOW(inter_fd, 12) = pet_lv; + WFIFOL(inter_fd, 14) = pet_egg_id; + WFIFOL(inter_fd, 18) = pet_equip; + WFIFOW(inter_fd, 22) = intimate; + WFIFOW(inter_fd, 24) = hungry; + WFIFOB(inter_fd, 26) = rename_flag; + WFIFOB(inter_fd, 27) = incubate; + memcpy(WFIFOP(inter_fd, 28), pet_name, NAME_LENGTH); + WFIFOSET(inter_fd, 28 + NAME_LENGTH); return 0; } diff --git a/src/map/intif.h b/src/map/intif.h index 4973768d7..c75b93201 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -58,8 +58,8 @@ struct intif_interface { int packet_len_table[INTIF_PACKET_LEN_TABLE_SIZE]; /* funcs */ int (*parse) (int fd); - int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, - short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); + int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, int pet_egg_id, + int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); int (*broadcast) (const char *mes, int len, int type); int (*broadcast2) (const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY); int (*main_message) (struct map_session_data* sd, const char* message); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index cee38b973..5e447d4c0 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -863,7 +863,7 @@ static void itemdb_read_groups(void) itemdb->groups[count].id = data->nameid; itemdb->groups[count].qty = gsize[ count ]; - CREATE(itemdb->groups[count].nameid, unsigned short, gsize[ count ] + 1); + CREATE(itemdb->groups[count].nameid, int, gsize[count] + 1); c = 0; while( (it = libconfig->setting_get_elem(itg,c++)) ) { int repeat = 1; @@ -873,7 +873,7 @@ static void itemdb_read_groups(void) } else itname = libconfig->setting_get_string_elem(itg,c - 1); - if( itname[0] == 'I' && itname[1] == 'D' && strlen(itname) < 8 ) { + if (itname[0] == 'I' && itname[1] == 'D' && strlen(itname) <= 12) { if( !( data = itemdb->exists(atoi(itname+2)) ) ) ShowWarning("itemdb_read_groups: unknown item ID '%d' in group '%s'!\n",atoi(itname+2),config_setting_name(itg)); } else if( !( data = itemdb->name2id(itname) ) ) @@ -913,7 +913,8 @@ static void itemdb_write_cached_packages(const char *config_filename) hwrite(&pcount,sizeof(pcount),1,file); for(i = 0; i < pcount; i++) { - unsigned short id = itemdb->packages[i].id, random_qty = itemdb->packages[i].random_qty, must_qty = itemdb->packages[i].must_qty; + int id = itemdb->packages[i].id; + unsigned short random_qty = itemdb->packages[i].random_qty, must_qty = itemdb->packages[i].must_qty; unsigned short c; //into a package, first 2 bytes = id. hwrite(&id,sizeof(id),1,file); @@ -970,6 +971,7 @@ static void itemdb_write_cached_packages(const char *config_filename) return; } + static bool itemdb_read_cached_packages(const char *config_filename) { FILE *file; @@ -988,12 +990,13 @@ static bool itemdb_read_cached_packages(const char *config_filename) itemdb->package_count = pcount; for( i = 0; i < pcount; i++ ) { - unsigned short id = 0, random_qty = 0, must_qty = 0; + int id = 0; + unsigned short random_qty = 0, must_qty = 0; struct item_data *pdata; struct item_package *package = &itemdb->packages[i]; unsigned short c; - //into a package, first 2 bytes = id. + //into a package, first 4 bytes = id. hread(&id,sizeof(id),1,file); //next 2 bytes = must count hread(&must_qty,sizeof(must_qty),1,file); @@ -1016,10 +1019,11 @@ static bool itemdb_read_cached_packages(const char *config_filename) //now we loop into must for(c = 0; c < package->must_qty; c++) { struct item_package_must_entry *entry = &itemdb->packages[i].must_items[c]; - unsigned short mid = 0, qty = 0, hours = 0; + int mid = 0; + unsigned short qty = 0, hours = 0; unsigned char announce = 0, named = 0, force_serial = 0; struct item_data *data; - //first 2 byte = item id + //first 4 byte = item id hread(&mid,sizeof(mid),1,file); //next 2 byte = qty hread(&qty,sizeof(qty),1,file); @@ -1059,7 +1063,8 @@ static bool itemdb_read_cached_packages(const char *config_filename) //now we loop into the group's list for(h = 0; h < group_qty; h++) { struct item_package_rand_entry *entry = &itemdb->packages[i].random_groups[c].random_list[h]; - unsigned short mid = 0, qty = 0, hours = 0, rate = 0; + int mid = 0; + unsigned short qty = 0, hours = 0, rate = 0; unsigned char announce = 0, named = 0, force_serial = 0; struct item_data *data; @@ -1235,7 +1240,7 @@ static void itemdb_read_packages(void) itname = config_setting_name(it); - if( itname[0] == 'I' && itname[1] == 'D' && strlen(itname) < 8 ) { + if (itname[0] == 'I' && itname[1] == 'D' && strlen(itname) <= 12) { if( !( data = itemdb->exists(atoi(itname+2)) ) ) ShowWarning("itemdb_read_packages: unknown item ID '%d' in package '%s'!\n",atoi(itname+2),config_setting_name(itg)); } else if( !( data = itemdb->name2id(itname) ) ) @@ -1486,7 +1491,7 @@ static void itemdb_read_chains(void) while( (entry = libconfig->setting_get_elem(itc,c++)) ) { const char *itname = config_setting_name(entry); - if( itname[0] == 'I' && itname[1] == 'D' && strlen(itname) < 8 ) { + if (itname[0] == 'I' && itname[1] == 'D' && strlen(itname) <= 12) { if( !( data = itemdb->exists(atoi(itname+2)) ) ) ShowWarning("itemdb_read_chains: unknown item ID '%d' in chain '%s'!\n",atoi(itname+2),name); } else if( !( data = itemdb->name2id(itname) ) ) @@ -1695,9 +1700,9 @@ static int itemdb_validate_entry(struct item_data *entry, int n, const char *sou nullpo_ret(entry); nullpo_ret(source); - if( entry->nameid <= 0 || entry->nameid >= MAX_ITEMDB ) { - ShowWarning("itemdb_validate_entry: Invalid item ID %d in entry %d of '%s', allowed values 0 < ID < %d (MAX_ITEMDB), skipping.\n", - entry->nameid, n, source, MAX_ITEMDB); + if (entry->nameid <= 0 || entry->nameid > MAX_ITEM_ID) { + ShowWarning("itemdb_validate_entry: Invalid item ID %d in entry %d of '%s', allowed values 0 < ID < %d (MAX_ITEM_ID), skipping.\n", + entry->nameid, n, source, MAX_ITEM_ID); if (entry->script) { script->free_code(entry->script); entry->script = NULL; @@ -1982,7 +1987,7 @@ static int itemdb_readdb_libconfig_sub(struct config_setting_t *it, int n, const ShowWarning("itemdb_readdb_libconfig_sub: Invalid or missing id in \"%s\", entry #%d, skipping.\n", source, n); return 0; } - id.nameid = (uint16)i32; + id.nameid = i32; if( (t = libconfig->setting_get_member(it, "Inherit")) && (inherit = libconfig->setting_get_bool(t)) ) { if( !itemdb->exists(id.nameid) ) { @@ -2341,6 +2346,7 @@ static bool itemdb_lookup_const_mask(const struct config_setting_t *it, const ch static int itemdb_readdb_libconfig(const char *filename) { bool duplicate[MAX_ITEMDB]; + struct DBMap *duplicate_db; struct config_t item_db_conf; struct config_setting_t *itdb, *it; char filepath[256]; @@ -2357,26 +2363,38 @@ static int itemdb_readdb_libconfig(const char *filename) return 0; } + // TODO add duplicates check for itemdb->other memset(&duplicate,0,sizeof(duplicate)); + duplicate_db = idb_alloc(DB_OPT_BASE); while( (it = libconfig->setting_get_elem(itdb,i++)) ) { int nameid = itemdb->readdb_libconfig_sub(it, i-1, filename); - if (nameid <= 0 || nameid >= MAX_ITEMDB) + if (nameid <= 0 || nameid > MAX_ITEM_ID) continue; itemdb->readdb_additional_fields(nameid, it, i - 1, filename); count++; - if( duplicate[nameid] ) { - ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n", - filename, nameid, itemdb_name(nameid), itemdb_jname(nameid)); - } else - duplicate[nameid] = true; + if (nameid < MAX_ITEMDB) { + if (duplicate[nameid]) { + ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n", + filename, nameid, itemdb_name(nameid), itemdb_jname(nameid)); + } else { + duplicate[nameid] = true; + } + } else { + if (idb_exists(duplicate_db, nameid)) { + ShowWarning("itemdb_readdb:%s: duplicate entry of ID #%d (%s/%s)\n", + filename, nameid, itemdb_name(nameid), itemdb_jname(nameid)); + } else { + idb_iput(duplicate_db, nameid, true); + } + } } + db_destroy(duplicate_db); libconfig->destroy(&item_db_conf); ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename); - return count; } @@ -2406,6 +2424,7 @@ static void itemdb_read(bool minimal) for (i = 0; i < ARRAYLENGTH(filename); i++) itemdb->readdb_libconfig(filename[i]); + // TODO check duplicate names also in itemdb->other for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) { if( itemdb->array[i] ) { if( itemdb->names->put(itemdb->names,DB->str2key(itemdb->array[i]->name),DB->ptr2data(itemdb->array[i]),&prev) ) { @@ -2431,7 +2450,7 @@ static void itemdb_read(bool minimal) /** * retrieves item_combo data by combo id **/ -static struct item_combo *itemdb_id2combo(unsigned short id) +static struct item_combo *itemdb_id2combo(int id) { if( id > itemdb->combo_count ) return NULL; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index efe3d0a3a..d92940445 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -33,10 +33,29 @@ struct hplugin_data_store; /** * Defines **/ -#define MAX_ITEMDB 0x8000 // 32k array entries in array (the rest goes to the db) +#ifndef MAX_ITEMDB +#define MAX_ITEMDB 0xFFFF +#endif + +#ifndef MAX_ITEM_ID +#if PACKETVER_RE_NUM >= 20180704 +#define MAX_ITEM_ID 0x20000 +#else +#define MAX_ITEM_ID 0xFFFF +#endif +#endif + +#ifndef MAX_ITEMDELAYS #define MAX_ITEMDELAYS 10 // The maximum number of item delays +#endif + +#ifndef MAX_SEARCH #define MAX_SEARCH 5 //Designed for search functions, species max number of matches to display. +#endif + +#ifndef MAX_ITEMS_PER_COMBO #define MAX_ITEMS_PER_COMBO 6 /* maximum amount of items a combo may require */ +#endif #define CARD0_FORGE 0x00FF #define CARD0_CREATE 0x00FE @@ -45,8 +64,17 @@ struct hplugin_data_store; //Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex] #define itemdb_isspecial(i) ((i) == CARD0_FORGE || (i) == CARD0_CREATE || (i) == CARD0_PET) +#ifndef UNKNOWN_ITEM_ID //Use apple for unknown items. #define UNKNOWN_ITEM_ID 512 +#endif + +#if MAX_ITEM_ID < MAX_ITEMDB +#error "MAX_ITEM_ID must be bigger or same with MAX_ITEMDB" +#endif +#if MAX_ITEM_ID > 0xFFFF && PACKETVER_RE_NUM < 20180704 +#error "For clients before 20180704 RE, MAX_ITEM_ID must be smaller than 0x10000" +#endif enum item_itemid { ITEMID_RED_POTION = 501, @@ -393,19 +421,19 @@ VECTOR_STRUCT_DECL(itemlist, struct itemlist_entry); struct item_combo { struct script_code *script; - unsigned short nameid[MAX_ITEMS_PER_COMBO];/* nameid array */ + int nameid[MAX_ITEMS_PER_COMBO];/* nameid array */ unsigned char count; - unsigned short id;/* id of this combo */ + int id; /* id of this combo */ }; struct item_group { - unsigned short id; - unsigned short *nameid; + int id; + int *nameid; unsigned short qty; }; struct item_chain_entry { - unsigned short id; + int id; unsigned short rate; struct item_chain_entry *next; }; @@ -416,7 +444,7 @@ struct item_chain { }; struct item_package_rand_entry { - unsigned short id; + int id; unsigned short qty; unsigned short rate; unsigned short hours; @@ -427,7 +455,7 @@ struct item_package_rand_entry { }; struct item_package_must_entry { - unsigned short id; + int id; unsigned short qty; unsigned short hours; unsigned int announce : 1; @@ -441,7 +469,7 @@ struct item_package_rand_group { }; struct item_package { - unsigned short id; + int id; struct item_package_rand_group *random_groups; struct item_package_must_entry *must_items; unsigned short random_qty; @@ -454,7 +482,7 @@ struct itemdb_option { }; struct item_data { - uint16 nameid; + int nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; int value_buy; @@ -651,7 +679,7 @@ struct itemdb_interface { int (*final_sub) (union DBKey key, struct DBData *data, va_list ap); int (*options_final_sub) (union DBKey key, struct DBData *data, va_list ap); void (*clear) (bool total); - struct item_combo * (*id2combo) (unsigned short id); + struct item_combo * (*id2combo) (int id); bool (*is_item_usable) (struct item_data *item); bool (*lookup_const) (const struct config_setting_t *it, const char *name, int *value); bool (*lookup_const_mask) (const struct config_setting_t *it, const char *name, int *value); diff --git a/src/map/map.c b/src/map/map.c index 40261ebbc..0124a3035 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3681,8 +3681,7 @@ static void do_final_maps(void) if( map->list[i].channel ) channel->delete(map->list[i].channel); - if( map->list[i].qi_data ) - aFree(map->list[i].qi_data); + quest->questinfo_vector_clear(i); HPM->data_store_destroy(&map->list[i].hdata); } @@ -3752,11 +3751,7 @@ static void map_flags_init(void) map->list[i].short_damage_rate = 100; map->list[i].long_damage_rate = 100; - if( map->list[i].qi_data ) - aFree(map->list[i].qi_data); - - map->list[i].qi_data = NULL; - map->list[i].qi_count = 0; + VECTOR_INIT(map->list[i].qi_data); } } @@ -5455,13 +5450,13 @@ static void map_zone_init(void) } } -static unsigned short map_zone_str2itemid(const char *name) +static int map_zone_str2itemid(const char *name) { struct item_data *data; if( !name ) return 0; - if( name[0] == 'I' && name[1] == 'D' && strlen(name) < 8 ) { + if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) { if( !( data = itemdb->exists(atoi(name+2))) ) { return 0; } @@ -5479,7 +5474,7 @@ static unsigned short map_zone_str2skillid(const char *name) if( !name ) return 0; - if( name[0] == 'I' && name[1] == 'D' && strlen(name) < 8 ) { + if (name[0] == 'I' && name[1] == 'D' && strlen(name) <= 12) { if( !skill->get_index((nameid = atoi(name+2))) ) return 0; } else { @@ -5972,34 +5967,24 @@ static int map_get_new_bonus_id(void) static void map_add_questinfo(int m, struct questinfo *qi) { - unsigned short i; - nullpo_retv(qi); Assert_retv(m >= 0 && m < map->count); - /* duplicate, override */ - for(i = 0; i < map->list[m].qi_count; i++) { - if( map->list[m].qi_data[i].nd == qi->nd ) - break; - } - - if( i == map->list[m].qi_count ) - RECREATE(map->list[m].qi_data, struct questinfo, ++map->list[m].qi_count); - memcpy(&map->list[m].qi_data[i], qi, sizeof(struct questinfo)); + VECTOR_ENSURE(map->list[m].qi_data, 1, 1); + VECTOR_PUSH(map->list[m].qi_data, *qi); } static bool map_remove_questinfo(int m, struct npc_data *nd) { unsigned short i; + nullpo_retr(false, nd); Assert_retr(false, m >= 0 && m < map->count); - for(i = 0; i < map->list[m].qi_count; i++) { - struct questinfo *qi = &map->list[m].qi_data[i]; - if( qi->nd == nd ) { - memset(&map->list[m].qi_data[i], 0, sizeof(struct questinfo)); - if( i != --map->list[m].qi_count ) { - memmove(&map->list[m].qi_data[i],&map->list[m].qi_data[i+1],sizeof(struct questinfo)*(map->list[m].qi_count-i)); - } + + for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) { + struct questinfo *qi_data = &VECTOR_INDEX(map->list[m].qi_data, i); + if (qi_data->nd == nd) { + VECTOR_ERASE(map->list[m].qi_data, i); return true; } } diff --git a/src/map/map.h b/src/map/map.h index 494f93cfe..04525b4d5 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -48,6 +48,7 @@ enum E_MAPSERVER_ST { #define MAX_NPC_PER_MAP 512 #define AREA_SIZE (battle->bc->area_size) #define CHAT_AREA_SIZE (battle->bc->chat_area_size) +#define DEAD_AREA_SIZE (battle->bc->dead_area_size) #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 #define MAX_MOBSKILL 50 @@ -714,7 +715,7 @@ enum map_zone_skill_subtype { }; struct map_zone_disabled_skill_entry { - unsigned short nameid; + int nameid; enum bl_type type; enum map_zone_skill_subtype subtype; }; @@ -724,7 +725,7 @@ struct map_zone_disabled_command_entry { }; struct map_zone_skill_damage_cap_entry { - unsigned short nameid; + int nameid; unsigned int cap; enum bl_type type; enum map_zone_skill_subtype subtype; @@ -772,14 +773,31 @@ struct map_drop_list { int drop_per; }; +struct questinfo_qreq { + int id; + int state; +}; struct questinfo { struct npc_data *nd; unsigned short icon; unsigned char color; - int quest_id; bool hasJob; unsigned short job;/* perhaps a mapid mask would be most flexible? */ + bool sex_enabled; + int sex; + struct { + int min; + int max; + } base_level; + struct { + int min; + int max; + } job_level; + VECTOR_DECL(struct item) items; + struct s_homunculus homunculus; + int homunculus_type; + VECTOR_DECL(struct questinfo_qreq) quest_requirement; }; @@ -921,8 +939,7 @@ struct map_data { } cell_buf; /* ShowEvent Data Cache */ - struct questinfo *qi_data; - unsigned short qi_count; + VECTOR_DECL(struct questinfo) qi_data; /* speeds up clif_updatestatus processing by causing hpmeter to run only when someone with the permission can view it */ unsigned short hpmeter_visible; @@ -1342,7 +1359,7 @@ END_ZEROED_BLOCK; int (*sql_init) (void); int (*sql_close) (void); bool (*zone_mf_cache) (int m, char *flag, char *params); - unsigned short (*zone_str2itemid) (const char *name); + int (*zone_str2itemid) (const char *name); unsigned short (*zone_str2skillid) (const char *name); enum bl_type (*zone_bl_type) (const char *entry, enum map_zone_skill_subtype *subtype); void (*read_zone_db) (void); diff --git a/src/map/mob.c b/src/map/mob.c index 403e3a2f2..0dbff9211 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -88,6 +88,7 @@ struct item_drop_ratio { int mob_id[MAX_ITEMRATIO_MOBS]; }; static struct item_drop_ratio *item_drop_ratio_db[MAX_ITEMDB]; +static struct DBMap *item_drop_ratio_other_db = NULL; static struct eri *item_drop_ers; //For loot drops delay structures. static struct eri *item_drop_list_ers; @@ -3791,6 +3792,28 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor return (unsigned int)cap_value(rate,rate_min,rate_max); } +static struct item_drop_ratio *mob_get_item_drop_ratio(int nameid) +{ + Assert_retr(NULL, nameid > 0); + if (nameid < ARRAYLENGTH(item_drop_ratio_db)) { + return item_drop_ratio_db[nameid]; + } else { + return (struct item_drop_ratio *)idb_get(item_drop_ratio_other_db, nameid); + } +} + +static void mob_set_item_drop_ratio(int nameid, struct item_drop_ratio *ratio) +{ + Assert_retv(nameid > 0); + if (nameid < ARRAYLENGTH(item_drop_ratio_db)) { + Assert_retv(item_drop_ratio_db[nameid] == NULL); + item_drop_ratio_db[nameid] = ratio; + } else { + Assert_retv(idb_get(item_drop_ratio_other_db, nameid) == NULL); + idb_put(item_drop_ratio_other_db, nameid, ratio); + } +} + /** * Check if global item drop rate is overridden for given item * in db/mob_item_ratio.txt @@ -3800,16 +3823,19 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor */ static void item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust) { + struct item_drop_ratio *dropRatio; nullpo_retv(rate_adjust); - if( item_drop_ratio_db[nameid] ) { - if( item_drop_ratio_db[nameid]->mob_id[0] ) { // only for listed mobs + + dropRatio = mob->get_item_drop_ratio(nameid); + if (dropRatio) { + if (dropRatio->mob_id[0] ) { // only for listed mobs int i; - ARR_FIND(0, MAX_ITEMRATIO_MOBS, i, item_drop_ratio_db[nameid]->mob_id[i] == mob_id); - if(i < MAX_ITEMRATIO_MOBS) // found - *rate_adjust = item_drop_ratio_db[nameid]->drop_ratio; + ARR_FIND(0, MAX_ITEMRATIO_MOBS, i, dropRatio->mob_id[i] == mob_id); + if (i < MAX_ITEMRATIO_MOBS) // found + *rate_adjust = dropRatio->drop_ratio; } else // for all mobs - *rate_adjust = item_drop_ratio_db[nameid]->drop_ratio; + *rate_adjust = dropRatio->drop_ratio; } } @@ -5142,6 +5168,7 @@ static bool mob_readdb_race2(char *fields[], int columns, int current) static bool mob_readdb_itemratio(char *str[], int columns, int current) { int nameid, ratio, i; + struct item_drop_ratio *dropRatio; nullpo_retr(false, str); nameid = atoi(str[0]); @@ -5154,12 +5181,15 @@ static bool mob_readdb_itemratio(char *str[], int columns, int current) ratio = atoi(str[1]); - if(item_drop_ratio_db[nameid] == NULL) - item_drop_ratio_db[nameid] = (struct item_drop_ratio*)aCalloc(1, sizeof(struct item_drop_ratio)); + dropRatio = mob->get_item_drop_ratio(nameid); + if (dropRatio == NULL) { + dropRatio = (struct item_drop_ratio*)aCalloc(1, sizeof(struct item_drop_ratio)); + mob->set_item_drop_ratio(nameid, dropRatio); + } - item_drop_ratio_db[nameid]->drop_ratio = ratio; - for(i = 0; i < columns-2; i++) - item_drop_ratio_db[nameid]->mob_id[i] = atoi(str[i+2]); + dropRatio->drop_ratio = ratio; + for (i = 0; i < columns - 2; i++) + dropRatio->mob_id[i] = atoi(str[i + 2]); return true; } @@ -5183,6 +5213,19 @@ static void mob_load(bool minimal) sv->readdb(map->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2); } +/** + * @see DBApply + */ +static int mob_final_ratio_sub(union DBKey key, struct DBData *data, va_list ap) +{ + struct item_drop_ratio *ratio = DB->data2ptr(data); + + if (ratio) + aFree(ratio); + + return 0; +} + static void mob_reload(void) { int i; @@ -5201,6 +5244,7 @@ static void mob_reload(void) item_drop_ratio_db[i] = NULL; } } + mob->item_drop_ratio_other_db->clear(mob->item_drop_ratio_other_db, mob->final_ratio_sub); mob->load(false); } @@ -5291,6 +5335,8 @@ static int do_final_mob(void) item_drop_ratio_db[i] = NULL; } } + mob->item_drop_ratio_other_db->clear(mob->item_drop_ratio_other_db, mob->final_ratio_sub); + db_destroy(mob->item_drop_ratio_other_db); ers_destroy(item_drop_ers); ers_destroy(item_drop_list_ers); return 0; @@ -5334,6 +5380,10 @@ void mob_defaults(void) memcpy(mob->splendide, mob_splendide, sizeof(mob->splendide)); memcpy(mob->mora, mob_mora, sizeof(mob->mora)); + item_drop_ratio_other_db = idb_alloc(DB_OPT_BASE); + mob->item_drop_ratio_db = item_drop_ratio_db; + mob->item_drop_ratio_other_db = item_drop_ratio_other_db; + /* */ mob->reload = mob_reload; mob->init = do_init_mob; @@ -5438,6 +5488,9 @@ void mob_defaults(void) mob->readdb_race2 = mob_readdb_race2; mob->readdb_itemratio = mob_readdb_itemratio; mob->load = mob_load; + mob->get_item_drop_ratio = mob_get_item_drop_ratio; + mob->set_item_drop_ratio = mob_set_item_drop_ratio; + mob->final_ratio_sub = mob_final_ratio_sub; mob->clear_spawninfo = mob_clear_spawninfo; mob->destroy_mob_db = mob_destroy_mob_db; mob->skill_db_libconfig = mob_skill_db_libconfig; diff --git a/src/map/mob.h b/src/map/mob.h index 3ff3f213b..4cb3877ed 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -25,6 +25,7 @@ #include "map/status.h" // struct status_data, struct status_change #include "map/unit.h" // struct unit_data, view_data #include "common/hercules.h" +#include "common/db.h" #include "common/mmo.h" // struct item struct hplugin_data_store; @@ -72,6 +73,8 @@ struct hplugin_data_store; // Disable this to make monsters not do any path search when looking for a target (old behavior). #define ACTIVEPATHSEARCH +struct item_drop_ratio; + enum e_bosstype { BTYPE_NONE = 0, BTYPE_BOSS = 1, @@ -437,6 +440,8 @@ struct mob_interface { int manuk[8]; int splendide[5]; int mora[5]; + struct item_drop_ratio **item_drop_ratio_db; + struct DBMap *item_drop_ratio_other_db; /* */ int (*init) (bool mimimal); int (*final) (void); @@ -543,6 +548,9 @@ struct mob_interface { bool (*readdb_itemratio) (char *str[], int columns, int current); void (*load) (bool minimal); void (*clear_spawninfo) (void); + struct item_drop_ratio *(*get_item_drop_ratio) (int nameid); + void (*set_item_drop_ratio) (int nameid, struct item_drop_ratio *ratio); + int (*final_ratio_sub) (union DBKey key, struct DBData *data, va_list ap); void (*destroy_mob_db) (int index); bool (*skill_db_libconfig) (const char *filename, bool ignore_missing); bool (*skill_db_libconfig_sub) (struct config_setting_t *it, int n); diff --git a/src/map/npc.h b/src/map/npc.h index fa8b12be5..eff4ed4ec 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -57,14 +57,14 @@ struct npc_label_list { int pos; }; struct npc_item_list { - unsigned short nameid; + int nameid; unsigned int value; unsigned int qty; }; struct npc_shop_data { unsigned char type;/* what am i */ struct npc_item_list *item;/* list */ - unsigned short items;/* total */ + unsigned int items;/* total */ }; struct npc_parse; struct npc_data { diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index b8950589e..e8207d29c 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -600,12 +600,12 @@ struct packet_idle_unit2 { int16 healthState; int16 effectState; int16 job; - int16 head; - int16 weapon; - int16 accessory; - int16 shield; - int16 accessory2; - int16 accessory3; + uint16 head; + uint16 weapon; + uint16 accessory; + uint16 shield; + uint16 accessory2; + uint16 accessory3; int16 headpalette; int16 bodypalette; int16 headDir; @@ -636,13 +636,13 @@ struct packet_spawn_unit2 { int16 bodyState; int16 healthState; int16 effectState; - int16 head; - int16 weapon; - int16 accessory; + uint16 head; + uint16 weapon; + uint16 accessory; int16 job; - int16 shield; - int16 accessory2; - int16 accessory3; + uint16 shield; + uint16 accessory2; + uint16 accessory3; int16 headpalette; int16 bodypalette; int16 headDir; @@ -675,26 +675,26 @@ struct packet_spawn_unit { int32 effectState; #endif int16 job; - int16 head; + uint16 head; #if PACKETVER < 7 - int16 weapon; + uint16 weapon; #else - int32 weapon; + uint32 weapon; #endif #if PACKETVER_RE_NUM >= 20180704 - int32 shield; + uint32 shield; #endif - int16 accessory; + uint16 accessory; #if PACKETVER < 7 - int16 shield; + uint16 shield; #endif - int16 accessory2; - int16 accessory3; + uint16 accessory2; + uint16 accessory3; int16 headpalette; int16 bodypalette; int16 headDir; #if PACKETVER >= 20101124 - int16 robe; + uint16 robe; #endif uint32 GUID; int16 GEmblemVer; @@ -748,27 +748,27 @@ struct packet_unit_walking { int32 effectState; #endif int16 job; - int16 head; + uint16 head; #if PACKETVER < 7 - int16 weapon; + uint16 weapon; #else - int32 weapon; + uint32 weapon; #endif #if PACKETVER_RE_NUM >= 20180704 - int32 shield; + uint32 shield; #endif - int16 accessory; + uint16 accessory; uint32 moveStartTime; #if PACKETVER < 7 - int16 shield; + uint16 shield; #endif - int16 accessory2; - int16 accessory3; + uint16 accessory2; + uint16 accessory3; int16 headpalette; int16 bodypalette; int16 headDir; #if PACKETVER >= 20101124 - int16 robe; + uint16 robe; #endif uint32 GUID; int16 GEmblemVer; @@ -793,7 +793,7 @@ struct packet_unit_walking { uint8 isBoss; #endif #if PACKETVER >= 20150513 - int16 body; + uint16 body; #endif /* Might be earlier, this is when the named item bug began */ #if PACKETVER >= 20131223 @@ -820,26 +820,26 @@ struct packet_idle_unit { int32 effectState; #endif int16 job; - int16 head; + uint16 head; #if PACKETVER < 7 - int16 weapon; + uint16 weapon; #else - int32 weapon; + uint32 weapon; #endif #if PACKETVER_RE_NUM >= 20180704 - int32 shield; + uint32 shield; #endif - int16 accessory; + uint16 accessory; #if PACKETVER < 7 - int16 shield; + uint16 shield; #endif - int16 accessory2; - int16 accessory3; + uint16 accessory2; + uint16 accessory3; int16 headpalette; int16 bodypalette; int16 headDir; #if PACKETVER >= 20101124 - int16 robe; + uint16 robe; #endif uint32 GUID; int16 GEmblemVer; @@ -865,7 +865,7 @@ struct packet_idle_unit { uint8 isBoss; #endif #if PACKETVER >= 20150513 - int16 body; + uint16 body; #endif /* Might be earlier, this is when the named item bug began */ #if PACKETVER >= 20131223 diff --git a/src/map/pc.c b/src/map/pc.c index 89d414263..d89abcca8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -565,7 +565,7 @@ static int pc_inventory_rental_clear(struct map_session_data *sd) /* assumes i is valid (from default areas where it is called, it is) */ static void pc_rental_expire(struct map_session_data *sd, int i) { - short nameid; + int nameid; nullpo_retv(sd); Assert_retv(i >= 0 && i < MAX_INVENTORY); @@ -2082,7 +2082,7 @@ static int pc_disguise(struct map_session_data *sd, int class) return 1; } -static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id) +static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id) { int i; @@ -2120,7 +2120,7 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor return 1; } -static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id) +static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id) { int i; @@ -4783,6 +4783,7 @@ static int pc_additem(struct map_session_data *sd, struct item *item_data, int a pc->inventory_rental_add(sd, seconds); } } + quest->questinfo_refresh(sd); return 0; } @@ -4820,6 +4821,7 @@ static int pc_delitem(struct map_session_data *sd, int n, int amount, int type, clif->delitem(sd,n,amount,reason); if(!(type&2)) clif->updatestatus(sd,SP_WEIGHT); + quest->questinfo_refresh(sd); return 0; } @@ -6881,6 +6883,7 @@ static int pc_checkbaselevelup(struct map_session_data *sd) party->send_levelup(sd); pc->baselevelchanged(sd); + quest->questinfo_refresh(sd); return 1; } @@ -6943,6 +6946,7 @@ static int pc_checkjoblevelup(struct map_session_data *sd) clif->status_change(&sd->bl,SI_DEVIL1, 1, 0, 0, 0, 1); //Permanent blind effect from SG_DEVIL. npc->script_event(sd, NPCE_JOBLVUP); + quest->questinfo_refresh(sd); return 1; } @@ -9036,6 +9040,7 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) break; } } + quest->questinfo_refresh(sd); return 0; } diff --git a/src/map/pc.h b/src/map/pc.h index 9bad3a135..0781fe801 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -132,7 +132,8 @@ BEGIN_ZEROED_BLOCK; // all the variables within this block get zero'ed in each c END_ZEROED_BLOCK; }; struct s_autospell { - short id, lv, rate, card_id, flag; + short id, lv, rate, flag; + int card_id; bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed }; /// AddEff bonus data @@ -150,7 +151,8 @@ struct s_addeffectonskill { unsigned char target; }; struct s_add_drop { - short id, group; + int id; + short group; int race, rate; }; struct s_autobonus { @@ -168,7 +170,7 @@ enum npc_timeout_type { struct pc_combos { struct script_code *bonus;/* the script of the combo */ - unsigned short id;/* this combo id */ + int id; /* this combo id */ }; struct map_session_data { @@ -218,7 +220,7 @@ struct map_session_data { unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop short pmap; // Previous map on Map Change unsigned short autoloot; - unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus] + int autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus] unsigned short autoloottype; unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish] @@ -303,7 +305,7 @@ struct map_session_data { int64 cansendmail_tick; /// Mail System Flood Protection int64 ks_floodprotect_tick; /// [Kill Steal Protection] struct { - short nameid; + int nameid; int64 tick; } item_delay[MAX_ITEMDELAYS]; // [Paradox924X] bool has_shield; ///< Whether the character is wearing a shield. @@ -496,7 +498,7 @@ END_ZEROED_BLOCK; // Mail System [Zephyrus] struct { - short nameid; + int nameid; int index, amount, zeny; struct mail_data inbox; bool changed; // if true, should sync with charserver on next mailbox request @@ -795,7 +797,7 @@ enum { ADDITEM_EXIST , ADDITEM_NEW , ADDITEM_OVERAMOUNT }; **/ struct item_cd { int64 tick[MAX_ITEMDELAYS];//tick - short nameid[MAX_ITEMDELAYS];//skill id + int nameid[MAX_ITEMDELAYS];//skill id }; enum e_pc_autotrade_update_action { @@ -1113,8 +1115,8 @@ END_ZEROED_BLOCK; /* End */ int (*check_banding) ( struct block_list *bl, va_list ap ); int (*inventory_rental_end) (int tid, int64 tick, int id, intptr_t data); void (*check_skilltree) (struct map_session_data *sd, int skill_id); - int (*bonus_autospell) (struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id); - int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id); + int (*bonus_autospell) (struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id); + int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id); int (*bonus_addeff) (struct s_addeffect* effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration); int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target); int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate); diff --git a/src/map/pet.c b/src/map/pet.c index f4ba4e31b..d1d8a5a33 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -112,7 +112,7 @@ static int pet_create_egg(struct map_session_data *sd, int item_id) intif->create_pet(sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); return 1; @@ -345,10 +345,13 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); if (i != MAX_INVENTORY) { - sd->status.inventory[i].identify = 1; + sd->status.inventory[i].attribute &= ~ATTR_BROKEN; sd->status.inventory[i].bound = IBT_NONE; } - +#if PACKETVER >= 20180704 + clif->inventorylist(sd); + clif->send_petdata(sd, pd, 6, 0); +#endif pd->pet.incubate = 1; unit->free(&pd->bl,CLR_OUTSIGHT); @@ -462,6 +465,9 @@ static int pet_birth_process(struct map_session_data *sd, struct s_pet *petinfo) clif->spawn(&sd->pd->bl); clif->send_petdata(sd,sd->pd, 0,0); clif->send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style); +#if PACKETVER >= 20180704 + clif->send_petdata(sd, sd->pd, 6, 1); +#endif clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom); clif->send_petstatus(sd); } @@ -496,8 +502,8 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) if (!pet->birth_process(sd,p)) { - // Pet Evolution, Hide the egg by setting identify to 0 [Dastgir/Hercules] - sd->status.inventory[i].identify = 0; + // Pet Evolution, Hide the egg by setting broken attribute (0x2) [Asheraf] + sd->status.inventory[i].attribute |= ATTR_BROKEN; // bind the egg to the character to avoid moving it via forged packets [Asheraf] sd->status.inventory[i].bound = IBT_CHARACTER; } @@ -516,7 +522,7 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) return 0; } -static int pet_select_egg(struct map_session_data *sd, short egg_index) +static int pet_select_egg(struct map_session_data *sd, int egg_index) { nullpo_ret(sd); @@ -555,7 +561,8 @@ static int pet_catch_process2(struct map_session_data *sd, int target_id) // Invalid inputs/state, abort capture. clif->pet_roulette(sd,0); sd->catch_target_class = -1; - sd->itemid = sd->itemindex = -1; + sd->itemid = -1; + sd->itemindex = -1; return 1; } @@ -1334,7 +1341,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].itemID = (uint16)data->nameid; + pet->db[n].itemID = data->nameid; } } @@ -1342,7 +1349,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].EggID = (uint16)data->nameid; + pet->db[n].EggID = data->nameid; } } @@ -1350,7 +1357,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].AcceID = (uint16)data->nameid; + pet->db[n].AcceID = data->nameid; } } @@ -1358,7 +1365,7 @@ static int pet_read_db_sub(struct config_setting_t *it, int n, const char *sourc if (!(data = itemdb->name2id(str))) { ShowWarning("pet_read_db_sub: Invalid item '%s' in pet %d of \"%s\", defaulting to 0.\n", str, pet->db[n].class_, source); } else { - pet->db[n].FoodID = (uint16)data->nameid; + pet->db[n].FoodID = data->nameid; } } diff --git a/src/map/pet.h b/src/map/pet.h index b3a16c5d7..049816804 100644 --- a/src/map/pet.h +++ b/src/map/pet.h @@ -39,10 +39,10 @@ struct pet_evolve_data { struct s_pet_db { short class_; char name[NAME_LENGTH],jname[NAME_LENGTH]; - short itemID; - short EggID; - short AcceID; - short FoodID; + int itemID; + int EggID; + int AcceID; + int FoodID; int fullness; int hungry_delay; int r_hungry; @@ -157,7 +157,7 @@ struct pet_interface { int (*data_init) (struct map_session_data *sd, struct s_pet *petinfo); int (*birth_process) (struct map_session_data *sd, struct s_pet *petinfo); int (*recv_petdata) (int account_id, struct s_pet *p, int flag); - int (*select_egg) (struct map_session_data *sd, short egg_index); + int (*select_egg) (struct map_session_data *sd, int egg_index); int (*catch_process1) (struct map_session_data *sd, int target_class); int (*catch_process2) (struct map_session_data *sd, int target_id); bool (*get_egg) (int account_id, short pet_class, int pet_id ); diff --git a/src/map/quest.c b/src/map/quest.c index 614c79cb6..ab0b06974 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -25,6 +25,7 @@ #include "map/battle.h" #include "map/chrif.h" #include "map/clif.h" +#include "map/homunculus.h" #include "map/intif.h" #include "map/itemdb.h" #include "map/log.h" @@ -154,6 +155,7 @@ static int quest_add(struct map_session_data *sd, int quest_id, unsigned int tim #else clif->quest_update_objective(sd, &sd->quest_log[n]); #endif + quest->questinfo_refresh(sd); if ((map->save_settings & 64) != 0) chrif->save(sd, 0); @@ -211,10 +213,10 @@ static int quest_change(struct map_session_data *sd, int qid1, int qid2) #else clif->quest_update_objective(sd, &sd->quest_log[i]); #endif + quest->questinfo_refresh(sd); if( map->save_settings&64 ) chrif->save(sd,0); - return 0; } @@ -254,6 +256,7 @@ static int quest_delete(struct map_session_data *sd, int quest_id) sd->save_quest = true; clif->quest_delete(sd, quest_id); + quest->questinfo_refresh(sd); if( map->save_settings&64 ) chrif->save(sd,0); @@ -381,6 +384,7 @@ static int quest_update_status(struct map_session_data *sd, int quest_id, enum q } clif->quest_delete(sd, quest_id); + quest->questinfo_refresh(sd); if( map->save_settings&64 ) chrif->save(sd,0); @@ -638,6 +642,278 @@ static void quest_clear_db(void) } } +/* +* Limit the questinfo icon id to avoid client problems +*/ +static int quest_questinfo_validate_icon(int icon) +{ +#if PACKETVER >= 20170315 + if (icon < 0 || (icon > 10 && icon != 9999)) + icon = 9999; +#elif PACKETVER >= 20120410 + if (icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if (icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif + return icon; +} + +/** + * Refresh the questinfo bubbles on the player map. + * + * @param sd session data. + * @param qi questinfo data. + * + */ +static void quest_questinfo_refresh(struct map_session_data *sd) +{ + int i; + + nullpo_retv(sd); + + for (i = 0; i < VECTOR_LENGTH(map->list[sd->bl.m].qi_data); i++) { + struct questinfo *qi = &VECTOR_INDEX(map->list[sd->bl.m].qi_data, i); + // Remove the bubbles if one of the conditions is no longer valid. + if (quest->questinfo_validate(sd, qi) == false) { +#if PACKETVER >= 20120410 + clif->quest_show_event(sd, &qi->nd->bl, 9999, 0); +#else + clif->quest_show_event(sd, &qi->nd->bl, 0, 0); +#endif + } else { + clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color); + } + } +} + +/** + * Validate all possible conditions required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if conditions are correct. + * @retval false if one condition or more are in-correct. + */ +static bool quest_questinfo_validate(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + if (qi->hasJob && quest->questinfo_validate_job(sd, qi) == false) + return false; + if (qi->sex_enabled && quest->questinfo_validate_sex(sd, qi) == false) + return false; + if ((qi->base_level.min != 0 || qi->base_level.max != 0) && quest->questinfo_validate_baselevel(sd, qi) == false) + return false; + if ((qi->job_level.min != 0 || qi->job_level.max != 0) && quest->questinfo_validate_joblevel(sd, qi) == false) + return false; + if (VECTOR_LENGTH(qi->items) > 0 && quest->questinfo_validate_items(sd, qi) == false) + return false; + if (qi->homunculus.level != 0 && quest->questinfo_validate_homunculus_level(sd, qi) == false) + return false; + if (qi->homunculus.class_ != 0 && quest->questinfo_validate_homunculus_type(sd, qi) == false) + return false; + if (VECTOR_LENGTH(qi->quest_requirement) > 0 && quest->questinfo_validate_quests(sd, qi) == false) + return false; + return true; +} + +/** + * Validate job required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player job is matching the required. + * @retval false if player job is NOT matching the required. + */ +static bool quest_questinfo_validate_job(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + if (sd->status.class == qi->job) + return true; + return false; +} + +/** + * Validate sex required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player sex is matching the required. + * @retval false if player sex is NOT matching the required. + */ +static bool quest_questinfo_validate_sex(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + if (sd->status.sex == qi->sex) + return true; + return false; +} + +/** + * Validate base level required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player base level is included in the required level range. + * @retval false if player base level is NOT included in the required level range. + */ +static bool quest_questinfo_validate_baselevel(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + if (sd->status.base_level >= qi->base_level.min && sd->status.base_level <= qi->base_level.max) + return true; + return false; +} + +/** + * Validate job level required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player job level is included in the required level range. + * @retval false if player job level is NOT included in the required level range. + */ +static bool quest_questinfo_validate_joblevel(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + if (sd->status.job_level >= qi->job_level.min && sd->status.job_level <= qi->job_level.max) + return true; + return false; +} + +/** + * Validate items list required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player have all the items required. + * @retval false if player is missing one or more of the items required. + */ +static bool quest_questinfo_validate_items(struct map_session_data *sd, struct questinfo *qi) +{ + int i, idx; + + nullpo_retr(false, sd); + nullpo_retr(false, qi); + + + for (i = 0; i < VECTOR_LENGTH(qi->items); i++) { + struct item *item = &VECTOR_INDEX(qi->items, i); + idx = pc->search_inventory(sd, item->nameid); + if (idx == INDEX_NOT_FOUND) + return false; + if (sd->status.inventory[idx].amount < item->amount) + return false; + } + + return true; +} + +/** + * Validate minimal homunculus level required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if homunculus level >= the required value. + * @retval false if homunculus level smaller than the required value. + */ +static bool quest_questinfo_validate_homunculus_level(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + + if (sd->hd == NULL) + return false; + if (!homun_alive(sd->hd)) + return false; + if (sd->hd->homunculus.level < qi->homunculus.level) + return false; + return true; +} + +/** + * Validate homunculus type required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player's homunculus is matching the required. + * @retval false if player's homunculus is NOT matching the required. + */ +static bool quest_questinfo_validate_homunculus_type(struct map_session_data *sd, struct questinfo *qi) +{ + nullpo_retr(false, sd); + nullpo_retr(false, qi); + + if (sd->hd == NULL) + return false; + if (!homun_alive(sd->hd)) + return false; + if (homun->class2type(sd->hd->homunculus.class_) != qi->homunculus_type) + return false; + return true; +} + +/** + * Validate quest list required for the questinfo + * + * @param sd session data. + * @param qi questinfo data. + * + * @retval true if player have all the quests required. + * @retval false if player is missing one or more of the quests required. + */ +static bool quest_questinfo_validate_quests(struct map_session_data *sd, struct questinfo *qi) +{ + int i; + + nullpo_retr(false, sd); + nullpo_retr(false, qi); + + for (i = 0; i < VECTOR_LENGTH(qi->quest_requirement); i++) { + struct questinfo_qreq *quest_requirement = &VECTOR_INDEX(qi->quest_requirement, i); + if (quest->check(sd, quest_requirement->id, HAVEQUEST) != quest_requirement->state) + return false; + } + + return true; +} + +/** + * Clears the questinfo data vector + * + * @param m mapindex. + * + */ +static void quest_questinfo_vector_clear(int m) +{ + int i; + + Assert_retv(m >= 0 && m < map->count); + + for (i = 0; i < VECTOR_LENGTH(map->list[m].qi_data); i++) { + struct questinfo *qi_data = &VECTOR_INDEX(map->list[m].qi_data, i); + VECTOR_CLEAR(qi_data->items); + VECTOR_CLEAR(qi_data->quest_requirement); + } + VECTOR_CLEAR(map->list[m].qi_data); +} + /** * Initializes the quest interface. * @@ -699,4 +975,17 @@ void quest_defaults(void) quest->clear = quest_clear_db; quest->read_db = quest_read_db; quest->read_db_sub = quest_read_db_sub; + + quest->questinfo_validate_icon = quest_questinfo_validate_icon; + quest->questinfo_refresh = quest_questinfo_refresh; + quest->questinfo_validate = quest_questinfo_validate; + quest->questinfo_validate_job = quest_questinfo_validate_job; + quest->questinfo_validate_sex = quest_questinfo_validate_sex; + quest->questinfo_validate_baselevel = quest_questinfo_validate_baselevel; + quest->questinfo_validate_joblevel = quest_questinfo_validate_joblevel; + quest->questinfo_validate_items = quest_questinfo_validate_items; + quest->questinfo_validate_homunculus_level = quest_questinfo_validate_homunculus_level; + quest->questinfo_validate_homunculus_type = quest_questinfo_validate_homunculus_type; + quest->questinfo_validate_quests = quest_questinfo_validate_quests; + quest->questinfo_vector_clear = quest_questinfo_vector_clear; } diff --git a/src/map/quest.h b/src/map/quest.h index d33d84885..305a48df1 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -28,6 +28,7 @@ struct block_list; struct config_setting_t; struct map_session_data; +struct questinfo; #define MAX_QUEST_DB (60355+1) // Highest quest ID + 1 @@ -79,6 +80,19 @@ struct quest_interface { void (*clear) (void); int (*read_db) (void); struct quest_db *(*read_db_sub) (struct config_setting_t *cs, int n, const char *source); + + int (*questinfo_validate_icon) (int icon); + void (*questinfo_refresh) (struct map_session_data *sd); + bool (*questinfo_validate) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_job) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_sex) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_baselevel) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_joblevel) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_items) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_homunculus_level) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_homunculus_type) (struct map_session_data *sd, struct questinfo *qi); + bool (*questinfo_validate_quests) (struct map_session_data *sd, struct questinfo *qi); + void (*questinfo_vector_clear) (int m); }; #ifdef HERCULES_CORE diff --git a/src/map/script.c b/src/map/script.c index 9adf6b44d..1e635b622 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2258,7 +2258,7 @@ static void script_set_constant(const char *name, int value, bool is_parameter, { int n = script->add_str(name); - if( script->str_data[n].type == C_NOP ) {// new + if (script->str_data[n].type == C_NOP) { script->str_data[n].type = is_parameter ? C_PARAM : C_INT; script->str_data[n].val = value; script->str_data[n].deprecated = is_deprecated ? 1 : 0; @@ -2302,7 +2302,7 @@ static void script_set_constant2(const char *name, int value, bool is_parameter, /** * Loads the constants database from constants.conf */ -static void read_constdb(void) +static void read_constdb(bool reload) { struct config_t constants_conf; char filepath[256]; @@ -2321,7 +2321,6 @@ static void read_constdb(void) } while ((t = libconfig->setting_get_elem(cdb, i++))) { - bool is_parameter = false; bool is_deprecated = false; int value = 0; const char *name = config_setting_name(t); @@ -2352,10 +2351,6 @@ static void read_constdb(void) continue; } value = i32; - if (libconfig->setting_lookup_bool(t, "Parameter", &i32)) { - if (i32 != 0) - is_parameter = true; - } if (libconfig->setting_lookup_bool(t, "Deprecated", &i32)) { if (i32 != 0) is_deprecated = true; @@ -2363,9 +2358,13 @@ static void read_constdb(void) } else { value = libconfig->setting_get_int(t); } - if (is_parameter) - ShowWarning("read_constdb: Defining parameters in the constants configuration is deprecated and will no longer be possible in a future version. Parameters should be defined in source. (parameter = '%s')\n", name); - script->set_constant(name, value, is_parameter, is_deprecated); + + if (reload) { + int n = script->add_str(name); + script->str_data[n].type = C_NOP; // ensures it will be overwritten + } + + script->set_constant(name, value, false, is_deprecated); } script->constdb_comment(NULL); libconfig->destroy(&constants_conf); @@ -5593,7 +5592,7 @@ static void do_init_script(bool minimal) VECTOR_INIT(script->hqi); script->parse_builtin(); - script->read_constdb(); + script->read_constdb(false); script->load_parameters(); script->hardcoded_constants(); @@ -5645,12 +5644,11 @@ static int script_reload(void) script->parse_cleanup_timer_id = INVALID_TIMER; } - mapreg->reload(); - + script->read_constdb(true); itemdb->name_constants(); - clan->set_constants(); + mapreg->reload(); sysinfo->vcsrevision_reload(); return 0; @@ -7701,10 +7699,10 @@ static BUILDIN(countitem2) iden = script_getnum(st,3); ref = script_getnum(st,4); attr = script_getnum(st,5); - c1 = (short)script_getnum(st,6); - c2 = (short)script_getnum(st,7); - c3 = (short)script_getnum(st,8); - c4 = (short)script_getnum(st,9); + c1 = script_getnum(st,6); + c2 = script_getnum(st,7); + c3 = script_getnum(st,8); + c4 = script_getnum(st,9); for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] != NULL && @@ -8037,10 +8035,10 @@ static BUILDIN(getitem2) iden=script_getnum(st,4); ref=script_getnum(st,5); attr=script_getnum(st,6); - c1=(short)script_getnum(st,7); - c2=(short)script_getnum(st,8); - c3=(short)script_getnum(st,9); - c4=(short)script_getnum(st,10); + c1 = script_getnum(st,7); + c2 = script_getnum(st,8); + c3 = script_getnum(st,9); + c4 = script_getnum(st,10); if (bound && (itemdb_type(nameid) == IT_PETEGG || itemdb_type(nameid) == IT_PETARMOR)) { ShowError("script_getitembound2: can't bind a pet egg/armor! Type=%d\n",bound); @@ -8079,10 +8077,10 @@ static BUILDIN(getitem2) item_tmp.refine=ref; item_tmp.attribute=attr; item_tmp.bound=(unsigned char)bound; - item_tmp.card[0]=(short)c1; - item_tmp.card[1]=(short)c2; - item_tmp.card[2]=(short)c3; - item_tmp.card[3]=(short)c4; + item_tmp.card[0] = c1; + item_tmp.card[1] = c2; + item_tmp.card[2] = c3; + item_tmp.card[3] = c4; //Check if it's stackable. if (!itemdb->isstackable(nameid)) @@ -8371,10 +8369,10 @@ static BUILDIN(makeitem2) item_tmp.identify = script_getnum(st, 4); item_tmp.refine = cap_value(script_getnum(st, 5), 0, MAX_REFINE); item_tmp.attribute = script_getnum(st, 6); - item_tmp.card[0] = (short)script_getnum(st, 7); - item_tmp.card[1] = (short)script_getnum(st, 8); - item_tmp.card[2] = (short)script_getnum(st, 9); - item_tmp.card[3] = (short)script_getnum(st, 10); + item_tmp.card[0] = script_getnum(st, 7); + item_tmp.card[1] = script_getnum(st, 8); + item_tmp.card[2] = script_getnum(st, 9); + item_tmp.card[3] = script_getnum(st, 10); map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0, false); @@ -8619,10 +8617,10 @@ static BUILDIN(delitem2) it.identify=script_getnum(st,4); it.refine=script_getnum(st,5); it.attribute=script_getnum(st,6); - it.card[0]=(short)script_getnum(st,7); - it.card[1]=(short)script_getnum(st,8); - it.card[2]=(short)script_getnum(st,9); - it.card[3]=(short)script_getnum(st,10); + it.card[0] = script_getnum(st, 7); + it.card[1] = script_getnum(st, 8); + it.card[2] = script_getnum(st, 9); + it.card[3] = script_getnum(st, 10); if( it.amount <= 0 ) return true;// nothing to do @@ -9247,6 +9245,8 @@ static BUILDIN(getbrokenid) num=script_getnum(st,2); for(i=0; i<MAX_INVENTORY; i++) { + if (sd->status.inventory[i].card[0] == CARD0_PET) + continue; if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { brokencounter++; if(num==brokencounter) { @@ -9272,6 +9272,8 @@ static BUILDIN(getbrokencount) return true; for (i = 0; i < MAX_INVENTORY; i++) { + if (sd->status.inventory[i].card[0] == CARD0_PET) + continue; if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) counter++; } @@ -9294,6 +9296,8 @@ static BUILDIN(repair) num=script_getnum(st,2); for(i=0; i<MAX_INVENTORY; i++) { + if (sd->status.inventory[i].card[0] == CARD0_PET) + continue; if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { repaircounter++; if(num==repaircounter) { @@ -9322,6 +9326,8 @@ static BUILDIN(repairall) for(i = 0; i < MAX_INVENTORY; i++) { + if (sd->status.inventory[i].card[0] == CARD0_PET) + continue; if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { sd->status.inventory[i].attribute |= ATTR_BROKEN; @@ -10728,7 +10734,7 @@ static BUILDIN(makepet) sd->catch_target_class = pet->db[pet_id].class_; intif->create_pet(sd->status.account_id, sd->status.char_id, (short)pet->db[pet_id].class_, (short)mob->db(pet->db[pet_id].class_)->lv, - (short)pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, + pet->db[pet_id].EggID, 0, (short)pet->db[pet_id].intimate, 100, 0, 1, pet->db[pet_id].jname); } @@ -16457,7 +16463,7 @@ static BUILDIN(equip) nameid=script_getnum(st,2); if((item_data = itemdb->exists(nameid)) == NULL) { - ShowError("wrong item ID : equipitem(%i)\n",nameid); + ShowError("wrong item ID : equipitem(%d)\n",nameid); return false; } ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].equip == 0 ); @@ -16513,12 +16519,12 @@ static BUILDIN(equip2) return false; } - ref = script_getnum(st,3); - attr = script_getnum(st,4); - c0 = (short)script_getnum(st,5); - c1 = (short)script_getnum(st,6); - c2 = (short)script_getnum(st,7); - c3 = (short)script_getnum(st,8); + ref = script_getnum(st, 3); + attr = script_getnum(st, 4); + c0 = script_getnum(st, 5); + c1 = script_getnum(st, 6); + c2 = script_getnum(st, 7); + c3 = script_getnum(st, 8); ARR_FIND( 0, MAX_INVENTORY, i,( sd->status.inventory[i].equip == 0 && sd->status.inventory[i].nameid == nameid && @@ -20915,63 +20921,177 @@ static BUILDIN(readbook) static BUILDIN(questinfo) { struct npc_data *nd = map->id2nd(st->oid); - int quest_id, icon; - struct questinfo qi; + struct questinfo qi = { 0 }; + int icon = script_getnum(st, 2); - if( nd == NULL || nd->bl.m == -1 ) + if (nd == NULL) return true; - quest_id = script_getnum(st, 2); - icon = script_getnum(st, 3); - -#if PACKETVER >= 20170315 - if (icon < 0 || (icon > 10 && icon != 9999)) - icon = 9999; -#elif PACKETVER >= 20120410 - if (icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. -#else - if (icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; -#endif + if (nd->bl.m == -1) { + ShowWarning("buildin_questinfo: questinfo cannot be set for an npc with no valid map.\n"); + return false; + } - qi.quest_id = quest_id; - qi.icon = (unsigned char)icon; qi.nd = nd; - - if (script_hasdata(st, 4)) { - int color = script_getnum(st, 4); + qi.icon = quest->questinfo_validate_icon(icon); + if (script_hasdata(st, 3)) { + int color = script_getnum(st, 3); if (color < 0 || color > 3) { - ShowWarning("buildin_questinfo: invalid color '%d', changing to 0\n",color); + ShowWarning("buildin_questinfo: invalid color '%d', defaulting to 0.\n", color); script->reportfunc(st); color = 0; } qi.color = (unsigned char)color; } - qi.hasJob = false; + map->add_questinfo(nd->bl.m, &qi); + return true; +} - if (script_hasdata(st, 5)) { - int job = script_getnum(st, 5); +static BUILDIN(setquestinfo) +{ + struct npc_data *nd = map->id2nd(st->oid); + struct questinfo *qi = NULL; + uint32 type = script_getnum(st, 2); - if (!pc->db_checkid(job)) { - ShowError("buildin_questinfo: Nonexistant Job Class.\n"); - } else { - qi.hasJob = true; - qi.job = (unsigned short)job; + if (nd == NULL) + return true; + + if (nd->bl.m == -1) { + ShowWarning("buildin_setquestinfo: questinfo cannot be set for an npc with no valid map.\n"); + return false; + } + + qi = &VECTOR_LAST(map->list[nd->bl.m].qi_data); + if (qi == NULL) { + ShowWarning("buildin_setquestinfo: no valide questinfo data has been found for this npc.\n"); + return false; + } + if (qi->nd != nd) { + ShowWarning("buildin_setquestinfo: invalid usage, setquestinfo must be used only after questinfo.\n"); + return false; + } + switch (type) { + case QINFO_JOB: + { + int jobid = script_getnum(st, 3); + if (!pc->db_checkid(jobid)) { + ShowWarning("buildin_setquestinfo: invalid job id given (%d).\n", jobid); + return false; + } + qi->hasJob = true; + qi->job = jobid; + break; + } + case QINFO_SEX: + { + int sex = script_getnum(st, 3); + if (sex != SEX_MALE && sex != SEX_FEMALE) { + ShowWarning("buildin_setquestinfo: unsupported sex has been given (%d).\n", sex); + return false; + } + qi->sex_enabled = true; + qi->sex = sex; + break; + } + case QINFO_BASE_LEVEL: + { + int min = script_getnum(st, 3); + int max = script_getnum(st, 4); + if (min > max) { + ShowWarning("buildin_setquestinfo: minimal level (%d) is bigger than the maximal level (%d).\n", min, max); + return false; } + qi->base_level.min = min; + qi->base_level.max = max; + break; } + case QINFO_JOB_LEVEL: + { + int min = script_getnum(st, 3); + int max = script_getnum(st, 4); + if (min > max) { + ShowWarning("buildin_setquestinfo: minimal level (%d) is bigger than the maximal level (%d).\n", min, max); + return false; + } + qi->job_level.min = min; + qi->job_level.max = max; + break; + } + case QINFO_ITEM: + { + struct item item = { 0 }; - map->add_questinfo(nd->bl.m,&qi); + item.nameid = script_getnum(st, 3); + item.amount = script_getnum(st, 4); + if (itemdb->exists(item.nameid) == NULL) { + ShowWarning("buildin_setquestinfo: non existing item (%d) have been given.\n", item.nameid); + return false; + } + if (item.amount <= 0 || item.amount > MAX_AMOUNT) { + ShowWarning("buildin_setquestinfo: given amount (%d) must be bigger than 0 and smaller than %d.\n", item.amount, MAX_AMOUNT + 1); + return false; + } + if (VECTOR_LENGTH(qi->items) == 0) + VECTOR_INIT(qi->items); + VECTOR_ENSURE(qi->items, 1, 1); + VECTOR_PUSH(qi->items, item); + break; + } + case QINFO_HOMUN_LEVEL: + { + int min = script_getnum(st, 3); + if (min > battle_config.hom_max_level && min > battle_config.hom_S_max_level) { + ShowWarning("buildin_setquestinfo: minimum homunculus level given (%d) is bigger than the max possible level.\n", min); + return false; + } + qi->homunculus.level = min; + break; + } + case QINFO_HOMUN_TYPE: + { + int hom_type = script_getnum(st, 3); + if (hom_type < HT_REG || hom_type > HT_S) { + ShowWarning("buildin_setquestinfo: invalid homunculus type (%d).\n", hom_type); + return false; + } + qi->homunculus_type = hom_type; + break; + } + case QINFO_QUEST: + { + struct questinfo_qreq quest_req = { 0 }; + struct quest_db *quest_data = NULL; + + quest_req.id = script_getnum(st, 3); + quest_req.state = script_getnum(st, 4); + + quest_data = quest->db(quest_req.id); + if (quest_data == &quest->dummy) { + ShowWarning("buildin_setquestinfo: invalid quest given (%d).\n", quest_req.id); + return false; + } + if (quest_req.state < Q_INACTIVE || quest_req.state > Q_COMPLETE) { + ShowWarning("buildin_setquestinfo: invalid quest state given (%d).\n", quest_req.state); + return false; + } + + if (VECTOR_LENGTH(qi->quest_requirement) == 0) + VECTOR_INIT(qi->quest_requirement); + VECTOR_ENSURE(qi->quest_requirement, 1, 1); + VECTOR_PUSH(qi->quest_requirement, quest_req); + break; + } + default: + ShowWarning("buildin_setquestinfo: invalid type given (%u).\n", type); + return false; + } return true; } static BUILDIN(setquest) { - unsigned short i; int quest_id; unsigned int time_limit; struct map_session_data *sd = script->rid2sd(st); @@ -20983,19 +21103,6 @@ static BUILDIN(setquest) time_limit = script_hasdata(st, 3) ? script_getnum(st, 3) : 0; quest->add(sd, quest_id, time_limit); - - // If questinfo is set, remove quest bubble once quest is set. - for (i = 0; i < map->list[sd->bl.m].qi_count; i++) { - struct questinfo *qi = &map->list[sd->bl.m].qi_data[i]; - if (qi->quest_id == quest_id) { -#if PACKETVER >= 20120410 - clif->quest_show_event(sd, &qi->nd->bl, 9999, 0); -#else - clif->quest_show_event(sd, &qi->nd->bl, 0, 0); -#endif - } - } - return true; } @@ -25097,7 +25204,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(checkbound, "i???????"), //Quest Log System [Inkfish] - BUILDIN_DEF(questinfo, "ii??"), + BUILDIN_DEF(questinfo, "i?"), + BUILDIN_DEF(setquestinfo, "i??"), BUILDIN_DEF(setquest, "i?"), BUILDIN_DEF(erasequest, "i?"), BUILDIN_DEF(completequest, "i?"), @@ -25558,6 +25666,16 @@ static void script_hardcoded_constants(void) script->set_constant("P_AIRSHIP_ITEM_NOT_ENOUGH", P_AIRSHIP_ITEM_NOT_ENOUGH, false, false); script->set_constant("P_AIRSHIP_ITEM_INVALID", P_AIRSHIP_ITEM_INVALID, false, false); + script->constdb_comment("questinfo types"); + script->set_constant("QINFO_JOB", QINFO_JOB, false, false); + script->set_constant("QINFO_SEX", QINFO_SEX, false, false); + script->set_constant("QINFO_BASE_LEVEL", QINFO_BASE_LEVEL, false, false); + script->set_constant("QINFO_JOB_LEVEL", QINFO_JOB_LEVEL, false, false); + script->set_constant("QINFO_ITEM", QINFO_ITEM, false, false); + script->set_constant("QINFO_HOMUN_LEVEL", QINFO_HOMUN_LEVEL, false, false); + script->set_constant("QINFO_HOMUN_TYPE", QINFO_HOMUN_TYPE, false, false); + script->set_constant("QINFO_QUEST", QINFO_QUEST, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index a0cfb7692..fe8bcf00b 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -708,7 +708,7 @@ struct script_interface { int string_list_size; int string_list_pos; /* */ - unsigned short current_item_id; + int current_item_id; /* */ struct script_label_entry *labels; int label_count; @@ -872,7 +872,7 @@ struct script_interface { void (*add_translatable_string) (const struct script_string_buf *string, const char *start_point); const char *(*parse_expr) (const char *p); const char *(*parse_line) (const char *p); - void (*read_constdb) (void); + void (*read_constdb) (bool reload); void (*constdb_comment) (const char *comment); void (*load_parameters) (void); const char* (*print_line) (StringBuf *buf, const char *p, const char *mark, int line); diff --git a/src/map/searchstore.c b/src/map/searchstore.c index 6b847eb92..0c6fa3555 100644 --- a/src/map/searchstore.c +++ b/src/map/searchstore.c @@ -263,7 +263,7 @@ static void searchstore_close(struct map_session_data *sd) } } -static void searchstore_click(struct map_session_data *sd, int account_id, int store_id, unsigned short nameid) +static void searchstore_click(struct map_session_data *sd, int account_id, int store_id, int nameid) { unsigned int i; struct map_session_data* pl_sd; @@ -278,7 +278,7 @@ static void searchstore_click(struct map_session_data *sd, int account_id, int s ARR_FIND( 0, sd->searchstore.count, i, sd->searchstore.items[i].store_id == store_id && sd->searchstore.items[i].account_id == account_id && sd->searchstore.items[i].nameid == nameid ); if( i == sd->searchstore.count ) {// no such result, crafted - ShowWarning("searchstore_click: Received request with item %hu of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id); + ShowWarning("searchstore_click: Received request with item %d of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id); clif->search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE); return; } @@ -345,7 +345,7 @@ static void searchstore_clearremote(struct map_session_data *sd) } /// receives results from a store-specific callback -static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short *card, unsigned char refine, const struct item_option *option) +static bool searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option) { struct s_search_store_info_item* ssitem; diff --git a/src/map/searchstore.h b/src/map/searchstore.h index 03924c29a..e5ccfd300 100644 --- a/src/map/searchstore.h +++ b/src/map/searchstore.h @@ -72,10 +72,10 @@ struct s_search_store_info_item { unsigned int store_id; int account_id; char store_name[MESSAGE_SIZE]; - unsigned short nameid; + int nameid; unsigned short amount; unsigned int price; - short card[MAX_SLOTS]; + int card[MAX_SLOTS]; unsigned char refine; struct item_option option[MAX_ITEM_OPTIONS]; }; @@ -93,7 +93,7 @@ struct s_search_store_info { }; /// type for shop search function -typedef bool (*searchstore_search_t)(struct map_session_data* sd, unsigned short nameid); +typedef bool (*searchstore_search_t)(struct map_session_data* sd, int nameid); typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struct s_search_store_search* s); /** @@ -106,10 +106,10 @@ struct searchstore_interface { void (*next) (struct map_session_data* sd); void (*clear) (struct map_session_data* sd); void (*close) (struct map_session_data* sd); - void (*click) (struct map_session_data* sd, int account_id, int store_id, unsigned short nameid); + void (*click) (struct map_session_data* sd, int account_id, int store_id, int nameid); bool (*queryremote) (struct map_session_data* sd, int account_id); void (*clearremote) (struct map_session_data* sd); - bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine, const struct item_option *option); + bool (*result) (struct map_session_data* sd, unsigned int store_id, int account_id, const char* store_name, int nameid, unsigned short amount, unsigned int price, const int* card, unsigned char refine, const struct item_option *option); }; #ifdef HERCULES_CORE diff --git a/src/map/skill.c b/src/map/skill.c index 64b04e7b4..524769873 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -10246,7 +10246,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list * case GN_SLINGITEM: if( sd ) { - short ammo_id; + int ammo_id; int equip_idx = sd->equip_index[EQI_AMMO]; if( equip_idx <= 0 ) break; // No ammo. @@ -16106,6 +16106,9 @@ static void skill_repairweapon(struct map_session_data *sd, int idx) if( item->nameid <= 0 || (item->attribute & ATTR_BROKEN) == 0 ) return; //Again invalid item.... + if (item->card[0] == CARD0_PET) + return; + if( sd != target_sd && !battle->check_range(&sd->bl,&target_sd->bl, skill->get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){ clif->item_repaireffect(sd,idx,1); return; @@ -19917,7 +19920,7 @@ static bool skill_parse_row_abradb(char *split[], int columns, int current) static bool skill_parse_row_changematerialdb(char *split[], int columns, int current) { // ProductID,BaseRate,MakeAmount1,MakeAmountRate1...,MakeAmount5,MakeAmountRate5 - uint16 skill_id; + int skill_id; short j; int x,y; diff --git a/src/map/skill.h b/src/map/skill.h index bd1dc3344..736417649 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1726,7 +1726,7 @@ struct skill_condition { // Database skills struct s_skill_db { - unsigned short nameid; + int nameid; char name[MAX_SKILL_NAME_LENGTH]; char desc[40]; int range[MAX_SKILL_LEVEL],hit,inf,element[MAX_SKILL_LEVEL],nk,splash[MAX_SKILL_LEVEL],max; diff --git a/src/map/unit.h b/src/map/unit.h index 761b3a0b6..0c1c2405c 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -81,16 +81,16 @@ struct unit_data { struct view_data { int16 class; - uint16 weapon, + int weapon, shield, //Or left-hand weapon. robe, head_top, head_mid, head_bottom, hair_style, - hair_color, - cloth_color, body_style; + uint16 hair_color, + cloth_color; char sex; unsigned dead_sit : 2; }; diff --git a/src/map/vending.c b/src/map/vending.c index 9bd06c758..692f5f378 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -315,7 +315,7 @@ static void vending_openvending(struct map_session_data *sd, const char *message /// Checks if an item is being sold in given player's vending. -static bool vending_search(struct map_session_data *sd, unsigned short nameid) +static bool vending_search(struct map_session_data *sd, int nameid) { int i; @@ -324,7 +324,7 @@ static bool vending_search(struct map_session_data *sd, unsigned short nameid) return false; } - ARR_FIND( 0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == (short)nameid ); + ARR_FIND(0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == nameid); if( i == sd->vend_num ) { // not found return false; } @@ -347,7 +347,7 @@ static bool vending_searchall(struct map_session_data *sd, const struct s_search return true; for( idx = 0; idx < s->item_count; idx++ ) { - ARR_FIND( 0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == (short)s->itemlist[idx] ); + ARR_FIND(0, sd->vend_num, i, sd->status.cart[sd->vending[i].index].nameid == s->itemlist[idx]); if( i == sd->vend_num ) {// not found continue; } diff --git a/src/map/vending.h b/src/map/vending.h index 831e122e7..c994aad3a 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -45,7 +45,7 @@ struct vending_interface { void (*open) (struct map_session_data* sd, const char* message, const uint8* data, int count); void (*list) (struct map_session_data* sd, unsigned int id); void (*purchase) (struct map_session_data* sd, int aid, unsigned int uid, const uint8* data, int count); - bool (*search) (struct map_session_data* sd, unsigned short nameid); + bool (*search) (struct map_session_data* sd, int nameid); bool (*searchall) (struct map_session_data* sd, const struct s_search_store_search* s); }; diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index e3b694c2b..ca64aca6a 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2016 Hercules Dev Team + * Copyright (C) 2013-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index af1d1acd3..6b6c4d4e7 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -338,8 +338,8 @@ typedef void (*HPMHOOK_pre_buyingstore_open) (struct map_session_data **sd, int typedef void (*HPMHOOK_post_buyingstore_open) (struct map_session_data *sd, int account_id); typedef void (*HPMHOOK_pre_buyingstore_trade) (struct map_session_data **sd, int *account_id, unsigned int *buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub **itemlist, unsigned int *count); typedef void (*HPMHOOK_post_buyingstore_trade) (struct map_session_data *sd, int account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub *itemlist, unsigned int count); -typedef bool (*HPMHOOK_pre_buyingstore_search) (struct map_session_data **sd, unsigned short *nameid); -typedef bool (*HPMHOOK_post_buyingstore_search) (bool retVal___, struct map_session_data *sd, unsigned short nameid); +typedef bool (*HPMHOOK_pre_buyingstore_search) (struct map_session_data **sd, int *nameid); +typedef bool (*HPMHOOK_post_buyingstore_search) (bool retVal___, struct map_session_data *sd, int nameid); typedef bool (*HPMHOOK_pre_buyingstore_searchall) (struct map_session_data **sd, const struct s_search_store_search **s); typedef bool (*HPMHOOK_post_buyingstore_searchall) (bool retVal___, struct map_session_data *sd, const struct s_search_store_search *s); typedef unsigned int (*HPMHOOK_pre_buyingstore_getuid) (void); @@ -1042,10 +1042,10 @@ typedef void (*HPMHOOK_pre_clif_cashshop_load) (void); typedef void (*HPMHOOK_post_clif_cashshop_load) (void); typedef void (*HPMHOOK_pre_clif_cashShopSchedule) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_cashShopSchedule) (int fd, struct map_session_data *sd); -typedef void (*HPMHOOK_pre_clif_package_announce) (struct map_session_data **sd, unsigned short *nameid, unsigned short *containerid); -typedef void (*HPMHOOK_post_clif_package_announce) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid); -typedef void (*HPMHOOK_pre_clif_item_drop_announce) (struct map_session_data **sd, unsigned short *nameid, char **monsterName); -typedef void (*HPMHOOK_post_clif_item_drop_announce) (struct map_session_data *sd, unsigned short nameid, char *monsterName); +typedef void (*HPMHOOK_pre_clif_package_announce) (struct map_session_data **sd, int *nameid, int *containerid); +typedef void (*HPMHOOK_post_clif_package_announce) (struct map_session_data *sd, int nameid, int containerid); +typedef void (*HPMHOOK_pre_clif_item_drop_announce) (struct map_session_data **sd, int *nameid, char **monsterName); +typedef void (*HPMHOOK_post_clif_item_drop_announce) (struct map_session_data *sd, int nameid, char *monsterName); typedef void (*HPMHOOK_pre_clif_clearunit_single) (int *id, clr_type *type, int *fd); typedef void (*HPMHOOK_post_clif_clearunit_single) (int id, clr_type type, int fd); typedef void (*HPMHOOK_pre_clif_clearunit_area) (struct block_list **bl, clr_type *type); @@ -1256,8 +1256,8 @@ typedef int (*HPMHOOK_pre_clif_hpmeter_sub) (struct block_list **bl, va_list ap) typedef int (*HPMHOOK_post_clif_hpmeter_sub) (int retVal___, struct block_list *bl, va_list ap); typedef void (*HPMHOOK_pre_clif_upgrademessage) (int *fd, int *result, int *item_id); typedef void (*HPMHOOK_post_clif_upgrademessage) (int fd, int result, int item_id); -typedef void (*HPMHOOK_pre_clif_get_weapon_view) (struct map_session_data **sd, unsigned short **rhand, unsigned short **lhand); -typedef void (*HPMHOOK_post_clif_get_weapon_view) (struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand); +typedef void (*HPMHOOK_pre_clif_get_weapon_view) (struct map_session_data **sd, int **rhand, int **lhand); +typedef void (*HPMHOOK_post_clif_get_weapon_view) (struct map_session_data *sd, int *rhand, int *lhand); typedef void (*HPMHOOK_pre_clif_gospel_info) (struct map_session_data **sd, int *type); typedef void (*HPMHOOK_post_clif_gospel_info) (struct map_session_data *sd, int type); typedef void (*HPMHOOK_pre_clif_feel_req) (int *fd, struct map_session_data **sd, uint16 *skill_lv); @@ -1800,12 +1800,12 @@ typedef void (*HPMHOOK_pre_clif_buyingstore_itemlist) (struct map_session_data * typedef void (*HPMHOOK_post_clif_buyingstore_itemlist) (struct map_session_data *sd, struct map_session_data *pl_sd); typedef void (*HPMHOOK_pre_clif_buyingstore_trade_failed_buyer) (struct map_session_data **sd, short *result); typedef void (*HPMHOOK_post_clif_buyingstore_trade_failed_buyer) (struct map_session_data *sd, short result); -typedef void (*HPMHOOK_pre_clif_buyingstore_update_item) (struct map_session_data **sd, unsigned short *nameid, unsigned short *amount, uint32 *char_id, int *zeny); -typedef void (*HPMHOOK_post_clif_buyingstore_update_item) (struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny); +typedef void (*HPMHOOK_pre_clif_buyingstore_update_item) (struct map_session_data **sd, int *nameid, unsigned short *amount, uint32 *char_id, int *zeny); +typedef void (*HPMHOOK_post_clif_buyingstore_update_item) (struct map_session_data *sd, int nameid, unsigned short amount, uint32 char_id, int zeny); typedef void (*HPMHOOK_pre_clif_buyingstore_delete_item) (struct map_session_data **sd, short *index, unsigned short *amount, int *price); typedef void (*HPMHOOK_post_clif_buyingstore_delete_item) (struct map_session_data *sd, short index, unsigned short amount, int price); -typedef void (*HPMHOOK_pre_clif_buyingstore_trade_failed_seller) (struct map_session_data **sd, short *result, unsigned short *nameid); -typedef void (*HPMHOOK_post_clif_buyingstore_trade_failed_seller) (struct map_session_data *sd, short result, unsigned short nameid); +typedef void (*HPMHOOK_pre_clif_buyingstore_trade_failed_seller) (struct map_session_data **sd, short *result, int *nameid); +typedef void (*HPMHOOK_post_clif_buyingstore_trade_failed_seller) (struct map_session_data *sd, short result, int nameid); typedef void (*HPMHOOK_pre_clif_search_store_info_ack) (struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_search_store_info_ack) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_search_store_info_failed) (struct map_session_data **sd, unsigned char *reason); @@ -1868,8 +1868,8 @@ typedef void (*HPMHOOK_pre_clif_npc_market_purchase_ack) (struct map_session_dat typedef void (*HPMHOOK_post_clif_npc_market_purchase_ack) (struct map_session_data *sd, const struct itemlist *item_list, unsigned char response); typedef bool (*HPMHOOK_pre_clif_parse_roulette_db) (void); typedef bool (*HPMHOOK_post_clif_parse_roulette_db) (bool retVal___); -typedef void (*HPMHOOK_pre_clif_roulette_generate_ack) (struct map_session_data **sd, unsigned char *result, short *stage, short *prizeIdx, short *bonusItemID); -typedef void (*HPMHOOK_post_clif_roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID); +typedef void (*HPMHOOK_pre_clif_roulette_generate_ack) (struct map_session_data **sd, unsigned char *result, short *stage, short *prizeIdx, int *bonusItemID); +typedef void (*HPMHOOK_post_clif_roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); typedef void (*HPMHOOK_pre_clif_openmergeitem) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_openmergeitem) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_cancelmergeitem) (int *fd, struct map_session_data **sd); @@ -2454,8 +2454,8 @@ typedef bool (*HPMHOOK_pre_clif_stylist_read_db_libconfig_sub) (struct config_se typedef bool (*HPMHOOK_post_clif_stylist_read_db_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); typedef bool (*HPMHOOK_pre_clif_style_change_validate_requirements) (struct map_session_data **sd, int *type, int16 *idx); typedef bool (*HPMHOOK_post_clif_style_change_validate_requirements) (bool retVal___, struct map_session_data *sd, int type, int16 idx); -typedef void (*HPMHOOK_pre_clif_stylist_send_rodexitem) (struct map_session_data **sd, int16 *itemid); -typedef void (*HPMHOOK_post_clif_stylist_send_rodexitem) (struct map_session_data *sd, int16 itemid); +typedef void (*HPMHOOK_pre_clif_stylist_send_rodexitem) (struct map_session_data **sd, int *itemid); +typedef void (*HPMHOOK_post_clif_stylist_send_rodexitem) (struct map_session_data *sd, int itemid); typedef void (*HPMHOOK_pre_clif_pReqStyleChange) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pReqStyleChange) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_cz_req_style_change_sub) (struct map_session_data **sd, int *type, int16 *idx, bool *isitem); @@ -3280,8 +3280,8 @@ typedef int (*HPMHOOK_pre_inter_pet_delete_) (int *pet_id); typedef int (*HPMHOOK_post_inter_pet_delete_) (int retVal___, int pet_id); typedef int (*HPMHOOK_pre_inter_pet_parse_frommap) (int *fd); typedef int (*HPMHOOK_post_inter_pet_parse_frommap) (int retVal___, int fd); -typedef struct s_pet* (*HPMHOOK_pre_inter_pet_create) (int *account_id, int *char_id, short *pet_class, short *pet_lv, short *pet_egg_id, short *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, const char **pet_name); -typedef struct s_pet* (*HPMHOOK_post_inter_pet_create) (struct s_pet* retVal___, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); +typedef struct s_pet* (*HPMHOOK_pre_inter_pet_create) (int *account_id, int *char_id, short *pet_class, short *pet_lv, int *pet_egg_id, int *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, const char **pet_name); +typedef struct s_pet* (*HPMHOOK_post_inter_pet_create) (struct s_pet* retVal___, int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); typedef struct s_pet* (*HPMHOOK_pre_inter_pet_load) (int *account_id, int *char_id, int *pet_id); typedef struct s_pet* (*HPMHOOK_post_inter_pet_load) (struct s_pet* retVal___, int account_id, int char_id, int pet_id); #endif // CHAR_INT_PET_H @@ -3342,8 +3342,8 @@ typedef bool (*HPMHOOK_post_inter_storage_retrieve_bound_items) (bool retVal___, #ifdef MAP_INTIF_H /* intif */ typedef int (*HPMHOOK_pre_intif_parse) (int *fd); typedef int (*HPMHOOK_post_intif_parse) (int retVal___, int fd); -typedef int (*HPMHOOK_pre_intif_create_pet) (int *account_id, int *char_id, short *pet_type, short *pet_lv, short *pet_egg_id, short *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, char **pet_name); -typedef int (*HPMHOOK_post_intif_create_pet) (int retVal___, int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); +typedef int (*HPMHOOK_pre_intif_create_pet) (int *account_id, int *char_id, short *pet_type, short *pet_lv, int *pet_egg_id, int *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, char **pet_name); +typedef int (*HPMHOOK_post_intif_create_pet) (int retVal___, int account_id, int char_id, short pet_type, short pet_lv, int pet_egg_id, int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); typedef int (*HPMHOOK_pre_intif_broadcast) (const char **mes, int *len, int *type); typedef int (*HPMHOOK_post_intif_broadcast) (int retVal___, const char *mes, int len, int type); typedef int (*HPMHOOK_pre_intif_broadcast2) (const char **mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY); @@ -3816,8 +3816,8 @@ typedef int (*HPMHOOK_pre_itemdb_options_final_sub) (union DBKey *key, struct DB typedef int (*HPMHOOK_post_itemdb_options_final_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef void (*HPMHOOK_pre_itemdb_clear) (bool *total); typedef void (*HPMHOOK_post_itemdb_clear) (bool total); -typedef struct item_combo* (*HPMHOOK_pre_itemdb_id2combo) (unsigned short *id); -typedef struct item_combo* (*HPMHOOK_post_itemdb_id2combo) (struct item_combo* retVal___, unsigned short id); +typedef struct item_combo* (*HPMHOOK_pre_itemdb_id2combo) (int *id); +typedef struct item_combo* (*HPMHOOK_post_itemdb_id2combo) (struct item_combo* retVal___, int id); typedef bool (*HPMHOOK_pre_itemdb_is_item_usable) (struct item_data **item); typedef bool (*HPMHOOK_post_itemdb_is_item_usable) (bool retVal___, struct item_data *item); typedef bool (*HPMHOOK_pre_itemdb_lookup_const) (const struct config_setting_t **it, const char **name, int **value); @@ -4504,8 +4504,8 @@ typedef int (*HPMHOOK_pre_map_sql_close) (void); typedef int (*HPMHOOK_post_map_sql_close) (int retVal___); typedef bool (*HPMHOOK_pre_map_zone_mf_cache) (int *m, char **flag, char **params); typedef bool (*HPMHOOK_post_map_zone_mf_cache) (bool retVal___, int m, char *flag, char *params); -typedef unsigned short (*HPMHOOK_pre_map_zone_str2itemid) (const char **name); -typedef unsigned short (*HPMHOOK_post_map_zone_str2itemid) (unsigned short retVal___, const char *name); +typedef int (*HPMHOOK_pre_map_zone_str2itemid) (const char **name); +typedef int (*HPMHOOK_post_map_zone_str2itemid) (int retVal___, const char *name); typedef unsigned short (*HPMHOOK_pre_map_zone_str2skillid) (const char **name); typedef unsigned short (*HPMHOOK_post_map_zone_str2skillid) (unsigned short retVal___, const char *name); typedef enum bl_type (*HPMHOOK_pre_map_zone_bl_type) (const char **entry, enum map_zone_skill_subtype **subtype); @@ -5186,6 +5186,12 @@ typedef void (*HPMHOOK_pre_mob_load) (bool *minimal); typedef void (*HPMHOOK_post_mob_load) (bool minimal); typedef void (*HPMHOOK_pre_mob_clear_spawninfo) (void); typedef void (*HPMHOOK_post_mob_clear_spawninfo) (void); +typedef struct item_drop_ratio* (*HPMHOOK_pre_mob_get_item_drop_ratio) (int *nameid); +typedef struct item_drop_ratio* (*HPMHOOK_post_mob_get_item_drop_ratio) (struct item_drop_ratio* retVal___, int nameid); +typedef void (*HPMHOOK_pre_mob_set_item_drop_ratio) (int *nameid, struct item_drop_ratio **ratio); +typedef void (*HPMHOOK_post_mob_set_item_drop_ratio) (int nameid, struct item_drop_ratio *ratio); +typedef int (*HPMHOOK_pre_mob_final_ratio_sub) (union DBKey *key, struct DBData **data, va_list ap); +typedef int (*HPMHOOK_post_mob_final_ratio_sub) (int retVal___, union DBKey key, struct DBData *data, va_list ap); typedef void (*HPMHOOK_pre_mob_destroy_mob_db) (int *index); typedef void (*HPMHOOK_post_mob_destroy_mob_db) (int index); typedef bool (*HPMHOOK_pre_mob_skill_db_libconfig) (const char **filename, bool *ignore_missing); @@ -5978,10 +5984,10 @@ typedef int (*HPMHOOK_pre_pc_inventory_rental_end) (int *tid, int64 *tick, int * typedef int (*HPMHOOK_post_pc_inventory_rental_end) (int retVal___, int tid, int64 tick, int id, intptr_t data); typedef void (*HPMHOOK_pre_pc_check_skilltree) (struct map_session_data **sd, int *skill_id); typedef void (*HPMHOOK_post_pc_check_skilltree) (struct map_session_data *sd, int skill_id); -typedef int (*HPMHOOK_pre_pc_bonus_autospell) (struct s_autospell **spell, int *max, short *id, short *lv, short *rate, short *flag, short *card_id); -typedef int (*HPMHOOK_post_pc_bonus_autospell) (int retVal___, struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id); -typedef int (*HPMHOOK_pre_pc_bonus_autospell_onskill) (struct s_autospell **spell, int *max, short *src_skill, short *id, short *lv, short *rate, short *card_id); -typedef int (*HPMHOOK_post_pc_bonus_autospell_onskill) (int retVal___, struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id); +typedef int (*HPMHOOK_pre_pc_bonus_autospell) (struct s_autospell **spell, int *max, short *id, short *lv, short *rate, short *flag, int *card_id); +typedef int (*HPMHOOK_post_pc_bonus_autospell) (int retVal___, struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id); +typedef int (*HPMHOOK_pre_pc_bonus_autospell_onskill) (struct s_autospell **spell, int *max, short *src_skill, short *id, short *lv, short *rate, int *card_id); +typedef int (*HPMHOOK_post_pc_bonus_autospell_onskill) (int retVal___, struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id); typedef int (*HPMHOOK_pre_pc_bonus_addeff) (struct s_addeffect **effect, int *max, enum sc_type *id, int16 *rate, int16 *arrow_rate, uint8 *flag, uint16 *duration); typedef int (*HPMHOOK_post_pc_bonus_addeff) (int retVal___, struct s_addeffect *effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration); typedef int (*HPMHOOK_pre_pc_bonus_addeff_onskill) (struct s_addeffectonskill **effect, int *max, enum sc_type *id, short *rate, short *skill_id, unsigned char *target); @@ -6134,8 +6140,8 @@ typedef int (*HPMHOOK_pre_pet_birth_process) (struct map_session_data **sd, stru typedef int (*HPMHOOK_post_pet_birth_process) (int retVal___, struct map_session_data *sd, struct s_pet *petinfo); typedef int (*HPMHOOK_pre_pet_recv_petdata) (int *account_id, struct s_pet **p, int *flag); typedef int (*HPMHOOK_post_pet_recv_petdata) (int retVal___, int account_id, struct s_pet *p, int flag); -typedef int (*HPMHOOK_pre_pet_select_egg) (struct map_session_data **sd, short *egg_index); -typedef int (*HPMHOOK_post_pet_select_egg) (int retVal___, struct map_session_data *sd, short egg_index); +typedef int (*HPMHOOK_pre_pet_select_egg) (struct map_session_data **sd, int *egg_index); +typedef int (*HPMHOOK_post_pet_select_egg) (int retVal___, struct map_session_data *sd, int egg_index); typedef int (*HPMHOOK_pre_pet_catch_process1) (struct map_session_data **sd, int *target_class); typedef int (*HPMHOOK_post_pet_catch_process1) (int retVal___, struct map_session_data *sd, int target_class); typedef int (*HPMHOOK_pre_pet_catch_process2) (struct map_session_data **sd, int *target_id); @@ -6252,6 +6258,30 @@ typedef int (*HPMHOOK_pre_quest_read_db) (void); typedef int (*HPMHOOK_post_quest_read_db) (int retVal___); typedef struct quest_db* (*HPMHOOK_pre_quest_read_db_sub) (struct config_setting_t **cs, int *n, const char **source); typedef struct quest_db* (*HPMHOOK_post_quest_read_db_sub) (struct quest_db* retVal___, struct config_setting_t *cs, int n, const char *source); +typedef int (*HPMHOOK_pre_quest_questinfo_validate_icon) (int *icon); +typedef int (*HPMHOOK_post_quest_questinfo_validate_icon) (int retVal___, int icon); +typedef void (*HPMHOOK_pre_quest_questinfo_refresh) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_quest_questinfo_refresh) (struct map_session_data *sd); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_job) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_job) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_sex) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_sex) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_baselevel) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_baselevel) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_joblevel) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_joblevel) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_items) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_items) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_homunculus_level) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_homunculus_level) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_homunculus_type) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_homunculus_type) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef bool (*HPMHOOK_pre_quest_questinfo_validate_quests) (struct map_session_data **sd, struct questinfo **qi); +typedef bool (*HPMHOOK_post_quest_questinfo_validate_quests) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); +typedef void (*HPMHOOK_pre_quest_questinfo_vector_clear) (int *m); +typedef void (*HPMHOOK_post_quest_questinfo_vector_clear) (int m); #endif // MAP_QUEST_H #ifdef COMMON_RANDOM_H /* rnd */ typedef void (*HPMHOOK_pre_rnd_init) (void); @@ -6502,8 +6532,8 @@ typedef const char* (*HPMHOOK_pre_script_parse_expr) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_expr) (const char* retVal___, const char *p); typedef const char* (*HPMHOOK_pre_script_parse_line) (const char **p); typedef const char* (*HPMHOOK_post_script_parse_line) (const char* retVal___, const char *p); -typedef void (*HPMHOOK_pre_script_read_constdb) (void); -typedef void (*HPMHOOK_post_script_read_constdb) (void); +typedef void (*HPMHOOK_pre_script_read_constdb) (bool *reload); +typedef void (*HPMHOOK_post_script_read_constdb) (bool reload); typedef void (*HPMHOOK_pre_script_constdb_comment) (const char **comment); typedef void (*HPMHOOK_post_script_constdb_comment) (const char *comment); typedef void (*HPMHOOK_pre_script_load_parameters) (void); @@ -6688,14 +6718,14 @@ typedef void (*HPMHOOK_pre_searchstore_clear) (struct map_session_data **sd); typedef void (*HPMHOOK_post_searchstore_clear) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_searchstore_close) (struct map_session_data **sd); typedef void (*HPMHOOK_post_searchstore_close) (struct map_session_data *sd); -typedef void (*HPMHOOK_pre_searchstore_click) (struct map_session_data **sd, int *account_id, int *store_id, unsigned short *nameid); -typedef void (*HPMHOOK_post_searchstore_click) (struct map_session_data *sd, int account_id, int store_id, unsigned short nameid); +typedef void (*HPMHOOK_pre_searchstore_click) (struct map_session_data **sd, int *account_id, int *store_id, int *nameid); +typedef void (*HPMHOOK_post_searchstore_click) (struct map_session_data *sd, int account_id, int store_id, int nameid); typedef bool (*HPMHOOK_pre_searchstore_queryremote) (struct map_session_data **sd, int *account_id); typedef bool (*HPMHOOK_post_searchstore_queryremote) (bool retVal___, struct map_session_data *sd, int account_id); typedef void (*HPMHOOK_pre_searchstore_clearremote) (struct map_session_data **sd); typedef void (*HPMHOOK_post_searchstore_clearremote) (struct map_session_data *sd); -typedef bool (*HPMHOOK_pre_searchstore_result) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, unsigned short *nameid, unsigned short *amount, unsigned int *price, const short **card, unsigned char *refine, const struct item_option **option); -typedef bool (*HPMHOOK_post_searchstore_result) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short *card, unsigned char refine, const struct item_option *option); +typedef bool (*HPMHOOK_pre_searchstore_result) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, int *nameid, unsigned short *amount, unsigned int *price, const int **card, unsigned char *refine, const struct item_option **option); +typedef bool (*HPMHOOK_post_searchstore_result) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option); #endif // MAP_SEARCHSTORE_H #ifdef COMMON_SHOWMSG_H /* showmsg */ typedef void (*HPMHOOK_pre_showmsg_init) (void); @@ -7892,8 +7922,8 @@ typedef void (*HPMHOOK_pre_vending_list) (struct map_session_data **sd, unsigned typedef void (*HPMHOOK_post_vending_list) (struct map_session_data *sd, unsigned int id); typedef void (*HPMHOOK_pre_vending_purchase) (struct map_session_data **sd, int *aid, unsigned int *uid, const uint8 **data, int *count); typedef void (*HPMHOOK_post_vending_purchase) (struct map_session_data *sd, int aid, unsigned int uid, const uint8 *data, int count); -typedef bool (*HPMHOOK_pre_vending_search) (struct map_session_data **sd, unsigned short *nameid); -typedef bool (*HPMHOOK_post_vending_search) (bool retVal___, struct map_session_data *sd, unsigned short nameid); +typedef bool (*HPMHOOK_pre_vending_search) (struct map_session_data **sd, int *nameid); +typedef bool (*HPMHOOK_post_vending_search) (bool retVal___, struct map_session_data *sd, int nameid); typedef bool (*HPMHOOK_pre_vending_searchall) (struct map_session_data **sd, const struct s_search_store_search **s); typedef bool (*HPMHOOK_post_vending_searchall) (bool retVal___, struct map_session_data *sd, const struct s_search_store_search *s); #endif // MAP_VENDING_H diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index ad57bce86..831c9da63 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -9271,11 +9271,11 @@ int HP_inter_pet_parse_frommap(int fd) { } return retVal___; } -struct s_pet* HP_inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name) { +struct s_pet* HP_inter_pet_create(int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name) { int hIndex = 0; struct s_pet* retVal___ = NULL; if (HPMHooks.count.HP_inter_pet_create_pre > 0) { - struct s_pet* (*preHookFunc) (int *account_id, int *char_id, short *pet_class, short *pet_lv, short *pet_egg_id, short *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, const char **pet_name); + struct s_pet* (*preHookFunc) (int *account_id, int *char_id, short *pet_class, short *pet_lv, int *pet_egg_id, int *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, const char **pet_name); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_create_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_inter_pet_create_pre[hIndex].func; @@ -9290,7 +9290,7 @@ struct s_pet* HP_inter_pet_create(int account_id, int char_id, short pet_class, retVal___ = HPMHooks.source.inter_pet.create(account_id, char_id, pet_class, pet_lv, pet_egg_id, pet_equip, intimate, hungry, rename_flag, incubate, pet_name); } if (HPMHooks.count.HP_inter_pet_create_post > 0) { - struct s_pet* (*postHookFunc) (struct s_pet* retVal___, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); + struct s_pet* (*postHookFunc) (struct s_pet* retVal___, int account_id, int char_id, short pet_class, short pet_lv, int pet_egg_id, int pet_equip, short intimate, short hungry, char rename_flag, char incubate, const char *pet_name); for (hIndex = 0; hIndex < HPMHooks.count.HP_inter_pet_create_post; hIndex++) { postHookFunc = HPMHooks.list.HP_inter_pet_create_post[hIndex].func; retVal___ = postHookFunc(retVal___, account_id, char_id, pet_class, pet_lv, pet_egg_id, pet_equip, intimate, hungry, rename_flag, incubate, pet_name); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 61779b200..7d0e12e93 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3798,6 +3798,12 @@ struct { struct HPMHookPoint *HP_mob_load_post; struct HPMHookPoint *HP_mob_clear_spawninfo_pre; struct HPMHookPoint *HP_mob_clear_spawninfo_post; + struct HPMHookPoint *HP_mob_get_item_drop_ratio_pre; + struct HPMHookPoint *HP_mob_get_item_drop_ratio_post; + struct HPMHookPoint *HP_mob_set_item_drop_ratio_pre; + struct HPMHookPoint *HP_mob_set_item_drop_ratio_post; + struct HPMHookPoint *HP_mob_final_ratio_sub_pre; + struct HPMHookPoint *HP_mob_final_ratio_sub_post; struct HPMHookPoint *HP_mob_destroy_mob_db_pre; struct HPMHookPoint *HP_mob_destroy_mob_db_post; struct HPMHookPoint *HP_mob_skill_db_libconfig_pre; @@ -4808,6 +4814,30 @@ struct { struct HPMHookPoint *HP_quest_read_db_post; struct HPMHookPoint *HP_quest_read_db_sub_pre; struct HPMHookPoint *HP_quest_read_db_sub_post; + struct HPMHookPoint *HP_quest_questinfo_validate_icon_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_icon_post; + struct HPMHookPoint *HP_quest_questinfo_refresh_pre; + struct HPMHookPoint *HP_quest_questinfo_refresh_post; + struct HPMHookPoint *HP_quest_questinfo_validate_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_post; + struct HPMHookPoint *HP_quest_questinfo_validate_job_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_job_post; + struct HPMHookPoint *HP_quest_questinfo_validate_sex_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_sex_post; + struct HPMHookPoint *HP_quest_questinfo_validate_baselevel_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_baselevel_post; + struct HPMHookPoint *HP_quest_questinfo_validate_joblevel_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_joblevel_post; + struct HPMHookPoint *HP_quest_questinfo_validate_items_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_items_post; + struct HPMHookPoint *HP_quest_questinfo_validate_homunculus_level_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_homunculus_level_post; + struct HPMHookPoint *HP_quest_questinfo_validate_homunculus_type_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_homunculus_type_post; + struct HPMHookPoint *HP_quest_questinfo_validate_quests_pre; + struct HPMHookPoint *HP_quest_questinfo_validate_quests_post; + struct HPMHookPoint *HP_quest_questinfo_vector_clear_pre; + struct HPMHookPoint *HP_quest_questinfo_vector_clear_post; struct HPMHookPoint *HP_rnd_init_pre; struct HPMHookPoint *HP_rnd_init_post; struct HPMHookPoint *HP_rnd_final_pre; @@ -10189,6 +10219,12 @@ struct { int HP_mob_load_post; int HP_mob_clear_spawninfo_pre; int HP_mob_clear_spawninfo_post; + int HP_mob_get_item_drop_ratio_pre; + int HP_mob_get_item_drop_ratio_post; + int HP_mob_set_item_drop_ratio_pre; + int HP_mob_set_item_drop_ratio_post; + int HP_mob_final_ratio_sub_pre; + int HP_mob_final_ratio_sub_post; int HP_mob_destroy_mob_db_pre; int HP_mob_destroy_mob_db_post; int HP_mob_skill_db_libconfig_pre; @@ -11199,6 +11235,30 @@ struct { int HP_quest_read_db_post; int HP_quest_read_db_sub_pre; int HP_quest_read_db_sub_post; + int HP_quest_questinfo_validate_icon_pre; + int HP_quest_questinfo_validate_icon_post; + int HP_quest_questinfo_refresh_pre; + int HP_quest_questinfo_refresh_post; + int HP_quest_questinfo_validate_pre; + int HP_quest_questinfo_validate_post; + int HP_quest_questinfo_validate_job_pre; + int HP_quest_questinfo_validate_job_post; + int HP_quest_questinfo_validate_sex_pre; + int HP_quest_questinfo_validate_sex_post; + int HP_quest_questinfo_validate_baselevel_pre; + int HP_quest_questinfo_validate_baselevel_post; + int HP_quest_questinfo_validate_joblevel_pre; + int HP_quest_questinfo_validate_joblevel_post; + int HP_quest_questinfo_validate_items_pre; + int HP_quest_questinfo_validate_items_post; + int HP_quest_questinfo_validate_homunculus_level_pre; + int HP_quest_questinfo_validate_homunculus_level_post; + int HP_quest_questinfo_validate_homunculus_type_pre; + int HP_quest_questinfo_validate_homunculus_type_post; + int HP_quest_questinfo_validate_quests_pre; + int HP_quest_questinfo_validate_quests_post; + int HP_quest_questinfo_vector_clear_pre; + int HP_quest_questinfo_vector_clear_post; int HP_rnd_init_pre; int HP_rnd_init_post; int HP_rnd_final_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 55ac7d531..53a8f55a0 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1947,6 +1947,9 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mob->readdb_itemratio, HP_mob_readdb_itemratio) }, { HP_POP(mob->load, HP_mob_load) }, { HP_POP(mob->clear_spawninfo, HP_mob_clear_spawninfo) }, + { HP_POP(mob->get_item_drop_ratio, HP_mob_get_item_drop_ratio) }, + { HP_POP(mob->set_item_drop_ratio, HP_mob_set_item_drop_ratio) }, + { HP_POP(mob->final_ratio_sub, HP_mob_final_ratio_sub) }, { HP_POP(mob->destroy_mob_db, HP_mob_destroy_mob_db) }, { HP_POP(mob->skill_db_libconfig, HP_mob_skill_db_libconfig) }, { HP_POP(mob->skill_db_libconfig_sub, HP_mob_skill_db_libconfig_sub) }, @@ -2463,6 +2466,18 @@ struct HookingPointData HookingPoints[] = { { HP_POP(quest->clear, HP_quest_clear) }, { HP_POP(quest->read_db, HP_quest_read_db) }, { HP_POP(quest->read_db_sub, HP_quest_read_db_sub) }, + { HP_POP(quest->questinfo_validate_icon, HP_quest_questinfo_validate_icon) }, + { HP_POP(quest->questinfo_refresh, HP_quest_questinfo_refresh) }, + { HP_POP(quest->questinfo_validate, HP_quest_questinfo_validate) }, + { HP_POP(quest->questinfo_validate_job, HP_quest_questinfo_validate_job) }, + { HP_POP(quest->questinfo_validate_sex, HP_quest_questinfo_validate_sex) }, + { HP_POP(quest->questinfo_validate_baselevel, HP_quest_questinfo_validate_baselevel) }, + { HP_POP(quest->questinfo_validate_joblevel, HP_quest_questinfo_validate_joblevel) }, + { HP_POP(quest->questinfo_validate_items, HP_quest_questinfo_validate_items) }, + { HP_POP(quest->questinfo_validate_homunculus_level, HP_quest_questinfo_validate_homunculus_level) }, + { HP_POP(quest->questinfo_validate_homunculus_type, HP_quest_questinfo_validate_homunculus_type) }, + { HP_POP(quest->questinfo_validate_quests, HP_quest_questinfo_validate_quests) }, + { HP_POP(quest->questinfo_vector_clear, HP_quest_questinfo_vector_clear) }, /* rnd_interface */ { HP_POP(rnd->init, HP_rnd_init) }, { HP_POP(rnd->final, HP_rnd_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 7000d3536..ab60f701c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -3630,11 +3630,11 @@ void HP_buyingstore_trade(struct map_session_data *sd, int account_id, unsigned } return; } -bool HP_buyingstore_search(struct map_session_data *sd, unsigned short nameid) { +bool HP_buyingstore_search(struct map_session_data *sd, int nameid) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_buyingstore_search_pre > 0) { - bool (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid); + bool (*preHookFunc) (struct map_session_data **sd, int *nameid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_buyingstore_search_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_buyingstore_search_pre[hIndex].func; @@ -3649,7 +3649,7 @@ bool HP_buyingstore_search(struct map_session_data *sd, unsigned short nameid) { retVal___ = HPMHooks.source.buyingstore.search(sd, nameid); } if (HPMHooks.count.HP_buyingstore_search_post > 0) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned short nameid); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int nameid); for (hIndex = 0; hIndex < HPMHooks.count.HP_buyingstore_search_post; hIndex++) { postHookFunc = HPMHooks.list.HP_buyingstore_search_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, nameid); @@ -8250,10 +8250,10 @@ void HP_clif_cashShopSchedule(int fd, struct map_session_data *sd) { } return; } -void HP_clif_package_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { +void HP_clif_package_announce(struct map_session_data *sd, int nameid, int containerid) { int hIndex = 0; if (HPMHooks.count.HP_clif_package_announce_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid, unsigned short *containerid); + void (*preHookFunc) (struct map_session_data **sd, int *nameid, int *containerid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_package_announce_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_package_announce_pre[hIndex].func; @@ -8268,7 +8268,7 @@ void HP_clif_package_announce(struct map_session_data *sd, unsigned short nameid HPMHooks.source.clif.package_announce(sd, nameid, containerid); } if (HPMHooks.count.HP_clif_package_announce_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned short nameid, unsigned short containerid); + void (*postHookFunc) (struct map_session_data *sd, int nameid, int containerid); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_package_announce_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_package_announce_post[hIndex].func; postHookFunc(sd, nameid, containerid); @@ -8276,10 +8276,10 @@ void HP_clif_package_announce(struct map_session_data *sd, unsigned short nameid } return; } -void HP_clif_item_drop_announce(struct map_session_data *sd, unsigned short nameid, char *monsterName) { +void HP_clif_item_drop_announce(struct map_session_data *sd, int nameid, char *monsterName) { int hIndex = 0; if (HPMHooks.count.HP_clif_item_drop_announce_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid, char **monsterName); + void (*preHookFunc) (struct map_session_data **sd, int *nameid, char **monsterName); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_item_drop_announce_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_item_drop_announce_pre[hIndex].func; @@ -8294,7 +8294,7 @@ void HP_clif_item_drop_announce(struct map_session_data *sd, unsigned short name HPMHooks.source.clif.item_drop_announce(sd, nameid, monsterName); } if (HPMHooks.count.HP_clif_item_drop_announce_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned short nameid, char *monsterName); + void (*postHookFunc) (struct map_session_data *sd, int nameid, char *monsterName); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_item_drop_announce_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_item_drop_announce_post[hIndex].func; postHookFunc(sd, nameid, monsterName); @@ -11065,10 +11065,10 @@ void HP_clif_upgrademessage(int fd, int result, int item_id) { } return; } -void HP_clif_get_weapon_view(struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand) { +void HP_clif_get_weapon_view(struct map_session_data *sd, int *rhand, int *lhand) { int hIndex = 0; if (HPMHooks.count.HP_clif_get_weapon_view_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned short **rhand, unsigned short **lhand); + void (*preHookFunc) (struct map_session_data **sd, int **rhand, int **lhand); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_get_weapon_view_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_get_weapon_view_pre[hIndex].func; @@ -11083,7 +11083,7 @@ void HP_clif_get_weapon_view(struct map_session_data *sd, unsigned short *rhand, HPMHooks.source.clif.get_weapon_view(sd, rhand, lhand); } if (HPMHooks.count.HP_clif_get_weapon_view_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned short *rhand, unsigned short *lhand); + void (*postHookFunc) (struct map_session_data *sd, int *rhand, int *lhand); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_get_weapon_view_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_get_weapon_view_post[hIndex].func; postHookFunc(sd, rhand, lhand); @@ -18157,10 +18157,10 @@ void HP_clif_buyingstore_trade_failed_buyer(struct map_session_data *sd, short r } return; } -void HP_clif_buyingstore_update_item(struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) { +void HP_clif_buyingstore_update_item(struct map_session_data *sd, int nameid, unsigned short amount, uint32 char_id, int zeny) { int hIndex = 0; if (HPMHooks.count.HP_clif_buyingstore_update_item_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid, unsigned short *amount, uint32 *char_id, int *zeny); + void (*preHookFunc) (struct map_session_data **sd, int *nameid, unsigned short *amount, uint32 *char_id, int *zeny); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_buyingstore_update_item_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_buyingstore_update_item_pre[hIndex].func; @@ -18175,7 +18175,7 @@ void HP_clif_buyingstore_update_item(struct map_session_data *sd, unsigned short HPMHooks.source.clif.buyingstore_update_item(sd, nameid, amount, char_id, zeny); } if (HPMHooks.count.HP_clif_buyingstore_update_item_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny); + void (*postHookFunc) (struct map_session_data *sd, int nameid, unsigned short amount, uint32 char_id, int zeny); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_buyingstore_update_item_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_buyingstore_update_item_post[hIndex].func; postHookFunc(sd, nameid, amount, char_id, zeny); @@ -18209,10 +18209,10 @@ void HP_clif_buyingstore_delete_item(struct map_session_data *sd, short index, u } return; } -void HP_clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, unsigned short nameid) { +void HP_clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short result, int nameid) { int hIndex = 0; if (HPMHooks.count.HP_clif_buyingstore_trade_failed_seller_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, short *result, unsigned short *nameid); + void (*preHookFunc) (struct map_session_data **sd, short *result, int *nameid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_buyingstore_trade_failed_seller_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_buyingstore_trade_failed_seller_pre[hIndex].func; @@ -18227,7 +18227,7 @@ void HP_clif_buyingstore_trade_failed_seller(struct map_session_data *sd, short HPMHooks.source.clif.buyingstore_trade_failed_seller(sd, result, nameid); } if (HPMHooks.count.HP_clif_buyingstore_trade_failed_seller_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, short result, unsigned short nameid); + void (*postHookFunc) (struct map_session_data *sd, short result, int nameid); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_buyingstore_trade_failed_seller_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_buyingstore_trade_failed_seller_post[hIndex].func; postHookFunc(sd, result, nameid); @@ -19045,10 +19045,10 @@ bool HP_clif_parse_roulette_db(void) { } return retVal___; } -void HP_clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID) { +void HP_clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID) { int hIndex = 0; if (HPMHooks.count.HP_clif_roulette_generate_ack_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned char *result, short *stage, short *prizeIdx, short *bonusItemID); + void (*preHookFunc) (struct map_session_data **sd, unsigned char *result, short *stage, short *prizeIdx, int *bonusItemID); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_roulette_generate_ack_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_roulette_generate_ack_pre[hIndex].func; @@ -19063,7 +19063,7 @@ void HP_clif_roulette_generate_ack(struct map_session_data *sd, unsigned char re HPMHooks.source.clif.roulette_generate_ack(sd, result, stage, prizeIdx, bonusItemID); } if (HPMHooks.count.HP_clif_roulette_generate_ack_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID); + void (*postHookFunc) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_roulette_generate_ack_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_roulette_generate_ack_post[hIndex].func; postHookFunc(sd, result, stage, prizeIdx, bonusItemID); @@ -26675,10 +26675,10 @@ bool HP_clif_style_change_validate_requirements(struct map_session_data *sd, int } return retVal___; } -void HP_clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) { +void HP_clif_stylist_send_rodexitem(struct map_session_data *sd, int itemid) { int hIndex = 0; if (HPMHooks.count.HP_clif_stylist_send_rodexitem_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, int16 *itemid); + void (*preHookFunc) (struct map_session_data **sd, int *itemid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_send_rodexitem_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_stylist_send_rodexitem_pre[hIndex].func; @@ -26693,7 +26693,7 @@ void HP_clif_stylist_send_rodexitem(struct map_session_data *sd, int16 itemid) { HPMHooks.source.clif.stylist_send_rodexitem(sd, itemid); } if (HPMHooks.count.HP_clif_stylist_send_rodexitem_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, int16 itemid); + void (*postHookFunc) (struct map_session_data *sd, int itemid); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_stylist_send_rodexitem_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_stylist_send_rodexitem_post[hIndex].func; postHookFunc(sd, itemid); @@ -33553,11 +33553,11 @@ int HP_intif_parse(int fd) { } return retVal___; } -int HP_intif_create_pet(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) { +int HP_intif_create_pet(int account_id, int char_id, short pet_type, short pet_lv, int pet_egg_id, int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_intif_create_pet_pre > 0) { - int (*preHookFunc) (int *account_id, int *char_id, short *pet_type, short *pet_lv, short *pet_egg_id, short *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, char **pet_name); + int (*preHookFunc) (int *account_id, int *char_id, short *pet_type, short *pet_lv, int *pet_egg_id, int *pet_equip, short *intimate, short *hungry, char *rename_flag, char *incubate, char **pet_name); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_intif_create_pet_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_intif_create_pet_pre[hIndex].func; @@ -33572,7 +33572,7 @@ int HP_intif_create_pet(int account_id, int char_id, short pet_type, short pet_l retVal___ = HPMHooks.source.intif.create_pet(account_id, char_id, pet_type, pet_lv, pet_egg_id, pet_equip, intimate, hungry, rename_flag, incubate, pet_name); } if (HPMHooks.count.HP_intif_create_pet_post > 0) { - int (*postHookFunc) (int retVal___, int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id, short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); + int (*postHookFunc) (int retVal___, int account_id, int char_id, short pet_type, short pet_lv, int pet_egg_id, int pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name); for (hIndex = 0; hIndex < HPMHooks.count.HP_intif_create_pet_post; hIndex++) { postHookFunc = HPMHooks.list.HP_intif_create_pet_post[hIndex].func; retVal___ = postHookFunc(retVal___, account_id, char_id, pet_type, pet_lv, pet_egg_id, pet_equip, intimate, hungry, rename_flag, incubate, pet_name); @@ -39554,11 +39554,11 @@ void HP_itemdb_clear(bool total) { } return; } -struct item_combo* HP_itemdb_id2combo(unsigned short id) { +struct item_combo* HP_itemdb_id2combo(int id) { int hIndex = 0; struct item_combo* retVal___ = NULL; if (HPMHooks.count.HP_itemdb_id2combo_pre > 0) { - struct item_combo* (*preHookFunc) (unsigned short *id); + struct item_combo* (*preHookFunc) (int *id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_id2combo_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_itemdb_id2combo_pre[hIndex].func; @@ -39573,7 +39573,7 @@ struct item_combo* HP_itemdb_id2combo(unsigned short id) { retVal___ = HPMHooks.source.itemdb.id2combo(id); } if (HPMHooks.count.HP_itemdb_id2combo_post > 0) { - struct item_combo* (*postHookFunc) (struct item_combo* retVal___, unsigned short id); + struct item_combo* (*postHookFunc) (struct item_combo* retVal___, int id); for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_id2combo_post; hIndex++) { postHookFunc = HPMHooks.list.HP_itemdb_id2combo_post[hIndex].func; retVal___ = postHookFunc(retVal___, id); @@ -45640,11 +45640,11 @@ bool HP_map_zone_mf_cache(int m, char *flag, char *params) { } return retVal___; } -unsigned short HP_map_zone_str2itemid(const char *name) { +int HP_map_zone_str2itemid(const char *name) { int hIndex = 0; - unsigned short retVal___ = 0; + int retVal___ = 0; if (HPMHooks.count.HP_map_zone_str2itemid_pre > 0) { - unsigned short (*preHookFunc) (const char **name); + int (*preHookFunc) (const char **name); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_map_zone_str2itemid_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_map_zone_str2itemid_pre[hIndex].func; @@ -45659,7 +45659,7 @@ unsigned short HP_map_zone_str2itemid(const char *name) { retVal___ = HPMHooks.source.map.zone_str2itemid(name); } if (HPMHooks.count.HP_map_zone_str2itemid_post > 0) { - unsigned short (*postHookFunc) (unsigned short retVal___, const char *name); + int (*postHookFunc) (int retVal___, const char *name); for (hIndex = 0; hIndex < HPMHooks.count.HP_map_zone_str2itemid_post; hIndex++) { postHookFunc = HPMHooks.list.HP_map_zone_str2itemid_post[hIndex].func; retVal___ = postHookFunc(retVal___, name); @@ -50399,6 +50399,92 @@ void HP_mob_clear_spawninfo(void) { } return; } +struct item_drop_ratio* HP_mob_get_item_drop_ratio(int nameid) { + int hIndex = 0; + struct item_drop_ratio* retVal___ = NULL; + if (HPMHooks.count.HP_mob_get_item_drop_ratio_pre > 0) { + struct item_drop_ratio* (*preHookFunc) (int *nameid); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_get_item_drop_ratio_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mob_get_item_drop_ratio_pre[hIndex].func; + retVal___ = preHookFunc(&nameid); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.mob.get_item_drop_ratio(nameid); + } + if (HPMHooks.count.HP_mob_get_item_drop_ratio_post > 0) { + struct item_drop_ratio* (*postHookFunc) (struct item_drop_ratio* retVal___, int nameid); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_get_item_drop_ratio_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mob_get_item_drop_ratio_post[hIndex].func; + retVal___ = postHookFunc(retVal___, nameid); + } + } + return retVal___; +} +void HP_mob_set_item_drop_ratio(int nameid, struct item_drop_ratio *ratio) { + int hIndex = 0; + if (HPMHooks.count.HP_mob_set_item_drop_ratio_pre > 0) { + void (*preHookFunc) (int *nameid, struct item_drop_ratio **ratio); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_set_item_drop_ratio_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_mob_set_item_drop_ratio_pre[hIndex].func; + preHookFunc(&nameid, &ratio); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.mob.set_item_drop_ratio(nameid, ratio); + } + if (HPMHooks.count.HP_mob_set_item_drop_ratio_post > 0) { + void (*postHookFunc) (int nameid, struct item_drop_ratio *ratio); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_set_item_drop_ratio_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_mob_set_item_drop_ratio_post[hIndex].func; + postHookFunc(nameid, ratio); + } + } + return; +} +int HP_mob_final_ratio_sub(union DBKey key, struct DBData *data, va_list ap) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_mob_final_ratio_sub_pre > 0) { + int (*preHookFunc) (union DBKey *key, struct DBData **data, va_list ap); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_final_ratio_sub_pre; hIndex++) { + va_list ap___copy; va_copy(ap___copy, ap); + preHookFunc = HPMHooks.list.HP_mob_final_ratio_sub_pre[hIndex].func; + retVal___ = preHookFunc(&key, &data, ap___copy); + va_end(ap___copy); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + va_list ap___copy; va_copy(ap___copy, ap); + retVal___ = HPMHooks.source.mob.final_ratio_sub(key, data, ap___copy); + va_end(ap___copy); + } + if (HPMHooks.count.HP_mob_final_ratio_sub_post > 0) { + int (*postHookFunc) (int retVal___, union DBKey key, struct DBData *data, va_list ap); + for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_final_ratio_sub_post; hIndex++) { + va_list ap___copy; va_copy(ap___copy, ap); + postHookFunc = HPMHooks.list.HP_mob_final_ratio_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, key, data, ap___copy); + va_end(ap___copy); + } + } + return retVal___; +} void HP_mob_destroy_mob_db(int index) { int hIndex = 0; if (HPMHooks.count.HP_mob_destroy_mob_db_pre > 0) { @@ -60889,11 +60975,11 @@ void HP_pc_check_skilltree(struct map_session_data *sd, int skill_id) { } return; } -int HP_pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id) { +int HP_pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_bonus_autospell_pre > 0) { - int (*preHookFunc) (struct s_autospell **spell, int *max, short *id, short *lv, short *rate, short *flag, short *card_id); + int (*preHookFunc) (struct s_autospell **spell, int *max, short *id, short *lv, short *rate, short *flag, int *card_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_autospell_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_bonus_autospell_pre[hIndex].func; @@ -60908,7 +60994,7 @@ int HP_pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv retVal___ = HPMHooks.source.pc.bonus_autospell(spell, max, id, lv, rate, flag, card_id); } if (HPMHooks.count.HP_pc_bonus_autospell_post > 0) { - int (*postHookFunc) (int retVal___, struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id); + int (*postHookFunc) (int retVal___, struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_autospell_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_bonus_autospell_post[hIndex].func; retVal___ = postHookFunc(retVal___, spell, max, id, lv, rate, flag, card_id); @@ -60916,11 +61002,11 @@ int HP_pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv } return retVal___; } -int HP_pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id) { +int HP_pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_bonus_autospell_onskill_pre > 0) { - int (*preHookFunc) (struct s_autospell **spell, int *max, short *src_skill, short *id, short *lv, short *rate, short *card_id); + int (*preHookFunc) (struct s_autospell **spell, int *max, short *src_skill, short *id, short *lv, short *rate, int *card_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_autospell_onskill_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_bonus_autospell_onskill_pre[hIndex].func; @@ -60935,7 +61021,7 @@ int HP_pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_ retVal___ = HPMHooks.source.pc.bonus_autospell_onskill(spell, max, src_skill, id, lv, rate, card_id); } if (HPMHooks.count.HP_pc_bonus_autospell_onskill_post > 0) { - int (*postHookFunc) (int retVal___, struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id); + int (*postHookFunc) (int retVal___, struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_autospell_onskill_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_bonus_autospell_onskill_post[hIndex].func; retVal___ = postHookFunc(retVal___, spell, max, src_skill, id, lv, rate, card_id); @@ -62944,11 +63030,11 @@ int HP_pet_recv_petdata(int account_id, struct s_pet *p, int flag) { } return retVal___; } -int HP_pet_select_egg(struct map_session_data *sd, short egg_index) { +int HP_pet_select_egg(struct map_session_data *sd, int egg_index) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pet_select_egg_pre > 0) { - int (*preHookFunc) (struct map_session_data **sd, short *egg_index); + int (*preHookFunc) (struct map_session_data **sd, int *egg_index); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pet_select_egg_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pet_select_egg_pre[hIndex].func; @@ -62963,7 +63049,7 @@ int HP_pet_select_egg(struct map_session_data *sd, short egg_index) { retVal___ = HPMHooks.source.pet.select_egg(sd, egg_index); } if (HPMHooks.count.HP_pet_select_egg_post > 0) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, short egg_index); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, int egg_index); for (hIndex = 0; hIndex < HPMHooks.count.HP_pet_select_egg_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pet_select_egg_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, egg_index); @@ -64062,6 +64148,328 @@ struct quest_db* HP_quest_read_db_sub(struct config_setting_t *cs, int n, const } return retVal___; } +int HP_quest_questinfo_validate_icon(int icon) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_quest_questinfo_validate_icon_pre > 0) { + int (*preHookFunc) (int *icon); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_icon_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_icon_pre[hIndex].func; + retVal___ = preHookFunc(&icon); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_icon(icon); + } + if (HPMHooks.count.HP_quest_questinfo_validate_icon_post > 0) { + int (*postHookFunc) (int retVal___, int icon); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_icon_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_icon_post[hIndex].func; + retVal___ = postHookFunc(retVal___, icon); + } + } + return retVal___; +} +void HP_quest_questinfo_refresh(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_quest_questinfo_refresh_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_refresh_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_refresh_pre[hIndex].func; + preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.quest.questinfo_refresh(sd); + } + if (HPMHooks.count.HP_quest_questinfo_refresh_post > 0) { + void (*postHookFunc) (struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_refresh_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_refresh_post[hIndex].func; + postHookFunc(sd); + } + } + return; +} +bool HP_quest_questinfo_validate(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_job(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_job_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_job_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_job_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_job(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_job_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_job_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_job_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_sex(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_sex_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_sex_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_sex_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_sex(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_sex_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_sex_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_sex_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_baselevel(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_baselevel_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_baselevel_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_baselevel_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_baselevel(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_baselevel_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_baselevel_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_baselevel_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_joblevel(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_joblevel_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_joblevel_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_joblevel_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_joblevel(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_joblevel_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_joblevel_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_joblevel_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_items(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_items_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_items_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_items_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_items(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_items_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_items_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_items_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_homunculus_level(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_homunculus_level_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_homunculus_level_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_homunculus_level_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_homunculus_level(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_homunculus_level_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_homunculus_level_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_homunculus_level_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_homunculus_type(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_homunculus_type_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_homunculus_type_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_homunculus_type_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_homunculus_type(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_homunculus_type_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_homunculus_type_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_homunculus_type_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +bool HP_quest_questinfo_validate_quests(struct map_session_data *sd, struct questinfo *qi) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_quest_questinfo_validate_quests_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, struct questinfo **qi); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_quests_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_validate_quests_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &qi); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.quest.questinfo_validate_quests(sd, qi); + } + if (HPMHooks.count.HP_quest_questinfo_validate_quests_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, struct questinfo *qi); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_validate_quests_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_validate_quests_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, qi); + } + } + return retVal___; +} +void HP_quest_questinfo_vector_clear(int m) { + int hIndex = 0; + if (HPMHooks.count.HP_quest_questinfo_vector_clear_pre > 0) { + void (*preHookFunc) (int *m); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_vector_clear_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_quest_questinfo_vector_clear_pre[hIndex].func; + preHookFunc(&m); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.quest.questinfo_vector_clear(m); + } + if (HPMHooks.count.HP_quest_questinfo_vector_clear_post > 0) { + void (*postHookFunc) (int m); + for (hIndex = 0; hIndex < HPMHooks.count.HP_quest_questinfo_vector_clear_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_quest_questinfo_vector_clear_post[hIndex].func; + postHookFunc(m); + } + } + return; +} /* rnd_interface */ void HP_rnd_init(void) { int hIndex = 0; @@ -67306,14 +67714,14 @@ const char* HP_script_parse_line(const char *p) { } return retVal___; } -void HP_script_read_constdb(void) { +void HP_script_read_constdb(bool reload) { int hIndex = 0; if (HPMHooks.count.HP_script_read_constdb_pre > 0) { - void (*preHookFunc) (void); + void (*preHookFunc) (bool *reload); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_script_read_constdb_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_script_read_constdb_pre[hIndex].func; - preHookFunc(); + preHookFunc(&reload); } if (*HPMforce_return) { *HPMforce_return = false; @@ -67321,13 +67729,13 @@ void HP_script_read_constdb(void) { } } { - HPMHooks.source.script.read_constdb(); + HPMHooks.source.script.read_constdb(reload); } if (HPMHooks.count.HP_script_read_constdb_post > 0) { - void (*postHookFunc) (void); + void (*postHookFunc) (bool reload); for (hIndex = 0; hIndex < HPMHooks.count.HP_script_read_constdb_post; hIndex++) { postHookFunc = HPMHooks.list.HP_script_read_constdb_post[hIndex].func; - postHookFunc(); + postHookFunc(reload); } } return; @@ -69906,10 +70314,10 @@ void HP_searchstore_close(struct map_session_data *sd) { } return; } -void HP_searchstore_click(struct map_session_data *sd, int account_id, int store_id, unsigned short nameid) { +void HP_searchstore_click(struct map_session_data *sd, int account_id, int store_id, int nameid) { int hIndex = 0; if (HPMHooks.count.HP_searchstore_click_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, int *account_id, int *store_id, unsigned short *nameid); + void (*preHookFunc) (struct map_session_data **sd, int *account_id, int *store_id, int *nameid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_click_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_searchstore_click_pre[hIndex].func; @@ -69924,7 +70332,7 @@ void HP_searchstore_click(struct map_session_data *sd, int account_id, int store HPMHooks.source.searchstore.click(sd, account_id, store_id, nameid); } if (HPMHooks.count.HP_searchstore_click_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, int account_id, int store_id, unsigned short nameid); + void (*postHookFunc) (struct map_session_data *sd, int account_id, int store_id, int nameid); for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_click_post; hIndex++) { postHookFunc = HPMHooks.list.HP_searchstore_click_post[hIndex].func; postHookFunc(sd, account_id, store_id, nameid); @@ -69985,11 +70393,11 @@ void HP_searchstore_clearremote(struct map_session_data *sd) { } return; } -bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short *card, unsigned char refine, const struct item_option *option) { +bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_searchstore_result_pre > 0) { - bool (*preHookFunc) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, unsigned short *nameid, unsigned short *amount, unsigned int *price, const short **card, unsigned char *refine, const struct item_option **option); + bool (*preHookFunc) (struct map_session_data **sd, unsigned int *store_id, int *account_id, const char **store_name, int *nameid, unsigned short *amount, unsigned int *price, const int **card, unsigned char *refine, const struct item_option **option); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_result_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_searchstore_result_pre[hIndex].func; @@ -70004,7 +70412,7 @@ bool HP_searchstore_result(struct map_session_data *sd, unsigned int store_id, i retVal___ = HPMHooks.source.searchstore.result(sd, store_id, account_id, store_name, nameid, amount, price, card, refine, option); } if (HPMHooks.count.HP_searchstore_result_post > 0) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short *card, unsigned char refine, const struct item_option *option); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned int store_id, int account_id, const char *store_name, int nameid, unsigned short amount, unsigned int price, const int *card, unsigned char refine, const struct item_option *option); for (hIndex = 0; hIndex < HPMHooks.count.HP_searchstore_result_post; hIndex++) { postHookFunc = HPMHooks.list.HP_searchstore_result_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, store_id, account_id, store_name, nameid, amount, price, card, refine, option); @@ -85840,11 +86248,11 @@ void HP_vending_purchase(struct map_session_data *sd, int aid, unsigned int uid, } return; } -bool HP_vending_search(struct map_session_data *sd, unsigned short nameid) { +bool HP_vending_search(struct map_session_data *sd, int nameid) { int hIndex = 0; bool retVal___ = false; if (HPMHooks.count.HP_vending_search_pre > 0) { - bool (*preHookFunc) (struct map_session_data **sd, unsigned short *nameid); + bool (*preHookFunc) (struct map_session_data **sd, int *nameid); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_vending_search_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_vending_search_pre[hIndex].func; @@ -85859,7 +86267,7 @@ bool HP_vending_search(struct map_session_data *sd, unsigned short nameid) { retVal___ = HPMHooks.source.vending.search(sd, nameid); } if (HPMHooks.count.HP_vending_search_post > 0) { - bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, unsigned short nameid); + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int nameid); for (hIndex = 0; hIndex < HPMHooks.count.HP_vending_search_post; hIndex++) { postHookFunc = HPMHooks.list.HP_vending_search_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, nameid); diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index ef3f1124b..e90a04f8b 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -1,7 +1,7 @@ # This file is part of Hercules. # http://herc.ws - http://github.com/HerculesWS/Hercules # -# Copyright (C) 2013-2016 Hercules Dev Team +# Copyright (C) 2013-2018 Hercules Dev Team # # Hercules is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/plugins/constdb2doc.c b/src/plugins/constdb2doc.c index d211c46e2..3f681ea1a 100644 --- a/src/plugins/constdb2doc.c +++ b/src/plugins/constdb2doc.c @@ -86,7 +86,7 @@ void constdb2doc_constdb(void) /* Run */ fprintf(out_fp, "## Constants (db/constants.conf)\n\n"); - script->read_constdb(); + script->read_constdb(false); fprintf(out_fp, "\n"); fprintf(out_fp, "## Hardcoded Constants (source)\n\n"); diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 38e5ead5d..57e68432e 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -242,7 +242,7 @@ int itemdb2sql_sub(struct config_setting_t *entry, int n, const char *source) StrBuf->Init(&buf); // id - StrBuf->Printf(&buf, "'%u',", it->nameid); + StrBuf->Printf(&buf, "'%u',", (uint32)it->nameid); // name_english SQL->EscapeString(NULL, e_name, it->name); @@ -449,7 +449,7 @@ void itemdb2sql_tableheader(void) "\n" "DROP TABLE IF EXISTS `%s`;\n" "CREATE TABLE `%s` (\n" - " `id` smallint(5) UNSIGNED NOT NULL DEFAULT '0',\n" + " `id` int(11) UNSIGNED NOT NULL DEFAULT '0',\n" " `name_english` varchar(50) NOT NULL DEFAULT '',\n" " `name_japanese` varchar(50) NOT NULL DEFAULT '',\n" " `type` tinyint(2) UNSIGNED NOT NULL DEFAULT '0',\n" diff --git a/src/plugins/script_mapquit.c b/src/plugins/script_mapquit.c index 767292f2d..b212ce1c6 100644 --- a/src/plugins/script_mapquit.c +++ b/src/plugins/script_mapquit.c @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2014-2015 Hercules Dev Team + * Copyright (C) 2014-2018 Hercules Dev Team * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |