fix: simplify talent rank display in character sheet

This commit is contained in:
Johannes Loher 2022-11-10 03:32:52 +01:00
parent d99b1006ba
commit 1e7492073e
9 changed files with 3 additions and 73 deletions

View file

@ -232,7 +232,6 @@
"DS4.TalentRankMax": "Maximum", "DS4.TalentRankMax": "Maximum",
"DS4.TalentRankMod": "Zusätzlich", "DS4.TalentRankMod": "Zusätzlich",
"DS4.TalentRankTotal": "Gesamt", "DS4.TalentRankTotal": "Gesamt",
"DS4.TalentRankOf": "von",
"DS4.CharacterLanguageLanguages": "Sprachen", "DS4.CharacterLanguageLanguages": "Sprachen",
"DS4.CharacterLanguageAlphabets": "Schriftzeichen", "DS4.CharacterLanguageAlphabets": "Schriftzeichen",
"DS4.SpecialCreatureAbilityExperiencePoints": "Erfahrungspunkte", "DS4.SpecialCreatureAbilityExperiencePoints": "Erfahrungspunkte",

View file

@ -232,7 +232,6 @@
"DS4.TalentRankMax": "Maximum", "DS4.TalentRankMax": "Maximum",
"DS4.TalentRankMod": "Additional", "DS4.TalentRankMod": "Additional",
"DS4.TalentRankTotal": "Total", "DS4.TalentRankTotal": "Total",
"DS4.TalentRankOf": "of",
"DS4.CharacterLanguageLanguages": "Languages", "DS4.CharacterLanguageLanguages": "Languages",
"DS4.CharacterLanguageAlphabets": "Alphabets", "DS4.CharacterLanguageAlphabets": "Alphabets",
"DS4.SpecialCreatureAbilityExperiencePoints": "Experience Points", "DS4.SpecialCreatureAbilityExperiencePoints": "Experience Points",

View file

@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Johannes Loher
* SPDX-FileCopyrightText: 2021 Gesina Schwalbe
*
* SPDX-License-Identifier: MIT
*/
.ds4-talent-rank-equation {
display: flex;
gap: 0.5em;
&__value {
&[type="number"] {
background-color: transparent;
border: 0;
height: auto;
padding: 0;
text-align: center;
}
}
}

View file

