From 67b0555b11d9781388c6d4eb76a9bfde6367fafd Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 7 Sep 2022 00:09:17 +0200 Subject: [PATCH] Corrections v10 Il y en avait partout dans des dialogues, des options, le drag&drop d'acteur sur acteur, l'empilage d'objet... --- module/actor-sheet.js | 32 +++++++---------- module/actor.js | 29 +++++++-------- module/chat-utility.js | 2 +- module/dialog-fabriquer-potion.js | 12 +++---- module/dialog-split-item.js | 2 +- module/item-competence.js | 16 ++++----- module/item-monnaie.js | 8 ++--- module/item-sheet.js | 2 +- module/item.js | 36 +++++++++++-------- module/rdd-combat.js | 18 +++++----- module/rdd-hotbar-drop.js | 6 ++-- module/rdd-roll.js | 4 +-- module/rdd-sheet-utility.js | 2 +- module/rdd-utility.js | 7 ++-- module/tmr-rencontres.js | 2 +- templates/actor-sheet-competence-partial.html | 2 +- templates/actor-sheet-inventaire-item.html | 4 +-- templates/actor-sheet-inventaire-monnaie.html | 2 +- templates/actor-sheet.html | 2 +- templates/chat-resultat-recettecuisine.html | 2 +- templates/chat-resultat-reve-de-dragon.html | 2 +- templates/chat-resultat-sort.html | 4 +-- templates/chat-signe-draconique-actor.html | 2 +- templates/dialog-create-signedraconique.html | 4 +-- templates/dialog-item-consommer.html | 2 +- templates/hud-actor-attaque.html | 4 +-- templates/hud-actor-init.html | 2 +- templates/partial-description-sort.html | 2 +- 28 files changed, 107 insertions(+), 105 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 1dec14dd..659089c1 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -39,7 +39,6 @@ export class RdDActorSheet extends ActorSheet { const objectData = this.object.system this.timerRecherche = undefined; - console.log("New actor", objectData) let formData = { title: this.title, id: this.object.id, @@ -76,15 +75,12 @@ export class RdDActorSheet extends ActorSheet { surEncombrementMessage: this.actor.getMessageSurEncombrement() }; - /* TODO - TO FIX for v10 formData.competences.forEach(item => { - console.log("ITEM1", item) - item.visible = this.options.recherche + item.system.isVisible = this.options.recherche ? RdDItemCompetence.nomContientTexte(item, this.options.recherche.text) : (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item)); RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value); - });*/ - + }); Object.values(formData.data.carac).forEach(c => { RdDCarac.levelUp(c); }); @@ -94,7 +90,7 @@ export class RdDActorSheet extends ActorSheet { formData.combat = duplicate(formData.armes ?? []); RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac); - formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.system)); + formData.esquives = this.actor.getCompetences("Esquive"); formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.data.carac); this.armesList = formData.combat; @@ -132,9 +128,9 @@ export class RdDActorSheet extends ActorSheet { /* -------------------------------------------- */ async _onDropActor(event, dragData) { - console.log("_onDropActor", this.actor.id, dragData) - this.actor.addSubActeur(dragData.id || dragData.data._id) - super._onDropActor(event, dragData) + const dropActor = fromUuidSync(dragData.uuid); + this.actor.addSubActeur(dropActor); + super._onDropActor(event, dragData); } /* -------------------------------------------- */ @@ -385,13 +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("system.carac.", ""); - //console.log("Value changed :", event, caracName); + let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", ""); this.actor.updateCarac(caracName, parseInt(event.target.value)); }); - html.find('.carac-xp').change(async event => { - let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", ""); - //console.log("Value changed :", event, caracName); + html.find('input.carac-xp').change(async event => { + let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", ""); this.actor.updateCaracXP(caracName, parseInt(event.target.value)); }); // On competence change @@ -401,12 +395,12 @@ export class RdDActorSheet extends ActorSheet { this.actor.updateCompetence(compName, parseInt(event.target.value)); }); // On competence xp change - html.find('.competence-xp').change(async event => { + html.find('input.competence-xp').change(async event => { let compName = event.currentTarget.attributes.compname.value; this.actor.updateCompetenceXP(compName, parseInt(event.target.value)); }); // On competence xp change - html.find('.competence-xp-sort').change(async event => { + html.find('input.competence-xp-sort').change(async event => { let compName = event.currentTarget.attributes.compname.value; this.actor.updateCompetenceXPSort(compName, parseInt(event.target.value)); }); @@ -583,9 +577,9 @@ export class RdDActorSheet extends ActorSheet { } async _onSplitItem(item, split) { - if (split >= 1 && split < Misc.data(item).data.quantite) { + if (split >= 1 && split < item.system.quantite) { await item.diminuerQuantite(split); - const itemData = duplicate(Misc.data(item)); + const itemData = duplicate(item.system); itemData.data.quantite = split; await this.actor.createEmbeddedDocuments('Item', [itemData]) } diff --git a/module/actor.js b/module/actor.js index 648b725e..243107c1 100644 --- a/module/actor.js +++ b/module/actor.js @@ -609,7 +609,6 @@ export class RdDActor extends Actor { whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), content: "Remise à neuf de " + this.name }; - const actorData = Misc.data(this); if (this.isEntite([ENTITE_NONINCARNE])) { return; } @@ -1041,7 +1040,6 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async updateExperienceLog(modeXP, valeurXP, raisonXP = 'Inconnue') { let d = new Date(); - console.log(modeXP, valeurXP, raisonXP); let expLog = duplicate(this.system.experiencelog); expLog.push({ mode: Misc.upperFirst(modeXP), valeur: valeurXP, raison: Misc.upperFirst(raisonXP), @@ -2170,7 +2168,7 @@ export class RdDActor extends Actor { createCallbackExperience() { return { condition: r => r.rolled.isPart && r.finalLevel < 0 && game.settings.get("core", "rollMode") != 'selfroll', - action: r => this.appliquerAjoutExperience(r, (game.settings.get("core", "rollMode") != 'blindroll' && !game.user.isGM)) + action: r => this.appliquerAjoutExperience(r) }; } @@ -2242,10 +2240,11 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async appliquerAjoutExperience(rollData, display) { + async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { if (!this.isPersonnage()) return; + hideChatMessage = hideChatMessage == 'hide' || (game.settings.get("core", "rollMode") != 'blindroll' && !game.user.isGM) let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence); - if (xpData && display) { + if (xpData && !hideChatMessage) { ChatMessage.create({ whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData) @@ -3036,7 +3035,7 @@ export class RdDActor extends Actor { let update = { _id: xpData.competence._id, 'system.xp': newXp }; await this.updateEmbeddedDocuments('Item', [update]); xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false); - this.updateExperienceLog("XP", xpData.xp, "XP gagné en " + xpData.competence.name); + this.updateExperienceLog("XP", xpData.xpCompetence, "XP gagné en " + xpData.competence.name); } } @@ -3068,7 +3067,7 @@ export class RdDActor extends Actor { // Gestion expérience (si existante) data.competence = this.getCompetence("astrologie") data.selectedCarac = this.system.carac["vue"]; - this.appliquerAjoutExperience(data, false); + this.appliquerAjoutExperience(data, 'hide'); // Ajout du nombre astral const item = { @@ -3891,19 +3890,21 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - addSubActeur(subActorId) { - let subActor = game.actors.get(subActorId); - //console.log("Ajout acteur : ", actor, this); - if (subActor && !subActor.owner) { - if (subActortype == 'vehicule') { + addSubActeur(subActor) { + if(subActor?.id == this.id){ + ui.notifications.warn("Vous ne pouvez pas attacher un acteur à lui même") + } + else if (!subActor?.isOwner) { + ui.notifications.warn("Vous n'avez pas les droits sur l'acteur que vous attachez.") + } + else { + if (subActor.type == 'vehicule') { this.pushSubacteur(subActor, this.system.subacteurs.vehicules, 'system.subacteurs.vehicules', 'Ce Véhicule'); } else if (subActor.type == 'creature') { this.pushSubacteur(subActor, this.system.subacteurs.montures, 'system.subacteurs.montures', 'Cette Monture'); } else if (subActor.type == 'personnage') { this.pushSubacteur(subActor, this.system.subacteurs.suivants, 'system.subacteurs.suivants', 'Ce Suivant'); } - } else { - ui.notifications.warn("Vous n'avez pas les droits sur l'acteur que vous attachez.") } } diff --git a/module/chat-utility.js b/module/chat-utility.js index e4a12af9..b8aa9ae1 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -141,7 +141,7 @@ export class ChatUtility { /* -------------------------------------------- */ static getUsers(filter) { - return Misc.getUsers().filter(filter).map(user => user.data._id); + return Misc.getUsers().filter(filter).map(user => user.id); } /* -------------------------------------------- */ diff --git a/module/dialog-fabriquer-potion.js b/module/dialog-fabriquer-potion.js index 9cdcd339..fe4d1744 100644 --- a/module/dialog-fabriquer-potion.js +++ b/module/dialog-fabriquer-potion.js @@ -9,7 +9,7 @@ export class DialogFabriquerPotion extends Dialog { let potionData = DialogFabriquerPotion.prepareData(actor, item); let conf = { - title: `Fabriquer une potion de ${potionData.data.categorie}`, + title: `Fabriquer une potion de ${potionData.system.categorie}`, content: await renderTemplate(dialogConfig.html, potionData), default: potionData.buttonName, }; @@ -25,8 +25,8 @@ export class DialogFabriquerPotion extends Dialog { /* -------------------------------------------- */ static prepareData(actor, item) { let potionData = duplicate(item) - potionData.nbBrinsSelect = RdDUtility.buildListOptions(1, potionData.data.quantite); - potionData.nbBrins = Math.min(potionData.data.quantite, DialogFabriquerPotion.getNombreBrinOptimal(potionData)); + potionData.nbBrinsSelect = RdDUtility.buildListOptions(1, potionData.system.quantite); + potionData.nbBrins = Math.min(potionData.system.quantite, DialogFabriquerPotion.getNombreBrinOptimal(potionData)); potionData.buttonName = "Fabriquer"; return potionData; } @@ -46,9 +46,9 @@ export class DialogFabriquerPotion extends Dialog { } static getNombreBrinOptimal(herbeData) { - switch (herbeData.data.categorie ?? '') { - case "Soin": return 12 - herbeData.data.niveau; - case "Repos": return 7 - herbeData.data.niveau; + switch (herbeData.system.categorie ?? '') { + case "Soin": return 12 - herbeData.system.niveau; + case "Repos": return 7 - herbeData.system.niveau; } return 1; } diff --git a/module/dialog-split-item.js b/module/dialog-split-item.js index f6e73ffd..abe557ae 100644 --- a/module/dialog-split-item.js +++ b/module/dialog-split-item.js @@ -6,7 +6,7 @@ export class DialogSplitItem extends Dialog { const itemData = item const splitData = { item: itemData, - choix: { quantite: 1, max: itemData.data.quantite - 1 } + choix: { quantite: 1, max: itemData.system.quantite - 1 } }; const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-split.html`, splitData); return new DialogSplitItem(item, splitData, html, callback) diff --git a/module/item-competence.js b/module/item-competence.js index de3945cf..6eaf8193 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -183,14 +183,14 @@ export class RdDItemCompetence extends Item { } /* -------------------------------------------- */ - static levelUp(itemData, stressTransforme) { - itemData.system.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.system.niveau); - const xpManquant = itemData.system.xpNext - itemData.system.xp; - itemData.system.isLevelUp = xpManquant <= 0; - itemData.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && itemData.system.niveau < itemData.system.niveau_archetype); - itemData.system.stressXpMax = 0; - if (xpManquant > 0 && stressTransforme > 0 && itemData.system.niveau < itemData.system.niveau_archetype) { - itemData.system.stressXpMax = Math.min(xpManquant , stressTransforme); + static levelUp(item, stressTransforme) { + item.system.xpNext = RdDItemCompetence.getCompetenceNextXp(item.system.niveau); + const xpManquant = item.system.xpNext - item.system.xp; + item.system.isLevelUp = xpManquant <= 0; + item.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype); + item.system.stressXpMax = 0; + if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) { + item.system.stressXpMax = Math.min(xpManquant , stressTransforme); } } diff --git a/module/item-monnaie.js b/module/item-monnaie.js index 2395eee0..2d970eec 100644 --- a/module/item-monnaie.js +++ b/module/item-monnaie.js @@ -4,22 +4,22 @@ const monnaiesData = [ { name: "Etain (1 denier)", type: 'monnaie', img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp", - data: { quantite: 0, valeur_deniers: 1, encombrement: 0.001, description: "" } + system: { quantite: 0, valeur_deniers: 1, encombrement: 0.001, description: "" } }, { name: "Bronze (10 deniers)", type: 'monnaie', img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_bronze_epees.webp", - data: { quantite: 0, valeur_deniers: 10, encombrement: 0.002, description: "" } + system: { quantite: 0, valeur_deniers: 10, encombrement: 0.002, description: "" } }, { name: "Argent (1 sol)", type: 'monnaie', img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_argent_sol.webp", - data: { quantite: 0, valeur_deniers: 100, encombrement: 0.003, description: "" } + system: { quantite: 0, valeur_deniers: 100, encombrement: 0.003, description: "" } }, { name: "Or (10 sols)", type: 'monnaie', img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_or_sol.webp", - data: { quantite: 0, valeur_deniers: 1000, encombrement: 0.004, description: "" } + system: { quantite: 0, valeur_deniers: 1000, encombrement: 0.004, description: "" } } ] diff --git a/module/item-sheet.js b/module/item-sheet.js index 667fd868..67379b7f 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -105,7 +105,7 @@ export class RdDItemSheet extends ItemSheet { } RdDHerbes.updatePotionData(formData); } - if (formData.isOwned && formData.type == 'herbe' && (formData.data.categorie == 'Soin' || formData.data.categorie == 'Repos')) { + if (formData.isOwned && formData.type == 'herbe' && (formData.system.categorie == 'Soin' || formData.system.categorie == 'Repos')) { formData.isIngredientPotionBase = true; } formData.bonusCaseList = RdDItemSort.getBonusCaseList(formData, true); diff --git a/module/item.js b/module/item.js index 81b543ae..ef9a14e8 100644 --- a/module/item.js +++ b/module/item.js @@ -117,7 +117,7 @@ export class RdDItem extends Item { if (this.isPotion()) { this.prepareDataPotion() } - this.actionPrincipale = this.getActionPrincipale({ warnIfNot: false }); + this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false }); } } @@ -192,22 +192,28 @@ export class RdDItem extends Item { /* -------------------------------------------- */ // détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité isEquipementSimilaire(other) { - const itemData = this - const otherData = other - const tplData = this - const otherTplData = other if (!this.isEquipement()) return false; - if (itemData.type != otherData.type) return false; - if (itemData.name != otherData.name) return false; - if (tplData.quantite == undefined) return false; - - const differences = Object.entries(tplData).filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key)) - .filter(([key, value]) => value != otherTplData[key]); - if (differences.length > 0) { - let message = `Impossible de regrouper les ${itemData.type} ${itemData.name}: `; - for (const [key, value] of differences) { - message += `
${key}: ${value} vs ${otherTplData[key]}`; + let message = undefined; + if (this.type != other.type) { + message = `Impossible de regrouper ${this.type} avec ${other.type}`; + } + else if (this.name != other.name) { + message = `Impossible de regrouper ${this.name} avec ${other.name}`; + } + else if (this.system.quantite == undefined) { + message = `Impossible de regrouper des ${this.type}, ils ne sont pas empilables`; + } + else { + const differences = Object.entries(this.system) + .filter(([key, value]) => !['quantite', 'encTotal', 'prixTotal', 'cout'].includes(key) && value != other.system[key]); + if (differences.length > 0) { + message = `Impossible de regrouper les ${this.type} ${this.name}: `; + for (const [key, value] of differences) { + message += `
${key}: ${value} vs ${other.system[key]}`; + } } + } + if (message){ ui.notifications.info(message) return false; } diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 9d1cbc38..81c38b3e 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -99,7 +99,7 @@ export class RdDCombatManager extends Combat { if (competence) { const carac = combatant.actor.system.carac[competence.system.defaut_carac].value; const niveau = competence.system.niveau; - const bonusEcaille = (armeCombat?.data.magique) ? armeCombat.system.ecaille_efficacite : 0; + const bonusEcaille = (armeCombat?.system.magique) ? armeCombat.system.ecaille_efficacite : 0; rollFormula = RdDCombatManager.formuleInitiative(2, carac, niveau, bonusEcaille); } } @@ -204,7 +204,7 @@ export class RdDCombatManager extends Combat { action: 'conjurer', data: { competence: p.name, - possessionid: p.data.data.possessionid, + possessionid: p.system.possessionid, } } })); @@ -228,9 +228,9 @@ export class RdDCombatManager extends Combat { .concat(RdDItemArme.mainsNues()); let competences = items.filter(it => it.type == 'competence'); - actions = actions.concat(RdDCombatManager.listActionsArmes(armes, competences, actor.data.data.carac)); + actions = actions.concat(RdDCombatManager.listActionsArmes(armes, competences, actor.system.carac)); - if (actor.data.data.attributs.hautrevant.value) { + if (actor.system.attributs.hautrevant.value) { actions.push({ name: "Draconic", action: 'haut-reve', data: { initOnly: true, competence: "Draconic" } }); } } @@ -256,7 +256,7 @@ export class RdDCombatManager extends Combat { //console.log("Parsed !!!", combatant, initDone, game.combat.current, arme); if (action && action.type == "arme") { for (let initData of premierRoundInit) { - if (Grammar.toLowerCaseNoAccentNoSpace(action.data.initpremierround).includes(initData.pattern)) { + if (Grammar.toLowerCaseNoAccentNoSpace(action.system.initpremierround).includes(initData.pattern)) { let msg = `

