Converted the skill database to YAML (#4531)

* Combines skill_cast_db, skill_castnodex_db, skill_copyable_db, skill_nonearnpc_db, skill_require_db, and skill_unit_db into skill_db.
* Introduces a cached YAML class for quicker lookups.
* General cleanups and optimizations.
* Includes CSV2YAML conversion tool.
Thanks to @Lemongrass3110!
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Aleos
2020-01-31 14:14:08 -05:00
committed by GitHub
parent de9f667d2f
commit dca3797d44
51 changed files with 74122 additions and 12272 deletions

View File

@@ -1087,7 +1087,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, enum e_skill_bl
map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
if(su) {
if (su->group && skill_get_unit_flag(su->group->skill_id)&UF_KNOCKBACK_GROUP)
if (su->group && skill_get_unit_flag(su->group->skill_id, UF_KNOCKBACKGROUP))
skill_unit_move_unit_group(su->group, bl->m, dx, dy);
else
skill_unit_move_unit(bl, nx, ny);
@@ -1159,7 +1159,7 @@ enum e_unit_blown unit_blown_immune(struct block_list* bl, uint8 flag)
case BL_SKILL: {
struct skill_unit* su = (struct skill_unit *)bl;
// Trap cannot be knocked back
if (su && su->group && skill_get_unit_flag(su->group->skill_id)&UF_NOKNOCKBACK)
if (su && su->group && skill_get_unit_flag(su->group->skill_id, UF_NOKNOCKBACK))
return UB_TARGET_TRAP;
}
break;
@@ -1375,7 +1375,7 @@ int unit_can_move(struct block_list *bl) {
if (!ud)
return 0;
if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skill_id)&INF2_GUILD_SKILL))
if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill_get_inf2(ud->skill_id, INF2_ISGUILD)))
return 0; // Prevent moving while casting
if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
@@ -1515,8 +1515,6 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
struct block_list * target = NULL;
t_tick tick = gettick();
int combo = 0, range;
uint8 inf = 0;
uint32 inf2 = 0;
nullpo_ret(src);
@@ -1537,8 +1535,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
if (sc && !sc->count)
sc = NULL; // Unneeded
inf = skill_get_inf(skill_id);
inf2 = skill_get_inf2(skill_id);
int inf = skill_get_inf(skill_id);
std::shared_ptr<s_skill_db> skill = skill_db.find(skill_id);
// temp: used to signal combo-skills right now.
if (sc && sc->data[SC_COMBO] &&
@@ -1552,13 +1550,13 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
else if (target_id == src->id || ud->target > 0)
target_id = ud->target;
if (inf&INF_SELF_SKILL && skill_get_nk(skill_id)&NK_NO_DAMAGE)// exploit fix
if (inf&INF_SELF_SKILL && skill->nk[NK_NODAMAGE])// exploit fix
target_id = src->id;
combo = 1;
} else if ( target_id == src->id &&
inf&INF_SELF_SKILL &&
(inf2&INF2_NO_TARGET_SELF ||
(skill->inf2[INF2_NOTARGETSELF] ||
(skill_id == RL_QD_SHOT && sc && sc->data[SC_QD_SHOT_READY])) ) {
target_id = ud->target; // Auto-select target. [Skotlex]
combo = 1;
@@ -1632,14 +1630,14 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
if(ud->skilltimer != INVALID_TIMER && skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST)
return 0;
if(inf2&INF2_NO_TARGET_SELF && src->id == target_id)
if(skill->inf2[INF2_NOTARGETSELF] && src->id == target_id)
return 0;
if(!status_check_skilluse(src, target, skill_id, 0))
return 0;
// Fail if the targetted skill is near NPC [Cydh]
if(inf2&INF2_NO_NEARNPC && skill_isNotOk_npcRange(src,skill_id,skill_lv,target->x,target->y)) {
if(skill->inf2[INF2_DISABLENEARNPC] && skill_isNotOk_npcRange(src,skill_id,skill_lv,target->x,target->y)) {
if (sd)
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -2016,7 +2014,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
return 0;
// Fail if the targetted skill is near NPC [Cydh]
if(skill_get_inf2(skill_id)&INF2_NO_NEARNPC && skill_isNotOk_npcRange(src,skill_id,skill_lv,skill_x,skill_y)) {
if(skill_get_inf2(skill_id, INF2_DISABLENEARNPC) && skill_isNotOk_npcRange(src,skill_id,skill_lv,skill_x,skill_y)) {
if (sd)
clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);