Display all of the pinned ammo on the sheet and tweak the list header style.
This commit is contained in:
parent
c495f45015
commit
a7e0fe899a
5 changed files with 32 additions and 25 deletions
|
|
@ -173,10 +173,13 @@
|
||||||
"rollTarget": "Target",
|
"rollTarget": "Target",
|
||||||
"difficulty": "(DC: {dc})",
|
"difficulty": "(DC: {dc})",
|
||||||
"RichEditor-no-collaborative": "Warning: This editor is not collaborative, that means that if you and someone else are editing it at the same time, you won't see that someone else is making changes until they save, and then your changes will be lost.",
|
"RichEditor-no-collaborative": "Warning: This editor is not collaborative, that means that if you and someone else are editing it at the same time, you won't see that someone else is making changes until they save, and then your changes will be lost.",
|
||||||
|
"starred-ammo-placeholder": "Starred Ammo Slot",
|
||||||
"AmmoTracker": {
|
"AmmoTracker": {
|
||||||
"no-ammo": "You don't have any ammo!",
|
"no-ammo": "You don't have any ammo!",
|
||||||
"pin-button": "Pin {name} to your character sheet",
|
"star-button": "Add {name} as a starred ammo",
|
||||||
"pin-button-tooltip": "Pin {name}"
|
"star-button-tooltip": "Add Star",
|
||||||
|
"unstar-button": "Remove {name} as a starred ammo",
|
||||||
|
"unstar-button-tooltip": "Remove Star"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notifs": {
|
"notifs": {
|
||||||
|
|
|
||||||
|
|
@ -140,20 +140,21 @@ export class HeroSkillsCardV1 extends GenericAppMixin(HandlebarsApplicationMixin
|
||||||
|
|
||||||
static async prepareAmmo(ctx) {
|
static async prepareAmmo(ctx) {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
ctx.favouriteAmmo = [];
|
let favouriteCount = 0;
|
||||||
|
ctx.favouriteAmmo = new Array(3).fill(null);
|
||||||
|
|
||||||
for (const ammo of ctx.actor.itemTypes.ammo) {
|
for (const ammo of ctx.actor.itemTypes.ammo) {
|
||||||
total += ammo.system.quantity;
|
total += ammo.system.quantity;
|
||||||
|
|
||||||
if (ctx.favouriteAmmo.length < 3 && ammo.getFlag(game.system.id, `favourited`)) {
|
if (favouriteCount < 3 && ammo.getFlag(game.system.id, `favourited`)) {
|
||||||
ctx.favouriteAmmo.push({
|
ctx.favouriteAmmo[favouriteCount] = {
|
||||||
uuid: ammo.uuid,
|
uuid: ammo.uuid,
|
||||||
name: ammo.name,
|
name: ammo.name,
|
||||||
quantity: ammo.system.quantity,
|
quantity: ammo.system.quantity,
|
||||||
});
|
};
|
||||||
|
favouriteCount++;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ctx.favouriteAmmo.length = 3; // assert array length
|
|
||||||
|
|
||||||
ctx.ammo = total;
|
ctx.ammo = total;
|
||||||
return ctx;
|
return ctx;
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="ammo half-pill with-icon">
|
<div class="ammo pill with-icon">
|
||||||
<rc-icon
|
<rc-icon
|
||||||
class="ammo-info-icon"
|
class="ammo-info-icon"
|
||||||
name="icons/info-circle"
|
name="icons/info-circle"
|
||||||
|
|
@ -121,12 +121,12 @@
|
||||||
{{#each favouriteAmmo as | data |}}
|
{{#each favouriteAmmo as | data |}}
|
||||||
{{#if data}}
|
{{#if data}}
|
||||||
<div
|
<div
|
||||||
class="half-pill fav-ammo"
|
class="pill fav-ammo"
|
||||||
data-item-id="{{data.uuid}}"
|
data-item-id="{{data.uuid}}"
|
||||||
>
|
>
|
||||||
<label for="{{@root.meta.idp}}-{{data.uuid}}-quantity">
|
<div>
|
||||||
{{data.name}}
|
{{data.name}}
|
||||||
</label>
|
</div>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value="{{data.quantity}}"
|
value="{{data.quantity}}"
|
||||||
|
|
@ -134,12 +134,15 @@
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
<div class="pill" style="opacity: 0.5; background: var(--alt-row-background);">
|
||||||
|
{{ rc-i18n "RipCrypt.Apps.starred-ammo-placeholder" }}
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{!-- * Currencies --}}
|
{{!-- * Currencies --}}
|
||||||
<div class="currencies">
|
<div class="currencies">
|
||||||
<div class="currency half-pill">
|
<div class="currency pill">
|
||||||
<label for="{{meta.idp}}-gold" >
|
<label for="{{meta.idp}}-gold" >
|
||||||
{{ rc-i18n "RipCrypt.common.currency.gold"}}
|
{{ rc-i18n "RipCrypt.common.currency.gold"}}
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -150,7 +153,7 @@
|
||||||
value="0"
|
value="0"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="currency half-pill">
|
<div class="currency pill">
|
||||||
<label for="{{meta.idp}}-silver" >
|
<label for="{{meta.idp}}-silver" >
|
||||||
{{ rc-i18n "RipCrypt.common.currency.silver"}}
|
{{ rc-i18n "RipCrypt.common.currency.silver"}}
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -161,7 +164,7 @@
|
||||||
value="0"
|
value="0"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="currency half-pill">
|
<div class="currency pill">
|
||||||
<label for="{{meta.idp}}-copper" >
|
<label for="{{meta.idp}}-copper" >
|
||||||
{{ rc-i18n "RipCrypt.common.currency.copper"}}
|
{{ rc-i18n "RipCrypt.common.currency.copper"}}
|
||||||
</label>
|
</label>
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
border-radius: 999px;
|
||||||
}
|
}
|
||||||
.skill-list {
|
.skill-list {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
@ -107,33 +108,30 @@
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.half-pill {
|
.pill {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background: var(--section-header-background);
|
background: var(--section-header-background);
|
||||||
border-radius: 0 999px 999px 0;
|
border-radius: 999px;
|
||||||
color: var(--section-header-text);
|
color: var(--section-header-text);
|
||||||
|
padding: 2px 0 2px 4px;
|
||||||
--input-background: var(--base-background);
|
--input-background: var(--base-background);
|
||||||
--input-text: var(--base-text);
|
--input-text: var(--base-text);
|
||||||
|
|
||||||
&.with-icon {
|
&.with-icon {
|
||||||
grid-template-columns: min-content minmax(0, 1.5fr) minmax(0, 1fr);
|
grid-template-columns: min-content minmax(0, 1.5fr) minmax(0, 1fr);
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
padding: 2px 0 2px 4px;
|
|
||||||
.label {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
label, .label {
|
label, .label {
|
||||||
|
padding: 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input, .input {
|
input, .input {
|
||||||
margin: 2px;
|
margin: 0 2px 0 0;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<div>
|
<div data-tooltip-direction="RIGHT">
|
||||||
{{#if ammos}}
|
{{#if ammos}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#each ammos as | data |}}
|
{{#each ammos as | data |}}
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
type="button"
|
type="button"
|
||||||
class="icon"
|
class="icon"
|
||||||
data-action="unfavourite"
|
data-action="unfavourite"
|
||||||
aria-label="Unpin ammo"
|
aria-label="{{ rc-i18n "RipCrypt.Apps.AmmoTracker.unstar-button" name=data.ammo.name }}"
|
||||||
|
data-tooltip="{{ rc-i18n "RipCrypt.Apps.AmmoTracker.unstar-button-tooltip" name=data.ammo.name }}"
|
||||||
>
|
>
|
||||||
<rc-icon
|
<rc-icon
|
||||||
name="icons/star"
|
name="icons/star"
|
||||||
|
|
@ -23,7 +24,8 @@
|
||||||
class="icon"
|
class="icon"
|
||||||
{{ disabled @root.atFavouriteLimit }}
|
{{ disabled @root.atFavouriteLimit }}
|
||||||
data-action="favourite"
|
data-action="favourite"
|
||||||
aria-label="Pin ammo"
|
aria-label="{{ rc-i18n "RipCrypt.Apps.AmmoTracker.star-button" name=data.ammo.name }}"
|
||||||
|
data-tooltip="{{ rc-i18n "RipCrypt.Apps.AmmoTracker.star-button-tooltip" name=data.ammo.name }}"
|
||||||
>
|
>
|
||||||
<rc-icon
|
<rc-icon
|
||||||
name="icons/star-empty"
|
name="icons/star-empty"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue