浏览代码

Skill Database cleanups (#4902)

* When reloading the skill_db clear out Abra, Magic Mushroom, and Reading Spell Book databases as well.
* Fixes NC_SHAPESHIFT and NC_REPAIR checking an invalid ItemCost slot based on the old implementation.
* Updated a lot of references to the old skill databases.
Aleos 5 年之前
父节点
当前提交
18b642c174
共有 6 个文件被更改,包括 24 次插入25 次删除
  1. 4 4
      conf/battle/skill.conf
  2. 1 1
      doc/atcommands.txt
  3. 1 1
      doc/item_bonus.txt
  4. 1 1
      doc/mapflags.txt
  5. 5 5
      doc/script_commands.txt
  6. 12 13
      src/map/skill.cpp

+ 4 - 4
conf/battle/skill.conf

@@ -85,7 +85,7 @@ clear_skills_on_warp: 15
 
 
 //Setting this to YES will override the target mode of ground-based skills with the flag 0x01 to "No Enemies"
 //Setting this to YES will override the target mode of ground-based skills with the flag 0x01 to "No Enemies"
 //The two skills affected by default are Pneuma and Safety Wall (if set to yes, those two skills will not protect everyone, but only allies)
 //The two skills affected by default are Pneuma and Safety Wall (if set to yes, those two skills will not protect everyone, but only allies)
-//See db/skill_unit_db.txt for more info.
+//See db/(pre-)re/skill_db.yml for more info.
 defunit_not_enemy: no
 defunit_not_enemy: no
 
 
 // Should skills always do at least 'hits' damage when they don't miss/are blocked?
 // Should skills always do at least 'hits' damage when they don't miss/are blocked?
@@ -107,11 +107,11 @@ auto_counter_type: 15
 
 
 // Can ground skills be placed on top of each other? (Note 3)
 // Can ground skills be placed on top of each other? (Note 3)
 // By default, skills with UF_NOREITERATION set cannot be stacked on top of 
 // By default, skills with UF_NOREITERATION set cannot be stacked on top of 
-// other skills, this setting will override that. (skill_unit_db)
+// other skills, this setting will override that.
 skill_reiteration: 0
 skill_reiteration: 0
 
 
 // Can ground skills NOT be placed underneath/near players/monsters? (Note 3)
 // Can ground skills NOT be placed underneath/near players/monsters? (Note 3)
-// If set, only skills with UF_NOFOOTSET set will be affected (skill_unit_db)
+// If set, only skills with UF_NOFOOTSET set will be affected.
 skill_nofootset: 1
 skill_nofootset: 1
 
 
 // Should traps (hunter traps + quagmire) change their target to "all" inside gvg/pvp grounds? (Note 3)
 // Should traps (hunter traps + quagmire) change their target to "all" inside gvg/pvp grounds? (Note 3)
@@ -343,7 +343,7 @@ stormgust_knockback: yes
 // For RENEWAL_CAST (Note 2)
 // For RENEWAL_CAST (Note 2)
 // By default skill that has '0' value for Fixed Casting Time will use 20% of cast time
 // By default skill that has '0' value for Fixed Casting Time will use 20% of cast time
 // as Fixed Casting Time, and the rest (80%) as Variable Casting Time.
 // as Fixed Casting Time, and the rest (80%) as Variable Casting Time.
-// Put it 0 to disable default Fixed Casting Time (just like -1 is the skill_cast_db.txt).
+// Put it 0 to disable default Fixed Casting Time (just like -1 in the skill_db.yml).
 default_fixed_castrate: 20
 default_fixed_castrate: 20
 
 
 // On official servers, skills that hit all targets on a path (e.g. Focused Arrow Strike and First Wind) first
 // On official servers, skills that hit all targets on a path (e.g. Focused Arrow Strike and First Wind) first

+ 1 - 1
doc/atcommands.txt

@@ -1367,7 +1367,7 @@ Affected files:
 -- pcdb: statpoint.txt, job_exp.txt, skill_tree.txt, attr_fix.txt, job_db1.txt, job_db2.txt, job_basehpsp_db.txt, job_maxhpsp_db.txt, job_param_db.txt, level_penalty.txt
 -- pcdb: statpoint.txt, job_exp.txt, skill_tree.txt, attr_fix.txt, job_db1.txt, job_db2.txt, job_basehpsp_db.txt, job_maxhpsp_db.txt, job_param_db.txt, level_penalty.txt
 -- questdb: quest_db.txt
 -- questdb: quest_db.txt
 -- script: /npc/*.txt, /npc/*.conf
 -- script: /npc/*.txt, /npc/*.conf
--- skilldb: skill_db.txt, const.txt, skill_require_db.txt, skill_cast_db.txt, skill_castnodex_db.txt, skill_nocast_db.txt, skill_copyable_db.txt, skill_improvise_db.txt, skill_changematerial_db.txt, skill_nonearnpc_db.txt, skill_damage_db.txt, skill_unit_db.txt, abra_db.txt, create_arrow_db.txt, produce_db.txt, spellbook_db.txt, magicmushroom_db.txt
+-- skilldb: skill_db.yml, const.txt, skill_nocast_db.txt, skill_changematerial_db.txt, skill_damage_db.txt, abra_db.yml, create_arrow_db.txt, produce_db.txt, spellbook_db.yml, magicmushroom_db.yml
 -- statusdb: attr_fix.txt, size_fix.txt, refine_db.txt
 -- statusdb: attr_fix.txt, size_fix.txt, refine_db.txt
 -- achievementdb: achievement_db.conf
 -- achievementdb: achievement_db.conf
 
 

+ 1 - 1
doc/item_bonus.txt

@@ -65,7 +65,7 @@ This list contains all available constants referenced in the 'bonus' commands.
 	ATF_MISC	= Trigger on misc skills
 	ATF_MISC	= Trigger on misc skills
 
 
 * Other values:
 * Other values:
-	Skill (sk): see 'db/(pre-)re/skill_db.txt' (NOTE: Both skill IDs and names, in quotes, are supported.)
+	Skill (sk): see 'db/(pre-)re/skill_db.yml' (NOTE: Both skill IDs and names, in quotes, are supported.)
 	Monster id (mid): see 'db/(pre-)re/mob_db.txt'
 	Monster id (mid): see 'db/(pre-)re/mob_db.txt'
 	Item id (iid): see 'db/(pre-)re/item_db.txt'
 	Item id (iid): see 'db/(pre-)re/item_db.txt'
 	Item group (ig): see 'db/(pre-)re/item_group_db.txt' and the constants in 'db/const.txt', prefixed with IG_*
 	Item group (ig): see 'db/(pre-)re/item_group_db.txt' and the constants in 'db/const.txt', prefixed with IG_*

+ 1 - 1
doc/mapflags.txt

@@ -304,7 +304,7 @@ for 'Map' type 16 will be applied.
 
 
 This mapflag can also be used to adjust the damage of one skill by a percentage:
 This mapflag can also be used to adjust the damage of one skill by a percentage:
  - skill_name:
  - skill_name:
-	Name of the skill in 'db/(pre-)re/skill_db.txt' (ex. SM_BASH).
+	Name of the skill in 'db/(pre-)re/skill_db.yml' (ex. SM_BASH).
 	To adjust all skill damage, write "all" (without quotes).
 	To adjust all skill damage, write "all" (without quotes).
  - caster: the groups for which the adjustment takes effect. (bitmask)
  - caster: the groups for which the adjustment takes effect. (bitmask)
 	BL_PC = Player
 	BL_PC = Player

+ 5 - 5
doc/script_commands.txt

@@ -3426,7 +3426,7 @@ recalculating guardians' HP.
 This function returns the level of the skill <skill id> of the guild <guild id>.
 This function returns the level of the skill <skill id> of the guild <guild id>.
 If the guild does not have that skill, 0 is returned.
 If the guild does not have that skill, 0 is returned.
 If the guild does not exist, -1 is returned.
 If the guild does not exist, -1 is returned.
-Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
+Refer to 'db/(pre-)re/skill_db.yml' for the full list of skills. (GD_* are guild skills)
 
 
 ---------------------------------------
 ---------------------------------------
 
 
@@ -3459,7 +3459,7 @@ mes "You have " + getMapGuildUsers("prontera",getcharid(2)) + " guild members in
 
 
 This function returns the level of the specified skill that the invoking
 This function returns the level of the specified skill that the invoking
 character has. If they don't have the skill, 0 will be returned. The full list
 character has. If they don't have the skill, 0 will be returned. The full list
-of character skills is available in 'db/(pre-)re/skill_db.txt'.
+of character skills is available in 'db/(pre-)re/skill_db.yml'.
 
 
 There are two main uses for this function, it can check whether the character
 There are two main uses for this function, it can check whether the character
 has a skill or not, and it can tell you if the level is high enough.
 has a skill or not, and it can tell you if the level is high enough.
@@ -5583,7 +5583,7 @@ levels. This refers to the invoking character and will only work if the invoking
 character is a member of a guild AND its guild master, otherwise no failure
 character is a member of a guild AND its guild master, otherwise no failure
 message will be given and no error will occur, but nothing will happen - same
 message will be given and no error will occur, but nothing will happen - same
 about the guild skill trying to exceed the possible maximum. The full list of
 about the guild skill trying to exceed the possible maximum. The full list of
-guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
+guild skills is available in 'db/(pre-)re/skill_db.yml', these are all the GD_ skills at
 the end.
 the end.
 
 
 // This would give your character's guild one level of Approval (GD_APPROVAL ID
 // This would give your character's guild one level of Approval (GD_APPROVAL ID
@@ -5970,7 +5970,7 @@ These commands will give the invoking character a specified skill. This is also
 used for item scripts.
 used for item scripts.
 
 
 Level is obvious. Skill id is the ID number of the skill in question as per
 Level is obvious. Skill id is the ID number of the skill in question as per
-'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
+'db/(pre-)re/skill_db.yml'. It is not known for certain whether this can be used to give
 a character a monster's skill, but you're welcome to try with the numbers given
 a character a monster's skill, but you're welcome to try with the numbers given
 in 'db/(pre-)re/mob_skill_db.txt'.
 in 'db/(pre-)re/mob_skill_db.txt'.
 
 
@@ -9702,7 +9702,7 @@ when pet performance is activated.
 
 
 This will make the pet use a specified support skill on the owner whenever the
 This will make the pet use a specified support skill on the owner whenever the
 HP and SP are below the given percent values, with a specified delay time
 HP and SP are below the given percent values, with a specified delay time
-between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
+between activations. The skill numbers are as per 'db/(pre-)re/skill_db.yml'.
 
 
 It's not quite certain who's stats will be used for the skills cast, the
 It's not quite certain who's stats will be used for the skills cast, the
 character's or the pets. Probably, Skotlex can answer that question.
 character's or the pets. Probably, Skotlex can answer that question.

+ 12 - 13
src/map/skill.cpp

@@ -765,7 +765,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
 
 
 /**
 /**
  * Making Plagiarism and Reproduce check their own function
  * Making Plagiarism and Reproduce check their own function
- * Previous prevention for NPC skills, Wedding skills, and INF3_DIS_PLAGIA are removed since we use skill_copyable_db.txt [Cydh]
+ * Previous prevention for NPC skills, Wedding skills, and INF3_DIS_PLAGIA are removed since we use skill_db.yml [Cydh]
  * @param sd: Player who will copy the skill
  * @param sd: Player who will copy the skill
  * @param skill_id: Target skill
  * @param skill_id: Target skill
  * @return 0 - Cannot be copied; 1 - Can be copied by Plagiarism 2 - Can be copied by Reproduce
  * @return 0 - Cannot be copied; 1 - Can be copied by Plagiarism 2 - Can be copied by Reproduce
@@ -1507,7 +1507,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
 		sc_start(src,bl,SC_STUN,(10+3*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv));
 		sc_start(src,bl,SC_STUN,(10+3*skill_lv),skill_lv,skill_get_time(skill_id,skill_lv));
 		sc_start(src,bl,SC_BLIND,(10+3*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv));
 		sc_start(src,bl,SC_BLIND,(10+3*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv));
 #ifdef RENEWAL
 #ifdef RENEWAL
-		sc_start(src, bl, SC_RAID, 100, skill_lv, 10000); // Hardcoded to 10 seconds since skill_cast_db is full
+		sc_start(src, bl, SC_RAID, 100, skill_lv, 10000); // Hardcoded to 10 seconds since Duration1 and Duration2 are used
 		break;
 		break;
 
 
 	case RG_BACKSTAP:
 	case RG_BACKSTAP:
@@ -14148,7 +14148,7 @@ static int skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_
 }
 }
 
 
 /**
 /**
- * Process skill unit each interval (sg->interval, see interval field of skill_unit_db.txt)
+ * Process skill unit each interval (sg->interval, see interval field of skill_db.yml)
  * @param unit Skill unit
  * @param unit Skill unit
  * @param bl Valid 'target' above the unit, that has been check in skill_unit_timer_sub_onplace
  * @param bl Valid 'target' above the unit, that has been check in skill_unit_timer_sub_onplace
  * @param tick
  * @param tick
@@ -16892,10 +16892,10 @@ struct s_skill_condition skill_get_requirement(struct map_session_data* sd, uint
 
 
 	switch( skill_id ) {
 	switch( skill_id ) {
 		/* Skill level-dependent checks */
 		/* Skill level-dependent checks */
-		case NC_SHAPESHIFT: // NOTE: Please make sure Magic_Gear_Fuel in the last position in skill_require_db.txt
-		case NC_REPAIR: // NOTE: Please make sure Repair_Kit in the last position in skill_require_db.txt
-			req.itemid[1] = skill->require.itemid[MAX_SKILL_ITEM_REQUIRE-1];
-			req.amount[1] = skill->require.amount[MAX_SKILL_ITEM_REQUIRE-1];
+		case NC_SHAPESHIFT: // NOTE: Magic_Gear_Fuel must be last in the ItemCost list depending on the skill's max level
+		case NC_REPAIR: // NOTE: Repair_Kit must be last in the ItemCost list depending on the skill's max level
+			req.itemid[1] = skill->require.itemid[skill->max - 1];
+			req.amount[1] = skill->require.amount[skill->max - 1];
 		case KO_MAKIBISHI:
 		case KO_MAKIBISHI:
 		case GN_FIRE_EXPANSION:
 		case GN_FIRE_EXPANSION:
 		case SO_SUMMON_AGNI:
 		case SO_SUMMON_AGNI:
@@ -18811,7 +18811,7 @@ static int skill_get_new_group_id(void)
  * @param count How many 'cells' used that needed. Related with skill layout
  * @param count How many 'cells' used that needed. Related with skill layout
  * @param skill_id ID of used skill
  * @param skill_id ID of used skill
  * @param skill_lv Skill level of used skill
  * @param skill_lv Skill level of used skill
- * @param unit_id Unit ID (look at skill_unit_db.txt)
+ * @param unit_id Unit ID (see skill.hpp::e_skill_unit_id)
  * @param limit Lifetime for skill unit, uses skill_get_time(skill_id, skill_lv)
  * @param limit Lifetime for skill unit, uses skill_get_time(skill_id, skill_lv)
  * @param interval Time interval
  * @param interval Time interval
  * @return skill_unit_group
  * @return skill_unit_group
@@ -22995,12 +22995,8 @@ static bool skill_parse_row_skilldamage(char* split[], int columns, int current)
 
 
 /*===============================
 /*===============================
  * DB reading.
  * DB reading.
- * skill_db.txt
- * skill_require_db.txt
- * skill_cast_db.txt
- * skill_castnodex_db.txt
+ * skill_db.yml
  * skill_nocast_db.txt
  * skill_nocast_db.txt
- * skill_unit_db.txt
  * produce_db.txt
  * produce_db.txt
  * create_arrow_db.txt
  * create_arrow_db.txt
  *------------------------------*/
  *------------------------------*/
@@ -23054,6 +23050,9 @@ static void skill_readdb(void)
 
 
 void skill_reload (void) {
 void skill_reload (void) {
 	skill_db.clear();
 	skill_db.clear();
+	abra_db.clear();
+	magic_mushroom_db.clear();
+	reading_spellbook_db.clear();
 	skill_readdb();
 	skill_readdb();
 	initChangeTables(); // Re-init Status Change tables
 	initChangeTables(); // Re-init Status Change tables