diff --git a/src/ds4.scss b/src/ds4.scss index af018bb7..212a180f 100644 --- a/src/ds4.scss +++ b/src/ds4.scss @@ -1,26 +1,24 @@ -// Import utilities. -@import "scss/utils/typography"; -@import "scss/utils/colors"; -@import "scss/utils/mixins"; -@import "scss/utils/variables"; +@use 'sass:meta'; /* Global styles */ -@import "scss/global/window"; -@import "scss/global/grid"; -@import "scss/global/flex"; -@import "scss/global/accessibility"; +@include meta.load-css("scss/global/accessibility"); +@include meta.load-css("scss/global/flex"); +@include meta.load-css("scss/global/fonts"); +@include meta.load-css("scss/global/grid"); +@include meta.load-css("scss/global/window"); /* Styles limited to ds4 sheets */ .ds4 { - @import "scss/components/apps"; - @import "scss/components/forms"; - @import "scss/components/basic_property"; - @import "scss/components/tabs"; - @import "scss/components/items"; - @import "scss/components/talents"; - @import "scss/components/description"; - @import "scss/components/character_values"; - @import "scss/components/attributes_traits"; - @import "scss/components/combat_values"; - @import "scss/components/character_progression"; + @include meta.load-css("scss/components/attributes_traits"); + @include meta.load-css("scss/components/apps"); + @include meta.load-css("scss/components/basic_property"); + @include meta.load-css("scss/components/character_progression"); + @include meta.load-css("scss/components/character_values"); + @include meta.load-css("scss/components/combat_values"); + @include meta.load-css("scss/components/description"); + @include meta.load-css("scss/components/forms"); + @include meta.load-css("scss/components/item_list"); + @include meta.load-css("scss/components/tabs"); + @include meta.load-css("scss/components/talent_rank_equation"); + @include meta.load-css("scss/components/currency"); } diff --git a/src/fonts/Lora/LICENSE b/src/fonts/Lora/LICENSE new file mode 100644 index 00000000..ea469b65 --- /dev/null +++ b/src/fonts/Lora/LICENSE @@ -0,0 +1,44 @@ +Copyright (c) 2011-2013, Cyreal (www.cyreal.org a@cyreal.org), with +Reserved Font Name ‘Lora’ + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + +—————————————————————————————- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +—————————————————————————————- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. + +DEFINITIONS +“Font Software” refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. + +“Reserved Font Name” refers to any names specified as such after the copyright statement(s). + +“Original Version” refers to the collection of Font Software components as distributed by the Copyright Holder(s). + +“Modified Version” refers to any derivative made by adding to, deleting, or substituting—in part or in whole—any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. + +“Author” refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/src/fonts/Lora/Lora-Bold.woff b/src/fonts/Lora/Lora-Bold.woff new file mode 100644 index 00000000..3d2e1ecd Binary files /dev/null and b/src/fonts/Lora/Lora-Bold.woff differ diff --git a/src/fonts/Lora/Lora-BoldItalic.woff b/src/fonts/Lora/Lora-BoldItalic.woff new file mode 100644 index 00000000..cc53adb5 Binary files /dev/null and b/src/fonts/Lora/Lora-BoldItalic.woff differ diff --git a/src/fonts/Lora/Lora-Italic.woff b/src/fonts/Lora/Lora-Italic.woff new file mode 100644 index 00000000..2c2c863a Binary files /dev/null and b/src/fonts/Lora/Lora-Italic.woff differ diff --git a/src/fonts/Lora/Lora-Regular.woff b/src/fonts/Lora/Lora-Regular.woff new file mode 100644 index 00000000..c7d539f3 Binary files /dev/null and b/src/fonts/Lora/Lora-Regular.woff differ diff --git a/src/fonts/Lora/Lora.woff b/src/fonts/Lora/Lora.woff new file mode 100644 index 00000000..92d8a707 Binary files /dev/null and b/src/fonts/Lora/Lora.woff differ diff --git a/src/fonts/Woodstamp.otf b/src/fonts/Woodstamp.otf deleted file mode 100644 index c206d9d4..00000000 Binary files a/src/fonts/Woodstamp.otf and /dev/null differ diff --git a/src/fonts/Woodstamp.woff b/src/fonts/Woodstamp/Woodstamp.woff similarity index 100% rename from src/fonts/Woodstamp.woff rename to src/fonts/Woodstamp/Woodstamp.woff diff --git a/src/lang/de.json b/src/lang/de.json index f7c2fa70..31800739 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -143,6 +143,7 @@ "DS4.TalentRankMax": "Maximaler Rang", "DS4.TalentRankMod": "Zusätzlicher Rang", "DS4.TalentRankTotal": "Gesamter Rang", + "DS4.TalentRankOf": "von", "DS4.CharacterLanguageLanguages": "Sprachen", "DS4.CharacterLanguageAlphabets": "Schriftzeichen", "DS4.SpecialCreatureAbilityExperiencePoints": "Erfahrungspunkte", diff --git a/src/lang/en.json b/src/lang/en.json index baf7007d..0894350b 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -143,6 +143,7 @@ "DS4.TalentRankMax": "Maximum Ranks", "DS4.TalentRankMod": "Additional Ranks", "DS4.TalentRankTotal": "Total Ranks", + "DS4.TalentRankOf": "of", "DS4.CharacterLanguageLanguages": "Languages", "DS4.CharacterLanguageAlphabets": "Alphabets", "DS4.SpecialCreatureAbilityExperiencePoints": "Experience Points", diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index 1534131e..aee139ff 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -58,12 +58,17 @@ export class DS4ActorSheet extends ActorSheet> { * @returns The data fed to the template of the actor sheet */ async getData(): Promise> { + const itemsByType = Object.fromEntries( + Object.entries(this.actor.itemTypes).map(([itemType, items]) => { + return [itemType, items.map((item) => item.data).sort((a, b) => (a.sort || 0) - (b.sort || 0))]; + }), + ); const data = { ...this._addTooltipsToData(await super.getData()), // Add the localization config to the data: config: DS4, // Add the items explicitly sorted by type to the data: - itemsByType: this.actor.itemTypes, + itemsByType, }; return data; } @@ -224,7 +229,7 @@ export class DS4ActorSheet extends ActorSheet> { // unsupported: else { - throw TypeError("Binding of item property to this type of HTML element not supported; given: " + el); + throw new TypeError("Binding of item property to this type of HTML element not supported; given: " + el); } } diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 5ca1f257..c8243f4e 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -63,6 +63,10 @@ async function registerHandlebarsPartials() { "systems/ds4/templates/actor/partials/special-creature-abilities-overview.hbs", "systems/ds4/templates/actor/partials/character-inventory.hbs", "systems/ds4/templates/actor/partials/creature-inventory.hbs", + "systems/ds4/templates/actor/partials/talent-rank-equation.hbs", + "systems/ds4/templates/actor/partials/item-list-header.hbs", + "systems/ds4/templates/actor/partials/item-list-entry.hbs", + "systems/ds4/templates/actor/partials/currency.hbs", ]; return loadTemplates(templatePaths); } diff --git a/src/module/handlebars-helpers.ts b/src/module/handlebars-helpers.ts index 2790ea43..95144da3 100644 --- a/src/module/handlebars-helpers.ts +++ b/src/module/handlebars-helpers.ts @@ -1,6 +1,10 @@ -export default { htmlToPlainText }; +export default { htmlToPlainText, isEmpty }; function htmlToPlainText(input: string | null | undefined): string | null | undefined { if (!input) return; return $(input).text(); } + +function isEmpty(input: Array | null | undefined): boolean { + return (input?.length ?? 0) === 0; +} diff --git a/src/scss/components/_attributes_traits.scss b/src/scss/components/_attributes_traits.scss index ff99478f..fc29d362 100644 --- a/src/scss/components/_attributes_traits.scss +++ b/src/scss/components/_attributes_traits.scss @@ -1,13 +1,17 @@ +@use "../utils/colors"; +@use "../utils/typography"; +@use "../utils/variables"; + .attributes-traits { - margin-top: $margin-sm; + margin-top: variables.$margin-sm; .attribute { .attribute-label { - @include font-heading-upper; + @include typography.font-heading-upper; font-size: 2em; text-align: center; } .attribute-value { - border: 2px groove $c-border-groove; + border: variables.$border-groove; font-size: 1.5em; text-align: center; padding-left: 2px; @@ -16,7 +20,7 @@ input, .attribute-value-total { grid-column: span 2; - line-height: $default-input-height; + line-height: variables.$default-input-height; } .attribute-value-arrow { padding: 0 5px; @@ -26,14 +30,14 @@ .trait { .trait-label { color: transparent; - @include font-heading-upper; + @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 $c-black; + -webkit-text-stroke: 1px colors.$c-black; } .trait-value { - border: 2px groove $c-border-groove; + border: variables.$border-groove; font-size: 1.5em; text-align: center; padding-left: 2px; @@ -42,7 +46,7 @@ input, .trait-value-total { grid-column: span 2; - line-height: $default-input-height; + line-height: variables.$default-input-height; } .trait-value-arrow { padding: 0 5px; diff --git a/src/scss/components/_basic_property.scss b/src/scss/components/_basic_property.scss index 56668373..64a696c5 100644 --- a/src/scss/components/_basic_property.scss +++ b/src/scss/components/_basic_property.scss @@ -1,3 +1,5 @@ +@use "../utils/mixins"; + .basic-properties { flex: 0 0 100%; grid-gap: 2px; @@ -21,6 +23,6 @@ text-align: center; } - @include mark-invalid-or-disabled-input; + @include mixins.mark-invalid-or-disabled-input; } } diff --git a/src/scss/components/_character_progression.scss b/src/scss/components/_character_progression.scss index 729b2af1..1f9f3642 100644 --- a/src/scss/components/_character_progression.scss +++ b/src/scss/components/_character_progression.scss @@ -1,3 +1,7 @@ +@use "../utils/colors"; +@use "../utils/typography"; +@use "../utils/variables"; + .progression { .progression-entry { display: flex; @@ -8,16 +12,15 @@ padding-right: 3px; h2.progression-label { - @include font-heading-upper; + @include typography.font-heading-upper; display: block; height: 50px; padding: 0; - color: $c-light-grey; + color: colors.$c-light-grey; border: none; line-height: 50px; - margin: $header-top-margin 0; + margin: variables.$margin-sm 0; text-align: right; - //flex: 0; } input.progression-value { margin-left: 5px; diff --git a/src/scss/components/_combat_values.scss b/src/scss/components/_combat_values.scss index 431d838b..a0bea351 100644 --- a/src/scss/components/_combat_values.scss +++ b/src/scss/components/_combat_values.scss @@ -1,13 +1,16 @@ +@use "../utils/mixins"; +@use "../utils/variables"; + .combat-values { - margin-top: $margin-sm; + margin-top: variables.$margin-sm; .combat-value-with-formula { + $size: 60px; display: grid; place-items: center; - $size: 60px; - row-gap: $margin-sm; + row-gap: variables.$margin-sm; .combat-value { - $combat-values-icons-path: "#{$official-icons-path}/combat-values"; - @include centered-content; + $combat-values-icons-path: "#{variables.$official-icons-path}/combat-values"; + @include mixins.centered-content; height: $size; width: $size; flex: 0 0 auto; @@ -43,7 +46,7 @@ width: $size; text-align: center; span { - line-height: $default-input-height; + line-height: variables.$default-input-height; } } } diff --git a/src/scss/components/_currency.scss b/src/scss/components/_currency.scss new file mode 100644 index 00000000..582a6547 --- /dev/null +++ b/src/scss/components/_currency.scss @@ -0,0 +1,16 @@ +@use "../utils/variables"; + +.ds4-currency { + align-items: center; + display: flex; + gap: 1em; + margin: 0.5em 0; +} + +.ds4-currency-title { + border-bottom: variables.$border-groove; + font-weight: bold; + margin-bottom: 0; + margin-top: 1em; + padding-left: 1em; +} diff --git a/src/scss/components/_description.scss b/src/scss/components/_description.scss index 7afaf399..01187302 100644 --- a/src/scss/components/_description.scss +++ b/src/scss/components/_description.scss @@ -1,10 +1,13 @@ +@use "../utils/mixins"; +@use "../utils/variables"; + .side-properties { flex: 0; min-width: fit-content; max-width: 50%; margin: 5px 5px 5px 0; padding-right: 5px; - border-right: 2px groove $c-border-groove; + border-right: variables.$border-groove; .side-property { margin: 2px 0; @@ -13,7 +16,7 @@ justify-content: left; label { - line-height: $default-input-height; + line-height: variables.$default-input-height; font-weight: bold; padding-right: 3pt; } @@ -27,7 +30,7 @@ text-overflow: ellipsis; } - @include mark-invalid-or-disabled-input; + @include mixins.mark-invalid-or-disabled-input; input[type="checkbox"] { width: auto; diff --git a/src/scss/components/_forms.scss b/src/scss/components/_forms.scss index 7da745c8..672b56bd 100644 --- a/src/scss/components/_forms.scss +++ b/src/scss/components/_forms.scss @@ -1,8 +1,10 @@ -.item-form { - font-family: $font-primary; -} +@use "../utils/colors"; +@use "../utils/typography"; +@use "../utils/variables"; -$header-top-margin: 5px; +.item-form { + font-family: typography.$font-primary; +} header.sheet-header { flex: 0 0 auto; @@ -16,7 +18,7 @@ header.sheet-header { .profile-img { flex: 0 0 100px; height: 100px; - margin: $header-top-margin 10px $header-top-margin 0; + margin: variables.$margin-sm 10px variables.$margin-sm 0; } .header-fields { @@ -26,9 +28,9 @@ header.sheet-header { h1.charname { height: 50px; padding: 0px; - margin: $header-top-margin 10px $header-top-margin 0; + margin: variables.$margin-sm 10px variables.$margin-sm 0; border-bottom: 0; - @include font-heading-upper; + @include typography.font-heading-upper; display: block; input { width: 100%; @@ -36,19 +38,19 @@ header.sheet-header { margin: 0; border: none; background-color: transparent; - @include font-heading-upper; + @include typography.font-heading-upper; } } h2.item-type { - @include font-heading-upper; + @include typography.font-heading-upper; display: block; height: 50px; padding: 0px; flex: 0 0 auto; - color: $c-light-grey; + color: colors.$c-light-grey; border: none; line-height: 50px; - margin: $header-top-margin 0; + margin: variables.$margin-sm 0; text-align: right; } } diff --git a/src/scss/components/_item_list.scss b/src/scss/components/_item_list.scss new file mode 100644 index 00000000..afebd6cc --- /dev/null +++ b/src/scss/components/_item_list.scss @@ -0,0 +1,100 @@ +@use "../utils/mixins"; +@use "../utils/variables"; + +.ds4-item-list { + @include mixins.mark-invalid-or-disabled-input; + + $row-height: 1.75em; + + align-items: center; + display: grid; + grid-column-gap: 0.5em; + grid-row-gap: 0.2em; + margin: 0.5em 0; + overflow-y: auto; + padding: 0; + + &--weapon { + grid-template-columns: $row-height $row-height 3ch 3fr $row-height 1fr 3ch 5fr 4ch; + } + &--armor { + grid-template-columns: $row-height $row-height 3ch 3fr 1fr 1fr 3ch 5fr 4ch; + } + &--shield { + grid-template-columns: $row-height $row-height 3ch 1fr 3ch 3fr 4ch; + } + &--equipment { + grid-template-columns: $row-height $row-height 3ch 1fr 10ch 3fr 4ch; + } + &--loot { + grid-template-columns: $row-height 3ch 1fr 10ch 3fr 4ch; + } + &--spell { + grid-template-columns: $row-height $row-height 2fr $row-height 1fr 1fr 1fr 1fr 4ch; + } + &--talent { + grid-template-columns: $row-height 1fr 1fr 3fr 4ch; + } + &--racial-ability, + &--language, + &--alphabet, + &--special-creature-ability { + grid-template-columns: $row-height 1fr 3fr 4ch; + } + + &__row { + display: contents; // TODO: Once chromium supports `grid-template-columns: subgrid` (https://bugs.chromium.org/p/chromium/issues/detail?id=618969), switch to `display: grid; grid: 1/-1; grid-template-columns: subgrid` + + &--header { + font-weight: bold; + } + + > * { + height: $row-height; + line-height: $row-height; + white-space: nowrap; + } + } + + &__image { + background-position: center; + background-repeat: no-repeat; + background-size: 100%; + } + + &__editable { + background-color: transparent; + border: 0; + padding: 0; + + &--checkbox { + width: 100%; + height: 100%; + margin: 0px; + } + } + + &__description { + overflow: hidden; + text-overflow: ellipsis; + + :not(:first-child) { + display: none; + } + + > * { + font-size: 0.75em; + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + } + } +} + +.ds4-item-list-title { + border-bottom: variables.$border-groove; + font-weight: bold; + margin-bottom: 0; + margin-top: 1em; + padding-left: 1em; +} diff --git a/src/scss/components/_items.scss b/src/scss/components/_items.scss deleted file mode 100644 index 6382c587..00000000 --- a/src/scss/components/_items.scss +++ /dev/null @@ -1,84 +0,0 @@ -@use "sass:color"; - -.items-list { - list-style: none; - margin: 7px 0; - padding: 0; - overflow-y: auto; - - .item-header { - font-weight: bold; - } - - .item { - height: 30px; - line-height: 24px; - padding: 3px 0; - border-bottom: 1px solid #bbb; - - .item-image { - flex: 0 0 24px; - height: 100%; - //margin-right: 5px; - @include centered-content; - } - - img { - display: block; - border: none; - } - - input { - border: 0; - padding: 0; - background-color: transparent; - } - - input[type="checkbox"] { - width: auto; - height: 100%; - margin: 0px; - } - - @include mark-invalid-or-disabled-input; - } - - .item-name { - margin: 0; - } - - .item-controls { - flex: 0 0 86px; - text-align: right; - } - - .item-num-val { - text-align: center; - width: 2.5em; - padding: 0; - } - - .item-description { - font-size: 75%; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - height: 100%; - p { - text-overflow: ellipsis; - overflow: hidden; - } - p:first-child { - margin-top: 0px; - padding-top: 0px; - } - } -} - -.items-list-title { - margin-top: 2em; - margin-bottom: 0px; - padding-left: 1em; - border-bottom: 2px groove $c-border-groove; - font-weight: bold; -} diff --git a/src/scss/components/_tabs.scss b/src/scss/components/_tabs.scss index 30a316da..064923c3 100644 --- a/src/scss/components/_tabs.scss +++ b/src/scss/components/_tabs.scss @@ -1,10 +1,12 @@ +@use "../utils/variables"; + nav.tabs { height: auto; - border-top: 2px groove $c-border-groove; - border-bottom: 2px groove $c-border-groove; - + border-top: variables.$border-groove; + border-bottom: variables.$border-groove; .item { font-weight: bold; + white-space: nowrap; } .item.active { diff --git a/src/scss/components/_talent_rank_equation.scss b/src/scss/components/_talent_rank_equation.scss new file mode 100644 index 00000000..0b861f9b --- /dev/null +++ b/src/scss/components/_talent_rank_equation.scss @@ -0,0 +1,12 @@ +.ds4-talent-rank-equation { + display: flex; + gap: 0.5em; + + &__value { + background-color: transparent; + border: 0; + height: auto; + padding: 0; + text-align: center; + } +} diff --git a/src/scss/components/_talents.scss b/src/scss/components/_talents.scss deleted file mode 100644 index 2f8db41b..00000000 --- a/src/scss/components/_talents.scss +++ /dev/null @@ -1,3 +0,0 @@ -.talent-ranks-equation { - text-align: center; -} diff --git a/src/scss/global/_fonts.scss b/src/scss/global/_fonts.scss new file mode 100644 index 00000000..eff17092 --- /dev/null +++ b/src/scss/global/_fonts.scss @@ -0,0 +1,34 @@ +@font-face { + font-family: "Lora"; + font-style: normal; + font-weight: normal; + src: local("Lora"), url("fonts/Lora/Lora.woff") format("woff"); +} + +@font-face { + font-family: "Lora"; + font-style: normal; + font-weight: bold; + src: local("Lora"), url("fonts/Lora/Lora-Bold.woff") format("woff"); +} + +@font-face { + font-family: "Lora"; + font-style: italic; + font-weight: normal; + src: local("Lora"), url("fonts/Lora/Lora-Italic.woff") format("woff"); +} + +@font-face { + font-family: "Lora"; + font-style: italic; + font-weight: bold; + src: local("Lora"), url("fonts/Lora/Lora-BoldItalic.woff") format("woff"); +} + +@font-face { + font-family: "Wood Stamp"; + font-style: normal; + font-weight: normal; + src: local("Wood Stamp"), url("fonts/Woodstamp/Woodstamp.woff") format("woff"); +} diff --git a/src/scss/global/_window.scss b/src/scss/global/_window.scss index 36985d71..eeeb4fbf 100644 --- a/src/scss/global/_window.scss +++ b/src/scss/global/_window.scss @@ -1,5 +1,7 @@ +@use "../utils/typography"; + .window-app { - font-family: $font-primary; + font-family: typography.$font-primary; input[type="text"], input[type="number"], input[type="password"], diff --git a/src/scss/utils/_mixins.scss b/src/scss/utils/_mixins.scss index 7b030461..0c354845 100644 --- a/src/scss/utils/_mixins.scss +++ b/src/scss/utils/_mixins.scss @@ -1,3 +1,5 @@ +@use "./colors"; + @mixin element-invisible { position: absolute; @@ -22,14 +24,9 @@ @mixin mark-invalid-or-disabled-input { input:invalid { - background-color: $c-invalid-input; + background-color: colors.$c-invalid-input; } input:disabled { background-color: transparent; } } - -@mixin font-heading-upper { - font-family: $font-heading; - text-transform: uppercase; -} diff --git a/src/scss/utils/_typography.scss b/src/scss/utils/_typography.scss index a5838b07..5cf2892f 100644 --- a/src/scss/utils/_typography.scss +++ b/src/scss/utils/_typography.scss @@ -1,12 +1,8 @@ -@import url("https://fonts.googleapis.com/css2?family=Lora:wght@400;700&display=swap"); - -@font-face { - font-family: "Wood Stamp"; - font-style: normal; - font-weight: normal; - src: local("Wood Stamp"), url("fonts/Woodstamp.woff") format("woff"); -} - -$font-primary: "Lora", sans-serif; -$font-secondary: "Lora", sans-serif; +$font-primary: "Lora", serif; +$font-secondary: "Lora", serif; $font-heading: "Wood Stamp", sans-serif; + +@mixin font-heading-upper { + font-family: $font-heading; + text-transform: uppercase; +} diff --git a/src/scss/utils/_variables.scss b/src/scss/utils/_variables.scss index 25d50b77..f63ffea6 100644 --- a/src/scss/utils/_variables.scss +++ b/src/scss/utils/_variables.scss @@ -1,3 +1,5 @@ +@use "./colors"; + $padding-sm: 5px; $padding-md: 10px; $padding-lg: 20px; @@ -8,3 +10,5 @@ $margin-lg: $padding-lg; $default-input-height: 26px; $official-icons-path: "assets/icons/official"; + +$border-groove: 2px groove colors.$c-border-groove; diff --git a/src/templates/actor/partials/character-inventory.hbs b/src/templates/actor/partials/character-inventory.hbs index b27fff63..07a94705 100644 --- a/src/templates/actor/partials/character-inventory.hbs +++ b/src/templates/actor/partials/character-inventory.hbs @@ -1,21 +1,4 @@
- - {{!-- Money--}} -

