From 8e37ccb6313ea0c25876b4ec6426980f55ab56c0 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Wed, 25 Jan 2023 16:46:32 +0100 Subject: [PATCH] Add module data path --- modules/avd12-item-sheet.js | 16 +++++++++++++--- styles/simple.css | 18 ++++++++++++++++++ system.json | 4 ++-- templates/items/item-module-sheet.hbs | 23 +++++++++++++++++++++-- templates/items/item-trait-sheet.hbs | 3 +++ 5 files changed, 57 insertions(+), 7 deletions(-) diff --git a/modules/avd12-item-sheet.js b/modules/avd12-item-sheet.js index fba0613..dad4e7f 100644 --- a/modules/avd12-item-sheet.js +++ b/modules/avd12-item-sheet.js @@ -52,8 +52,12 @@ export class Avd12ItemSheet extends ItemSheet { // Specific case for formating descriptions of sub-items if (this.object.type == "module") { for (let level of this.object.system.levels) { - for (let id in level.features) { - level.features[id].descriptionHTML = await TextEditor.enrichHTML(level.features[id].system.description, { async: true }) + if ( level && level.features) { + for (let id in level.features) { + if ( level.features[id] ) { + level.features[id].descriptionHTML = await TextEditor.enrichHTML(level.features[id].system.description, { async: true }) + } + } } } } @@ -249,7 +253,13 @@ export class Avd12ItemSheet extends ItemSheet { levels[levelIndex].choices[choiceIndex].features[featureId] = undefined this.object.update({ 'system.levels': levels }) }) - + html.find('.module-level-delete').click(ev => { + let levels = duplicate(this.object.system.levels) + let levelIndex = Number($(ev.currentTarget).data("level-index")) + levels.splice(levelIndex,levelIndex) + this.object.update({ 'system.levels': levels }) + }) + html.find('.choice-level-selected').change(ev => { this.processChoiceLevelSelection(ev) }) diff --git a/styles/simple.css b/styles/simple.css index b7cfddc..050b6f9 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1336,3 +1336,21 @@ ul, li { border-radius: 3px; border: 2px ridge #846109; } +.module-level-box { + background: linear-gradient(to bottom, #6c95b9fc 5%, #105177ab 100%); + border-radius: 5px; + padding: 4px; + margin-bottom: 8px; + margin-left: 12px; + border: 2px ridge #846109; + max-width: 45%; + min-height: 64px; + align-content: center; +} +.color-selected { + background: linear-gradient(to bottom, #9ae470fc 5%, #247e30ab 100%); +} +.flex-center { + align-items: center; + align-content: space-between; +} \ No newline at end of file diff --git a/system.json b/system.json index 8b7457c..dc20494 100644 --- a/system.json +++ b/system.json @@ -64,7 +64,7 @@ ], "title": "AnyVenture D12 RPG", "url": "https://www.uberwald.me/gitea/public/fvtt-avd12", - "version": "10.0.24", - "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.24.zip", + "version": "10.0.25", + "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.25.zip", "background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp" } \ No newline at end of file diff --git a/templates/items/item-module-sheet.hbs b/templates/items/item-module-sheet.hbs index bfc87c3..dec9292 100644 --- a/templates/items/item-module-sheet.hbs +++ b/templates/items/item-module-sheet.hbs @@ -15,7 +15,23 @@ {{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
- TODO : The tre of module choices will be displayed here for players, with the "selected" option only + +
+ {{#each system.levels as |level index|}} +
+ {{#each level.choices as |choice choiceIndex|}} + +
    + {{#each choice.features as |feature id|}} +
  • {{feature.name}}
  • + {{/each}} +
+
+ {{/each}} +
+ {{/each}} +
+
{{#if isGM}} @@ -26,7 +42,10 @@ {{#each system.levels as |level index|}}
  • -

    Level {{add index 1}}

    +

    Level {{add index 1}}

    + + +