L'initiative de ${combatant.actor.name} a été modifiée !


@@ -329,10 +329,10 @@ export class RdDCombatManager extends Combat { } else { compData = RdDItemCompetence.findCompetence(combatant.actor.items, arme.system.competence); compNiveau = compData.system.niveau; - initInfo = action.name + " / " + action.data.competence; + initInfo = action.name + " / " + action.system.competence; if (combatant.actor.type == 'creature' || combatant.actor.type == 'entite') { - caracForInit = compData.data.carac_value; + caracForInit = compData.system.carac_value; if (compData.system.categorie == "lancer") { initOffset = 7; } @@ -361,7 +361,7 @@ export class RdDCombatManager extends Combat { return 7; } // Offset de principe pour les armes de jet - switch (arme.data.cac) { + switch (arme.system.cac) { case "empoignade": return 3; case "pugilat": return 4; } @@ -384,7 +384,7 @@ export class RdDCombatManager extends Combat { let menuItems = []; for (let action of actions) { menuItems.push({ - name: action.data.competence, + name: action.system.competence, icon: "", callback: target => { RdDCombatManager.rollInitiativeAction(combatantId, action) } }); diff --git a/module/rdd-hotbar-drop.js b/module/rdd-hotbar-drop.js index ea215554..9303d596 100644 --- a/module/rdd-hotbar-drop.js +++ b/module/rdd-hotbar-drop.js @@ -77,8 +77,10 @@ export class RdDHotbar { if (speaker.token) actor = game.actors.tokens[speaker.token]; if (!actor) actor = game.actors.get(speaker.actor); - let item = Misc.data(actor?.items.find(it => it.name === itemName && it.type == itemType)); - if (!item) return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`); + let item = actor?.items.find(it => it.name === itemName && it.type == itemType) ?? undefined; + if (!item){ + return ui.notifications.warn(`Impossible de trouver l'objet de cette macro`); + } // Trigger the item roll switch (item.type) { diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 02c98599..f9c860d7 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -165,7 +165,7 @@ export class RdDRoll extends Dialog { function onLoad() { let rollData = dialog.rollData; - console.log(rollData); + console.log('Ouverture RdDRoll', rollData); // Update html, according to data if (rollData.competence) { const defaut_carac = rollData.competence.system.defaut_carac @@ -294,7 +294,7 @@ export class RdDRoll extends Dialog { async setSelectedSigneDraconique(signe){ this.rollData.signe = signe; - this.rollData.diffLibre = Misc.data(signe).data.difficulte, + this.rollData.diffLibre = signe.system.difficulte, $(".signe-difficulte").text(Misc.toSignedString(this.rollData.diffLibre)); } diff --git a/module/rdd-sheet-utility.js b/module/rdd-sheet-utility.js index 13b2b166..a4730081 100644 --- a/module/rdd-sheet-utility.js +++ b/module/rdd-sheet-utility.js @@ -29,7 +29,7 @@ export class RdDSheetUtility { destId: destItemId, targetActorId: actorId, itemId: itemId, - sourceActorId: dragData.actorId, + sourceActorId: item.actor.id, srcId: objetVersConteneur[itemId], onEnleverConteneur: () => { delete objetVersConteneur[itemId]; }, onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index cdd1edab..0bade4f6 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -239,7 +239,7 @@ export class RdDUtility { Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); - Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.visible) + Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.system.isVisible) .sort((a, b) => { if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { if (a.name.includes("Cité")) return -1; @@ -831,7 +831,7 @@ export class RdDUtility { static confirmerSuppressionSubacteur(actorSheet, li) { let actorId = li.data("actor-id"); let actor = game.actors.get(actorId); - let msgTxt = "

Etes vous certain de vouloir supprimer le lien vers ce véhicule/monture/suivant : " + actor.data.name + " ?

"; + let msgTxt = "

Etes vous certain de vouloir supprimer le lien vers ce véhicule/monture/suivant : " + actor.name + " ?

"; let d = new Dialog({ title: "Confirmer la suppression du lien", content: msgTxt, @@ -881,8 +881,7 @@ export class RdDUtility { label: "Annuler" } } - const docData = objet - if (docData.type == 'conteneur' && docData.data.contenu.length > 0) { + if (objet.type == 'conteneur' && objet.system.contenu.length > 0) { msgTxt += "
Ce conteneur n'est pas vide. Choisissez l'option de suppression"; buttons['deleteall'] = { icon: '', diff --git a/module/tmr-rencontres.js b/module/tmr-rencontres.js index 8a375d75..17a31038 100644 --- a/module/tmr-rencontres.js +++ b/module/tmr-rencontres.js @@ -486,7 +486,7 @@ export class TMRRencontres { /* -------------------------------------------- */ static async onPostSuccessReveDeDragon(tmrDialog, tmrData) { if (tmrData.rolled.isPart) { - await tmrData.actor.appliquerAjoutExperience(tmrData, true); + await tmrData.actor.appliquerAjoutExperience(tmrData); } await tmrData.actor.resultCombatReveDeDragon(tmrData); } diff --git a/templates/actor-sheet-competence-partial.html b/templates/actor-sheet-competence-partial.html index 57487ab4..9a59bcde 100644 --- a/templates/actor-sheet-competence-partial.html +++ b/templates/actor-sheet-competence-partial.html @@ -1,4 +1,4 @@ -{{#if visible}} +{{#if system.isVisible}}
  • diff --git a/templates/actor-sheet-inventaire-item.html b/templates/actor-sheet-inventaire-item.html index 74d14643..b7c4629e 100644 --- a/templates/actor-sheet-inventaire-item.html +++ b/templates/actor-sheet-inventaire-item.html @@ -40,8 +40,8 @@ {{/if}} - {{#if item.system.actionPrincipale}} - {{item.system.actionPrincipale}} + {{#if item.actionPrincipale}} + {{item.actionPrincipale}} {{/if}}
  • diff --git a/templates/actor-sheet-inventaire-monnaie.html b/templates/actor-sheet-inventaire-monnaie.html index 52374164..dfccc8bd 100644 --- a/templates/actor-sheet-inventaire-monnaie.html +++ b/templates/actor-sheet-inventaire-monnaie.html @@ -16,7 +16,7 @@ diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 252a87b2..751df0a7 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -300,7 +300,7 @@ {{/each}} {{#each esquives as |esq key|}} -
  • +
  • diff --git a/templates/chat-resultat-recettecuisine.html b/templates/chat-resultat-recettecuisine.html index 42a71719..e2405b5a 100644 --- a/templates/chat-resultat-recettecuisine.html +++ b/templates/chat-resultat-recettecuisine.html @@ -6,7 +6,7 @@
    {{platCuisine.name}} -
    {{alias}} a préparé {{platCuisine.data.quantite}} portions de {{platCuisine.name}} +
    {{alias}} a préparé {{platCuisine.system.quantite}} portions de {{platCuisine.name}} {{~#if ajouterEquipement}}, qui ont été ajoutées à son équipement{{/if}}. {{#if rolled.isSuccess}} Il a réussi la recette, pour un plat de qualité {{qualiteFinale}} diff --git a/templates/chat-resultat-reve-de-dragon.html b/templates/chat-resultat-reve-de-dragon.html index 5f94d708..3a1300f5 100644 --- a/templates/chat-resultat-reve-de-dragon.html +++ b/templates/chat-resultat-reve-de-dragon.html @@ -15,7 +15,7 @@ {{alias}} ne parvient pas à vaincre le Rêve de Dragon, et prend un violent coup de queue. Il subit {{#if rolled.isETotal}}deux queues{{else}}une queue{{/if}} de dragon! {{#each queues as | queue key|}} -
    {{queue.name}}: {{{queue.data.description}}} +
    {{queue.name}}: {{{queue.system.description}}} {{/each}} {{/if}}
    diff --git a/templates/chat-resultat-sort.html b/templates/chat-resultat-sort.html index 0b1e2d1b..1beca975 100644 --- a/templates/chat-resultat-sort.html +++ b/templates/chat-resultat-sort.html @@ -1,10 +1,10 @@ {{competence.name}}

    {{alias}} {{#if isSortReserve}}met en réserve{{else}}lance{{/if}} - le {{#if selectedSort.data.isrituel}}rituel{{else}}sort{{/if}} + le {{#if selectedSort.system.isrituel}}rituel{{else}}sort{{/if}} {{selectedSort.name}}

    -
    Pour {{selectedSort.data.ptreve_reel}} point{{~#if (gt selectedSort.data.ptreve_reel 1)}}s{{/if}} de rêve en {{tmr.label}} ({{tmr.coord}}). +
    Pour {{selectedSort.system.ptreve_reel}} point{{~#if (gt selectedSort.system.ptreve_reel 1)}}s{{/if}} de rêve en {{tmr.label}} ({{tmr.coord}}). {{#if show.reveInsuffisant}} Pas assez de rêve! {{/if}} diff --git a/templates/chat-signe-draconique-actor.html b/templates/chat-signe-draconique-actor.html index aaeee2b6..16806afa 100644 --- a/templates/chat-signe-draconique-actor.html +++ b/templates/chat-signe-draconique-actor.html @@ -3,5 +3,5 @@

    Pour le lire ce signe draconique, {{alias}} doit se rendre dans les Terres Médianes du Rêve et trouvez une case de résonnance. - {{#if signe.data.ephemere}}C'est un signe éphémère, qui ne restera présent que pour {{signe.data.duree}}{{/if}} + {{#if signe.system.ephemere}}C'est un signe éphémère, qui ne restera présent que pour {{signe.system.duree}}{{/if}}

    diff --git a/templates/dialog-create-signedraconique.html b/templates/dialog-create-signedraconique.html index 23ba5a97..c136702a 100644 --- a/templates/dialog-create-signedraconique.html +++ b/templates/dialog-create-signedraconique.html @@ -26,9 +26,9 @@
    - + - +
    diff --git a/templates/dialog-item-consommer.html b/templates/dialog-item-consommer.html index 2f1fa490..93744bac 100644 --- a/templates/dialog-item-consommer.html +++ b/templates/dialog-item-consommer.html @@ -4,7 +4,7 @@
    + min="0" max="{{item.system.quantite}}" data-dtype="Number" />
    {{#if item.system.sust}}

    Cette {{#if item.system.boisson}}boisson{{else}}nourriture{{/if}} vous apportera

    {{#each actions as |action key|}} - {{#unless action.data.initOnly}} + {{#unless action.system.initOnly}}
    - +
    {{/unless}} {{/each}} diff --git a/templates/hud-actor-init.html b/templates/hud-actor-init.html index fc743149..9f862f3a 100644 --- a/templates/hud-actor-init.html +++ b/templates/hud-actor-init.html @@ -6,7 +6,7 @@ data-combatant-id="{{../combatant.id}}" data-action-index="{{action.index}}" title="{{action.name}}"> - +
    {{/each}} {{#each commandes as |commande key|}} diff --git a/templates/partial-description-sort.html b/templates/partial-description-sort.html index 841eeb6b..efb6d1ef 100644 --- a/templates/partial-description-sort.html +++ b/templates/partial-description-sort.html @@ -1,7 +1,7 @@
    {{#if sort.system.cible}}{{/if}} {{#if sort.system.JR}}{{/if}} - {{#if sort.system.portee}}{{/if}} + {{#if sort.system.portee}}{{/if}} {{#if sort.system.duree}}{{/if}} {{#if sort.system.coutseuil}}{{/if}}