mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Update armor slot handling
This commit is contained in:
parent
4bdafeff6d
commit
af3a415e56
10 changed files with 56 additions and 72 deletions
|
|
@ -9,13 +9,6 @@ export default class DHToken extends TokenDocument {
|
|||
const barGroup = game.i18n.localize('TOKEN.BarAttributes');
|
||||
const valueGroup = game.i18n.localize('TOKEN.BarValues');
|
||||
|
||||
const bars = attributes.bar.map(v => {
|
||||
const a = v.join('.');
|
||||
const modelLabel = model ? game.i18n.localize(model.schema.getField(`${a}.value`).label) : null;
|
||||
return { group: barGroup, value: a, label: modelLabel ? modelLabel : a };
|
||||
});
|
||||
bars.sort((a, b) => a.label.compare(b.label));
|
||||
|
||||
const invalidAttributes = [
|
||||
'gold',
|
||||
'levelData',
|
||||
|
|
@ -29,8 +22,21 @@ export default class DHToken extends TokenDocument {
|
|||
'description',
|
||||
'impulses',
|
||||
'tier',
|
||||
'type'
|
||||
'type',
|
||||
'resources.armor'
|
||||
];
|
||||
|
||||
const bars = attributes.bar.reduce((acc, v) => {
|
||||
const a = v.join('.');
|
||||
if (invalidAttributes.some(x => a.startsWith(x))) return acc;
|
||||
|
||||
const modelLabel = model ? game.i18n.localize(model.schema.getField(`${a}.value`).label) : null;
|
||||
acc.push({ group: barGroup, value: a, label: modelLabel ? modelLabel : a });
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
bars.sort((a, b) => a.label.compare(b.label));
|
||||
|
||||
const values = attributes.value.reduce((acc, v) => {
|
||||
const a = v.join('.');
|
||||
if (invalidAttributes.some(x => a.startsWith(x))) return acc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue