Fix v12 warnings

This commit is contained in:
LeRatierBretonnien 2024-06-06 22:46:40 +02:00
parent 2c5ff15830
commit 8a5c62fafd
14 changed files with 96 additions and 107 deletions

View File

@ -73,7 +73,7 @@ for (let c of choice)
{ {
item = item.toObject() item = item.toObject()
equip(item); equip(item);
items.push(mergeObject(item, (c.diff || {}))) items.push(foundry.utils.mergeObject(item, (c.diff || {})))
} }
else else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})

View File

@ -13,7 +13,7 @@ let choices = await ItemDialog.create(ItemDialog.objectToArray(symptoms), roll.t
if (choices.length) if (choices.length)
{ {
let symptomEffects = duplicate(game.wfrp4e.config.symptomEffects) let symptomEffects = foundry.utils.duplicate(game.wfrp4e.config.symptomEffects)
let added = [] let added = []
for(let choice of choices) for(let choice of choices)
{ {

View File

@ -1,7 +1,7 @@
let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") } let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") }
let message = "" 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 regenRoll = await new Roll("1d10").roll();
let regen = regenRoll.total; let regen = regenRoll.total;

View File

@ -2,7 +2,7 @@ fromUuid(this.effect.origin).then(caster => {
if (caster) { if (caster) {
if (actor.items.find(it => it.name == game.i18n.localize("Bestial"))) { if (actor.items.find(it => it.name == game.i18n.localize("Bestial"))) {
let healed = caster.characteristics.wp.bonus 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 wounds.value += healed
if (wounds.value > wounds.max) if (wounds.value > wounds.max)

View File

@ -30,7 +30,7 @@ else if (roll = 10)
message = `Résultat de ${roll}, gagnez ${item.name}, ${modifier} en Force` message = `Résultat de ${roll}, gagnez ${item.name}, ${modifier} en Force`
dice.toMessage(this.script.getChatData()) dice.toMessage(this.script.getChatData())
let changes = duplicate(this.effect.changes) let changes = foundry.utils.duplicate(this.effect.changes)
changes[0].value = modifier changes[0].value = modifier
this.effect.updateSource({changes}) this.effect.updateSource({changes})

View File

@ -109,7 +109,7 @@ for (let c of choice) {
if (item) { if (item) {
item = item.toObject() item = item.toObject()
equip(item); equip(item);
items.push(mergeObject(item, (c.diff || {}))) items.push(foundry.utils.mergeObject(item, (c.diff || {})))
} }
else else
ui.notifications.warn(`Impossible de trouver ${c.name}`, { permanent: true }) ui.notifications.warn(`Impossible de trouver ${c.name}`, { permanent: true })

View File

@ -112,7 +112,7 @@ for (let c of choice)
{ {
item = item.toObject() item = item.toObject()
equip(item); equip(item);
items.push(mergeObject(item, (c.diff || {}))) items.push(foundry.utils.mergeObject(item, (c.diff || {})))
} }
else else
ui.notifications.warn(`Impossible de trouver ${c.name}`, {permanent : true}) ui.notifications.warn(`Impossible de trouver ${c.name}`, {permanent : true})

View File

@ -1,7 +1,7 @@
let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") } let chatData = { whisper: ChatMessage.getWhisperRecipients("GM") }
let message = "" 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 regenRoll = await new Roll("1d10").roll();
let regen = regenRoll.total; let regen = regenRoll.total;

View File

@ -4,38 +4,31 @@ let targetedItem = this.actor.items.get(this.effect.flags.wfrp4e.itemTargets[0])
let qualities = foundry.utils.deepClone(game.wfrp4e.config.itemQualities); let qualities = foundry.utils.deepClone(game.wfrp4e.config.itemQualities);
let flaws = foundry.utils.deepClone(game.wfrp4e.config.itemFlaws); let flaws = foundry.utils.deepClone(game.wfrp4e.config.itemFlaws);
if (targetedItem.type == "weapon") if (targetedItem.type == "weapon") {
{ foundry.utils.mergeObject(qualities, game.wfrp4e.config.weaponQualities)
mergeObject(qualities, game.wfrp4e.config.weaponQualities) foundry.utils.mergeObject(flaws, game.wfrp4e.config.weaponFlaws)
mergeObject(flaws, game.wfrp4e.config.weaponFlaws)
} }
else if (targetedItem.type == "armour") else if (targetedItem.type == "armour") {
{ foundry.utils.mergeObject(qualities, game.wfrp4e.config.armorQualities)
mergeObject(qualities, game.wfrp4e.config.armorQualities) foundry.utils.mergeObject(flaws, game.wfrp4e.config.armorFlaws)
mergeObject(flaws, game.wfrp4e.config.armorFlaws)
} }
for(let q in qualities) for (let q in qualities) {
{
// If the weapon already has a flaw, don't put it in the dialog // If the weapon already has a flaw, don't put it in the dialog
if (targetedItem.system.properties.qualities[q]) if (targetedItem.system.properties.qualities[q]) {
{
delete qualities[q] delete qualities[q]
} }
} }
for(let f in flaws) for (let f in flaws) {
{
// If a weapon doesn't have a flaw, don't put it in the dialog // If a weapon doesn't have a flaw, don't put it in the dialog
if (!targetedItem.system.properties.flaws[f]) if (!targetedItem.system.properties.flaws[f]) {
{
delete flaws[f] delete flaws[f]
} }
} }
let added = await ItemDialog.create(ItemDialog.objectToArray(qualities), "unlimited", "Choisissez la Qualité à ajouter"); let added = await ItemDialog.create(ItemDialog.objectToArray(qualities), "unlimited", "Choisissez la Qualité à ajouter");
let removed = [] let removed = []
if (!foundry.utils.isEmpty(flaws)) if (!foundry.utils.isEmpty(flaws)) {
{
removed = await ItemDialog.create(ItemDialog.objectToArray(flaws), "unlimited", "Choisissez le Défaut à enlever"); removed = await ItemDialog.create(ItemDialog.objectToArray(flaws), "unlimited", "Choisissez le Défaut à enlever");
} }

View File

@ -1,8 +1,10 @@
let injury = this.effect.itemTargets[0] let injury = this.effect.itemTargets[0]
if (injury && this.effect.sourceTest.result.outcome == "success") { if (injury && this.effect.sourceTest.result.outcome == "success") {
let days = new Roll(injury.system.duration.value).roll( {async: false} ).total 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 num = 1 + Number(this.effect.sourceTest.result.SL);
let roll = await new Roll(num+'d10').roll({async: false}) let roll = await new Roll(num + 'd10').roll()
await roll.toMessage(this.script.getChatData()) await roll.toMessage(this.script.getChatData())
let newDays = Math.max(days - roll.total, 1) let newDays = Math.max(days - roll.total, 1)
this.actor.updateEmbeddedDocuments("Item", [{ _id: injury.id, 'system.duration.value': newDays }]) this.actor.updateEmbeddedDocuments("Item", [{ _id: injury.id, 'system.duration.value': newDays }])

View File

@ -69,7 +69,7 @@ for (let c of choice)
{ {
item = item.toObject() item = item.toObject()
equip(item); equip(item);
items.push(mergeObject(item, (c.diff || {}))) items.push(foundry.utils.mergeObject(item, (c.diff || {})))
} }
else else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})

View File

@ -94,7 +94,7 @@ for (let c of choice)
{ {
item = item.toObject() item = item.toObject()
equip(item); equip(item);
items.push(mergeObject(item, (c.diff || {}))) items.push(foundry.utils.mergeObject(item, (c.diff || {})))
} }
else else
ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true}) ui.notifications.warn(`Impossible de trouver ${talent}`, {permanent : true})

View File

@ -25,7 +25,7 @@ if (test.failed)
` `
this.script.scriptMessage(msg); 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.ws.initial -= ws
characteristics.bs.initial -= bs characteristics.bs.initial -= bs

View File

@ -50,26 +50,21 @@ let choice = await Dialog.wait({
let updateObj = this.actor.toObject(); let updateObj = this.actor.toObject();
let items = [] let items = []
for (let c of choice) for (let c of choice) {
{
let existing let existing
if (c.type == "skill") if (c.type == "skill") {
{
existing = updateObj.items.find(i => i.name == c.name && i.type == c.type) existing = updateObj.items.find(i => i.name == c.name && i.type == c.type)
if (existing && c.diff?.system?.advances?.value) if (existing && c.diff?.system?.advances?.value) {
{
existing.system.advances.value += c.diff.system.advances.value existing.system.advances.value += c.diff.system.advances.value
} }
} }
if (!existing) if (!existing) {
{
let item = await game.wfrp4e.utility.find(c.name, c.type) let item = await game.wfrp4e.utility.find(c.name, c.type)
if (item) if (item) {
{
item = item.toObject() item = item.toObject()
equip(item); equip(item);
items.push(mergeObject(item, (c.diff || {}))) items.push(foundry.utils.mergeObject(item, (c.diff || {})))
} }
else else
ui.notifications.warn(`Impossible de trouver ${talent}`, { permanent: true }) ui.notifications.warn(`Impossible de trouver ${talent}`, { permanent: true })
@ -79,8 +74,7 @@ for (let c of choice)
await this.actor.update(updateObj) await this.actor.update(updateObj)
this.actor.createEmbeddedDocuments("Item", items); this.actor.createEmbeddedDocuments("Item", items);
function equip(item) function equip(item) {
{
if (item.type == "armour") if (item.type == "armour")
item.system.worn.value = true item.system.worn.value = true
else if (item.type == "weapon") else if (item.type == "weapon")