diff --git a/src/module/sheets/character/liturgies.mjs b/src/module/sheets/character/liturgies.mjs index 1b8c5af2..062d5966 100644 --- a/src/module/sheets/character/liturgies.mjs +++ b/src/module/sheets/character/liturgies.mjs @@ -104,8 +104,11 @@ export default { _onRender: (context, options) => { }, - _getTabConfig: (group) => { - group.tabs.push({id: "liturgies", group: "sheet", label: "Liturgien"}) + _getTabConfig: (group, thisObject) => { + const hasLiturgies = thisObject.document.items.filter(p => p.type === "Liturgy").length > 0 ?? false + if (hasLiturgies) { + group.tabs.push({id: "liturgies", group: "sheet", label: "Liturgien"}) + } }, template: `systems/DSA_4-1/templates/actor/character/tab-liturgies.hbs` } \ No newline at end of file diff --git a/src/module/sheets/character/spells.mjs b/src/module/sheets/character/spells.mjs index 8bc0a3af..920283c7 100644 --- a/src/module/sheets/character/spells.mjs +++ b/src/module/sheets/character/spells.mjs @@ -45,8 +45,11 @@ export default { _onRender: (context, options) => { }, - _getTabConfig: (group) => { - group.tabs.push({id: "spells", group: "sheet", label: "Zauber"}) + _getTabConfig: (group, thisObject) => { + const hasSpells = thisObject.document.items.filter(p => p.type === "Spell").length > 0 ?? false + if (hasSpells) { + group.tabs.push({id: "spells", group: "sheet", label: "Zauber"}) + } }, template: `systems/DSA_4-1/templates/actor/character/tab-spells.hbs` } \ No newline at end of file diff --git a/src/module/sheets/characterSheet.mjs b/src/module/sheets/characterSheet.mjs index c322ade3..12fe6951 100644 --- a/src/module/sheets/characterSheet.mjs +++ b/src/module/sheets/characterSheet.mjs @@ -38,13 +38,12 @@ 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'}, - + // {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' } @@ -110,19 +109,19 @@ 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) + Attributes._getTabConfig(tabs, this) + Combat._getTabConfig(tabs, this) + Equipment._getTabConfig(tabs, this) + Skills._getTabConfig(tabs, this) + Spells._getTabConfig(tabs, this) + Liturgies._getTabConfig(tabs, this) + Effects._getTabConfig(tabs, this) return tabs } - */ + async _preparePartContext(partId, context) { switch (partId) { case "form":