From 274b99d8c64cd9c42536a771965993d85f84ca7b Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Sun, 19 Jul 2026 11:43:48 +0200 Subject: [PATCH 1/3] Apply suggestions from code review Co-authored-by: Carlos Fernandez --- module/applications/ui/chatLog.mjs | 4 +--- module/data/action/attackAction.mjs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/module/applications/ui/chatLog.mjs b/module/applications/ui/chatLog.mjs index 35a4a966..02846400 100644 --- a/module/applications/ui/chatLog.mjs +++ b/module/applications/ui/chatLog.mjs @@ -282,8 +282,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo async onRollReloadCheck(_event, messageData) { const message = game.messages.get(messageData._id); const needReload = await message.system.action.handleReload?.({ awaitRoll: true }); - await message.update({ - 'system.needReload': needReload - }); + await message.update({ 'system.needReload': needReload }); } } diff --git a/module/data/action/attackAction.mjs b/module/data/action/attackAction.mjs index 934cbbae..1922140c 100644 --- a/module/data/action/attackAction.mjs +++ b/module/data/action/attackAction.mjs @@ -53,7 +53,7 @@ export default class DHAttackAction extends DHDamageAction { async use(event, options) { if (this.item?.system.needsReload) { - return ui.notifications.error(game.i18n.format('DAGGERHEART.UI.Notifications.reloadRequired', { weapon: this.item.name })); + return ui.notifications.error(_loc('DAGGERHEART.UI.Notifications.reloadRequired', { weapon: this.item.name })); } const result = await super.use(event, options); From 2b9e21bd53d4cf192d783927984d0f7517a1b39a Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 19 Jul 2026 12:16:19 +0200 Subject: [PATCH 2/3] Fixes --- lang/en.json | 5 +++++ module/applications/ui/chatLog.mjs | 2 +- module/config/settingsConfig.mjs | 6 +++--- module/data/chat-message/actorRoll.mjs | 2 +- templates/ui/chat/roll.hbs | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lang/en.json b/lang/en.json index c3b9284f..d0b8d0f7 100755 --- a/lang/en.json +++ b/lang/en.json @@ -1326,6 +1326,11 @@ "short": "V. Far" } }, + "ReloadChoices": { + "off": { "label": "Don't Use" }, + "button": { "label": "Use button" }, + "auto": { "label": "Automatic" } + }, "RollTypes": { "trait": { "name": "Trait" diff --git a/module/applications/ui/chatLog.mjs b/module/applications/ui/chatLog.mjs index 02846400..4ef19b4b 100644 --- a/module/applications/ui/chatLog.mjs +++ b/module/applications/ui/chatLog.mjs @@ -282,6 +282,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo async onRollReloadCheck(_event, messageData) { const message = game.messages.get(messageData._id); const needReload = await message.system.action.handleReload?.({ awaitRoll: true }); - await message.update({ 'system.needReload': needReload }); + await message.update({ 'system.needsReload': needReload }); } } diff --git a/module/config/settingsConfig.mjs b/module/config/settingsConfig.mjs index 9e061cdc..33cce535 100644 --- a/module/config/settingsConfig.mjs +++ b/module/config/settingsConfig.mjs @@ -63,14 +63,14 @@ export const actionAutomationChoices = { export const reloadChoices = { off: { id: 'off', - label: 'Don\'t Use' + label: 'DAGGERHEART.CONFIG.ReloadChoices.off.label' }, button: { id: 'button', - label: 'Use Button' + label: 'DAGGERHEART.CONFIG.ReloadChoices.button.label' }, auto: { id: 'auto', - label: 'Automatic' + label: 'DAGGERHEART.CONFIG.ReloadChoices.auto.label' } }; \ No newline at end of file diff --git a/module/data/chat-message/actorRoll.mjs b/module/data/chat-message/actorRoll.mjs index f32a0736..7071ed1e 100644 --- a/module/data/chat-message/actorRoll.mjs +++ b/module/data/chat-message/actorRoll.mjs @@ -42,7 +42,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel { hasEffect: new fields.BooleanField({ initial: false }), hasSave: new fields.BooleanField({ initial: false }), hasTarget: new fields.BooleanField({ initial: false }), - needReload: new fields.BooleanField({ initial: false }), + needsReload: new fields.BooleanField({ initial: false }), isDirect: new fields.BooleanField({ initial: false }), onSave: new fields.StringField(), source: new fields.SchemaField({ diff --git a/templates/ui/chat/roll.hbs b/templates/ui/chat/roll.hbs index 1875a645..ab4e197e 100644 --- a/templates/ui/chat/roll.hbs +++ b/templates/ui/chat/roll.hbs @@ -2,9 +2,9 @@
{{title}}
{{#if (eq action.type 'attack')}} - {{#if needReload}} + {{#if needsReload}}
- {{#if needReload}} + {{#if needsReload}}

{{localize "DAGGERHEART.ACTIONS.Reload.reloadRequired"}}

{{/if}}
From 27eb4a14302ec2353e78f14bd6d5f990fd79784c Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 19 Jul 2026 12:24:49 +0200 Subject: [PATCH 3/3] . --- module/applications/sheets/actors/character.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 5107df12..b88ec6fd 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -964,8 +964,9 @@ export default class CharacterSheet extends DHBaseActorSheet { if (!item || !item.system.resource?.max) return; - await item.update({ 'system.resource.value': - item.system.needsReload ? itemAbleRollParse(item.system.resource.max, this.document, item) : 0 + await item.update({ + 'system.resource.value': item.system.needsReload ? + itemAbleRollParse(item.system.resource.max, this.document, item) : 0 }) }