diff --git a/src/module/sheets/character/advsf.mjs b/src/module/sheets/character/advsf.mjs new file mode 100644 index 00000000..7b77ed96 --- /dev/null +++ b/src/module/sheets/character/advsf.mjs @@ -0,0 +1,45 @@ +export default { + _prepareContext: async (context, options, object) => { + + const actorData = context.document + context.system = actorData.system + context.flags = actorData.flags + context.derived = context.document.system + context.originalName = actorData.name + context.name = context.derived.name ?? actorData.name + context.effects = actorData.effects ?? [] + context.advantages = [] + + actorData.itemTypes.Advantage.forEach((item) => { + context.advantages.push({ + id: item._id, + name: item.name, + value: item.system.value, + options: item.system.auswahl, + description: item.system.description, + isAdvantage: !item.system.nachteil, + isDisadvantage: item.system.nachteil, + isBadAttribute: item.system.schlechteEigenschaft + }) + } + ) + + context.specialAbilities = [] + actorData.itemTypes.SpecialAbility.forEach((item) => { + context.specialAbilities.push({ + id: item._id, + name: item.name, + }); + } + ); + + return context + }, + _onRender: (context, options) => { + + }, + _getTabConfig: (group) => { + group.tabs.push({id: "advsf", group: "sheet", label: "Vorteile"}) + }, + template: `systems/DSA_4-1/templates/actor/character/tab-advsf.hbs` +} \ No newline at end of file diff --git a/src/module/sheets/character/attributes.mjs b/src/module/sheets/character/attributes.mjs deleted file mode 100644 index b01333eb..00000000 --- a/src/module/sheets/character/attributes.mjs +++ /dev/null @@ -1,128 +0,0 @@ -export default { - _prepareContext: async (context, options, object) => { - - const actorData = context.document - context.system = actorData.system - context.flags = actorData.flags - context.derived = context.document.system - context.originalName = actorData.name - context.name = context.derived.name ?? actorData.name - context.effects = actorData.effects ?? [] - context.advantages = [] - - const getModsOfAttribute = async (keyPath, object) => { - let returnValue = []; - Array.from(object.appliedEffects).forEach( - (e) => - e.changes.filter(c => c.key === keyPath).forEach(change => { - returnValue.push({ - name: e.name, - value: change.value > 0 ? "+" + change.value : "" + change.value, - icon: e.icon, - }) - })) - return returnValue - } - - context.mods = { - "mu": await getModsOfAttribute('system.attribute.mu.mod', actorData), - "kl": await getModsOfAttribute('system.attribute.kl.mod', actorData), - "in": await getModsOfAttribute('system.attribute.in.mod', actorData), - "ch": await getModsOfAttribute('system.attribute.ch.mod', actorData), - "ff": await getModsOfAttribute('system.attribute.ff.mod', actorData), - "ge": await getModsOfAttribute('system.attribute.ge.mod', actorData), - "ko": await getModsOfAttribute('system.attribute.ko.mod', actorData), - "kk": await getModsOfAttribute('system.attribute.kk.mod', actorData), - "at": await getModsOfAttribute('system.at.mod', actorData), - "pa": await getModsOfAttribute('system.pa.mod', actorData), - "fk": await getModsOfAttribute('system.fk.mod', actorData), - } - - context.attributes = [ - { - eigenschaft: "mu", - name: "MU", - tooltip: "Mut", - wert: context.derived.attribute.mu.aktuell ?? 0, - }, - { - eigenschaft: "kl", - name: "KL", - tooltip: "Klugheit", - wert: context.derived.attribute.kl.aktuell ?? 0, - }, - { - eigenschaft: "in", - name: "IN", - tooltip: "Intuition", - wert: context.derived.attribute.in.aktuell ?? 0, - }, - { - eigenschaft: "ch", - name: "CH", - tooltip: "Charisma", - wert: context.derived.attribute.ch.aktuell ?? 0, - }, - { - eigenschaft: "ff", - name: "FF", - tooltip: "Fingerfertigkeit", - wert: context.derived.attribute.ff.aktuell ?? 0, - }, - { - eigenschaft: "ge", - name: "GE", - tooltip: "Geschicklichkeit", - wert: context.derived.attribute.ge.aktuell ?? 0, - }, - { - eigenschaft: "ko", - name: "KO", - tooltip: "Konstitution", - wert: context.derived.attribute.ko.aktuell ?? 0, - }, - { - eigenschaft: "kk", - name: "KK", - tooltip: "Körperkraft", - wert: context.derived.attribute.kk.aktuell ?? 0, - }, - ] - - Object.values(actorData.items).forEach((item) => { - if (item.type === "Advantage") { - context.advantages.push({ - id: item._id, - name: item.name, - value: item.system.value, - options: item.system.auswahl, - description: item.system.description, - isAdvantage: !item.system.nachteil, - isDisadvantage: item.system.nachteil, - isBadAttribute: item.system.schlechteEigenschaft - }) - } - } - ) - - context.specialAbilities = [] - Object.values(actorData.items).forEach((item) => { - if (item.type === "SpecialAbility") { - context.specialAbilities.push({ - id: item._id, - name: item.name, - }); - } - } - ); - - return context - }, - _onRender: (context, options) => { - - }, - _getTabConfig: (group) => { - group.tabs.push({id: "attributes", group: "sheet", label: "Eigenschaften"}) - }, - template: `systems/DSA_4-1/templates/actor/character/tab-attributes.hbs` -} \ No newline at end of file diff --git a/src/module/sheets/characterSheet.mjs b/src/module/sheets/characterSheet.mjs index a8ff97d8..73613520 100644 --- a/src/module/sheets/characterSheet.mjs +++ b/src/module/sheets/characterSheet.mjs @@ -1,4 +1,4 @@ -import Attributes from "./character/attributes.mjs" +import Advsf from "./character/advsf.mjs" import Combat from "./character/combat.mjs" import Effects from "./character/effects.mjs" import Equipment from "./character/equipment.mjs" @@ -55,8 +55,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { social: { template: Social.template }, - attributes: { - template: Attributes.template + advsf: { + template: Advsf.template }, combat: { template: Combat.template @@ -146,7 +146,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { const tabs = foundry.utils.deepClone(super._getTabsConfig(group)) Meta._getTabConfig(tabs, this); Social._getTabConfig(tabs, this); - Attributes._getTabConfig(tabs, this) + Advsf._getTabConfig(tabs, this) Combat._getTabConfig(tabs, this) Equipment._getTabConfig(tabs, this) Skills._getTabConfig(tabs, this) @@ -341,8 +341,8 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { case "social": await Social._prepareContext(context, this.document) break - case "attributes": - await Attributes._prepareContext(context, this.document) + case "advsf": + await Advsf._prepareContext(context, this.document) break case "combat": await Combat._prepareContext(context, this.document) @@ -369,7 +369,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { _onRender(context, options) { Meta._onRender(context, options, this.element) Social._onRender(context, options, this.element) - Attributes._onRender(context, options, this.element) + Advsf._onRender(context, options, this.element) Combat._onRender(context, options, this.element) Effects._onRender(context, options, this.element) Equipment._onRender(context, options, this) diff --git a/src/style/atoms/_typography.scss b/src/style/atoms/_typography.scss index aa08a435..e3cb3ab3 100644 --- a/src/style/atoms/_typography.scss +++ b/src/style/atoms/_typography.scss @@ -4,7 +4,7 @@ label, .sheet-tabs.tabs a, - h2 { + h2, h3 { font-family: Gentium, sans-serif; font-weight: bold; font-size: 12pt; diff --git a/src/style/organisms/character-tabs/_attributes.scss b/src/style/organisms/character-tabs/_attributes.scss index e9a959bb..f64cafe8 100644 --- a/src/style/organisms/character-tabs/_attributes.scss +++ b/src/style/organisms/character-tabs/_attributes.scss @@ -1,121 +1,80 @@ @mixin tab { height: 100%; - .attribute { - padding: 8px 0; - display: flex; - gap: 0 8px; + .advantages-and-specialabilities { - label { - width: 120px; - text-align: right; - vertical-align: middle; - line-height: 24px; - } + height: unset; + display: unset; + gap: 0; + padding: unset; - input { - max-width: 80px; - text-align: right; - } + .advantages, .special-abilities { + margin-bottom: 16px; - .mod { - color: grey; - text-shadow: 0 -1px 0 #ccc; - box-Shadow: 1px 1px 1px rgba(0, 0, 0, 0.5); - border-radius: 4px; - height: 24px; - width: 24px; - background: linear-gradient(0deg, rgba(24, 24, 24, 1) 0%, rgba(80, 80, 80, 1) 100%);; - display: inline-block; - text-align: center; - vertical-align: middle; - line-height: 24px; - margin-left: 4px; - } + ul { + list-style-type: none; + padding: 0; + margin: 0; + text-indent: 0; - } + li { + display: inline-block; + } - .attributes-overview { - - columns: 2; - gap: 0 16px; - - } - - .resource-overview { - - .attribute { - - } - - } - - .advantages, .special-abilities { - margin-bottom: 16px; - - ul { - list-style-type: none; - padding: 0; - margin: 0; - text-indent: 0; - - li { - display: inline-block; - } - - .advantage, .special-ability { - position: relative; - border: 1px solid gold; - box-shadow: 2px 2px 4px #000; - border-radius: 8px; - height: 24px; - color: gold; - text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); - display: inline-block; - padding: 0 8px; - margin-left: 0; - margin-bottom: 4px; - background-image: url("../../assets/velvet_button.png"); - background-repeat: repeat-y; - background-size: cover; - - span { + .advantage, .special-ability { position: relative; - z-index: 2; - line-height: 24px; - vertical-align: middle; - } - - &.special-ability { - &::after { - background: rgba(128, 0, 96, 0.5); - } - } - - &::after { - content: ""; - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; + border: 1px solid gold; + box-shadow: 2px 2px 4px #000; border-radius: 8px; - background: rgba(0, 128, 0, 0.5); - } + height: 24px; + color: gold; + text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); + display: inline-block; + padding: 0 8px; + margin-left: 0; + margin-bottom: 4px; + background-image: url("../../assets/velvet_button.png"); + background-repeat: repeat-y; + background-size: cover; - & + .advantage, & + .special-ability { - margin-left: 8px; - } + span { + position: relative; + z-index: 2; + line-height: 24px; + vertical-align: middle; + } - &.disadvantage { - font-style: italic; + &.special-ability { + &::after { + background: rgba(128, 0, 96, 0.5); + } + } &::after { - background: rgba(128, 0, 0, 0.5); + content: ""; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + border-radius: 8px; + background: rgba(0, 128, 0, 0.5); + } + + & + .advantage, & + .special-ability { + margin-left: 8px; + } + + &.disadvantage { + font-style: italic; + + &::after { + background: rgba(128, 0, 0, 0.5); + } } } } - } + } } } diff --git a/src/templates/actor/character/tab-advsf.hbs b/src/templates/actor/character/tab-advsf.hbs new file mode 100644 index 00000000..346a6ba4 --- /dev/null +++ b/src/templates/actor/character/tab-advsf.hbs @@ -0,0 +1,22 @@ +
+
+
+

Vor- und Nachteile

+
    + {{#each this.advantages}} +
  • {{> "systems/DSA_4-1/templates/ui/partial-advantage-button.hbs" this}}
  • + {{/each}} +
+
+
+

Sonderfertigkeiten

+
    + {{#each this.specialAbilities}} +
  • {{> "systems/DSA_4-1/templates/ui/partial-sf-button.hbs" this}}
  • + {{/each}} +
+
+
+
diff --git a/src/templates/actor/character/tab-attributes.hbs b/src/templates/actor/character/tab-attributes.hbs deleted file mode 100644 index 842f2973..00000000 --- a/src/templates/actor/character/tab-attributes.hbs +++ /dev/null @@ -1,161 +0,0 @@ -
- -
-
- - -
- {{#each this.mods.mu}} - {{this.value}} - {{/each}} -
-
-
- - -
- {{#each this.mods.kl}} - {{this.value}} - {{/each}} -
-
-
- - -
- {{#each this.mods.in}} - {{this.value}} - {{/each}} -
- -
-
- - -
- {{#each this.mods.ch}} - {{this.value}} - {{/each}} -
- -
-
- - -
- {{#each this.mods.ff}} - {{this.value}} - {{/each}} -
- -
-
- - -
- {{#each this.mods.ge}} - {{this.value}} - {{/each}} -
- -
-
- - -
- {{#each this.mods.ko}} - {{this.value}} - {{/each}} -
- -
-
- - -
- {{#each this.mods.kk}} - {{this.value}} - {{/each}} -
- -
-
- - -
-
- - -
- {{#each this.mods.at}} - {{this.value}} - {{/each}} -
-
-
- - -
- {{#each this.mods.pa}} - {{this.value}} - {{/each}} -
-
-
- - -
- {{#each this.mods.fk}} - {{this.value}} - {{/each}} -
-
-
-
-
- - - -
- {{#if ausdauer}} -
- - - -
- {{/if}} - {{#if hasSpells}} -
- - - -
- {{/if}} - {{#if hasLiturgies}} -
- - - -
- {{/if}} -
-
-

Vor- und Nachteile

- -
-
-

Sonderfertigkeiten

- -
- -