From 92bfede022209dfd8075a967b4031b7d12f3fa49 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Thu, 17 Jul 2025 21:07:48 +0200 Subject: [PATCH] Added downtime buttons --- lang/en.json | 5 ++-- module/applications/dialogs/downtime.mjs | 3 +++ .../applications/sheets/actors/character.mjs | 9 ++++++- styles/less/global/tab-navigation.less | 20 +++++++++++---- .../less/sheets/actors/character/header.less | 9 +++++++ templates/dialogs/downtime/downtime.hbs | 2 +- templates/sheets/actors/character/header.hbs | 11 +++++++- .../sheets/global/tabs/tab-navigation.hbs | 25 ++++++++++++------- 8 files changed, 64 insertions(+), 20 deletions(-) diff --git a/lang/en.json b/lang/en.json index ac71c319..0eeba4d5 100755 --- a/lang/en.json +++ b/lang/en.json @@ -249,10 +249,9 @@ "title": "{actor} - Death Move" }, "Downtime": { - "downtimeHeader": "Downtime Activities", "longRest": { "title": "Long Rest", - "moves": "Long Rest ({current}/{max})", + "moves": "Long Rest Moves ({current}/{max})", "clearStress": { "description": "Describe how you blow off steam or pull yourself together, and clear all marked Stress.", "name": "Clear Stress" @@ -276,7 +275,7 @@ }, "shortRest": { "title": "Short Rest", - "moves": "Short Rest ({current}/{max})", + "moves": "Short Rest Moves ({current}/{max})", "tendToWounds": { "name": "Tend to Wounds", "description": "Describe how you hastily patch yourself up, then clear a number of Hit Points equal to 1d4 + your tier. You can do this to an ally instead." diff --git a/module/applications/dialogs/downtime.mjs b/module/applications/dialogs/downtime.mjs index 8da8137d..0b263799 100644 --- a/module/applications/dialogs/downtime.mjs +++ b/module/applications/dialogs/downtime.mjs @@ -51,6 +51,9 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV async _prepareContext(_options) { const context = await super._prepareContext(_options); + context.title = game.i18n.localize( + `DAGGERHEART.APPLICATIONS.Downtime.${this.shortrest ? 'shortRest' : 'longRest'}.title` + ); context.selectedActivity = this.selectedActivity; context.moveData = this.moveData; context.nrCurrentChoices = Object.values(this.moveData).reduce((acc, category) => { diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 139a1369..0f6f8284 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -28,7 +28,8 @@ export default class CharacterSheet extends DHBaseActorSheet { useAction: this.useAction, toggleResourceDice: this.toggleResourceDice, handleResourceDice: this.handleResourceDice, - toChat: this.toChat + toChat: this.toChat, + useDowntime: this.useDowntime }, window: { resizable: true @@ -752,6 +753,12 @@ export default class CharacterSheet extends DHBaseActorSheet { } } + static useDowntime(_, button) { + new game.system.api.applications.dialogs.Downtime(this.document, button.dataset.type === 'shortRest').render( + true + ); + } + async _onDragStart(event) { const item = this.getItem(event); diff --git a/styles/less/global/tab-navigation.less b/styles/less/global/tab-navigation.less index 2880711d..014da89f 100755 --- a/styles/less/global/tab-navigation.less +++ b/styles/less/global/tab-navigation.less @@ -7,12 +7,22 @@ height: 40px; width: 100%; - .feature-tab { - border: none; + .navigation-container { + display: flex; + align-items: center; + gap: 8px; - a { - color: light-dark(@dark-blue, @golden); - font-family: @font-body; + .navigation-inner-container { + flex: 1; + + .feature-tab { + border: none; + + a { + color: light-dark(@dark-blue, @golden); + font-family: @font-body; + } + } } } } diff --git a/styles/less/sheets/actors/character/header.less b/styles/less/sheets/actors/character/header.less index 6110fcc6..b80da83d 100644 --- a/styles/less/sheets/actors/character/header.less +++ b/styles/less/sheets/actors/character/header.less @@ -193,5 +193,14 @@ } } } + + .character-downtime-container { + display: flex; + gap: 2px; + + button { + flex: 1; + } + } } } diff --git a/templates/dialogs/downtime/downtime.hbs b/templates/dialogs/downtime/downtime.hbs index c75a23d3..c8e44e5d 100644 --- a/templates/dialogs/downtime/downtime.hbs +++ b/templates/dialogs/downtime/downtime.hbs @@ -1,6 +1,6 @@
-

{{localize "DAGGERHEART.APPLICATIONS.Downtime.downtimeHeader"}}

+

{{title}}

diff --git a/templates/sheets/actors/character/header.hbs b/templates/sheets/actors/character/header.hbs index a09063d4..57860ffd 100644 --- a/templates/sheets/actors/character/header.hbs +++ b/templates/sheets/actors/character/header.hbs @@ -116,5 +116,14 @@ {{/each}}
- {{> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} + {{#> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} +
+ + + + + + +
+ {{/'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} \ No newline at end of file diff --git a/templates/sheets/global/tabs/tab-navigation.hbs b/templates/sheets/global/tabs/tab-navigation.hbs index 976aac89..10d76619 100755 --- a/templates/sheets/global/tabs/tab-navigation.hbs +++ b/templates/sheets/global/tabs/tab-navigation.hbs @@ -1,11 +1,18 @@
- - - +
\ No newline at end of file