diff --git a/src/module/sheets/character/attributes.mjs b/src/module/sheets/character/attributes.mjs index 230caa62..b01333eb 100644 --- a/src/module/sheets/character/attributes.mjs +++ b/src/module/sheets/character/attributes.mjs @@ -21,7 +21,7 @@ export default { icon: e.icon, }) })) - return returnValue; + return returnValue } context.mods = { @@ -36,8 +36,8 @@ export default { "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", @@ -87,7 +87,6 @@ export default { tooltip: "Körperkraft", wert: context.derived.attribute.kk.aktuell ?? 0, }, - ] Object.values(actorData.items).forEach((item) => { @@ -101,12 +100,12 @@ export default { isAdvantage: !item.system.nachteil, isDisadvantage: item.system.nachteil, isBadAttribute: item.system.schlechteEigenschaft - }); + }) } } - ); + ) - context.specialAbilities = []; + context.specialAbilities = [] Object.values(actorData.items).forEach((item) => { if (item.type === "SpecialAbility") { context.specialAbilities.push({ @@ -116,6 +115,8 @@ export default { } } ); + + return context }, _onRender: (context, options) => { diff --git a/src/module/sheets/character/combat.mjs b/src/module/sheets/character/combat.mjs index ab4d9b48..883cc92a 100644 --- a/src/module/sheets/character/combat.mjs +++ b/src/module/sheets/character/combat.mjs @@ -101,6 +101,8 @@ export default { }) } + return context + }, _onRender: (context, options) => { diff --git a/src/module/sheets/character/effects.mjs b/src/module/sheets/character/effects.mjs index 6c817e7d..e59e080d 100644 --- a/src/module/sheets/character/effects.mjs +++ b/src/module/sheets/character/effects.mjs @@ -42,6 +42,8 @@ export default { }); } }) + + return context }, _onRender: (context, options) => { diff --git a/src/module/sheets/character/equipment.mjs b/src/module/sheets/character/equipment.mjs index 680a0538..4739a516 100644 --- a/src/module/sheets/character/equipment.mjs +++ b/src/module/sheets/character/equipment.mjs @@ -140,6 +140,8 @@ export default { ] }) } + + return context }, _onRender: (context, options, element) => { const mapAllSets = () => { diff --git a/src/module/sheets/character/liturgies.mjs b/src/module/sheets/character/liturgies.mjs index 196ac767..1b8c5af2 100644 --- a/src/module/sheets/character/liturgies.mjs +++ b/src/module/sheets/character/liturgies.mjs @@ -98,6 +98,8 @@ export default { }) context.hasLiturgies = context.blessings.length > 0; + + return context }, _onRender: (context, options) => { diff --git a/src/module/sheets/character/meta.mjs b/src/module/sheets/character/meta.mjs index 75ed6f50..de5d56fe 100644 --- a/src/module/sheets/character/meta.mjs +++ b/src/module/sheets/character/meta.mjs @@ -7,6 +7,8 @@ export default { context.originalName = actorData.name context.name = context.derived.name ?? actorData.name context.effects = actorData.effects ?? [] + + return context }, _onRender: (context, options) => { diff --git a/src/module/sheets/character/skills.mjs b/src/module/sheets/character/skills.mjs index 78e6b307..b8c271c0 100644 --- a/src/module/sheets/character/skills.mjs +++ b/src/module/sheets/character/skills.mjs @@ -69,7 +69,9 @@ export default { context.flatSkills.push(obj); } } - ); + ) + + return context }, _onRender: (context, options) => { diff --git a/src/module/sheets/character/spells.mjs b/src/module/sheets/character/spells.mjs index 9c33ad0d..8bc0a3af 100644 --- a/src/module/sheets/character/spells.mjs +++ b/src/module/sheets/character/spells.mjs @@ -38,7 +38,9 @@ export default { }) } }) - context.hasSpells = context.spells.length > 0; + context.hasSpells = context.spells.length > 0 + + return context }, _onRender: (context, options) => { diff --git a/src/module/sheets/characterSheet.mjs b/src/module/sheets/characterSheet.mjs index 69716a1b..464663ab 100644 --- a/src/module/sheets/characterSheet.mjs +++ b/src/module/sheets/characterSheet.mjs @@ -38,6 +38,13 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { sheet: { tabs: [ {id: 'meta', group: 'sheet', label: 'Meta'}, + {id: 'attributes', group: 'sheet', label: 'Eigenschaften'}, + {id: 'combat', group: 'sheet', label: 'Kampf'}, + {id: 'equipment', group: 'sheet', label: 'Inventar'}, + {id: 'skills', group: 'sheet', label: 'Talente'}, + {id: 'spells', group: 'sheet', label: 'Zauber'}, + {id: 'liturgies', group: 'sheet', label: 'Liturgien'}, + ], initial: 'meta' } @@ -103,20 +110,41 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { await this.document.update(formData.object) // Note: formData.object } - _getTabsConfig(group) { - const tabs = foundry.utils.deepClone(super._getTabsConfig(group)) - Attributes._getTabConfig(tabs) - Combat._getTabConfig(tabs) - Equipment._getTabConfig(tabs) - Skills._getTabConfig(tabs) - Spells._getTabConfig(tabs) - Liturgies._getTabConfig(tabs) - Effects._getTabConfig(tabs) - return tabs - } - + /* + _getTabsConfig(group) { + const tabs = foundry.utils.deepClone(super._getTabsConfig(group)) + Attributes._getTabConfig(tabs) + Combat._getTabConfig(tabs) + Equipment._getTabConfig(tabs) + Skills._getTabConfig(tabs) + Spells._getTabConfig(tabs) + Liturgies._getTabConfig(tabs) + Effects._getTabConfig(tabs) + return tabs + } + */ async _preparePartContext(partId, context) { switch (partId) { + case "form": + 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.maxWounds = actorData.system.wunden.max ?? 3 + context.wounds = actorData.system.wunden.aktuell ?? 0 + context.woundsFilled = [] + for (let i = 1; i <= context.maxWounds; i++) { + context.woundsFilled[i] = i <= context.wounds + } + + context.zonenruestung = game.settings.get("DSA_4-1", "optional_ruestungzonen") + context.trefferzonen = game.settings.get("DSA_4-1", "optional_trefferzonen") + context.ausdauer = game.settings.get("DSA_4-1", "optional_ausdauer") + break; case "meta": Meta._prepareContext(context, this.object) break @@ -142,31 +170,7 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) { Effects._prepareContext(context, this.object) break } - } - - /** @override */ - async _prepareContext(options) { - const context = await super._prepareContext(options) - 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.maxWounds = actorData.system.wunden.max ?? 3 - context.wounds = actorData.system.wunden.aktuell ?? 0 - context.woundsFilled = [] - for (let i = 1; i <= context.maxWounds; i++) { - context.woundsFilled[i] = i <= context.wounds - } - - context.zonenruestung = game.settings.get("DSA_4-1", "optional_ruestungzonen") - context.trefferzonen = game.settings.get("DSA_4-1", "optional_trefferzonen") - context.ausdauer = game.settings.get("DSA_4-1", "optional_ausdauer") - - return context; + return context } _onRender(context, options) { diff --git a/src/style/organisms/_character-sheet.scss b/src/style/organisms/_character-sheet.scss index 6750bdde..14ae4631 100644 --- a/src/style/organisms/_character-sheet.scss +++ b/src/style/organisms/_character-sheet.scss @@ -3,10 +3,7 @@ @use "../atoms/colours" as colour; -.dsa41.sheet.actor.character { - - .window-header.flexrow.draggable.resizable { - } +.application.sheet.dsa41.actor.character { $sidebar-width: 224px; $attribute-height: 60px; diff --git a/src/templates/actor/character/tab-combat.hbs b/src/templates/actor/character/tab-combat.hbs index 9992c484..ab59267e 100644 --- a/src/templates/actor/character/tab-combat.hbs +++ b/src/templates/actor/character/tab-combat.hbs @@ -95,6 +95,4 @@ {{/if}} - - diff --git a/src/templates/actor/character/tab-effects.hbs b/src/templates/actor/character/tab-effects.hbs index ca174837..b131f219 100644 --- a/src/templates/actor/character/tab-effects.hbs +++ b/src/templates/actor/character/tab-effects.hbs @@ -24,4 +24,5 @@ {{/each}} + \ No newline at end of file