@ -59,7 +59,7 @@
} }
} }
&--talent { &--talent {
grid-template-columns: $row-height 1fr 21ch 3fr 5ch; grid-template-columns: $row-height 1fr 4ch 3fr 5ch;
:nth-child(9n + 3) { :nth-child(9n + 3) {
justify-self: center; justify-self: center;
} }

View file

@ -39,7 +39,6 @@
@use "components/actor/currency"; @use "components/actor/currency";
@use "components/actor/description"; @use "components/actor/description";
@use "components/actor/profile"; @use "components/actor/profile";
@use "components/actor/talent_rank_equation";
// item // item
@use "components/item/item_header"; @use "components/item/item_header";

View file

@ -15,7 +15,7 @@ export function disableOverriddenFields(
for (const key of Object.keys(foundry.utils.flattenObject(overrides))) { for (const key of Object.keys(foundry.utils.flattenObject(overrides))) {
const elements = form?.querySelectorAll(selector(key)); const elements = form?.querySelectorAll(selector(key));
elements?.forEach((element) => { elements?.forEach((element) => {
if (inputs.includes(element.tagName)) { if (inputs.includes(element.tagName) && !element.hasAttribute("disabled")) {
element.setAttribute("disabled", ""); element.setAttribute("disabled", "");
const title = element.getAttribute("title"); const title = element.getAttribute("title");
const newTitle = title === null ? titleAddition : `${title} ${titleAddition}`; const newTitle = title === null ? titleAddition : `${title} ${titleAddition}`;

View file

@ -25,7 +25,6 @@ export async function registerHandlebarsPartials(): Promise<void> {
"systems/ds4/templates/sheets/actor/components/item-list-header.hbs", "systems/ds4/templates/sheets/actor/components/item-list-header.hbs",
"systems/ds4/templates/sheets/actor/components/items-overview.hbs", "systems/ds4/templates/sheets/actor/components/items-overview.hbs",
"systems/ds4/templates/sheets/actor/components/profile.hbs", "systems/ds4/templates/sheets/actor/components/profile.hbs",
"systems/ds4/templates/sheets/actor/components/talent-rank-equation.hbs",
"systems/ds4/templates/sheets/actor/tabs/biography.hbs", "systems/ds4/templates/sheets/actor/tabs/biography.hbs",
"systems/ds4/templates/sheets/actor/tabs/character-abilities.hbs", "systems/ds4/templates/sheets/actor/tabs/character-abilities.hbs",
"systems/ds4/templates/sheets/actor/tabs/character-inventory.hbs", "systems/ds4/templates/sheets/actor/tabs/character-inventory.hbs",

View file

@ -1,45 +0,0 @@
{{!--
SPDX-FileCopyrightText: 2021 Johannes Loher
SPDX-FileCopyrightText: 2021 Gesina Schwalbe
SPDX-License-Identifier: MIT
--}}
{{!-- ======================================================================== --}}
{{!-- INLINE PARTIAL DEFINITIONS --}}
{{!-- ======================================================================== --}}
{{!--
!-- Render an input element for a rank value property of an item.
!-- @param talentRank: The talentRank
!-- @param property: The key of the property in item.data (if 'base', the max value is set automatically)
!-- @param disabled: If given, is placed plainly into the input as HTML property; meant to be set to "disabled" to
disable the input element
!-- @param localizeString: The string to use as key for the localized tooltip
--}}
{{#*inline "talentRankValue"}}
<input class="ds4-talent-rank-equation__value change-item" data-dtype="Number" type="number" min="0" step="1" {{#if (eq
property 'base' ) }}max="{{talentRank.max}}" {{/if}} {{disabled}} data-property="data.rank.{{property}}"
value="{{lookup talentRank property}}" title="{{localize localizeString}}" />
{{/inline}}
{{!-- ======================================================================== --}}
{{!--
!-- Render an input element for a rank value property of an item.
!-- @param talentRank: The talent rank
--}}
<div class="ds4-talent-rank-equation">
{{!-- acquired rank --}}
{{> talentRankValue talentRank=talentRank property='base' localizeString='DS4.TalentRankBase'}}
<div> ( {{localize "DS4.TalentRankOf"}} </div>
{{!-- maximum acquirable rank --}}
{{> talentRankValue talentRank=talentRank property='max' localizeString='DS4.TalentRankMax'}}
<div>) + </div>
{{!-- additional ranks --}}
{{> talentRankValue talentRank=talentRank property='mod' localizeString='DS4.TalentRankMod'}}
<div> = </div>
{{!-- derived total rank --}}
{{> talentRankValue talentRank=talentRank property='total' localizeString='DS4.TalentRankTotal'
disabled='disabled'}}
</div>

View file

@ -18,7 +18,7 @@ SPDX-License-Identifier: MIT
{{#each itemsByType.talent as |itemData id|}} {{#each itemsByType.talent as |itemData id|}}
{{#> systems/ds4/templates/sheets/actor/components/item-list-entry.hbs itemData=itemData}} {{#> systems/ds4/templates/sheets/actor/components/item-list-entry.hbs itemData=itemData}}
{{!-- rank --}} {{!-- rank --}}
{{> systems/ds4/templates/sheets/actor/components/talent-rank-equation.hbs talentRank=itemData.data.rank}} <div>{{itemData.data.rank.total}}</div>
{{/systems/ds4/templates/sheets/actor/components/item-list-entry.hbs}} {{/systems/ds4/templates/sheets/actor/components/item-list-entry.hbs}}
{{/each}} {{/each}}
</ol> </ol>