mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Added rules and bonuses to ActiveEffect-autocomplete
This commit is contained in:
parent
c1f7866594
commit
532c74a5bb
5 changed files with 136 additions and 18 deletions
|
|
@ -30,7 +30,27 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
return { value: joined, label: getLabel(joined), group };
|
||||
});
|
||||
|
||||
acc.push(...bars, ...values);
|
||||
const getAllLeaves = (root, parentPath = '') => {
|
||||
const leaves = [];
|
||||
const rootKey = `${parentPath ? `${parentPath}.` : ''}${root.name}`;
|
||||
for (const field of Object.values(root.fields)) {
|
||||
if (field instanceof foundry.data.fields.SchemaField) leaves.push(...getAllLeaves(field, rootKey));
|
||||
else
|
||||
leaves.push({
|
||||
value: `${rootKey}.${field.name}`,
|
||||
label: game.i18n.localize(field.label),
|
||||
hint: game.i18n.localize(field.hint),
|
||||
group
|
||||
});
|
||||
}
|
||||
|
||||
return leaves;
|
||||
};
|
||||
|
||||
const bonuses = getAllLeaves(model.schema.fields.bonuses);
|
||||
const rules = getAllLeaves(model.schema.fields.rules);
|
||||
|
||||
acc.push(...bars, ...values, ...rules, ...bonuses);
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue