[Feature] Item Resource Support (#328)

* Initial

* Resource setup finished

* Fixed so that costs can be used

* Corrected standard resources

* Actions can only use item resources from their parent item

* Fixed up dice

* Fixed resource dice positioning

* Fixed parsing of resource.max

* Fixed styling on settings tab

* Added manual input for Dice Resources

* Lightmode fixes

* Fixed Feature spellcasting modifier

* Bugfix for item input to resourceDiceDialog

* Item fix for TokenInput

* PR Fixes
This commit is contained in:
WBHarry 2025-07-14 01:12:32 +02:00 committed by GitHub
parent eefa116d9a
commit 4be3e6179c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 972 additions and 329 deletions

View file

@ -27,7 +27,7 @@ export default class ArmorSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
scrollable: ['.settings']
},
...super.PARTS,
...super.PARTS
};
/**@inheritdoc */

View file

@ -85,6 +85,16 @@ export default class ClassSheet extends DHBaseItemSheet {
await this.document.update({
'system.subclasses': [...this.document.system.subclasses.map(x => x.uuid), item.uuid]
});
} else if (item.type === 'feature') {
if (target.classList.contains('hope-feature')) {
await this.document.update({
'system.hopeFeatures': [...this.document.system.hopeFeatures.map(x => x.uuid), item.uuid]
});
} else if (target.classList.contains('class-feature')) {
await this.document.update({
'system.classFeatures': [...this.document.system.classFeatures.map(x => x.uuid), item.uuid]
});
}
} else if (item.type === 'weapon') {
if (target.classList.contains('primary-weapon-section')) {
if (!this.document.system.characterGuide.suggestedPrimaryWeapon && !item.system.secondary)
@ -144,7 +154,7 @@ export default class ClassSheet extends DHBaseItemSheet {
static async #removeItemFromCollection(_event, element) {
const { uuid, target } = element.dataset;
const prop = foundry.utils.getProperty(this.document.system, target);
await this.document.update({ [target]: prop.filter(i => i.uuid !== uuid) });
await this.document.update({ [`system.${target}`]: prop.filter(i => i.uuid !== uuid) });
}
/**

View file

@ -21,6 +21,7 @@ export default class FeatureSheet extends DHBaseItemSheet {
header: { template: 'systems/daggerheart/templates/sheets/items/feature/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
settings: { template: 'systems/daggerheart/templates/sheets/items/feature/settings.hbs' },
actions: {
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
scrollable: ['.actions']
@ -34,7 +35,7 @@ export default class FeatureSheet extends DHBaseItemSheet {
/**@override */
static TABS = {
primary: {
tabs: [{ id: 'description' }, { id: 'actions' }, { id: 'effects' }],
tabs: [{ id: 'description' }, { id: 'settings' }, { id: 'actions' }, { id: 'effects' }],
initial: 'description',
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
}
@ -67,7 +68,6 @@ export default class FeatureSheet extends DHBaseItemSheet {
}
),
title = game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType');
console.log(this.document);
return foundry.applications.api.DialogV2.prompt({
window: { title },

View file

@ -27,7 +27,7 @@ export default class WeaponSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
scrollable: ['.settings']
},
...super.PARTS,
...super.PARTS
};
/**@inheritdoc */