From 336767c19ec4331994a2f82c788b6a31e38209fe Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 7 Sep 2022 09:01:23 +0200 Subject: [PATCH] v10 WIP --- module/actor-sheet.js | 10 ++--- module/actor.js | 8 ++-- module/dialog-create-signedraconique.js | 44 +++++++++++----------- module/dialog-item-achat.js | 2 +- module/dialog-item-consommer.js | 10 ++--- module/item-arme.js | 1 - module/item-competence.js | 2 +- module/item-sheet.js | 8 ++-- module/item-signedraconique.js | 2 +- module/item-sort.js | 12 +++--- module/rdd-alchimie.js | 6 +-- module/rdd-calendrier.js | 4 +- module/rdd-combat.js | 10 ++--- module/rdd-herbes.js | 2 +- module/rdd-hotbar-drop.js | 2 +- module/rdd-main.js | 4 +- module/rdd-possession.js | 2 +- module/rdd-resolution-table.js | 2 +- module/rdd-roll.js | 6 +-- module/rdd-utility.js | 2 +- module/rolldata-ajustements.js | 2 +- module/tmr/sort-reserve.js | 2 +- module/tmr/urgence-draconique.js | 2 +- system.json | 4 +- templates/chat-demande-attaque-etotal.html | 2 +- 25 files changed, 75 insertions(+), 76 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 659089c1..01d6553e 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -330,7 +330,7 @@ export class RdDActorSheet extends ActorSheet { }); // Initiative pour l'arme html.find('.arme-initiative a').click(async event => { - let combatant = game.combat.data.combatants.find(c => c.actor.data._id == this.actor.data._id); + let combatant = game.combat.combatants.find(c => c.actor._id == this.actor._id); if (combatant) { let action = this._getEventArmeCombat(event); RdDCombatManager.rollInitiativeAction(combatant._id, action); @@ -381,11 +381,11 @@ export class RdDActorSheet extends ActorSheet { if (this.options.editCaracComp) { // On carac change html.find('.carac-value').change(async event => { - let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); + let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", ""); this.actor.updateCarac(caracName, parseInt(event.target.value)); }); html.find('input.carac-xp').change(async event => { - let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", ""); + let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", ""); this.actor.updateCaracXP(caracName, parseInt(event.target.value)); }); // On competence change @@ -579,8 +579,8 @@ export class RdDActorSheet extends ActorSheet { async _onSplitItem(item, split) { if (split >= 1 && split < item.system.quantite) { await item.diminuerQuantite(split); - const itemData = duplicate(item.system); - itemData.data.quantite = split; + const itemData = duplicate(item); + itemData.system.quantite = split; await this.actor.createEmbeddedDocuments('Item', [itemData]) } } diff --git a/module/actor.js b/module/actor.js index 243107c1..0dbf9e50 100644 --- a/module/actor.js +++ b/module/actor.js @@ -182,7 +182,7 @@ export class RdDActor extends Actor { async cleanupConteneurs() { let updates = this.listItemsData('conteneur') .filter(c => c.system.contenu.filter(id => this.getObjet(id) == undefined).length > 0) - .map(c => { return { _id: c._id, 'data.contenu': c.system.contenu.filter(id => this.getObjet(id) != undefined) } }); + .map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getObjet(id) != undefined) } }); if (updates.length > 0) { await this.updateEmbeddedDocuments("Item", updates) } @@ -402,7 +402,7 @@ export class RdDActor extends Actor { if (!potion.system.prpermanent) { console.log(potion); let newPr = (potion.system.pr > 0) ? potion.system.pr - 1 : 0; - let update = { _id: potion._id, 'data.pr': newPr }; + let update = { _id: potion._id, 'system.pr': newPr }; const updated = await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity let messageData = { @@ -1003,7 +1003,7 @@ export class RdDActor extends Actor { if (competence) { if (isNaN(newXp) || typeof (newXp) != 'number') newXp = 0; this.checkCompetenceXP(idOrName, newXp); - const update = { _id: competence.id, 'data.xp': newXp }; + const update = { _id: competence.id, 'system.xp': newXp }; await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity this.updateExperienceLog("XP", newXp, "XP modifié en " + competence.name); } else { @@ -2841,7 +2841,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ _meditationEPart(meditationRoll) { - this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'data.malus': meditationRoll.meditation.system.malus - 1 }]); + this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]); } diff --git a/module/dialog-create-signedraconique.js b/module/dialog-create-signedraconique.js index 2800d53b..21d2d79f 100644 --- a/module/dialog-create-signedraconique.js +++ b/module/dialog-create-signedraconique.js @@ -10,7 +10,7 @@ export class DialogCreateSigneDraconique extends Dialog { const signe = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); let dialogData = { signe: signe, - tmrs: TMRUtility.listSelectedTMR(signe.data.typesTMR ?? []), + tmrs: TMRUtility.listSelectedTMR(signe.system.typesTMR ?? []), actors: game.actors.filter(actor => actor.isHautRevant()).map(actor => { let actorData = duplicate(actor); actorData.selected = actor.hasPlayerOwner; @@ -38,7 +38,7 @@ export class DialogCreateSigneDraconique extends Dialog { } async _onCreerSigneActeurs() { - await $("[name='signe.data.ephemere']").change(); + await $("[name='signe.system.ephemere']").change(); await $(".signe-xp-sort").change(); this.validerSigne(); this.dialogData.actors.filter(it => it.selected).map(it => game.actors.get(it._id)) @@ -58,21 +58,21 @@ export class DialogCreateSigneDraconique extends Dialog { validerSigne() { this.dialogData.signe.name = $("[name='signe.name']").val(); - this.dialogData.signe.data.valeur.norm = $("[name='signe.data.valeur.norm']").val(); - this.dialogData.signe.data.valeur.sign = $("[name='signe.data.valeur.sign']").val(); - this.dialogData.signe.data.valeur.part = $("[name='signe.data.valeur.part']").val(); - this.dialogData.signe.data.difficulte = $("[name='signe.data.difficulte']").val(); - this.dialogData.signe.data.ephemere = $("[name='signe.data.ephemere']").prop("checked"); - this.dialogData.signe.data.duree = $("[name='signe.data.duree']").val(); - this.dialogData.signe.data.typesTMR = $(".select-tmr").val(); + this.dialogData.signe.system.valeur.norm = $("[name='signe.system.valeur.norm']").val(); + this.dialogData.signe.system.valeur.sign = $("[name='signe.system.valeur.sign']").val(); + this.dialogData.signe.system.valeur.part = $("[name='signe.system.valeur.part']").val(); + this.dialogData.signe.system.difficulte = $("[name='signe.system.difficulte']").val(); + this.dialogData.signe.system.ephemere = $("[name='signe.system.ephemere']").prop("checked"); + this.dialogData.signe.system.duree = $("[name='signe.system.duree']").val(); + this.dialogData.signe.system.typesTMR = $(".select-tmr").val(); } /* -------------------------------------------- */ activateListeners(html) { super.activateListeners(html); - this.setEphemere(this.dialogData.signe.data.ephemere); + this.setEphemere(this.dialogData.signe.system.ephemere); html.find(".signe-aleatoire").click(event => this.setSigneAleatoire()); - html.find("[name='signe.data.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked)); + html.find("[name='signe.system.ephemere']").change((event) => this.setEphemere(event.currentTarget.checked)); html.find(".select-actor").change((event) => this.onSelectActor(event)); html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event)); } @@ -81,18 +81,18 @@ export class DialogCreateSigneDraconique extends Dialog { const newSigne = await RdDItemSigneDraconique.randomSigneDraconique({ephemere: true}); $("[name='signe.name']").val(newSigne.name); - $("[name='signe.data.valeur.norm']").val(newSigne.data.valeur.norm); - $("[name='signe.data.valeur.sign']").val(newSigne.data.valeur.sign); - $("[name='signe.data.valeur.part']").val(newSigne.data.valeur.part); - $("[name='signe.data.difficulte']").val(newSigne.data.difficulte); - $("[name='signe.data.duree']").val(newSigne.data.duree); - $("[name='signe.data.ephemere']").prop("checked", newSigne.data.ephemere); - $(".select-tmr").val(newSigne.data.typesTMR); - this.setEphemere(newSigne.data.ephemere); + $("[name='signe.system.valeur.norm']").val(newSigne.system.valeur.norm); + $("[name='signe.system.valeur.sign']").val(newSigne.system.valeur.sign); + $("[name='signe.system.valeur.part']").val(newSigne.system.valeur.part); + $("[name='signe.system.difficulte']").val(newSigne.system.difficulte); + $("[name='signe.system.duree']").val(newSigne.system.duree); + $("[name='signe.system.ephemere']").prop("checked", newSigne.system.ephemere); + $(".select-tmr").val(newSigne.system.typesTMR); + this.setEphemere(newSigne.system.ephemere); } async setEphemere(ephemere) { - this.dialogData.signe.data.ephemere = ephemere; + this.dialogData.signe.system.ephemere = ephemere; HtmlUtility._showControlWhen($(".signe-data-duree"), ephemere); } @@ -111,8 +111,8 @@ export class DialogCreateSigneDraconique extends Dialog { onValeurXpSort(event) { const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const xp = Number(event.currentTarget.value); - const oldValeur = this.dialogData.signe.data.valeur; - this.dialogData.signe.data.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); + const oldValeur = this.dialogData.signe.system.valeur; + this.dialogData.signe.system.valeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); } } \ No newline at end of file diff --git a/module/dialog-item-achat.js b/module/dialog-item-achat.js index 8b6ba515..d122a29e 100644 --- a/module/dialog-item-achat.js +++ b/module/dialog-item-achat.js @@ -34,7 +34,7 @@ export class DialogItemAchat extends Dialog { const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre"; const buttons = {}; if (isConsommable) { - buttons["consommer"] = { label: venteData.item.data.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } } + buttons["consommer"] = { label: venteData.item.system.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } } } buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } }; buttons["decliner"] = { label: "Décliner", callback: it => { } }; diff --git a/module/dialog-item-consommer.js b/module/dialog-item-consommer.js index 9c2b8359..b62d8797 100644 --- a/module/dialog-item-consommer.js +++ b/module/dialog-item-consommer.js @@ -49,8 +49,8 @@ export class DialogConsommer extends Dialog { } switch (itemData.type) { case 'nourritureboisson': - consommerData.title = itemData.data.boisson ? `${itemData.name}: boire une dose` : `${itemData.name}: manger une portion`; - consommerData.buttonName = itemData.data.boisson ? "Boire" : "Manger"; + consommerData.title = itemData.system.boisson ? `${itemData.name}: boire une dose` : `${itemData.name}: manger une portion`; + consommerData.buttonName = itemData.system.boisson ? "Boire" : "Manger"; break; case 'potion': consommerData.title = `${itemData.name}: boire la potion`; @@ -63,9 +63,9 @@ export class DialogConsommer extends Dialog { static calculDoses(consommerData) { const doses = consommerData.choix.doses; - consommerData.totalSust = Misc.keepDecimals(doses * (consommerData.item.data.sust ?? 0), 2); - consommerData.totalDesaltere = consommerData.item.data.boisson - ? Misc.keepDecimals(doses * (consommerData.item.data.desaltere ?? 0), 2) + consommerData.totalSust = Misc.keepDecimals(doses * (consommerData.item.system.sust ?? 0), 2); + consommerData.totalDesaltere = consommerData.item.system.boisson + ? Misc.keepDecimals(doses * (consommerData.item.system.desaltere ?? 0), 2) : 0; } diff --git a/module/item-arme.js b/module/item-arme.js index 56153c78..59c5f698 100644 --- a/module/item-arme.js +++ b/module/item-arme.js @@ -168,7 +168,6 @@ export class RdDItemArme extends Item { let corpsACorps = competences.find(it => it.name == 'Corps à corps') ?? { system: { niveau: -6 } }; let init = RdDCombatManager.calculInitiative(corpsACorps.system.niveau, carac['melee'].value); armes.push(RdDItemArme.mainsNues({ niveau: corpsACorps.system.niveau, initiative: init })); - //armes.push(RdDItemArme.empoignade({ niveau: corpsACorps.data.niveau, initiative: init })); } static corpsACorps(actorData) { diff --git a/module/item-competence.js b/module/item-competence.js index 6eaf8193..8d3b7728 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -196,7 +196,7 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static isVisible(itemData) { - return Number(itemData.data.niveau) != RdDItemCompetence.getNiveauBase(itemData.data.categorie); + return Number(itemData.system.niveau) != RdDItemCompetence.getNiveauBase(itemData.system.categorie); } static nomContientTexte(itemData, texte) { diff --git a/module/item-sheet.js b/module/item-sheet.js index 67379b7f..00984fbd 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -92,7 +92,7 @@ export class RdDItemSheet extends ItemSheet { console.log(formData.competences) } if (formData.type == 'recettealchimique') { - RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id); + RdDAlchimie.processManipulation(this.object, this.actor && this.actor.id); } if (formData.type == 'gemme') { formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); @@ -145,8 +145,8 @@ export class RdDItemSheet extends ItemSheet { html.find(".categorie").change(event => this._onSelectCategorie(event)); html.find('.sheet-competence-xp').change((event) => { - if (this.object.data.type == 'competence') { - RdDUtility.checkThanatosXP(this.object.data.name); + if (this.object.type == 'competence') { + RdDUtility.checkThanatosXP(this.object.name); } }); @@ -252,7 +252,7 @@ export class RdDItemSheet extends ItemSheet { const dragData = { actorId: this.actor.id, type: "Item", - data: item.data + data: item }; event.dataTransfer.setData("text/plain", JSON.stringify(dragData)); diff --git a/module/item-signedraconique.js b/module/item-signedraconique.js index af2b6697..eaddb716 100644 --- a/module/item-signedraconique.js +++ b/module/item-signedraconique.js @@ -24,7 +24,7 @@ export class RdDItemSigneDraconique { type: "signedraconique", img: meditation.img, data: { - typesTMR: [TMRUtility.typeTmrName(meditation.data.tmr)], + typesTMR: [TMRUtility.typeTmrName(meditation.system.tmr)], difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE, ephemere: true, duree: "1 round", diff --git a/module/item-sort.js b/module/item-sort.js index 9b9af594..203904c7 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -7,12 +7,12 @@ export class RdDItemSort extends Item { /* -------------------------------------------- */ static isDifficulteVariable(sort) { - return sort && (sort.data.difficulte.toLowerCase() == "variable"); + return sort && (sort.system.difficulte.toLowerCase() == "variable"); } /* -------------------------------------------- */ static isCoutVariable(sort) { - return sort && (sort.data.ptreve.toLowerCase() == "variable" || sort.data.ptreve.indexOf("+") >= 0); + return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0); } /* -------------------------------------------- */ @@ -25,7 +25,7 @@ export class RdDItemSort extends Item { /* -------------------------------------------- */ static getDifficulte(sort, variable) { if (sort && !RdDItemSort.isDifficulteVariable(sort)) { - return Misc.toInt(sort.data.difficulte); + return Misc.toInt(sort.system.difficulte); } return variable; } @@ -54,7 +54,7 @@ export class RdDItemSort extends Item { static getBonusCaseList( item, newCase = false ) { // Gestion spéciale case bonus if ( item.type == 'sort') { - return this.buildBonusCaseList(item.data.bonuscase, newCase ); + return this.buildBonusCaseList(item.system.bonuscase, newCase ); } return undefined; } @@ -87,7 +87,7 @@ export class RdDItemSort extends Item { /* -------------------------------------------- */ static incrementBonusCase( actor, sort, coord ) { - let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false); + let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false); //console.log("ITEMSORT", sort, bonusCaseList); let found = false; @@ -111,7 +111,7 @@ export class RdDItemSort extends Item { /* -------------------------------------------- */ static getCaseBonus( sort, coord) { - let bonusCaseList = this.buildBonusCaseList(sort.data.bonuscase, false); + let bonusCaseList = this.buildBonusCaseList(sort.system.bonuscase, false); for( let bc of bonusCaseList) { if (bc.case == coord) { // Case existante return Number(bc.bonus); diff --git a/module/rdd-alchimie.js b/module/rdd-alchimie.js index 58611457..7d99ee06 100644 --- a/module/rdd-alchimie.js +++ b/module/rdd-alchimie.js @@ -7,9 +7,9 @@ const matchOperationTerms = new RegExp(/@(\w*){([\w\-]+)}/i); export class RdDAlchimie { /* -------------------------------------------- */ - static processManipulation(recetteData, actorId = undefined) { + static processManipulation(recette, actorId = undefined) { //console.log("CALLED", recette, recette.isOwned, actorId ); - let manip = recetteData.data.manipulation; + let manip = recette.system.manipulation; let matchArray = manip.match(matchOperations); if (matchArray) { for (let matchStr of matchArray) { @@ -22,7 +22,7 @@ export class RdDAlchimie { } } } - recetteData.data.manipulation_update = manip; + recetteData.recette.manipulation_update = manip; } /* -------------------------------------------- */ diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index 691ed7b9..75605ca2 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -223,9 +223,9 @@ export class RdDCalendrier extends Application { checkMaladie( periode) { for (let actor of game.actors) { if (actor.type == 'personnage') { - let maladies = actor.filterItems( item => (item.type == 'maladie' || (item.type == 'poison' && item.data.active) ) && item.data.periodicite.toLowerCase().includes(periode) ); + let maladies = actor.filterItems( item => (item.type == 'maladie' || (item.type == 'poison' && item.system.active) ) && item.system.periodicite.toLowerCase().includes(periode) ); for (let maladie of maladies) { - if ( maladie.data.identifie) { + if ( maladie.system.identifie) { ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` }); } else { ChatMessage.create({ content: `${actor.name} souffre d'un mal inconnu (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` }); diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 81c38b3e..5bb20b9f 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -66,7 +66,7 @@ export class RdDCombatManager extends Combat { /* -------------------------------------------- */ async finDeRound(options = { terminer: false }) { - for (let combatant of this.data.combatants) { + for (let combatant of this.combatants) { if (combatant.actor) { await combatant.actor.finDeRound(options); } @@ -78,7 +78,7 @@ export class RdDCombatManager extends Combat { /************************************************************************************/ async rollInitiative(ids, formula = undefined, messageOptions = {}) { - console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions); + console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions); // Structure input data ids = typeof ids === "string" ? [ids] : ids; const currentId = this.combatant._id; @@ -249,9 +249,9 @@ export class RdDCombatManager extends Combat { static processPremierRoundInit() { // Check if we have the whole init ! if (Misc.isUniqueConnectedGM() && game.combat.current.round == 1) { - let initMissing = game.combat.data.combatants.find(it => !it.initiative); + let initMissing = game.combat.combatants.find(it => !it.initiative); if (!initMissing) { // Premier round ! - for (let combatant of game.combat.data.combatants) { + for (let combatant of game.combat.combatants) { let action = combatant.initiativeData?.arme; //console.log("Parsed !!!", combatant, initDone, game.combat.current, arme); if (action && action.type == "arme") { @@ -415,7 +415,7 @@ export class RdDCombat { /* -------------------------------------------- */ static onUpdateCombat(combat, change, options, userId) { - if (combat.data.round != 0 && combat.turns && combat.data.active) { + if (combat.round != 0 && combat.turns && combat.active) { RdDCombat.combatNouveauTour(combat); } } diff --git a/module/rdd-herbes.js b/module/rdd-herbes.js index 38c490d3..1c7e431e 100644 --- a/module/rdd-herbes.js +++ b/module/rdd-herbes.js @@ -27,7 +27,7 @@ export class RdDHerbes extends Item { for ( let herbe of listHerbes) { let herbeData = herbe.system let brins = max - herbeData.niveau; - list[herbe.data.name] = `${herbe.data.name} (Bonus: ${herbeData.niveau}, Brins: ${brins})`; + list[herbe.name] = `${herbe.name} (Bonus: ${herbeData.niveau}, Brins: ${brins})`; } list['Autre'] = 'Autre (Bonus: variable, Brins: variable)' return list; diff --git a/module/rdd-hotbar-drop.js b/module/rdd-hotbar-drop.js index 9303d596..83bc0c05 100644 --- a/module/rdd-hotbar-drop.js +++ b/module/rdd-hotbar-drop.js @@ -45,7 +45,7 @@ export class RdDHotbar { macro = await Macro.create({ name: actor.name, type: "script", - img: actor.data.img, + img: actor.img, command: command }, { displaySheet: false }) game.user.assignHotbarMacro(macro, slot); diff --git a/module/rdd-main.js b/module/rdd-main.js index 0261c096..a01bc08c 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -292,8 +292,8 @@ async function migrationPngWebp_1_5_34() { await Item.updateDocuments(itemsUpdates); await Actor.updateDocuments(actorsUpdates); game.actors.forEach(actor => { - if (actor.data.token?.img && actor.data.token.img.match(regexOldPngJpg)) { - actor.update({ "token.img": convertImgToWebp(actor.data.token.img) }); + if (actor.token?.img && actor.token.img.match(regexOldPngJpg)) { + actor.update({ "token.img": convertImgToWebp(actor.token.img) }); } const actorItemsToUpdate = prepareDocumentsImgUpdate(actor.items); actor.updateEmbeddedDocuments('Item', actorItemsToUpdate); diff --git a/module/rdd-possession.js b/module/rdd-possession.js index 25a92923..c2823230 100644 --- a/module/rdd-possession.js +++ b/module/rdd-possession.js @@ -84,7 +84,7 @@ export class RdDPossession { attacker: attacker, defender: defender, competence: defender.getDraconicOuPossession(), - selectedCarac: defender.system.data.carac.reve, + selectedCarac: defender.system.carac.reve, forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: defender.getReveActuel() } } } rollData.competence.system.defaut_carac = 'reve-actuel' diff --git a/module/rdd-resolution-table.js b/module/rdd-resolution-table.js index 6db89650..88389a9c 100644 --- a/module/rdd-resolution-table.js +++ b/module/rdd-resolution-table.js @@ -166,7 +166,7 @@ export class RdDResolutionTable { if (rollData.selectedCarac?.label.toLowerCase().includes('chance')) { return true; } - if (rollData.selectedSort?.data.isrituel) { + if (rollData.selectedSort?.system.isrituel) { return true; } return false; diff --git a/module/rdd-roll.js b/module/rdd-roll.js index f9c860d7..3d9abbd4 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -221,7 +221,7 @@ export class RdDRoll extends Dialog { }); html.find('#ptreve-variable').change((event) => { let ptreve = Misc.toInt(event.currentTarget.value); - this.rollData.selectedSort.data.ptreve_reel = ptreve; + this.rollData.selectedSort.system.ptreve_reel = ptreve; console.log("RdDRollSelectDialog - Cout reve", ptreve); this.updateRollResult(); }); @@ -348,10 +348,10 @@ export class RdDRoll extends Dialog { /* -------------------------------------------- */ _computeDiffCompetence(rollData) { if (rollData.competence) { - return Misc.toInt(rollData.competence.data.niveau); + return Misc.toInt(rollData.competence.system.niveau); } if (rollData.draconicList) { - return Misc.toInt(rollData.competence.data.niveau); + return Misc.toInt(rollData.competence.system.niveau); } return 0; } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 0bade4f6..e732957a 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -753,7 +753,7 @@ export class RdDUtility { static getSelectedActor(msgPlayer = undefined) { if (canvas.tokens.controlled.length == 1) { let token = canvas.tokens.controlled[0]; - if (token.actor && token.data.actorLink) { + if (token.actor && token.actorLink) { return token.actor; } if (msgPlayer != undefined) { diff --git a/module/rolldata-ajustements.js b/module/rolldata-ajustements.js index 1743a47a..4631e7cc 100644 --- a/module/rolldata-ajustements.js +++ b/module/rolldata-ajustements.js @@ -33,7 +33,7 @@ export const referenceAjustements = { getLabel: (rollData, actor) => rollData.selectedSort?.name ?? rollData.attackerRoll ? 'Imposée' : 'Libre', getValue: (rollData, actor) => rollData.selectedSort ? RdDItemSort.getDifficulte(rollData.selectedSort, rollData.diffLibre) - : rollData.diffLibre ?? rollData.competence?.data.default_diffLibre ?? 0 + : rollData.diffLibre ?? rollData.competence?.system.default_diffLibre ?? 0 }, diffConditions: { isUsed: (rollData, actor) => rollData.diffConditions != undefined, diff --git a/module/tmr/sort-reserve.js b/module/tmr/sort-reserve.js index 1f632963..9005d0f1 100644 --- a/module/tmr/sort-reserve.js +++ b/module/tmr/sort-reserve.js @@ -13,7 +13,7 @@ export class SortReserve extends Draconique { async onActorCreateOwned(actor, item) { } code() { return 'sort' } - tooltip(sort) { return `${sort.name}, r${sort.data.ptreve_reel}` } + tooltip(sort) { return `${sort.name}, r${sort.system.ptreve_reel}` } img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/scroll.webp' } createSprite(pixiTMR) { diff --git a/module/tmr/urgence-draconique.js b/module/tmr/urgence-draconique.js index a7aa8080..db81794f 100644 --- a/module/tmr/urgence-draconique.js +++ b/module/tmr/urgence-draconique.js @@ -37,7 +37,7 @@ export class UrgenceDraconique extends Draconique { } async onActorDeleteCaseTmr(actor, casetmr) { - await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]); + await actor.deleteEmbeddedDocuments('Item', [casetmr.system.sourceid]); } code() { return 'urgence' } diff --git a/system.json b/system.json index 68bb681d..2a16fd0d 100644 --- a/system.json +++ b/system.json @@ -34,7 +34,7 @@ ], "url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/", "license": "LICENSE.txt", - "version": "10.0.9", + "version": "10.0.10", "compatibility": { "minimum": "10" }, @@ -332,7 +332,7 @@ ], "socket": true, "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.8.zip", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.10.zip", "gridDistance": 1, "gridUnits": "m", "primaryTokenAttribute": "sante.vie", diff --git a/templates/chat-demande-attaque-etotal.html b/templates/chat-demande-attaque-etotal.html index 0e77997a..6c88fc0f 100644 --- a/templates/chat-demande-attaque-etotal.html +++ b/templates/chat-demande-attaque-etotal.html @@ -8,7 +8,7 @@
{{/unless}} - {{#if (gt attacker.data.compteurs.destinee.value 0)}} + {{#if (gt attacker.system.compteurs.destinee.value 0)}} Utiliser la destinée