{{localize 'DS4.CharacterCurrency'}}

-
    -
  1. - - - - - - -
  2. -
- + {{> systems/ds4/templates/actor/partials/currency.hbs}} {{> systems/ds4/templates/actor/partials/items-overview.hbs}} - -
\ No newline at end of file + diff --git a/src/templates/actor/partials/currency.hbs b/src/templates/actor/partials/currency.hbs new file mode 100644 index 00000000..821c769f --- /dev/null +++ b/src/templates/actor/partials/currency.hbs @@ -0,0 +1,8 @@ +

{{localize 'DS4.CharacterCurrency'}}

+
+ {{#each data.currency as |value key|}} + + + {{/each}} +
diff --git a/src/templates/actor/partials/item-list-entry.hbs b/src/templates/actor/partials/item-list-entry.hbs new file mode 100644 index 00000000..f74093b6 --- /dev/null +++ b/src/templates/actor/partials/item-list-entry.hbs @@ -0,0 +1,45 @@ +{{!-- +!-- Render an item list entry row. +!-- If the partial is called with a partial block, the partial block +!-- content is inserted before the description. +!-- @param itemData: The data of the item. +!-- @param isEquipable: A flag to enable the equipped column. +!-- @param hasQuantity: A flag to enable the quantity column. +!-- @param hideDescription: A flag to disable the description column. +!-- @param @partial-block: Custom column headers can be passed using the partial block. +--}} +
  • + {{!-- equipped --}} + {{#if isEquipable}} + + {{/if}} + + {{!-- image --}} +
    + + {{!-- amount --}} + {{#if hasQuantity}} + + {{/if}} + + {{!-- name --}} + + + {{!-- item type specifics --}} + {{#if @partial-block }} + {{> @partial-block}} + {{/if}} + + {{!-- description --}} + {{#unless hideDescription}} +
    + {{{itemData.data.description}}}
    + {{/unless}} + + {{!-- control buttons --}} + {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} +
  • diff --git a/src/templates/actor/partials/item-list-header.hbs b/src/templates/actor/partials/item-list-header.hbs new file mode 100644 index 00000000..4a478e3b --- /dev/null +++ b/src/templates/actor/partials/item-list-header.hbs @@ -0,0 +1,39 @@ +{{!-- +!-- Render an item list header row. +!-- If the partial is called with a partial block, the partial block +!-- content is inserted before the description heading. +!-- @param isEquipable: A flag to enable the equipped column. +!-- @param hasQuantity: A flag to enable the quantity column. +!-- @param hideDescription: A flag to disable the description column. +!-- @param @partial-block: Custom column headers can be passed using the partial block. +--}} +
  • + {{!-- equipped --}} + {{#if isEquipable}} +
    {{localize 'DS4.ItemEquippedAbbr'}}
    + {{/if}} + + {{!-- image --}} +
    + + {{!-- amount --}} + {{#if hasQuantity}} +
    #
    + {{/if}} + + {{!-- name --}} +
    {{localize 'DS4.ItemName'}}
    + + {{!-- item type specifics --}} + {{#if @partial-block }} + {{> @partial-block }} + {{/if}} + + {{!-- description --}} + {{#unless hideDescription}} +
    {{localize 'DS4.Description'}}
    + {{/unless}} + + {{!-- control buttons placeholder --}} +
    +
  • diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index e0dc4e20..c3544805 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -1,198 +1,132 @@ -{{!-- TODO: Refactor to avoid code duplication with special-creature-abilites-overview and talents-overview --}} - -{{!-- ======================================================================== --}} -{{!-- INLINE PARTIAL DEFINITIONS --}} -{{!-- ======================================================================== --}} - - -{{!-- -!-- Render the given partial block only if the given itemsArray has length > 0, -!-- else only an add button. -!-- -!-- @param itemsArray: the array with the items to check the length of -!-- @param dataType: the string type of the item ---}} -{{#*inline "ifHasItemOfType"}} -{{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}} -{{> @partial-block}} -{{/if}} -{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} -{{/inline}} - - -{{!-- -!-- Render a header row for a given data type. -!-- It is a flexbox with a child for each column head. -!-- An "equipped" heading is rendered except for the case dataType==='loot'. -!-- The partial assumes a variable dataType to be given in the context. -!-- If the partial is called with a partial block, the partial block -!-- content is inserted before the description heading. - -!-- @param datType: hand over the dataType to the partial as hash parameter -!-- @param partial-block: hand over custom children of the flexbox in the partial block. ---}} -{{#*inline "itemListHeader" }} -
  • - {{!-- equipped --}} - {{#if (ne dataType 'loot')}} -
    {{localize 'DS4.ItemEquippedAbbr'}}
    - {{/if}} - {{!-- image --}} -
    - {{!-- amount --}} -
    #
    - {{!-- name --}} -
    {{localize 'DS4.ItemName'}}
    - {{!-- item type specifics --}} - {{> @partial-block }} - {{!-- description --}} -
    {{localize 'DS4.Description'}}
    - {{!-- control buttons placeholder --}} -
    -
  • -{{/inline}} - -{{!-- -!-- Render a list row from a given item. -!-- It is a flexbox with a child for each item value of interest. -!-- An equipped checkbox is rendered except for the case item.data.type==='loot'. -!-- The partial assumes a variable item to be given in the context. -!-- If the partial is called with a partial block, the partial block -!-- content is inserted before the description. - -!-- @param item: hand over the item to the partial as hash parameter -!-- @param partial-block: hand over custom children of the flexbox in the partial block. ---}} -{{#*inline "itemListEntry"}} -
  • - {{!-- equipped --}} - {{#if (ne item.data.type 'loot')}} - - {{/if}} - {{!-- image --}} -
    - -
    - {{!-- amount --}} - - {{!-- name --}} - - {{!-- item type specifics --}} - {{> @partial-block}} - {{!-- description --}} -
    - {{{item.data.data.description}}}
    - {{!-- control buttons --}} - {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} -
  • -{{/inline}} - - -{{!-- ======================================================================== --}} - {{!-- WEAPONS --}} -

    {{localize 'DS4.ItemTypeWeaponPlural'}}

    -{{!-- {{#if (and (ne itemsByType.weapon undefined) (gt itemsByType.weapon.length 0)) }} --}} -{{#> ifHasItemOfType itemsArray=itemsByType.weapon dataType='weapon' }} -
      - {{#> itemListHeader dataType='weapon'}} -
      {{localize 'DS4.AttackTypeAbbr'}}
      -
      +

      {{localize 'DS4.ItemTypeWeaponPlural'}}

      +{{#unless (isEmpty itemsByType.weapon)}} +
        + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}} + {{!-- attack type --}} +
        {{localize 'DS4.AttackTypeAbbr'}}
        + + {{!-- weapon bonus --}} +
        {{localize 'DS4.WeaponBonusAbbr'}}
        -
        + + {{!-- opponent defense --}} +
        {{localize 'DS4.OpponentDefenseAbbr'}}
        - {{/itemListHeader}} - {{#each itemsByType.weapon as |item id|}} - {{#> itemListEntry item=item}} -
        - + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + + {{#each itemsByType.weapon as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}} + {{!-- attack type --}} +
        -
        {{ item.data.data.weaponBonus}}
        -
        {{ item.data.data.opponentDefense}}
        - {{/itemListEntry}} + + {{!-- weapon bonus --}} +
        {{ itemData.data.weaponBonus}}
        + + {{!-- opponent defense --}} +
        {{ itemData.data.opponentDefense}}
        + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
      -{{!-- {{else}} -{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='weapon' }} --}} -{{/ifHasItemOfType}} +{{/unless}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='weapon'}} {{!-- ARMOR --}} -

      {{localize 'DS4.ItemTypeArmorPlural'}}

      -{{#> ifHasItemOfType itemsArray=itemsByType.armor dataType='armor' }} -
        - {{#> itemListHeader dataType='armor'}} +

        {{localize 'DS4.ItemTypeArmorPlural'}}

        +{{#unless (isEmpty itemsByType.armor)}} +
          + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}} + {{!-- armor material type --}}
          {{localize 'DS4.ArmorMaterialTypeAbbr'}}
          + + {{!-- armor type --}}
          {{localize 'DS4.ArmorTypeAbbr'}}
          -
          + + {{!-- armor value --}} +
          {{localize 'DS4.ArmorValueAbbr'}}
          - {{/itemListHeader}} - {{#each itemsByType.armor as |item id|}} - {{#> itemListEntry item=item }} -
          - {{lookup ../../config.i18n.armorMaterialTypesAbbr item.data.data.armorMaterialType}} + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + + {{#each itemsByType.armor as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}} + {{!-- armor material type --}} +
          + {{lookup ../../config.i18n.armorMaterialTypesAbbr itemData.data.armorMaterialType}}
          -
          - {{lookup ../../config.i18n.armorTypesAbbr item.data.data.armorType}} + + {{!-- armor type --}} +
          + {{lookup ../../config.i18n.armorTypesAbbr itemData.dataData.armorType}}
          -
          {{ item.data.data.armorValue}}
          - {{/itemListEntry}} + + {{!-- armor value --}} +
          {{ itemData.data.armorValue}}
          + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
        -{{/ifHasItemOfType}} - +{{/unless}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='armor'}} {{!-- SHIELD --}} -

        {{localize 'DS4.ItemTypeShieldPlural'}}

        {{!-- SPECIFIC --}} -{{#> ifHasItemOfType itemsArray=itemsByType.shield dataType='shield' }} -
          - {{#> itemListHeader dataType='shield' }} -
          +

          {{localize 'DS4.ItemTypeShieldPlural'}}

          +{{#unless (isEmpty itemsByType.shield)}} +
            + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}} + {{!-- armor value --}} +
            {{localize 'DS4.ArmorValueAbbr'}}
            - {{/itemListHeader}} - {{#each itemsByType.shield as |item id|}} - {{#> itemListEntry item=item }} -
            {{item.data.data.armorValue}}
            {{!-- SPECIFIC --}} - {{/itemListEntry}} + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.shield as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}} + {{!-- armor value --}} +
            {{itemData.data.armorValue}}
            + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
          -{{/ifHasItemOfType}} +{{/unless}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='shield'}} {{!-- EQUIPMENT --}} -

          {{localize 'DS4.ItemTypeEquipmentPlural'}}

          -{{#> ifHasItemOfType itemsArray=itemsByType.equipment dataType='equipment' }} -
            - {{#> itemListHeader dataType='equipment'}} -
            {{localize 'DS4.StorageLocation'}}
            - {{/itemListHeader}} - {{#each itemsByType.equipment as |item id|}} - {{#> itemListEntry item=item }} - - {{/itemListEntry}} +

            {{localize 'DS4.ItemTypeEquipmentPlural'}}

            +{{#unless (isEmpty itemsByType.equipment)}} +
              + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hasQuantity=true}} + {{!-- storage location --}} +
              {{localize 'DS4.StorageLocation'}}
              + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.equipment as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true hasQuantity=true}} + {{!-- storage location --}} + + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
            -{{/ifHasItemOfType}} +{{/unless}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='equipment'}} {{!-- LOOT --}} -

            {{localize 'DS4.ItemTypeLootPlural'}}

            -{{#> ifHasItemOfType itemsArray=itemsByType.loot dataType='loot' }} -
              - {{#> itemListHeader dataType='loot'}} -
              {{localize 'DS4.StorageLocation'}}
              - {{/itemListHeader}} - {{#each itemsByType.loot as |item id|}} - {{#> itemListEntry item=item }} - - {{/itemListEntry}} +

              {{localize 'DS4.ItemTypeLootPlural'}}

              +{{#unless (isEmpty itemsByType.loot)}} +
                + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs hasQuantity=true}} + {{!-- storage location --}} +
                {{localize 'DS4.StorageLocation'}}
                + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.loot as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData hasQuantity=true}} + {{!-- storage location --}} + + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
              -{{/ifHasItemOfType}} +{{/unless}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='loot'}} diff --git a/src/templates/actor/partials/overview-add-button.hbs b/src/templates/actor/partials/overview-add-button.hbs index 86e5d774..ad60bc7f 100644 --- a/src/templates/actor/partials/overview-add-button.hbs +++ b/src/templates/actor/partials/overview-add-button.hbs @@ -1,11 +1,10 @@ {{! !-- Render an "add" button for adding an item of given data type. -!-- -!-- @param datType: hand over the dataType to the partial as hash parameter +!-- @param dataType: hand over the dataType to the partial as hash parameter }} \ No newline at end of file +
          diff --git a/src/templates/actor/partials/special-creature-abilities-overview.hbs b/src/templates/actor/partials/special-creature-abilities-overview.hbs index 8b9f5195..cf6a4a55 100644 --- a/src/templates/actor/partials/special-creature-abilities-overview.hbs +++ b/src/templates/actor/partials/special-creature-abilities-overview.hbs @@ -1,63 +1,11 @@ -{{!-- TODO: Refactor to avoid code duplication with items-overview and talents-overview --}} - -{{!-- ======================================================================== --}} -{{!-- INLINE PARTIAL DEFINITIONS --}} -{{!-- ======================================================================== --}} - -{{!-- -!-- Render a list row for a base item from a given item. -!-- Base item means it just has an image, a description, and a name (and effects). -!-- It is a flexbox with a child for each item value of interest. -!-- The partial assumes a variable item to be given in the context. -!-- -!-- @param item: hand over the item to the partial as hash parameter ---}} -{{#*inline "baseItemListEntry"}} -
        1. - {{!-- image --}} -
          - -
          - {{!-- name --}} - - {{!-- description --}} -
          - {{{item.data.data.description}}}
          - {{!-- control buttons --}} - {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} -
        2. -{{/inline}} - -{{!-- -!-- Render a list header for a base item list entries from a given item. -!-- The partial assumes a variable dataType to be given in the context. -!-- -!-- @param dataType: the string item type for the list ---}} -{{#*inline "baseItemListHeader"}} -
        3. - {{!-- image --}} -
          - {{!-- name --}} -
          {{localize 'DS4.ItemName'}}
          - {{!-- description --}} -
          {{localize 'DS4.Description'}}
          - {{!-- control buttons placeholder --}} -
          -
        4. -{{/inline}} - - -{{!-- ======================================================================== --}} - -
          -
            - {{> baseItemListHeader dataType='specialCreatureAbility' }} - {{#each itemsByType.specialCreatureAbility as |item id|}} - {{> baseItemListEntry item=item}} + {{#unless (isEmpty itemsByType.specialCreatureAbility)}} +
              + {{> systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.specialCreatureAbility as |itemData id|}} + {{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}} {{/each}}
            - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='specialCreatureAbility' }} + {{/unless}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='specialCreatureAbility'}}
          diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index 8bd974ad..e9861c77 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -5,30 +5,32 @@ {{!-- !-- Base template to display a value with unit. !-- @param unitDatum: the object to display; must have a value and a unit attribute -!-- @param localizationString +!-- @param titleKey: The key of the localized title to use. !-- @param unitNames: mapping of allowed unitDatum.unit values to localized unit name !-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation --}} {{#*inline "unit"}} -
          +
          {{#if unitDatum.value }} {{unitDatum.value}} {{lookup unitAbbrs unitDatum.unit}} {{else}}-{{/if}}
          {{/inline}} + {{!-- !-- Two templates based on the "unit" template for displaying values with unit. !-- Both accept a `config` object holding the unitNames and unitAbbr instead of !-- directly handing over the latter two. +!-- @param titleKey: The key of the localized title to use. --}} {{#*inline "temporalUnit"}} {{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum -localizationString=localizationString}} +titleKey=titleKey}} {{/inline}} {{#*inline "distanceUnit"}} {{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum -localizationString=localizationString}} +titleKey=titleKey}} {{/inline}} @@ -36,65 +38,50 @@ localizationString=localizationString}}
          -
            -
          1. - {{!-- equipped --}} -
            {{localize 'DS4.ItemEquippedAbbr'}} -
            - {{!-- image --}} -
            - {{!-- name --}} -
            {{localize 'DS4.ItemName'}}
            - {{!-- spell type --}} -
            {{localize 'DS4.SpellTypeAbbr'}}
            - {{!-- spell bonus --}} -
            {{localize 'DS4.SpellBonusAbbr'}}
            - {{!-- max. distance --}} -
            - {{!-- duration --}} -
            - {{!-- cooldown duration --}} -
            - {{!-- description --}} - {{!--
            {{localize 'DS4.Description'}}
            --}} - {{!-- control buttons placeholder --}} -
            -
          2. - {{#each itemsByType.spell as |item id|}} -
          3. - - {{!-- image --}} -
            - -
            - {{!-- name --}} - - {{!-- spell type --}} -
            - -
            - {{!-- spell bonus --}} - - {{!-- max. distance --}} - {{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance - config=../config}} - {{!-- duration --}} - {{> temporalUnit localizationString='DS4.SpellDuration' unitDatum=item.data.data.duration config=../config}} - {{!-- cooldown duration --}} - {{> temporalUnit localizationString='DS4.SpellCooldownDuration' unitDatum=item.data.data.cooldownDuration - config=../config}} - {{!-- description --}} - {{!--
            {{{item.data.data.description}}}
            --}} - {{!-- control buttons --}} - {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} -
          4. + {{#unless (isEmpty itemsByType.spell)}} +
              + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs isEquipable=true hideDescription=true}} + {{!-- spell type --}} +
              {{localize 'DS4.SpellTypeAbbr'}}
              + + {{!-- spell bonus --}} +
              {{localize 'DS4.SpellBonusAbbr'}}
              + + {{!-- max. distance --}} +
              + + {{!-- duration --}} +
              + + {{!-- cooldown duration --}} +
              + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.spell as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData isEquipable=true + hideDescription=true}} + {{!-- spell type --}} +
              +
              + + {{!-- spell bonus --}} + + + {{!-- max. distance --}} + {{> distanceUnit titleKey='DS4.SpellMaxDistance' unitDatum=itemData.data.maxDistance + config=../../config}} + + {{!-- duration --}} + {{> temporalUnit titleKey='DS4.SpellDuration' unitDatum=itemData.data.duration config=../../config}} + + {{!-- cooldown duration --}} + {{> temporalUnit titleKey='DS4.SpellCooldownDuration' unitDatum=itemData.data.cooldownDuration + config=../../config}} + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
            - {{!-- add button --}} + {{/unless}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='spell' }}
          diff --git a/src/templates/actor/partials/talent-rank-equation.hbs b/src/templates/actor/partials/talent-rank-equation.hbs new file mode 100644 index 00000000..e6e2f052 --- /dev/null +++ b/src/templates/actor/partials/talent-rank-equation.hbs @@ -0,0 +1,38 @@ +{{!-- ======================================================================== --}} +{{!-- 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"}} + +{{/inline}} + +{{!-- ======================================================================== --}} + +{{!-- +!-- Render an input element for a rank value property of an item. +!-- @param talentRank: The talent rank +--}} +
          + {{!-- acquired rank --}} + {{> talentRankValue talentRank=talentRank property='base' localizeString='DS4.TalentRankBase'}} +
          ( {{localize "DS4.TalentRankOf"}}
          + {{!-- maximum acquirable rank --}} + {{> talentRankValue talentRank=talentRank property='max' localizeString='DS4.TalentRankMax'}} +
          ) +
          + {{!-- additional ranks --}} + {{> talentRankValue talentRank=talentRank property='mod' localizeString='DS4.TalentRankMod'}} +
          =
          + {{!-- derived total rank --}} + {{> talentRankValue talentRank=talentRank property='total' localizeString='DS4.TalentRankTotal' + disabled='disabled'}} +
          diff --git a/src/templates/actor/partials/talents-abilities-overview.hbs b/src/templates/actor/partials/talents-abilities-overview.hbs index 70a4d43c..9ec53331 100644 --- a/src/templates/actor/partials/talents-abilities-overview.hbs +++ b/src/templates/actor/partials/talents-abilities-overview.hbs @@ -1,175 +1,55 @@ -{{!-- TODO: Refactor to avoid code duplication with creature-special-abilities-overview and talents-overview --}} - -{{!-- ======================================================================== --}} -{{!-- INLINE PARTIAL DEFINITIONS --}} -{{!-- ======================================================================== --}} - - -{{!-- -!-- Render the given partial block only if the given itemsArray has length > 0, -!-- else only an add button. -!-- -!-- @param itemsArray: the array with the items to check the length of -!-- @param dataType: the string type of the item ---}} -{{#*inline "ifHasItemOfType"}} -{{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}} -{{> @partial-block}} -{{/if}} -{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} -{{/inline}} - - -{{!-- -!-- Render an input element for a rank value property of an item. -!-- -!-- @param item: the item -!-- @param property: the key of the property in item.data.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 ---}} -{{#*inline "talentRankValue"}} - -{{/inline}} - - -{{!-- -!-- Render a talent list row from a given item. -!-- It is a flexbox with a child for each item value of interest. -!-- The partial assumes a variable item to be given in the context. -!-- -!-- @param item: hand over the item to the partial as hash parameter ---}} -{{#*inline "talentListEntry"}} -
        5. - {{!-- image --}} -
          - -
          - {{!-- name --}} - -
          - {{!-- acquired rank --}} - {{> talentRankValue item=item property='base' localizeString='DS4.TalentRankBase'}} - ( of - {{!-- maximum acquirable rank --}} - {{> talentRankValue item=item property='max' localizeString='DS4.TalentRankMax'}} - ) + - {{!-- additional ranks --}} - {{> talentRankValue item=item property='mod' localizeString='DS4.TalentRankMod'}} - = - {{!-- derived total rank --}} - {{> talentRankValue item=item property='total' localizeString='DS4.TalentRankTotal' disabled='disabled'}} -
          - {{!-- description --}} -
          - {{{item.data.data.description}}}
          - {{!-- control buttons --}} - {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} -
        6. -{{/inline}} - - -{{!-- -!-- Render a list row for a base item from a given item. -!-- Base item means it just has an image, a description, and a name (and effects). -!-- It is a flexbox with a child for each item value of interest. -!-- The partial assumes a variable item to be given in the context. -!-- -!-- @param item: hand over the item to the partial as hash parameter ---}} -{{#*inline "baseItemListEntry"}} -
        7. - {{!-- image --}} -
          - -
          - {{!-- name --}} - - {{!-- description --}} -
          - {{{item.data.data.description}}}
          - {{!-- control buttons --}} - {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} -
        8. -{{/inline}} - -{{!-- -!-- Render a list header for a base item list entry from a given item. -!-- The partial assumes a variable dataType to be given in the context. -!-- -!-- @param dataType: the string item type for the list ---}} -{{#*inline "baseItemListHeader"}} -
        9. - {{!-- image --}} -
          - {{!-- name --}} -
          {{localize 'DS4.ItemName'}}
          - {{!-- description --}} -
          {{localize 'DS4.Description'}}
          - {{!-- control buttons placeholder --}} -
          -
        10. -{{/inline}} - - -{{!-- ======================================================================== --}} - -
          -

          {{localize 'DS4.ItemTypeTalentPlural'}}

          - {{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }} -
            -
          1. - {{!-- image --}} -
            - {{!-- name --}} -
            {{localize 'DS4.ItemName'}}
            - {{!-- rank info --}} -
            {{localize 'DS4.TalentRank'}}
            - {{!-- description --}} -
            {{localize 'DS4.Description'}}
            - {{!-- control buttons placeholder --}} -
            -
          2. - {{#each itemsByType.talent as |item id|}} - {{> talentListEntry item=item}} + {{!-- TALENT --}} +

            {{localize 'DS4.ItemTypeTalentPlural'}}

            + {{#unless (isEmpty itemsByType.talent)}} +
              + {{#> systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{!-- rank --}} +
              {{localize 'DS4.TalentRank'}}
              + {{/systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.talent as |itemData id|}} + {{#> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}} + {{!-- rank --}} + {{> systems/ds4/templates/actor/partials/talent-rank-equation.hbs talentRank=itemData.data.rank}} + {{/systems/ds4/templates/actor/partials/item-list-entry.hbs}} {{/each}}
            - {{/ifHasItemOfType}} + {{/unless}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='talent'}} -

            {{localize 'DS4.ItemTypeRacialAbilityPlural'}}

            - {{#> ifHasItemOfType itemsArray=itemsByType.racialAbility dataType='racialAbility' }} -
              - {{> baseItemListHeader dataType='racialAbility' }} - {{#each itemsByType.racialAbility as |item id|}} - {{> baseItemListEntry item=item}} + {{!-- RACIAL ABILITY --}} +

              {{localize 'DS4.ItemTypeRacialAbilityPlural'}}

              + {{#unless (isEmpty itemsByType.racialAbility)}} +
                + {{> systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.racialAbility as |itemData id|}} + {{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}} {{/each}}
              - {{/ifHasItemOfType}} + {{/unless}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='racialAbility'}} -

              {{localize 'DS4.ItemTypeLanguagePlural'}}

              - {{#> ifHasItemOfType itemsArray=itemsByType.language dataType='language' }} -
                - {{> baseItemListHeader dataType='language' }} - {{#each itemsByType.language as |item id|}} - {{> baseItemListEntry item=item}} + {{!-- LANGUAGE --}} +

                {{localize 'DS4.ItemTypeLanguagePlural'}}

                + {{#unless (isEmpty itemsByType.language)}} +
                  + {{> systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.language as |itemData id|}} + {{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}} {{/each}}
                - {{/ifHasItemOfType}} + {{/unless}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='language'}} -

                {{localize 'DS4.ItemTypeAlphabetPlural'}}

                - {{#> ifHasItemOfType itemsArray=itemsByType.alphabet dataType='alphabet' }} -
                  - {{> baseItemListHeader dataType='alphabet' }} - {{#each itemsByType.alphabet as |item id|}} - {{> baseItemListEntry item=item}} + {{!-- ALPHABET --}} +

                  {{localize 'DS4.ItemTypeAlphabetPlural'}}

                  + {{#unless (isEmpty itemsByType.alphabet)}} +
                    + {{> systems/ds4/templates/actor/partials/item-list-header.hbs}} + {{#each itemsByType.alphabet as |itemData id|}} + {{> systems/ds4/templates/actor/partials/item-list-entry.hbs itemData=itemData}} {{/each}}
                  - {{/ifHasItemOfType}} + {{/unless}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='alphabet'}}