Fix the localization function and provide a special placeholder for when the user doesn't have a die assigned to their stat
This commit is contained in:
parent
c1ee1a9ef8
commit
2065596686
6 changed files with 71 additions and 40 deletions
|
|
@ -43,6 +43,14 @@
|
||||||
"d10": "d10",
|
"d10": "d10",
|
||||||
"d12": "d12",
|
"d12": "d12",
|
||||||
"d20": "d20"
|
"d20": "d20"
|
||||||
|
},
|
||||||
|
"sheet": {
|
||||||
|
"actor": {
|
||||||
|
"v2": {
|
||||||
|
"stat-not-chosen": "Select a dice to see the {name} skills",
|
||||||
|
"skill-roll-locked": "@dotdungeon.trainingLevel.locked"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ export class PlayerSheetv2 extends GenericActorSheet {
|
||||||
name: game.i18n.format(`dotdungeon.skills.${skill}`),
|
name: game.i18n.format(`dotdungeon.skills.${skill}`),
|
||||||
value,
|
value,
|
||||||
formula: `1` + stat.value + modifierToString(value, { spaces: true }),
|
formula: `1` + stat.value + modifierToString(value, { spaces: true }),
|
||||||
rollDisabled: stat.value === `` || value === -1,
|
rollDisabled: value === -1,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ export function localizer(key, args = {}, depth = 0) {
|
||||||
const subkey = match.groups.key;
|
const subkey = match.groups.key;
|
||||||
localized =
|
localized =
|
||||||
localized.slice(0, match.index)
|
localized.slice(0, match.index)
|
||||||
+ localizer(subkey.slice(1), args, depth + 1)
|
+ localizer(subkey, args, depth + 1)
|
||||||
+ localized.slice(match.index + subkey.length)
|
+ localized.slice(match.index + subkey.length + 1)
|
||||||
};
|
};
|
||||||
return localized;
|
return localized;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
.stat {
|
.stat {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
select {
|
select {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
@ -28,6 +30,9 @@
|
||||||
}
|
}
|
||||||
.dice-select {
|
.dice-select {
|
||||||
color: var(--stat-dice-select-text-color);
|
color: var(--stat-dice-select-text-color);
|
||||||
|
option {
|
||||||
|
background: var(--stat-dice-select-bg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.roll-stat {
|
.roll-stat {
|
||||||
color: var(--stat-roll-button-text-color);
|
color: var(--stat-roll-button-text-color);
|
||||||
|
|
@ -38,12 +43,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__skills {
|
&__empty {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
justify-content: center;
|
||||||
gap: 8px;
|
|
||||||
margin: 8px;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__skills {
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
padding: 8px;
|
||||||
|
|
||||||
.skill {
|
.skill {
|
||||||
&__label {
|
&__label {
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,12 @@ $on-secondary: $t;
|
||||||
|
|
||||||
--stat-header-text-color: #{$on-surface};
|
--stat-header-text-color: #{$on-surface};
|
||||||
--stat-dice-select-text-color: #{$on-surface};
|
--stat-dice-select-text-color: #{$on-surface};
|
||||||
|
--stat-dice-select-bg: #{$surface};
|
||||||
--stat-roll-button-text-color: #{$on-surface};
|
--stat-roll-button-text-color: #{$on-surface};
|
||||||
--stat-divider-color: #{$secondary};
|
--stat-divider-color: #{$secondary};
|
||||||
|
--stat-not-chosen-placeholder-text-color: #{$on-surface};
|
||||||
--skill-name-text-color: #{$on-surface};
|
--skill-name-text-color: #{$on-surface};
|
||||||
--skill-training-select: #{$surface};
|
--skill-training-select-bg: #{$surface};
|
||||||
--skill-training-select-text-color: #{$on-surface};
|
--skill-training-select-text-color: #{$on-surface};
|
||||||
--skill-roll-button-text-color: #{$on-surface};
|
--skill-roll-button-text-color: #{$on-surface};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,38 +17,46 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{{#if stat.skills}}
|
{{#if stat.skills}}
|
||||||
<div class="stat__skills skill">
|
{{#if stat.value}}
|
||||||
{{#each stat.skills as | skill |}}
|
<div class="stat__skills skill">
|
||||||
<label
|
{{#each stat.skills as | skill |}}
|
||||||
for="{{meta.idp}}-{{skill.key}}-training"
|
<label
|
||||||
class="skill__label"
|
for="{{@root.meta.idp}}-{{skill.key}}-training"
|
||||||
>
|
class="skill__label"
|
||||||
{{skill.name}}
|
>
|
||||||
</label>
|
{{skill.name}}
|
||||||
<select
|
</label>
|
||||||
name="system.skills.{{stat.key}}.{{skill.key}}"
|
<select
|
||||||
id="{{meta.idp}}-{{skill.key}}-training"
|
name="system.skills.{{stat.key}}.{{skill.key}}"
|
||||||
class="e-2dp skill__training"
|
id="{{@root.meta.idp}}-{{skill.key}}-training"
|
||||||
>
|
class="e-2dp skill__training"
|
||||||
{{{dd-options
|
>
|
||||||
skill.value
|
{{{dd-options
|
||||||
@root.config.trainingLevels
|
skill.value
|
||||||
localize=true
|
@root.config.trainingLevels
|
||||||
}}}
|
localize=true
|
||||||
</select>
|
}}}
|
||||||
<button
|
</select>
|
||||||
type="button"
|
<button
|
||||||
class="e-2dp skill__roll"
|
type="button"
|
||||||
{{disabled skill.rollDisabled}}
|
class="e-2dp skill__roll"
|
||||||
>
|
{{disabled skill.rollDisabled}}
|
||||||
{{#if skill.rollDisabled}}
|
>
|
||||||
Locked
|
{{#if skill.rollDisabled}}
|
||||||
{{else}}
|
{{dd-i18n "dotdungeon.sheet.actor.v2.skill-roll-locked"}}
|
||||||
{{skill.formula}}
|
{{else}}
|
||||||
{{/if}}
|
{{skill.formula}}
|
||||||
</button>
|
{{/if}}
|
||||||
{{/each}}
|
</button>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="stat__empty">
|
||||||
|
<p>
|
||||||
|
{{dd-i18n "dotdungeon.sheet.actor.v2.stat-not-chosen" stat}}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue