diff options
43 files changed, 594 insertions, 359 deletions
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/mmo.h b/src/common/mmo.h index 4a79245a1..fa8f3048d 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]; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2d17f7ae7..79bd92213 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. 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 c4a401fa7..e15a65902 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -939,7 +939,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); @@ -14022,7 +14022,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 +17862,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 +17913,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 +18509,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 +19038,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 +19056,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 +19700,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 +19757,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 +19843,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 +20643,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 +21249,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..47b2c8f46 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -618,7 +618,7 @@ struct s_packet_db { }; struct hCSData { - unsigned short id; + int id; unsigned int price; }; @@ -629,7 +629,7 @@ struct cdelayed_damage { struct merge_item { int16 position; - int16 nameid; + int nameid; }; /* attendance data */ @@ -642,8 +642,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 +729,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 +843,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 +1141,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 +1186,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 +1500,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/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..8ea059700 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5455,13 +5455,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 +5479,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 { diff --git a/src/map/map.h b/src/map/map.h index 494f93cfe..e346e72ba 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -714,7 +714,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 +724,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; @@ -1342,7 +1342,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 27c099a9e..d9160ed3f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -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 cd49a6dbf..d9e41fde2 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; diff --git a/src/map/pc.h b/src/map/pc.h index f998c799d..622dcf3f7 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..e544905c0 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; @@ -516,7 +516,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 +555,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 +1335,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 +1343,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 +1351,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 +1359,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/script.c b/src/map/script.c index 9adf6b44d..e678a7738 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7701,10 +7701,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 +8037,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 +8079,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 +8371,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 +8619,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 @@ -10728,7 +10728,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 +16457,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 +16513,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 && diff --git a/src/map/script.h b/src/map/script.h index a0cfb7692..4ad9531b7 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; 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..ed69b8c0f 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. @@ -19917,7 +19917,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/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index af1d1acd3..3bc6956ae 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); @@ -6688,14 +6694,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 +7898,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..1a689494f 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; @@ -10189,6 +10195,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; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 55ac7d531..01e5e166b 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) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 7000d3536..d2d3c515a 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); @@ -69906,10 +69992,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 +70010,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 +70071,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 +70090,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 +85926,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 +85945,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/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" |