Fix buildSkillConfig to work with DataModels
Replace game.data.template.Actor reference with hardcoded skill structure. With DataModels, template.json is no longer used at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -123,12 +123,47 @@ export class EcrymeUtility {
|
|||||||
|
|
||||||
/*-------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
static buildSkillConfig() {
|
static buildSkillConfig() {
|
||||||
|
// Build skill configuration from DataModel structure
|
||||||
game.system.ecryme.config.skills = {}
|
game.system.ecryme.config.skills = {}
|
||||||
for (let categKey in game.data.template.Actor.templates.core.skills) {
|
|
||||||
let category = game.data.template.Actor.templates.core.skills[categKey]
|
const skillCategories = {
|
||||||
|
physical: {
|
||||||
|
name: "ECRY.ui.physical",
|
||||||
|
skilllist: {
|
||||||
|
athletics: { key: "athletics", name: "ECRY.ui.athletics", max: 0, value: 0 },
|
||||||
|
driving: { key: "driving", name: "ECRY.ui.driving", max: 0, value: 0 },
|
||||||
|
fencing: { key: "fencing", name: "ECRY.ui.fencing", max: 0, value: 0 },
|
||||||
|
brawling: { key: "brawling", name: "ECRY.ui.brawling", max: 0, value: 0 },
|
||||||
|
shooting: { key: "shooting", name: "ECRY.ui.shooting", max: 0, value: 0 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mental: {
|
||||||
|
name: "ECRY.ui.mental",
|
||||||
|
skilllist: {
|
||||||
|
anthropomecanology: { key: "anthropomecanology", name: "ECRY.ui.anthropomecanology", max: 10, value: 0 },
|
||||||
|
ecrymology: { key: "ecrymology", name: "ECRY.ui.ecrymology", max: 10, value: 0 },
|
||||||
|
traumatology: { key: "traumatology", name: "ECRY.ui.traumatology", max: 10, value: 0 },
|
||||||
|
traversology: { key: "traversology", name: "ECRY.ui.traversology", max: 10, value: 0 },
|
||||||
|
urbatechnology: { key: "urbatechnology", name: "ECRY.ui.urbatechnology", max: 10, value: 0 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
social: {
|
||||||
|
name: "ECRY.ui.social",
|
||||||
|
skilllist: {
|
||||||
|
quibbling: { key: "quibbling", name: "ECRY.ui.quibbling", max: 10, value: 0 },
|
||||||
|
creativity: { key: "creativity", name: "ECRY.ui.creativity", max: 10, value: 0 },
|
||||||
|
loquacity: { key: "loquacity", name: "ECRY.ui.loquacity", max: 10, value: 0 },
|
||||||
|
guile: { key: "guile", name: "ECRY.ui.guile", max: 10, value: 0 },
|
||||||
|
performance: { key: "performance", name: "ECRY.ui.performance", max: 10, value: 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let categKey in skillCategories) {
|
||||||
|
let category = skillCategories[categKey]
|
||||||
for (let skillKey in category.skilllist) {
|
for (let skillKey in category.skilllist) {
|
||||||
let skill = foundry.utils.duplicate(category.skilllist[skillKey])
|
let skill = foundry.utils.duplicate(category.skilllist[skillKey])
|
||||||
skill.categKey = categKey // Auto reference the category
|
skill.categKey = categKey
|
||||||
game.system.ecryme.config.skills[skillKey] = skill
|
game.system.ecryme.config.skills[skillKey] = skill
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user