Skip to content

Commit

Permalink
Skill Database cleanups (rathena#4902)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
aleos89 authored May 19, 2020
1 parent d9f5331 commit 18b642c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
8 changes: 4 additions & 4 deletions conf/battle/skill.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
//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

// Should skills always do at least 'hits' damage when they don't miss/are blocked?
Expand All @@ -107,11 +107,11 @@ auto_counter_type: 15

// 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
// other skills, this setting will override that. (skill_unit_db)
// other skills, this setting will override that.
skill_reiteration: 0

// 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

// Should traps (hunter traps + quagmire) change their target to "all" inside gvg/pvp grounds? (Note 3)
Expand Down Expand Up @@ -343,7 +343,7 @@ stormgust_knockback: yes
// For RENEWAL_CAST (Note 2)
// 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.
// 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

// On official servers, skills that hit all targets on a path (e.g. Focused Arrow Strike and First Wind) first
Expand Down
2 changes: 1 addition & 1 deletion doc/atcommands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
-- questdb: quest_db.txt
-- 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
-- achievementdb: achievement_db.conf

Expand Down
2 changes: 1 addition & 1 deletion doc/item_bonus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ This list contains all available constants referenced in the 'bonus' commands.
ATF_MISC = Trigger on misc skills

* 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'
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_*
Expand Down
2 changes: 1 addition & 1 deletion doc/mapflags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- 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).
- caster: the groups for which the adjustment takes effect. (bitmask)
BL_PC = Player
Expand Down
10 changes: 5 additions & 5 deletions doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3426,7 +3426,7 @@ recalculating guardians' HP.
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 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)

---------------------------------------

Expand Down Expand Up @@ -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
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
has a skill or not, and it can tell you if the level is high enough.
Expand Down Expand Up @@ -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
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
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.

// This would give your character's guild one level of Approval (GD_APPROVAL ID
Expand Down Expand Up @@ -5970,7 +5970,7 @@ These commands will give the invoking character a specified skill. This is also
used for item scripts.

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
in 'db/(pre-)re/mob_skill_db.txt'.

Expand Down Expand Up @@ -9702,7 +9702,7 @@ when pet performance is activated.

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
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
character's or the pets. Probably, Skotlex can answer that question.
Expand Down
25 changes: 12 additions & 13 deletions src/map/skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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 skill_id: Target skill
* @return 0 - Cannot be copied; 1 - Can be copied by Plagiarism 2 - Can be copied by Reproduce
Expand Down Expand Up @@ -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_BLIND,(10+3*skill_lv),skill_lv,skill_get_time2(skill_id,skill_lv));
#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;

case RG_BACKSTAP:
Expand Down Expand Up @@ -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 bl Valid 'target' above the unit, that has been check in skill_unit_timer_sub_onplace
* @param tick
Expand Down Expand Up @@ -16892,10 +16892,10 @@ struct s_skill_condition skill_get_requirement(struct map_session_data* sd, uint

switch( skill_id ) {
/* 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 GN_FIRE_EXPANSION:
case SO_SUMMON_AGNI:
Expand Down Expand Up @@ -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 skill_id ID 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 interval Time interval
* @return skill_unit_group
Expand Down Expand Up @@ -22995,12 +22995,8 @@ static bool skill_parse_row_skilldamage(char* split[], int columns, int current)

/*===============================
* 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_unit_db.txt
* produce_db.txt
* create_arrow_db.txt
*------------------------------*/
Expand Down Expand Up @@ -23054,6 +23050,9 @@ static void skill_readdb(void)

void skill_reload (void) {
skill_db.clear();
abra_db.clear();
magic_mushroom_db.clear();
reading_spellbook_db.clear();
skill_readdb();
initChangeTables(); // Re-init Status Change tables

Expand Down

0 comments on commit 18b642c

Please sign in to comment.