From 46f50bf4b4ddb5abd0ed27219beb2f88d39d333f Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sat, 10 Dec 2022 13:58:53 +0100 Subject: [PATCH] Some fixes --- modules/avd12-item-sheet.js | 41 ++++++++++++++++++++++--------------- styles/simple.css | 14 +++++++++---- system.json | 4 ++-- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/modules/avd12-item-sheet.js b/modules/avd12-item-sheet.js index b9d11af..ec660bb 100644 --- a/modules/avd12-item-sheet.js +++ b/modules/avd12-item-sheet.js @@ -173,6 +173,29 @@ export class Avd12ItemSheet extends ItemSheet { } } + /* -------------------------------------------- */ + async processChoiceLevelSelection(ev) { + let levels = duplicate(this.object.system.levels) + let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index")) + let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index")) + for (let choice of levels[levelIndex].choices) { + choice.selected = false // Everybody to false + } + levels[levelIndex].choices[choiceIndex].selected = ev.currentTarget.checked + //console.log("Added", obj, levels, this.object.actor) + if ( this.object.actor ) { + let obj = await this.object.actor.updateEmbeddedDocuments('Item', [{ _id: this.object.id, 'system.levels': levels }]); + if ( ev.currentTarget.checked ) { + console.log("Added", obj, levels) + this.object.actor.addModuleLevel( this.object.id, levels[levelIndex].choices[choiceIndex] ) + } else { + this.object.actor.deleteModuleLevel( this.object.id, levels[levelIndex].choices[choiceIndex] ) + } + } else { + this.object.update({ 'system.levels': levels }) + } + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -223,22 +246,8 @@ export class Avd12ItemSheet extends ItemSheet { this.object.update({ 'system.levels': levels }) }) - html.find('.choice-level-selected').change(ev => { - let levels = duplicate(this.object.system.levels) - let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index")) - let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index")) - for (let choice of levels[levelIndex].choices) { - choice.selected = false // Everybody to false - } - levels[levelIndex].choices[choiceIndex].selected = ev.currentTarget.checked - this.object.update({ 'system.levels': levels }) - if ( this.object.actor ) { - if ( ev.currentTarget.checked ) { - this.object.actor.addModuleLevel( this.object.id, levels[levelIndex].choices[choiceIndex] ) - } else { - this.object.actor.deleteModuleLevel( this.object.id, levels[levelIndex].choices[choiceIndex] ) - } - } + html.find('.choice-level-selected').change(ev => { + this.processChoiceLevelSelection(ev) }) } diff --git a/styles/simple.css b/styles/simple.css index 1654c67..77f0675 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -385,15 +385,19 @@ table {border: 1px solid #7a7971;} /* ======================================== */ /* Sheet */ .window-app.sheet .window-content .sheet-header{ - /*color: rgba(168, 139, 139, 0.5);*/ + color: rgba(228, 240, 240, 0.75); /*background: url("../images/ui/pc_sheet_bg.webp");*/ background: #494e6b; } input[type="text"], select[type="text"] { background:white; + color: #494e6b; } +select { + background:white; +} /* background: #011d33 url("../images/ui/fond1.webp") repeat left top;*/ /*color: rgba(168, 139, 139, 0.5);*/ .window-app.sheet .window-content .sheet-header select[type="text"], .window-app.sheet .window-content .sheet-header input[type="text"], .window-app.sheet .window-content .sheet-header input[type="number"], .window-app.sheet .window-content .sheet-body input[type="text"], .window-app.sheet .window-content .sheet-body input[type="number"], .window-app.sheet .window-content .sheet-body select[type="text"] { @@ -401,7 +405,7 @@ input[type="text"], select[type="text"] { } .window-app.sheet .window-content .sheet-header input[type="password"], .window-app.sheet .window-content .sheet-header input[type="date"], .window-app.sheet .window-content .sheet-header input[type="time"] { - color: rgba(36, 37, 37, 0.75); + color: rgba(228, 240, 240, 0.75); background: #494e6b; border: 1 none; margin-bottom: 0.25rem; @@ -409,7 +413,7 @@ input[type="text"], select[type="text"] { } .window-app.sheet .window-content .sheet-body input[type="password"], .window-app.sheet .window-content .sheet-body input[type="date"], .window-app.sheet .window-content .sheet-body input[type="time"] { - color: rgba(36, 37, 37, 0.75); + color: rgba(228, 240, 240, 0.75); background: #494e6b; border: 1 none; margin-bottom: 0.25rem; @@ -417,7 +421,7 @@ input[type="text"], select[type="text"] { } .window-app.sheet .window-content .sheet-body select, .window-app.sheet .window-content .sheet-header select { - color: rgba(36, 37, 37, 0.75); + color: rgba(228, 240, 240, 0.75); background: #494e6b; border: 1 none; margin-bottom: 0.25rem; @@ -428,6 +432,7 @@ input[type="text"], select[type="text"] { font-size: 0.8rem; /*background: url("../images/ui/pc_sheet_bg.webp") repeat left top;*/ background: #494e6b; + color: rgba(228, 240, 240, 0.75); } /* background: rgba(245,245,240,0.6) url("../images/ui/sheet_background.webp") left top;*/ @@ -558,6 +563,7 @@ ul, li { padding: 0.125rem; flex: 1 1 5rem; display: flex !important; + color: rgba(228, 240, 240, 0.75); } .list-item-shadow { background:rgba(87, 60, 32, 0.35); diff --git a/system.json b/system.json index 8493288..2f661ef 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.10", - "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.10.zip", + "version": "10.0.11", + "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.11.zip", "background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp" } \ No newline at end of file