Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master into monsters #22

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 90 additions & 91 deletions util/check.js
Original file line number Diff line number Diff line change
@@ -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])
}
}
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]);
};
};