toggle functionality added

This commit is contained in:
Nikhil Nagarajan 2025-11-09 16:34:32 -05:00
parent 8a832fa142
commit 4ce9cb98d8
3 changed files with 87 additions and 6 deletions

View file

@ -55,6 +55,7 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.isNPC = this.document.isNPC;
context.useResourcePips = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance).useResourcePips;
context.showAttribution = !game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
.hideAttribution;

View file

@ -154,7 +154,7 @@
color: light-dark(@beige, @dark-blue);
}
}
.status-value {
.slot-value {
position: absolute;
display: flex;
flex-direction: column;
@ -216,6 +216,20 @@
border-left: 1px solid @dark-golden;
}
}
}
.status-value {
position: absolute;
display: flex;
padding: 0 5px;
font-size: 1.5rem;
align-items: center;
width: 140px;
height: 40px;
justify-content: center;
text-align: center;
z-index: 2;
color: @beige;
input[type='number'] {
background: transparent;
@ -312,7 +326,7 @@
font-size: var(--font-size-12);
}
}
.status-value {
.slot-value {
position: absolute;
display: flex;
padding: 0 5px;
@ -372,6 +386,21 @@
}
}
}
.status-value {
position: absolute;
display: flex;
padding: 0 5px;
font-size: 1.2rem;
align-items: center;
width: 80px;
height: 30px;
justify-content: center;
text-align: center;
z-index: 2;
color: light-dark(@dark-blue, @beige);
input[type='number'] {
background: transparent;
font-size: 1.2rem;

View file

@ -18,7 +18,8 @@
<div class="info-section">
<div class="resources-section">
<div class="status-bar">
<div class='status-value'>
{{#if useResourcePips}}
<div class='slot-value'>
<div class="slot-bar">
{{#times document.system.resources.hitPoints.max}}
<span class='slot {{#if (gte ../document.system.resources.hitPoints.value (add this 1))}}filled{{/if}}' data-action='toggleHitPoints' data-value="{{add this 1}}">
@ -28,11 +29,28 @@
<div class="slot-label">
<span class="label">{{localize "DAGGERHEART.GENERAL.HitPoints.short"}}</span>
<span class="value">{{document.system.resources.hitPoints.value}} / {{document.system.resources.hitPoints.max}}</span>
</div>
</div>
</div>
{{else}}
<div class='status-value'>
<p><input class="bar-input" name="system.resources.hitPoints.value" min="0" max='{{document.system.resources.hitPoints.max}}'
value="{{document.system.resources.hitPoints.value}}" type="number"></p>
<p>/</p>
<p class="bar-label">{{document.system.resources.hitPoints.max}}</p>
</div>
<progress
class='progress-bar'
max='{{document.system.resources.hitPoints.max}}'
value='{{document.system.resources.hitPoints.value}}'
></progress>
<div class="status-label">
<h4>{{localize "DAGGERHEART.GENERAL.HitPoints.short"}}</h4>
</div>
{{/if}}
</div>
<div class="status-bar">
<div class='status-value'>
{{#if useResourcePips}}
<div class='slot-value'>
<div class="slot-bar">
{{#times document.system.resources.stress.max}}
<span class='slot {{#if (gte ../document.system.resources.stress.value (add this 1))}}filled{{/if}}' data-action='toggleStress' data-value="{{add this 1}}">
@ -46,6 +64,23 @@
</div>
</div>
</div>
{{else}}
<div class='status-value'>
<p><input class="bar-input" name="system.resources.stress.value" min="0" max='{{document.system.resources.stress.max}}'
value="{{document.system.resources.stress.value}}" type="number"></p>
<p>/</p>
<p class="bar-label">{{document.system.resources.stress.max}}</p>
</div>
<progress
class='progress-bar stress-color'
value='{{document.system.resources.stress.value}}'
min="0"
max='{{document.system.resources.stress.max}}'
></progress>
<div class="status-label">
<h4>{{localize "DAGGERHEART.GENERAL.stress"}}</h4>
</div>
{{/if}}
</div>
</div>
<div class="status-section">
@ -60,7 +95,8 @@
{{#if document.system.armor.system.marks}}
<div class="status-bar armor-slots">
<div class='status-value'>
{{#if useResourcePips}}
<div class='slot-value'>
<div class="slot-bar">
{{#times document.system.armorScore}}
<a class='armor-slot' data-action='toggleArmor' data-value="{{add this 1}}">
@ -77,6 +113,21 @@
<span class="value">{{document.system.armor.system.marks.value}} / {{document.system.armorScore}}</span>
</div>
</div>
{{else}}
<div class='status-value'>
<p><input class="bar-input armor-marks-input" value="{{document.system.armor.system.marks.value}}" type="number"></p>
<p>/</p>
<p class="bar-label">{{document.system.armorScore}}</p>
</div>
<progress
class='progress-bar stress-color'
value='{{document.system.armor.system.marks.value}}'
max='{{document.system.armorScore}}'
></progress>
<div class="status-label">
<h4>{{localize "DAGGERHEART.GENERAL.armorSlots"}}</h4>
</div>
{{/if}}
</div>
{{else}}
<div class="status-number armor-slots">