From c1ee1a9ef842a30c0d7b6405b950dfbe6910c71d Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Fri, 1 Mar 2024 23:28:18 -0700 Subject: [PATCH] Get 95% of the way through the stats tab --- langs/en-ca.2.json | 6 +++ module/config.mjs | 14 ++++--- module/helpers/options.mjs | 7 +++- module/sheets/Actors/PC/Improved.mjs | 23 +++++----- .../sheets/actor/char-sheet/pages/stats.scss | 35 ++++++++++++---- .../sheets/actor/char-sheet/themes/dark.scss | 10 ++++- .../char-sheet/v2/partials/stats.v2.pc.hbs | 42 +++++++++++-------- 7 files changed, 91 insertions(+), 46 deletions(-) diff --git a/langs/en-ca.2.json b/langs/en-ca.2.json index 6e03f87..2d68788 100644 --- a/langs/en-ca.2.json +++ b/langs/en-ca.2.json @@ -30,6 +30,12 @@ "explosives": "Explosives", "piloting": "Piloting" }, + "trainingLevel": { + "untrained": "Untrained", + "trained": "Trained", + "expert": "Expert", + "locked": "Locked" + }, "die": { "d4": "d4", "d6": "d6", diff --git a/module/config.mjs b/module/config.mjs index 664ecd2..65ea399 100644 --- a/module/config.mjs +++ b/module/config.mjs @@ -1,11 +1,11 @@ export const statDice = [ `d4`, `d6`, `d8`, `d10`, `d12`, `d20` ]; -export const trainingLevels = { - locked: -1, - untrained: 0, - trained: 2, - expert: 4 -} +export const trainingLevels = [ + { key: "locked", label: "dotdungeon.trainingLevel.locked", value: -1 }, + { key: "untrained", label: "dotdungeon.trainingLevel.untrained", value: 0 }, + { key: "trained", label: "dotdungeon.trainingLevel.trained", value: 2 }, + { key: "expert", label: "dotdungeon.trainingLevel.expert", value: 4 }, +]; export const damageTypes = [ `slashing`, `piercing`, `smashing`, `gun`, `neon`, `shadow`, `solar` ]; @@ -32,6 +32,7 @@ export const skills = { hands: handsSkills, }; +export const defaultItemTier = `simple`; export const itemTiers = [ `simple`, `greater`, `rare`, `legendary` @@ -64,6 +65,7 @@ export default { handsSkills, allSkills, skills, + defaultItemTier, itemTiers, syncMilestones, syncDice, diff --git a/module/helpers/options.mjs b/module/helpers/options.mjs index 8775ebc..97a2d62 100644 --- a/module/helpers/options.mjs +++ b/module/helpers/options.mjs @@ -1,3 +1,5 @@ +import { localizer } from "../utils/localizer.mjs"; + /** * @typedef {object} Option * @property {string} [label] @@ -9,7 +11,8 @@ * @param {string | number} selected * @param {Array` ); }; diff --git a/module/sheets/Actors/PC/Improved.mjs b/module/sheets/Actors/PC/Improved.mjs index a84b852..9283e69 100644 --- a/module/sheets/Actors/PC/Improved.mjs +++ b/module/sheets/Actors/PC/Improved.mjs @@ -64,13 +64,16 @@ export class PlayerSheetv2 extends GenericActorSheet { selector. Disables all dice options that are selected, but not used by this stat. */ - stat.dieOptions = DOTDUNGEON.statDice.map(die => { - return { - value: die, - label: localizer(`dotdungeon.die.${die}`, { stat: statName }), - disabled: usedDice.has(die) && this.actor.system.stats[statName] !== die, - }; - }); + stat.dieOptions = [ + { label: `---`, value: `` }, + ...DOTDUNGEON.statDice.map(die => { + return { + value: die, + label: localizer(`dotdungeon.die.${die}`, { stat: statName }), + disabled: usedDice.has(die) && this.actor.system.stats[statName] !== die, + }; + }) + ]; /* Calculating the data needed in order to display all of the skills @@ -81,10 +84,10 @@ export class PlayerSheetv2 extends GenericActorSheet { const value = this.actor.system.skills[statName][skill]; stat.skills.push({ key: skill, - name: localizer(`dotdungeon.skills.${skill}`), + name: game.i18n.format(`dotdungeon.skills.${skill}`), value, - formula: `1` + stat.value + modifierToString(value), - rollDisabled: stat.value === `` || value === `locked`, + formula: `1` + stat.value + modifierToString(value, { spaces: true }), + rollDisabled: stat.value === `` || value === -1, }); }; diff --git a/styles/sheets/actor/char-sheet/pages/stats.scss b/styles/sheets/actor/char-sheet/pages/stats.scss index 995336a..fdc3638 100644 --- a/styles/sheets/actor/char-sheet/pages/stats.scss +++ b/styles/sheets/actor/char-sheet/pages/stats.scss @@ -7,12 +7,12 @@ .stat { border-radius: 8px; - color: white; select { height: 100%; outline: none; border: none; + text-align: center; } &__header { @@ -22,9 +22,17 @@ flex-direction: row; color: var(--stat-divider-text-color); gap: 8px; - > :first-child { + > h2 { flex-grow: 1; + color: var(--stat-header-text-color); } + .dice-select { + color: var(--stat-dice-select-text-color); + } + .roll-stat { + color: var(--stat-roll-button-text-color); + } + &:not(:only-child) { border-bottom: 1px solid var(--stat-divider-color); } @@ -36,12 +44,23 @@ gap: 8px; margin: 8px; align-items: center; - label { - text-align: end; - justify-self: right; - } - button { - margin-right: 25%; + + .skill { + &__label { + text-align: end; + justify-self: right; + color: var(--skill-name-text-color); + } + &__training { + color: var(--skill-training-select-text-color); + option { + background: var(--skill-training-select-bg); + } + } + &__roll { + margin-right: 25%; + color: var(--skill-roll-button-text-color); + } } } } diff --git a/styles/sheets/actor/char-sheet/themes/dark.scss b/styles/sheets/actor/char-sheet/themes/dark.scss index e315e3a..dfb2871 100644 --- a/styles/sheets/actor/char-sheet/themes/dark.scss +++ b/styles/sheets/actor/char-sheet/themes/dark.scss @@ -5,7 +5,7 @@ $surface: #121212; $primary: #005300; $secondary: #6c056c; $on-background: $t; -$on-surface: $t; +$on-surface: white; $on-primary: $t; $on-secondary: $t; @@ -25,6 +25,12 @@ $on-secondary: $t; --elevation-16dp-bg: color-mix(in lab, transparent, white 15%); --elevation-24dp-bg: color-mix(in lab, transparent, white 16%); + --stat-header-text-color: #{$on-surface}; + --stat-dice-select-text-color: #{$on-surface}; + --stat-roll-button-text-color: #{$on-surface}; --stat-divider-color: #{$secondary}; - --stat-header-text-color: white; + --skill-name-text-color: #{$on-surface}; + --skill-training-select: #{$surface}; + --skill-training-select-text-color: #{$on-surface}; + --skill-roll-button-text-color: #{$on-surface}; } diff --git a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs index 87bc6b1..3acf48e 100644 --- a/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs +++ b/templates/actors/char-sheet/v2/partials/stats.v2.pc.hbs @@ -1,38 +1,44 @@
- {{!-- - Iterate over each stat in the display data - - header: - - localized stat name - - stat dice dropdown - - roll button - - body (if skills present): - - iterate over all of the skills - - localized skill name - - training dropdown - - roll button - --}} {{#each computed.stats as | stat |}}

{{stat.name}}

-
{{#if stat.skills}} -
+
{{#each stat.skills as | skill |}} - - + +