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

@ -120,8 +120,9 @@ export class Avd12ItemSheet extends ItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDrop(event) { async _onDrop(event) {
const levelIndex = Number($(event.toElement).data("level-index")) let li = $(event.toElement).parents(".item")
const choiceIndex = Number($(event.toElement).data("choice-index")) const levelIndex = Number(li.data("level-index"))
const choiceIndex = Number(li.data("choice-index"))
let data = event.dataTransfer.getData('text/plain') let data = event.dataTransfer.getData('text/plain')
let dataItem = JSON.parse(data) let dataItem = JSON.parse(data)
let item = fromUuidSync(dataItem.uuid) let item = fromUuidSync(dataItem.uuid)
@ -203,7 +204,11 @@ export class Avd12ItemSheet extends ItemSheet {
html.find('.add-module-level').click(ev => { html.find('.add-module-level').click(ev => {
let levels = duplicate(this.object.system.levels) let levels = duplicate(this.object.system.levels)
if ( (levels.length+1) % 2 == 0) {
levels.push({ choices: [ {selected: false, features: {} }, {selected: false, features: {} } ] }) levels.push({ choices: [ {selected: false, features: {} }, {selected: false, features: {} } ] })
}else {
levels.push({ choices: [ {selected: false, features: {} } ] })
}
this.object.update({ 'system.levels': levels }) this.object.update({ 'system.levels': levels })
}) })

View File

@ -35,7 +35,7 @@
], ],
"title": "AnyVenture D12 RPG", "title": "AnyVenture D12 RPG",
"url": "https://www.uberwald.me/gitea/public/fvtt-avd12", "url": "https://www.uberwald.me/gitea/public/fvtt-avd12",
"version": "10.0.6", "version": "10.0.7",
"download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.6.zip", "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" "background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp"
} }

View File

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