mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Fixed resource dice positioning
This commit is contained in:
parent
58f96a36c9
commit
9fc1005caa
7 changed files with 80 additions and 76 deletions
|
|
@ -390,7 +390,9 @@
|
||||||
},
|
},
|
||||||
"ResourceDice": {
|
"ResourceDice": {
|
||||||
"title": "{name} Resource",
|
"title": "{name} Resource",
|
||||||
"rerollDice": "Reroll Dice"
|
"rerollDice": "Reroll Dice",
|
||||||
|
"rerollRecoveryInfo": "{name} refresh on {recovery}.",
|
||||||
|
"rerollConfirmation": "Are you sure you want to reroll your {name} dice?"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||||
|
|
||||||
export default class ResourceDiceDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
export default class ResourceDiceDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
constructor(name, actorName, resource, options = {}) {
|
constructor(name, recovery, actorName, resource, options = {}) {
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.recovery = recovery;
|
||||||
this.actorName = actorName;
|
this.actorName = actorName;
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +40,8 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
const context = await super._prepareContext(_options);
|
const context = await super._prepareContext(_options);
|
||||||
context.resource = this.resource;
|
context.name = this.name;
|
||||||
|
context.recovery = game.i18n.localize(CONFIG.DH.GENERAL.refreshTypes[this.recovery].label);
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
@ -66,9 +68,9 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static async create(name, actorName, resource, options = {}) {
|
static async create(name, recovery, actorName, resource, options = {}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const app = new this(name, actorName, resource, options);
|
const app = new this(name, recovery, actorName, resource, options);
|
||||||
app.addEventListener('close', () => resolve(app.rollValues), { once: true });
|
app.addEventListener('close', () => resolve(app.rollValues), { once: true });
|
||||||
app.render({ force: true });
|
app.render({ force: true });
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -700,6 +700,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
|
|
||||||
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(
|
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(
|
||||||
item.name,
|
item.name,
|
||||||
|
item.system.resource.recovery,
|
||||||
this.document.name,
|
this.document.name,
|
||||||
item.system.resource
|
item.system.resource
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,6 @@
|
||||||
.daggerheart.dialog.dh-style.views.resource-dice {
|
.daggerheart.dialog.dh-style.views.resource-dice {
|
||||||
.item-resources {
|
.reroll-confirmation {
|
||||||
display: flex;
|
margin-bottom: 8px;
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 8px;
|
|
||||||
|
|
||||||
.item-resource {
|
|
||||||
width: 38px;
|
|
||||||
height: 38px;
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
label {
|
|
||||||
position: absolute;
|
|
||||||
color: light-dark(white, black);
|
|
||||||
filter: drop-shadow(0 0 1px @golden);
|
|
||||||
font-size: 24px;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
filter: brightness(0) saturate(100%) invert(97%) sepia(7%) saturate(580%) hue-rotate(332deg)
|
|
||||||
brightness(96%) contrast(95%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="item-resources">
|
<div class="reroll-confirmation">
|
||||||
{{#each resource.diceStates as | state key |}}
|
<div>{{localize 'DAGGERHEART.APPLICATIONS.ResourceDice.rerollRecoveryInfo' name=name recovery=recovery }}</div>
|
||||||
<div class="item-resource">
|
<div>{{localize 'DAGGERHEART.APPLICATIONS.ResourceDice.rerollConfirmation' name=name }}</div>
|
||||||
<label>{{ifThen state.value state.value '?'}}</label>
|
|
||||||
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/d" ../resource.dieFaces ".svg"}}" />
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
|
<button data-action="close">{{localize 'No'}}</button>
|
||||||
<button data-action="rerollDice">{{localize "DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"}}</button>
|
<button data-action="rerollDice">{{localize "DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"}}</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
|
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
|
||||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
|
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
|
||||||
<div class="item-label">
|
<div class="item-label-wrapper">
|
||||||
|
<div class="item-label {{#unless (and (not isSidebar) (or (eq item.system.resource.type 'simple') item.system.quantity))}}fullWidth{{/unless}}">
|
||||||
{{#if isCompanion}}
|
{{#if isCompanion}}
|
||||||
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
@ -42,6 +43,30 @@
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{#if (eq type 'armor')}}
|
||||||
|
{{#if isSidebar}}
|
||||||
|
<div class="item-labels">
|
||||||
|
<div class="label">
|
||||||
|
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
||||||
|
{{item.system.baseScore}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="item-tags">
|
||||||
|
<div class="tag">
|
||||||
|
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
||||||
|
{{item.system.baseScore}}
|
||||||
|
</div>
|
||||||
|
<div class="tag">
|
||||||
|
{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}:
|
||||||
|
{{item.system.baseThresholds.major}}
|
||||||
|
<span>/</span>
|
||||||
|
{{item.system.baseThresholds.severe}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq type 'domainCard')}}
|
{{#if (eq type 'domainCard')}}
|
||||||
{{#if isSidebar}}
|
{{#if isSidebar}}
|
||||||
|
|
@ -102,7 +127,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{#if (and (not isSidebar) item.system.resource)}}
|
{{#if (and (not isSidebar) (eq item.system.resource.type 'simple'))}}
|
||||||
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (and (not isSidebar) item.system.quantity)}}
|
{{#if (and (not isSidebar) item.system.quantity)}}
|
||||||
|
|
@ -160,7 +185,9 @@
|
||||||
<span></span>
|
<span></span>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<div class="item-description">{{#unless isSidebar}}{{{item.system.description}}}{{/unless}}</div>
|
<div class="item-description">{{#unless isSidebar}}{{{item.system.description}}}{{/unless}}</div>
|
||||||
|
{{#if (and (not isSidebar) (eq item.system.resource.type 'diceValue'))}}
|
||||||
|
{{> "systems/daggerheart/templates/sheets/global/partials/item-resource.hbs"}}
|
||||||
|
{{/if}}
|
||||||
{{#if featureType}}
|
{{#if featureType}}
|
||||||
<div class="item-buttons">
|
<div class="item-buttons">
|
||||||
{{#each item.system.actions as | action |}}
|
{{#each item.system.actions as | action |}}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<a data-action="handleResourceDice"><i class="fa-solid fa-gears resource-edit"></i></a>
|
<a data-action="handleResourceDice" data-tooltip="DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"><i class="fa-solid fa-dice resource-edit"></i></a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue