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

@@ -138,26 +138,28 @@ struct view_data* npc_get_viewdata(int class_) {
int npc_isnear_sub(struct block_list* bl, va_list args) {
struct npc_data *nd = (struct npc_data*)bl;
if (nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE))
return 0;
int skill_id = va_arg(args, int);
if (skill_id > 0) { //If skill_id > 0 that means is used for INF2_NO_NEARNPC [Cydh]
uint16 idx = skill_get_index(skill_id);
if (skill_id > 0) { //If skill_id > 0 that means is used for INF2_DISABLENEARNPC [Cydh]
std::shared_ptr<s_skill_db> skill = skill_db.find(skill_id);
if (idx > 0 && skill_db[idx]->unit_nonearnpc_type) {
while (1) {
if (skill_db[idx]->unit_nonearnpc_type&1 && nd->subtype == NPCTYPE_WARP) break;
if (skill_db[idx]->unit_nonearnpc_type&2 && nd->subtype == NPCTYPE_SHOP) break;
if (skill_db[idx]->unit_nonearnpc_type&4 && nd->subtype == NPCTYPE_SCRIPT) break;
if (skill_db[idx]->unit_nonearnpc_type&8 && nd->subtype == NPCTYPE_TOMB) break;
return 0;
}
if (skill && skill->unit_nonearnpc_type) {
if (skill->unit_nonearnpc_type&SKILL_NONEAR_WARPPORTAL && nd->subtype == NPCTYPE_WARP)
return 1;
if (skill->unit_nonearnpc_type&SKILL_NONEAR_SHOP && nd->subtype == NPCTYPE_SHOP)
return 1;
if (skill->unit_nonearnpc_type&SKILL_NONEAR_NPC && nd->subtype == NPCTYPE_SCRIPT)
return 1;
if (skill->unit_nonearnpc_type&SKILL_NONEAR_TOMB && nd->subtype == NPCTYPE_TOMB)
return 1;
}
}
if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) )
return 0;
return 1;
return 0;
}
bool npc_isnear(struct block_list * bl) {