`template.json` Nesting Properties

I am in the process of developing a new system for Foundry VTT and I have found myself struggling to find the best way to organise some data. The system is broken into 3 categories of skills, Basic, Trained and Expert. I was able to find a nice way to separate them and have them appearing nicely in a nested sheet-tab, thanks to help in a previous post. My issue now is a couple skills are a base stat for other skills, e.g Diplomacy is the base skill for Barter, Persuade etc. Here is a snippet of the template.json:
"dipl": {
"value": 0,
"bb": {
"value": 0
},
"cd": {
"value": 0
},
"dm": {
"value": 0
},
"int": {
"value": 0
},
"per": {
"value": 0
}
},
"dipl": {
"value": 0,
"bb": {
"value": 0
},
"cd": {
"value": 0
},
"dm": {
"value": 0
},
"int": {
"value": 0
},
"per": {
"value": 0
}
},
When I try and loop through the keys, I hit an error that it is not iterable, as would be expected as trying to iterate through an Object inside an Object just wouldn't work without a nested loop. But is this the best way to organise the data structure as my config and en pack now look like this and it feels wrong to me:
OUTBREAK.skills = {
label: "OUTBREAK.Skills.Label",
...
trained: {
label: "OUTBREAK.Skills.Trained.Label",
bow: "OUTBREAK.Skills.Trained.Bow",
calm: "OUTBREAK.Skills.Trained.Calm",
dipl: "OUTBREAK.Skills.Trained.Dipl.Dipl",
bb: "OUTBREAK.Skills.Trained.Dipl.BB",
cd: "OUTBREAK.Skills.Trained.Dipl.Cd",
dm: "OUTBREAK.Skills.Trained.Dipl.DM",
int: "OUTBREAK.Skills.Trained.Dipl.Int",
per: "OUTBREAK.Skills.Trained.Dipl.Per",
dgtlsys: "OUTBREAK.Skills.Trained.DgtlSys",
long: "OUTBREAK.Skills.Trained.Firm.Long",
pistol: "OUTBREAK.Skills.Trained.Firm.Pistol",
faid: "OUTBREAK.Skills.Trained.FAid",
bl: "OUTBREAK.Skills.Trained.MA.Bl",
pi: "OUTBREAK.Skills.Trained.MA.Pi",
sl: "OUTBREAK.Skills.Trained.MA.Sl",
nav: "OUTBREAK.Skills.Trained.Nav",
swim: "OUTBREAK.Skills.Trained.Swim",
throw: "OUTBREAK.Skills.Trained.Throw"
},
...
OUTBREAK.skills = {
label: "OUTBREAK.Skills.Label",
...
trained: {
label: "OUTBREAK.Skills.Trained.Label",
bow: "OUTBREAK.Skills.Trained.Bow",
calm: "OUTBREAK.Skills.Trained.Calm",
dipl: "OUTBREAK.Skills.Trained.Dipl.Dipl",
bb: "OUTBREAK.Skills.Trained.Dipl.BB",
cd: "OUTBREAK.Skills.Trained.Dipl.Cd",
dm: "OUTBREAK.Skills.Trained.Dipl.DM",
int: "OUTBREAK.Skills.Trained.Dipl.Int",
per: "OUTBREAK.Skills.Trained.Dipl.Per",
dgtlsys: "OUTBREAK.Skills.Trained.DgtlSys",
long: "OUTBREAK.Skills.Trained.Firm.Long",
pistol: "OUTBREAK.Skills.Trained.Firm.Pistol",
faid: "OUTBREAK.Skills.Trained.FAid",
bl: "OUTBREAK.Skills.Trained.MA.Bl",
pi: "OUTBREAK.Skills.Trained.MA.Pi",
sl: "OUTBREAK.Skills.Trained.MA.Sl",
nav: "OUTBREAK.Skills.Trained.Nav",
swim: "OUTBREAK.Skills.Trained.Swim",
throw: "OUTBREAK.Skills.Trained.Throw"
},
...
1 Reply
Ikaguia
Ikaguia•2y ago
I would use one of these two:
"dipl": {
"value": 0,
"subskills": [
"bb": {
"value": 0
},
"cd": {
"value": 0
},
"dm": {
"value": 0
},
"int": {
"value": 0
},
"per": {
"value": 0
}
]
},
"dipl": {
"value": 0,
"subskills": [
"bb": {
"value": 0
},
"cd": {
"value": 0
},
"dm": {
"value": 0
},
"int": {
"value": 0
},
"per": {
"value": 0
}
]
},
"dipl": {
"value": 0,
"base": null
},
"bb": {
"value": 0,
"base": "dipl"
},
"cd": {
"value": 0,
"base": "dipl"
},
"dm": {
"value": 0,
"base": "dipl"
},
"int": {
"value": 0,
"base": "dipl"
},
"per": {
"value": 0,
"base": "dipl"
}
"dipl": {
"value": 0,
"base": null
},
"bb": {
"value": 0,
"base": "dipl"
},
"cd": {
"value": 0,
"base": "dipl"
},
"dm": {
"value": 0,
"base": "dipl"
},
"int": {
"value": 0,
"base": "dipl"
},
"per": {
"value": 0,
"base": "dipl"
}
Want results from more Discord servers?
Add your server