diff --git a/util/check.js b/util/check.js index 0bf3456..390b1cc 100644 --- a/util/check.js +++ b/util/check.js @@ -1,109 +1,108 @@ -const monsters = require('./monsters.json') -const talents = require('./talents.json') -const traits = require('./traits.json') -const skills = require('./skills.json') - - - -monstertalents = [] -monstertraits = [] -incompletemonsters = [] -for (monster in monsters) { +const monsters = require('../objects/monsters.json'); +const talents = require('../objects/talents.json'); +const traits = require('../objects/traits.json'); +const skills = require('../objects/skills.json'); + +let monsterTalents = []; +let monsterTraits = []; +let incompleteMonsters = []; +let keys = null; +for (let monster in monsters) { if (monsters[monster].talents != null) { - monstertalents.push(monsters[monster].talents[0]) - } + monsterTalents.push(monsters[monster].talents[0]); + }; if (monsters[monster].traits != null) { if (monsters[monster].traits.small != null) { - keys = Object.keys(monsters[monster].traits.small) - for (key in keys) { - monstertraits.push(keys[key]) - } - } + keys = Object.keys(monsters[monster].traits.small); + for (let key in keys) { + monsterTraits.push(keys[key]); + }; + }; if (monsters[monster].traits.large != null) { - keys = Object.keys(monsters[monster].traits.large) - for (key in keys) { - monstertraits.push(keys[key]) - } - } - } - - m = monsters[monster] - if (m.name == null || m.rank == null || m.family == null || m.growth == null || m.talents == null || m.traits == null || m.resistances == null) { + keys = Object.keys(monsters[monster].traits.large); + for (let key in keys) { + monsterTraits.push(keys[key]); + }; + }; + }; + + let m = monsters[monster]; + if (m.name == null || m.rank == null || m.family == null || m.growth == null || m.talents == null || m.traits == null || m.resistances == null) { if (m.rank != 'E') { - incompletemonsters.push(monster) - } - } -} + incompleteMonsters.push(monster); + }; + }; +}; -monstertalents = [... new Set(monstertalents)] -monstertraits = [... new Set(monstertraits)] +monsterTalents = [... new Set(monsterTalents)]; +monsterTraits = [... new Set(monsterTraits)]; -doctalents = [] -doctalentskills = [] -doctalenttraits = [] -for (talent in talents) { - doctalents.push(talent) +let docTalents = []; +let docTalentSkills = []; +let docTalentTraits = []; +for (let talent in talents) { + docTalents.push(talent); if (talents[talent].skills != null) { - keys = Object.keys(talents[talent].skills) - for (key in keys) { - doctalentskills.push(keys[key]) - } - } + keys = Object.keys(talents[talent].skills); + for (let key in keys) { + docTalentSkills.push(keys[key]); + }; + }; if (talents[talent].traits != null) { - keys = Object.keys(talents[talent].traits) - for (key in keys) { - doctalenttraits.push(keys[key]) - } - } -} + keys = Object.keys(talents[talent].traits); + for (let key in keys) { + docTalentTraits.push(keys[key]); + }; + }; +}; -doctalentskills = [... new Set(doctalentskills)] -doctalenttraits = [... new Set(doctalenttraits)] +docTalentSkills = [... new Set(docTalentSkills)]; +docTalentTraits = [... new Set(docTalentTraits)]; doctraits = [] for (trait in traits) { - doctraits.push(trait) -} + doctraits.push(trait); +}; docskills = [] for (skill in skills) { - docskills.push(skill) -} - -if (incompletemonsters.length != 0){ - console.log("Incomplete monsters (monsters that are in monsters.json but are missing at least one of the following: name, rank, family, growth, talents, traits, resistances):") - console.log("Excluding: numbers, large traits, synthesis and rank 'E' monsters:") - for (i in incompletemonsters) { - console.log(" " + incompletemonsters[i]) - } -} - -console.log("Missing talents (talents that are in monsters.json but aren't in talents.json):") -for (i in monstertalents) { - if (!doctalents.includes(monstertalents[i])) { - console.log(" " + monstertalents[i]) - } -} - -console.log("Missing traits (traits that are in monsters.json but aren't in traits.json):") -for (i in monstertalents) { - if (!doctraits.includes(monstertraits[i])) { - console.log(" " + monstertraits[i]) - } -} - -console.log("Missing talent skills (skills that are in talents.json but aren't in skills.json):") -for (i in doctalentskills) { - if (!docskills.includes(doctalentskills[i])) { - console.log(" " + doctalentskills[i]) - } -} - -console.log("Missing talent traits (skills that are in talents.json but aren't in traits.json):") -for (i in doctalenttraits) { - if (!doctraits.includes(doctalenttraits[i])) { - console.log(" " + doctalenttraits[i]) - } -} \ No newline at end of file + docskills.push(skill); +}; + +if (incompleteMonsters.length != 0) { + console.log("Incomplete monsters (monsters that are in monsters.json but are missing at least one of the following: name, rank, family, growth, talents, traits, resistances):"); + console.log("Excluding: numbers, large traits, synthesis and rank 'E' monsters:"); + for (i in incompleteMonsters) { + console.log(" " + incompleteMonsters[i]); + }; +}; + +console.log("Missing talents (talents that are in monsters.json but aren't in talents.json):"); +for (i in monsterTalents) { + if (!docTalents.includes(monsterTalents[i])) { + console.log(" " + monsterTalents[i]); + }; +}; + +console.log("Missing traits (traits that are in monsters.json but aren't in traits.json):"); +for (i in monsterTalents) { + if (!doctraits.includes(monsterTraits[i])) { + console.log(" " + monsterTraits[i]); + }; +}; + +console.log("Missing talent skills (skills that are in talents.json but aren't in skills.json):"); +for (i in docTalentSkills) { + if (!docskills.includes(docTalentSkills[i])) { + console.log(" " + docTalentSkills[i]); + }; +}; + +console.log("Missing talent traits (skills that are in talents.json but aren't in traits.json):"); +for (i in docTalentTraits) { + if (!doctraits.includes(docTalentTraits[i])) { + console.log(" " + docTalentTraits[i]); + }; +}; \ No newline at end of file