Talents automation + management

This commit is contained in:
2022-10-28 21:44:49 +02:00
parent e4d7ff4ca3
commit 6551a93791
14 changed files with 453 additions and 89 deletions

View File

@ -144,8 +144,7 @@ export class HawkmoonItemSheet extends ItemSheet {
pred[index].description = ev.currentTarget.value
pred[index].id = pred[index].id || randomID(16)
this.object.update( { 'system.predilections': pred })
})
})
html.find('.predilection-acquise').change(ev => {
const li = $(ev.currentTarget).parents(".prediction-item")
let index = li.data("prediction-index")
@ -153,8 +152,7 @@ export class HawkmoonItemSheet extends ItemSheet {
pred[index].acquise = ev.currentTarget.checked
pred[index].id = pred[index].id || randomID(16)
this.object.update( { 'system.predilections': pred })
})
})
html.find('.predilection-maitrise').change(ev => {
const li = $(ev.currentTarget).parents(".prediction-item")
let index = li.data("prediction-index")
@ -172,6 +170,11 @@ export class HawkmoonItemSheet extends ItemSheet {
this.object.update( { 'system.predilections': pred })
})
html.find('#add-predilection').click(ev => {
let pred = duplicate(this.object.system.predilections)
pred.push( { name: "Nouvelle prédilection", id: randomID(16), used: false })
this.object.update( { 'system.predilections': pred })
})
html.find('.delete-prediction').click(ev => {
const li = $(ev.currentTarget).parents(".prediction-item")
let index = li.data("prediction-index")
@ -180,11 +183,28 @@ export class HawkmoonItemSheet extends ItemSheet {
this.object.update( { 'system.predilections': pred })
})
html.find('#add-predilection').click(ev => {
let pred = duplicate(this.object.system.predilections)
pred.push( { name: "Nouvelle prédilection", id: randomID(16), used: false })
this.object.update( { 'system.predilections': pred })
html.find('#add-automation').click(ev => {
let autom = duplicate(this.object.system.automations)
autom.push( { eventtype: "on-drop", name: "Automatisation 1", script: "", id: randomID(16) })
this.object.update( { 'system.automations': autom })
})
html.find('.delete-automation').click(ev => {
const li = $(ev.currentTarget).parents(".automation-item")
let index = li.data("automation-index")
let autom = duplicate(this.object.system.automations)
autom.splice(index,1)
this.object.update( { 'system.automations': autom })
})
html.find('.automation-edit-field').change(ev => {
const li = $(ev.currentTarget).parents(".automation-item")
let index = li.data("automation-index")
let field = li.data("automation-field")
let auto = duplicate(this.object.system.automations)
auto[index][field] = ev.currentTarget.value
auto[index].id = auto[index].id || randomID(16)
this.object.update( { 'system.automations': auto })
})
// Update Inventory Item
html.find('.item-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");