From 92b4bfd741478615216dbba1080e7bfbb7f8a910 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Fri, 6 Jun 2025 22:50:21 +0200 Subject: [PATCH] Added categories for combatants --- daggerheart.mjs | 3 +- lang/en.json | 8 +++ module/ui/combatTracker.mjs | 7 +- styles/daggerheart.css | 4 ++ styles/ui.less | 74 ++----------------- templates/ui/combat/combatTracker.hbs | 76 ++------------------ templates/ui/combat/combatTrackerSection.hbs | 75 +++++++++++++++++++ 7 files changed, 104 insertions(+), 143 deletions(-) create mode 100644 templates/ui/combat/combatTrackerSection.hbs diff --git a/daggerheart.mjs b/daggerheart.mjs index fcff2bbd..0153a62c 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -294,6 +294,7 @@ const preloadHandlebarsTemplates = async function () { 'systems/daggerheart/templates/sheets/pc/parts/heritageCard.hbs', 'systems/daggerheart/templates/sheets/pc/parts/advancementCard.hbs', 'systems/daggerheart/templates/views/parts/level.hbs', - 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' + 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs', + 'systems/daggerheart/templates/ui/combat/combatTrackerSection.hbs' ]); }; diff --git a/lang/en.json b/lang/en.json index 96185acb..a2656b4f 100755 --- a/lang/en.json +++ b/lang/en.json @@ -163,6 +163,14 @@ "Or": "Or", "Description": "Description", "Features": "Features", + "Adversary": { + "Singular": "Adversary", + "Plural": "Adversaries" + }, + "Character": { + "Singular": "Character", + "Plural": "Characters" + }, "RefreshType": { "Session": "Session", "Shortrest": "Short Rest", diff --git a/module/ui/combatTracker.mjs b/module/ui/combatTracker.mjs index 948f2f18..46f7f318 100644 --- a/module/ui/combatTracker.mjs +++ b/module/ui/combatTracker.mjs @@ -30,8 +30,13 @@ export default class DhCombatTracker extends foundry.applications.sidebar.tabs.C async _prepareTrackerContext(context, options) { await super._prepareTrackerContext(context, options); + const adversaries = context.turns.filter(x => x.isNPC); + const characters = context.turns.filter(x => !x.isNPC); + Object.assign(context, { - actionTokens: game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules).actionTokens + actionTokens: game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.variantRules).actionTokens, + adversaries, + characters }); } diff --git a/styles/daggerheart.css b/styles/daggerheart.css index cb56dddb..9968a8b8 100755 --- a/styles/daggerheart.css +++ b/styles/daggerheart.css @@ -1365,6 +1365,10 @@ filter: drop-shadow(0 0 3px gold); color: var(--button-hover-text-color); } +.combat-sidebar h5 { + margin: 0; + text-align: center; +} .chat-message.duality { border-color: black; padding: 8px 0 0 0; diff --git a/styles/ui.less b/styles/ui.less index 498aca68..032e5a43 100644 --- a/styles/ui.less +++ b/styles/ui.less @@ -1,73 +1,4 @@ .combat-sidebar { - // .encounter-gm-resources { - // flex: 0; - // display: flex; - // justify-content: center; - // padding: @largePadding 0; - - // .gm-resource-controls { - // display: flex; - // flex-direction: column; - // align-items: center; - // padding: 0 4px; - // justify-content: center; - // } - - // .gm-resource-tools { - // display: flex; - // flex-direction: column; - // justify-content: center; - // padding: 0 5px 0 @fullPadding; - - // i { - // margin: 0 @tinyMargin; - // font-size: 16px; - - // &.disabled { - // opacity: 0.6; - // } - - // &:hover:not(.disabled) { - // cursor: pointer; - // filter: drop-shadow(0 0 3px @mainShadow); - // } - // } - // } - - // .gm-resource { - // background: rgba(255, 255, 255, 0.1); - // padding: @fullPadding; - // border-radius: 8px; - // border: @normalBorder solid black; - // font-size: 20px; - // } - // } - - // .token-action-tokens { - // flex: 0 0 48px; - // text-align: center; - - // .use-action-token { - // &.disabled { - // opacity: 0.6; - // } - // } - // } - - // .icon-button { - // &.spaced { - // margin-left: @halfMargin; - // } - - // &.disabled { - // opacity: 0.6; - // } - - // &:hover:not(.disabled) { - // cursor: pointer; - // filter: drop-shadow(0 0 3px @mainShadow); - // } - // } .encounter-controls.combat { justify-content: space-between; @@ -157,4 +88,9 @@ } } } + + h5 { + margin: 0; + text-align: center; + } } diff --git a/templates/ui/combat/combatTracker.hbs b/templates/ui/combat/combatTracker.hbs index 4243193d..683c599b 100644 --- a/templates/ui/combat/combatTracker.hbs +++ b/templates/ui/combat/combatTracker.hbs @@ -1,72 +1,4 @@ -
    - {{#each turns}} -
  1. - {{!-- Image --}} - {{ name }} - - {{!-- Name & Controls --}} -
    - {{ name }} -
    - {{#if @root.user.isGM}} - - - {{/if}} - {{#if canPing}} - - {{/if}} - {{#unless @root.user.isGM}} - - {{/unless}} - {{!-- TODO: Target Control --}} -
    - {{#each effects.icons}} - {{ name }} - {{/each}} -
    -
    -
    - - {{!-- Resource --}} - {{#if resource includeZero=true}} -
    - {{ resource }} -
    - {{/if}} - - {{#if ../combat.round}} -
    - {{#if isOwner}} - {{#if (and (not isNPC) ../actionTokens.enabled)}} -
    - {{#times ../actionTokens.tokens}} - - {{/times}} -
    - {{/if}} - - {{#if @root.user.isGM}} - - {{else}} - - {{/if}} - {{/if}} -
    - {{/if}} -
  2. - {{/each}} -
+
+ {{> 'systems/daggerheart/templates/ui/combat/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.General.Character.Plural") turns=this.characters}} + {{> 'systems/daggerheart/templates/ui/combat/combatTrackerSection.hbs' this title=(localize "DAGGERHEART.General.Adversary.Plural") turns=this.adversaries}} +
\ No newline at end of file diff --git a/templates/ui/combat/combatTrackerSection.hbs b/templates/ui/combat/combatTrackerSection.hbs new file mode 100644 index 00000000..c0aa4139 --- /dev/null +++ b/templates/ui/combat/combatTrackerSection.hbs @@ -0,0 +1,75 @@ +
+
{{title}}
+
    + {{#each turns}} +
  1. + {{!-- Image --}} + {{ name }} + + {{!-- Name & Controls --}} +
    + {{ name }} +
    + {{#if @root.user.isGM}} + + + {{/if}} + {{#if canPing}} + + {{/if}} + {{#unless @root.user.isGM}} + + {{/unless}} + {{!-- TODO: Target Control --}} +
    + {{#each effects.icons}} + {{ name }} + {{/each}} +
    +
    +
    + + {{!-- Resource --}} + {{#if resource includeZero=true}} +
    + {{ resource }} +
    + {{/if}} + + {{#if ../combat.round}} +
    + {{#if isOwner}} + {{#if (and (not isNPC) ../actionTokens.enabled)}} +
    + {{#times ../actionTokens.tokens}} + + {{/times}} +
    + {{/if}} + + {{#if @root.user.isGM}} + + {{else}} + + {{/if}} + {{/if}} +
    + {{/if}} +
  2. + {{/each}} +
+
\ No newline at end of file