This commit is contained in:
WBHarry 2026-01-02 22:12:55 +01:00
parent 36eac51041
commit 8881f14153
8 changed files with 84 additions and 13 deletions

View file

@ -15,7 +15,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
static DEFAULT_OPTIONS = {
tag: 'form',
classes: ['daggerheart', 'dh-style', 'dialog', 'max-800'],
classes: ['daggerheart', 'dh-style', 'action-config', 'dialog', 'max-800'],
window: {
icon: 'fa-solid fa-wrench',
resizable: false
@ -126,6 +126,10 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
context.baseAttackBonus = this.action.actor?.system.attack?.roll.bonus;
context.hasRoll = this.action.hasRoll;
context.triggerOptions = CONFIG.DH.TRIGGER.triggers;
context.triggers = context.source.triggers.map(trigger => ({
...trigger,
hint: CONFIG.DH.TRIGGER.triggers[trigger.trigger].hint
}));
const settingsTiers = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers;
context.tierOptions = [
@ -245,7 +249,19 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });
}
static removeTrigger(_event, button) {
static async removeTrigger(_event, button) {
const trigger = CONFIG.DH.TRIGGER.triggers[this.action.triggers[button.dataset.index].trigger];
const confirmed = await foundry.applications.api.DialogV2.confirm({
window: {
title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.deleteTriggerTitle')
},
content: game.i18n.format('DAGGERHEART.ACTIONS.Config.deleteTriggerContent', {
trigger: game.i18n.localize(trigger.label)
})
});
if (!confirmed) return;
const data = this.action.toObject();
data.triggers = data.triggers.filter((_, index) => index !== Number.parseInt(button.dataset.index));
this.constructor.updateForm.bind(this)(null, null, { object: foundry.utils.flattenObject(data) });

View file

@ -1,10 +1,12 @@
export const triggers = {
dualityRoll: {
id: 'dualityRoll',
label: 'DAGGERHEART.CONFIG.Triggers.dualityRoll'
label: 'DAGGERHEART.CONFIG.Triggers.dualityRoll.label',
hint: 'DAGGERHEART.CONFIG.Triggers.dualityRoll.hint'
},
fearRoll: {
id: 'fearRoll',
label: 'DAGGERHEART.CONFIG.Triggers.fearRoll'
label: 'DAGGERHEART.CONFIG.Triggers.fearRoll.label',
hint: 'DAGGERHEART.CONFIG.Triggers.fearRoll.hint'
}
};