[Rework] Fear Tracker (#2097)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run

* rework fear tracker application, add static positions to hold the tracker, enhance token and bar display
This commit is contained in:
Murilo Brito 2026-07-21 16:50:03 -03:00 committed by GitHub
parent 26bcc2dddc
commit d50545af4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 457 additions and 112 deletions

View file

@ -8,6 +8,10 @@
value=setting.displayFear
localize=true}}
{{formGroup
fields.fearPosition
value=setting.fearPosition
localize=true}}
{{formGroup
fields.displayCountdownUI
value=setting.displayCountdownUI
localize=true}}

View file

@ -1,16 +1,48 @@
<div>
<div id="resource-fear" class="{{#if isGM}}isGM{{/if}}">
<div id="resource-fear" class="fear-tracker {{#if isGM}}isGM{{/if}}">
{{#if isFree}}
<div class="fear-header">
<div class="drag-handle">
<i class="fa-solid fa-grip-vertical"></i>
</div>
<span class="fear-title">{{localize 'DAGGERHEART.GENERAL.fear'}}</span>
</div>
{{/if}}
{{#if (eq display 'token')}}
{{#times max}}
<i class="fas fa-skull {{#if (gte @this ../current)}} inactive{{/if}}" style="filter: hue-rotate(calc(({{this}}/{{../max}})*75deg))" data-index="{{this}}" data-action="setFear"></i>
{{/times}}
<div class="fear-tokens">
{{#times max}}
<a
class="fear-token {{#if (gte @this ../current)}} inactive{{/if}}"
style="filter: hue-rotate(calc(({{this}}/{{../max}})*75deg))"
data-index="{{this}}" data-action="setFear"
>
<i class="fear-token fas fa-skull"></i>
</a>
{{/times}}
</div>
{{/if}}
{{#if (eq display 'bar')}}
{{#if isGM}}<div class="controls control-minus {{#if (lte current 0)}} disabled{{/if}}" data-increment="-1" data-action="increaseFear">-</div>{{/if}}
<div class="resource-bar fear-bar" style="--fear-percent: {{percent}}%">
<span>{{current}}/{{max}}</span>
<progress
class='progress-bar stress-color'
value='{{current}}'
max='{{max}}'
></progress>
<h4 class="label">{{current}} / {{max}}</h4>
</div>
{{#if isGM}}<div class="controls control-plus {{#if (gte current max)}} disabled{{/if}}" data-increment="+1" data-action="increaseFear">+</div>{{/if}}
{{#if isGM}}
<div class="controls">
<a class="{{#if (lte current 0)}} disabled{{/if}}" data-increment="-1" data-action="increaseFear"><i class="fa-solid fa-minus"></i></a>
<a class="{{#if (gte current max)}} disabled{{/if}}" data-increment="+1" data-action="increaseFear"><i class="fa-solid fa-plus"></i></a>
</div>
{{/if}}
{{/if}}
{{#if isFree}}
<a class="resize-handle">
<i class="fa-solid fa-chevron-right" style="transform: rotate(45deg);"></i>
</a>
{{/if}}
</div>
</div>