From 8a5c62fafdab26b4269072533e90e2b73da147e3 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Thu, 6 Jun 2024 22:46:40 +0200 Subject: [PATCH] Fix v12 warnings --- scripts/A1odAcuRbq9797ZB.js | 2 +- scripts/BD7bVTU2pVoRSRBe.js | 2 +- scripts/OGX4BneaYAnV25TO.js | 2 +- scripts/QfTBRGXVfwQSghmd.js | 2 +- scripts/S1QihXuvdEVzeRtB.js | 2 +- scripts/TwgdEucxcHloc4cX.js | 2 +- scripts/UnqnWi0dZYLf5fTT.js | 2 +- scripts/Z6OmmC0irJzxSnMH.js | 2 +- scripts/a8i0sA1RBnD8nHZt.js | 47 +++++++-------- scripts/dWr3tkFoIzsAgelu.js | 18 +++--- scripts/ePPgxQOqL1Uhz2k9.js | 2 +- scripts/hpwJRAhCsXTp9bd9.js | 2 +- scripts/lvjcddwRiN9iGruy.js | 2 +- scripts/v5xrDWcrTNFJkyQB.js | 116 +++++++++++++++++------------------- 14 files changed, 96 insertions(+), 107 deletions(-) diff --git a/scripts/A1odAcuRbq9797ZB.js b/scripts/A1odAcuRbq9797ZB.js index 4a76f8e..7103e1e 100644 --- a/scripts/A1odAcuRbq9797ZB.js +++ b/scripts/A1odAcuRbq9797ZB.js @@ -73,7 +73,7 @@ for (let c of choice) { item = item.toObject() equip(item); - items.push(mergeObject(item, (c.diff || {}))) + items.push(foundry.utils.mergeObject(item, (c.diff || {}))) } else ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) diff --git a/scripts/BD7bVTU2pVoRSRBe.js b/scripts/BD7bVTU2pVoRSRBe.js index d34ed0a..b436fd6 100644 --- a/scripts/BD7bVTU2pVoRSRBe.js +++ b/scripts/BD7bVTU2pVoRSRBe.js @@ -13,7 +13,7 @@ let choices = await ItemDialog.create(ItemDialog.objectToArray(symptoms), roll.t if (choices.length) { - let symptomEffects = duplicate(game.wfrp4e.config.symptomEffects) + let symptomEffects = foundry.utils.duplicate(game.wfrp4e.config.symptomEffects) let added = [] for(let choice of choices) { diff --git a/scripts/OGX4BneaYAnV25TO.js b/scripts/OGX4BneaYAnV25TO.js index cd24841..a2c6e62 100644 --- a/scripts/OGX4BneaYAnV25TO.js +++ b/scripts/OGX4BneaYAnV25TO.js @@ -1,7 +1,7 @@ let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") } let message = "" -let wounds = duplicate(this.actor.status.wounds) +let wounds = foundry.utils.duplicate(this.actor.status.wounds) let regenRoll = await new Roll("1d10").roll(); let regen = regenRoll.total; diff --git a/scripts/QfTBRGXVfwQSghmd.js b/scripts/QfTBRGXVfwQSghmd.js index 180052e..733f235 100644 --- a/scripts/QfTBRGXVfwQSghmd.js +++ b/scripts/QfTBRGXVfwQSghmd.js @@ -2,7 +2,7 @@ fromUuid(this.effect.origin).then(caster => { if (caster) { if (actor.items.find(it => it.name == game.i18n.localize("Bestial"))) { let healed = caster.characteristics.wp.bonus - let wounds = duplicate(args.actor.status.wounds) + let wounds = foundry.utils.duplicate(args.actor.status.wounds) wounds.value += healed if (wounds.value > wounds.max) diff --git a/scripts/S1QihXuvdEVzeRtB.js b/scripts/S1QihXuvdEVzeRtB.js index dd7235c..37f949e 100644 --- a/scripts/S1QihXuvdEVzeRtB.js +++ b/scripts/S1QihXuvdEVzeRtB.js @@ -30,7 +30,7 @@ else if (roll = 10) message = `Résultat de ${roll}, gagnez ${item.name}, ${modifier} en Force` dice.toMessage(this.script.getChatData()) -let changes = duplicate(this.effect.changes) +let changes = foundry.utils.duplicate(this.effect.changes) changes[0].value = modifier this.effect.updateSource({changes}) diff --git a/scripts/TwgdEucxcHloc4cX.js b/scripts/TwgdEucxcHloc4cX.js index 08c7bb0..f7c4810 100644 --- a/scripts/TwgdEucxcHloc4cX.js +++ b/scripts/TwgdEucxcHloc4cX.js @@ -109,7 +109,7 @@ for (let c of choice) { if (item) { item = item.toObject() equip(item); - items.push(mergeObject(item, (c.diff || {}))) + items.push(foundry.utils.mergeObject(item, (c.diff || {}))) } else ui.notifications.warn(`Impossible de trouver ${c.name}`, { permanent: true }) diff --git a/scripts/UnqnWi0dZYLf5fTT.js b/scripts/UnqnWi0dZYLf5fTT.js index ea1aec2..6196a13 100644 --- a/scripts/UnqnWi0dZYLf5fTT.js +++ b/scripts/UnqnWi0dZYLf5fTT.js @@ -112,7 +112,7 @@ for (let c of choice) { item = item.toObject() equip(item); - items.push(mergeObject(item, (c.diff || {}))) + items.push(foundry.utils.mergeObject(item, (c.diff || {}))) } else ui.notifications.warn(`Impossible de trouver ${c.name}`, {permanent : true}) diff --git a/scripts/Z6OmmC0irJzxSnMH.js b/scripts/Z6OmmC0irJzxSnMH.js index a7d2b34..a2c9377 100644 --- a/scripts/Z6OmmC0irJzxSnMH.js +++ b/scripts/Z6OmmC0irJzxSnMH.js @@ -1,7 +1,7 @@ let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") } let message = "" -let wounds = duplicate(this.actor.status.wounds) +let wounds = foundry.utils.duplicate(this.actor.status.wounds) let regenRoll = await new Roll("1d10").roll(); let regen = regenRoll.total; diff --git a/scripts/a8i0sA1RBnD8nHZt.js b/scripts/a8i0sA1RBnD8nHZt.js index cfba899..d8ce792 100644 --- a/scripts/a8i0sA1RBnD8nHZt.js +++ b/scripts/a8i0sA1RBnD8nHZt.js @@ -4,39 +4,32 @@ let targetedItem = this.actor.items.get(this.effect.flags.wfrp4e.itemTargets[0]) let qualities = foundry.utils.deepClone(game.wfrp4e.config.itemQualities); let flaws = foundry.utils.deepClone(game.wfrp4e.config.itemFlaws); -if (targetedItem.type == "weapon") -{ - mergeObject(qualities, game.wfrp4e.config.weaponQualities) - mergeObject(flaws, game.wfrp4e.config.weaponFlaws) +if (targetedItem.type == "weapon") { + foundry.utils.mergeObject(qualities, game.wfrp4e.config.weaponQualities) + foundry.utils.mergeObject(flaws, game.wfrp4e.config.weaponFlaws) } -else if (targetedItem.type == "armour") -{ - mergeObject(qualities, game.wfrp4e.config.armorQualities) - mergeObject(flaws, game.wfrp4e.config.armorFlaws) +else if (targetedItem.type == "armour") { + foundry.utils.mergeObject(qualities, game.wfrp4e.config.armorQualities) + foundry.utils.mergeObject(flaws, game.wfrp4e.config.armorFlaws) } -for(let q in qualities) -{ - // If the weapon already has a flaw, don't put it in the dialog - if (targetedItem.system.properties.qualities[q]) - { - delete qualities[q] - } +for (let q in qualities) { + // If the weapon already has a flaw, don't put it in the dialog + if (targetedItem.system.properties.qualities[q]) { + delete qualities[q] + } } -for(let f in flaws) -{ - // If a weapon doesn't have a flaw, don't put it in the dialog - if (!targetedItem.system.properties.flaws[f]) - { - delete flaws[f] - } +for (let f in flaws) { + // If a weapon doesn't have a flaw, don't put it in the dialog + if (!targetedItem.system.properties.flaws[f]) { + delete flaws[f] + } } - + let added = await ItemDialog.create(ItemDialog.objectToArray(qualities), "unlimited", "Choisissez la Qualité à ajouter"); let removed = [] -if (!foundry.utils.isEmpty(flaws)) -{ - removed = await ItemDialog.create(ItemDialog.objectToArray(flaws), "unlimited", "Choisissez le Défaut à enlever"); +if (!foundry.utils.isEmpty(flaws)) { + removed = await ItemDialog.create(ItemDialog.objectToArray(flaws), "unlimited", "Choisissez le Défaut à enlever"); } -this.effect.updateSource({"flags.wfrp4e.propertiesChanged" : {added : added.map(i => i.id), removed : removed.map(i => i.id)}}) +this.effect.updateSource({ "flags.wfrp4e.propertiesChanged": { added: added.map(i => i.id), removed: removed.map(i => i.id) } }) diff --git a/scripts/dWr3tkFoIzsAgelu.js b/scripts/dWr3tkFoIzsAgelu.js index ee54da3..b153ae5 100644 --- a/scripts/dWr3tkFoIzsAgelu.js +++ b/scripts/dWr3tkFoIzsAgelu.js @@ -1,11 +1,13 @@ let injury = this.effect.itemTargets[0] if (injury && this.effect.sourceTest.result.outcome == "success") { - let days = new Roll(injury.system.duration.value).roll( {async: false} ).total - let num = 1 + Number(this.effect.sourceTest.result.SL); - let roll = await new Roll(num+'d10').roll({async: false}) - await roll.toMessage(this.script.getChatData()) - let newDays = Math.max(days - roll.total, 1) - this.actor.updateEmbeddedDocuments("Item", [{_id: injury.id, 'system.duration.value': newDays} ]) - let message = "Blessures réduites à "+newDays+" (-" + roll.total + ") au lieu de "+days - this.script.scriptMessage(message) + let roll1 = new Roll(injury.system.duration.value) + await roll1.roll() + let days = roll1.total + let num = 1 + Number(this.effect.sourceTest.result.SL); + let roll = await new Roll(num + 'd10').roll() + await roll.toMessage(this.script.getChatData()) + let newDays = Math.max(days - roll.total, 1) + this.actor.updateEmbeddedDocuments("Item", [{ _id: injury.id, 'system.duration.value': newDays }]) + let message = "Blessures réduites à " + newDays + " (-" + roll.total + ") au lieu de " + days + this.script.scriptMessage(message) } diff --git a/scripts/ePPgxQOqL1Uhz2k9.js b/scripts/ePPgxQOqL1Uhz2k9.js index 8ded4d7..22ff72d 100644 --- a/scripts/ePPgxQOqL1Uhz2k9.js +++ b/scripts/ePPgxQOqL1Uhz2k9.js @@ -69,7 +69,7 @@ for (let c of choice) { item = item.toObject() equip(item); - items.push(mergeObject(item, (c.diff || {}))) + items.push(foundry.utils.mergeObject(item, (c.diff || {}))) } else ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) diff --git a/scripts/hpwJRAhCsXTp9bd9.js b/scripts/hpwJRAhCsXTp9bd9.js index ac8a134..b082e41 100644 --- a/scripts/hpwJRAhCsXTp9bd9.js +++ b/scripts/hpwJRAhCsXTp9bd9.js @@ -94,7 +94,7 @@ for (let c of choice) { item = item.toObject() equip(item); - items.push(mergeObject(item, (c.diff || {}))) + items.push(foundry.utils.mergeObject(item, (c.diff || {}))) } else ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) diff --git a/scripts/lvjcddwRiN9iGruy.js b/scripts/lvjcddwRiN9iGruy.js index 7dc0a07..5aea090 100644 --- a/scripts/lvjcddwRiN9iGruy.js +++ b/scripts/lvjcddwRiN9iGruy.js @@ -25,7 +25,7 @@ if (test.failed) ` this.script.scriptMessage(msg); - let characteristics = duplicate(this.actor.system.characteristics) + let characteristics = foundry.utils.duplicate(this.actor.system.characteristics) characteristics.ws.initial -= ws characteristics.bs.initial -= bs diff --git a/scripts/v5xrDWcrTNFJkyQB.js b/scripts/v5xrDWcrTNFJkyQB.js index c2c9e3d..5a0eca8 100644 --- a/scripts/v5xrDWcrTNFJkyQB.js +++ b/scripts/v5xrDWcrTNFJkyQB.js @@ -1,30 +1,30 @@ let choice1 = [ - { - type : "skill", - name : "Projectiles (Arc)", - diff : { - system : { - advances : { - value : 10 - } - } + { + type: "skill", + name: "Projectiles (Arc)", + diff: { + system: { + advances: { + value: 10 } - }, - { - type : "weapon", - name : "Arc long", - }, - { - type : "ammunition", - name : "Flèche", + } } + }, + { + type: "weapon", + name: "Arc long", + }, + { + type: "ammunition", + name: "Flèche", + } ] let choice2 = [ ] let choice = await Dialog.wait({ - title : "Option", - content : + title: "Option", + content: `

Ajouter l'ption?

@@ -32,59 +32,53 @@ let choice = await Dialog.wait({
  • Ranged (Bow) +10 and a Longbow with 12 Arrows
  • `, - buttons : { - 1 : { - label : "Oui", - callback : () => { - return choice1; - } - }, - 2 : { - label : "Non", - callback : () => { - return choice2; - } - } + buttons: { + 1: { + label: "Oui", + callback: () => { + return choice1; + } + }, + 2: { + label: "Non", + callback: () => { + return choice2; + } } + } }) let updateObj = this.actor.toObject(); let items = [] -for (let c of choice) -{ - let existing - if (c.type == "skill") - { - existing = updateObj.items.find(i => i.name == c.name && i.type == c.type) - if (existing && c.diff?.system?.advances?.value) - { - existing.system.advances.value += c.diff.system.advances.value - } +for (let c of choice) { + let existing + if (c.type == "skill") { + existing = updateObj.items.find(i => i.name == c.name && i.type == c.type) + if (existing && c.diff?.system?.advances?.value) { + existing.system.advances.value += c.diff.system.advances.value } + } - if (!existing) - { - let item = await game.wfrp4e.utility.find(c.name, c.type) - if (item) - { - item = item.toObject() - equip(item); - items.push(mergeObject(item, (c.diff || {}))) - } - else - ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) + if (!existing) { + let item = await game.wfrp4e.utility.find(c.name, c.type) + if (item) { + item = item.toObject() + equip(item); + items.push(foundry.utils.mergeObject(item, (c.diff || {}))) } + else + ui.notifications.warn(`Impossible de trouver ${talent}`, { permanent: true }) + } } await this.actor.update(updateObj) this.actor.createEmbeddedDocuments("Item", items); -function equip(item) -{ - if (item.type == "armour") - item.system.worn.value = true - else if (item.type == "weapon") - item.system.equipped = true - else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories") - item.system.worn = true +function equip(item) { + if (item.type == "armour") + item.system.worn.value = true + else if (item.type == "weapon") + item.system.equipped = true + else if (item.type == "trapping" && item.system.trappingType.value == "clothingAccessories") + item.system.worn = true } \ No newline at end of file