From cf80b18ba6b5fb2fdba6f9a5f2c12e83859d77ed Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Wed, 24 Mar 2021 20:10:14 +0100 Subject: [PATCH 01/12] Move core values and combat values to values tab and BEMify core values --- src/lang/de.json | 1 + src/lang/en.json | 1 + src/module/actor/sheets/actor-sheet.ts | 22 ++------ src/module/actor/sheets/character-sheet.ts | 21 +------ src/module/actor/sheets/creature-sheet.ts | 21 +------ src/module/handlebars/handlebars-partials.ts | 4 +- src/scss/components/_attributes_traits.scss | 56 ------------------- src/scss/components/_core_value.scss | 36 ++++++++++++ src/scss/components/_core_values.scss | 10 ++++ src/scss/ds4.scss | 3 +- src/templates/actor/character-sheet.hbs | 49 ++++++++-------- src/templates/actor/creature-sheet.hbs | 10 ++-- .../actor/partials/attributes-traits.hbs | 56 ------------------- src/templates/actor/partials/core-value.hbs | 27 +++++++++ src/templates/actor/partials/core-values.hbs | 11 ++++ src/templates/actor/partials/values-tab.hbs | 4 ++ 16 files changed, 129 insertions(+), 203 deletions(-) delete mode 100644 src/scss/components/_attributes_traits.scss create mode 100644 src/scss/components/_core_value.scss create mode 100644 src/scss/components/_core_values.scss delete mode 100644 src/templates/actor/partials/attributes-traits.hbs create mode 100644 src/templates/actor/partials/core-value.hbs create mode 100644 src/templates/actor/partials/core-values.hbs create mode 100644 src/templates/actor/partials/values-tab.hbs diff --git a/src/lang/de.json b/src/lang/de.json index 1da1dea4..b0addb6d 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -9,6 +9,7 @@ "DS4.RollableImageRollableTitle": "Für {name} würfeln", "DS4.DiceOverlayImageAltText": "Bild eines W20", "DS4.NotOwned": "Nicht besessen", + "DS4.HeadingValues": "Werte", "DS4.HeadingBiography": "Biografie", "DS4.HeadingDetails": "Details", "DS4.HeadingEffects": "Effekte", diff --git a/src/lang/en.json b/src/lang/en.json index f5d456c7..a6cf1868 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -9,6 +9,7 @@ "DS4.RollableImageRollableTitle": "Roll for {name}", "DS4.DiceOverlayImageAltText": "Image of a d20", "DS4.NotOwned": "No owner", + "DS4.HeadingValues": "Values", "DS4.HeadingBiography": "Biography", "DS4.HeadingDetails": "Details", "DS4.HeadingEffects": "Effects", diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index dd8dfd47..37849acd 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -14,10 +14,11 @@ export class DS4ActorSheet extends ActorSheet> { static get defaultOptions(): BaseEntitySheet.Options { const superDefaultOptions = super.defaultOptions; return mergeObject(superDefaultOptions, { + ...superDefaultOptions, classes: ["ds4", "sheet", "actor"], - width: 650, height: 600, scrollY: [ + ".values", ".inventory", ".spells", ".talents-abilities", @@ -25,23 +26,8 @@ export class DS4ActorSheet extends ActorSheet> { ".biography", ".special-creature-abilities", ], - template: superDefaultOptions.template, - viewPermission: superDefaultOptions.viewPermission, - closeOnSubmit: superDefaultOptions.closeOnSubmit, - submitOnChange: superDefaultOptions.submitOnChange, - submitOnClose: superDefaultOptions.submitOnClose, - editable: superDefaultOptions.editable, - baseApplication: superDefaultOptions.baseApplication, - top: superDefaultOptions.top, - left: superDefaultOptions.left, - popOut: superDefaultOptions.popOut, - minimizable: superDefaultOptions.minimizable, - resizable: superDefaultOptions.resizable, - id: superDefaultOptions.id, - dragDrop: superDefaultOptions.dragDrop, - filters: superDefaultOptions.filters, - title: superDefaultOptions.title, - tabs: superDefaultOptions.tabs, + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "values" }], + width: 650, }); } diff --git a/src/module/actor/sheets/character-sheet.ts b/src/module/actor/sheets/character-sheet.ts index 2e077ce6..437de822 100644 --- a/src/module/actor/sheets/character-sheet.ts +++ b/src/module/actor/sheets/character-sheet.ts @@ -8,27 +8,8 @@ export class DS4CharacterActorSheet extends DS4ActorSheet { static get defaultOptions(): BaseEntitySheet.Options { const superDefaultOptions = super.defaultOptions; return mergeObject(superDefaultOptions, { + ...superDefaultOptions, classes: ["ds4", "sheet", "actor", "character"], - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], - template: superDefaultOptions.template, - viewPermission: superDefaultOptions.viewPermission, - closeOnSubmit: superDefaultOptions.closeOnSubmit, - submitOnChange: superDefaultOptions.submitOnChange, - submitOnClose: superDefaultOptions.submitOnClose, - editable: superDefaultOptions.editable, - baseApplication: superDefaultOptions.baseApplication, - top: superDefaultOptions.top, - left: superDefaultOptions.left, - popOut: superDefaultOptions.popOut, - minimizable: superDefaultOptions.minimizable, - resizable: superDefaultOptions.resizable, - id: superDefaultOptions.id, - dragDrop: superDefaultOptions.dragDrop, - filters: superDefaultOptions.filters, - title: superDefaultOptions.title, - width: superDefaultOptions.width, - height: superDefaultOptions.height, - scrollY: superDefaultOptions.scrollY, }); } } diff --git a/src/module/actor/sheets/creature-sheet.ts b/src/module/actor/sheets/creature-sheet.ts index 91af61d2..8e032e86 100644 --- a/src/module/actor/sheets/creature-sheet.ts +++ b/src/module/actor/sheets/creature-sheet.ts @@ -8,27 +8,8 @@ export class DS4CreatureActorSheet extends DS4ActorSheet { static get defaultOptions(): BaseEntitySheet.Options { const superDefaultOptions = super.defaultOptions; return mergeObject(superDefaultOptions, { + ...superDefaultOptions, classes: ["ds4", "sheet", "actor", "creature"], - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], - template: superDefaultOptions.template, - viewPermission: superDefaultOptions.viewPermission, - closeOnSubmit: superDefaultOptions.closeOnSubmit, - submitOnChange: superDefaultOptions.submitOnChange, - submitOnClose: superDefaultOptions.submitOnClose, - editable: superDefaultOptions.editable, - baseApplication: superDefaultOptions.baseApplication, - top: superDefaultOptions.top, - left: superDefaultOptions.left, - popOut: superDefaultOptions.popOut, - minimizable: superDefaultOptions.minimizable, - resizable: superDefaultOptions.resizable, - id: superDefaultOptions.id, - dragDrop: superDefaultOptions.dragDrop, - filters: superDefaultOptions.filters, - title: superDefaultOptions.title, - width: superDefaultOptions.width, - height: superDefaultOptions.height, - scrollY: superDefaultOptions.scrollY, }); } } diff --git a/src/module/handlebars/handlebars-partials.ts b/src/module/handlebars/handlebars-partials.ts index 81945ebc..046ce8f6 100644 --- a/src/module/handlebars/handlebars-partials.ts +++ b/src/module/handlebars/handlebars-partials.ts @@ -10,9 +10,10 @@ export default async function registerHandlebarsPartials(): Promise { "systems/ds4/templates/actor/partials/spells-overview.hbs", "systems/ds4/templates/actor/partials/overview-add-button.hbs", "systems/ds4/templates/actor/partials/overview-control-buttons.hbs", - "systems/ds4/templates/actor/partials/attributes-traits.hbs", + "systems/ds4/templates/actor/partials/core-values.hbs", "systems/ds4/templates/actor/partials/combat-values.hbs", "systems/ds4/templates/actor/partials/profile.hbs", + "systems/ds4/templates/actor/partials/values-tab.hbs", "systems/ds4/templates/actor/partials/character-progression.hbs", "systems/ds4/templates/actor/partials/special-creature-abilities-overview.hbs", "systems/ds4/templates/actor/partials/character-inventory.hbs", @@ -22,6 +23,7 @@ export default async function registerHandlebarsPartials(): Promise { "systems/ds4/templates/actor/partials/item-list-entry.hbs", "systems/ds4/templates/actor/partials/currency.hbs", "systems/ds4/templates/common/partials/rollable-image.hbs", + "systems/ds4/templates/actor/partials/core-value.hbs", ]; await loadTemplates(templatePaths); } diff --git a/src/scss/components/_attributes_traits.scss b/src/scss/components/_attributes_traits.scss deleted file mode 100644 index fc29d362..00000000 --- a/src/scss/components/_attributes_traits.scss +++ /dev/null @@ -1,56 +0,0 @@ -@use "../utils/colors"; -@use "../utils/typography"; -@use "../utils/variables"; - -.attributes-traits { - margin-top: variables.$margin-sm; - .attribute { - .attribute-label { - @include typography.font-heading-upper; - font-size: 2em; - text-align: center; - } - .attribute-value { - border: variables.$border-groove; - font-size: 1.5em; - text-align: center; - padding-left: 2px; - padding-right: 2px; - gap: 0; - input, - .attribute-value-total { - grid-column: span 2; - line-height: variables.$default-input-height; - } - .attribute-value-arrow { - padding: 0 5px; - } - } - } - .trait { - .trait-label { - color: transparent; - @include typography.font-heading-upper; - font-size: 2em; - text-align: center; - //text-shadow: -1px 1px 0 $c-black, 1px 1px 0 $c-black, 1px -1px 0 $c-black, -1px -1px 0 $c-black; - -webkit-text-stroke: 1px colors.$c-black; - } - .trait-value { - border: variables.$border-groove; - font-size: 1.5em; - text-align: center; - padding-left: 2px; - padding-right: 2px; - gap: 0; - input, - .trait-value-total { - grid-column: span 2; - line-height: variables.$default-input-height; - } - .trait-value-arrow { - padding: 0 5px; - } - } - } -} diff --git a/src/scss/components/_core_value.scss b/src/scss/components/_core_value.scss new file mode 100644 index 00000000..b2fbd151 --- /dev/null +++ b/src/scss/components/_core_value.scss @@ -0,0 +1,36 @@ +@use "../utils/colors"; +@use "../utils/typography"; +@use "../utils/variables"; + +.ds4-core-value { + align-items: center; + display: flex; + + &__label { + @include typography.font-heading-upper; + flex: 1; + font-size: 2em; + text-align: center; + } + + &__value { + align-items: center; + display: flex; + flex: 1.1; + font-size: 1.2em; + gap: 0.15em; + text-align: center; + } + + &__value-input, + &__value-total { + flex: 1 1 4em; + } + + &--trait { + .ds4-core-value__label { + -webkit-text-stroke: 1px colors.$c-black; + color: transparent; + } + } +} diff --git a/src/scss/components/_core_values.scss b/src/scss/components/_core_values.scss new file mode 100644 index 00000000..be687512 --- /dev/null +++ b/src/scss/components/_core_values.scss @@ -0,0 +1,10 @@ +@use "../utils/colors"; +@use "../utils/typography"; +@use "../utils/variables"; + +.ds4-core-values { + column-gap: 0.5em; + display: grid; + grid-template-columns: repeat(3, 1fr); + row-gap: 0.5em; +} diff --git a/src/scss/ds4.scss b/src/scss/ds4.scss index 1d06a5fa..3fbc95a9 100644 --- a/src/scss/ds4.scss +++ b/src/scss/ds4.scss @@ -11,7 +11,8 @@ /* Styles limited to ds4 sheets */ .ds4 { - @include meta.load-css("components/attributes_traits"); + @include meta.load-css("components/core_values"); + @include meta.load-css("components/core_value"); @include meta.load-css("components/apps"); @include meta.load-css("components/basic_property"); @include meta.load-css("components/character_progression"); diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 0d252d9b..303c0bbb 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -2,7 +2,7 @@ {{!-- Sheet Header --}}
Actor Icon + height="100" width="100" />

@@ -15,68 +15,62 @@ + data-dtype="String" />

+ value="{{data.baseInfo.culture}}" data-dtype="String" />
+ for="data.progression.progressPoints.used">{{config.i18n.characterProgression.progressPoints}}
+ name="data.progression.progressPoints.used" value="{{data.progression.progressPoints.used}}" + data-dtype="Number" /> / - +
+ for="data.progression.talentPoints.used">{{config.i18n.characterProgression.talentPoints}}
+ id="data.progression.talentPoints.used" value="{{data.progression.talentPoints.used}}" + data-dtype="Number" /> / - +
+ value="{{data.baseInfo.class}}" data-dtype="String" />
+ for="data.baseInfo.heroClass">{{config.i18n.characterBaseInfo.heroClass}} + value="{{data.baseInfo.heroClass}}" data-dtype="String" />
-
- {{> systems/ds4/templates/actor/partials/attributes-traits.hbs}} - {{> systems/ds4/templates/actor/partials/combat-values.hbs}} -
{{!-- Sheet Tab Navigation --}}