diff options
Diffstat (limited to 'src')
36 files changed, 1864 insertions, 900 deletions
diff --git a/src/char/char.c b/src/char/char.c index 78b2d19fa..9bef2941d 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -600,7 +600,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p) StrBuf->Clear(&buf); StrBuf->Printf(&buf, "INSERT INTO `%s`(`char_id`,`id`,`lv`,`flag`) VALUES ", skill_db); //insert here. - for( i = 0, count = 0; i < MAX_SKILL; ++i ) { + for (i = 0, count = 0; i < MAX_SKILL_DB; ++i) { if( p->skill[i].id != 0 && p->skill[i].flag != SKILL_FLAG_TEMPORARY ) { if( p->skill[i].lv == 0 && ( p->skill[i].flag == SKILL_FLAG_PERM_GRANTED || p->skill[i].flag == SKILL_FLAG_PERMANENT ) ) continue; @@ -755,7 +755,7 @@ int char_getitemdata_from_sql(struct item *items, int max, int guid, enum invent stmt = SQL->StmtMalloc(inter->sql_handle); if (SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &guid, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &guid, sizeof guid) || SQL_ERROR == SQL->StmtExecute(stmt)) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); @@ -763,32 +763,35 @@ int char_getitemdata_from_sql(struct item *items, int max, int guid, enum invent return -1; } - if (SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_UINT, &item.equip, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, NULL, NULL)) - { + 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, 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) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, sizeof item.refine, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, sizeof item.attribute, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, sizeof item.expire_time, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, sizeof item.bound, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, sizeof item.unique_id, NULL, NULL) + ) { SqlStmt_ShowDebug(stmt); } - for (i = 0; i < MAX_SLOTS; i++) - if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + i, SQLDT_SHORT, &item.card[i], 0, NULL, NULL)) + 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)) SqlStmt_ShowDebug(stmt); + } - for (i = 0; i < MAX_ITEM_OPTIONS; i++) - if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + MAX_SLOTS + i * 2, SQLDT_INT16, &item.option[i].index, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 11 + MAX_SLOTS + i * 2, SQLDT_INT16, &item.option[i].value, 0, NULL, NULL)) + for (i = 0; i < MAX_ITEM_OPTIONS; i++) { + if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + MAX_SLOTS + i * 2, SQLDT_INT16, &item.option[i].index, sizeof item.option[i].index, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 11 + MAX_SLOTS + i * 2, SQLDT_INT16, &item.option[i].value, sizeof item.option[i].index, NULL, NULL)) SqlStmt_ShowDebug(stmt); + } - if (has_favorite) - if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + MAX_SLOTS + MAX_ITEM_OPTIONS * 2, SQLDT_UCHAR, &item.favorite, 0, NULL, NULL)) + if (has_favorite) { + if (SQL_ERROR == SQL->StmtBindColumn(stmt, 10 + MAX_SLOTS + MAX_ITEM_OPTIONS * 2, SQLDT_CHAR, &item.favorite, sizeof item.favorite, NULL, NULL)) SqlStmt_ShowDebug(stmt); + } if (SQL->StmtNumRows(stmt) > 0 ) { i = 0; @@ -1066,46 +1069,46 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf) "`robe`,`slotchange`,`unban_time`,`sex`" " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, MAX_CHARS) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p.job_exp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p.status_point, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 20, SQLDT_INT, &p.skill_point, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p.hair, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 25, SQLDT_SHORT, &p.hair_color, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_SHORT, &p.clothes_color, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_SHORT, &p.body, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_SHORT, &p.look.weapon, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_SHORT, &p.look.shield, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p.look.head_top, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p.look.head_mid, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p.look.head_bottom, 0, 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, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_UINT32, &p.delete_date, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p.look.robe, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_USHORT, &p.slotchange, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_LONG, &unban_time, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof(sex), NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, sizeof p.char_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, sizeof p.slot, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof p.name, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_INT16, &p.class, sizeof p.class, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, sizeof p.base_level, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, sizeof p.job_level, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT64, &p.base_exp, sizeof p.base_exp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p.job_exp, sizeof p.job_exp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &p.zeny, sizeof p.zeny, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_SHORT, &p.str, sizeof p.str, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p.agi, sizeof p.agi, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p.vit, sizeof p.vit, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p.int_, sizeof p.int_, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p.dex, sizeof p.dex, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p.luk, sizeof p.luk, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 15, SQLDT_INT, &p.max_hp, sizeof p.max_hp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p.hp, sizeof p.hp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p.max_sp, sizeof p.max_sp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p.sp, sizeof p.sp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p.status_point, sizeof p.status_point, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 20, SQLDT_INT, &p.skill_point, sizeof p.skill_point, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 21, SQLDT_UINT, &p.option, sizeof p.option, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 22, SQLDT_UCHAR, &p.karma, sizeof p.karma, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 23, SQLDT_SHORT, &p.manner, sizeof p.manner, NULL, NULL) + || 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, 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, 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) ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); @@ -1172,67 +1175,67 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`" " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT64, &p->job_exp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 20, SQLDT_INT, &p->status_point, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 21, SQLDT_INT, &p->skill_point, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 30, SQLDT_SHORT, &p->hair, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 31, SQLDT_SHORT, &p->hair_color, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 32, SQLDT_SHORT, &p->clothes_color, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 33, SQLDT_SHORT, &p->body, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 34, SQLDT_SHORT, &p->look.weapon, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 35, SQLDT_SHORT, &p->look.shield, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 36, SQLDT_SHORT, &p->look.head_top, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 37, SQLDT_SHORT, &p->look.head_mid, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_SHORT, &p->look.head_bottom, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 39, SQLDT_STRING, &last_map, sizeof(last_map), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 40, SQLDT_SHORT, &p->last_point.x, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 41, SQLDT_SHORT, &p->last_point.y, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof(save_map), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 43, SQLDT_SHORT, &p->save_point.x, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 44, SQLDT_SHORT, &p->save_point.y, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 49, SQLDT_INT, &p->fame, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 50, SQLDT_USHORT, &p->rename, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 51, SQLDT_UINT32, &p->delete_date, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 52, SQLDT_SHORT, &p->look.robe, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 53, SQLDT_USHORT, &p->slotchange, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 54, SQLDT_UINT, &opt, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 55, SQLDT_UCHAR, &p->font, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT, &p->uniqueitem_counter, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof(sex), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->char_id, sizeof p->char_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, sizeof p->account_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, sizeof p->slot, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof p->name, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT16, &p->class, sizeof p->class, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, sizeof p->base_level, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, sizeof p->job_level, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT64, &p->base_exp, sizeof p->base_exp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_UINT64, &p->job_exp, sizeof p->job_exp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_INT, &p->zeny, sizeof p->zeny, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_SHORT, &p->str, sizeof p->str, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_SHORT, &p->agi, sizeof p->agi, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_SHORT, &p->vit, sizeof p->vit, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_SHORT, &p->int_, sizeof p->int_, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 14, SQLDT_SHORT, &p->dex, sizeof p->dex, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 15, SQLDT_SHORT, &p->luk, sizeof p->luk, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 16, SQLDT_INT, &p->max_hp, sizeof p->max_hp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 17, SQLDT_INT, &p->hp, sizeof p->hp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 18, SQLDT_INT, &p->max_sp, sizeof p->max_sp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 19, SQLDT_INT, &p->sp, sizeof p->sp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 20, SQLDT_INT, &p->status_point, sizeof p->status_point, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 21, SQLDT_INT, &p->skill_point, sizeof p->skill_point, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 22, SQLDT_UINT, &p->option, sizeof p->option, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 23, SQLDT_UCHAR, &p->karma, sizeof p->karma, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 24, SQLDT_SHORT, &p->manner, sizeof p->manner, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 25, SQLDT_INT, &p->party_id, sizeof p->party_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 26, SQLDT_INT, &p->guild_id, sizeof p->guild_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 27, SQLDT_INT, &p->pet_id, sizeof p->pet_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 28, SQLDT_INT, &p->hom_id, sizeof p->hom_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 29, SQLDT_INT, &p->ele_id, sizeof p->ele_id, NULL, NULL) + || 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, 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) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 42, SQLDT_STRING, &save_map, sizeof save_map, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 43, SQLDT_INT16, &p->save_point.x, sizeof p->save_point.x, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 44, SQLDT_INT16, &p->save_point.y, sizeof p->save_point.y, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 45, SQLDT_INT, &p->partner_id, sizeof p->partner_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 46, SQLDT_INT, &p->father, sizeof p->father, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 47, SQLDT_INT, &p->mother, sizeof p->mother, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 48, SQLDT_INT, &p->child, sizeof p->child, NULL, NULL) + || 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, 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) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 56, SQLDT_UINT32, &p->uniqueitem_counter, sizeof p->uniqueitem_counter, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 57, SQLDT_ENUM, &sex, sizeof sex, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 58, SQLDT_UCHAR, &p->hotkey_rowshift, sizeof p->hotkey_rowshift, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); @@ -1276,11 +1279,11 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every //`memo` (`memo_id`,`char_id`,`map`,`x`,`y`) memset(&tmp_point, 0, sizeof(tmp_point)); if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `map`,`x`,`y` FROM `%s` WHERE `char_id`=? ORDER by `memo_id` LIMIT %d", memo_db, MAX_MEMOPOINTS) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof(point_map), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &tmp_point.x, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &tmp_point.y, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &point_map, sizeof point_map, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT16, &tmp_point.x, sizeof tmp_point.x, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_INT16, &tmp_point.y, sizeof tmp_point.y, NULL, NULL) ) SqlStmt_ShowDebug(stmt); @@ -1301,12 +1304,12 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every //read skill //`skill` (`char_id`, `id`, `lv`) memset(&tmp_skill, 0, sizeof(tmp_skill)); - if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `id`, `lv`,`flag` FROM `%s` WHERE `char_id`=? LIMIT %d", skill_db, MAX_SKILL_DB) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id , 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR , &tmp_skill.lv , 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR , &tmp_skill.flag, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_USHORT, &tmp_skill.id, sizeof tmp_skill.id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_skill.lv, sizeof tmp_skill.lv, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &tmp_skill.flag, sizeof tmp_skill.flag, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); } @@ -1314,7 +1317,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every if( tmp_skill.flag != SKILL_FLAG_PERM_GRANTED ) tmp_skill.flag = SKILL_FLAG_PERMANENT; - for( i = 0; i < MAX_SKILL && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i ) { + for (i = 0; i < MAX_SKILL_DB && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) { if( skillid2idx[tmp_skill.id] ) memcpy(&p->skill[skillid2idx[tmp_skill.id]], &tmp_skill, sizeof(tmp_skill)); else @@ -1326,11 +1329,11 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every //`friends` (`char_id`, `friend_account`, `friend_id`) memset(&tmp_friend, 0, sizeof(tmp_friend)); if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT c.`account_id`, c.`char_id`, c.`name` FROM `%s` c LEFT JOIN `%s` f ON f.`friend_account` = c.`account_id` AND f.`friend_id` = c.`char_id` WHERE f.`char_id`=? LIMIT %d", char_db, friend_db, MAX_FRIENDS) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof(tmp_friend.name), NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_friend.account_id, sizeof tmp_friend.account_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_friend.char_id, sizeof tmp_friend.char_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &tmp_friend.name, sizeof tmp_friend.name, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); } @@ -1344,13 +1347,15 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every //`hotkey` (`char_id`, `hotkey`, `type`, `itemskill_id`, `skill_lvl` memset(&tmp_hotkey, 0, sizeof(tmp_hotkey)); if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `hotkey`, `type`, `itemskill_id`, `skill_lvl` FROM `%s` WHERE `char_id`=?", hotkey_db) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, 0, NULL, NULL) ) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &hotkey_num, sizeof hotkey_num, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &tmp_hotkey.type, sizeof tmp_hotkey.type, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_hotkey.id, sizeof tmp_hotkey.id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &tmp_hotkey.lv, sizeof tmp_hotkey.lv, NULL, NULL) + ) { SqlStmt_ShowDebug(stmt); + } while( SQL_SUCCESS == SQL->StmtNextRow(stmt) ) { @@ -1371,12 +1376,12 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every //`account_data` (`account_id`,`bank_vault`,`base_exp`,`base_drop`,`base_death`) if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `bank_vault`,`base_exp`,`base_drop`,`base_death` FROM `%s` WHERE `account_id`=? LIMIT 1", account_data_db) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &account_id, sizeof account_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p->bank_vault, sizeof p->bank_vault, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_USHORT, &p->mod_exp, sizeof p->mod_exp, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_USHORT, &p->mod_drop, sizeof p->mod_drop, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &p->mod_death, sizeof p->mod_death, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); } @@ -2439,13 +2444,13 @@ int char_parse_fromlogin_changesex_reply(int fd) stmt = SQL->StmtMalloc(inter->sql_handle); if (SQL_ERROR == SQL->StmtPrepare(stmt, "SELECT `char_id`,`class`,`guild_id` FROM `%s` WHERE `account_id` = '%d'", char_db, acc) || SQL_ERROR == SQL->StmtExecute(stmt) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, sizeof char_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class, sizeof class, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, sizeof guild_id, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); } - SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, NULL, NULL); for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) { char_change_sex_sub(sex, acc, char_id, class, guild_id); @@ -2979,8 +2984,8 @@ void char_parse_frommap_skillid2idx(int fd) if( j ) j /= 4; for(i = 0; i < j; i++) { - if( RFIFOW(fd, 4 + (i*4)) > MAX_SKILL_ID ) { - ShowWarning("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n",RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)),RFIFOW(fd, 4 + (i*4)),MAX_SKILL_ID); + if (RFIFOW(fd, 4 + (i*4)) >= MAX_SKILL_ID) { + ShowWarning("Error skillid2dx[%d] = %d failed, %d is higher than MAX_SKILL_ID (%d)\n", RFIFOW(fd, 4 + (i*4)), RFIFOW(fd, 6 + (i*4)), RFIFOW(fd, 4 + (i*4)), MAX_SKILL_ID); continue; } skillid2idx[RFIFOW(fd, 4 + (i*4))] = RFIFOW(fd, 6 + (i*4)); @@ -3375,8 +3380,8 @@ void char_ban(int account_id, int char_id, time_t *unban_time, short year, short if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "UPDATE `%s` SET `unban_time` = ? WHERE `char_id` = ? LIMIT 1", char_db) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_LONG, ×tamp, sizeof(timestamp)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof(char_id)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_TIME, ×tamp, sizeof timestamp) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_INT, &char_id, sizeof char_id) || SQL_SUCCESS != SQL->StmtExecute(stmt) ) { SqlStmt_ShowDebug(stmt); @@ -3385,7 +3390,7 @@ void char_ban(int account_id, int char_id, time_t *unban_time, short year, short SQL->StmtFree(stmt); // condition applies; send to all map-servers to disconnect the player - if( timestamp > time(NULL) ) { + if (timestamp > time(NULL)) { mapif->char_ban(char_id, timestamp); // disconnect player if online on char-server chr->disconnect_player(account_id); diff --git a/src/char/int_homun.c b/src/char/int_homun.c index 4f382cd3c..edf737992 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -171,9 +171,9 @@ bool mapif_homunculus_save(const struct s_homunculus *hd) } else { for (i = 0; i < MAX_HOMUNSKILL; ++i) { if (hd->hskill[i].id > 0 && hd->hskill[i].lv != 0) { - SQL->StmtBindParam(stmt, 0, SQLDT_USHORT, &hd->hskill[i].id, 0); - SQL->StmtBindParam(stmt, 1, SQLDT_USHORT, &hd->hskill[i].lv, 0); - if (SQL_ERROR == SQL->StmtExecute(stmt)) { + if (SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_USHORT, &hd->hskill[i].id, sizeof hd->hskill[i].id) + || SQL_ERROR == SQL->StmtBindParam(stmt, 1, SQLDT_UCHAR, &hd->hskill[i].lv, sizeof hd->hskill[i].lv) + || SQL_ERROR == SQL->StmtExecute(stmt)) { SqlStmt_ShowDebug(stmt); flag = false; break; diff --git a/src/char/int_quest.c b/src/char/int_quest.c index bd49cb7d4..9554be414 100644 --- a/src/char/int_quest.c +++ b/src/char/int_quest.c @@ -56,6 +56,7 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) StringBuf buf; int i; int sqlerror = SQL_SUCCESS; + int quest_state = 0; if (!count) return NULL; @@ -77,11 +78,11 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) memset(&tmp_quest, 0, sizeof(struct quest)); if (SQL_ERROR == SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf)) - || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, 0) + || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &tmp_quest.state, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_quest.time, 0, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &tmp_quest.quest_id, sizeof tmp_quest.quest_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &quest_state, sizeof quest_state, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UINT, &tmp_quest.time, sizeof tmp_quest.time, NULL, NULL) ) { sqlerror = SQL_ERROR; } @@ -89,7 +90,7 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) StrBuf->Destroy(&buf); for (i = 0; sqlerror != SQL_ERROR && i < MAX_QUEST_OBJECTIVES; i++) { // Stop on the first error - sqlerror = SQL->StmtBindColumn(stmt, 3+i, SQLDT_INT, &tmp_quest.count[i], 0, NULL, NULL); + sqlerror = SQL->StmtBindColumn(stmt, 3+i, SQLDT_INT, &tmp_quest.count[i], sizeof tmp_quest.count[i], NULL, NULL); } if (sqlerror == SQL_ERROR) { @@ -105,9 +106,10 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) questlog = (struct quest *)aCalloc(*count, sizeof(struct quest)); while (SQL_SUCCESS == SQL->StmtNextRow(stmt)) { + tmp_quest.state = quest_state; if (i >= *count) // Sanity check, should never happen break; - memcpy(&questlog[i++], &tmp_quest, sizeof(tmp_quest)); + questlog[i++] = tmp_quest; } if (i < *count) { // Should never happen. Compact array diff --git a/src/char/int_rodex.c b/src/char/int_rodex.c index 994e8110e..f5d036991 100644 --- a/src/char/int_rodex.c +++ b/src/char/int_rodex.c @@ -43,10 +43,9 @@ struct inter_rodex_interface *inter_rodex; // Loads new mails of this char_id/account_id static int inter_rodex_fromsql(int char_id, int account_id, int8 opentype, int64 mail_id, struct rodex_maillist *mails) { - int i, count = 0; + int count = 0; struct rodex_message msg = { 0 }; struct SqlStmt *stmt; - struct SqlStmt *stmt_items; nullpo_retr(-1, mails); @@ -108,112 +107,128 @@ static int inter_rodex_fromsql(int char_id, int account_id, int8 opentype, int64 } if (SQL_ERROR == SQL->StmtExecute(stmt) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT64, &msg.id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_STRING, &msg.sender_name, sizeof(msg.sender_name), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &msg.sender_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &msg.receiver_name, sizeof(msg.receiver_name), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &msg.receiver_id, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &msg.receiver_accountid, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_STRING, &msg.title, sizeof(msg.title), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_STRING, &msg.body, sizeof(msg.body), NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_INT, &msg.zeny, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT8, &msg.type, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_INT8, &msg.is_read, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_INT, &msg.send_date, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_INT, &msg.expire_date, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_INT, &msg.weight, 0, NULL, NULL) - ) { + || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT64, &msg.id, sizeof msg.id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_STRING, &msg.sender_name, sizeof msg.sender_name, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &msg.sender_id, sizeof msg.sender_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &msg.receiver_name, sizeof msg.receiver_name, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &msg.receiver_id, sizeof msg.receiver_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &msg.receiver_accountid, sizeof msg.receiver_accountid, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_STRING, &msg.title, sizeof msg.title, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_STRING, &msg.body, sizeof msg.body, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 8, SQLDT_INT64, &msg.zeny, sizeof msg.zeny, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 9, SQLDT_UINT8, &msg.type, sizeof msg.type, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 10, SQLDT_BOOL, &msg.is_read, sizeof msg.is_read, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 11, SQLDT_INT, &msg.send_date, sizeof msg.send_date, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 12, SQLDT_INT, &msg.expire_date, sizeof msg.expire_date, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 13, SQLDT_INT, &msg.weight, sizeof msg.weight, NULL, NULL) + ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); return -1; } - stmt_items = SQL->StmtMalloc(inter->sql_handle); - if (stmt_items == NULL) { - SQL->StmtFreeResult(stmt); - SQL->StmtFree(stmt); - return -1; - } - - // Read mails - while (SQL_SUCCESS == SQL->StmtNextRow(stmt)) { + { struct item it = { 0 }; + StringBuf buf; + struct SqlStmt *stmt_items = SQL->StmtMalloc(inter->sql_handle); + int i; - if (msg.type & MAIL_TYPE_ITEM) { - if (SQL_ERROR == SQL->StmtPrepare(stmt_items, "SELECT `nameid`, `amount`, `equip`, `identify`," - "`refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `opt_idx0`, `opt_val0`," - "`opt_idx1`, `opt_val1`, `opt_idx2`, `opt_val2`, `opt_idx3`, `opt_val3`, `opt_idx4`, `opt_val4`," - "`expire_time`, `bound`, `unique_id`" - "FROM `%s` WHERE mail_id = '%"PRId64"' ORDER BY `mail_id` ASC", rodex_item_db, msg.id) - || SQL_ERROR == SQL->StmtExecute(stmt_items) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 0, SQLDT_INT, &it.nameid, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 1, SQLDT_INT, &it.amount, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 2, SQLDT_UINT, &it.equip, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 3, SQLDT_INT8, &it.identify, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 4, SQLDT_INT8, &it.refine, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 5, SQLDT_INT8, &it.attribute, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 6, SQLDT_INT16, &it.card[0], 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 7, SQLDT_INT16, &it.card[1], 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 8, SQLDT_INT16, &it.card[2], 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 9, SQLDT_INT16, &it.card[3], 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 10, SQLDT_INT16, &it.option[0].index, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 11, SQLDT_INT16, &it.option[0].value, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 12, SQLDT_INT16, &it.option[1].index, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 13, SQLDT_INT16, &it.option[1].value, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 14, SQLDT_INT16, &it.option[2].index, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 15, SQLDT_INT16, &it.option[2].value, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 16, SQLDT_INT16, &it.option[3].index, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 17, SQLDT_INT16, &it.option[3].value, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 18, SQLDT_INT16, &it.option[4].index, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 19, SQLDT_INT16, &it.option[4].value, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 20, SQLDT_INT, &it.expire_time, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 21, SQLDT_UINT8, &it.bound, 0, NULL, NULL) - || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 22, SQLDT_UINT64, &it.unique_id, 0, NULL, NULL)) { - SqlStmt_ShowDebug(stmt_items); - } - - for (i = 0; i < RODEX_MAX_ITEM && SQL_SUCCESS == SQL->StmtNextRow(stmt_items); ++i) { - msg.items[i].item = it; - msg.items_count++; - } + if (stmt_items == NULL) { + SQL->StmtFreeResult(stmt); + SQL->StmtFree(stmt); + return -1; } - if (msg.items_count == 0) { - msg.type &= ~MAIL_TYPE_ITEM; + StrBuf->Init(&buf); + + StrBuf->AppendStr(&buf, "SELECT `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`"); + for (i = 0; i < MAX_SLOTS; i++) { + StrBuf->Printf(&buf, ", `card%d`", i); + } + for (i = 0; i < MAX_ITEM_OPTIONS; i++) { + StrBuf->Printf(&buf, ", `opt_idx%d`, `opt_val%d`", i, i); } + StrBuf->Printf(&buf, "FROM `%s` WHERE mail_id = ? ORDER BY `mail_id` ASC", rodex_item_db); - if (msg.zeny == 0) { - msg.type &= ~MAIL_TYPE_ZENY; + if (SQL_ERROR == SQL->StmtPrepareStr(stmt_items, StrBuf->Value(&buf)) + || SQL_ERROR == SQL->StmtBindParam(stmt_items, 0, SQLDT_INT64, &msg.id, sizeof msg.id) + ) { + SqlStmt_ShowDebug(stmt_items); } + // Read mails + while (SQL_SUCCESS == SQL->StmtNextRow(stmt)) { + + 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, 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) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 4, SQLDT_CHAR, &it.refine, sizeof it.refine, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 5, SQLDT_CHAR, &it.attribute, sizeof it.attribute, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 6, SQLDT_UINT, &it.expire_time, sizeof it.expire_time, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 7, SQLDT_UCHAR, &it.bound, sizeof it.bound, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 8, SQLDT_UINT64, &it.unique_id, sizeof it.unique_id, NULL, NULL) + ) { + 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)) + SqlStmt_ShowDebug(stmt_items); + } + for (i = 0; i < MAX_ITEM_OPTIONS; i++) { + if (SQL_ERROR == SQL->StmtBindColumn(stmt_items, 9 + MAX_SLOTS + i * 2, SQLDT_INT16, &it.option[i].index, sizeof it.option[i].index, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt_items, 10 + MAX_SLOTS + i * 2, SQLDT_INT16, &it.option[i].value, sizeof it.option[i].value, NULL, NULL) + ) { + SqlStmt_ShowDebug(stmt_items); + } + } + + for (i = 0; i < RODEX_MAX_ITEM && SQL_SUCCESS == SQL->StmtNextRow(stmt_items); ++i) { + msg.items[i].item = it; + msg.items_count++; + } + } + + if (msg.items_count == 0) { + msg.type &= ~MAIL_TYPE_ITEM; + } + + if (msg.zeny == 0) { + msg.type &= ~MAIL_TYPE_ZENY; + } + #if PACKETVER >= 20170419 - if (opentype == RODEX_OPENTYPE_UNSET) { - if (msg.receiver_id != 0) - msg.opentype = RODEX_OPENTYPE_MAIL; - else - msg.opentype = RODEX_OPENTYPE_ACCOUNT; - } else { - msg.opentype = opentype; - } + if (opentype == RODEX_OPENTYPE_UNSET) { + if (msg.receiver_id != 0) + msg.opentype = RODEX_OPENTYPE_MAIL; + else + msg.opentype = RODEX_OPENTYPE_ACCOUNT; + } else { + msg.opentype = opentype; + } #else - msg.opentype = opentype; + msg.opentype = opentype; #endif #if PACKETVER < 20160601 - // NPC Message Type isn't supported in old clients - msg.type &= ~MAIL_TYPE_NPC; + // NPC Message Type isn't supported in old clients + msg.type &= ~MAIL_TYPE_NPC; #endif - ++count; - VECTOR_ENSURE(*mails, 1, 1); - VECTOR_PUSH(*mails, msg); - memset(&msg, 0, sizeof(struct rodex_message)); + ++count; + VECTOR_ENSURE(*mails, 1, 1); + VECTOR_PUSH(*mails, msg); + memset(&msg, 0, sizeof(struct rodex_message)); + + SQL->StmtFreeResult(stmt_items); + } + StrBuf->Destroy(&buf); + SQL->StmtFree(stmt_items); } SQL->StmtFreeResult(stmt); - SQL->StmtFreeResult(stmt_items); - SQL->StmtFree(stmt); - SQL->StmtFree(stmt_items); ShowInfo("rodex load complete from DB - id: %d (total: %d)\n", char_id, count); return count; diff --git a/src/char/int_storage.c b/src/char/int_storage.c index aafba8520..70cdc5f19 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -566,23 +566,23 @@ int mapif_parse_ItemBoundRetrieve_sub(int fd) } memset(&item, 0, sizeof(item)); - SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 1, SQLDT_SHORT, &item.nameid, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 2, SQLDT_SHORT, &item.amount, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 3, SQLDT_USHORT, &item.equip, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 4, SQLDT_CHAR, &item.identify, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, NULL, NULL); + 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, 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); + SQL->StmtBindColumn(stmt, 5, SQLDT_CHAR, &item.refine, sizeof item.refine, NULL, NULL); + SQL->StmtBindColumn(stmt, 6, SQLDT_CHAR, &item.attribute, sizeof item.attribute, NULL, NULL); + SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, sizeof item.expire_time, NULL, NULL); + SQL->StmtBindColumn(stmt, 8, SQLDT_UCHAR, &item.bound, sizeof item.bound, NULL, NULL); + 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], 0, NULL, NULL); + SQL->StmtBindColumn(stmt, 10 + j, SQLDT_SHORT, &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, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 11 + MAX_SLOTS + j * 2, SQLDT_INT16, &item.option[j].value, 0, NULL, NULL); + SQL->StmtBindColumn(stmt, 10 + MAX_SLOTS + j * 2, SQLDT_INT16, &item.option[j].index, sizeof item.option[j].index, NULL, NULL); + SQL->StmtBindColumn(stmt, 11 + MAX_SLOTS + j * 2, SQLDT_INT16, &item.option[j].value, sizeof item.option[j].value, NULL, NULL); } while (SQL_SUCCESS == SQL->StmtNextRow(stmt)) { Assert_retb(i < MAX_INVENTORY); diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 7480269e5..e8135b6d1 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -574,6 +574,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_MAIL_LIST", sizeof(struct PACKET_ZC_MAIL_LIST), SERVER_TYPE_MAP }, { "PACKET_ZC_NOTIFY_UNREADMAIL", sizeof(struct PACKET_ZC_NOTIFY_UNREADMAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_READ_MAIL", sizeof(struct PACKET_ZC_READ_MAIL), SERVER_TYPE_MAP }, + { "PACKET_ZC_SKILL_SCALE", sizeof(struct PACKET_ZC_SKILL_SCALE), SERVER_TYPE_MAP }, { "PACKET_ZC_WRITE_MAIL_RESULT", sizeof(struct PACKET_ZC_WRITE_MAIL_RESULT), SERVER_TYPE_MAP }, { "mail_item", sizeof(struct mail_item), SERVER_TYPE_MAP }, { "maillistinfo", sizeof(struct maillistinfo), SERVER_TYPE_MAP }, diff --git a/src/common/mmo.h b/src/common/mmo.h index f102e2a2a..3987ef48b 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -139,8 +139,8 @@ #endif #define MAX_FAME 1000000000 #define MAX_CART 100 -#ifndef MAX_SKILL -#define MAX_SKILL 1510 +#ifndef MAX_SKILL_DB +#define MAX_SKILL_DB 1510 ///< Maximum number of skills in the skill DB (compacted array size) #endif #ifndef MAX_SKILL_ID #define MAX_SKILL_ID 10015 // [Ind/Hercules] max used skill ID @@ -636,7 +636,7 @@ struct mmo_charstatus { struct point last_point,save_point,memo_point[MAX_MEMOPOINTS]; struct item inventory[MAX_INVENTORY],cart[MAX_CART]; - struct s_skill skill[MAX_SKILL]; + struct s_skill skill[MAX_SKILL_DB]; struct s_friend friends[MAX_FRIENDS]; //New friend system [Skotlex] #ifdef HOTKEY_SAVING @@ -1204,4 +1204,8 @@ enum hz_char_ask_name_answer { #error MAX_SLOTS it too small #endif +#ifdef MAX_SKILL +#error MAX_SKILL has been replaced by MAX_SKILL_DB. Please update your custom definitions. +#endif + #endif /* COMMON_MMO_H */ diff --git a/src/common/sql.c b/src/common/sql.c index 235be3aca..7f526cff6 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -423,68 +423,99 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, memset(bind, 0, sizeof(MYSQL_BIND)); switch( buffer_type ) { - case SQLDT_NULL: bind->buffer_type = MYSQL_TYPE_NULL; + case SQLDT_NULL: + bind->buffer_type = MYSQL_TYPE_NULL; buffer_len = 0;// FIXME length = ? [FlavioJS] break; // fixed size - case SQLDT_UINT8: bind->is_unsigned = 1; + case SQLDT_UINT8: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_INT8: bind->buffer_type = MYSQL_TYPE_TINY; - buffer_len = 1; + case SQLDT_INT8: + bind->buffer_type = MYSQL_TYPE_TINY; + Assert_retr(SQL_ERROR, buffer_len == 1); break; - case SQLDT_UINT16: bind->is_unsigned = 1; + case SQLDT_UINT16: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_INT16: bind->buffer_type = MYSQL_TYPE_SHORT; - buffer_len = 2; + case SQLDT_INT16: + bind->buffer_type = MYSQL_TYPE_SHORT; + Assert_retr(SQL_ERROR, buffer_len == 2); break; - case SQLDT_UINT32: bind->is_unsigned = 1; + case SQLDT_UINT32: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_INT32: bind->buffer_type = MYSQL_TYPE_LONG; - buffer_len = 4; + case SQLDT_INT32: + bind->buffer_type = MYSQL_TYPE_LONG; + Assert_retr(SQL_ERROR, buffer_len == 4); break; - case SQLDT_UINT64: bind->is_unsigned = 1; + case SQLDT_UINT64: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_INT64: bind->buffer_type = MYSQL_TYPE_LONGLONG; - buffer_len = 8; + case SQLDT_INT64: + bind->buffer_type = MYSQL_TYPE_LONGLONG; + Assert_retr(SQL_ERROR, buffer_len == 8); break; // platform dependent size - case SQLDT_UCHAR: bind->is_unsigned = 1; + case SQLDT_UCHAR: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_CHAR: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(char)); - buffer_len = sizeof(char); + case SQLDT_CHAR: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(char)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(char)); break; - case SQLDT_USHORT: bind->is_unsigned = 1; + case SQLDT_USHORT: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_SHORT: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(short)); - buffer_len = sizeof(short); + case SQLDT_SHORT: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(short)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(short)); break; - case SQLDT_UINT: bind->is_unsigned = 1; + case SQLDT_UINT: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_INT: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int)); - buffer_len = sizeof(int); + case SQLDT_INT: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(int)); break; - case SQLDT_ULONG: bind->is_unsigned = 1; + case SQLDT_ULONG: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_LONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(long)); - buffer_len = sizeof(long); + case SQLDT_LONG: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(long)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(long)); break; - case SQLDT_ULONGLONG: bind->is_unsigned = 1; + case SQLDT_ULONGLONG: + bind->is_unsigned = 1; FALLTHROUGH - case SQLDT_LONGLONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int64)); - buffer_len = sizeof(int64); + case SQLDT_LONGLONG: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(long long)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(long long)); + break; + case SQLDT_BOOL: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(bool)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(bool)); + break; + case SQLDT_TIME: + bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(time_t)); + Assert_retr(SQL_ERROR, buffer_len == sizeof(time_t)); break; // floating point - case SQLDT_FLOAT: bind->buffer_type = MYSQL_TYPE_FLOAT; - buffer_len = 4; + case SQLDT_FLOAT: + bind->buffer_type = MYSQL_TYPE_FLOAT; + Assert_retr(SQL_ERROR, buffer_len == 4); break; - case SQLDT_DOUBLE: bind->buffer_type = MYSQL_TYPE_DOUBLE; - buffer_len = 8; + case SQLDT_DOUBLE: + bind->buffer_type = MYSQL_TYPE_DOUBLE; + Assert_retr(SQL_ERROR, buffer_len == 8); break; // other case SQLDT_STRING: - case SQLDT_ENUM: bind->buffer_type = MYSQL_TYPE_STRING; + case SQLDT_ENUM: + bind->buffer_type = MYSQL_TYPE_STRING; break; - case SQLDT_BLOB: bind->buffer_type = MYSQL_TYPE_BLOB; + case SQLDT_BLOB: + bind->buffer_type = MYSQL_TYPE_BLOB; break; default: ShowDebug("Sql_P_BindSqlDataType: unsupported buffer type (%u)\n", buffer_type); diff --git a/src/common/sql.h b/src/common/sql.h index 4d9a12cc1..11127c66c 100644 --- a/src/common/sql.h +++ b/src/common/sql.h @@ -59,6 +59,8 @@ enum SqlDataType { SQLDT_UINT, SQLDT_ULONG, SQLDT_ULONGLONG, + SQLDT_BOOL, + SQLDT_TIME, // floating point SQLDT_FLOAT, SQLDT_DOUBLE, diff --git a/src/login/account_sql.c b/src/login/account_sql.c index 70d4f3dfb..66ede6cfa 100644 --- a/src/login/account_sql.c +++ b/src/login/account_sql.c @@ -599,16 +599,16 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "INSERT INTO `%s` (`account_id`, `userid`, `user_pass`, `sex`, `email`, `group_id`, `state`, `unban_time`, `expiration_time`, `logincount`, `lastlogin`, `last_ip`, `birthdate`, `character_slots`, `pincode`, `pincode_change`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", db->account_db) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_INT, &acc->account_id, sizeof(acc->account_id)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_INT, &acc->account_id, sizeof acc->account_id) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, acc->userid, strlen(acc->userid)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, acc->pass, strlen(acc->pass)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 3, SQLDT_ENUM, &acc->sex, sizeof(acc->sex)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 3, SQLDT_ENUM, &acc->sex, sizeof acc->sex) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 4, SQLDT_STRING, &acc->email, strlen(acc->email)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 5, SQLDT_INT, &acc->group_id, sizeof(acc->group_id)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 6, SQLDT_UINT, &acc->state, sizeof(acc->state)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 7, SQLDT_LONG, &acc->unban_time, sizeof(acc->unban_time)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 8, SQLDT_INT, &acc->expiration_time, sizeof(acc->expiration_time)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 9, SQLDT_UINT, &acc->logincount, sizeof(acc->logincount)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 5, SQLDT_INT, &acc->group_id, sizeof acc->group_id) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 6, SQLDT_UINT, &acc->state, sizeof acc->state) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 7, SQLDT_TIME, &acc->unban_time, sizeof acc->unban_time) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 8, SQLDT_TIME, &acc->expiration_time, sizeof acc->expiration_time) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 9, SQLDT_UINT, &acc->logincount, sizeof acc->logincount) || SQL_SUCCESS != (acc->lastlogin[0] < '1' || acc->lastlogin[0] > '9' ? SQL->StmtBindParam(stmt, 10, SQLDT_NULL, NULL, 0) : SQL->StmtBindParam(stmt, 10, SQLDT_STRING, &acc->lastlogin, strlen(acc->lastlogin)) @@ -618,9 +618,9 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo SQL->StmtBindParam(stmt, 12, SQLDT_NULL, NULL, 0) : SQL->StmtBindParam(stmt, 12, SQLDT_STRING, &acc->birthdate, strlen(acc->birthdate)) ) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_UCHAR, &acc->char_slots, sizeof(acc->char_slots)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_UINT8, &acc->char_slots, sizeof acc->char_slots) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_STRING, &acc->pincode, strlen(acc->pincode)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 15, SQLDT_LONG, &acc->pincode_change, sizeof(acc->pincode_change)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 15, SQLDT_UINT, &acc->pincode_change, sizeof acc->pincode_change) || SQL_SUCCESS != SQL->StmtExecute(stmt) ) { SqlStmt_ShowDebug(stmt); @@ -630,13 +630,13 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "UPDATE `%s` SET `userid`=?,`user_pass`=?,`sex`=?,`email`=?,`group_id`=?,`state`=?,`unban_time`=?,`expiration_time`=?,`logincount`=?,`lastlogin`=?,`last_ip`=?,`birthdate`=?,`character_slots`=?,`pincode`=?,`pincode_change`=? WHERE `account_id` = '%d'", db->account_db, acc->account_id) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, acc->userid, strlen(acc->userid)) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, acc->pass, strlen(acc->pass)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_ENUM, &acc->sex, sizeof(acc->sex)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_ENUM, &acc->sex, sizeof acc->sex) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 3, SQLDT_STRING, acc->email, strlen(acc->email)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 4, SQLDT_INT, &acc->group_id, sizeof(acc->group_id)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 5, SQLDT_UINT, &acc->state, sizeof(acc->state)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 6, SQLDT_LONG, &acc->unban_time, sizeof(acc->unban_time)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 7, SQLDT_LONG, &acc->expiration_time, sizeof(acc->expiration_time)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 8, SQLDT_UINT, &acc->logincount, sizeof(acc->logincount)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 4, SQLDT_INT, &acc->group_id, sizeof acc->group_id) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 5, SQLDT_UINT, &acc->state, sizeof acc->state) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 6, SQLDT_TIME, &acc->unban_time, sizeof acc->unban_time) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 7, SQLDT_TIME, &acc->expiration_time, sizeof acc->expiration_time) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 8, SQLDT_UINT, &acc->logincount, sizeof acc->logincount) || SQL_SUCCESS != (acc->lastlogin[0] < '1' || acc->lastlogin[0] > '9' ? SQL->StmtBindParam(stmt, 9, SQLDT_NULL, NULL, 0) : SQL->StmtBindParam(stmt, 9, SQLDT_STRING, &acc->lastlogin, strlen(acc->lastlogin)) @@ -646,9 +646,9 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo SQL->StmtBindParam(stmt, 11, SQLDT_NULL, NULL, 0) : SQL->StmtBindParam(stmt, 11, SQLDT_STRING, &acc->birthdate, strlen(acc->birthdate)) ) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 12, SQLDT_UCHAR, &acc->char_slots, sizeof(acc->char_slots)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 12, SQLDT_UINT8, &acc->char_slots, sizeof acc->char_slots) || SQL_SUCCESS != SQL->StmtBindParam(stmt, 13, SQLDT_STRING, &acc->pincode, strlen(acc->pincode)) - || SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_LONG, &acc->pincode_change, sizeof(acc->pincode_change)) + || SQL_SUCCESS != SQL->StmtBindParam(stmt, 14, SQLDT_UINT, &acc->pincode_change, sizeof acc->pincode_change) || SQL_SUCCESS != SQL->StmtExecute(stmt) ) { SqlStmt_ShowDebug(stmt); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index d9f4810ee..1590c3f0c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5296,12 +5296,13 @@ ACMD(skillid) iter = db_iterator(skill->name2id_db); for (data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key)) { - int idx = skill->get_index(DB->data2i(data)); - if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill->dbs->db[idx].desc, message, skillen) == 0) { - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1164), DB->data2i(data), skill->dbs->db[idx].desc, key.str); // skill %d: %s (%s) + int skill_id = DB->data2i(data); + const char *skill_desc = skill->get_desc(skill_id); + if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_desc, message, skillen) == 0) { + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1164), skill_id, skill_desc, key.str); // skill %d: %s (%s) clif->message(fd, atcmd_output); - } else if ( found < MAX_SKILLID_PARTIAL_RESULTS && ( stristr(key.str,message) || stristr(skill->dbs->db[idx].desc,message) ) ) { - snprintf(partials[found], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_fd(fd,1164), DB->data2i(data), skill->dbs->db[idx].desc, key.str); + } else if (found < MAX_SKILLID_PARTIAL_RESULTS && (stristr(key.str, message) != NULL || stristr(skill_desc, message) != NULL)) { + snprintf(partials[found], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_fd(fd, 1164), skill_id, skill_desc, key.str); found++; } } @@ -5428,7 +5429,7 @@ ACMD(skilltree) for (j = 0; j < VECTOR_LENGTH(entry->need); j++) { struct skill_tree_requirement *req = &VECTOR_INDEX(entry->need, j); if (pc->checkskill(sd, req->id) < req->lv) { - safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1170), req->lv, skill->dbs->db[req->id].desc); // Player requires level %d of skill %s. + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1170), req->lv, skill->get_desc(req->id)); // Player requires level %d of skill %s. clif->message(fd, atcmd_output); meets = 0; } @@ -8686,7 +8687,7 @@ ACMD(cart) { int val = atoi(message); bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true; - unsigned int index = skill->get_index(MC_PUSHCART); + int index = skill->get_index(MC_PUSHCART); if (!*message || val < 0 || val > MAX_CARTS) { safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>). @@ -9394,7 +9395,7 @@ ACMD(cddebug) { } if (!cd || (*message && !strcmpi(message,"reset"))) { - for(i = 0; i < MAX_SKILL; i++) { + for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->blockskill[i] ) { clif->messages(fd,"Found skill '%s', unblocking...",skill->dbs->db[i].name); sd->blockskill[i] = false; diff --git a/src/map/battle.h b/src/map/battle.h index f6e825e82..429249dca 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -54,6 +54,7 @@ struct status_data; enum { // Flag of the final calculation + BF_NONE = 0x0000, BF_WEAPON = 0x0001, BF_MAGIC = 0x0002, BF_MISC = 0x0004, diff --git a/src/map/chrif.c b/src/map/chrif.c index 39aa046d7..96f144523 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1360,10 +1360,10 @@ void chrif_skillid2idx(int fd) { if (!sockt->session_is_valid(fd)) return; - WFIFOHEAD(fd,4 + (MAX_SKILL * 4)); + WFIFOHEAD(fd,4 + (MAX_SKILL_DB * 4)); WFIFOW(fd,0) = 0x2b0b; - for(i = 0; i < MAX_SKILL; i++) { - if( skill->dbs->db[i].nameid ) { + 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, 6 + (count*4)) = i; count++; diff --git a/src/map/clif.c b/src/map/clif.c index eb6b46bec..5f7cf3b5d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -293,7 +293,11 @@ unsigned char clif_bl_type(struct block_list *bl) case BL_NPC: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); +#if PACKETVER >= 20170726 + return CLUT_EVENT; +#else return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_EVENT; +#endif case BL_PET: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); @@ -3341,17 +3345,22 @@ void clif_changelook(struct block_list *bl,int type,int val) #if PACKETVER < 4 clif->sendlook(bl, bl->id, type, val, 0, target); #else - if(type == LOOK_WEAPON || type == LOOK_SHIELD) { - nullpo_retv(vd); - type = LOOK_WEAPON; - val = vd->weapon; - val2 = vd->shield; - } - if (clif->isdisguised(bl)) { - clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); - clif->sendlook(bl, -bl->id, type, val, val2, SELF); + if (bl->type != BL_NPC) { + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + nullpo_retv(vd); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if (clif->isdisguised(bl)) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else { + clif->sendlook(bl, bl->id, type, val, val2, target); + } } else { - clif->sendlook(bl, bl->id, type, val, val2, target); + struct npc_data *nd = BL_UCAST(BL_NPC, bl); + npc->refresh(nd); } #endif } @@ -4857,9 +4866,9 @@ void clif_skillinfoblock(struct map_session_data *sd) fd=sd->fd; if (!fd) return; - WFIFOHEAD(fd, MAX_SKILL * 37 + 4); + WFIFOHEAD(fd, MAX_SKILL_DB * 37 + 4); WFIFOW(fd,0) = 0x10f; - for ( i = 0, len = 4; i < MAX_SKILL; i++) { + for ( i = 0, len = 4; i < MAX_SKILL_DB; i++) { if( (id = sd->status.skill[i].id) != 0 ) { int level; // workaround for bugreport:5348 @@ -4890,7 +4899,7 @@ void clif_skillinfoblock(struct map_session_data *sd) WFIFOSET(fd,len); // workaround for bugreport:5348; send the remaining skills one by one to bypass packet size limit - for ( ; i < MAX_SKILL; i++) { + for ( ; i < MAX_SKILL_DB; i++) { if( (id = sd->status.skill[i].id) != 0 ) { clif->addskill(sd, id); clif->skillinfo(sd, id, 0); @@ -4992,7 +5001,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf) int skill_lv; nullpo_retv(sd); - Assert_retv(idx >= 0 && idx < MAX_SKILL); + Assert_retv(idx >= 0 && idx < MAX_SKILL_DB); skill_lv = sd->status.skill[idx].lv; @@ -5059,6 +5068,10 @@ void clif_useskill(struct block_list* bl, int src_id, int dst_id, int dst_x, int } else { clif->send(buf,packet_len(cmd), bl, AREA); } +#if PACKETVER >= 20151223 + if ((skill->get_inf2(skill_id) & INF2_SHOW_SKILL_SCALE) != 0) + clif->skill_scale(bl, src_id, bl->x, bl->y, skill_id, skill_lv, casttime); +#endif } /// Notifies clients in area, that an object canceled casting (ZC_DISPEL). @@ -17647,7 +17660,7 @@ int clif_autoshadowspell_list(struct map_session_data *sd) { WFIFOHEAD(fd, 2 * 6 + 4); WFIFOW(fd,0) = 0x442; - for( i = 0, c = 0; i < MAX_SKILL; i++ ) + for (i = 0, c = 0; i < MAX_SKILL_DB; i++) if( sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].id > 0 && sd->status.skill[i].id < GS_GLITTERING && skill->get_type(sd->status.skill[i].id) == BF_MAGIC ) { // Can't auto cast both Extended class and 3rd class skills. @@ -19865,6 +19878,32 @@ void clif_parse_rodex_cancel_write_mail(int fd, struct map_session_data *sd) rodex->clean(sd, 1); } +void clif_skill_scale(struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime) +{ +#if PACKETVER >= 20151223 + struct PACKET_ZC_SKILL_SCALE p; + + p.PacketType = skillscale; + p.AID = src_id; + p.skill_id = skill_id; + p.skill_lv = skill_lv; + p.x = x; + p.y = y; + p.casttime = casttime; + + if (clif->isdisguised(bl)) { + clif->send(&p, sizeof(p), bl, AREA_WOS); + p.AID = -src_id; + clif->send(&p, sizeof(p), bl, SELF); + } else { + clif->send(&p, sizeof(p), bl, AREA); + } +#else + ShowWarning("clif_skill_scale: showing skill scale available only for clients >= 20151223."); + return; +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -20934,4 +20973,5 @@ void clif_defaults(void) { clif->rodex_request_items = clif_rodex_request_items; clif->rodex_icon = clif_rodex_icon; clif->rodex_send_mails_all = clif_rodex_send_mails_all; + clif->skill_scale = clif_skill_scale; } diff --git a/src/map/clif.h b/src/map/clif.h index c321b99d7..e348bbb08 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1403,6 +1403,7 @@ struct clif_interface { void (*pRodexRequestItems) (int fd, struct map_session_data *sd); void (*rodex_request_items) (struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result); void (*rodex_icon) (int fd, bool show); + void (*skill_scale) (struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime); }; #ifdef HERCULES_CORE diff --git a/src/map/elemental.c b/src/map/elemental.c index ae1fda0a2..cf1d485e1 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -885,7 +885,7 @@ int read_elementaldb(void) { estatus->race = atoi(str[20]); ele = atoi(str[21]); - estatus->def_ele = ele%10; + estatus->def_ele = ele % ELE_MAX; estatus->ele_lv = ele/20; if( estatus->def_ele >= ELE_MAX ) { ShowWarning("Elemental %d has invalid element type %d (max element is %d)\n", db->class_, estatus->def_ele, ELE_MAX - 1); diff --git a/src/map/homunculus.h b/src/map/homunculus.h index a80392cf6..f3b10fc19 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -124,7 +124,7 @@ struct homun_data { struct map_session_data *master; //pointer back to its master int hungry_timer; //[orn] unsigned int exp_next; - char blockskill[MAX_SKILL]; // [orn] + char blockskill[MAX_SKILL_DB]; // [orn] int64 masterteleport_timer; }; diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index 4cdb91b21..02015e011 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -211,9 +211,9 @@ void script_load_mapreg(void) { mapreg->skip_insert = true; - SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &varname[0], sizeof(varname), &length, NULL); - SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &index, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &value[0], sizeof(value), NULL, NULL); + SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &varname, sizeof varname, &length, NULL); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &index, sizeof index, NULL, NULL); + SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &value, sizeof value, NULL, NULL); while ( SQL_SUCCESS == SQL->StmtNextRow(stmt) ) { int s = script->add_str(varname); diff --git a/src/map/mercenary.c b/src/map/mercenary.c index f5d3fe11c..c4b692008 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -465,7 +465,7 @@ bool read_mercenarydb_sub(char* str[], int columns, int current) { mstatus->race = atoi(str[20]); ele = atoi(str[21]); - mstatus->def_ele = ele%10; + mstatus->def_ele = ele % ELE_MAX; mstatus->ele_lv = ele/20; if( mstatus->def_ele >= ELE_MAX ) { ShowWarning("Mercenary %d has invalid element type %d (max element is %d)\n", db->class_, mstatus->def_ele, ELE_MAX - 1); diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 0af75e8a2..f3773f191 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -92,7 +92,7 @@ struct mercenary_data { struct regen_data regen; struct s_mercenary_db *db; struct s_mercenary mercenary; - char blockskill[MAX_SKILL]; + char blockskill[MAX_SKILL_DB]; struct map_session_data *master; int contract_timer; diff --git a/src/map/mob.c b/src/map/mob.c index 208617b5d..f509ecace 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4846,7 +4846,7 @@ bool mob_parse_row_mobskilldb(char** str, int columns, int current) struct mob_skill *ms, gms; int mob_id; int i =0, j, tmp; - uint16 sidx = 0; + int sidx = 0; nullpo_retr(false, str); mob_id = atoi(str[0]); diff --git a/src/map/npc.c b/src/map/npc.c index de5335302..d3dfb39d2 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -114,6 +114,8 @@ bool npc_db_checkid(int id) return true; if (id >= MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END) // Second range return true; + if (pc->db_checkid(id)) + return true; // Anything else is invalid return false; } @@ -1558,9 +1560,9 @@ void npc_market_fromsql(void) return; } - SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &name[0], sizeof(name), NULL, NULL); - SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &itemid, 0, NULL, NULL); - SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &amount, 0, NULL, NULL); + SQL->StmtBindColumn(stmt, 0, SQLDT_STRING, &name, sizeof name, NULL, NULL); + SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &itemid, sizeof itemid, NULL, NULL); + SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &amount, sizeof amount, NULL, NULL); while ( SQL_SUCCESS == SQL->StmtNextRow(stmt) ) { struct npc_data *nd = NULL; @@ -2706,6 +2708,7 @@ struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, u nd->area_size = AREA_SIZE + 1; nd->class_ = class_; nd->speed = 200; + nd->vd = npc_viewdb[0]; // Copy INVISIBLE_CLASS view data. Actual view data is set by npc->add_to_location() later. return nd; } @@ -3656,6 +3659,18 @@ void npc_setclass(struct npc_data* nd, short class_) { clif->spawn(&nd->bl);// fade in } +void npc_refresh(struct npc_data* nd) +{ + nullpo_retv(nd); + + if (map->list[nd->bl.m].users) { + // using here CLR_TRICKDEAD because other flags show effects. + // probably need use other flag or other way to refresh npc. + clif->clearunit_area(&nd->bl, CLR_TRICKDEAD); // fade out + clif->spawn(&nd->bl); // fade in + } +} + // @commands (script based) int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const char* message, const char* eventname) { @@ -4999,7 +5014,6 @@ int do_init_npc(bool minimal) { npc_viewdb[i].class = i; for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ ) npc_viewdb2[i - MAX_NPC_CLASS2_START].class = i; - npc->ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, EVENT_NAME_LENGTH); npc->ev_label_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, NAME_LENGTH); npc->name_db = strdb_alloc(DB_OPT_BASE, NAME_LENGTH); @@ -5194,4 +5208,5 @@ void npc_defaults(void) { npc->market_delfromsql = npc_market_delfromsql; npc->market_delfromsql_sub = npc_market_delfromsql_sub; npc->db_checkid = npc_db_checkid; + npc->refresh = npc_refresh; } diff --git a/src/map/npc.h b/src/map/npc.h index 3bd11d536..8bb38f252 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -70,7 +70,7 @@ struct npc_parse; struct npc_data { struct block_list bl; struct unit_data *ud; - struct view_data *vd; + struct view_data vd; unsigned int option; struct npc_data *master_nd; short class_; @@ -309,6 +309,7 @@ struct npc_interface { void (*market_delfromsql) (struct npc_data *nd, unsigned short index); void (*market_delfromsql_sub) (const char *npcname, unsigned short index); bool (*db_checkid) (const int id); + void (*refresh) (struct npc_data* nd); /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 03b555e2b..e1395e949 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -330,6 +330,9 @@ enum packet_headers { #else // PACKETVER >= 20160316 rodexcheckplayer = 0x0A51, #endif +#if PACKETVER >= 20151223 + skillscale = 0xA41, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -1478,6 +1481,16 @@ struct PACKET_ZC_ACK_ITEM_FROM_MAIL { int8 result; } __attribute__((packed)); +struct PACKET_ZC_SKILL_SCALE { + int16 PacketType; + uint32 AID; + int16 skill_id; + int16 skill_lv; + int16 x; + int16 y; + uint32 casttime; +} __attribute__((packed)); + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris diff --git a/src/map/pc.c b/src/map/pc.c index 0636ebafa..d5d359557 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1560,7 +1560,7 @@ int pc_calc_skillpoint(struct map_session_data* sd) { nullpo_ret(sd); - for (i = 1; i < MAX_SKILL; i++) { + for (i = 1; i < MAX_SKILL_DB; i++) { int skill_lv = pc->checkskill2(sd,i); if (skill_lv > 0) { inf2 = skill->dbs->db[i].inf2; @@ -1596,7 +1596,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } classidx = pc->class2idx(class); - for( i = 0; i < MAX_SKILL; i++ ) { + for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these sd->status.skill[i].id = 0; //First clear skills. /* permanent skills that must be re-checked */ @@ -1613,7 +1613,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } } - for( i = 0; i < MAX_SKILL; i++ ) { + for (i = 0; i < MAX_SKILL_DB; i++) { if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) { // Restore original level of skills after deleting earned skills. sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; @@ -1622,18 +1622,25 @@ int pc_calc_skilltree(struct map_session_data *sd) if( sd->sc.count && sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_BARDDANCER && skill->dbs->db[i].nameid >= DC_HUMMING && skill->dbs->db[i].nameid <= DC_SERVICEFORYOU ) { //Enable Bard/Dancer spirit linked skills. - if( sd->status.sex ) - { //Link dancer skills to bard. - // i can be < 8? - if( sd->status.skill[i-8].lv < 10 ) + if (sd->status.sex) { + // Link dancer skills to bard. + if (i < 8) { + Assert_report(i >= 8); + continue; + } + if (sd->status.skill[i-8].lv < 10) continue; sd->status.skill[i].id = skill->dbs->db[i].nameid; sd->status.skill[i].lv = sd->status.skill[i-8].lv; // Set the level to the same as the linking skill sd->status.skill[i].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill - } else { //Link bard skills to dancer. - if( sd->status.skill[i].lv < 10 ) + } else { + // Link bard skills to dancer. + if (i < 8) { + Assert_report(i >= 8); + continue; + } + if (sd->status.skill[i].lv < 10) continue; - // i can be < 8? sd->status.skill[i-8].id = skill->dbs->db[i-8].nameid; sd->status.skill[i-8].lv = sd->status.skill[i].lv; // Set the level to the same as the linking skill sd->status.skill[i-8].flag = SKILL_FLAG_TEMPORARY; // Tag it as a non-savable, non-uppable, bonus skill @@ -1642,7 +1649,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } if( pc_has_permission(sd, PC_PERM_ALL_SKILL) ) { - for( i = 0; i < MAX_SKILL; i++ ) { + for (i = 0; i < MAX_SKILL_DB; i++) { switch(skill->dbs->db[i].nameid) { /** * Dummy skills must be added here otherwise they'll be displayed in the, @@ -1836,7 +1843,7 @@ int pc_clean_skilltree(struct map_session_data *sd) { int i; nullpo_ret(sd); - for (i = 0; i < MAX_SKILL; i++){ + for (i = 0; i < MAX_SKILL_DB; i++) { if (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY || sd->status.skill[i].flag == SKILL_FLAG_PLAGIARIZED) { sd->status.skill[i].id = 0; sd->status.skill[i].lv = 0; @@ -4143,7 +4150,7 @@ int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4 *------------------------------------------*/ int pc_skill(struct map_session_data *sd, int id, int level, int flag) { - uint16 index = 0; + int index = 0; nullpo_ret(sd); if (!(index = skill->get_index(id))) { @@ -5869,7 +5876,7 @@ int pc_memo(struct map_session_data* sd, int pos) { * Return player sd skill_lv learned for given skill *------------------------------------------*/ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { - uint16 index = 0; + int index = 0; if(sd == NULL) return 0; if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) { struct guild *g; @@ -5888,8 +5895,9 @@ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { return 0; } int pc_checkskill2(struct map_session_data *sd,uint16 index) { - if(sd == NULL) return 0; - if(index >= ARRAYLENGTH(sd->status.skill) ) { + if (sd == NULL) + return 0; + if (index >= MAX_SKILL_DB) { ShowError("pc_checkskill: Invalid skill index %d (char_id=%d).\n", index, sd->status.char_id); return 0; } @@ -7229,7 +7237,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) * Skill point allocation *------------------------------------------*/ int pc_skillup(struct map_session_data *sd,uint16 skill_id) { - uint16 index = 0; + int index = 0; nullpo_ret(sd); if( skill_id >= GD_SKILLBASE && skill_id < GD_SKILLBASE+MAX_GUILDSKILL ) { @@ -7286,7 +7294,7 @@ int pc_allskillup(struct map_session_data *sd) nullpo_ret(sd); - for(i=0;i<MAX_SKILL;i++){ + for (i = 0; i < MAX_SKILL_DB; i++) { if (sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED) { sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; sd->status.skill[i].flag = SKILL_FLAG_PERMANENT; @@ -7297,7 +7305,7 @@ int pc_allskillup(struct map_session_data *sd) if (pc_has_permission(sd, PC_PERM_ALL_SKILL)) { //Get ALL skills except npc/guild ones. [Skotlex] //and except SG_DEVIL [Komurka] and MO_TRIPLEATTACK and RG_SNATCHER [ultramage] - for(i=0;i<MAX_SKILL;i++){ + for (i = 0; i < MAX_SKILL_DB; i++) { switch( skill->dbs->db[i].nameid ) { case SG_DEVIL: case MO_TRIPLEATTACK: @@ -7537,9 +7545,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); } - for( i = 1; i < MAX_SKILL; i++ ) { - // FIXME: We're looping on i = [1..MAX_SKILL-1] (which makes sense as index for sd->status.skill[]) but then we're using the - // same i to access skill->dbs->db[], and especially to check skill_ischangesex(). This is wrong. + for (i = 1; i < MAX_SKILL_DB; i++) { uint16 skill_id = 0; int lv = sd->status.skill[i].lv; if (lv < 1) continue; diff --git a/src/map/pc.h b/src/map/pc.h index 50cb1b68e..df0df979d 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -292,7 +292,7 @@ struct map_session_data { uint16 skill_id_old,skill_lv_old; uint16 skill_id_dance,skill_lv_dance; short cook_mastery; // range: [0,1999] [Inkfish] - bool blockskill[MAX_SKILL]; + bool blockskill[MAX_SKILL_DB]; int cloneskill_id, reproduceskill_id; int menuskill_id, menuskill_val, menuskill_val2; int invincible_timer; diff --git a/src/map/script.c b/src/map/script.c index 2d4f60f37..7f7aba183 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12190,7 +12190,7 @@ BUILDIN(homunculus_mutate) if (script_hasdata(st,2)) homun_id = script_getnum(st,2); else - homun_id = 6048 + (rnd() % 4); + homun_id = HOMID_EIRA + (rnd() % 4); m_class = homun->class2type(sd->hd->homunculus.class_); m_id = homun->class2type(homun_id); @@ -14081,53 +14081,61 @@ BUILDIN(getiteminfo) } switch (n) { - case 0: + case ITEMINFO_BUYPRICE: script_pushint(st, it->value_buy); break; - case 1: + case ITEMINFO_SELLPRICE: script_pushint(st, it->value_sell); break; - case 2: + case ITEMINFO_TYPE: script_pushint(st, it->type); break; - case 3: + case ITEMINFO_MAXCHANCE: script_pushint(st, it->maxchance); break; - case 4: + case ITEMINFO_SEX: script_pushint(st, it->sex); break; - case 5: + case ITEMINFO_LOC: script_pushint(st, it->equip); break; - case 6: + case ITEMINFO_WEIGHT: script_pushint(st, it->weight); break; - case 7: + case ITEMINFO_ATK: script_pushint(st, it->atk); break; - case 8: + case ITEMINFO_DEF: script_pushint(st, it->def); break; - case 9: + case ITEMINFO_RANGE: script_pushint(st, it->range); break; - case 10: + case ITEMINFO_SLOTS: script_pushint(st, it->slot); break; - case 11: + case ITEMINFO_SUBTYPE: script_pushint(st, it->subtype); break; - case 12: + case ITEMINFO_ELV: script_pushint(st, it->elv); break; - case 13: + case ITEMINFO_WLV: script_pushint(st, it->wlv); break; - case 14: + case ITEMINFO_VIEWID: script_pushint(st, it->view_id); break; + case ITEMINFO_MATK: + script_pushint(st, it->matk); + break; + case ITEMINFO_VIEWSPRITE: + script_pushint(st, it->view_sprite); + break; default: + ShowError("buildin_getiteminfo: Invalid item type %d.\n", n); script_pushint(st,-1); + return false; } return true; } @@ -14339,54 +14347,61 @@ BUILDIN(setiteminfo) } switch (n) { - case 0: + case ITEMINFO_BUYPRICE: it->value_buy = value; break; - case 1: + case ITEMINFO_SELLPRICE: it->value_sell = value; break; - case 2: + case ITEMINFO_TYPE: it->type = value; break; - case 3: + case ITEMINFO_MAXCHANCE: it->maxchance = value; break; - case 4: + case ITEMINFO_SEX: it->sex = value; break; - case 5: + case ITEMINFO_LOC: it->equip = value; break; - case 6: + case ITEMINFO_WEIGHT: it->weight = value; break; - case 7: + case ITEMINFO_ATK: it->atk = value; break; - case 8: + case ITEMINFO_DEF: it->def = value; break; - case 9: + case ITEMINFO_RANGE: it->range = value; break; - case 10: + case ITEMINFO_SLOTS: it->slot = value; break; - case 11: + case ITEMINFO_SUBTYPE: it->subtype = value; break; - case 12: + case ITEMINFO_ELV: it->elv = value; break; - case 13: + case ITEMINFO_WLV: it->wlv = value; break; - case 14: + case ITEMINFO_VIEWID: it->view_id = value; break; + case ITEMINFO_MATK: + it->matk = value; + break; + case ITEMINFO_VIEWSPRITE: + it->view_sprite = value; + break; default: + ShowError("buildin_setiteminfo: invalid type %d.\n", n); script_pushint(st,-1); - return true; + return false; } script_pushint(st,value); return true; @@ -14590,7 +14605,7 @@ BUILDIN(getskilllist) int i,j=0; if (sd == NULL) return true; - for(i=0;i<MAX_SKILL;i++) { + for (i = 0; i < MAX_SKILL_DB; i++) { if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0) { pc->setreg(sd,reference_uid(script->add_str("@skilllist_id"), j),sd->status.skill[i].id); pc->setreg(sd,reference_uid(script->add_str("@skilllist_lv"), j),sd->status.skill[i].lv); @@ -18217,6 +18232,8 @@ BUILDIN(setunitdata) case UDT_INTIMACY: case UDT_LIFETIME: case UDT_MERC_KILLCOUNT: + case UDT_ROBE: + case UDT_BODY2: setunitdata_check_min(4, 0); break; case UDT_MASTERAID: @@ -19155,6 +19172,40 @@ BUILDIN(setunitdata) case UDT_DMOTION: nd->status.dmotion = (unsigned short) val; break; + case UDT_SEX: + nd->vd.sex = (char)val; + npc->refresh(nd); + break; + case UDT_HAIRSTYLE: + clif->changelook(bl, LOOK_HAIR, val); + break; + case UDT_HAIRCOLOR: + clif->changelook(bl, LOOK_HAIR_COLOR, val); + break; + case UDT_HEADBOTTOM: + clif->changelook(bl, LOOK_HEAD_BOTTOM, val); + break; + case UDT_HEADMIDDLE: + clif->changelook(bl, LOOK_HEAD_MID, val); + break; + case UDT_HEADTOP: + clif->changelook(bl, LOOK_HEAD_TOP, val); + break; + case UDT_CLOTHCOLOR: + clif->changelook(bl, LOOK_CLOTHES_COLOR, val); + break; + case UDT_SHIELD: + clif->changelook(bl, LOOK_SHIELD, val); + break; + case UDT_WEAPON: + clif->changelook(bl, LOOK_WEAPON, val); + break; + case UDT_ROBE: + clif->changelook(bl, LOOK_ROBE, val); + break; + case UDT_BODY2: + clif->changelook(bl, LOOK_BODY2, val); + break; default: ShowWarning("buildin_setunitdata: Invalid data type '%s' for NPC unit.\n", udtype); script_pushint(st, 0); @@ -19565,6 +19616,18 @@ BUILDIN(getunitdata) case UDT_AMOTION: script_pushint(st, nd->status.amotion); break; case UDT_ADELAY: script_pushint(st, nd->status.adelay); break; case UDT_DMOTION: script_pushint(st, nd->status.dmotion); break; + case UDT_SEX: script_pushint(st, nd->vd.sex); break; + case UDT_CLASS: script_pushint(st, nd->vd.class); break; + case UDT_HAIRSTYLE: script_pushint(st, nd->vd.hair_style); break; + case UDT_HAIRCOLOR: script_pushint(st, nd->vd.hair_color); break; + case UDT_HEADBOTTOM: script_pushint(st, nd->vd.head_bottom); break; + case UDT_HEADMIDDLE: script_pushint(st, nd->vd.head_mid); break; + case UDT_HEADTOP: script_pushint(st, nd->vd.head_top); break; + case UDT_CLOTHCOLOR: script_pushint(st, nd->vd.cloth_color); break; + case UDT_SHIELD: script_pushint(st, nd->vd.shield); break; + case UDT_WEAPON: script_pushint(st, nd->vd.weapon); break; + case UDT_ROBE: script_pushint(st, nd->vd.robe); break; + case UDT_BODY2: script_pushint(st, nd->vd.body_style); break; default: ShowWarning("buildin_getunitdata: Invalid data type '%s' for NPC unit.\n", udtype); script_pushint(st, 0); @@ -21140,72 +21203,90 @@ BUILDIN(has_instance) const char *str; int16 m; int instance_id = -1; + int i = 0, j = 0; bool type = strcmp(script->getfuncname(st),"has_instance2") == 0 ? true : false; str = script_getstr(st, 2); - if( (m = map->mapname2mapid(str)) < 0 ) { - if( type ) + if ((m = map->mapname2mapid(str)) < 0) { + if (type) { script_pushint(st, -1); - else + } else { script_pushconststr(st, ""); + } return true; } - if( script_hasdata(st, 3) ) + if (script_hasdata(st, 3)) instance_id = script_getnum(st, 3); - else if( st->instance_id >= 0 ) + else if (st->instance_id >= 0) instance_id = st->instance_id; - else if( (sd = script->rid2sd(st)) != NULL ) { + else if ((sd = script->rid2sd(st)) != NULL) { struct party_data *p; - int i = 0, j = 0; - if( sd->instances ) { - for( i = 0; i < sd->instances; i++ ) { - if( sd->instance[i] >= 0 ) { + if (sd->instances) { + for (i = 0; i < sd->instances; i++) { + if (sd->instance[i] >= 0) { ARR_FIND(0, instance->list[sd->instance[i]].num_map, j, map->list[instance->list[sd->instance[i]].map[j]].instance_src_map == m); - if( j != instance->list[sd->instance[i]].num_map ) + if (j != instance->list[sd->instance[i]].num_map) break; } } - if( i != sd->instances ) + if (i != sd->instances) { instance_id = sd->instance[i]; + } } if (instance_id == -1 && sd->status.party_id && (p = party->search(sd->status.party_id)) != NULL && p->instances) { - for( i = 0; i < p->instances; i++ ) { - if( p->instance[i] >= 0 ) { + for (i = 0; i < p->instances; i++) { + if (p->instance[i] >= 0) { ARR_FIND(0, instance->list[p->instance[i]].num_map, j, map->list[instance->list[p->instance[i]].map[j]].instance_src_map == m); - if( j != instance->list[p->instance[i]].num_map ) + if (j != instance->list[p->instance[i]].num_map) break; } } - if( i != p->instances ) + if (i != p->instances) { instance_id = p->instance[i]; + } } - if( instance_id == -1 && sd->guild && sd->guild->instances ) { - for( i = 0; i < sd->guild->instances; i++ ) { - if( sd->guild->instance[i] >= 0 ) { + if (instance_id == -1 && sd->guild && sd->guild->instances) { + for (i = 0; i < sd->guild->instances; i++) { + if (sd->guild->instance[i] >= 0) { ARR_FIND(0, instance->list[sd->guild->instance[i]].num_map, j, map->list[instance->list[sd->guild->instance[i]].map[j]].instance_src_map == m); - if( j != instance->list[sd->guild->instance[i]].num_map ) + if (j != instance->list[sd->guild->instance[i]].num_map) break; } } - if( i != sd->guild->instances ) + if (i != sd->guild->instances) instance_id = sd->guild->instance[i]; } } - if( !instance->valid(instance_id) || (m = instance->map2imap(m, instance_id)) < 0 ) { - if( type ) + if (instance_id == -1) { + for (i = 0; i < instance->instances; i++) { + if (instance->list[i].state != INSTANCE_FREE && instance->list[i].owner_type == IOT_NONE && instance->list[i].num_map > 0) { + ARR_FIND(0, instance->list[i].num_map, j, map->list[instance->list[i].map[j]].instance_src_map == m); + if (j != instance->list[i].num_map) + break; + } + } + if (i != instance->instances) { + instance_id = instance->list[i].id; + } + } + + if (!instance->valid(instance_id) || (m = instance->map2imap(m, instance_id)) < 0) { + if (type) { script_pushint(st, -1); - else + } else { script_pushconststr(st, ""); + } return true; } - if( type ) + if (type) { script_pushint(st, instance_id); - else + } else { script_pushconststr(st, map->list[m].name); + } return true; } @@ -24763,6 +24844,25 @@ void script_hardcoded_constants(void) script->set_constant("MAPINFO_SIZE_Y", MAPINFO_SIZE_Y, false, false); script->set_constant("MAPINFO_ZONE", MAPINFO_ZONE, false, false); + script->constdb_comment("set/getiteminfo options"); + script->set_constant("ITEMINFO_BUYPRICE", ITEMINFO_BUYPRICE, false, false); + script->set_constant("ITEMINFO_SELLPRICE", ITEMINFO_SELLPRICE, false, false); + script->set_constant("ITEMINFO_TYPE", ITEMINFO_TYPE, false, false); + script->set_constant("ITEMINFO_MAXCHANCE", ITEMINFO_MAXCHANCE, false, false); + script->set_constant("ITEMINFO_SEX", ITEMINFO_SEX, false, false); + script->set_constant("ITEMINFO_LOC", ITEMINFO_LOC, false, false); + script->set_constant("ITEMINFO_WEIGHT", ITEMINFO_WEIGHT, false, false); + script->set_constant("ITEMINFO_ATK", ITEMINFO_ATK, false, false); + script->set_constant("ITEMINFO_DEF", ITEMINFO_DEF, false, false); + script->set_constant("ITEMINFO_RANGE", ITEMINFO_RANGE, false, false); + script->set_constant("ITEMINFO_SLOTS", ITEMINFO_SLOTS, false, false); + script->set_constant("ITEMINFO_SUBTYPE", ITEMINFO_SUBTYPE, false, false); + script->set_constant("ITEMINFO_ELV", ITEMINFO_ELV, false, false); + script->set_constant("ITEMINFO_WLV", ITEMINFO_WLV, false, false); + script->set_constant("ITEMINFO_VIEWID", ITEMINFO_VIEWID, false, false); + script->set_constant("ITEMINFO_MATK", ITEMINFO_MATK, false, false); + script->set_constant("ITEMINFO_VIEWSPRITE", ITEMINFO_VIEWSPRITE, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); diff --git a/src/map/script.h b/src/map/script.h index 283afa496..14d20838d 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -423,10 +423,37 @@ enum script_unit_data_types { UDT_LIFETIME, UDT_MERC_KILLCOUNT, UDT_STATPOINT, + UDT_ROBE, + UDT_BODY2, UDT_MAX }; /** + * Item Info types. + */ +enum script_iteminfo_types { + ITEMINFO_BUYPRICE = 0, + ITEMINFO_SELLPRICE, + ITEMINFO_TYPE, + ITEMINFO_MAXCHANCE, + ITEMINFO_SEX, + ITEMINFO_LOC, + ITEMINFO_WEIGHT, + ITEMINFO_ATK, + ITEMINFO_DEF, + ITEMINFO_RANGE, + ITEMINFO_SLOTS, + ITEMINFO_SUBTYPE, + ITEMINFO_ELV, + ITEMINFO_WLV, + ITEMINFO_VIEWID, + ITEMINFO_MATK, + ITEMINFO_VIEWSPRITE, + + ITEMINFO_MAX +}; + +/** * Structures **/ diff --git a/src/map/skill.c b/src/map/skill.c index 726deaa9a..88a29b9a8 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -105,7 +105,7 @@ int skill_name2id(const char* name) /// Maps skill ids to skill db offsets. /// Returns the skill's array index, or 0 (Unknown Skill). -int skill_get_index (uint16 skill_id) +int skill_get_index(int skill_id) { // avoid ranges reserved for mapping guild/homun/mercenary skills if( (skill_id >= GD_SKILLRANGEMIN && skill_id <= GD_SKILLRANGEMAX) @@ -138,88 +138,593 @@ int skill_get_index (uint16 skill_id) } // validate result - if( !skill_id || skill_id >= MAX_SKILL_DB ) + if (skill_id <= 0|| skill_id >= MAX_SKILL_DB) return 0; return skill_id; } -const char* skill_get_name( uint16 skill_id ) { +const char *skill_get_name(int skill_id) +{ return skill->dbs->db[skill->get_index(skill_id)].name; } -const char* skill_get_desc( uint16 skill_id ) { +const char *skill_get_desc(int skill_id) +{ return skill->dbs->db[skill->get_index(skill_id)].desc; } -// out of bounds error checking [celest] -void skill_chk(uint16* skill_id) { - *skill_id = skill->get_index(*skill_id); // checks/adjusts id -} +#define skill_get_lvl_idx(lv) (min((lv), MAX_SKILL_LEVEL) - 1) +#define skill_adjust_over_level(val, lv, max_lv) ((val) > 1 ? ((val) + ((lv) - (max_lv)) / 2) : (val)) -#define skill_get(var,id) do { skill->chk(&(id)); if(!(id)) return 0; return (var); } while(0) -#define skill_get2(var,id,lv) do { \ - skill->chk(&(id)); \ - if(!(id)) return 0; \ - if( (lv) > MAX_SKILL_LEVEL && (var) > 1 ) { \ - int lv2__ = (lv); (lv) = skill->dbs->db[(id)].max; \ - return (var) + ((lv2__-(lv))/2);\ - } \ - return (var);\ -} while(0) -#define skill_glv(lv) min((lv),MAX_SKILL_LEVEL-1) // Skill DB -int skill_get_hit( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].hit, skill_id); } -int skill_get_inf( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].inf, skill_id); } -int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get (skill->dbs->db[skill_id].element[skill_glv(skill_lv-1)], skill_id); } -int skill_get_nk( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].nk, skill_id); } -int skill_get_max( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].max, skill_id); } -int skill_get_range( uint16 skill_id , uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].range[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 ( (skill->dbs->db[skill_id].splash[skill_glv(skill_lv-1)]>=0?skill->dbs->db[skill_id].splash[skill_glv(skill_lv-1)]:AREA_SIZE), skill_id, skill_lv); } -int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].hp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].sp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].hp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].sp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_state(uint16 skill_id) { skill_get (skill->dbs->db[skill_id].state, skill_id); } -int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].spiritball[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill->dbs->db[skill_id].itemid[idx], skill_id); } -int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill->dbs->db[skill_id].amount[idx], skill_id); } -int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].zeny[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].num[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].cast[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].delay[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].walkdelay[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].upkeep_time[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].upkeep_time2[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_castdef( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].cast_def_rate, skill_id); } -int skill_get_weapontype( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].weapon, skill_id); } -int skill_get_ammotype( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].ammo, skill_id); } -int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].ammo_qty[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_inf2( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].inf2, skill_id); } -int skill_get_castcancel( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].castcancel, skill_id); } -int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].maxcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].blewcount[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].mhp[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].castnodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].delaynodex[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_type( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].skill_type, skill_id); } -int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill->dbs->db[skill_id].unit_id[flag], skill_id); } -int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_interval, skill_id); } -int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].unit_range[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_unit_target( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_target&BCT_ALL, skill_id); } -int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_target&BL_ALL, skill_id); } -int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill->dbs->db[skill_id].unit_flag, skill_id); } -int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); } -int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) { + +int skill_get_hit(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].hit; +} + +int skill_get_inf(int skill_id) +{ + int idx; + if (skill_id == 0) + return INF_NONE; + idx = skill->get_index(skill_id); + Assert_retr(INF_NONE, idx != 0); + return skill->dbs->db[idx].inf; +} + +int skill_get_ele(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return ELE_NEUTRAL; + idx = skill->get_index(skill_id); + Assert_retr(ELE_NEUTRAL, idx != 0); + Assert_retr(ELE_NEUTRAL, skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].element[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].element[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_nk(int skill_id) +{ + int idx; + if (skill_id == 0) + return NK_NONE; + idx = skill->get_index(skill_id); + Assert_retr(NK_NONE, idx != 0); + return skill->dbs->db[idx].nk; +} + +int skill_get_max(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].max; +} + +int skill_get_range(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].range[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].range[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_splash(int skill_id, int skill_lv) +{ + int idx, val; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + val = skill->dbs->db[idx].splash[skill_get_lvl_idx(skill_lv)]; + if (val < 0) { + val = AREA_SIZE; + } + if (skill_lv > MAX_SKILL_LEVEL) { + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return val; +} + +int skill_get_hp(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].hp[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].hp[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_sp(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].sp[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].sp[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_hp_rate(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].hp_rate[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].hp_rate[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_sp_rate(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].sp_rate[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].sp_rate[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_state(int skill_id) +{ + int idx; + if (skill_id == 0) + return ST_NONE; + idx = skill->get_index(skill_id); + Assert_retr(ST_NONE, idx != 0); + return skill->dbs->db[idx].state; +} + +int skill_get_spiritball(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].spiritball[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].spiritball[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_itemid(int skill_id, int item_idx) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(item_idx >= 0 && item_idx < MAX_SKILL_ITEM_REQUIRE); + return skill->dbs->db[idx].itemid[item_idx]; +} + +int skill_get_itemqty(int skill_id, int item_idx) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(item_idx >= 0 && item_idx < MAX_SKILL_ITEM_REQUIRE); + return skill->dbs->db[idx].amount[item_idx]; +} + +int skill_get_zeny(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].zeny[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].zeny[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_num(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].num[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].num[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_cast(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].cast[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].cast[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_delay(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].delay[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].delay[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_walkdelay(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].walkdelay[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].walkdelay[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_time(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].upkeep_time[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].upkeep_time[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_time2(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].upkeep_time2[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].upkeep_time2[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_castdef(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].cast_def_rate; +} + +int skill_get_weapontype(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].weapon; +} + +int skill_get_ammotype(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].ammo; +} + +int skill_get_ammo_qty(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].ammo_qty[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].ammo_qty[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_inf2(int skill_id) +{ + int idx; + if (skill_id == 0) + return INF2_NONE; + idx = skill->get_index(skill_id); + Assert_retr(INF2_NONE, idx != 0); + return skill->dbs->db[idx].inf2; +} + +int skill_get_castcancel(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].castcancel; +} + +int skill_get_maxcount(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].maxcount[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].maxcount[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_blewcount(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].blewcount[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].blewcount[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_mhp(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].mhp[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].mhp[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_castnodex(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].castnodex[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].castnodex[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_delaynodex(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].delaynodex[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].delaynodex[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_type(int skill_id) +{ + int idx; + if (skill_id == 0) + return BF_NONE; + idx = skill->get_index(skill_id); + Assert_retr(BF_NONE, idx != 0); + return skill->dbs->db[idx].skill_type; +} + +int skill_get_unit_id(int skill_id, int flag) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(flag >= 0 && flag < ARRAYLENGTH(skill->dbs->db[0].unit_id)); + return skill->dbs->db[idx].unit_id[flag]; +} + +int skill_get_unit_interval(int skill_id) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + return skill->dbs->db[idx].unit_interval; +} + +int skill_get_unit_range(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].unit_range[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].unit_range[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_unit_target(int skill_id) +{ + int idx; + if (skill_id == 0) + return BCT_NOONE; + idx = skill->get_index(skill_id); + Assert_retr(BCT_NOONE, idx != 0); + return skill->dbs->db[idx].unit_target & BCT_ALL; +} + +int skill_get_unit_bl_target(int skill_id) +{ + int idx; + if (skill_id == 0) + return BL_NUL; + idx = skill->get_index(skill_id); + Assert_retr(BL_NUL, idx != 0); + return skill->dbs->db[idx].unit_target & BL_ALL; +} + +int skill_get_unit_flag(int skill_id) +{ + int idx; + if (skill_id == 0) + return UF_NONE; + idx = skill->get_index(skill_id); + Assert_retr(UF_NONE, idx != 0); + return skill->dbs->db[idx].unit_flag; +} + +int skill_get_unit_layout_type(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].unit_layout_type[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].unit_layout_type[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_cooldown(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].cooldown[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].cooldown[skill_get_lvl_idx(skill_lv)]; +} + +int skill_get_fixed_cast(int skill_id, int skill_lv) +{ + int idx; + if (skill_id == 0) + return 0; + idx = skill->get_index(skill_id); + Assert_ret(idx != 0); + Assert_ret(skill_lv > 0); #ifdef RENEWAL_CAST - Assert_ret(skill_lv > 0); skill_get2 (skill->dbs->db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv); + if (skill_lv > MAX_SKILL_LEVEL) { + int val = skill->dbs->db[idx].fixed_cast[skill_get_lvl_idx(skill_lv)]; + return skill_adjust_over_level(val, skill_lv, skill->dbs->db[idx].max); + } + return skill->dbs->db[idx].fixed_cast[skill_get_lvl_idx(skill_lv)]; #else return 0; #endif } -int skill_tree_get_max(uint16 skill_id, int class) +int skill_tree_get_max(int skill_id, int class) { int i; int class_idx = pc->class2idx(class); @@ -231,7 +736,7 @@ int skill_tree_get_max(uint16 skill_id, int class) return skill->get_max(skill_id); } -int skill_get_casttype(uint16 skill_id) +int skill_get_casttype(int skill_id) { int inf = skill->get_inf(skill_id); if (inf&(INF_GROUND_SKILL)) @@ -248,7 +753,7 @@ int skill_get_casttype(uint16 skill_id) return CAST_DAMAGE; } -int skill_get_casttype2(uint16 index) +int skill_get_casttype2(int index) { int inf; Assert_retr(CAST_NODAMAGE, index < MAX_SKILL_DB); @@ -268,7 +773,7 @@ int skill_get_casttype2(uint16 index) } //Returns actual skill range taking into account attack range and AC_OWL [Skotlex] -int skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv) +int skill_get_range2(struct block_list *bl, int skill_id, int skill_lv) { int range; struct map_session_data *sd = BL_CAST(BL_PC, bl); @@ -3175,8 +3680,8 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, struct status_data *st; struct map_session_data *sd = NULL; int i, hp, sp, hp_rate, sp_rate, state, mhp; - uint16 idx; - int itemid[MAX_SKILL_ITEM_REQUIRE],amount[ARRAYLENGTH(itemid)],index[ARRAYLENGTH(itemid)]; + int idx; + int itemid[MAX_SKILL_ITEM_REQUIRE], amount[MAX_SKILL_ITEM_REQUIRE], index[MAX_SKILL_ITEM_REQUIRE]; if( lv < 1 || lv > MAX_SKILL_LEVEL ) return 0; @@ -3192,8 +3697,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv, return 0; // Requirements - for( i = 0; i < ARRAYLENGTH(itemid); i++ ) - { + for (i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++) { itemid[i] = skill->dbs->db[idx].itemid[i]; amount[i] = skill->dbs->db[idx].amount[i]; } @@ -6666,7 +7170,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin // custom hack to make the mob display the skill, because these skills don't show the skill use text themselves //NOTE: mobs don't have the sprite animation that is used when performing this skill (will cause glitches) char temp[70]; - snprintf(temp, sizeof(temp), "%s : %s !!",md->name,skill->dbs->db[skill_id].desc); + snprintf(temp, sizeof(temp), "%s : %s !!", md->name, skill->get_desc(skill_id)); clif->disp_overhead(&md->bl,temp); } break; @@ -6865,7 +7369,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin return 1; } if( sd->skillitem != skill_id ) - status_zap(src,0,skill->dbs->db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded + status_zap(src, 0, skill->get_sp(skill_id, skill_lv)); // consume sp only if succeeded } break; @@ -7041,21 +7545,22 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin return 1; } if( sd ) { - int x,bonus=100, potion = min(500+skill_lv,505); - x = skill_lv%11 - 1; - i = pc->search_inventory(sd,skill->dbs->db[skill_id].itemid[x]); - if (i == INDEX_NOT_FOUND || skill->dbs->db[skill_id].itemid[x] <= 0) { + int bonus = 100, potion = min(500+skill_lv,505); + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + int item_id = skill->get_itemid(skill_id, item_idx); + int inventory_idx = pc->search_inventory(sd, item_id); + if (inventory_idx == INDEX_NOT_FOUND || item_id <= 0) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; } - if(sd->inventory_data[i] == NULL || sd->status.inventory[i].amount < skill->dbs->db[skill_id].amount[x]) { + if (sd->inventory_data[inventory_idx] == NULL || sd->status.inventory[inventory_idx].amount < skill->get_itemqty(skill_id, item_idx)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; } if( skill_id == AM_BERSERKPITCHER ) { - if (dstsd && dstsd->status.base_level < sd->inventory_data[i]->elv) { + if (dstsd != NULL && dstsd->status.base_level < sd->inventory_data[inventory_idx]->elv) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); map->freeblock_unlock(); return 1; @@ -7064,7 +7569,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin script->potion_flag = 1; script->potion_hp = script->potion_sp = script->potion_per_hp = script->potion_per_sp = 0; script->potion_target = bl->id; - script->run_use_script(sd, sd->inventory_data[i], 0); + script->run_use_script(sd, sd->inventory_data[inventory_idx], 0); script->potion_flag = script->potion_target = 0; if( sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_ALCHEMIST ) bonus += sd->status.base_level; @@ -7384,7 +7889,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin maxlv = skill_lv - 4; } else if(skill_lv >=2) { - int i = rnd()%3; + int i = rnd() % ARRAYLENGTH(spellarray); spellid = spellarray[i]; maxlv = skill_lv - 1; } @@ -7591,14 +8096,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case WE_MALE: { - int hp_rate = (!skill_lv)? 0:skill->dbs->db[skill_id].hp_rate[skill_lv-1]; + int hp_rate = skill_lv == 0 ? 0 : skill->get_hp_rate(skill_id, skill_lv); int gain_hp = tstatus->max_hp*abs(hp_rate)/100; // The earned is the same % of the target HP than it cost the caster. [Skotlex] clif->skill_nodamage(src,bl,skill_id,status->heal(bl, gain_hp, 0, 0),1); } break; case WE_FEMALE: { - int sp_rate = (!skill_lv)? 0:skill->dbs->db[skill_id].sp_rate[skill_lv-1]; + int sp_rate = skill_lv == 0 ? 0 : skill->get_sp_rate(skill_id, skill_lv); int gain_sp = tstatus->max_sp*abs(sp_rate)/100;// The earned is the same % of the target SP than it cost the caster. [Skotlex] clif->skill_nodamage(src,bl,skill_id,status->heal(bl, 0, gain_sp, 0),1); } @@ -7661,16 +8166,17 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( battle_config.skill_removetrap_type ) { int i; // get back all items used to deploy the trap - for( i = 0; i < 10; i++ ) { - if( skill->dbs->db[su->group->skill_id].itemid[i] > 0 ) { + for (i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++) { + int nameid = skill->get_itemid(su->group->skill_id, i); + if (nameid > 0) { int success; - struct item item_tmp; - memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid = skill->dbs->db[su->group->skill_id].itemid[i]; + struct item item_tmp = { 0 }; + int amount = skill->get_itemqty(su->group->skill_id, i); + item_tmp.nameid = nameid; item_tmp.identify = 1; - if (item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_SKILL)) != 0) { + if ((success = pc->additem(sd, &item_tmp, amount, LOG_TYPE_SKILL)) != 0) { clif->additem(sd,0,0,success); - map->addflooritem(&sd->bl, &item_tmp, skill->dbs->db[su->group->skill_id].amount[i], sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); + map->addflooritem(&sd->bl, &item_tmp, amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -7902,7 +8408,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin map->freeblock_unlock(); return 0; } - status_zap(src,0,skill->dbs->db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish] + status_zap(src, 0, skill->get_sp(skill_id, skill_lv)); // consume sp only if succeeded [Inkfish] do { int eff = rnd() % 14; if( eff == 5 ) @@ -7926,7 +8432,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->damage(src,bl,0,0,1000,0,BDT_NORMAL,0); if( !status->isdead(bl) ) { int where[] = { EQP_ARMOR, EQP_SHIELD, EQP_HELM, EQP_SHOES, EQP_GARMENT }; - skill->break_equip(bl, where[rnd()%5], 10000, BCT_ENEMY); + skill->break_equip(bl, where[rnd() % ARRAYLENGTH(where)], 10000, BCT_ENEMY); } } break; @@ -7947,7 +8453,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case 7: // stop freeze or stoned { enum sc_type sc[] = { SC_STOP, SC_FREEZE, SC_STONE }; - sc_start(src,bl,sc[rnd()%3],100,skill_lv,skill->get_time2(skill_id,skill_lv)); + sc_start(src,bl,sc[rnd() % ARRAYLENGTH(sc)],100,skill_lv,skill->get_time2(skill_id,skill_lv)); } break; case 8: // curse coma and poison @@ -10837,10 +11343,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui // Slim Pitcher [Celest] case CR_SLIMPITCHER: if (sd) { - int i = skill_lv%11 - 1; - int j = pc->search_inventory(sd,skill->dbs->db[skill_id].itemid[i]); - if (j == INDEX_NOT_FOUND || skill->dbs->db[skill_id].itemid[i] <= 0 - || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill->dbs->db[skill_id].amount[i] + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + int item_id = skill->get_itemid(skill_id, item_idx); + int inventory_idx = pc->search_inventory(sd, item_id); + int bonus; + if (inventory_idx == INDEX_NOT_FOUND || item_id <= 0 + || sd->inventory_data[inventory_idx] == NULL + || sd->status.inventory[inventory_idx].amount < skill->get_itemqty(skill_id, item_idx) ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; @@ -10848,44 +11357,44 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui script->potion_flag = 1; script->potion_hp = 0; script->potion_sp = 0; - script->run_use_script(sd, sd->inventory_data[j], 0); + script->run_use_script(sd, sd->inventory_data[inventory_idx], 0); script->potion_flag = 0; //Apply skill bonuses - i = pc->checkskill(sd,CR_SLIMPITCHER)*10 + bonus = pc->checkskill(sd,CR_SLIMPITCHER)*10 + pc->checkskill(sd,AM_POTIONPITCHER)*10 + pc->checkskill(sd,AM_LEARNINGPOTION)*5 + pc->skillheal_bonus(sd, skill_id); - script->potion_hp = script->potion_hp * (100+i)/100; - script->potion_sp = script->potion_sp * (100+i)/100; + script->potion_hp = script->potion_hp * (100 + bonus) / 100; + script->potion_sp = script->potion_sp * (100 + bonus) / 100; - if(script->potion_hp > 0 || script->potion_sp > 0) { - i = skill->get_splash(skill_id, skill_lv); + if (script->potion_hp > 0 || script->potion_sp > 0) { + r = skill->get_splash(skill_id, skill_lv); map->foreachinarea(skill->area_sub, - src->m,x-i,y-i,x+i,y+i,BL_CHAR, - src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, + src->m, x - r, y - r, x + r, y + r, BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_PARTY|BCT_GUILD|1, skill->castend_nodamage_id); } } else { - int i = skill_lv%11 - 1; - struct item_data *item; - i = skill->dbs->db[skill_id].itemid[i]; - item = itemdb->search(i); + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + int item_id = skill->get_itemid(skill_id, item_idx); + struct item_data *item = itemdb->search(item_id); + int bonus; script->potion_flag = 1; script->potion_hp = 0; script->potion_sp = 0; script->run(item->script,0,src->id,0); script->potion_flag = 0; - i = skill->get_max(CR_SLIMPITCHER)*10; + bonus = skill->get_max(CR_SLIMPITCHER)*10; - script->potion_hp = script->potion_hp * (100+i)/100; - script->potion_sp = script->potion_sp * (100+i)/100; + script->potion_hp = script->potion_hp * (100 + bonus)/100; + script->potion_sp = script->potion_sp * (100 + bonus)/100; - if(script->potion_hp > 0 || script->potion_sp > 0) { - i = skill->get_splash(skill_id, skill_lv); + if (script->potion_hp > 0 || script->potion_sp > 0) { + r = skill->get_splash(skill_id, skill_lv); map->foreachinarea(skill->area_sub, - src->m,x-i,y-i,x+i,y+i,BL_CHAR, - src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1, + src->m, x - r, y - r, x + r, y + r, BL_CHAR, + src, skill_id, skill_lv, tick, flag|BCT_PARTY|BCT_GUILD|1, skill->castend_nodamage_id); } } @@ -11636,27 +12145,27 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ int element[5]={ELE_WIND,ELE_DARK,ELE_POISON,ELE_WATER,ELE_FIRE}; val1 = st->rhw.ele; - if (!val1) - val1=element[rnd()%5]; + if (val1 == ELE_NEUTRAL) + val1 = element[rnd() % ARRAYLENGTH(element)]; - switch (val1) - { + switch (val1) { case ELE_FIRE: - subunt++; - FALLTHROUGH + subunt = 4; + break; case ELE_WATER: - subunt++; - FALLTHROUGH + subunt = 3; + break; case ELE_POISON: - subunt++; - FALLTHROUGH + subunt = 2; + break; case ELE_DARK: - subunt++; - FALLTHROUGH + subunt = 1; + break; case ELE_WIND: + subunt = 0; break; default: - subunt=rnd()%5; + subunt = rnd() % 5; break; } @@ -14824,7 +15333,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16 } for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++ ) { - if( (skill_id == AM_POTIONPITCHER || skill_id == CR_SLIMPITCHER || skill_id == CR_CULTIVATION) && i != skill_lv%11 - 1 ) + int item_idx = (skill_lv - 1) % MAX_SKILL_ITEM_REQUIRE; + if ((skill_id == AM_POTIONPITCHER || skill_id == CR_SLIMPITCHER || skill_id == CR_CULTIVATION) && i != item_idx) continue; switch( skill_id ) { @@ -16618,15 +17128,16 @@ struct skill_unit_group* skill_id2group(int group_id) /// Fatal error if nothing is available. int skill_get_new_group_id(void) { - if( skill->unit_group_newid >= MAX_SKILL_DB && skill->id2group(skill->unit_group_newid) == NULL ) + if (skill->unit_group_newid > MAX_SKILL_ID && skill->id2group(skill->unit_group_newid) == NULL) return skill->unit_group_newid++;// available - {// find next id + + { + // find next id int base_id = skill->unit_group_newid; - while( base_id != ++skill->unit_group_newid ) - { - if( skill->unit_group_newid < MAX_SKILL_DB ) - skill->unit_group_newid = MAX_SKILL_DB; - if( skill->id2group(skill->unit_group_newid) == NULL ) + while (base_id != ++skill->unit_group_newid) { + if (skill->unit_group_newid <= MAX_SKILL_ID) + skill->unit_group_newid = MAX_SKILL_ID + 1; + if (skill->id2group(skill->unit_group_newid) == NULL) return skill->unit_group_newid++;// available } // full loop, nothing available @@ -17719,7 +18230,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int difficulty = 30 + rnd()%120; // Random number between (30 ~ 150) make_per = sd->status.job_level / 4 + st->luk / 2 + st->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3) - qty = ~(5 + rnd()%5) + 1; + qty = ~(5 + rnd()%5) + 1; // FIXME[Haru]: This smells, if anyone knows the intent, please rewrite the expression in a more clear form. switch(nameid){// difficulty factor case ITEMID_APPLE_BOMB: @@ -17755,7 +18266,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, qty = 5; if( qty < 0 || (skill_lv == 1 && make_per < difficulty)){ - qty = ~qty + 1; + qty = ~qty + 1; // FIXME[Haru]: This smells. If anyone knows the intent, please rewrite the expression in a more clear form. make_per = 0; }else make_per = 10000; @@ -18012,7 +18523,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, int rate = rnd()%500; memset(&tmp_item,0,sizeof(tmp_item)); if( rate < 50) i = 4; - else if( rate < 100) i = 2+rnd()%1; + else if( rate < 100) i = 2+rnd()%1; // FIXME[Haru]: This '%1' is certainly not intended. If anyone knows the purpose, please rewrite this code. else if( rate < 250 ) i = 1; else if( rate < 500 ) i = 0; tmp_item.nameid = compensation[i]; @@ -18435,7 +18946,7 @@ int skill_blockpc_end(int tid, int64 tick, int id, intptr_t data) struct map_session_data *sd = map->id2sd(id); struct skill_cd * cd = NULL; - if (data <= 0 || data >= MAX_SKILL) + if (data <= 0 || data >= MAX_SKILL_DB) return 0; if (!sd || !sd->blockskill[data]) return 0; @@ -18571,7 +19082,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick) int skill_blockhomun_end(int tid, int64 tick, int id, intptr_t data) { struct homun_data *hd = map->id2hd(id); - if (data <= 0 || data >= MAX_SKILL) + if (data <= 0 || data >= MAX_SKILL_DB) return 0; if (hd != NULL) hd->blockskill[data] = 0; @@ -18600,7 +19111,7 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) int skill_blockmerc_end(int tid, int64 tick, int id, intptr_t data) { struct mercenary_data *md = map->id2mc(id); - if (data <= 0 || data >= MAX_SKILL) + if (data <= 0 || data >= MAX_SKILL_DB) return 0; if (md != NULL) md->blockskill[data] = 0; @@ -19651,6 +20162,12 @@ void skill_validate_skillinfo(struct config_setting_t *conf, struct s_skill_db * } else { sk->inf2 &= ~INF2_FREE_CAST_REDUCED; } + } else if (strcmpi(type, "ShowSkillScale") == 0) { + if (on) { + sk->inf2 |= INF2_SHOW_SKILL_SCALE; + } else { + sk->inf2 &= ~INF2_SHOW_SKILL_SCALE; + } } else if (strcmpi(type, "None") != 0) { skilldb_invalid_error(type, config_setting_name(t), sk->nameid); } @@ -20477,7 +20994,7 @@ bool skill_read_skilldb(const char *filename) struct config_setting_t *sk, *conf; char filepath[256]; int count=0, index=0; - bool duplicate[MAX_SKILL] = {0}; + bool duplicate[MAX_SKILL_DB] = {0}; nullpo_retr(false, filename); @@ -20902,8 +21419,12 @@ void skill_defaults(void) skill->get_hp = skill_get_hp; skill->get_mhp = skill_get_mhp; skill->get_sp = skill_get_sp; + skill->get_hp_rate = skill_get_hp_rate; + skill->get_sp_rate = skill_get_sp_rate; skill->get_state = skill_get_state; skill->get_spiritball = skill_get_spiritball; + skill->get_itemid = skill_get_itemid; + skill->get_itemqty = skill_get_itemqty; skill->get_zeny = skill_get_zeny; skill->get_num = skill_get_num; skill->get_cast = skill_get_cast; @@ -20932,7 +21453,6 @@ void skill_defaults(void) skill->tree_get_max = skill_tree_get_max; skill->get_name = skill_get_name; skill->get_desc = skill_get_desc; - skill->chk = skill_chk; skill->get_casttype = skill_get_casttype; skill->get_casttype2 = skill_get_casttype2; skill->is_combo = skill_is_combo; diff --git a/src/map/skill.h b/src/map/skill.h index bba440107..1e00e488f 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -25,7 +25,7 @@ #include "map/status.h" // enum sc_type #include "common/hercules.h" #include "common/db.h" -#include "common/mmo.h" // MAX_SKILL, struct square +#include "common/mmo.h" // MAX_SKILL_DB, struct square /** * Declarations @@ -43,7 +43,6 @@ struct status_change_entry; /** * Defines **/ -#define MAX_SKILL_DB MAX_SKILL #define MAX_SKILL_PRODUCE_DB 270 #define MAX_PRODUCE_RESOURCE 10 #define MAX_SKILL_ARROW_DB 140 @@ -77,6 +76,7 @@ struct status_change_entry; //Constants to identify the skill's inf value: enum e_skill_inf { + INF_NONE = 0x00, INF_ATTACK_SKILL = 0x01, INF_GROUND_SKILL = 0x02, INF_SELF_SKILL = 0x04, // Skills casted on self where target is automatically chosen @@ -89,6 +89,7 @@ enum e_skill_inf { //The NK value applies only to non INF_GROUND_SKILL skills //when determining skill castend function to invoke. enum e_skill_nk { + NK_NONE = 0x00, NK_NO_DAMAGE = 0x01, NK_SPLASH = 0x02|0x04, // 0x4 = splash & split NK_SPLASH_ONLY = 0x02, @@ -103,6 +104,7 @@ enum e_skill_nk { //A skill with 3 would be no damage + splash: area of effect. //Constants to identify a skill's inf2 value. enum e_skill_inf2 { + INF2_NONE = 0x00000, INF2_QUEST_SKILL = 0x00001, INF2_NPC_SKILL = 0x00002, // NPC skills are those that players can't have in their skill tree. INF2_WEDDING_SKILL = 0x00004, @@ -120,6 +122,7 @@ enum e_skill_inf2 { INF2_CHORUS_SKILL = 0x04000, // Chorus skill INF2_FREE_CAST_NORMAL = 0x08000, INF2_FREE_CAST_REDUCED = 0x10000, + INF2_SHOW_SKILL_SCALE = 0x20000, }; @@ -132,6 +135,7 @@ enum e_skill_display { }; enum { + UF_NONE = 0x0000, UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend' UF_NOREITERATION = 0x0002, // Spell cannot be stacked UF_NOFOOTSET = 0x0004, // Spell cannot be cast near/on targets @@ -158,7 +162,7 @@ enum wl_spheres { }; enum { - ST_NONE, + ST_NONE = 0, ST_HIDING, ST_CLOAKING, ST_HIDDEN, @@ -1930,54 +1934,56 @@ struct skill_interface { int unit_temp[20]; // temporary storage for tracking skill unit skill ids as players move in/out of them int unit_group_newid; /* accesssors */ - int (*get_index) ( uint16 skill_id ); - int (*get_type) ( uint16 skill_id ); - int (*get_hit) ( uint16 skill_id ); - int (*get_inf) ( uint16 skill_id ); - int (*get_ele) ( uint16 skill_id, uint16 skill_lv ); - int (*get_nk) ( uint16 skill_id ); - int (*get_max) ( uint16 skill_id ); - int (*get_range) ( uint16 skill_id, uint16 skill_lv ); - int (*get_range2) (struct block_list *bl, uint16 skill_id, uint16 skill_lv); - int (*get_splash) ( uint16 skill_id, uint16 skill_lv ); - int (*get_hp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_mhp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_sp) ( uint16 skill_id, uint16 skill_lv ); - int (*get_state) (uint16 skill_id); - int (*get_spiritball) (uint16 skill_id, uint16 skill_lv); - int (*get_zeny) ( uint16 skill_id, uint16 skill_lv ); - int (*get_num) ( uint16 skill_id, uint16 skill_lv ); - int (*get_cast) ( uint16 skill_id, uint16 skill_lv ); - int (*get_delay) ( uint16 skill_id, uint16 skill_lv ); - int (*get_walkdelay) ( uint16 skill_id, uint16 skill_lv ); - int (*get_time) ( uint16 skill_id, uint16 skill_lv ); - int (*get_time2) ( uint16 skill_id, uint16 skill_lv ); - int (*get_castnodex) ( uint16 skill_id, uint16 skill_lv ); - int (*get_delaynodex) ( uint16 skill_id ,uint16 skill_lv ); - int (*get_castdef) ( uint16 skill_id ); - int (*get_weapontype) ( uint16 skill_id ); - int (*get_ammotype) ( uint16 skill_id ); - int (*get_ammo_qty) ( uint16 skill_id, uint16 skill_lv ); - int (*get_unit_id) (uint16 skill_id,int flag); - int (*get_inf2) ( uint16 skill_id ); - int (*get_castcancel) ( uint16 skill_id ); - int (*get_maxcount) ( uint16 skill_id, uint16 skill_lv ); - int (*get_blewcount) ( uint16 skill_id, uint16 skill_lv ); - int (*get_unit_flag) ( uint16 skill_id ); - int (*get_unit_target) ( uint16 skill_id ); - int (*get_unit_interval) ( uint16 skill_id ); - int (*get_unit_bl_target) ( uint16 skill_id ); - int (*get_unit_layout_type) ( uint16 skill_id ,uint16 skill_lv ); - int (*get_unit_range) ( uint16 skill_id, uint16 skill_lv ); - int (*get_cooldown) ( uint16 skill_id, uint16 skill_lv ); - int (*tree_get_max) (uint16 skill_id, int class); - const char *(*get_name) ( uint16 skill_id ); - const char *(*get_desc) ( uint16 skill_id ); - /* check */ - void (*chk) (uint16* skill_id); + int (*get_index) (int skill_id); + int (*get_type) (int skill_id); + int (*get_hit) (int skill_id); + int (*get_inf) (int skill_id); + int (*get_ele) (int skill_id, int skill_lv); + int (*get_nk) (int skill_id); + int (*get_max) (int skill_id); + int (*get_range) (int skill_id, int skill_lv); + int (*get_range2) (struct block_list *bl, int skill_id, int skill_lv); + int (*get_splash) (int skill_id, int skill_lv); + int (*get_hp) (int skill_id, int skill_lv); + int (*get_mhp) (int skill_id, int skill_lv); + int (*get_sp) (int skill_id, int skill_lv); + int (*get_hp_rate) (int skill_id, int skill_lv); + int (*get_sp_rate) (int skill_id, int skill_lv); + int (*get_state) (int skill_id); + int (*get_spiritball) (int skill_id, int skill_lv); + int (*get_itemid) (int skill_id, int item_idx); + int (*get_itemqty) (int skill_id, int item_idx); + int (*get_zeny) (int skill_id, int skill_lv); + int (*get_num) (int skill_id, int skill_lv); + int (*get_cast) (int skill_id, int skill_lv); + int (*get_delay) (int skill_id, int skill_lv); + int (*get_walkdelay) (int skill_id, int skill_lv); + int (*get_time) (int skill_id, int skill_lv); + int (*get_time2) (int skill_id, int skill_lv); + int (*get_castnodex) (int skill_id, int skill_lv); + int (*get_delaynodex) (int skill_id, int skill_lv); + int (*get_castdef) (int skill_id); + int (*get_weapontype) (int skill_id); + int (*get_ammotype) (int skill_id); + int (*get_ammo_qty) (int skill_id, int skill_lv); + int (*get_unit_id) (int skill_id, int flag); + int (*get_inf2) (int skill_id); + int (*get_castcancel) (int skill_id); + int (*get_maxcount) (int skill_id, int skill_lv); + int (*get_blewcount) (int skill_id, int skill_lv); + int (*get_unit_flag) (int skill_id); + int (*get_unit_target) (int skill_id); + int (*get_unit_interval) (int skill_id); + int (*get_unit_bl_target) (int skill_id); + int (*get_unit_layout_type) (int skill_id, int skill_lv); + int (*get_unit_range) (int skill_id, int skill_lv); + int (*get_cooldown) (int skill_id, int skill_lv); + int (*tree_get_max) (int skill_id, int class); + const char *(*get_name) (int skill_id); + const char *(*get_desc) (int skill_id); /* whether its CAST_GROUND, CAST_DAMAGE or CAST_NODAMAGE */ - int (*get_casttype) (uint16 skill_id); - int (*get_casttype2) (uint16 index); + int (*get_casttype) (int skill_id); + int (*get_casttype2) (int index); bool (*is_combo) (int skill_id); int (*name2id) (const char* name); int (*isammotype) (struct map_session_data *sd, int skill_id); @@ -2071,7 +2077,7 @@ struct skill_interface { int (*check_condition_mob_master_sub) (struct block_list *bl, va_list ap); void (*brandishspear_first) (struct square *tc, uint8 dir, int16 x, int16 y); void (*brandishspear_dir) (struct square* tc, uint8 dir, int are); - int (*get_fixed_cast) ( uint16 skill_id ,uint16 skill_lv ); + int (*get_fixed_cast) (int skill_id, int skill_lv); int (*sit_count) (struct block_list *bl, va_list ap); int (*sit_in) (struct block_list *bl, va_list ap); int (*sit_out) (struct block_list *bl, va_list ap); diff --git a/src/map/status.c b/src/map/status.c index e0893aa36..ddb8c7e6a 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -159,7 +159,7 @@ void initChangeTables(void) for (i = 0; i < SC_MAX; i++) status->dbs->IconChangeTable[i] = SI_BLANK; - for (i = 0; i < MAX_SKILL; i++) + for (i = 0; i < MAX_SKILL_DB; i++) status->dbs->Skill2SCTable[i] = SC_NONE; for (i = 0; i < SI_MAX; i++) @@ -2329,7 +2329,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) static int calculating = 0; //Check for recursive call preemption. [Skotlex] struct status_data *bstatus; // pointer to the player's base status const struct status_change *sc; - struct s_skill b_skill[MAX_SKILL]; // previous skill tree + struct s_skill b_skill[MAX_SKILL_DB]; // previous skill tree int b_weight, b_max_weight, b_cart_weight_max, // previous weight i, k, index, skill_lv,refinedef=0; int64 i64; @@ -6809,7 +6809,7 @@ struct view_data *status_get_viewdata(struct block_list *bl) case BL_PC: return &BL_UCAST(BL_PC, bl)->vd; case BL_MOB: return BL_UCAST(BL_MOB, bl)->vd; case BL_PET: return &BL_UCAST(BL_PET, bl)->vd; - case BL_NPC: return BL_UCAST(BL_NPC, bl)->vd; + case BL_NPC: return &BL_UCAST(BL_NPC, bl)->vd; case BL_HOM: return BL_UCAST(BL_HOM, bl)->vd; case BL_MER: return BL_UCAST(BL_MER, bl)->vd; case BL_ELEM: return BL_UCAST(BL_ELEM, bl)->vd; @@ -6927,10 +6927,14 @@ void status_set_viewdata(struct block_list *bl, int class_) case BL_NPC: { struct npc_data *nd = BL_UCAST(BL_NPC, bl); - if (vd != NULL) - nd->vd = vd; - else + if (vd != NULL) { + memcpy(&nd->vd, vd, sizeof(struct view_data)); + } else if (pc->db_checkid(class_)) { + memset(&nd->vd, 0, sizeof(struct view_data)); + nd->vd.class = class_; + } else { ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name); + } } break; case BL_HOM: //[blackhole89] diff --git a/src/map/status.h b/src/map/status.h index a104c66ab..e9c2218e8 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -2257,7 +2257,7 @@ BEGIN_ZEROED_BLOCK; /* Everything within this block will be memset to 0 when sta int HP_table[CLASS_COUNT][MAX_LEVEL + 1]; int SP_table[CLASS_COUNT][MAX_LEVEL + 1]; int aspd_base[CLASS_COUNT][MAX_SINGLE_WEAPON_TYPE+1]; // +1 for RENEWAL_ASPD - sc_type Skill2SCTable[MAX_SKILL]; // skill -> status + sc_type Skill2SCTable[MAX_SKILL_DB]; // skill -> status int IconChangeTable[SC_MAX]; // status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated) unsigned int ChangeFlagTable[SC_MAX]; // status -> flags int SkillChangeTable[SC_MAX]; // status -> skill diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index b18bd84f5..4204be2e4 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2294,6 +2294,8 @@ typedef void (*HPMHOOK_pre_clif_rodex_request_items) (struct map_session_data ** typedef void (*HPMHOOK_post_clif_rodex_request_items) (struct map_session_data *sd, int8 opentype, int64 mail_id, int8 result); typedef void (*HPMHOOK_pre_clif_rodex_icon) (int *fd, bool *show); typedef void (*HPMHOOK_post_clif_rodex_icon) (int fd, bool show); +typedef void (*HPMHOOK_pre_clif_skill_scale) (struct block_list **bl, int *src_id, int *x, int *y, uint16 *skill_id, uint16 *skill_lv, int *casttime); +typedef void (*HPMHOOK_post_clif_skill_scale) (struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); @@ -5150,6 +5152,8 @@ typedef void (*HPMHOOK_pre_npc_market_delfromsql_sub) (const char **npcname, uns typedef void (*HPMHOOK_post_npc_market_delfromsql_sub) (const char *npcname, unsigned short index); typedef bool (*HPMHOOK_pre_npc_db_checkid) (const int *id); typedef bool (*HPMHOOK_post_npc_db_checkid) (bool retVal___, const int id); +typedef void (*HPMHOOK_pre_npc_refresh) (struct npc_data **nd); +typedef void (*HPMHOOK_post_npc_refresh) (struct npc_data *nd); typedef int (*HPMHOOK_pre_npc_secure_timeout_timer) (int *tid, int64 *tick, int *id, intptr_t *data); typedef int (*HPMHOOK_post_npc_secure_timeout_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); #endif // MAP_NPC_H @@ -6356,98 +6360,104 @@ typedef void (*HPMHOOK_pre_skill_reload) (void); typedef void (*HPMHOOK_post_skill_reload) (void); typedef void (*HPMHOOK_pre_skill_read_db) (bool *minimal); typedef void (*HPMHOOK_post_skill_read_db) (bool minimal); -typedef int (*HPMHOOK_pre_skill_get_index) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_index) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_type) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_type) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_hit) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_hit) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_inf) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_inf) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_ele) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_ele) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_nk) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_nk) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_max) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_max) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_range) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_range) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_range2) (struct block_list **bl, uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_range2) (int retVal___, struct block_list *bl, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_splash) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_splash) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_hp) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_hp) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_mhp) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_mhp) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_sp) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_sp) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_state) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_state) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_spiritball) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_spiritball) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_zeny) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_zeny) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_num) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_num) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_cast) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_cast) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_delay) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_delay) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_walkdelay) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_walkdelay) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_time) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_time) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_time2) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_time2) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_castnodex) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_castnodex) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_delaynodex) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_delaynodex) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_castdef) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_castdef) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_weapontype) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_weapontype) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_ammotype) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_ammotype) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_ammo_qty) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_ammo_qty) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_unit_id) (uint16 *skill_id, int *flag); -typedef int (*HPMHOOK_post_skill_get_unit_id) (int retVal___, uint16 skill_id, int flag); -typedef int (*HPMHOOK_pre_skill_get_inf2) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_inf2) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_castcancel) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_castcancel) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_maxcount) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_maxcount) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_blewcount) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_blewcount) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_unit_flag) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_unit_flag) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_unit_target) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_unit_target) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_unit_interval) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_unit_interval) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_unit_bl_target) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_unit_bl_target) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_unit_layout_type) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_unit_layout_type) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_unit_range) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_unit_range) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_get_cooldown) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_cooldown) (int retVal___, uint16 skill_id, uint16 skill_lv); -typedef int (*HPMHOOK_pre_skill_tree_get_max) (uint16 *skill_id, int *class); -typedef int (*HPMHOOK_post_skill_tree_get_max) (int retVal___, uint16 skill_id, int class); -typedef const char* (*HPMHOOK_pre_skill_get_name) (uint16 *skill_id); -typedef const char* (*HPMHOOK_post_skill_get_name) (const char* retVal___, uint16 skill_id); -typedef const char* (*HPMHOOK_pre_skill_get_desc) (uint16 *skill_id); -typedef const char* (*HPMHOOK_post_skill_get_desc) (const char* retVal___, uint16 skill_id); -typedef void (*HPMHOOK_pre_skill_chk) (uint16 **skill_id); -typedef void (*HPMHOOK_post_skill_chk) (uint16 *skill_id); -typedef int (*HPMHOOK_pre_skill_get_casttype) (uint16 *skill_id); -typedef int (*HPMHOOK_post_skill_get_casttype) (int retVal___, uint16 skill_id); -typedef int (*HPMHOOK_pre_skill_get_casttype2) (uint16 *index); -typedef int (*HPMHOOK_post_skill_get_casttype2) (int retVal___, uint16 index); +typedef int (*HPMHOOK_pre_skill_get_index) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_index) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_type) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_type) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_hit) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_hit) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_inf) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_inf) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_ele) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_ele) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_nk) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_nk) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_max) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_max) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_range) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_range) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_range2) (struct block_list **bl, int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_range2) (int retVal___, struct block_list *bl, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_splash) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_splash) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_hp) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_hp) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_mhp) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_mhp) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_sp) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_sp) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_hp_rate) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_hp_rate) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_sp_rate) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_sp_rate) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_state) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_state) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_spiritball) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_spiritball) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_itemid) (int *skill_id, int *item_idx); +typedef int (*HPMHOOK_post_skill_get_itemid) (int retVal___, int skill_id, int item_idx); +typedef int (*HPMHOOK_pre_skill_get_itemqty) (int *skill_id, int *item_idx); +typedef int (*HPMHOOK_post_skill_get_itemqty) (int retVal___, int skill_id, int item_idx); +typedef int (*HPMHOOK_pre_skill_get_zeny) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_zeny) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_num) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_num) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_cast) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_cast) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_delay) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_delay) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_walkdelay) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_walkdelay) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_time) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_time) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_time2) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_time2) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_castnodex) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_castnodex) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_delaynodex) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_delaynodex) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_castdef) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_castdef) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_weapontype) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_weapontype) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_ammotype) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_ammotype) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_ammo_qty) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_ammo_qty) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_unit_id) (int *skill_id, int *flag); +typedef int (*HPMHOOK_post_skill_get_unit_id) (int retVal___, int skill_id, int flag); +typedef int (*HPMHOOK_pre_skill_get_inf2) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_inf2) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_castcancel) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_castcancel) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_maxcount) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_maxcount) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_blewcount) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_blewcount) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_unit_flag) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_unit_flag) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_unit_target) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_unit_target) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_unit_interval) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_unit_interval) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_unit_bl_target) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_unit_bl_target) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_unit_layout_type) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_unit_layout_type) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_unit_range) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_unit_range) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_get_cooldown) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_cooldown) (int retVal___, int skill_id, int skill_lv); +typedef int (*HPMHOOK_pre_skill_tree_get_max) (int *skill_id, int *class); +typedef int (*HPMHOOK_post_skill_tree_get_max) (int retVal___, int skill_id, int class); +typedef const char* (*HPMHOOK_pre_skill_get_name) (int *skill_id); +typedef const char* (*HPMHOOK_post_skill_get_name) (const char* retVal___, int skill_id); +typedef const char* (*HPMHOOK_pre_skill_get_desc) (int *skill_id); +typedef const char* (*HPMHOOK_post_skill_get_desc) (const char* retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_casttype) (int *skill_id); +typedef int (*HPMHOOK_post_skill_get_casttype) (int retVal___, int skill_id); +typedef int (*HPMHOOK_pre_skill_get_casttype2) (int *index); +typedef int (*HPMHOOK_post_skill_get_casttype2) (int retVal___, int index); typedef bool (*HPMHOOK_pre_skill_is_combo) (int *skill_id); typedef bool (*HPMHOOK_post_skill_is_combo) (bool retVal___, int skill_id); typedef int (*HPMHOOK_pre_skill_name2id) (const char **name); @@ -6634,8 +6644,8 @@ typedef void (*HPMHOOK_pre_skill_brandishspear_first) (struct square **tc, uint8 typedef void (*HPMHOOK_post_skill_brandishspear_first) (struct square *tc, uint8 dir, int16 x, int16 y); typedef void (*HPMHOOK_pre_skill_brandishspear_dir) (struct square **tc, uint8 *dir, int *are); typedef void (*HPMHOOK_post_skill_brandishspear_dir) (struct square *tc, uint8 dir, int are); -typedef int (*HPMHOOK_pre_skill_get_fixed_cast) (uint16 *skill_id, uint16 *skill_lv); -typedef int (*HPMHOOK_post_skill_get_fixed_cast) (int retVal___, uint16 skill_id, uint16 skill_lv); +typedef int (*HPMHOOK_pre_skill_get_fixed_cast) (int *skill_id, int *skill_lv); +typedef int (*HPMHOOK_post_skill_get_fixed_cast) (int retVal___, int skill_id, int skill_lv); typedef int (*HPMHOOK_pre_skill_sit_count) (struct block_list **bl, va_list ap); typedef int (*HPMHOOK_post_skill_sit_count) (int retVal___, struct block_list *bl, va_list ap); typedef int (*HPMHOOK_pre_skill_sit_in) (struct block_list **bl, va_list ap); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index a2679a551..cc097aeae 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -1930,6 +1930,8 @@ struct { struct HPMHookPoint *HP_clif_rodex_request_items_post; struct HPMHookPoint *HP_clif_rodex_icon_pre; struct HPMHookPoint *HP_clif_rodex_icon_post; + struct HPMHookPoint *HP_clif_skill_scale_pre; + struct HPMHookPoint *HP_clif_skill_scale_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -3918,6 +3920,8 @@ struct { struct HPMHookPoint *HP_npc_market_delfromsql_sub_post; struct HPMHookPoint *HP_npc_db_checkid_pre; struct HPMHookPoint *HP_npc_db_checkid_post; + struct HPMHookPoint *HP_npc_refresh_pre; + struct HPMHookPoint *HP_npc_refresh_post; struct HPMHookPoint *HP_npc_secure_timeout_timer_pre; struct HPMHookPoint *HP_npc_secure_timeout_timer_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; @@ -5100,10 +5104,18 @@ struct { struct HPMHookPoint *HP_skill_get_mhp_post; struct HPMHookPoint *HP_skill_get_sp_pre; struct HPMHookPoint *HP_skill_get_sp_post; + struct HPMHookPoint *HP_skill_get_hp_rate_pre; + struct HPMHookPoint *HP_skill_get_hp_rate_post; + struct HPMHookPoint *HP_skill_get_sp_rate_pre; + struct HPMHookPoint *HP_skill_get_sp_rate_post; struct HPMHookPoint *HP_skill_get_state_pre; struct HPMHookPoint *HP_skill_get_state_post; struct HPMHookPoint *HP_skill_get_spiritball_pre; struct HPMHookPoint *HP_skill_get_spiritball_post; + struct HPMHookPoint *HP_skill_get_itemid_pre; + struct HPMHookPoint *HP_skill_get_itemid_post; + struct HPMHookPoint *HP_skill_get_itemqty_pre; + struct HPMHookPoint *HP_skill_get_itemqty_post; struct HPMHookPoint *HP_skill_get_zeny_pre; struct HPMHookPoint *HP_skill_get_zeny_post; struct HPMHookPoint *HP_skill_get_num_pre; @@ -5160,8 +5172,6 @@ struct { struct HPMHookPoint *HP_skill_get_name_post; struct HPMHookPoint *HP_skill_get_desc_pre; struct HPMHookPoint *HP_skill_get_desc_post; - struct HPMHookPoint *HP_skill_chk_pre; - struct HPMHookPoint *HP_skill_chk_post; struct HPMHookPoint *HP_skill_get_casttype_pre; struct HPMHookPoint *HP_skill_get_casttype_post; struct HPMHookPoint *HP_skill_get_casttype2_pre; @@ -8129,6 +8139,8 @@ struct { int HP_clif_rodex_request_items_post; int HP_clif_rodex_icon_pre; int HP_clif_rodex_icon_post; + int HP_clif_skill_scale_pre; + int HP_clif_skill_scale_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; @@ -10117,6 +10129,8 @@ struct { int HP_npc_market_delfromsql_sub_post; int HP_npc_db_checkid_pre; int HP_npc_db_checkid_post; + int HP_npc_refresh_pre; + int HP_npc_refresh_post; int HP_npc_secure_timeout_timer_pre; int HP_npc_secure_timeout_timer_post; int HP_nullpo_assert_report_pre; @@ -11299,10 +11313,18 @@ struct { int HP_skill_get_mhp_post; int HP_skill_get_sp_pre; int HP_skill_get_sp_post; + int HP_skill_get_hp_rate_pre; + int HP_skill_get_hp_rate_post; + int HP_skill_get_sp_rate_pre; + int HP_skill_get_sp_rate_post; int HP_skill_get_state_pre; int HP_skill_get_state_post; int HP_skill_get_spiritball_pre; int HP_skill_get_spiritball_post; + int HP_skill_get_itemid_pre; + int HP_skill_get_itemid_post; + int HP_skill_get_itemqty_pre; + int HP_skill_get_itemqty_post; int HP_skill_get_zeny_pre; int HP_skill_get_zeny_post; int HP_skill_get_num_pre; @@ -11359,8 +11381,6 @@ struct { int HP_skill_get_name_post; int HP_skill_get_desc_pre; int HP_skill_get_desc_post; - int HP_skill_chk_pre; - int HP_skill_chk_post; int HP_skill_get_casttype_pre; int HP_skill_get_casttype_post; int HP_skill_get_casttype2_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 3a3a7177e..7caf25de6 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -987,6 +987,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pRodexRequestItems, HP_clif_pRodexRequestItems) }, { HP_POP(clif->rodex_request_items, HP_clif_rodex_request_items) }, { HP_POP(clif->rodex_icon, HP_clif_rodex_icon) }, + { HP_POP(clif->skill_scale, HP_clif_skill_scale) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, @@ -2009,6 +2010,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(npc->market_delfromsql, HP_npc_market_delfromsql) }, { HP_POP(npc->market_delfromsql_sub, HP_npc_market_delfromsql_sub) }, { HP_POP(npc->db_checkid, HP_npc_db_checkid) }, + { HP_POP(npc->refresh, HP_npc_refresh) }, { HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, @@ -2614,8 +2616,12 @@ struct HookingPointData HookingPoints[] = { { HP_POP(skill->get_hp, HP_skill_get_hp) }, { HP_POP(skill->get_mhp, HP_skill_get_mhp) }, { HP_POP(skill->get_sp, HP_skill_get_sp) }, + { HP_POP(skill->get_hp_rate, HP_skill_get_hp_rate) }, + { HP_POP(skill->get_sp_rate, HP_skill_get_sp_rate) }, { HP_POP(skill->get_state, HP_skill_get_state) }, { HP_POP(skill->get_spiritball, HP_skill_get_spiritball) }, + { HP_POP(skill->get_itemid, HP_skill_get_itemid) }, + { HP_POP(skill->get_itemqty, HP_skill_get_itemqty) }, { HP_POP(skill->get_zeny, HP_skill_get_zeny) }, { HP_POP(skill->get_num, HP_skill_get_num) }, { HP_POP(skill->get_cast, HP_skill_get_cast) }, @@ -2644,7 +2650,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(skill->tree_get_max, HP_skill_tree_get_max) }, { HP_POP(skill->get_name, HP_skill_get_name) }, { HP_POP(skill->get_desc, HP_skill_get_desc) }, - { HP_POP(skill->chk, HP_skill_chk) }, { HP_POP(skill->get_casttype, HP_skill_get_casttype) }, { HP_POP(skill->get_casttype2, HP_skill_get_casttype2) }, { HP_POP(skill->is_combo, HP_skill_is_combo) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 59464109d..4340f8dbd 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -25113,6 +25113,32 @@ void HP_clif_rodex_icon(int fd, bool show) { } return; } +void HP_clif_skill_scale(struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_skill_scale_pre > 0) { + void (*preHookFunc) (struct block_list **bl, int *src_id, int *x, int *y, uint16 *skill_id, uint16 *skill_lv, int *casttime); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_skill_scale_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_skill_scale_pre[hIndex].func; + preHookFunc(&bl, &src_id, &x, &y, &skill_id, &skill_lv, &casttime); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.skill_scale(bl, src_id, x, y, skill_id, skill_lv, casttime); + } + if (HPMHooks.count.HP_clif_skill_scale_post > 0) { + void (*postHookFunc) (struct block_list *bl, int src_id, int x, int y, uint16 skill_id, uint16 skill_lv, int casttime); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_skill_scale_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_skill_scale_post[hIndex].func; + postHookFunc(bl, src_id, x, y, skill_id, skill_lv, casttime); + } + } + return; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; @@ -52089,6 +52115,32 @@ bool HP_npc_db_checkid(const int id) { } return retVal___; } +void HP_npc_refresh(struct npc_data *nd) { + int hIndex = 0; + if (HPMHooks.count.HP_npc_refresh_pre > 0) { + void (*preHookFunc) (struct npc_data **nd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_refresh_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_npc_refresh_pre[hIndex].func; + preHookFunc(&nd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc.refresh(nd); + } + if (HPMHooks.count.HP_npc_refresh_post > 0) { + void (*postHookFunc) (struct npc_data *nd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_refresh_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_npc_refresh_post[hIndex].func; + postHookFunc(nd); + } + } + return; +} int HP_npc_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) { int hIndex = 0; int retVal___ = 0; @@ -67767,11 +67819,11 @@ void HP_skill_read_db(bool minimal) { } return; } -int HP_skill_get_index(uint16 skill_id) { +int HP_skill_get_index(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_index_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_index_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_index_pre[hIndex].func; @@ -67786,7 +67838,7 @@ int HP_skill_get_index(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_index(skill_id); } if (HPMHooks.count.HP_skill_get_index_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_index_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_index_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -67794,11 +67846,11 @@ int HP_skill_get_index(uint16 skill_id) { } return retVal___; } -int HP_skill_get_type(uint16 skill_id) { +int HP_skill_get_type(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_type_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_type_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_type_pre[hIndex].func; @@ -67813,7 +67865,7 @@ int HP_skill_get_type(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_type(skill_id); } if (HPMHooks.count.HP_skill_get_type_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_type_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_type_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -67821,11 +67873,11 @@ int HP_skill_get_type(uint16 skill_id) { } return retVal___; } -int HP_skill_get_hit(uint16 skill_id) { +int HP_skill_get_hit(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_hit_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_hit_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_hit_pre[hIndex].func; @@ -67840,7 +67892,7 @@ int HP_skill_get_hit(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_hit(skill_id); } if (HPMHooks.count.HP_skill_get_hit_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_hit_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_hit_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -67848,11 +67900,11 @@ int HP_skill_get_hit(uint16 skill_id) { } return retVal___; } -int HP_skill_get_inf(uint16 skill_id) { +int HP_skill_get_inf(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_inf_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_inf_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_inf_pre[hIndex].func; @@ -67867,7 +67919,7 @@ int HP_skill_get_inf(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_inf(skill_id); } if (HPMHooks.count.HP_skill_get_inf_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_inf_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_inf_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -67875,11 +67927,11 @@ int HP_skill_get_inf(uint16 skill_id) { } return retVal___; } -int HP_skill_get_ele(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_ele(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_ele_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_ele_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_ele_pre[hIndex].func; @@ -67894,7 +67946,7 @@ int HP_skill_get_ele(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_ele(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_ele_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_ele_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_ele_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -67902,11 +67954,11 @@ int HP_skill_get_ele(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_nk(uint16 skill_id) { +int HP_skill_get_nk(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_nk_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_nk_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_nk_pre[hIndex].func; @@ -67921,7 +67973,7 @@ int HP_skill_get_nk(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_nk(skill_id); } if (HPMHooks.count.HP_skill_get_nk_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_nk_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_nk_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -67929,11 +67981,11 @@ int HP_skill_get_nk(uint16 skill_id) { } return retVal___; } -int HP_skill_get_max(uint16 skill_id) { +int HP_skill_get_max(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_max_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_max_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_max_pre[hIndex].func; @@ -67948,7 +68000,7 @@ int HP_skill_get_max(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_max(skill_id); } if (HPMHooks.count.HP_skill_get_max_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_max_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_max_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -67956,11 +68008,11 @@ int HP_skill_get_max(uint16 skill_id) { } return retVal___; } -int HP_skill_get_range(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_range(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_range_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_range_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_range_pre[hIndex].func; @@ -67975,7 +68027,7 @@ int HP_skill_get_range(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_range(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_range_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_range_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_range_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -67983,11 +68035,11 @@ int HP_skill_get_range(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_range2(struct block_list *bl, int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_range2_pre > 0) { - int (*preHookFunc) (struct block_list **bl, uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (struct block_list **bl, int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_range2_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_range2_pre[hIndex].func; @@ -68002,7 +68054,7 @@ int HP_skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv) retVal___ = HPMHooks.source.skill.get_range2(bl, skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_range2_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, struct block_list *bl, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_range2_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_range2_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, skill_id, skill_lv); @@ -68010,11 +68062,11 @@ int HP_skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv) } return retVal___; } -int HP_skill_get_splash(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_splash(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_splash_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_splash_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_splash_pre[hIndex].func; @@ -68029,7 +68081,7 @@ int HP_skill_get_splash(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_splash(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_splash_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_splash_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_splash_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68037,11 +68089,11 @@ int HP_skill_get_splash(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_hp(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_hp(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_hp_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_hp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_hp_pre[hIndex].func; @@ -68056,7 +68108,7 @@ int HP_skill_get_hp(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_hp(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_hp_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_hp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_hp_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68064,11 +68116,11 @@ int HP_skill_get_hp(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_mhp(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_mhp(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_mhp_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_mhp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_mhp_pre[hIndex].func; @@ -68083,7 +68135,7 @@ int HP_skill_get_mhp(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_mhp(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_mhp_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_mhp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_mhp_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68091,11 +68143,11 @@ int HP_skill_get_mhp(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_sp(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_sp(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_sp_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_sp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_sp_pre[hIndex].func; @@ -68110,7 +68162,7 @@ int HP_skill_get_sp(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_sp(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_sp_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_sp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_sp_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68118,11 +68170,65 @@ int HP_skill_get_sp(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_state(uint16 skill_id) { +int HP_skill_get_hp_rate(int skill_id, int skill_lv) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_skill_get_hp_rate_pre > 0) { + int (*preHookFunc) (int *skill_id, int *skill_lv); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_hp_rate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_skill_get_hp_rate_pre[hIndex].func; + retVal___ = preHookFunc(&skill_id, &skill_lv); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.get_hp_rate(skill_id, skill_lv); + } + if (HPMHooks.count.HP_skill_get_hp_rate_post > 0) { + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_hp_rate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_skill_get_hp_rate_post[hIndex].func; + retVal___ = postHookFunc(retVal___, skill_id, skill_lv); + } + } + return retVal___; +} +int HP_skill_get_sp_rate(int skill_id, int skill_lv) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_skill_get_sp_rate_pre > 0) { + int (*preHookFunc) (int *skill_id, int *skill_lv); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_sp_rate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_skill_get_sp_rate_pre[hIndex].func; + retVal___ = preHookFunc(&skill_id, &skill_lv); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.get_sp_rate(skill_id, skill_lv); + } + if (HPMHooks.count.HP_skill_get_sp_rate_post > 0) { + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_sp_rate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_skill_get_sp_rate_post[hIndex].func; + retVal___ = postHookFunc(retVal___, skill_id, skill_lv); + } + } + return retVal___; +} +int HP_skill_get_state(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_state_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_state_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_state_pre[hIndex].func; @@ -68137,7 +68243,7 @@ int HP_skill_get_state(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_state(skill_id); } if (HPMHooks.count.HP_skill_get_state_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_state_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_state_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68145,11 +68251,11 @@ int HP_skill_get_state(uint16 skill_id) { } return retVal___; } -int HP_skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_spiritball(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_spiritball_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_spiritball_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_spiritball_pre[hIndex].func; @@ -68164,7 +68270,7 @@ int HP_skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_spiritball(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_spiritball_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_spiritball_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_spiritball_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68172,11 +68278,65 @@ int HP_skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_zeny(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_itemid(int skill_id, int item_idx) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_skill_get_itemid_pre > 0) { + int (*preHookFunc) (int *skill_id, int *item_idx); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_itemid_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_skill_get_itemid_pre[hIndex].func; + retVal___ = preHookFunc(&skill_id, &item_idx); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.get_itemid(skill_id, item_idx); + } + if (HPMHooks.count.HP_skill_get_itemid_post > 0) { + int (*postHookFunc) (int retVal___, int skill_id, int item_idx); + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_itemid_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_skill_get_itemid_post[hIndex].func; + retVal___ = postHookFunc(retVal___, skill_id, item_idx); + } + } + return retVal___; +} +int HP_skill_get_itemqty(int skill_id, int item_idx) { + int hIndex = 0; + int retVal___ = 0; + if (HPMHooks.count.HP_skill_get_itemqty_pre > 0) { + int (*preHookFunc) (int *skill_id, int *item_idx); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_itemqty_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_skill_get_itemqty_pre[hIndex].func; + retVal___ = preHookFunc(&skill_id, &item_idx); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.get_itemqty(skill_id, item_idx); + } + if (HPMHooks.count.HP_skill_get_itemqty_post > 0) { + int (*postHookFunc) (int retVal___, int skill_id, int item_idx); + for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_itemqty_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_skill_get_itemqty_post[hIndex].func; + retVal___ = postHookFunc(retVal___, skill_id, item_idx); + } + } + return retVal___; +} +int HP_skill_get_zeny(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_zeny_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_zeny_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_zeny_pre[hIndex].func; @@ -68191,7 +68351,7 @@ int HP_skill_get_zeny(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_zeny(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_zeny_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_zeny_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_zeny_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68199,11 +68359,11 @@ int HP_skill_get_zeny(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_num(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_num(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_num_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_num_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_num_pre[hIndex].func; @@ -68218,7 +68378,7 @@ int HP_skill_get_num(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_num(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_num_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_num_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_num_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68226,11 +68386,11 @@ int HP_skill_get_num(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_cast(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_cast(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_cast_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_cast_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_cast_pre[hIndex].func; @@ -68245,7 +68405,7 @@ int HP_skill_get_cast(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_cast(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_cast_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_cast_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_cast_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68253,11 +68413,11 @@ int HP_skill_get_cast(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_delay(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_delay(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_delay_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_delay_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_delay_pre[hIndex].func; @@ -68272,7 +68432,7 @@ int HP_skill_get_delay(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_delay(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_delay_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_delay_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_delay_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68280,11 +68440,11 @@ int HP_skill_get_delay(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_walkdelay(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_walkdelay(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_walkdelay_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_walkdelay_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_walkdelay_pre[hIndex].func; @@ -68299,7 +68459,7 @@ int HP_skill_get_walkdelay(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_walkdelay(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_walkdelay_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_walkdelay_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_walkdelay_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68307,11 +68467,11 @@ int HP_skill_get_walkdelay(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_time(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_time(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_time_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_time_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_time_pre[hIndex].func; @@ -68326,7 +68486,7 @@ int HP_skill_get_time(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_time(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_time_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_time_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_time_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68334,11 +68494,11 @@ int HP_skill_get_time(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_time2(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_time2(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_time2_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_time2_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_time2_pre[hIndex].func; @@ -68353,7 +68513,7 @@ int HP_skill_get_time2(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_time2(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_time2_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_time2_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_time2_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68361,11 +68521,11 @@ int HP_skill_get_time2(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_castnodex(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_castnodex(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_castnodex_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_castnodex_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_castnodex_pre[hIndex].func; @@ -68380,7 +68540,7 @@ int HP_skill_get_castnodex(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_castnodex(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_castnodex_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_castnodex_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_castnodex_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68388,11 +68548,11 @@ int HP_skill_get_castnodex(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_delaynodex(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_delaynodex(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_delaynodex_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_delaynodex_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_delaynodex_pre[hIndex].func; @@ -68407,7 +68567,7 @@ int HP_skill_get_delaynodex(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_delaynodex(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_delaynodex_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_delaynodex_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_delaynodex_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68415,11 +68575,11 @@ int HP_skill_get_delaynodex(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_castdef(uint16 skill_id) { +int HP_skill_get_castdef(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_castdef_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_castdef_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_castdef_pre[hIndex].func; @@ -68434,7 +68594,7 @@ int HP_skill_get_castdef(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_castdef(skill_id); } if (HPMHooks.count.HP_skill_get_castdef_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_castdef_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_castdef_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68442,11 +68602,11 @@ int HP_skill_get_castdef(uint16 skill_id) { } return retVal___; } -int HP_skill_get_weapontype(uint16 skill_id) { +int HP_skill_get_weapontype(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_weapontype_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_weapontype_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_weapontype_pre[hIndex].func; @@ -68461,7 +68621,7 @@ int HP_skill_get_weapontype(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_weapontype(skill_id); } if (HPMHooks.count.HP_skill_get_weapontype_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_weapontype_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_weapontype_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68469,11 +68629,11 @@ int HP_skill_get_weapontype(uint16 skill_id) { } return retVal___; } -int HP_skill_get_ammotype(uint16 skill_id) { +int HP_skill_get_ammotype(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_ammotype_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_ammotype_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_ammotype_pre[hIndex].func; @@ -68488,7 +68648,7 @@ int HP_skill_get_ammotype(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_ammotype(skill_id); } if (HPMHooks.count.HP_skill_get_ammotype_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_ammotype_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_ammotype_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68496,11 +68656,11 @@ int HP_skill_get_ammotype(uint16 skill_id) { } return retVal___; } -int HP_skill_get_ammo_qty(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_ammo_qty(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_ammo_qty_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_ammo_qty_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_ammo_qty_pre[hIndex].func; @@ -68515,7 +68675,7 @@ int HP_skill_get_ammo_qty(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_ammo_qty(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_ammo_qty_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_ammo_qty_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_ammo_qty_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68523,11 +68683,11 @@ int HP_skill_get_ammo_qty(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_unit_id(uint16 skill_id, int flag) { +int HP_skill_get_unit_id(int skill_id, int flag) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_id_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, int *flag); + int (*preHookFunc) (int *skill_id, int *flag); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_id_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_id_pre[hIndex].func; @@ -68542,7 +68702,7 @@ int HP_skill_get_unit_id(uint16 skill_id, int flag) { retVal___ = HPMHooks.source.skill.get_unit_id(skill_id, flag); } if (HPMHooks.count.HP_skill_get_unit_id_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, int flag); + int (*postHookFunc) (int retVal___, int skill_id, int flag); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_id_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_id_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, flag); @@ -68550,11 +68710,11 @@ int HP_skill_get_unit_id(uint16 skill_id, int flag) { } return retVal___; } -int HP_skill_get_inf2(uint16 skill_id) { +int HP_skill_get_inf2(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_inf2_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_inf2_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_inf2_pre[hIndex].func; @@ -68569,7 +68729,7 @@ int HP_skill_get_inf2(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_inf2(skill_id); } if (HPMHooks.count.HP_skill_get_inf2_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_inf2_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_inf2_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68577,11 +68737,11 @@ int HP_skill_get_inf2(uint16 skill_id) { } return retVal___; } -int HP_skill_get_castcancel(uint16 skill_id) { +int HP_skill_get_castcancel(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_castcancel_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_castcancel_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_castcancel_pre[hIndex].func; @@ -68596,7 +68756,7 @@ int HP_skill_get_castcancel(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_castcancel(skill_id); } if (HPMHooks.count.HP_skill_get_castcancel_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_castcancel_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_castcancel_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68604,11 +68764,11 @@ int HP_skill_get_castcancel(uint16 skill_id) { } return retVal___; } -int HP_skill_get_maxcount(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_maxcount(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_maxcount_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_maxcount_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_maxcount_pre[hIndex].func; @@ -68623,7 +68783,7 @@ int HP_skill_get_maxcount(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_maxcount(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_maxcount_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_maxcount_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_maxcount_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68631,11 +68791,11 @@ int HP_skill_get_maxcount(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_blewcount(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_blewcount(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_blewcount_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_blewcount_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_blewcount_pre[hIndex].func; @@ -68650,7 +68810,7 @@ int HP_skill_get_blewcount(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_blewcount(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_blewcount_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_blewcount_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_blewcount_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68658,11 +68818,11 @@ int HP_skill_get_blewcount(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_unit_flag(uint16 skill_id) { +int HP_skill_get_unit_flag(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_flag_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_flag_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_flag_pre[hIndex].func; @@ -68677,7 +68837,7 @@ int HP_skill_get_unit_flag(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_unit_flag(skill_id); } if (HPMHooks.count.HP_skill_get_unit_flag_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_flag_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_flag_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68685,11 +68845,11 @@ int HP_skill_get_unit_flag(uint16 skill_id) { } return retVal___; } -int HP_skill_get_unit_target(uint16 skill_id) { +int HP_skill_get_unit_target(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_target_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_target_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_target_pre[hIndex].func; @@ -68704,7 +68864,7 @@ int HP_skill_get_unit_target(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_unit_target(skill_id); } if (HPMHooks.count.HP_skill_get_unit_target_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_target_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_target_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68712,11 +68872,11 @@ int HP_skill_get_unit_target(uint16 skill_id) { } return retVal___; } -int HP_skill_get_unit_interval(uint16 skill_id) { +int HP_skill_get_unit_interval(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_interval_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_interval_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_interval_pre[hIndex].func; @@ -68731,7 +68891,7 @@ int HP_skill_get_unit_interval(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_unit_interval(skill_id); } if (HPMHooks.count.HP_skill_get_unit_interval_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_interval_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_interval_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68739,11 +68899,11 @@ int HP_skill_get_unit_interval(uint16 skill_id) { } return retVal___; } -int HP_skill_get_unit_bl_target(uint16 skill_id) { +int HP_skill_get_unit_bl_target(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_bl_target_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_bl_target_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_bl_target_pre[hIndex].func; @@ -68758,7 +68918,7 @@ int HP_skill_get_unit_bl_target(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_unit_bl_target(skill_id); } if (HPMHooks.count.HP_skill_get_unit_bl_target_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_bl_target_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_bl_target_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68766,11 +68926,11 @@ int HP_skill_get_unit_bl_target(uint16 skill_id) { } return retVal___; } -int HP_skill_get_unit_layout_type(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_unit_layout_type(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_layout_type_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_layout_type_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_layout_type_pre[hIndex].func; @@ -68785,7 +68945,7 @@ int HP_skill_get_unit_layout_type(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_unit_layout_type(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_unit_layout_type_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_layout_type_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_layout_type_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68793,11 +68953,11 @@ int HP_skill_get_unit_layout_type(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_unit_range(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_unit_range(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_unit_range_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_range_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_unit_range_pre[hIndex].func; @@ -68812,7 +68972,7 @@ int HP_skill_get_unit_range(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_unit_range(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_unit_range_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_unit_range_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_unit_range_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68820,11 +68980,11 @@ int HP_skill_get_unit_range(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_get_cooldown(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_cooldown(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_cooldown_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_cooldown_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_cooldown_pre[hIndex].func; @@ -68839,7 +68999,7 @@ int HP_skill_get_cooldown(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_cooldown(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_cooldown_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_cooldown_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_cooldown_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); @@ -68847,11 +69007,11 @@ int HP_skill_get_cooldown(uint16 skill_id, uint16 skill_lv) { } return retVal___; } -int HP_skill_tree_get_max(uint16 skill_id, int class) { +int HP_skill_tree_get_max(int skill_id, int class) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_tree_get_max_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, int *class); + int (*preHookFunc) (int *skill_id, int *class); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_tree_get_max_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_tree_get_max_pre[hIndex].func; @@ -68866,7 +69026,7 @@ int HP_skill_tree_get_max(uint16 skill_id, int class) { retVal___ = HPMHooks.source.skill.tree_get_max(skill_id, class); } if (HPMHooks.count.HP_skill_tree_get_max_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, int class); + int (*postHookFunc) (int retVal___, int skill_id, int class); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_tree_get_max_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_tree_get_max_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, class); @@ -68874,11 +69034,11 @@ int HP_skill_tree_get_max(uint16 skill_id, int class) { } return retVal___; } -const char* HP_skill_get_name(uint16 skill_id) { +const char* HP_skill_get_name(int skill_id) { int hIndex = 0; const char* retVal___ = NULL; if (HPMHooks.count.HP_skill_get_name_pre > 0) { - const char* (*preHookFunc) (uint16 *skill_id); + const char* (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_name_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_name_pre[hIndex].func; @@ -68893,7 +69053,7 @@ const char* HP_skill_get_name(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_name(skill_id); } if (HPMHooks.count.HP_skill_get_name_post > 0) { - const char* (*postHookFunc) (const char* retVal___, uint16 skill_id); + const char* (*postHookFunc) (const char* retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_name_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_name_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68901,11 +69061,11 @@ const char* HP_skill_get_name(uint16 skill_id) { } return retVal___; } -const char* HP_skill_get_desc(uint16 skill_id) { +const char* HP_skill_get_desc(int skill_id) { int hIndex = 0; const char* retVal___ = NULL; if (HPMHooks.count.HP_skill_get_desc_pre > 0) { - const char* (*preHookFunc) (uint16 *skill_id); + const char* (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_desc_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_desc_pre[hIndex].func; @@ -68920,7 +69080,7 @@ const char* HP_skill_get_desc(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_desc(skill_id); } if (HPMHooks.count.HP_skill_get_desc_post > 0) { - const char* (*postHookFunc) (const char* retVal___, uint16 skill_id); + const char* (*postHookFunc) (const char* retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_desc_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_desc_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68928,37 +69088,11 @@ const char* HP_skill_get_desc(uint16 skill_id) { } return retVal___; } -void HP_skill_chk(uint16 *skill_id) { - int hIndex = 0; - if (HPMHooks.count.HP_skill_chk_pre > 0) { - void (*preHookFunc) (uint16 **skill_id); - *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_chk_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_skill_chk_pre[hIndex].func; - preHookFunc(&skill_id); - } - if (*HPMforce_return) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.skill.chk(skill_id); - } - if (HPMHooks.count.HP_skill_chk_post > 0) { - void (*postHookFunc) (uint16 *skill_id); - for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_chk_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_skill_chk_post[hIndex].func; - postHookFunc(skill_id); - } - } - return; -} -int HP_skill_get_casttype(uint16 skill_id) { +int HP_skill_get_casttype(int skill_id) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_casttype_pre > 0) { - int (*preHookFunc) (uint16 *skill_id); + int (*preHookFunc) (int *skill_id); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_casttype_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_casttype_pre[hIndex].func; @@ -68973,7 +69107,7 @@ int HP_skill_get_casttype(uint16 skill_id) { retVal___ = HPMHooks.source.skill.get_casttype(skill_id); } if (HPMHooks.count.HP_skill_get_casttype_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id); + int (*postHookFunc) (int retVal___, int skill_id); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_casttype_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_casttype_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id); @@ -68981,11 +69115,11 @@ int HP_skill_get_casttype(uint16 skill_id) { } return retVal___; } -int HP_skill_get_casttype2(uint16 index) { +int HP_skill_get_casttype2(int index) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_casttype2_pre > 0) { - int (*preHookFunc) (uint16 *index); + int (*preHookFunc) (int *index); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_casttype2_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_casttype2_pre[hIndex].func; @@ -69000,7 +69134,7 @@ int HP_skill_get_casttype2(uint16 index) { retVal___ = HPMHooks.source.skill.get_casttype2(index); } if (HPMHooks.count.HP_skill_get_casttype2_post > 0) { - int (*postHookFunc) (int retVal___, uint16 index); + int (*postHookFunc) (int retVal___, int index); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_casttype2_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_casttype2_post[hIndex].func; retVal___ = postHookFunc(retVal___, index); @@ -71607,11 +71741,11 @@ void HP_skill_brandishspear_dir(struct square *tc, uint8 dir, int are) { } return; } -int HP_skill_get_fixed_cast(uint16 skill_id, uint16 skill_lv) { +int HP_skill_get_fixed_cast(int skill_id, int skill_lv) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_skill_get_fixed_cast_pre > 0) { - int (*preHookFunc) (uint16 *skill_id, uint16 *skill_lv); + int (*preHookFunc) (int *skill_id, int *skill_lv); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_fixed_cast_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_skill_get_fixed_cast_pre[hIndex].func; @@ -71626,7 +71760,7 @@ int HP_skill_get_fixed_cast(uint16 skill_id, uint16 skill_lv) { retVal___ = HPMHooks.source.skill.get_fixed_cast(skill_id, skill_lv); } if (HPMHooks.count.HP_skill_get_fixed_cast_post > 0) { - int (*postHookFunc) (int retVal___, uint16 skill_id, uint16 skill_lv); + int (*postHookFunc) (int retVal___, int skill_id, int skill_lv); for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_get_fixed_cast_post; hIndex++) { postHookFunc = HPMHooks.list.HP_skill_get_fixed_cast_post[hIndex].func; retVal___ = postHookFunc(retVal___, skill_id, skill_lv); |