Replace compendium calls

This commit is contained in:
Dapoolp 2025-08-06 03:04:00 +02:00
parent 42867a4be1
commit 3ea050997b
12 changed files with 220 additions and 70 deletions

View file

@ -1,6 +1,7 @@
import { abilities } from '../../config/actorConfig.mjs';
import { burden } from '../../config/generalConfig.mjs';
import { createEmbeddedItemWithEffects } from '../../helpers/utils.mjs';
import { ItemBrowser } from '../ui/itemBrowser.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
@ -485,8 +486,24 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
});
}
static async viewCompendium(_, target) {
(await game.packs.get(`daggerheart.${target.dataset.compendium}`))?.render(true);
static async viewCompendium(event, target) {
const type = target.dataset.compendium ?? target.dataset.type;
const presets = {
compendium: "daggerheart",
folder: type,
render: {
noFolder: true
}
};
if(type == "domains")
presets.filter = {
'level.max': { key: 'level.max', value: 1 },
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null },
};
return new ItemBrowser({ presets }).render({ force: true });
}
static async viewItem(_, target) {