Ver código fonte

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.

aleos89 9 anos atrás
pai
commit
523cb145f5
5 arquivos alterados com 41 adições e 38 exclusões
  1. 1 1
      conf/msg_conf/map_msg.conf
  2. 2 2
      db/pre-re/skill_require_db.txt
  3. 3 3
      src/map/pc.c
  4. 18 15
      src/map/skill.c
  5. 17 17
      src/map/skill.h

+ 1 - 1
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

+ 2 - 2
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
 

+ 3 - 3
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

+ 18 - 15
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;

+ 17 - 17
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<<weapon)
-	uint16 ammo;						 /// Ammo type. Combine bitmask of enum ammo_type (1<<ammo)
-	int ammo_qty[MAX_SKILL_LEVEL];		 /// Amount of ammo
-	uint8 state;						 /// State/condition. @see enum e_require_state
-	int spiritball[MAX_SKILL_LEVEL];	 /// Spiritball cost
-	int itemid[MAX_SKILL_ITEM_REQUIRE];	 /// Required item
-	int amount[MAX_SKILL_ITEM_REQUIRE];	 /// Amount of item
-	uint16 *eqItem;						 /// List of equipped item
-	enum sc_type *status;				 /// List of Status required (SC)
-	uint8 status_count,					 /// Count of SC
-		eqItem_count;					 /// Count of equipped item
+	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<<weapon)
+	uint16 ammo;							 /// Ammo type. Combine bitmask of enum ammo_type (1<<ammo)
+	int ammo_qty[MAX_SKILL_LEVEL];			 /// Amount of ammo
+	uint8 state;							 /// State/condition. @see enum e_require_state
+	int spiritball[MAX_SKILL_LEVEL];		 /// Spiritball cost
+	uint16 itemid[MAX_SKILL_ITEM_REQUIRE];	 /// Required item
+	uint16 amount[MAX_SKILL_ITEM_REQUIRE];	 /// Amount of item
+	uint16 *eqItem;							 /// List of equipped item
+	enum sc_type *status;					 /// List of Status required (SC)
+	uint8 status_count,						 /// Count of SC
+		eqItem_count;						 /// Count of equipped item
 };
 
 /// Database skills. !TODO: Cleanup the variable types that use array [MAX_SKILL_LEVEL]