From 523cb145f5136355a019eacdc847bcc3ab0465d0 Mon Sep 17 00:00:00 2001 From: aleos89 Date: Thu, 3 Dec 2015 11:20:12 -0500 Subject: [PATCH] Follow up to a7b8fd4 * Resolves a check for skills that have required equipment items to check for all items in the list. * Fixes #782 - Removed renewal items from pre-renewal skill requirements for 3rd classes. --- conf/msg_conf/map_msg.conf | 2 +- db/pre-re/skill_require_db.txt | 4 ++-- src/map/pc.c | 6 +++--- src/map/skill.c | 33 ++++++++++++++++++--------------- src/map/skill.h | 34 +++++++++++++++++----------------- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/conf/msg_conf/map_msg.conf b/conf/msg_conf/map_msg.conf index e6dfbc4de1..5732b2fa2a 100644 --- a/conf/msg_conf/map_msg.conf +++ b/conf/msg_conf/map_msg.conf @@ -751,7 +751,7 @@ //Skill messages 720: %s is required. 721: [%s] Poison effect was applied to the weapon. -722: Please equipped with a %s. +//722: Free // @costume 723: '%s' is an unknown costume diff --git a/db/pre-re/skill_require_db.txt b/db/pre-re/skill_require_db.txt index 19f1ba04f4..059009b809 100644 --- a/db/pre-re/skill_require_db.txt +++ b/db/pre-re/skill_require_db.txt @@ -680,13 +680,13 @@ //**** // NC Mechanic 2256,0,0,3:6:9:12:15,0,0,0,99,0,0,mado,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_BOOSTKNUCKLE -2257,0,0,50,0,0,0,99,0,0,mado,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1549:16030:16031:16032 //NC_PILEBUNKER +2257,0,0,50,0,0,0,99,0,0,mado,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_PILEBUNKER 2258,0,0,2:4:6,0,0,0,99,0,0,mado,0,0,6145,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_VULCANARM 2259,0,0,20,0,0,0,99,0,0,mado,0,0,2139,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_FLAMELAUNCHER 2260,0,0,20,0,0,0,99,0,0,mado,0,0,6146,1,6147,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_COLDSLOWER 2261,0,0,40:45:50,0,0,0,99,8,1,mado,0,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_ARMSCANNON 2262,0,0,20:40:60,0,0,0,99,0,0,mado,0,0,2800,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_ACCELERATION -2263,0,0,25,0,0,0,99,0,0,mado,0,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2801 //NC_HOVERING +2263,0,0,25,0,0,0,99,0,0,mado,0,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_HOVERING 2264,0,0,5,0,0,0,99,0,0,mado,0,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_F_SIDESLIDE 2265,0,0,5,0,0,0,99,0,0,mado,0,0,6146,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_B_SIDESLIDE diff --git a/src/map/pc.c b/src/map/pc.c index 001db0e9c7..22d8541805 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5589,9 +5589,9 @@ static void pc_checkallowskill(struct map_session_data *sd) } /*========================================== - * Return equiped itemid? on player sd at pos + * Return equipped index of item on player sd at pos * Return - * -1 : mean nothing equiped + * -1 : Nothing equipped * idx : (this index could be used in inventory to found item_data) *------------------------------------------*/ short pc_checkequip(struct map_session_data *sd,int pos) @@ -5609,7 +5609,7 @@ short pc_checkequip(struct map_session_data *sd,int pos) } /*========================================== - * Check if sd as nameid equiped somewhere + * Check if sd has nameid equipped somewhere * @sd : the player session * @nameid : id of the item to check * @min : : see pc.h enum equip_index from ? to @max diff --git a/src/map/skill.c b/src/map/skill.c index afc6cd5a86..85bb5396d2 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -15068,14 +15068,15 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i if (require.eqItem_count) { for (i = 0; i < require.eqItem_count; i++) { uint16 reqeqit = require.eqItem[i]; + if (!reqeqit) - break; //no more required item get out of here + break; //no required item; get out of here if (!pc_checkequip2(sd,reqeqit,EQI_ACC_L,EQI_MAX)) { - char output[CHAT_SIZE_MAX]; - //Official use msgstringtable.txt for each skill failure - sprintf(output,msg_txt(sd,722),itemdb_jname(reqeqit)); - clif_colormes(sd->fd, color_table[COLOR_RED], output); - return false; + if (i == require.eqItem_count) { + clif_skill_fail(sd,skill_id,USESKILL_FAIL_THIS_WEAPON,0); + return false; + } + continue; } } } @@ -20288,7 +20289,8 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current) skill_split_atoi(split[12],skill_db[idx]->require.spiritball); for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; i++ ) { - int32 itemid = atoi(split[13 + 2 * i]); + uint16 itemid = atoi(split[13 + 2 * i]); + if (itemid > 0 && !itemdb_exists(itemid) ) { ShowError("skill_parse_row_requiredb: Invalid item (in ITEM_REQUIRE list) %d for skill %d.\n", itemid, atoi(split[0])); return false; @@ -20301,17 +20303,18 @@ static bool skill_parse_row_requiredb(char* split[], int columns, int current) trim(split[33]); if (split[33][0] != '\0' || atoi(split[33])) { int require[MAX_SKILL_EQUIP_REQUIRE]; + if ((skill_db[idx]->require.eqItem_count = skill_split_atoi2(split[33], require, ":", 500, ARRAYLENGTH(require)))) { CREATE(skill_db[idx]->require.eqItem, uint16, skill_db[idx]->require.eqItem_count); for (i = 0; i < skill_db[idx]->require.eqItem_count; i++){ - if (require[i] > 0 && !itemdb_exists(require[i])) { - ShowError("skill_parse_row_requiredb: Invalid item (in EQUIP_REQUIRE list) %d for skill %d.\n", require[i], atoi(split[0])); - aFree(skill_db[idx]->require.eqItem); //don't need to retain this - skill_db[idx]->require.eqItem_count = 0; - return false; - } - skill_db[idx]->require.eqItem[i] = require[i]; - } + if (require[i] > 0 && !itemdb_exists(require[i])) { + ShowError("skill_parse_row_requiredb: Invalid item (in EQUIP_REQUIRE list) %d for skill %d.\n", require[i], atoi(split[0])); + aFree(skill_db[idx]->require.eqItem); //don't need to retain this + skill_db[idx]->require.eqItem_count = 0; + return false; + } + skill_db[idx]->require.eqItem[i] = require[i]; + } } } return true; diff --git a/src/map/skill.h b/src/map/skill.h index 43d832e2c7..bc3dd885af 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -136,23 +136,23 @@ struct skill_condition { /// Skill requirement structure. !TODO: Cleanup the variable types that use array [MAX_SKILL_LEVEL] struct s_skill_require { - int hp[MAX_SKILL_LEVEL]; ///< HP cost - int mhp[MAX_SKILL_LEVEL]; ///< Max HP to trigger - int sp[MAX_SKILL_LEVEL]; /// SP cost - int hp_rate[MAX_SKILL_LEVEL]; /// HP cost (%) - int sp_rate[MAX_SKILL_LEVEL]; /// SP cost (%) - int zeny[MAX_SKILL_LEVEL]; /// Zeny cost - uint32 weapon; /// Weapon type. Combined bitmask of enum weapon_type (1<