mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-22 02:19:54 +02:00
[Feature] In setting sheets, split by feature type and include descriptions (#2026)
This commit is contained in:
parent
0d59e37a80
commit
cc16a726bf
9 changed files with 143 additions and 110 deletions
|
|
@ -10,11 +10,7 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
actions: {
|
||||
addExperience: DHAdversarySettings.#addExperience,
|
||||
removeExperience: DHAdversarySettings.#removeExperience
|
||||
},
|
||||
dragDrop: [
|
||||
{ dragSelector: null, dropSelector: '.tab.features' },
|
||||
{ dragSelector: '.feature-item', dropSelector: null }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
/**@override */
|
||||
|
|
@ -38,7 +34,8 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
},
|
||||
features: {
|
||||
id: 'features',
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/features.hbs'
|
||||
template: 'systems/daggerheart/templates/sheets-settings/adversary-settings/features.hbs',
|
||||
scrollable: ['']
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -54,12 +51,16 @@ export default class DHAdversarySettings extends DHBaseActorSettings {
|
|||
async _prepareContext(options) {
|
||||
const context = await super._prepareContext(options);
|
||||
|
||||
const featureForms = Object.keys(CONFIG.DH.ITEM.featureForm);
|
||||
context.features = context.document.system.features.sort((a, b) =>
|
||||
a.system.featureForm !== b.system.featureForm
|
||||
? featureForms.indexOf(a.system.featureForm) - featureForms.indexOf(b.system.featureForm)
|
||||
: a.sort - b.sort
|
||||
);
|
||||
// Get feature groups. Uncategorized go to actions
|
||||
const featureFormsTypes = ['passive', 'action', 'reaction'];
|
||||
const features = this.document.system.features.sort((a, b) => a.sort - b.sort);
|
||||
const featureGroups = featureFormsTypes.map(t => ({
|
||||
featureForm: t,
|
||||
label: _loc(CONFIG.DH.ITEM.featureForm[t]),
|
||||
features: features.filter(f => f.system.featureForm === t)
|
||||
}));
|
||||
featureGroups[1].features.push(...features.filter(f => !featureFormsTypes.includes(f.system.featureForm)));
|
||||
context.featureGroups = featureGroups;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue