From 82be5ecd0d371fbf524a1f312a815340d4071bef Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 20 Jul 2025 00:48:50 +0200 Subject: [PATCH] Corrected downtime buttons and actions --- module/applications/ui/chatLog.mjs | 11 ++++++----- module/config/generalConfig.mjs | 26 +++++++++++++++++++++----- styles/less/ui/chat/chat.less | 7 +------ templates/ui/chat/downtime.hbs | 12 +++++++----- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/module/applications/ui/chatLog.mjs b/module/applications/ui/chatLog.mjs index ba3cb921..41f9ef20 100644 --- a/module/applications/ui/chatLog.mjs +++ b/module/applications/ui/chatLog.mjs @@ -297,15 +297,16 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo await actor.useAction(action); }; - actionUseButton = async (_, message) => { + actionUseButton = async (event, message) => { + const { moveIndex, actionIndex } = event.currentTarget.dataset; const parent = await foundry.utils.fromUuid(message.system.actor); - const actionType = Object.values(message.system.moves)[0].actions[0]; - const cls = CONFIG.DH.ACTIONS.actionTypes[actionType.type]; + const actionType = message.system.moves[moveIndex].actions[actionIndex]; + const cls = game.system.api.models.actions.actionsTypes[actionType.type]; const action = new cls( { ...actionType, _id: foundry.utils.randomID(), name: game.i18n.localize(actionType.name) }, - { parent: parent } + { parent: parent.system } ); - action.use(); + action.use(event); }; } diff --git a/module/config/generalConfig.mjs b/module/config/generalConfig.mjs index dd2fa3af..390435b4 100644 --- a/module/config/generalConfig.mjs +++ b/module/config/generalConfig.mjs @@ -145,11 +145,11 @@ export const defaultRestOptions = { img: 'icons/magic/life/cross-worn-green.webp', actionType: 'action', healing: { - type: 'health', + applyTo: healingTypes.hitPoints.id, value: { custom: { enabled: true, - formula: '1d4 + 1' // should be 1d4 + {tier}. How to use the roll param? + formula: '1d4 + @tier' } } } @@ -169,11 +169,11 @@ export const defaultRestOptions = { img: 'icons/magic/perception/eye-ringed-green.webp', actionType: 'action', healing: { - type: 'stress', + applyTo: healingTypes.stress.id, value: { custom: { enabled: true, - formula: '1d4 + 1' // should be 1d4 + {tier}. How to use the roll param? + formula: '1d4 + @tier' } } } @@ -186,7 +186,23 @@ export const defaultRestOptions = { icon: 'fa-solid fa-hammer', img: 'icons/skills/trades/smithing-anvil-silver-red.webp', description: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.repairArmor.description'), - actions: [] + actions: [ + { + type: 'healing', + name: game.i18n.localize('DAGGERHEART.APPLICATIONS.Downtime.shortRest.repairArmor.name'), + img: 'icons/skills/trades/smithing-anvil-silver-red.webp', + actionType: 'action', + healing: { + applyTo: healingTypes.armorStack.id, + value: { + custom: { + enabled: true, + formula: '1d4 + @tier' + } + } + } + } + ] }, prepare: { id: 'prepare', diff --git a/styles/less/ui/chat/chat.less b/styles/less/ui/chat/chat.less index c08384e6..c2c72d48 100644 --- a/styles/less/ui/chat/chat.less +++ b/styles/less/ui/chat/chat.less @@ -21,13 +21,8 @@ width: 80px; } - .downtime-refresh-container { - margin-top: @fullMargin; + .action-use-button { width: 100%; - - .refresh-title { - font-weight: bold; - } } } diff --git a/templates/ui/chat/downtime.hbs b/templates/ui/chat/downtime.hbs index 98a7a227..cd50b3c6 100644 --- a/templates/ui/chat/downtime.hbs +++ b/templates/ui/chat/downtime.hbs @@ -2,10 +2,12 @@

{{title}}

- {{#each moves}} - {{this.name}} - -
{{{this.description}}}
- {{#if (gt this.actions.length 0)}}{{/if}} + {{#each moves as | move index |}} + {{move.name}} + +
{{{move.description}}}
+ {{#each move.actions as | action index |}} + + {{/each}} {{/each}} \ No newline at end of file