Rework skills and modules

This commit is contained in:
sladecraven 2022-11-15 21:39:08 +01:00
parent e796fac928
commit 2b00991e16
3 changed files with 17 additions and 11 deletions

View File

@ -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 })
})

View File

@ -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"
}

View File

@ -32,17 +32,18 @@
<ul class="ul-level1">
{{#each level.choices as |choice choiceIndex|}}
<li class="">
<h3 class="item-field-label-long">Level choice {{add choiceIndex 1}}</h3></li>
<li class="item flexrow" data-level-index="{{../index}}" data-choice-index="{{choiceIndex}}">
<div class="drop-module-step" data-choice-index="{{choiceIndex}}" data-level-index="{{../index}}">
<label data-choice-index="{{choiceIndex}}" data-level-index="{{../index}}">Drop traits/actions/... here !</label>
<h3 class="item-field-label-long">Level choice {{add choiceIndex 1}}</h3>
</li>
<li class="item flexrow" data-level-index="{{@../index}}" data-choice-index="{{choiceIndex}}">
<div class="drop-module-step">
<label>Drop traits/actions/... here !</label>
</div>
<span class="item-field-label-short">&nbsp;</span>
<label class="item-field-label-short">Selected</label>
<input type="checkbox" class="item-field-label-short choice-level-selected" {{checked choice.selected}} />
</li>
{{#each choice.features as |feature id|}}
<li class="flexrow item" data-level-index="{{../index}}" data-choice-index="{{choiceIndex}}" data-feature-id="{{feature._id}}" >
<li class="flexrow item" data-level-index="{{@../../index}}" data-choice-index="{{choiceIndex}}" data-feature-id="{{feature._id}}" >
<label class="item-field-label-medium">{{feature.name}}</label>
<label class="item-field-label-long2">{{{feature.descriptionHTML}}}</label>
<div class="item-controls item-controls-fixed">