mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 07:36:26 +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": {
|
||||
"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;
|
||||
|
||||
export default class ResourceDiceDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(name, actorName, resource, options = {}) {
|
||||
constructor(name, recovery, actorName, resource, options = {}) {
|
||||
super(options);
|
||||
|
||||
this.name = name;
|
||||
this.recovery = recovery;
|
||||
this.actorName = actorName;
|
||||
this.resource = resource;
|
||||
}
|
||||
|
|
@ -39,7 +40,8 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli
|
|||
|
||||
async _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;
|
||||
}
|
||||
|
|
@ -66,9 +68,9 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli
|
|||
this.close();
|
||||
}
|
||||
|
||||
static async create(name, actorName, resource, options = {}) {
|
||||
static async create(name, recovery, actorName, resource, options = {}) {
|
||||
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.render({ force: true });
|
||||
});
|
||||
|
|
|
|||
|
|
@ -700,6 +700,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
|
||||
const rollValues = await game.system.api.applications.dialogs.ResourceDiceDialog.create(
|
||||
item.name,
|
||||
item.system.resource.recovery,
|
||||
this.document.name,
|
||||
item.system.resource
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,31 +1,6 @@
|
|||
.daggerheart.dialog.dh-style.views.resource-dice {
|
||||
.item-resources {
|
||||
display: flex;
|
||||
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%);
|
||||
}
|
||||
}
|
||||
.reroll-confirmation {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
footer {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
<div>
|
||||
<div class="item-resources">
|
||||
{{#each resource.diceStates as | state key |}}
|
||||
<div class="item-resource">
|
||||
<label>{{ifThen state.value state.value '?'}}</label>
|
||||
<img src="{{concat "systems/daggerheart/assets/icons/dice/hope/d" ../resource.dieFaces ".svg"}}" />
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="reroll-confirmation">
|
||||
<div>{{localize 'DAGGERHEART.APPLICATIONS.ResourceDice.rerollRecoveryInfo' name=name recovery=recovery }}</div>
|
||||
<div>{{localize 'DAGGERHEART.APPLICATIONS.ResourceDice.rerollConfirmation' name=name }}</div>
|
||||
</div>
|
||||
<footer>
|
||||
<button data-action="close">{{localize 'No'}}</button>
|
||||
<button data-action="rerollDice">{{localize "DAGGERHEART.APPLICATIONS.ResourceDice.rerollDice"}}</button>
|
||||
</footer>
|
||||
</div>
|
||||
|
|
@ -1,45 +1,70 @@
|
|||
<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}} />
|
||||
<div class="item-label">
|
||||
{{#if isCompanion}}
|
||||
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
||||
{{else}}
|
||||
<div class="item-name">{{item.name}}</div>
|
||||
{{/if}}
|
||||
{{#if (eq type 'weapon')}}
|
||||
<div class="item-tags">
|
||||
<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}}
|
||||
<a class="item-name" data-action="attackRoll">{{item.name}}</a>
|
||||
{{else}}
|
||||
<div class="item-name">{{item.name}}</div>
|
||||
{{/if}}
|
||||
{{#if (eq type 'weapon')}}
|
||||
<div class="item-tags">
|
||||
{{#if isSidebar}}
|
||||
<div class="item-labels">
|
||||
<div class="label">
|
||||
{{!-- {{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}} --}}
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
|
||||
<span> - </span>
|
||||
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||
{{!-- ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}}) --}}
|
||||
{{#each item.system.attack.damage.parts.0.type as | type | }}
|
||||
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
||||
<i class="fa-solid {{icon}}"></i>
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="tag">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||
(
|
||||
{{#each item.system.attack.damage.parts.0.type}}
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' this '.abbreviation')}}
|
||||
{{/each}}
|
||||
)
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if (eq type 'armor')}}
|
||||
{{#if isSidebar}}
|
||||
<div class="item-labels">
|
||||
<div class="label">
|
||||
{{!-- {{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.short')}} --}}
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.short')}}
|
||||
<span> - </span>
|
||||
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||
{{!-- ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}}) --}}
|
||||
{{#each item.system.attack.damage.parts.0.type as | type | }}
|
||||
{{#with (lookup @root.config.GENERAL.damageTypes type)}}
|
||||
<i class="fa-solid {{icon}}"></i>
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}:
|
||||
{{item.system.baseScore}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="tag">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}}
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}}
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}}
|
||||
(
|
||||
{{#each item.system.attack.damage.parts.0.type}}
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.DamageType.' this '.abbreviation')}}
|
||||
{{/each}}
|
||||
)
|
||||
</div>
|
||||
<div class="tag">
|
||||
{{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}}
|
||||
<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}}
|
||||
|
|
@ -102,7 +127,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
</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"}}
|
||||
{{/if}}
|
||||
{{#if (and (not isSidebar) item.system.quantity)}}
|
||||
|
|
@ -160,7 +185,9 @@
|
|||
<span></span>
|
||||
{{/unless}}
|
||||
<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}}
|
||||
<div class="item-buttons">
|
||||
{{#each item.system.actions as | action |}}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@
|
|||
</div>
|
||||
</a>
|
||||
{{/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>
|
||||
{{/if}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue