Add v12 support
This commit is contained in:
@@ -9,7 +9,7 @@ export class HeritiersItemSheet extends ItemSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-les-heritiers", "sheet", "item"],
|
||||
template: "systems/fvtt-les-heritiers/templates/item-sheet.html",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
@@ -48,7 +48,7 @@ export class HeritiersItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = duplicate(this.object)
|
||||
const objectData = foundry.utils.duplicate(this.object)
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.id,
|
||||
@@ -96,7 +96,7 @@ export class HeritiersItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
postItem() {
|
||||
let chatData = duplicate(HeritiersUtility.data(this.item));
|
||||
let chatData = foundry.utils.duplicate(HeritiersUtility.data(this.item));
|
||||
if (this.actor) {
|
||||
chatData.actor = { id: this.actor.id };
|
||||
}
|
||||
@@ -138,52 +138,52 @@ export class HeritiersItemSheet extends ItemSheet {
|
||||
})
|
||||
|
||||
html.find('#add-specialite').click(ev => {
|
||||
let spec = duplicate(this.object.system.specialites)
|
||||
spec.push( { name: "Nouvelle Spécialité", id: randomID(16), used: false })
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
spec.push( { name: "Nouvelle Spécialité", id: foundry.utils.randomID(16), used: false })
|
||||
this.object.update( { 'system.specialites': spec })
|
||||
})
|
||||
html.find('.delete-specialite').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".specialite-item")
|
||||
let index = li.data("specialite-index")
|
||||
let spec = duplicate(this.object.system.specialites)
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
spec.splice(index,1)
|
||||
this.object.update( { 'system.specialites': spec })
|
||||
})
|
||||
html.find('.edit-specialite').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".specialite-item")
|
||||
let index = li.data("specialite-index")
|
||||
let spec = duplicate(this.object.system.specialites)
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
spec[index].name = ev.currentTarget.value
|
||||
spec[index].id = spec[index].id || randomID(16)
|
||||
spec[index].id = spec[index].id || foundry.utils.randomID(16)
|
||||
this.object.update( { 'system.specialites': spec })
|
||||
})
|
||||
html.find('.edit-specialite-description').change(ev => {
|
||||
const li = $(ev.currentTarget).parents(".specialite-item")
|
||||
let index = li.data("specialite-index")
|
||||
let spec = duplicate(this.object.system.specialites)
|
||||
let spec = foundry.utils.duplicate(this.object.system.specialites)
|
||||
spec[index].description = ev.currentTarget.value
|
||||
spec[index].id = spec[index].id || randomID(16)
|
||||
spec[index].id = spec[index].id || foundry.utils.randomID(16)
|
||||
this.object.update( { 'system.specialites': spec })
|
||||
})
|
||||
|
||||
html.find('#add-automation').click(ev => {
|
||||
let autom = duplicate(this.object.system.automations)
|
||||
autom.push( { eventtype: "on-drop", name: "Automatisation 1", competence: "", minLevel: 0, id: randomID(16) })
|
||||
let autom = foundry.utils.duplicate(this.object.system.automations)
|
||||
autom.push( { eventtype: "on-drop", name: "Automatisation 1", competence: "", minLevel: 0, id: foundry.utils.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)
|
||||
let autom = foundry.utils.duplicate(this.object.system.automations)
|
||||
autom.splice(index,1)
|
||||
this.object.update( { 'system.automations': autom })
|
||||
})
|
||||
html.find('.automation-edit-field').change(ev => {
|
||||
let index = $(ev.currentTarget).data("automation-index")
|
||||
let field = $(ev.currentTarget).data("automation-field")
|
||||
let auto = duplicate(this.object.system.automations)
|
||||
let auto = foundry.utils.duplicate(this.object.system.automations)
|
||||
auto[index][field] = ev.currentTarget.value
|
||||
auto[index].id = auto[index].id || randomID(16)
|
||||
auto[index].id = auto[index].id || foundry.utils.randomID(16)
|
||||
this.object.update( { 'system.automations': auto })
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user