mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
finish resources tab
This commit is contained in:
parent
8b1850fc5c
commit
f33c40d8f8
8 changed files with 337 additions and 17 deletions
|
|
@ -6,13 +6,17 @@ export default class Party extends DHBaseActorSheet {
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['party'],
|
classes: ['party'],
|
||||||
position: {
|
position: {
|
||||||
width: 500
|
width: 550
|
||||||
},
|
},
|
||||||
window: {
|
window: {
|
||||||
resizable: true
|
resizable: true
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
deletePartyMember: this.#deletePartyMember
|
deletePartyMember: Party.#deletePartyMember,
|
||||||
|
toggleHope: Party.#toggleHope,
|
||||||
|
toggleHitPoints: Party.#toggleHitPoints,
|
||||||
|
toggleStress: Party.#toggleStress,
|
||||||
|
toggleArmorSlot: Party.#toggleArmorSlot
|
||||||
},
|
},
|
||||||
dragDrop: [{ dragSelector: '.actors-section .inventory-item', dropSelector: null }]
|
dragDrop: [{ dragSelector: '.actors-section .inventory-item', dropSelector: null }]
|
||||||
};
|
};
|
||||||
|
|
@ -22,7 +26,10 @@ export default class Party extends DHBaseActorSheet {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/actors/party/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/actors/party/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
partyMembers: { template: 'systems/daggerheart/templates/sheets/actors/party/party-members.hbs' },
|
partyMembers: { template: 'systems/daggerheart/templates/sheets/actors/party/party-members.hbs' },
|
||||||
resources: { template: 'systems/daggerheart/templates/sheets/actors/party/resources.hbs' },
|
resources: {
|
||||||
|
template: 'systems/daggerheart/templates/sheets/actors/party/resources.hbs',
|
||||||
|
scrollable: ['.resources']
|
||||||
|
},
|
||||||
notes: { template: 'systems/daggerheart/templates/sheets/actors/party/notes.hbs' }
|
notes: { template: 'systems/daggerheart/templates/sheets/actors/party/notes.hbs' }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -93,6 +100,54 @@ export default class Party extends DHBaseActorSheet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles a hope resource value.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async #toggleHope(_, target) {
|
||||||
|
const hopeValue = Number.parseInt(target.dataset.value);
|
||||||
|
const actor = await foundry.utils.fromUuid(target.dataset.actorId);
|
||||||
|
const newValue = actor.system.resources.hope.value >= hopeValue ? hopeValue - 1 : hopeValue;
|
||||||
|
await actor.update({ 'system.resources.hope.value': newValue });
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles a hp resource value.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async #toggleHitPoints(_, target) {
|
||||||
|
const hitPointsValue = Number.parseInt(target.dataset.value);
|
||||||
|
const actor = await foundry.utils.fromUuid(target.dataset.actorId);
|
||||||
|
const newValue = actor.system.resources.hitPoints.value >= hitPointsValue ? hitPointsValue - 1 : hitPointsValue;
|
||||||
|
await actor.update({ 'system.resources.hitPoints.value': newValue });
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles a stress resource value.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async #toggleStress(_, target) {
|
||||||
|
const stressValue = Number.parseInt(target.dataset.value);
|
||||||
|
const actor = await foundry.utils.fromUuid(target.dataset.actorId);
|
||||||
|
const newValue = actor.system.resources.stress.value >= stressValue ? stressValue - 1 : stressValue;
|
||||||
|
await actor.update({ 'system.resources.stress.value': newValue });
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles a armor slot resource value.
|
||||||
|
* @type {ApplicationClickAction}
|
||||||
|
*/
|
||||||
|
static async #toggleArmorSlot(_, target, element) {
|
||||||
|
const armorItem = await foundry.utils.fromUuid(target.dataset.itemUuid);
|
||||||
|
const armorValue = Number.parseInt(target.dataset.value);
|
||||||
|
const newValue = armorItem.system.marks.value >= armorValue ? armorValue - 1 : armorValue;
|
||||||
|
await armorItem.update({ 'system.marks.value': newValue });
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
async _onDragStart(event) {
|
async _onDragStart(event) {
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,6 @@ export default function DHApplicationMixin(Base) {
|
||||||
context.fields = this.document.schema.fields;
|
context.fields = this.document.schema.fields;
|
||||||
context.systemFields = this.document.system.schema.fields;
|
context.systemFields = this.document.system.schema.fields;
|
||||||
context.settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
context.settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
||||||
console.log(context);
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,12 @@ body.game:is(.performance-low, .noblur) {
|
||||||
.themed.theme-dark .application.daggerheart.sheet.dh-style,
|
.themed.theme-dark .application.daggerheart.sheet.dh-style,
|
||||||
.themed.theme-dark.application.daggerheart.sheet.dh-style,
|
.themed.theme-dark.application.daggerheart.sheet.dh-style,
|
||||||
&.theme-dark .application.daggerheart {
|
&.theme-dark .application.daggerheart {
|
||||||
background: @dark-blue;
|
&.adversary,
|
||||||
};
|
&.character,
|
||||||
|
&.item {
|
||||||
|
background: @dark-blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.application.sheet.dh-style {
|
.application.sheet.dh-style {
|
||||||
|
|
|
||||||
195
styles/less/sheets/actors/party/resources.less
Normal file
195
styles/less/sheets/actors/party/resources.less
Normal file
|
|
@ -0,0 +1,195 @@
|
||||||
|
@import '../../../utils/colors.less';
|
||||||
|
@import '../../../utils/fonts.less';
|
||||||
|
@import '../../../utils/mixin.less';
|
||||||
|
|
||||||
|
body.game:is(.performance-low, .noblur) {
|
||||||
|
.application.sheet.daggerheart.actor.dh-style.party .tab.resources .actors-list .actor-resources {
|
||||||
|
background: light-dark(@dark-blue, @dark-golden);
|
||||||
|
|
||||||
|
.actor-name {
|
||||||
|
background: light-dark(@dark-blue, @dark-golden);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.application.sheet.daggerheart.actor.dh-style.party {
|
||||||
|
.tab.resources {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.actors-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.actor-resources {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
background: light-dark(@dark-blue-40, @dark-golden-40);
|
||||||
|
border-radius: 6px;
|
||||||
|
max-width: 230px;
|
||||||
|
height: -webkit-fill-available;
|
||||||
|
|
||||||
|
.actor-name {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
background: light-dark(@dark-blue-90, @dark-golden-80);
|
||||||
|
backdrop-filter: blur(6.5px);
|
||||||
|
border-radius: 6px 6px 0px 0px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 1;
|
||||||
|
font-size: var(--font-size-20);
|
||||||
|
color: light-dark(@beige, @golden);
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actor-img {
|
||||||
|
height: 150px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 6px 6px 0px 0px;
|
||||||
|
mask-image: linear-gradient(180deg, black 88%, transparent 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.resources {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
margin: 10px;
|
||||||
|
|
||||||
|
.slot-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.slot-bar {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 5px;
|
||||||
|
width: 239px;
|
||||||
|
|
||||||
|
background-color: light-dark(@dark-blue-10, @dark-blue);
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid light-dark(@dark-blue, @golden);
|
||||||
|
border-radius: 6px;
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
|
.armor-slot {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
|
||||||
|
.fa-shield-halved {
|
||||||
|
color: light-dark(@dark-blue-40, @golden-40);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.slot {
|
||||||
|
width: 20px;
|
||||||
|
height: 10px;
|
||||||
|
border: 1px solid light-dark(@dark-blue, @golden);
|
||||||
|
background: light-dark(@dark-blue-10, @golden-10);
|
||||||
|
border-radius: 3px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.filled {
|
||||||
|
background: light-dark(@dark-blue, @golden);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.slot-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: light-dark(@beige, @dark-blue);
|
||||||
|
background: light-dark(@dark-blue, @golden);
|
||||||
|
padding: 0 5px;
|
||||||
|
width: fit-content;
|
||||||
|
font-weight: bold;
|
||||||
|
border-radius: 0px 0px 5px 5px;
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
|
||||||
|
.label {
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
padding-left: 6px;
|
||||||
|
border-left: 1px solid @dark-golden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hope-section {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
background-color: light-dark(transparent, @dark-blue);
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
padding: 5px 10px;
|
||||||
|
border: 1px solid light-dark(@dark-blue, @golden);
|
||||||
|
border-radius: 3px;
|
||||||
|
align-items: center;
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hope-value {
|
||||||
|
display: flex;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.threshold-section {
|
||||||
|
display: flex;
|
||||||
|
align-self: center;
|
||||||
|
gap: 10px;
|
||||||
|
background-color: light-dark(transparent, @dark-blue);
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
padding: 5px 10px;
|
||||||
|
border: 1px solid light-dark(@dark-blue, @golden);
|
||||||
|
border-radius: 3px;
|
||||||
|
align-items: center;
|
||||||
|
width: fit-content;
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
|
||||||
|
&.threshold-value {
|
||||||
|
color: light-dark(@dark, @beige);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actors-dragger {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
border: 1px dashed light-dark(@dark-blue-50, @beige-50);
|
||||||
|
border-radius: 3px;
|
||||||
|
color: light-dark(@dark-blue-50, @beige-50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
|
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
overflow: hidden;
|
overflow: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
@import './actors/party/header.less';
|
@import './actors/party/header.less';
|
||||||
@import './actors/party/party-members.less';
|
@import './actors/party/party-members.less';
|
||||||
@import './actors/party/sheet.less';
|
@import './actors/party/sheet.less';
|
||||||
|
@import './actors/party/resources.less';
|
||||||
|
|
||||||
@import './items/beastform.less';
|
@import './items/beastform.less';
|
||||||
@import './items/class.less';
|
@import './items/class.less';
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
@medium-red-40: #d0474740;
|
@medium-red-40: #d0474740;
|
||||||
|
|
||||||
@dark-golden: #2b1d03;
|
@dark-golden: #2b1d03;
|
||||||
|
@dark-golden-40: #2b1d0340;
|
||||||
@dark-golden-80: #2b1d0380;
|
@dark-golden-80: #2b1d0380;
|
||||||
|
|
||||||
@red: #e54e4e;
|
@red: #e54e4e;
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,82 @@
|
||||||
<legend>{{localize tabs.resources.label}}</legend>
|
<legend>{{localize tabs.resources.label}}</legend>
|
||||||
<ul class="actors-list">
|
<ul class="actors-list">
|
||||||
{{#each document.system.partyMembers as |actor id|}}
|
{{#each document.system.partyMembers as |actor id|}}
|
||||||
{{> 'daggerheart.inventory-item'
|
<li class="actor-resources">
|
||||||
item=actor
|
<h2 class="actor-name">{{actor.name}}</h2>
|
||||||
type='character'
|
<img class="actor-img" src="{{actor.img}}">
|
||||||
isActor=true
|
<div class="resources">
|
||||||
}}
|
<div class="slot-section">
|
||||||
|
<div class="slot-bar">
|
||||||
|
{{#times actor.system.resources.hitPoints.max}}
|
||||||
|
<span class='slot {{#if (gte actor.system.resources.hitPoints.value (add this 1))}}filled{{/if}}'
|
||||||
|
data-action='toggleHitPoints' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}">
|
||||||
|
</span>
|
||||||
|
{{/times}}
|
||||||
|
</div>
|
||||||
|
<div class="slot-label">
|
||||||
|
<span class="label">{{localize "DAGGERHEART.GENERAL.HitPoints.short"}}</span>
|
||||||
|
<span class="value">{{actor.system.resources.hitPoints.value}} / {{actor.system.resources.hitPoints.max}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="slot-section">
|
||||||
|
<div class="slot-bar">
|
||||||
|
{{#times actor.system.resources.stress.max}}
|
||||||
|
<span class='slot {{#if (gte actor.system.resources.stress.value (add this 1))}}filled{{/if}}'
|
||||||
|
data-action='toggleStress' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}">
|
||||||
|
</span>
|
||||||
|
{{/times}}
|
||||||
|
</div>
|
||||||
|
<div class="slot-label">
|
||||||
|
<span class="label">{{localize "DAGGERHEART.GENERAL.stress"}}</span>
|
||||||
|
<span class="value">{{actor.system.resources.stress.value}} / {{actor.system.resources.stress.max}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if actor.system.armor.system.marks}}
|
||||||
|
<div class="slot-section">
|
||||||
|
<div class="slot-bar">
|
||||||
|
{{#times actor.system.armorScore}}
|
||||||
|
<a class='armor-slot'
|
||||||
|
data-action='toggleArmorSlot' data-actor-id="{{actor.uuid}}" data-item-uuid="{{actor.system.armor.uuid}}" data-value="{{add this 1}}">
|
||||||
|
{{#if (gte actor.system.armor.system.marks.value (add this 1))}}
|
||||||
|
<i class="fa-solid fa-shield"></i>
|
||||||
|
{{else}}
|
||||||
|
<i class="fa-solid fa-shield-halved"></i>
|
||||||
|
{{/if}}
|
||||||
|
</a>
|
||||||
|
{{/times}}
|
||||||
|
</div>
|
||||||
|
<div class="slot-label">
|
||||||
|
<span class="label">{{localize "DAGGERHEART.GENERAL.armorSlots"}}</span>
|
||||||
|
<span class="value">{{actor.system.armor.system.marks.value}} / {{actor.system.armorScore}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="hope-section">
|
||||||
|
<h4>{{localize "DAGGERHEART.GENERAL.hope"}}</h4>
|
||||||
|
{{#times actor.system.resources.hope.max}}
|
||||||
|
<span class='hope-value' data-action='toggleHope' data-actor-id="{{actor.uuid}}" data-value="{{add this 1}}">
|
||||||
|
{{#if (gte actor.system.resources.hope.value (add this 1))}}
|
||||||
|
<i class='fa-solid fa-diamond'></i>
|
||||||
|
{{else}}
|
||||||
|
<i class='fa-regular fa-circle'></i>
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
{{/times}}
|
||||||
|
</div>
|
||||||
|
<div class="threshold-section">
|
||||||
|
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.minor"}}</h4>
|
||||||
|
<h4 class="threshold-value">{{actor.system.damageThresholds.major}}</h4>
|
||||||
|
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.major"}}</h4>
|
||||||
|
<h4 class="threshold-value">{{actor.system.damageThresholds.severe}}</h4>
|
||||||
|
<h4 class="threshold-label">{{localize "DAGGERHEART.GENERAL.DamageThresholds.severe"}}</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
{{#unless document.system.partyMembers.length}}
|
|
||||||
<div class="actors-dragger">
|
|
||||||
<span>{{localize "DAGGERHEART.GENERAL.dropActorsHere"}}</span>
|
|
||||||
</div>
|
|
||||||
{{/unless}}
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue