Compendium Browser (#821)

This commit is contained in:
Dapoulp 2025-08-11 00:18:31 +02:00 committed by GitHub
parent b68d2e9ec2
commit f9774f130e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 74 additions and 20 deletions

View file

@ -383,7 +383,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
uuid: suggestions.armor?.uuid,
taken: suggestions.armor?.uuid === this.equipment.armor?.uuid
},
compendium: 'armors'
compendium: 'armor'
};
context.primaryWeapon = {
...this.equipment.primaryWeapon,
@ -392,7 +392,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
uuid: suggestions.primaryWeapon?.uuid,
taken: suggestions.primaryWeapon?.uuid === this.equipment.primaryWeapon?.uuid
},
compendium: 'weapons'
compendium: 'weapon'
};
context.secondaryWeapon = {
...this.equipment.secondaryWeapon,
@ -402,7 +402,7 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
taken: suggestions.secondaryWeapon?.uuid === this.equipment.secondaryWeapon?.uuid
},
disabled: this.equipment.primaryWeapon?.system?.burden === burden.twoHanded.value,
compendium: 'weapons'
compendium: 'weapon'
};
context.inventory = {
take: suggestions.inventory.take,
@ -500,11 +500,12 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
}
static async viewCompendium(event, target) {
const type = target.dataset.compendium ?? target.dataset.type;
const type = target.dataset.compendium ?? target.dataset.type,
equipment = ['armor', 'weapon'];
const presets = {
compendium: 'daggerheart',
folder: type,
folder: equipment.includes(type) ? "equipments" : type,
render: {
noFolder: true
}
@ -516,6 +517,12 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
'system.domain': { key: 'system.domain', value: this.setup.class?.system.domains ?? null }
};
if (equipment.includes(type))
presets.filter = {
'system.tier': { key: 'system.tier', value: 1 },
'type': { key: 'type', value: type }
};
return (this.itemBrowser = await new ItemBrowser({ presets }).render({ force: true }));
}