From 2b00991e169d447f4d1e5635bbe2726d0ed4b8f4 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 15 Nov 2022 21:39:08 +0100 Subject: [PATCH] Rework skills and modules --- modules/avd12-item-sheet.js | 13 +++++++++---- system.json | 4 ++-- templates/items/item-module-sheet.hbs | 11 ++++++----- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/modules/avd12-item-sheet.js b/modules/avd12-item-sheet.js index 07c37e0..145628f 100644 --- a/modules/avd12-item-sheet.js +++ b/modules/avd12-item-sheet.js @@ -119,9 +119,10 @@ export class Avd12ItemSheet extends ItemSheet { /* -------------------------------------------- */ async _onDrop(event) { - - const levelIndex = Number($(event.toElement).data("level-index")) - const choiceIndex = Number($(event.toElement).data("choice-index")) + + let li = $(event.toElement).parents(".item") + const levelIndex = Number(li.data("level-index")) + const choiceIndex = Number(li.data("choice-index")) let data = event.dataTransfer.getData('text/plain') let dataItem = JSON.parse(data) let item = fromUuidSync(dataItem.uuid) @@ -203,7 +204,11 @@ export class Avd12ItemSheet extends ItemSheet { html.find('.add-module-level').click(ev => { let levels = duplicate(this.object.system.levels) - levels.push({ choices: [ {selected: false, features: {} }, {selected: false, features: {} } ] }) + if ( (levels.length+1) % 2 == 0) { + levels.push({ choices: [ {selected: false, features: {} }, {selected: false, features: {} } ] }) + }else { + levels.push({ choices: [ {selected: false, features: {} } ] }) + } this.object.update({ 'system.levels': levels }) }) diff --git a/system.json b/system.json index c94cbd1..6e721d2 100644 --- a/system.json +++ b/system.json @@ -35,7 +35,7 @@ ], "title": "AnyVenture D12 RPG", "url": "https://www.uberwald.me/gitea/public/fvtt-avd12", - "version": "10.0.6", - "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.6.zip", + "version": "10.0.7", + "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.7.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 fef02da..908ce26 100644 --- a/templates/items/item-module-sheet.hbs +++ b/templates/items/item-module-sheet.hbs @@ -32,17 +32,18 @@