display only class subclasses on character creation

Fixes #715

This PR fixes the issue where all subclasses are displayed in the compendium
browser by allowing a fixed set of items as part of the presets passed to
the ItemBrowser.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
This commit is contained in:
Miguel Molina 2025-08-10 11:09:53 +02:00
parent 85982bac8c
commit a853f150be
No known key found for this signature in database
GPG key ID: B471CC6D357510E2
2 changed files with 19 additions and 10 deletions

View file

@ -511,6 +511,10 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null }
};
if (type === 'subclasses') {
presets.items = this.setup.class?.system.subclasses ?? null;
}
return (this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true }));
}

View file

@ -183,6 +183,11 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
items = items.concat(await comp.getDocuments({ type__in: folderData.type }));
}
if (this.presets.items?.length > 0) {
const ids = this.presets.items.map(i => i._id);
items = items.filter(i => ids.includes(i._id));
}
this.items = ItemBrowser.sortBy(items, 'name');
this.render({ force: true });
}