From 509b7f97dc6b64458617b291aa5ed907a35a1f17 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Wed, 7 Sep 2022 18:47:56 +0200 Subject: [PATCH] Utilisation de system dans les Item/Actor Sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Utilisation de system dans les data de formulaire pour tous les Item/Actor (à la base, ou les sous-éléments) Corrections sur les sorts en réserve (ce ne sont pas des Item) Petites améliorations: * `actor.itemTypes[type]` revient à faire (sans besoin de filtrer) `actor.items.filter(it => it.type == type)` * dans les ItemSheet, this.object et this.document remplacés par this.item * dans les ActorSheet, this.object et this.document remplacés par this.actor Quelques corrections en plus: * parade ne marchait pas * problèmes sur le commerce --- module/actor-creature-sheet.js | 4 +- module/actor-entite-sheet.js | 22 +- module/actor-sheet.js | 49 ++-- module/actor-vehicule-sheet.js | 21 +- module/actor.js | 219 +++++++++--------- module/chat-utility.js | 60 ++--- module/dialog-create-signedraconique.js | 2 +- module/dialog-item-consommer.js | 22 +- module/dialog-item-vente.js | 11 +- module/dialog-split-item.js | 5 +- module/hook-renderChatLog.js | 9 - module/item-arme.js | 31 ++- module/item-competence.js | 12 +- module/item-competencecreature.js | 10 +- module/item-monnaie.js | 19 +- module/item-sheet.js | 64 ++--- module/item-signedraconique-sheet.js | 14 +- module/item-signedraconique.js | 5 +- module/item-sort.js | 44 ++-- module/item.js | 16 +- module/rdd-alchimie.js | 4 +- module/rdd-astrologie-joueur.js | 16 +- module/rdd-calendrier.js | 14 +- module/rdd-carac.js | 38 +-- module/rdd-combat.js | 27 ++- module/rdd-commands.js | 2 +- module/rdd-compendium-organiser.js | 6 +- module/rdd-gemme.js | 13 +- module/rdd-herbes.js | 40 ++-- module/rdd-possession.js | 2 +- module/rdd-roll.js | 2 +- module/rdd-sheet-utility.js | 15 +- module/rdd-tmr-dialog.js | 4 +- module/rdd-token-hud.js | 6 +- module/rdd-utility.js | 24 +- module/tmr-rencontres.js | 8 +- module/tmr/draconique.js | 13 +- module/tmr/effets-draconiques.js | 2 +- module/tmr/pixi-tmr.js | 2 +- module/tmr/sort-reserve.js | 2 +- templates/actor-creature-sheet.html | 18 +- templates/actor-entite-sheet.html | 20 +- templates/actor-liste-blessures-partial.html | 6 +- templates/actor-sheet-inventaire.html | 2 +- templates/actor-sheet.html | 104 ++++----- templates/actor-vehicule-sheet.html | 18 +- templates/chat-achat-item.html | 2 +- .../chat-consommer-potion-generique.html | 8 +- templates/chat-consommer-potion-repos.html | 10 +- templates/chat-consommer-potion-soin.html | 8 +- templates/dialog-fabriquer-potion-base.html | 2 +- templates/dialog-roll-jeu.html | 2 +- templates/dialog-roll-musique.html | 2 +- templates/dialog-roll-recettecuisine.html | 2 +- templates/item-arme-sheet.html | 78 +++---- templates/item-armure-sheet.html | 10 +- templates/item-casetmr-sheet.html | 6 +- templates/item-chant-sheet.html | 4 +- templates/item-competence-sheet.html | 20 +- templates/item-competencecreature-sheet.html | 16 +- templates/item-conteneur-sheet.html | 8 +- templates/item-danse-sheet.html | 10 +- templates/item-gemme-sheet.html | 18 +- templates/item-herbe-sheet.html | 12 +- templates/item-ingredient-sheet.html | 14 +- templates/item-jeu-sheet.html | 8 +- templates/item-livre-sheet.html | 20 +- templates/item-maladie-sheet.html | 18 +- templates/item-meditation-sheet.html | 20 +- templates/item-monnaie-sheet.html | 8 +- templates/item-munition-sheet.html | 8 +- templates/item-musique-sheet.html | 4 +- templates/item-nombreastral-sheet.html | 8 +- templates/item-nourritureboisson-sheet.html | 42 ++-- templates/item-objet-sheet.html | 10 +- templates/item-oeuvre-sheet.html | 8 +- templates/item-ombre-sheet.html | 2 +- templates/item-poison-sheet.html | 20 +- templates/item-possession-sheet.html | 6 +- templates/item-potion-sheet.html | 30 +-- templates/item-queue-sheet.html | 2 +- templates/item-recettealchimique-sheet.html | 10 +- templates/item-recettecuisine-sheet.html | 12 +- templates/item-sheet.html | 8 +- templates/item-signedraconique-sheet.html | 22 +- templates/item-sort-sheet.html | 24 +- templates/item-tache-sheet.html | 22 +- templates/item-tarot-sheet.html | 4 +- templates/partial-item-description.html | 4 +- templates/post-item.html | 2 +- 90 files changed, 786 insertions(+), 815 deletions(-) delete mode 100644 module/hook-renderChatLog.js diff --git a/module/actor-creature-sheet.js b/module/actor-creature-sheet.js index dac64737..15870dd1 100644 --- a/module/actor-creature-sheet.js +++ b/module/actor-creature-sheet.js @@ -30,8 +30,8 @@ export class RdDActorCreatureSheet extends RdDActorSheet { let formData = await super.getData() //console.log("Creature : ", formData, formData.system) formData.calc = { - caracTotal: RdDCarac.computeTotal(formData.data.carac), - resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), + caracTotal: RdDCarac.computeTotal(formData.system.carac), + resumeBlessures: this.actor.computeResumeBlessure(formData.system.blessures), encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), surEncombrementMessage: this.actor.getMessageSurEncombrement() } diff --git a/module/actor-entite-sheet.js b/module/actor-entite-sheet.js index 2be3699e..bae8617c 100644 --- a/module/actor-entite-sheet.js +++ b/module/actor-entite-sheet.js @@ -25,23 +25,21 @@ export class RdDActorEntiteSheet extends ActorSheet { /* -------------------------------------------- */ async getData() { - const objectData = this.object; let formData = { title: this.title, - id: objectData.id, - type: objectData.type, - img: objectData.img, - name: objectData.name, - // actor: this.object, + id: this.actor.id, + type: this.actor.type, + img: this.actor.img, + name: this.actor.name, editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", - data: foundry.utils.deepClone(this.actor.system), - effects: this.object.effects.map(e => foundry.utils.deepClone(e)), + system: foundry.utils.deepClone(this.actor.system), + effects: this.actor.effects.map(e => foundry.utils.deepClone(e)), // items: items, - limited: this.object.limited, + limited: this.actor.limited, options: this.options, - owner: this.document.isOwner, - itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))), + owner: this.actor.isOwner, + itemsByType: Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i))), }; formData.options.isGM = game.user.isGM; @@ -141,6 +139,6 @@ export class RdDActorEntiteSheet extends ActorSheet { /** @override */ _updateObject(event, formData) { // Update the Actor - return this.object.update(formData); + return this.actor.update(formData); } } diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 01d6553e..19526161 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -36,23 +36,22 @@ export class RdDActorSheet extends ActorSheet { /* -------------------------------------------- */ async getData() { - const objectData = this.object.system this.timerRecherche = undefined; let formData = { title: this.title, - id: this.object.id, - type: this.object.type, - img: this.object.img, - name: this.object.name, + id: this.actor.id, + type: this.actor.type, + img: this.actor.img, + name: this.actor.name, editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", - data: foundry.utils.deepClone(this.actor.system), - effects: this.object.effects.map(e => foundry.utils.deepClone(e)), - limited: this.object.limited, + system: foundry.utils.deepClone(this.actor.system), + effects: this.actor.effects.map(e => foundry.utils.deepClone(e)), + limited: this.actor.limited, options: this.options, - owner: this.document.isOwner, - itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))), + owner: this.actor.isOwner, + itemsByType: Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i))), } RdDUtility.filterItemsPerTypeForSheet(formData) @@ -65,13 +64,13 @@ export class RdDActorSheet extends ActorSheet { formData.calc = { comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences), competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences), - caracTotal: RdDCarac.computeTotal(formData.data.carac, formData.data.beaute), + caracTotal: RdDCarac.computeTotal(formData.system.carac, formData.system.beaute), // Mise à jour de l'encombrement total et du prix de l'équipement encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), prixTotalEquipement: this.actor.computePrixTotalEquipement(), surprise: RdDBonus.find(this.actor.getSurprise(false)).descr, - fatigue: RdDUtility.calculFatigueHtml(formData.data.sante.fatigue.value, formData.data.sante.endurance.max), - resumeBlessures: this.actor.computeResumeBlessure(formData.data.blessures), + fatigue: RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max), + resumeBlessures: this.actor.computeResumeBlessure(formData.system.blessures), surEncombrementMessage: this.actor.getMessageSurEncombrement() }; @@ -79,9 +78,9 @@ export class RdDActorSheet extends ActorSheet { 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); + RdDItemCompetence.levelUp(item, formData.system.compteurs.experience.value); }); - Object.values(formData.data.carac).forEach(c => { + Object.values(formData.system.carac).forEach(c => { RdDCarac.levelUp(c); }); @@ -89,9 +88,9 @@ export class RdDActorSheet extends ActorSheet { // toujours avoir une liste d'armes (pour mettre esquive et corps à corps) formData.combat = duplicate(formData.armes ?? []); RdDItemArme.computeNiveauArmes(formData.combat, formData.competences); - RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac); + RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.system.carac); formData.esquives = this.actor.getCompetences("Esquive"); - formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.data.carac); + formData.combat = RdDCombatManager.listActionsArmes(formData.combat, formData.competences, formData.system.carac); this.armesList = formData.combat; @@ -101,8 +100,8 @@ export class RdDActorSheet extends ActorSheet { formData.hautreve = { isDemiReve: this.actor.getEffectByLabel("Demi-rêve"), - sortsReserve: formData.data.reve.reserve.list, - rencontres: duplicate(formData.data.reve.rencontre.list), + sortsReserve: formData.system.reve.reserve.list, + rencontres: duplicate(formData.system.reve.rencontre.list), casesTmr: formData.itemsByType.casetmr, cacheTMR: this.actor.isTMRCache() } @@ -330,7 +329,7 @@ export class RdDActorSheet extends ActorSheet { }); // Initiative pour l'arme html.find('.arme-initiative a').click(async event => { - let combatant = game.combat.combatants.find(c => c.actor._id == this.actor._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); @@ -451,7 +450,7 @@ export class RdDActorSheet extends ActorSheet { // On pts de reve change html.find('.pointsreve-value').change(async event => { let reveValue = event.currentTarget.value; - this.actor.update({ "data.reve.reve.value": reveValue }); + this.actor.update({ "system.reve.reve.value": reveValue }); }); // On seuil de reve change @@ -568,7 +567,7 @@ export class RdDActorSheet extends ActorSheet { /** @override */ _updateObject(event, formData) { // Update the Actor - return this.object.update(formData); + return this.actor.update(formData); } async splitItem(item) { @@ -579,9 +578,9 @@ export class RdDActorSheet extends ActorSheet { async _onSplitItem(item, split) { if (split >= 1 && split < item.system.quantite) { await item.diminuerQuantite(split); - const itemData = duplicate(item); - itemData.system.quantite = split; - await this.actor.createEmbeddedDocuments('Item', [itemData]) + const splitItem = duplicate(item); + splitItem.system.quantite = split; + await this.actor.createEmbeddedDocuments('Item', [splitItem]) } } diff --git a/module/actor-vehicule-sheet.js b/module/actor-vehicule-sheet.js index 23962f92..56ab0aee 100644 --- a/module/actor-vehicule-sheet.js +++ b/module/actor-vehicule-sheet.js @@ -27,21 +27,20 @@ export class RdDActorVehiculeSheet extends ActorSheet { /* -------------------------------------------- */ async getData() { - const objectData = this.object let formData = { title: this.title, - id: objectData.id, - type: objectData.type, - img: objectData.img, - name: objectData.name, + id: this.actor.id, + type: this.actor.type, + img: this.actor.img, + name: this.actor.name, editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", - data: foundry.utils.deepClone(this.object.system), - effects: this.object.effects.map(e => foundry.utils.deepClone(e)), - limited: this.object.limited, + system: foundry.utils.deepClone(this.actor.system), + effects: this.actor.effects.map(e => foundry.utils.deepClone(e)), + limited: this.actor.limited, options: this.options, - owner: this.document.isOwner, - itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))), + owner: this.actor.isOwner, + itemsByType: Misc.classify(this.actor.items.map(i => foundry.utils.deepClone(i))), }; RdDUtility.filterItemsPerTypeForSheet(formData); @@ -160,6 +159,6 @@ export class RdDActorVehiculeSheet extends ActorSheet { /** @override */ _updateObject(event, formData) { // Update the Actor - return this.object.update(formData); + return this.actor.update(formData); } } diff --git a/module/actor.js b/module/actor.js index 0dbf9e50..1d0babd9 100644 --- a/module/actor.js +++ b/module/actor.js @@ -35,6 +35,14 @@ import { RdDItem } from "./item.js"; import { RdDPossession } from "./rdd-possession.js"; import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; +const POSSESSION_SANS_DRACONIC = { + img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', + name: 'Sans draconic', + system: { + niveau: 0, + defaut_carac: "reve", + } +}; /* -------------------------------------------- */ /** @@ -63,23 +71,23 @@ export class RdDActor extends Actor { } } - static remoteActorCall(data, canExecuteLocally = () => Misc.isUniqueConnectedGM()) { + static remoteActorCall(callData, canExecuteLocally = () => Misc.isUniqueConnectedGM()) { if (canExecuteLocally()) { - RdDActor.onRemoteActorCall(data); + RdDActor.onRemoteActorCall(callData); return false; } else { - game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_remote_actor_call", data: data }); + game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_remote_actor_call", data: callData }); return true; } } - static onRemoteActorCall(data) { - const actor = game.actors.get(data?.actorId); + static onRemoteActorCall(callData) { + const actor = game.actors.get(callData?.actorId); if (Misc.isOwnerPlayerOrUniqueConnectedGM(actor)) { // Seul le joueur choisi effectue l'appel: le joueur courant si propriétaire de l'actor, ou le MJ sinon - const args = data.args; - console.info(`RdDActor.onRemoteActorCall: pour l'Actor ${data.actorId}, appel de RdDActor.${data.method}(`, ...args, ')'); - actor[data.method](...args); + const args = callData.args; + console.info(`RdDActor.onRemoteActorCall: pour l'Actor ${callData.actorId}, appel de RdDActor.${callData.method}(`, ...args, ')'); + actor[callData.method](...args); } } @@ -95,8 +103,8 @@ export class RdDActor extends Actor { * This overrided create() function adds initial items * Namely: Basic skills, money, * - * @param {Object} actorData Barebones actor data which this function adds onto. - * @param {Object} options (Unused) Additional options which customize the creation workflow. + * @param {Object} actorData Barebones actor template data which this function adds onto. + * @param {Object} options Additional options which customize the creation workflow. * */ static async create(actorData, options) { @@ -110,7 +118,7 @@ export class RdDActor extends Actor { if (actorData.items) { let actor = await super.create(actorData, options); if (isPersonnage) { - await actor.checkMonnaiePresence(actorData.items); + await actor.checkMonnaiePresence(); } return actor; } @@ -175,7 +183,7 @@ export class RdDActor extends Actor { this.computePrixTotalEquipement(); this.computeEtatGeneral(); // Sanity check - await this.checkMonnaiePresence(actorData.items); + await this.checkMonnaiePresence(); } /* -------------------------------------------- */ @@ -189,9 +197,9 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async checkMonnaiePresence(items) { // Ajout opportuniste si les pièces n'existent pas. - if (!items) return; // Sanity check during import - let manquantes = Monnaie.monnaiesManquantes(items); + async checkMonnaiePresence() { // Ajout opportuniste si les pièces n'existent pas. + if (!this.items) return; // Sanity check during import + let manquantes = Monnaie.monnaiesManquantes(this.itemTypes['monnaie']); //console.log("Manque : ", manquantes); if (manquantes.length > 0) { await this.createEmbeddedDocuments('Item', manquantes, { renderSheet: false }); @@ -313,13 +321,11 @@ export class RdDActor extends Actor { } listItemsData(type) { - return this.filterItemsData(it => it.type == type); - } - filterItemsData(filter) { - return this.items.map(it => it).filter(filter) + return this.itemTypes[type]; } + filterItems(filter) { - return this.items.filter(it => filter(it)) + return this.items.filter(filter); } getItemOfType(idOrName, type) { @@ -358,32 +364,26 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ getDraconicList() { return this.items.filter(it => it.type == 'competence' && it.system.categorie == 'draconic') - .sort(Misc.descending(it => it.system.niveau)) } /* -------------------------------------------- */ getBestDraconic() { const list = this.getDraconicList() + .sort(Misc.descending(it => it.system.niveau)) return duplicate(list[0]) } + getDraconicOuPossession() { const possessions = this.items.filter(it => it.type == 'competencecreature' && it.system.ispossession) .sort(Misc.descending(it => it.system.niveau)); if (possessions.length > 0) { return duplicate(possessions[0]); } - const draconics = this.getDraconicList().filter(it => it.system.niveau >= 0); - if (draconics.length > 0) { - return duplicate(draconics[0]); - } - return { - img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', - name: 'Sans draconic', - data: { - niveau: 0, - defaut_carac: "reve", - } - }; + const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0), + POSSESSION_SANS_DRACONIC] + .sort(Misc.descending(it => it.system.niveau)); + return duplicate(draconics[0]); } + getPossession(possessionId) { return this.items.find(it => it.type == 'possession' && it.system.possessionid == possessionId); } @@ -397,7 +397,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async verifierPotionsEnchantees() { - let potionsEnchantees = this.filterItemsData(it => it.type == 'potion' && it.system.categorie.toLowerCase().includes('enchant')); + let potionsEnchantees = this.filterItems(it => it.type == 'potion' && it.system.categorie.toLowerCase().includes('enchant')); for (let potion of potionsEnchantees) { if (!potion.system.prpermanent) { console.log(potion); @@ -882,8 +882,6 @@ export class RdDActor extends Actor { if (caracName == 'Taille') { return; } - // if ( isNaN(caracXP) || typeof(caracXP) != 'number') caracXP = 0; - //await this.update({ [`data.carac.${caracName}.xp`]: caracXP }); this.checkCaracXP(caracName); } @@ -1181,7 +1179,7 @@ export class RdDActor extends Actor { item.estContenu = undefined; } if (item.type == 'conteneur' && item.system.contenu.length > 0) { - corrections.push({ _id: itemData._id, 'system.contenu': [] }); + corrections.push({ _id: item.id, 'system.contenu': [] }); } } if (corrections.length > 0) { @@ -1352,7 +1350,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async computeMalusArmure() { - const newMalusArmure = this.filterItemsData(it => it.type == 'armure' && it.system.equipe) + const newMalusArmure = this.filterItems(it => it.type == 'armure' && it.system.equipe) .map(it => it.system.malus ?? 0) .reduce(Misc.sum(), 0); // Mise à jour éventuelle du malus armure @@ -1364,7 +1362,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ computePrixTotalEquipement() { - this.prixTotalEquipement = this.filterItemsData(it => it.system.prixTotal) + this.prixTotalEquipement = this.filterItems(it => it.system.prixTotal) .map(it => it.system.prixTotal ?? 0) .reduce(Misc.sum(), 0); // Mise à jour valeur totale de l'équipement @@ -1374,6 +1372,9 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ computeResumeBlessure(blessures = undefined) { blessures = blessures ?? this.system.blessures; + if (!blessures) { + return "Pas de blessures possibles"; + } let nbLegeres = this.countBlessures(blessures.legeres.liste); let nbGraves = this.countBlessures(blessures.graves.liste); let nbCritiques = this.countBlessures(blessures.critiques.liste); @@ -1393,11 +1394,11 @@ export class RdDActor extends Actor { resume += ","; resume += " une CRITIQUE !"; } + return resume; } else { - resume = "Aucune blessure"; + return "Aucune blessure"; } - return resume; } /* -------------------------------------------- */ @@ -1515,7 +1516,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ buildTMRInnaccessible() { - const tmrInnaccessibles = this.filterItemsData(it => Draconique.isCaseTMR(it) && + const tmrInnaccessibles = this.filterItems(it => Draconique.isCaseTMR(it) && EffetsDraconiques.isInnaccessible(it)); return tmrInnaccessibles.map(it => it.system.coord); } @@ -1648,8 +1649,11 @@ export class RdDActor extends Actor { } countBlessuresNonSoigneeByName(name) { - let blessures = this.system.blessures[name].liste; - return blessures.filter(b => b.active && !b.psdone).length; + if (this.system.blessures) { + let blessures = this.system.blessures[name].liste; + return blessures.filter(b => b.active && !b.psdone).length; + } + return 0; } /* -------------------------------------------- */ @@ -1766,7 +1770,6 @@ export class RdDActor extends Actor { } } compteur.value = result.newValue; - //console.log(name, inc, data.value, result.newValue, minValue, data.max); // If endurance lost, then the same amount of fatigue cannot be recovered if (ReglesOptionelles.isUsing("appliquer-fatigue") && sante.fatigue && fatigue > 0) { sante.fatigue.value = Math.max(sante.fatigue.value + fatigue, this._computeFatigueMin()); @@ -1948,15 +1951,16 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async consommerNourritureboisson(item, choix = { doses: 1, seForcer: false, supprimerSiZero: false }) { - if (itemData.type != 'nourritureboisson') { + + if (item.type != 'nourritureboisson') { return; } - if (choix.doses > itemData.system.quantite) { - ui.notifications.warn(`Il n'y a pas assez de ${itemData.name} pour manger ${choix.doses}`) + if (choix.doses > item.system.quantite) { + ui.notifications.warn(`Il n'y a pas assez de ${item.name} pour manger ${choix.doses}`) return; } - if (!this._apprecierCuisine(itemData, choix.seForcer)) { - ui.notifications.info(`${this.name} ne n'arrive pas à manger de ${itemData.name}`) + if (!this._apprecierCuisine(item, choix.seForcer)) { + ui.notifications.info(`${this.name} ne n'arrive pas à manger de ${item.name}`) return; } await this.manger(item, choix.doses, { diminuerQuantite: false }); @@ -1964,10 +1968,10 @@ export class RdDActor extends Actor { await item.diminuerQuantite(choix.doses, choix); } - async _apprecierCuisine(itemData, seForcer) { - const surmonteExotisme = await this._surmonterExotisme(itemData, seForcer); + async _apprecierCuisine(item, seForcer) { + const surmonteExotisme = await this._surmonterExotisme(item, seForcer); if (surmonteExotisme) { - await this.apprecier('gout', 'cuisine', itemData.system.qualite, itemData.system.boisson ? "apprécie la boisson" : "apprécie le plat"); + await this.apprecier('gout', 'cuisine', item.system.qualite, item.system.boisson ? "apprécie la boisson" : "apprécie le plat"); } else if (seForcer) { await this.jetDeMoral('malheureux'); @@ -1979,10 +1983,10 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async _surmonterExotisme(itemData) { - const exotisme = Math.min(itemData.system.exotisme, itemData.system.qualite, 0); + async _surmonterExotisme(item) { + const exotisme = Math.min(item.system.exotisme, item.system.qualite, 0); if (exotisme < 0) { - const rolled = await this.rollCaracCompetence('volonte', 'cuisine', exotisme, { title: `tente de surmonter l'exotisme de ${itemData.name}` }); + const rolled = await this.rollCaracCompetence('volonte', 'cuisine', exotisme, { title: `tente de surmonter l'exotisme de ${item.name}` }); return rolled.isSuccess; } return true; @@ -2007,14 +2011,13 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async boire(item, doses, options = { diminuerQuantite: true }) { - const itemData = item; - const desaltere = itemData.system.desaltere; + const desaltere = item.system.desaltere; if (desaltere > 0) { await this.updateCompteurValue('eau', Misc.keepDecimals(this.system.compteurs.eau.value + desaltere * doses, 1)); } if (item.isAlcool()) { for (let i = 0; i < doses; i++) { - await this.saouler(itemData.system.force, item); + await this.saouler(item.system.force, item); } } await item.diminuerQuantite(doses, options); @@ -2268,7 +2271,6 @@ export class RdDActor extends Actor { let tmr = TMRUtility.getTMR(coord); let letfilteredList = [] for (let sort of sortList) { - //console.log(sort.name, sort.data.caseTMR.toLowerCase(), sort.data.caseTMRspeciale.toLowerCase(), coord.toLowerCase() ); if (sort.system.caseTMR.toLowerCase().includes('variable')) { letfilteredList.push(sort); } else if (sort.system.caseTMRspeciale.toLowerCase().includes('variable')) { @@ -2575,8 +2577,7 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async creerTacheDepuisLivre(item, options = { renderSheet: true }) { - const itemData = item - const nomTache = "Lire " + itemData.name; + const nomTache = "Lire " + item.name; const filterTacheLecture = it => it.type == 'tache' && it.name == nomTache; let tachesExistantes = this.filterItems(filterTacheLecture); if (tachesExistantes.length == 0) { @@ -2585,12 +2586,12 @@ export class RdDActor extends Actor { system: { carac: 'intellect', competence: 'Ecriture', - difficulte: itemData.system.difficulte, + difficulte: item.system.difficulte, periodicite: "60 minutes", fatigue: 2, - points_de_tache: itemData.system.points_de_tache, + points_de_tache: item.system.points_de_tache, points_de_tache_courant: 0, - description: "Lecture du livre " + item.name + " - XP : " + itemData.system.xp + " - Compétences : " + itemData.system.competence + description: "Lecture du livre " + item.name + " - XP : " + item.system.xp + " - Compétences : " + item.system.competence } } await this.createEmbeddedDocuments('Item', [tache], options); @@ -2870,8 +2871,11 @@ export class RdDActor extends Actor { if (this.currentTMR) this.currentTMR.minimize(); // Hide let draconicList = this.getDraconicList() - .map(draconic => duplicate(draconic)) - .map(draconic => { draconic.system.defaut_carac = "intellect"; return draconic; }); + .map(draconic => { + let draconicLecture = duplicate(draconic); + draconicLecture.system.defaut_carac = "intellect"; + return draconicLecture; + }); const intellect = this.system.carac.intellect; let rollData = { @@ -2989,7 +2993,7 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ checkDesirLancinant() { - let queue = this.filterItemsData(it => it.type == 'queue' || it.type == 'ombre') + let queue = this.filterItems(it => it.type == 'queue' || it.type == 'ombre') .filter(it => Grammar.toLowerCaseNoAccent(it.name).includes('desir lancinant')); return (queue.length > 0); } @@ -3056,23 +3060,23 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - async resetNombreAstral(data) { + async resetNombreAstral() { let toDelete = this.listItemsData('nombreastral'); const deletions = toDelete.map(it => it._id); await this.deleteEmbeddedDocuments("Item", deletions); } /* -------------------------------------------- */ - async ajouteNombreAstral(data) { + async ajouteNombreAstral(callData) { // Gestion expérience (si existante) - data.competence = this.getCompetence("astrologie") - data.selectedCarac = this.system.carac["vue"]; - this.appliquerAjoutExperience(data, 'hide'); + callData.competence = this.getCompetence("astrologie") + callData.selectedCarac = this.system.carac["vue"]; + this.appliquerAjoutExperience(callData, 'hide'); // Ajout du nombre astral const item = { - name: "Nombre Astral", type: "nombreastral", data: - { value: data.nbAstral, istrue: data.isvalid, jourindex: Number(data.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(data.date)) } + name: "Nombre Astral", type: "nombreastral", system: + { value: callData.nbAstral, istrue: callData.isvalid, jourindex: Number(callData.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(callData.date)) } }; await this.createEmbeddedDocuments("Item", [item]); @@ -3218,15 +3222,15 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ getArmeParade(armeParadeId) { const item = armeParadeId ? this.getEmbeddedDocument('Item', armeParadeId) : undefined; - return RdDItemArme.getArmeData(item); + return RdDItemArme.getArme(item); } /* -------------------------------------------- */ - verifierForceMin(itemData) { - if (itemData.type == 'arme' && itemData.system.force > this.system.carac.force.value) { + verifierForceMin(item) { + if (item.type == 'arme' && item.system.force > this.system.carac.force.value) { ChatMessage.create({ - content: `${this.name} s'est équipé(e) de l'arme ${itemData.name}, mais n'a pas une force suffisante pour l'utiliser normalement - (${itemData.system.force} nécessaire pour une Force de ${this.system.carac.force.value})` + content: `${this.name} s'est équipé(e) de l'arme ${item.name}, mais n'a pas une force suffisante pour l'utiliser normalement + (${item.system.force} nécessaire pour une Force de ${this.system.carac.force.value})` }); } } @@ -3251,10 +3255,10 @@ export class RdDActor extends Actor { let armeData = attackerRoll.arme; let protection = 0; const armures = this.items.filter(it => it.type == "armure" && it.system.equipe); - for (const itemData of armures) { - protection += await RdDDice.rollTotal(itemData.system.protection.toString()); + for (const armure of armures) { + protection += await RdDDice.rollTotal(armure.system.protection.toString()); if (dmg > 0) { - this._deteriorerArmure(itemData, dmg); + this._deteriorerArmure(armure, dmg); dmg = 0; } } @@ -3273,39 +3277,39 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - _deteriorerArmure(item, dmg) { - let itemData = duplicate(item); - if (!ReglesOptionelles.isUsing('deteriorationArmure') || itemData.system.protection == '0') { + _deteriorerArmure(armure, dmg) { + armure = duplicate(armure); + if (!ReglesOptionelles.isUsing('deteriorationArmure') || armure.system.protection == '0') { return; } - itemData.system.deterioration = (itemData.system.deterioration ?? 0) + dmg; - if (itemData.system.deterioration >= 10) { - itemData.system.deterioration -= 10; - let res = /(\d+)?d(\d+)(\-\d+)?/.exec(itemData.system.protection); + armure.system.deterioration = (armure.system.deterioration ?? 0) + dmg; + if (armure.system.deterioration >= 10) { + armure.system.deterioration -= 10; + let res = /(\d+)?d(\d+)(\-\d+)?/.exec(armure.system.protection); if (res) { let malus = Misc.toInt(res[3]) - 1; let armure = Misc.toInt(res[2]); if (armure + malus <= 0) { - itemData.system.protection = 0; + armure.system.protection = 0; } else { - itemData.system.protection = '' + (res[1] ?? '1') + 'd' + armure + malus; + armure.system.protection = '' + (res[1] ?? '1') + 'd' + armure + malus; } } - else if (/\d+/.exec(itemData.system.protection)) { - itemData.system.protection = "1d" + itemData.system.protection; + else if (/\d+/.exec(armure.system.protection)) { + armure.system.protection = "1d" + armure.system.protection; } else { - ui.notifications.warn(`La valeur d'armure de votre ${item.name} est incorrecte`); + ui.notifications.warn(`La valeur d'armure de votre ${armure.name} est incorrecte`); } - ChatMessage.create({ content: "Votre armure s'est détériorée, elle protège maintenant de " + itemData.system.protection }); + ChatMessage.create({ content: "Votre armure s'est détériorée, elle protège maintenant de " + armure.system.protection }); } - this.updateEmbeddedDocuments('Item', [itemData]); + this.updateEmbeddedDocuments('Item', [armure]); } /* -------------------------------------------- */ async encaisser() { - let data = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() }; - let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', data); + let dialogData = { ajustementsEncaissement: RdDUtility.getAjustementsEncaissement() }; + let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-encaisser.html', dialogData); new RdDEncaisser(html, this).render(true); } @@ -3486,8 +3490,8 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ /** @override */ getRollData() { - const data = super.getRollData(); - return data; + const rollData = super.getRollData(); + return rollData; } /* -------------------------------------------- */ @@ -3578,20 +3582,19 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ getFortune() { - let monnaies = Monnaie.filtrerMonnaies(this.items); + let monnaies = this.itemTypes['monnaie']; if (monnaies.length < 4) { ui.notifications.error("Problème de monnaies manquantes, impossible de payer correctement!") throw "Problème de monnaies manquantes, impossible de payer correctement!"; } - return monnaies.map(m => this.system) - .map(tpl => tpl.valeur_deniers * Number(tpl.quantite)) + return monnaies.map(m => Number(m.system.valeur_deniers) * Number(m.system.quantite)) .reduce(Misc.sum(), 0); } /* -------------------------------------------- */ async optimizeArgent(fortuneTotale) { - let monnaies = Monnaie.filtrerMonnaies(this.items); - let parValeur = Misc.classifyFirst(monnaies, it => this.system.valeur_deniers); + let monnaies = this.itemTypes['monnaie']; + let parValeur = Misc.classifyFirst(monnaies, it => it.system.valeur_deniers); let nouvelleFortune = { 1000: Math.floor(fortuneTotale / 1000), // or 100: Math.floor(fortuneTotale / 100) % 10, // argent @@ -3716,7 +3719,7 @@ export class RdDActor extends Actor { const buttonAcheter = html.find(".button-acheter")[0]; const vente = DialogItemAchat.prepareVenteData(buttonAcheter, achat.vendeurId, vendeur, acheteur); const itemId = vente.item._id; - const isItemEmpilable = "quantite" in vente.item.data; + const isItemEmpilable = "quantite" in vente.item.system; const coutDeniers = Math.floor((achat.prixTotal ?? 0) * 100); achat.quantiteTotal = (achat.choix.nombreLots ?? 1) * (vente.tailleLot); @@ -3748,7 +3751,7 @@ export class RdDActor extends Actor { type: vente.item.type, img: vente.item.img, name: vente.item.name, - data: mergeObject(vente.item.system, { quantite: isItemEmpilable ? achat.quantiteTotal : undefined }), + system: mergeObject(vente.item.system, { quantite: isItemEmpilable ? achat.quantiteTotal : undefined }), } let listeAchat = isItemEmpilable ? [achatData] : Array.from({ length: achat.quantiteTotal }, (_, i) => achatData) let items = await acheteur.createEmbeddedDocuments("Item", listeAchat) diff --git a/module/chat-utility.js b/module/chat-utility.js index b8aa9ae1..86c2384e 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -1,7 +1,6 @@ import { Misc } from "./misc.js"; import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; -export const MESSAGE_DATA = 'message-data'; /** * Class providing helper methods to get the list of users, and @@ -19,61 +18,50 @@ export class ChatUtility { /* -------------------------------------------- */ static notifyUser(userId, level = 'info', message) { - const data = { + const socketData = { userId: userId, level: level, message: message }; if (game.user.id == userId) { - ChatUtility.onNotifyUser(data); + ChatUtility.onNotifyUser(socketData); } else { game.socket.emit(SYSTEM_SOCKET_ID, { - msg: "msg_user_ui_notifications", data: data + msg: "msg_user_ui_notifications", data: socketData }); } } - static onNotifyUser(data) { - if (game.user.id == data.userId) { - switch (data.level) { - case 'warn': ui.notifications.warn(data.message); break; - case 'error': ui.notifications.error(data.message); break; - default: ui.notifications.info(data.message); break; + static onNotifyUser(socketData) { + if (game.user.id == socketData.userId) { + switch (socketData.level) { + case 'warn': ui.notifications.warn(socketData.message); break; + case 'error': ui.notifications.error(socketData.message); break; + default: ui.notifications.info(socketData.message); break; } } } /* -------------------------------------------- */ - static onRemoveMessages(data) { + static onRemoveMessages(socketData) { if (Misc.isUniqueConnectedGM()) { - if (data.part) { - const toDelete = game.messages.filter(it => it.data.content.includes(data.part)); + if (socketData.part) { + const toDelete = game.messages.filter(it => it.content.includes(socketData.part)); toDelete.forEach(it => it.delete()); } - if (data.messageId) { - game.messages.get(data.messageId)?.delete(); + if (socketData.messageId) { + game.messages.get(socketData.messageId)?.delete(); } } } - static onRemoveMessages(data) { - if (Misc.isUniqueConnectedGM()) { - if (data.part) { - const toDelete = game.messages.filter(it => it.content.includes(data.part)); - toDelete.forEach(it => it.delete()); - } - if (data.messageId) { - game.messages.get(data.messageId)?.delete(); - } - } - } /* -------------------------------------------- */ - static removeMessages(data) { + static removeMessages(socketData) { if (Misc.isUniqueConnectedGM()) { - ChatUtility.onRemoveMessages(data); + ChatUtility.onRemoveMessages(socketData); } else { - game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_delete_chat_message", data: data }); + game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_delete_chat_message", data: socketData }); } } @@ -154,17 +142,17 @@ export class ChatUtility { } /* -------------------------------------------- */ - static handleGMChatMessage(data) { - console.log("blindMessageToGM", data); + static handleGMChatMessage(socketData) { + console.log("blindMessageToGM", socketData); if (game.user.isGM) { // message privé pour GM only - data.user = game.user.id; - ChatMessage.create(data); + socketData.user = game.user.id; + ChatMessage.create(socketData); } } - static async setMessageData(chatMessage, key, data) { - if (data) { - await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(data)); + static async setMessageData(chatMessage, key, flag) { + if (flag) { + await chatMessage.setFlag(SYSTEM_RDD, key, JSON.stringify(flag)); } } diff --git a/module/dialog-create-signedraconique.js b/module/dialog-create-signedraconique.js index 21d2d79f..c7509f70 100644 --- a/module/dialog-create-signedraconique.js +++ b/module/dialog-create-signedraconique.js @@ -93,7 +93,7 @@ export class DialogCreateSigneDraconique extends Dialog { async setEphemere(ephemere) { this.dialogData.signe.system.ephemere = ephemere; - HtmlUtility._showControlWhen($(".signe-data-duree"), ephemere); + HtmlUtility._showControlWhen($(".signe-system-duree"), ephemere); } async onSelectActor(event) { diff --git a/module/dialog-item-consommer.js b/module/dialog-item-consommer.js index b62d8797..7de062c8 100644 --- a/module/dialog-item-consommer.js +++ b/module/dialog-item-consommer.js @@ -38,22 +38,22 @@ export class DialogConsommer extends Dialog { /* -------------------------------------------- */ static prepareData(actor, item) { - const itemData = duplicate(item); + item = duplicate(item); let consommerData = { - item: itemData, + item: item, cuisine: actor.getCompetence('cuisine'), choix: { doses: 1, seForcer: false, } } - switch (itemData.type) { + switch (item.type) { case 'nourritureboisson': - consommerData.title = itemData.system.boisson ? `${itemData.name}: boire une dose` : `${itemData.name}: manger une portion`; - consommerData.buttonName = itemData.system.boisson ? "Boire" : "Manger"; + consommerData.title = item.system.boisson ? `${item.name}: boire une dose` : `${item.name}: manger une portion`; + consommerData.buttonName = item.system.boisson ? "Boire" : "Manger"; break; case 'potion': - consommerData.title = `${itemData.name}: boire la potion`; + consommerData.title = `${item.name}: boire la potion`; consommerData.buttonName = "Boire"; break; } @@ -61,11 +61,11 @@ export class DialogConsommer extends Dialog { return consommerData; } - static calculDoses(consommerData) { - const doses = consommerData.choix.doses; - 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) + static calculDoses(consommer) { + const doses = consommer.choix.doses; + consommer.totalSust = Misc.keepDecimals(doses * (consommer.item.system.sust ?? 0), 2); + consommer.totalDesaltere = consommer.item.system.boisson + ? Misc.keepDecimals(doses * (consommer.item.system.desaltere ?? 0), 2) : 0; } diff --git a/module/dialog-item-vente.js b/module/dialog-item-vente.js index c84f2aae..3dba68d0 100644 --- a/module/dialog-item-vente.js +++ b/module/dialog-item-vente.js @@ -4,15 +4,14 @@ import { Misc } from "./misc.js"; export class DialogItemVente extends Dialog { static async create(item, callback) { - const itemData = item - const quantite = item.isConteneur() ? 1 : itemData.system.quantite; + const quantite = item.isConteneur() ? 1 : item.system.quantite; const venteData = { - item: itemData, + item: item, alias: item.actor?.name ?? game.user.name, vendeurId: item.actor?.id, - prixOrigine: itemData.system.cout, - prixUnitaire: itemData.system.cout, - prixLot: itemData.system.cout, + prixOrigine: item.system.cout, + prixUnitaire: item.system.cout, + prixLot: item.system.cout, tailleLot: 1, quantiteNbLots: quantite, quantiteMaxLots: quantite, diff --git a/module/dialog-split-item.js b/module/dialog-split-item.js index abe557ae..d5ba3298 100644 --- a/module/dialog-split-item.js +++ b/module/dialog-split-item.js @@ -3,10 +3,9 @@ import { Misc } from "./misc.js"; export class DialogSplitItem extends Dialog { static async create(item, callback) { - const itemData = item const splitData = { - item: itemData, - choix: { quantite: 1, max: itemData.system.quantite - 1 } + item: item, + choix: { quantite: 1, max: item.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/hook-renderChatLog.js b/module/hook-renderChatLog.js deleted file mode 100644 index 64dec8c0..00000000 --- a/module/hook-renderChatLog.js +++ /dev/null @@ -1,9 +0,0 @@ -/* -------------------------------------------- */ -import { RdDUtility } from "./rdd-utility.js"; - -/* -------------------------------------------- */ -// Activate chat listeners defined -// Hooks.on('renderChatLog', (log, html, data) => { -// RdDUtility.chatListeners(html); -// }); - diff --git a/module/item-arme.js b/module/item-arme.js index 59c5f698..f8eef4f7 100644 --- a/module/item-arme.js +++ b/module/item-arme.js @@ -19,18 +19,16 @@ const nomCategorieParade = { /* -------------------------------------------- */ export class RdDItemArme extends Item { - static isArme(itemData) { - itemData = itemData - return (itemData.type == 'competencecreature' && itemData.system.iscombat) || itemData.type == 'arme'; + static isArme(item) { + return (item.type == 'competencecreature' && item.system.iscombat) || item.type == 'arme'; } /* -------------------------------------------- */ - static getArmeData(armeData) { - armeData = armeData - switch (armeData ? armeData.type : '') { - case 'arme': return armeData; + static getArme(arme) { + switch (arme ? arme.type : '') { + case 'arme': return arme; case 'competencecreature': - return RdDItemCompetenceCreature.toActionArme(armeData); + return RdDItemCompetenceCreature.toActionArme(arme); } return RdDItemArme.mainsNues(); } @@ -160,17 +158,18 @@ export class RdDItemArme extends Item { return armeData; } - static isArmeUtilisable(itemData) { - return itemData.type == 'arme' && itemData.system.equipe && (itemData.system.resistance > 0 || itemData.system.portee_courte > 0); + static isArmeUtilisable(arme) { + return arme.type == 'arme' && arme.system.equipe && (arme.system.resistance > 0 || arme.system.portee_courte > 0); } static ajoutCorpsACorps(armes, competences, carac) { 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.system.niveau, initiative: init })); } - static corpsACorps(actorData) { + static corpsACorps(mainsNuesActor) { const corpsACorps = { name: 'Corps à corps', img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp', @@ -185,20 +184,20 @@ export class RdDItemArme extends Item { categorie_parade: 'sans-armes' } }; - mergeObject(corpsACorps.system, actorData ?? {}, { overwrite: false }); + mergeObject(corpsACorps.system, mainsNuesActor ?? {}, { overwrite: false }); return corpsACorps; } - static mainsNues(actorData) { - const mainsNues = RdDItemArme.corpsACorps(actorData) + static mainsNues(mainsNuesActor) { + const mainsNues = RdDItemArme.corpsACorps(mainsNuesActor) mainsNues.name = 'Mains nues' mainsNues.system.cac = 'pugilat' mainsNues.system.baseInit = 4 return mainsNues; } - static empoignade(actorData) { - const empoignade = RdDItemArme.corpsACorps(actorData) + static empoignade(mainsNuesActor) { + const empoignade = RdDItemArme.corpsACorps(mainsNuesActor) empoignade.name = 'Empoignade' empoignade.system.cac = 'empoignade' empoignade.system.baseInit = 3 diff --git a/module/item-competence.js b/module/item-competence.js index 8d3b7728..22766254 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -195,17 +195,17 @@ export class RdDItemCompetence extends Item { } /* -------------------------------------------- */ - static isVisible(itemData) { - return Number(itemData.system.niveau) != RdDItemCompetence.getNiveauBase(itemData.system.categorie); + static isVisible(item) { + return Number(item.system.niveau) != RdDItemCompetence.getNiveauBase(item.system.categorie); } - static nomContientTexte(itemData, texte) { - return Grammar.toLowerCaseNoAccent(itemData.name).includes(Grammar.toLowerCaseNoAccent(texte)) + static nomContientTexte(item, texte) { + return Grammar.toLowerCaseNoAccent(item.name).includes(Grammar.toLowerCaseNoAccent(texte)) } /* -------------------------------------------- */ - static isNiveauBase(itemData) { - return Number(itemData.system.niveau) == RdDItemCompetence.getNiveauBase(itemData.system.categorie); + static isNiveauBase(item) { + return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie); } /* -------------------------------------------- */ diff --git a/module/item-competencecreature.js b/module/item-competencecreature.js index 32bd11a3..3e6e9050 100644 --- a/module/item-competencecreature.js +++ b/module/item-competencecreature.js @@ -38,14 +38,12 @@ export class RdDItemCompetenceCreature extends Item { } /* -------------------------------------------- */ - static isCompetenceAttaque(itemData) { - itemData = itemData - return itemData.type == 'competencecreature' && itemData.system.iscombat; + static isCompetenceAttaque(item) { + return item.type == 'competencecreature' && item.system.iscombat; } /* -------------------------------------------- */ - static isCompetenceParade(itemData) { - itemData = itemData - return itemData.type == 'competencecreature' && itemData.system.isparade; + static isCompetenceParade(item) { + return item.type == 'competencecreature' && item.system.isparade; } } diff --git a/module/item-monnaie.js b/module/item-monnaie.js index 2d970eec..bff8385c 100644 --- a/module/item-monnaie.js +++ b/module/item-monnaie.js @@ -1,6 +1,6 @@ import { Misc } from "./misc.js"; -const monnaiesData = [ +const MONNAIES_STANDARD = [ { name: "Etain (1 denier)", type: 'monnaie', img: "systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp", @@ -26,27 +26,28 @@ const monnaiesData = [ export class Monnaie { static isSystemMonnaie(item) { - let present = monnaiesData.find(monnaie => monnaie.system.valeur_deniers == item?.system?.valeur_deniers); + let present = MONNAIES_STANDARD.find(monnaie => monnaie.system.valeur_deniers == item?.system?.valeur_deniers); return present; } static monnaiesData() { - return monnaiesData; + return MONNAIES_STANDARD; } static filtrerMonnaies(items) { return items.filter(it => it.type == 'monnaie'); } - static monnaiesManquantes(items) { - const valeurs = Monnaie.filtrerMonnaies(items) - .map(it => it.system.valeur_deniers); - const manquantes = monnaiesData.filter(monnaie => !valeurs.find(v => v != monnaie.system?.valeur_deniers)) + static monnaiesManquantes(disponibles) { + const manquantes = MONNAIES_STANDARD.filter(standard => !disponibles.find(disponible => Monnaie.deValeur(disponible, standard.system?.valeur_deniers))); + if (manquantes.length>0) { + console.error('monnaiesManquantes', manquantes, ' avec monnaies', disponibles, MONNAIES_STANDARD); + } return []; //manquantes; } - static deValeur(monnaie, v) { - return v != monnaie.system.valeur_deniers + static deValeur(monnaie, valeur) { + return valeur == monnaie.system.valeur_deniers } static arrondiDeniers(sols) { diff --git a/module/item-sheet.js b/module/item-sheet.js index 00984fbd..ea1804be 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -32,7 +32,7 @@ export class RdDItemSheet extends ItemSheet { let buttons = super._getHeaderButtons(); // Add "Post to chat" button // We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry! - if ("cout" in this.object.system && this.object.isVideOuNonConteneur()) { + if ("cout" in this.item.system && this.item.isVideOuNonConteneur()) { buttons.unshift({ class: "vendre", icon: "fas fa-comments-dollar", @@ -61,22 +61,24 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ async getData() { let formData = { - id: this.object.id, - title: this.object.name, - type: this.object.type, - img: this.object.img, - name: this.object.name, - data: this.object.system, + id: this.item.id, + title: this.item.name, + type: this.item.type, + img: this.item.img, + name: this.item.name, + system: this.item.system, + // TODO: v10 remove + data: this.item.system, isGM: game.user.isGM, actorId: this.actor?.id, - owner: this.document.isOwner, + owner: this.item.isOwner, editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", isSoins: false } if (this.actor) { formData.isOwned = true; - if (this.object.type == 'conteneur') { + if (this.item.type == 'conteneur') { this.prepareConteneurData(formData); } } @@ -92,15 +94,15 @@ export class RdDItemSheet extends ItemSheet { console.log(formData.competences) } if (formData.type == 'recettealchimique') { - RdDAlchimie.processManipulation(this.object, this.actor && this.actor.id); + RdDAlchimie.processManipulation(this.item, this.actor && this.actor.id); } if (formData.type == 'gemme') { formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); - RdDGemme.calculDataDerivees(formData.data); + RdDGemme.calculDataDerivees(this.item); } if (formData.type == 'potion') { if (this.dateUpdated) { - formData.data.prdate = this.dateUpdated; + formData.system.prdate = this.dateUpdated; this.dateUpdated = undefined; } RdDHerbes.updatePotionData(formData); @@ -119,7 +121,7 @@ export class RdDItemSheet extends ItemSheet { RdDUtility.filterEquipementParType(formData) this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets); - formData.subItems = formData.conteneurs.find(it => it._id == this.object.id)?.subItems; + formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems; } @@ -128,15 +130,15 @@ export class RdDItemSheet extends ItemSheet { activateListeners(html) { super.activateListeners(html); - if (this.object.type == 'conteneur') { + if (this.item.type == 'conteneur') { this.form.ondragstart = (event) => this._onDragStart(event); this.form.ondrop = (event) => this._onDrop(event); } let itemSheetDialog = this; - HtmlUtility._showControlWhen($(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.object.isOwned); - HtmlUtility._showControlWhen($(".item-magique"), this.object.isMagique()); + HtmlUtility._showControlWhen($(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.item.isOwned); + HtmlUtility._showControlWhen($(".item-magique"), this.item.isMagique()); // Everything below here is only needed if the sheet is editable if (!this.options.editable) return; @@ -145,8 +147,8 @@ export class RdDItemSheet extends ItemSheet { html.find(".categorie").change(event => this._onSelectCategorie(event)); html.find('.sheet-competence-xp').change((event) => { - if (this.object.type == 'competence') { - RdDUtility.checkThanatosXP(this.object.name); + if (this.item.type == 'competence') { + RdDUtility.checkThanatosXP(this.item.name); } }); @@ -219,16 +221,16 @@ export class RdDItemSheet extends ItemSheet { async _onSelectCategorie(event) { event.preventDefault(); - if (this.object.isCompetence()) { + if (this.item.isCompetence()) { let level = RdDItemCompetence.getNiveauBase(event.currentTarget.value); - this.object.system.base = level; + this.item.system.base = level; $("#base").val(level); } } /* -------------------------------------------- */ get template() { - let type = this.object.type + let type = this.item.type return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`; } @@ -239,7 +241,7 @@ export class RdDItemSheet extends ItemSheet { // Données de bonus de cases ? formData = RdDItemSort.buildBonusCaseStringFromFormData(formData); - return this.object.update(formData); + return this.item.update(formData); } async _onDragStart(event) { @@ -252,28 +254,28 @@ export class RdDItemSheet extends ItemSheet { const dragData = { actorId: this.actor.id, type: "Item", - data: item + data: item.system }; event.dataTransfer.setData("text/plain", JSON.stringify(dragData)); } async _onDrop(event) { - // Try to extract the data - let data; + // Try to extract the dragData + let dragData; try { - data = JSON.parse(event.dataTransfer.getData('text/plain')); + dragData = JSON.parse(event.dataTransfer.getData('text/plain')); } catch (err) { return false; } - const allowed = Hooks.call("dropActorSheetData", this.actor, this, data); + const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData); if (allowed === false) return; - // Handle different data types - switch (data.type) { + // Handle different dragData types + switch (dragData.type) { case "Item": - return this._onDropItem(event, data); + return this._onDropItem(event, dragData); } return super._onDrop(event); } @@ -281,7 +283,7 @@ export class RdDItemSheet extends ItemSheet { /* -------------------------------------------- */ async _onDropItem(event, dragData) { if (this.actor) { - const dropParams = RdDSheetUtility.prepareItemDropParameters(this.object.id, this.actor.id, dragData, this.objetVersConteneur); + const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor.id, dragData, this.objetVersConteneur); await this.actor.processDropItem(dropParams); await this.render(true); } diff --git a/module/item-signedraconique-sheet.js b/module/item-signedraconique-sheet.js index 8d9d59a4..4d4d3546 100644 --- a/module/item-signedraconique-sheet.js +++ b/module/item-signedraconique-sheet.js @@ -40,17 +40,17 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet { /* -------------------------------------------- */ async getData() { - const formData = duplicate(this.object); + const formData = duplicate(this.item); mergeObject(formData, { title: formData.name, isGM: game.user.isGM, - owner: this.document.isOwner, + owner: this.actor.isOwner, isOwned: this.actor ? true : false, actorId: this.actor?.id, editable: this.isEditable, cssClass: this.isEditable ? "editable" : "locked", }); - formData.tmrs = TMRUtility.listSelectedTMR(formData.data.typesTMR ?? []); + formData.tmrs = TMRUtility.listSelectedTMR(formData.system.typesTMR ?? []); return formData; } @@ -68,21 +68,21 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet { async setSigneAleatoire() { const newSigne = await RdDItemSigneDraconique.randomSigneDraconique(); - this.object.update(newSigne); + this.item.update(newSigne); } async onSelectTmr(event) { event.preventDefault(); const selectedTMR = $(".select-tmr").val(); - this.object.update({ 'data.typesTMR': selectedTMR }); + this.item.update({ 'system.typesTMR': selectedTMR }); } async onValeurXpSort(event) { const codeReussite = event.currentTarget.attributes['data-typereussite']?.value ?? 0; const xp = Number(event.currentTarget.value); - const oldValeur = this.object.system.valeur; + const oldValeur = this.item.system.valeur; const newValeur = RdDItemSigneDraconique.calculValeursXpSort(codeReussite, xp, oldValeur); - await this.object.update({ 'data.valeur': newValeur }); + await this.item.update({ 'system.valeur': newValeur }); } /* -------------------------------------------- */ diff --git a/module/item-signedraconique.js b/module/item-signedraconique.js index eaddb716..8bed1ed0 100644 --- a/module/item-signedraconique.js +++ b/module/item-signedraconique.js @@ -18,12 +18,11 @@ const DIFFICULTE_LECTURE_SIGNE_MANQUE = +11; export class RdDItemSigneDraconique { static prepareSigneDraconiqueMeditation(meditation, rolled) { - meditation = meditation return { name: "de la " + meditation.name, type: "signedraconique", img: meditation.img, - data: { + system: { typesTMR: [TMRUtility.typeTmrName(meditation.system.tmr)], difficulte: rolled.isSuccess ? RdDItemSigneDraconique.getDiffSigneMeditation(rolled.code) : DIFFICULTE_LECTURE_SIGNE_MANQUE, ephemere: true, @@ -75,7 +74,7 @@ export class RdDItemSigneDraconique { name: await RdDItemSigneDraconique.randomSigneDescription(), type: "signedraconique", img: defaultItemImg.signedraconique, - data: { + system: { typesTMR: await RdDItemSigneDraconique.randomTmrs(modele.nbCases), ephemere: options?.ephemere == undefined ? RdDDice.rollTotal("1d2") == 2 : options.ephemere, duree: "1 round", diff --git a/module/item-sort.js b/module/item-sort.js index 203904c7..5047cc23 100644 --- a/module/item-sort.js +++ b/module/item-sort.js @@ -59,30 +59,30 @@ export class RdDItemSort extends Item { return undefined; } - /* -------------------------------------------- */ - /** Met à jour les données de formulaire - * si static des bonus de cases sont présents - * */ - static buildBonusCaseStringFromFormData( formData ) { - if ( formData.bonusValue ) { - let list = []; - let caseCheck = {}; - for(let i=0; i 0 && caseCheck[coord] == undefined ) { - caseCheck[coord] = bonus; - list.push( coord+":"+bonus ); - } + /* -------------------------------------------- */ + /** Met à jour les données de formulaire + * si static des bonus de cases sont présents + * */ + static buildBonusCaseStringFromFormData( formData ) { + if ( formData.bonusValue ) { + let list = []; + let caseCheck = {}; + for(let i=0; i 0 && caseCheck[coord] == undefined ) { + caseCheck[coord] = bonus; + list.push( coord+":"+bonus ); } } - formData.bonusValue = undefined; - formData.caseValue = undefined; - formData['data.bonuscase'] = list.toString(); // Reset } - return formData; + formData.bonusValue = undefined; + formData.caseValue = undefined; + formData.system.bonuscase = list.toString(); // Reset + } + return formData; } /* -------------------------------------------- */ @@ -106,7 +106,7 @@ export class RdDItemSort extends Item { // Sauvegarde/update let bonuscase = StringList.toString(); //console.log("Bonus cae :", bonuscase); - actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'data.bonuscase': bonuscase }] ); + actor.updateEmbeddedDocuments('Item', [{ _id: sort._id, 'system.bonuscase': bonuscase }] ); } /* -------------------------------------------- */ diff --git a/module/item.js b/module/item.js index ef9a14e8..f83cf913 100644 --- a/module/item.js +++ b/module/item.js @@ -1,6 +1,7 @@ import { DialogItemVente } from "./dialog-item-vente.js"; import { Grammar } from "./grammar.js"; import { Misc } from "./misc.js"; +import { RdDHerbes } from "./rdd-herbes.js"; import { RdDUtility } from "./rdd-utility.js"; const typesObjetsEquipement = ["objet", "arme", "armure", "gemme", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "nourritureboisson", "monnaie"] @@ -41,11 +42,11 @@ export const defaultItemImg = { /* -------------------------------------------- */ export class RdDItem extends Item { - constructor(data, context) { - if (!data.img) { - data.img = defaultItemImg[data.type]; + constructor(itemData, context) { + if (!itemData.img) { + itemData.img = defaultItemImg[itemData.type]; } - super(data, context); + super(itemData, context); } static getTypeObjetsEquipement() { @@ -126,7 +127,8 @@ export class RdDItem extends Item { this.system.magique = categorie.includes('enchante'); if (this.system.magique) { if (categorie.includes('soin') || categorie.includes('repos')) { - this.system.puissance = this.system.herbebonus * this.system.pr; + // TODO: utiliser calculePointsRepos / calculePointsGuerison + this.system.puissance = RdDHerbes.calculePuissancePotion(this); } } } @@ -180,11 +182,11 @@ export class RdDItem extends Item { } else { ui.notifications.notify(`Il ne vous reste plus de ${this.name}, vous pouvez le supprimer de votre équipement, ou trouver un moyen de vous en procurer.`); - await this.update({ "data.quantite": 0 }); + await this.update({ "system.quantite": 0 }); } } else { - await this.update({ "data.quantite": reste }); + await this.update({ "system.quantite": reste }); } } } diff --git a/module/rdd-alchimie.js b/module/rdd-alchimie.js index 7d99ee06..add4bd7c 100644 --- a/module/rdd-alchimie.js +++ b/module/rdd-alchimie.js @@ -17,12 +17,12 @@ export class RdDAlchimie { //console.log("RESULT ", result); if (result[1] && result[2]) { let commande = Misc.upperFirst(result[1]); - let replacement = this[`_alchimie${commande}`](recetteData, result[2], actorId); + let replacement = this[`_alchimie${commande}`](recette, result[2], actorId); manip = manip.replace(result[0], replacement); } } } - recetteData.recette.manipulation_update = manip; + recette.system.manipulation_update = manip; } /* -------------------------------------------- */ diff --git a/module/rdd-astrologie-joueur.js b/module/rdd-astrologie-joueur.js index 9925743d..5c520d6a 100644 --- a/module/rdd-astrologie-joueur.js +++ b/module/rdd-astrologie-joueur.js @@ -12,23 +12,23 @@ export class RdDAstrologieJoueur extends Dialog { /* -------------------------------------------- */ static async create(actor, dialogConfig) { - let data = { + let dialogData = { nombres: this.organizeNombres(actor), dates: game.system.rdd.calendrier.getJoursSuivants(10), etat: actor.getEtatGeneral(), ajustementsConditions: CONFIG.RDD.ajustementsConditions, astrologie: RdDItemCompetence.findCompetence(actor.items, 'Astrologie') } - const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', data); + const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', dialogData); let options = { classes: ["rdddialog"], width: 600, height: 500, 'z-index': 99999 }; if (dialogConfig.options) { mergeObject(options, dialogConfig.options, { overwrite: true }); } - return new RdDAstrologieJoueur(html, actor, data); + return new RdDAstrologieJoueur(html, actor, dialogData); } /* -------------------------------------------- */ - constructor(html, actor, data) { + constructor(html, actor, dialogData) { let myButtons = { saveButton: { label: "Fermer", callback: html => this.quitDialog() } @@ -41,7 +41,7 @@ export class RdDAstrologieJoueur extends Dialog { super(dialogConf, dialogOptions); this.actor = actor; - this.dataNombreAstral = duplicate(data); + this.dataNombreAstral = duplicate(dialogData); } /* -------------------------------------------- */ @@ -63,7 +63,7 @@ export class RdDAstrologieJoueur extends Dialog { /* -------------------------------------------- */ requestJetAstrologie() { - let data = { + let socketData = { id: this.actor.id, carac_vue: this.actor.system.carac['vue'].value, etat: this.dataNombreAstral.etat, @@ -73,11 +73,11 @@ export class RdDAstrologieJoueur extends Dialog { userId: game.user.id } if (Misc.isUniqueConnectedGM()) { - game.system.rdd.calendrier.requestNombreAstral(data); + game.system.rdd.calendrier.requestNombreAstral(socketData); } else { game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_request_nombre_astral", - data: data + data: socketData }); } this.close(); diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index 75605ca2..ec5864b7 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -223,7 +223,7 @@ 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.system.active) ) && item.system.periodicite.toLowerCase().includes(periode) ); + let maladies = actor.items.find( item => (item.type == 'maladie' || (item.type == 'poison' && item.system.active) ) && item.system.periodicite.toLowerCase().includes(periode) ); for (let maladie of maladies) { 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 !` }); @@ -444,9 +444,9 @@ export class RdDCalendrier extends Application { /* -------------------------------------------- */ updateDisplay() { - let data = this.fillCalendrierData(); - // Rebuild data - let dateHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})` + let calendrier = this.fillCalendrierData(); + // Rebuild text du calendrier + let dateHTML = `Jour ${calendrier.jourMois} de ${calendrier.nomMois} (${calendrier.nomSaison})` if (game.user.isGM) { dateHTML = dateHTML + " - NA: " + (this.getCurrentNombreAstral() ?? "indéterminé"); } @@ -454,13 +454,13 @@ export class RdDCalendrier extends Application { handle.innerHTML = dateHTML; } for (let heure of document.getElementsByClassName("calendar-heure-texte")) { - heure.innerHTML = data.nomHeure; + heure.innerHTML = calendrier.nomHeure; } for (const minute of document.getElementsByClassName("calendar-time-disp")) { - minute.innerHTML = `${data.minutesRelative} minutes`; + minute.innerHTML = `${calendrier.minutesRelative} minutes`; } for (const heureImg of document.getElementsByClassName("calendar-heure-img")) { - heureImg.src = data.iconHeure; + heureImg.src = calendrier.iconHeure; } } diff --git a/module/rdd-carac.js b/module/rdd-carac.js index ff684ab1..daff7567 100644 --- a/module/rdd-carac.js +++ b/module/rdd-carac.js @@ -101,35 +101,35 @@ export class RdDCarac { } /* -------------------------------------------- */ - static computeCarac(data) { - data.carac.force.value = Math.min(data.carac.force.value, parseInt(data.carac.taille.value) + 4); + static computeCarac(system) { + system.carac.force.value = Math.min(system.carac.force.value, parseInt(system.carac.taille.value) + 4); - data.carac.derobee.value = Math.floor(parseInt(((21 - data.carac.taille.value)) + parseInt(data.carac.agilite.value)) / 2); - let bonusDomKey = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2); + system.carac.derobee.value = Math.floor(parseInt(((21 - system.carac.taille.value)) + parseInt(system.carac.agilite.value)) / 2); + let bonusDomKey = Math.floor((parseInt(system.carac.force.value) + parseInt(system.carac.taille.value)) / 2); bonusDomKey = Math.min(Math.max(bonusDomKey, 0), 32); // Clamp de securite let tailleData = tableCaracDerivee[bonusDomKey]; - data.attributs.plusdom.value = tailleData.plusdom; + system.attributs.plusdom.value = tailleData.plusdom; - data.attributs.sconst.value = RdDCarac.calculSConst(data.carac.constitution.value); - data.attributs.sust.value = tableCaracDerivee[Number(data.carac.taille.value)].sust; + system.attributs.sconst.value = RdDCarac.calculSConst(system.carac.constitution.value); + system.attributs.sust.value = tableCaracDerivee[Number(system.carac.taille.value)].sust; - data.attributs.encombrement.value = (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2; - data.carac.melee.value = Math.floor((parseInt(data.carac.force.value) + parseInt(data.carac.agilite.value)) / 2); - data.carac.tir.value = Math.floor((parseInt(data.carac.vue.value) + parseInt(data.carac.dexterite.value)) / 2); - data.carac.lancer.value = Math.floor((parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2); + system.attributs.encombrement.value = (parseInt(system.carac.force.value) + parseInt(system.carac.taille.value)) / 2; + system.carac.melee.value = Math.floor((parseInt(system.carac.force.value) + parseInt(system.carac.agilite.value)) / 2); + system.carac.tir.value = Math.floor((parseInt(system.carac.vue.value) + parseInt(system.carac.dexterite.value)) / 2); + system.carac.lancer.value = Math.floor((parseInt(system.carac.tir.value) + parseInt(system.carac.force.value)) / 2); - data.sante.vie.max = Math.ceil((parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value)) / 2); + system.sante.vie.max = Math.ceil((parseInt(system.carac.taille.value) + parseInt(system.carac.constitution.value)) / 2); - data.sante.vie.value = Math.min(data.sante.vie.value, data.sante.vie.max) - data.sante.endurance.max = Math.max(parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value)); - data.sante.endurance.value = Math.min(data.sante.endurance.value, data.sante.endurance.max); - data.sante.fatigue.max = data.sante.endurance.max * 2; - data.sante.fatigue.value = Math.min(data.sante.fatigue.value, data.sante.fatigue.max); + system.sante.vie.value = Math.min(system.sante.vie.value, system.sante.vie.max) + system.sante.endurance.max = Math.max(parseInt(system.carac.taille.value) + parseInt(system.carac.constitution.value), parseInt(system.sante.vie.max) + parseInt(system.carac.volonte.value)); + system.sante.endurance.value = Math.min(system.sante.endurance.value, system.sante.endurance.max); + system.sante.fatigue.max = system.sante.endurance.max * 2; + system.sante.fatigue.value = Math.min(system.sante.fatigue.value, system.sante.fatigue.max); //Compteurs - data.reve.reve.max = data.carac.reve.value; - data.compteurs.chance.max = data.carac.chance.value; + system.reve.reve.max = system.carac.reve.value; + system.compteurs.chance.max = system.carac.chance.value; } diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 5bb20b9f..fee00988 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -79,7 +79,7 @@ export class RdDCombatManager extends Combat { /************************************************************************************/ async rollInitiative(ids, formula = undefined, 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; // calculate initiative @@ -93,7 +93,7 @@ export class RdDCombatManager extends Combat { rollFormula = RdDCombatManager.formuleInitiative(2, competence.system.carac_value, competence.system.niveau, 0); } } else { - const armeCombat = combatant.actor.items.find(it => it.type == 'arme' && itemData.system.equipe) + const armeCombat = combatant.actor.itemTypes['arme'].find(it => it.system.equipe) const compName = (armeCombat == undefined) ? "Corps à corps" : armeCombat.system.competence; const competence = RdDItemCompetence.findCompetence(combatant.actor.items, compName); if (competence) { @@ -202,7 +202,7 @@ export class RdDCombatManager extends Combat { return { name: p.name, action: 'conjurer', - data: { + system: { competence: p.name, possessionid: p.system.possessionid, } @@ -231,7 +231,7 @@ export class RdDCombatManager extends Combat { actions = actions.concat(RdDCombatManager.listActionsArmes(armes, competences, actor.system.carac)); if (actor.system.attributs.hautrevant.value) { - actions.push({ name: "Draconic", action: 'haut-reve', data: { initOnly: true, competence: "Draconic" } }); + actions.push({ name: "Draconic", action: 'haut-reve', system: { initOnly: true, competence: "Draconic" } }); } } @@ -892,8 +892,7 @@ export class RdDCombat { /* -------------------------------------------- */ _filterArmesParade(defender, competence) { - let items = defender.items; - items = items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it)) + let items = defender.items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it)) for (let item of items) { item.system.nbUsage = defender.getItemUse(item.id); // Ajout du # d'utilisation ce round } @@ -960,10 +959,10 @@ export class RdDCombat { async parade(attackerRoll, armeParadeId) { const arme = this.defender.getArmeParade(armeParadeId); console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme); - const competence = this.system?.competence; + const competence = arme?.system?.competence; if (competence == undefined) { - console.error("Pas de compétence de parade associée à ", arme) ; + console.error("Pas de compétence de parade associée à ", arme?.name, armeParadeId) ; return; } @@ -1144,7 +1143,7 @@ export class RdDCombat { resistance -= perteResistance; defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte'; defenderRoll.show.perteResistance = perteResistance; - this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'data.resistance': resistance }]); + this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'system.resistance': resistance }]); } } } else { @@ -1160,7 +1159,7 @@ export class RdDCombat { resistance -= dmg; defenderRoll.show.deteriorationArme = resistance <= 0 ? 'brise' : 'perte'; defenderRoll.show.perteResistance = dmg; - this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'data.resistance': resistance }]); + this.defender.updateEmbeddedDocuments('Item', [{ _id: defenderRoll.arme._id, 'system.resistance': resistance }]); } } // Si l'arme de parade n'est pas un bouclier, jet de désarmement (p.132) @@ -1274,7 +1273,7 @@ export class RdDCombat { /* -------------------------------------------- */ static async displayActorCombatStatus(combat, actor) { - let data = { + let formData = { combatId: combat._id, alias: actor.name, etatGeneral: actor.getEtatGeneral(), @@ -1286,13 +1285,13 @@ export class RdDCombat { isCritique: false } if (actor.countBlessuresNonSoigneeByName("critiques") > 0) { // Pour éviter le cumul grave + critique - data.isCritique = true; + formData.isCritique = true; } else if (actor.countBlessuresNonSoigneeByName("graves") > 0) { - data.isGrave = true; + formData.isGrave = true; } ChatUtility.createChatWithRollMode(actor.name, { - content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, data) + content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, formData) }); } } diff --git a/module/rdd-commands.js b/module/rdd-commands.js index d6ba8b08..8fcb93bd 100644 --- a/module/rdd-commands.js +++ b/module/rdd-commands.js @@ -358,7 +358,7 @@ export class RdDCommands { async supprimerSignesDraconiquesEphemeres() { game.actors.forEach(actor => { - const ephemeres = actor.filterItems(item => item.type = 'signedraconique' && item.system.ephemere) + const ephemeres = actor.items.find(item => item.type = 'signedraconique' && item.system.ephemere) .map(item => item.id); if (ephemeres.length > 0) { actor.deleteEmbeddedDocuments("Item", ephemeres); diff --git a/module/rdd-compendium-organiser.js b/module/rdd-compendium-organiser.js index 7f4a4665..56f9a08a 100644 --- a/module/rdd-compendium-organiser.js +++ b/module/rdd-compendium-organiser.js @@ -3,11 +3,11 @@ import { Misc } from "./misc.js"; export class RddCompendiumOrganiser { static init() { - Hooks.on('renderCompendium', async (pack, html, data) => RddCompendiumOrganiser.onRenderCompendium(pack, html, data)) + Hooks.on('renderCompendium', async (pack, html, compendiumData) => RddCompendiumOrganiser.onRenderCompendium(pack, html, compendiumData)) } - static async onRenderCompendium(compendium, html, data) { - console.log('onRenderCompendium', compendium, html, data); + static async onRenderCompendium(compendium, html, compendiumData) { + console.log('onRenderCompendium', compendium, html, compendiumData); const pack = compendium.collection if (pack.metadata.system === SYSTEM_RDD) { html.find('.directory-item').each((i, element) => { diff --git a/module/rdd-gemme.js b/module/rdd-gemme.js index 00201e1f..83981ecf 100644 --- a/module/rdd-gemme.js +++ b/module/rdd-gemme.js @@ -18,18 +18,19 @@ const tableGemmes = { export class RdDGemme extends Item { static getGemmeTypeOptionList() { + // TODO: look how to map object key-value pairs let options = "" for (let gemmeKey in tableGemmes) { - let gemmeData = tableGemmes[gemmeKey]; - options += `` + options += `` } return options; } - static calculDataDerivees(data) { - data.cout = (data.taille * data.purete) + data.qualite; - data.inertie = 7 - data.purete; - data.enchantabilite = data.taille - data.inertie; + + static calculDataDerivees(gemme) { + gemme.system.cout = (gemme.system.taille * gemme.system.purete) + gemme.system.qualite; + gemme.system.inertie = 7 - gemme.system.purete; + gemme.system.enchantabilite = gemme.system.taille - gemme.system.inertie; } } diff --git a/module/rdd-herbes.js b/module/rdd-herbes.js index 1c7e431e..d11a38f2 100644 --- a/module/rdd-herbes.js +++ b/module/rdd-herbes.js @@ -1,6 +1,4 @@ -/* -------------------------------------------- */ import { RdDUtility } from "./rdd-utility.js"; -import { Misc } from "./misc.js"; import { RdDCalendrier } from "./rdd-calendrier.js"; /* -------------------------------------------- */ @@ -22,12 +20,11 @@ export class RdDHerbes extends Item { } /* -------------------------------------------- */ - static buildHerbesList(listHerbes, max) { + static buildHerbesList(listeHerbes, max) { let list = {} - for ( let herbe of listHerbes) { - let herbeData = herbe.system - let brins = max - herbeData.niveau; - list[herbe.name] = `${herbe.name} (Bonus: ${herbeData.niveau}, Brins: ${brins})`; + for ( let herbe of listeHerbes) { + let brins = max - herbe.system.niveau; + list[herbe.system.name] = `${herbe.system.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`; } list['Autre'] = 'Autre (Bonus: variable, Brins: variable)' return list; @@ -39,36 +36,39 @@ export class RdDHerbes extends Item { formData.herbesRepos = this.buildHerbesList(this.herbesRepos, 7); formData.jourMoisOptions = RdDCalendrier.buildJoursMois(); formData.dateActuelle = game.system.rdd.calendrier.getDateFromIndex(); - formData.splitDate = game.system.rdd.calendrier.getNumericDateFromIndex(formData.data.prdate); + formData.splitDate = game.system.rdd.calendrier.getNumericDateFromIndex(formData.system.prdate); - if (formData.data.categorie.includes('Soin') ) { + if (formData.system.categorie.includes('Soin') ) { formData.isHerbe = true; this.computeHerbeBonus(formData, this.herbesSoins, 12); - } else if (formData.data.categorie.includes('Repos')) { + } else if (formData.system.categorie.includes('Repos')) { formData.isRepos = true; this.computeHerbeBonus(formData, this.herbesRepos, 7); } } /* -------------------------------------------- */ - static calculePointsRepos( data ) { - return data.herbebonus * data.pr; + static calculePuissancePotion( potion ) { + return potion.system.herbebonus * potion.system.pr; } /* -------------------------------------------- */ - static calculePointsGuerison( data ){ - return data.herbebonus * data.pr; + static calculePointsRepos( potion ) { + return potion.system.herbebonus * potion.system.pr; + } + + /* -------------------------------------------- */ + static calculePointsGuerison( potion ){ + return potion.system.herbebonus * potion.system.pr; } /* -------------------------------------------- */ static computeHerbeBonus( formData, herbesList, max) { - if ( Number(formData.data.herbebrins) ) { - let herbe = herbesList.find(item => item.name.toLowerCase() == formData.data.herbe.toLowerCase() ); + if ( Number(formData.system.herbebrins) ) { + let herbe = herbesList.find(item => item.name.toLowerCase() == formData.system.herbe.toLowerCase() ); if( herbe ) { - let herbeData = herbe.system; - let brinsBase = max - herbeData.niveau; - //console.log(herbeData, brinsBase, formData.data.herbebrins); - formData.data.herbebonus = Math.max(herbeData.niveau - Math.max(brinsBase - formData.data.herbebrins, 0), 0); + let brinsBase = max - herbe.system.niveau; + formData.system.herbebonus = Math.max(herbe.system.niveau - Math.max(brinsBase - formData.system.herbebrins, 0), 0); } } } diff --git a/module/rdd-possession.js b/module/rdd-possession.js index c2823230..e372d56d 100644 --- a/module/rdd-possession.js +++ b/module/rdd-possession.js @@ -159,7 +159,7 @@ export class RdDPossession { let possessionData = { name: "Possession en cours de " + attacker.name, type: 'possession', img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", - data: { description: "", typepossession: attacker.name, possede: false, possessionid: randomID(16), possesseurid: attacker.id, possedeid: defender.id, date: 0, compteur: 0 } + system: { description: "", typepossession: attacker.name, possede: false, possessionid: randomID(16), possesseurid: attacker.id, possedeid: defender.id, date: 0, compteur: 0 } } // Creates only the possession on the personnage side let poss = await defender.createEmbeddedDocuments('Item', [possessionData]) diff --git a/module/rdd-roll.js b/module/rdd-roll.js index 3d9abbd4..063a9c5a 100644 --- a/module/rdd-roll.js +++ b/module/rdd-roll.js @@ -166,7 +166,7 @@ export class RdDRoll extends Dialog { function onLoad() { let rollData = dialog.rollData; console.log('Ouverture RdDRoll', rollData); - // Update html, according to data + // Update html, according to rollData if (rollData.competence) { const defaut_carac = rollData.competence.system.defaut_carac // Set the default carac from the competence item diff --git a/module/rdd-sheet-utility.js b/module/rdd-sheet-utility.js index a4730081..1289aef1 100644 --- a/module/rdd-sheet-utility.js +++ b/module/rdd-sheet-utility.js @@ -21,17 +21,14 @@ export class RdDSheetUtility { } static prepareItemDropParameters(destItemId, actorId, dragData, objetVersConteneur) { - console.log("ID", dragData) const item = fromUuidSync(dragData.uuid) - let itemId = item.id - //const itemId = dragData.id || dragData.data._id return { destId: destItemId, targetActorId: actorId, - itemId: itemId, + itemId: item.id, sourceActorId: item.actor.id, - srcId: objetVersConteneur[itemId], - onEnleverConteneur: () => { delete objetVersConteneur[itemId]; }, + srcId: objetVersConteneur[item.id], + onEnleverConteneur: () => { delete objetVersConteneur[item.id]; }, onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; } } } @@ -47,10 +44,10 @@ export class RdDSheetUtility { static async _onSplitItem(item, split, actor) { if (split >= 1 && split < item.system.quantite) { await item.diminuerQuantite(split); - const itemData = duplicate(item); + const splitItem = duplicate(item); // todo: ajouter dans le même conteneur? - itemData.system.quantite = split; - await actor.createEmbeddedDocuments('Item', [itemData]) + splitItem.system.quantite = split; + await actor.createEmbeddedDocuments('Item', [splitItem]) } } } \ No newline at end of file diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 4ea8e43d..fce54383 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -267,7 +267,6 @@ export class RdDTMRDialog extends Dialog { if (ReglesOptionelles.isUsing("appliquer-fatigue")) { let fatigueItem = document.getElementById("tmr-fatigue-table"); - //console.log("Refresh : ", actorData.data.sante.fatigue.value); fatigueItem.innerHTML = "" + RdDUtility.makeHTMLfatigueMatrix(this.actor.system.sante.fatigue.value, this.actor.system.sante.endurance.max).html() + "
"; } } @@ -819,7 +818,7 @@ export class RdDTMRDialog extends Dialog { //this.updateSortReserve(); console.log("declencheSortEnReserve", sortReserve) this._tellToUserAndGM(`Vous avez déclenché le sort en réserve ${sortReserve.sort.name} - avec ${sortReserve.sort.system.ptreve_reel} points de Rêve + avec ${sortReserve.sort.data.ptreve_reel} points de Rêve en ${sortReserve.coord} (${TMRUtility.getTMRLabel(sortReserve.coord)}) `); this.close(); @@ -873,7 +872,6 @@ export class RdDTMRDialog extends Dialog { if (this.viewOnly) { return; } - let clickOddq = RdDTMRDialog._computeEventOddq(event.data.originalEvent); await this._onClickTMRPos(clickOddq); // Vérifier l'état des compteurs reve/fatigue/vie } diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index 25f662e8..f141caae 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -8,7 +8,7 @@ export class RdDTokenHud { static init() { // Integration du TokenHUD - Hooks.on('renderTokenHUD', (app, html, data) => { RdDTokenHud.addTokenHudExtensions(app, html, data._id) }); + Hooks.on('renderTokenHUD', (app, html, token) => { RdDTokenHud.addTokenHudExtensions(app, html, token._id) }); } /* -------------------------------------------- */ @@ -63,7 +63,7 @@ export class RdDTokenHud { const actionIndex = event.currentTarget.attributes['data-action-index']?.value; const action = actionsCombat[actionIndex]; if (action.action == 'conjurer') { - actor.conjurerPossession(actor.getPossession(action.data.possessionid)); + actor.conjurerPossession(actor.getPossession(action.system.possessionid)); } else { actor.rollArme(action); @@ -76,7 +76,7 @@ export class RdDTokenHud { case 'inc': return RdDCombatManager.incDecInit(combatantId, 0.01); case 'dec': return RdDCombatManager.incDecInit(combatantId, -0.01); case 'autre': return RdDCombatManager.rollInitiativeAction(combatantId, - { name: "Autre action", action: 'autre', data: { initOnly: true, competence: "Autre action" } }); + { name: "Autre action", action: 'autre', system: { initOnly: true, competence: "Autre action" } }); } } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index e732957a..991c7506 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -104,7 +104,7 @@ export class RdDUtility { /* -------------------------------------------- */ static async init() { Hooks.on("renderChatMessage", async (app, html, msg) => RdDUtility.onRenderChatMessage(app, html, msg)); - Hooks.on('renderChatLog', (log, html, data) => RdDUtility.chatListeners(html)); + Hooks.on('renderChatLog', (log, html, chatLog) => RdDUtility.chatListeners(html)); } /* -------------------------------------------- */ @@ -445,16 +445,16 @@ export class RdDUtility { /* -------------------------------------------- */ static calculEncContenu(conteneur, objets) { - const contenuDatas = (conteneur.system.contenu ?? []).filter(id => id != undefined) - .map(id => objets.find(it => (id == it._id))) + const contenus = (conteneur.system.contenu ?? []).filter(id => id != undefined) + .map(id => objets.find(it => (id == it.id))) .filter(it => it); let enc = Number(conteneur.system.encombrement ?? 0) * Number(conteneur.system.quantite ?? 1); - for (let itemData of contenuDatas) { - if (itemData.type == 'conteneur') { - enc += RdDUtility.calculEncContenu(itemData, objets); + for (let contenu of contenus) { + if (contenu.type == 'conteneur') { + enc += RdDUtility.calculEncContenu(contenu, objets); } else { - enc += Number(itemData.system.encombrement ?? 0) * Number(itemData.system.quantite ?? 1) + enc += Number(contenu.system.encombrement ?? 0) * Number(contenu.system.quantite ?? 1) } } return enc @@ -653,9 +653,9 @@ export class RdDUtility { } /* -------------------------------------------- */ - static async responseNombreAstral(data) { - let actor = game.actors.get(data.id); - actor.ajouteNombreAstral(data); + static async responseNombreAstral(callData) { + let actor = game.actors.get(callData.id); + actor.ajouteNombreAstral(callData); } /* -------------------------------------------- */ @@ -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.actorLink) { + if (token.actor) { return token.actor; } if (msgPlayer != undefined) { @@ -776,7 +776,7 @@ export class RdDUtility { static createMonnaie(name, valeur_deniers, img = "", enc = 0.01) { let piece = { name: name, type: 'monnaie', img: img, _id: randomID(16), - data: { + dasystemta: { quantite: 0, valeur_deniers: valeur_deniers, encombrement: enc, diff --git a/module/tmr-rencontres.js b/module/tmr-rencontres.js index 17a31038..eaeece96 100644 --- a/module/tmr-rencontres.js +++ b/module/tmr-rencontres.js @@ -468,10 +468,10 @@ export class TMRRencontres { } /* -------------------------------------------- */ - static async onPostEchecTourbillonRouge(tmrDialog, data) { - await data.actor.reveActuelIncDec(-2); // -2 pts de Reve a chaque itération - TMRRencontres._toubillonner(tmrDialog, data.actor, 4); - await data.actor.santeIncDec("vie", -1); // Et -1 PV + static async onPostEchecTourbillonRouge(tmrDialog, rencontre) { + await rencontre.actor.reveActuelIncDec(-2); // -2 pts de Reve a chaque itération + TMRRencontres._toubillonner(tmrDialog, rencontre.actor, 4); + await rencontre.actor.santeIncDec("vie", -1); // Et -1 PV } /* -------------------------------------------- */ diff --git a/module/tmr/draconique.js b/module/tmr/draconique.js index 6c8d53f4..460ea74d 100644 --- a/module/tmr/draconique.js +++ b/module/tmr/draconique.js @@ -9,11 +9,11 @@ const registeredEffects = [ * Définition des informations d'une "draconique" (queue, ombre, tête, souffle) qui influence les TMR */ export class Draconique { - static isCaseTMR(itemData) { return itemData.type == 'casetmr'; } - static isQueueDragon(itemData) { return itemData.type == 'queue' || itemData.type == 'ombre'; } - static isSouffleDragon(itemData) { return itemData.type == 'souffle'; } - static isTeteDragon(itemData) { return itemData.type == 'tete'; } - static isQueueSouffle(itemData) { return Draconique.isQueueDragon(itemData) || Draconique.isSouffleDragon(itemData); } + static isCaseTMR(item) { return item.type == 'casetmr'; } + static isQueueDragon(item) { return item.type == 'queue' || item.type == 'ombre'; } + static isSouffleDragon(item) { return item.type == 'souffle'; } + static isTeteDragon(item) { return item.type == 'tete'; } + static isQueueSouffle(item) { return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item); } tmrLabel(linkData) { return TMRUtility.getTMRLabel(linkData.system.coord); } @@ -38,8 +38,7 @@ export class Draconique { * @returns true si l'item correspond */ match(item) { - const itemData = item; - return Draconique.isQueueDragon(itemData) || Draconique.isSouffleDragon(itemData) || Draconique.isTeteDragon(itemData); + return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item) || Draconique.isTeteDragon(item); } /** diff --git a/module/tmr/effets-draconiques.js b/module/tmr/effets-draconiques.js index 9e4331b3..398ae930 100644 --- a/module/tmr/effets-draconiques.js +++ b/module/tmr/effets-draconiques.js @@ -112,7 +112,7 @@ export class EffetsDraconiques { } static filterItems(actor, filter, name) { - return actor.filter(filter) + return actor.filterItems(filter) .filter(it => Grammar.includesLowerCaseNoAccent(it.name, name)); } diff --git a/module/tmr/pixi-tmr.js b/module/tmr/pixi-tmr.js index a5f6cbbe..449d5bb6 100644 --- a/module/tmr/pixi-tmr.js +++ b/module/tmr/pixi-tmr.js @@ -25,7 +25,7 @@ export class PixiTMR { for (const [name, img] of Object.entries(PixiTMR.textures)) { loader = loader.add(name, img); } - loader.onLoad.add((error, reason) => { console.log("ERROR", error, reason) }); + loader.onError.add((error, reason) => { console.log("ERROR", error, reason) }); loader.load( (loader, resources) => { onLoad(loader, resources); for (let onAnimate of this.callbacksOnAnimate) { diff --git a/module/tmr/sort-reserve.js b/module/tmr/sort-reserve.js index 9005d0f1..1f632963 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.system.ptreve_reel}` } + tooltip(sort) { return `${sort.name}, r${sort.data.ptreve_reel}` } img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/scroll.webp' } createSprite(pixiTMR) { diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html index 5e26a5d6..a5974033 100644 --- a/templates/actor-creature-sheet.html +++ b/templates/actor-creature-sheet.html @@ -41,7 +41,7 @@
    - {{#each data.carac as |carac key|}} + {{#each system.carac as |carac key|}}
  1. {{#if (eq key 'taille')}} {{carac.label}} @@ -61,7 +61,7 @@
    - {{#each data.attributs as |attr key|}} + {{#each system.attributs as |attr key|}}
  1. {{attr.label}} @@ -70,20 +70,20 @@
  2. Vie - / - + / +
  3. Endurance - / - + / +
  4. Etat Général - +
@@ -134,12 +134,12 @@

Race

- +

Description

- {{editor data.description target="system.description" button=true owner=owner editable=true}} + {{editor system.description target="system.description" button=true owner=owner editable=true}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}} diff --git a/templates/actor-entite-sheet.html b/templates/actor-entite-sheet.html index d4297203..70554ec7 100644 --- a/templates/actor-entite-sheet.html +++ b/templates/actor-entite-sheet.html @@ -32,7 +32,7 @@
    - {{#each data.carac as |carac key|}} + {{#each system.carac as |carac key|}}
  1. {{#if (eq key 'taille')}} {{carac.label}} @@ -52,8 +52,8 @@
    1. Catégorie : - + {{#select system.definition.categorieentite}} {{/select}} @@ -61,15 +61,15 @@
    2. Type d'entité : - + {{#select system.definition.typeentite}} - + {{/select}}
    3. - {{#each data.attributs as |attr key|}} + {{#each system.attributs as |attr key|}}
    4. {{attr.label}} : Endurance : / + value="{{system.sante.endurance.value}}" data-dtype="Number" />/ + value="{{system.sante.endurance.max}}" data-dtype="Number" />
@@ -131,7 +131,7 @@ {{!-- Biography Tab --}}
- {{editor data.description target="system.description" button=true owner=owner editable=true}} + {{editor system.description target="system.description" button=true owner=owner editable=true}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}
diff --git a/templates/actor-liste-blessures-partial.html b/templates/actor-liste-blessures-partial.html index aad6f25d..2d106fed 100644 --- a/templates/actor-liste-blessures-partial.html +++ b/templates/actor-liste-blessures-partial.html @@ -13,15 +13,15 @@ Légères - {{#each data.blessures.legeres.liste as |bless key|}} + {{#each system.blessures.legeres.liste as |bless key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="legere" title="Légère"}} {{/each}} Graves - {{#each data.blessures.graves.liste as |bless key|}} + {{#each system.blessures.graves.liste as |bless key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="grave" title="Grave"}} {{/each}} Critiques - {{#each data.blessures.critiques.liste as |bless key|}} + {{#each system.blessures.critiques.liste as |bless key|}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-blessure-partial.html" bless=bless key=key gravite="critique" title="Critique"}} {{/each}} diff --git a/templates/actor-sheet-inventaire.html b/templates/actor-sheet-inventaire.html index c14600ae..89bf2d18 100644 --- a/templates/actor-sheet-inventaire.html +++ b/templates/actor-sheet-inventaire.html @@ -1,7 +1,7 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-inventaire-monnaie.html" monnaie=monnaie}}

Equipement

-Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{data.attributs.encombrement.value}} {{calc.surEncombrementMessage}} - +Encombrement total/max : {{numberFormat calc.encTotal decimals=2}} / {{system.attributs.encombrement.value}} {{calc.surEncombrementMessage}} - Créer un objet {{#if options.isGM}} - Vider tout les conteneurs diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 751df0a7..1b060de6 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -13,8 +13,8 @@ @@ -22,8 +22,8 @@ @@ -32,8 +32,8 @@ {{{calc.fatigue.html}}} Fatigue - - / {{data.sante.fatigue.max}} + + / {{system.sante.fatigue.max}} @@ -41,8 +41,8 @@ @@ -52,7 +52,7 @@ Encaisser des dommages Remise à neuf Se reposer - {{#if data.attributs.hautrevant.value}} + {{#if system.attributs.hautrevant.value}} Montée dans les Terres Médianes ! Montée accélérée dans les Terres Médianes ! Regarder les Terres Médianes @@ -65,8 +65,8 @@ {{calc.resumeBlessures}}
- {{data.compteurs.etat.label}}: {{data.compteurs.etat.value}} - {{data.compteurs.surenc.label}}: {{data.compteurs.surenc.value}} + {{system.compteurs.etat.label}}: {{system.compteurs.etat.value}} + {{system.compteurs.surenc.label}}: {{system.compteurs.surenc.value}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-effects-partial.html"}} @@ -100,7 +100,7 @@
    - {{#each data.carac as |carac key|}} + {{#each system.carac as |carac key|}} {{#if carac.isLevelUp}}
  • {{else}} @@ -149,10 +149,10 @@
    • Beauté : - +
    • - {{#each data.attributs as |attr key|}} + {{#each system.attributs as |attr key|}} {{#unless (eq key 'hautrevant')}}
    • {{attr.label}} : @@ -169,10 +169,10 @@
      • Chance actuelle - + Utiliser
      • - {{#each data.compteurs as |compteur key|}} + {{#each system.compteurs as |compteur key|}} {{#if (eq compteur.label 'Chance')}} {{else if (eq compteur.label 'Experience')}} {{else if compteur.isInput}} @@ -240,7 +240,7 @@ {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.tir) categorie="Compétences de Tir"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.lancer) categorie="Compétences de Lancer"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.connaissance) categorie="Connaissances"}} - {{#if (or data.attributs.hautrevant.value options.vueDetaillee)}} + {{#if (or system.attributs.hautrevant.value options.vueDetaillee)}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor-sheet-categorie-competences-partial.html" competences=(filtreTriCompetences competenceByCategory.draconic) categorie="Draconic"}} {{/if}} @@ -248,7 +248,7 @@
        • Stress transformé - +
        • @@ -444,13 +444,13 @@ {{!-- hautreve Tab --}}
          - {{#if data.attributs.hautrevant.value}} + {{#if system.attributs.hautrevant.value}}

          Haut rêvant

          {{else}}

          Vous n'avez pas le don de haut-rêve! Il faut attribuer la Tête de Dragon 'Don de Haut Rêve' si votre personnage est ou devient Haut-Rêvant.

          {{/if}}
            - {{#if data.attributs.hautrevant.value}} + {{#if system.attributs.hautrevant.value}} {{#if options.isGM}}
          • @@ -464,23 +464,23 @@
          • {{#if options.isGM}} Demi rêve : - {{caseTmr-label data.reve.tmrpos.coord}} + {{caseTmr-label system.reve.tmrpos.coord}} - + {{else}} Demi rêve : {{#unless hautreve.cacheTMR}} - {{caseTmr-label data.reve.tmrpos.coord}} + {{caseTmr-label system.reve.tmrpos.coord}} {{/unless}} {{#if hautreve.cacheTMR}} ?? {{else}} - {{data.reve.tmrpos.coord}} + {{system.reve.tmrpos.coord}} {{/if}} {{/if}} @@ -490,9 +490,9 @@ Seuil de Rêve : {{#if options.isGM}} - + {{else}} - {{data.reve.seuil.value}} + {{system.reve.seuil.value}} {{/if}}
          • @@ -500,9 +500,9 @@ Refoulement : {{#if options.isGM}} - + {{else}} - {{data.reve.refoulement.value}} + {{system.reve.refoulement.value}} {{/if}} @@ -562,7 +562,7 @@ {{/each}}
          {{/if}} - {{#if data.attributs.hautrevant.value}} + {{#if system.attributs.hautrevant.value}} {{#if (and options.isGM signesdraconiques.length)}}

          Signes draconiques

            @@ -676,50 +676,50 @@
            • - - + +
            • - - + +
            • - - + +
            • - - + +
            • - - + +
            • - - + +
            • - - + {{#select system.heure}} {{>"systems/foundryvtt-reve-de-dragon/templates/heures-select-option.html"}} {{/select}}
            • - +
            • - - + +
            • - - + +
            @@ -727,16 +727,16 @@

            Biographie :

            - {{editor data.biographie target="system.biographie" button=true owner=owner editable=editable}} + {{editor system.biographie target="system.biographie" button=true owner=owner editable=editable}}

            Notes :

            - {{editor data.notes target="system.notes" button=true owner=owner editable=editable}} + {{editor system.notes target="system.notes" button=true owner=owner editable=editable}}

            Journal d'Experience

              - {{#each data.experiencelog as |xp key|}} + {{#each system.experiencelog as |xp key|}}
            • diff --git a/templates/actor-vehicule-sheet.html b/templates/actor-vehicule-sheet.html index f50045dd..51c7126b 100644 --- a/templates/actor-vehicule-sheet.html +++ b/templates/actor-vehicule-sheet.html @@ -28,38 +28,38 @@
            • Catégorie
            • Résistance - +
            • Structure - +
            • Vitesse - +
            • Bonus - +
            • Manoeuvrabilité - +
            • Equipage - +
            • Capacité d'Encombrement - +
            @@ -75,7 +75,7 @@ {{!-- Biography Tab --}}
            - {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} + {{editor content=system.description target="system.description" button=true owner=owner editable=editable}}
            {{>"systems/foundryvtt-reve-de-dragon/templates/actor-sheet-editor-notes-mj.html"}}
            diff --git a/templates/chat-achat-item.html b/templates/chat-achat-item.html index 9b0540ed..142fc8f5 100644 --- a/templates/chat-achat-item.html +++ b/templates/chat-achat-item.html @@ -6,4 +6,4 @@ {{#if vendeur}}à {{vendeur.name}}{{/if}}: {{quantiteTotal}} {{item.name}} pour {{prixTotal}} sols.

            -{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" item.data}} +{{> "systems/foundryvtt-reve-de-dragon/templates/chat-description.html" item.system}} diff --git a/templates/chat-consommer-potion-generique.html b/templates/chat-consommer-potion-generique.html index 9898a038..0d8eb682 100644 --- a/templates/chat-consommer-potion-generique.html +++ b/templates/chat-consommer-potion-generique.html @@ -1,16 +1,16 @@ potion de repos

            - {{alias}} a bu une {{name}}{{#if data.magique}} enchantée{{/if}} + {{alias}} a bu une {{name}}{{#if system.magique}} enchantée{{/if}}


            - {{#if data.magique}} + {{#if system.magique}} Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}. {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{/if}}
            Les effets de la potions sont à gérer manuellement, en fonction de sa nature - {{#if data.magique}} - {{#if rolled.isEchec}}et de son enchantement ({{data.pr}} Points de Rêve) + {{#if system.magique}} + {{#if rolled.isEchec}}et de son enchantement ({{system.pr}} Points de Rêve) {{else}}son enchantement n'a pas d'effet {{/if}} {{/if}}. diff --git a/templates/chat-consommer-potion-repos.html b/templates/chat-consommer-potion-repos.html index 873a78c8..e8c37969 100644 --- a/templates/chat-consommer-potion-repos.html +++ b/templates/chat-consommer-potion-repos.html @@ -1,27 +1,27 @@ potion de repos

            - {{alias}} a bu une {{name}}{{#if data.magique}} enchantée{{/if}} + {{alias}} a bu une {{name}}{{#if system.magique}} enchantée{{/if}}


            - {{#if data.magique}} + {{#if system.magique}} Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}. {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{#if rolled.isEchec}}
            La potion fait effet ! {{alias}} a perdu 1 point de rêve et s'endort pour {{guerisonDureeValue}} {{guerisonDureeUnite}} et se récupère {{caseFatigueReel}} cases de fatigue.
            - {{#if data.reposalchimique}} + {{#if system.reposalchimique}} De plus, la potion étant alchimique, {{alias}} est en aphasie pendant cette durée. {{#if aphasiePermanente}} Malheureusement, l'aphasie est permanente tant que {{alias}} ne réussit pas un jet de VOLONTE à 0 à Chateau Dormant (le moral compte). {{/if}} {{/if}} {{else}} -
            La potion ne fait pas effet ! Elle vous octroie tout de même un bonus de {{data.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement). +
            La potion ne fait pas effet ! Elle vous octroie tout de même un bonus de {{system.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement). {{/if}} {{else}} - Une fois consommée (vers fin Lyre), elle vous octroie un bonus de {{data.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement). + Une fois consommée (vers fin Lyre), elle vous octroie un bonus de {{system.herbebonus}} segments de fatigue récupérés en plus à la fin de Chateau Dormant (à gérer manuellement). {{/if}}
            La potion a été supprimée de l'équipement.
            diff --git a/templates/chat-consommer-potion-soin.html b/templates/chat-consommer-potion-soin.html index ae429fe6..d691fc48 100644 --- a/templates/chat-consommer-potion-soin.html +++ b/templates/chat-consommer-potion-soin.html @@ -1,10 +1,10 @@ potion de soin

            - {{alias}} a bu une {{name}}{{#if data.magique}} enchantée{{/if}} + {{alias}} a bu une {{name}}{{#if system.magique}} enchantée{{/if}}


            - {{#if data.magique}} + {{#if system.magique}} Le Jet de Résistance est {{#if rolled.isSuccess}}réussi{{else}}échoué{{/if}}. {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{#if rolled.isEchec}} @@ -16,10 +16,10 @@ {{/each}}
          {{else}} -
          La potion ne fait pas effet ! Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{data.herbebonus}} (appliqué automatiquement). +
          La potion ne fait pas effet ! Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{system.herbebonus}} (appliqué automatiquement). {{/if}} {{else}} - Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{data.herbebonus}} (appliqué automatiquement). + Lors de votre prochain jet de récupération à Chateau Dormant, vous bénéficierez d'un bonus de {{system.herbebonus}} (appliqué automatiquement). {{/if}}
          La potion a été supprimée de l'équipement.
          diff --git a/templates/dialog-fabriquer-potion-base.html b/templates/dialog-fabriquer-potion-base.html index af4dbc4e..6ad04035 100644 --- a/templates/dialog-fabriquer-potion-base.html +++ b/templates/dialog-fabriquer-potion-base.html @@ -1,6 +1,6 @@
          - +
          diff --git a/templates/dialog-roll-jeu.html b/templates/dialog-roll-jeu.html index 52cf6413..1c74d5e3 100644 --- a/templates/dialog-roll-jeu.html +++ b/templates/dialog-roll-jeu.html @@ -19,7 +19,7 @@
          - {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}} + {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
          diff --git a/templates/dialog-roll-musique.html b/templates/dialog-roll-musique.html index e0cb231f..f435998b 100644 --- a/templates/dialog-roll-musique.html +++ b/templates/dialog-roll-musique.html @@ -8,7 +8,7 @@
- {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}} + {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}} diff --git a/templates/dialog-roll-recettecuisine.html b/templates/dialog-roll-recettecuisine.html index 5a03c1ab..52d113f8 100644 --- a/templates/dialog-roll-recettecuisine.html +++ b/templates/dialog-roll-recettecuisine.html @@ -32,7 +32,7 @@
- {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.data}} + {{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
diff --git a/templates/item-arme-sheet.html b/templates/item-arme-sheet.html index 6a80029d..c6e27293 100644 --- a/templates/item-arme-sheet.html +++ b/templates/item-arme-sheet.html @@ -9,85 +9,85 @@ {{!-- Sheet Body --}}
- - + {{#select system.competence}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence.html"}} {{/select}}
- - + +
- - + +
- - + {{#select system.categorie_parade}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-parade.html"}} {{/select}}
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + +
- - + {{#select system.initpremierround}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-initpremierround.html"}} {{/select}} diff --git a/templates/item-armure-sheet.html b/templates/item-armure-sheet.html index b7a3dca8..5bb8e062 100644 --- a/templates/item-armure-sheet.html +++ b/templates/item-armure-sheet.html @@ -10,23 +10,23 @@
- +
- +
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-casetmr-sheet.html b/templates/item-casetmr-sheet.html index d49735b4..7f6216c3 100644 --- a/templates/item-casetmr-sheet.html +++ b/templates/item-casetmr-sheet.html @@ -10,12 +10,12 @@
- +
- + {{#select system.specific}} {{>"systems/foundryvtt-reve-de-dragon/templates/casetmr-specific-list.html"}} {{/select}} diff --git a/templates/item-chant-sheet.html b/templates/item-chant-sheet.html index b02c7cae..c854406a 100644 --- a/templates/item-chant-sheet.html +++ b/templates/item-chant-sheet.html @@ -10,11 +10,11 @@
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-competence-sheet.html b/templates/item-competence-sheet.html index d215aa56..085a4386 100644 --- a/templates/item-competence-sheet.html +++ b/templates/item-competence-sheet.html @@ -17,52 +17,52 @@
- +
- +
{{#if isGM}} {{else}} - + {{/if}}
- +
- {{#if (eq data.categorie 'draconic')}} + {{#if (eq system.categorie 'draconic')}}
- +
{{/if}}
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-competencecreature-sheet.html b/templates/item-competencecreature-sheet.html index 805a72cd..174fd57b 100644 --- a/templates/item-competencecreature-sheet.html +++ b/templates/item-competencecreature-sheet.html @@ -10,39 +10,39 @@
- +
- +
- +
- +
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-conteneur-sheet.html b/templates/item-conteneur-sheet.html index ff3b15f7..f0621121 100644 --- a/templates/item-conteneur-sheet.html +++ b/templates/item-conteneur-sheet.html @@ -10,19 +10,19 @@
- +
- +
- +
- +
{{#if isOwned}}
diff --git a/templates/item-danse-sheet.html b/templates/item-danse-sheet.html index 638a9fc2..956dd877 100644 --- a/templates/item-danse-sheet.html +++ b/templates/item-danse-sheet.html @@ -11,7 +11,7 @@
+
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-gemme-sheet.html b/templates/item-gemme-sheet.html index d82222ed..79b45b3d 100644 --- a/templates/item-gemme-sheet.html +++ b/templates/item-gemme-sheet.html @@ -11,42 +11,42 @@
- +
- +
- +
- +
- +
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-herbe-sheet.html b/templates/item-herbe-sheet.html index b9bf1756..e8190788 100644 --- a/templates/item-herbe-sheet.html +++ b/templates/item-herbe-sheet.html @@ -16,24 +16,24 @@
- +
- +
- +
- +
@@ -41,7 +41,7 @@
diff --git a/templates/item-ingredient-sheet.html b/templates/item-ingredient-sheet.html index 4260724d..27b6d7e7 100644 --- a/templates/item-ingredient-sheet.html +++ b/templates/item-ingredient-sheet.html @@ -11,29 +11,29 @@
- +
- +
- +
- +
- +
@@ -41,7 +41,7 @@
diff --git a/templates/item-jeu-sheet.html b/templates/item-jeu-sheet.html index 653d4f4b..9b2bb091 100644 --- a/templates/item-jeu-sheet.html +++ b/templates/item-jeu-sheet.html @@ -11,7 +11,7 @@
+
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-livre-sheet.html b/templates/item-livre-sheet.html index 64994774..9a940f3d 100644 --- a/templates/item-livre-sheet.html +++ b/templates/item-livre-sheet.html @@ -15,12 +15,12 @@
- +
+
- +
- +
- +
- +
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-maladie-sheet.html b/templates/item-maladie-sheet.html index 1eb70e3d..0f8049ca 100644 --- a/templates/item-maladie-sheet.html +++ b/templates/item-maladie-sheet.html @@ -2,7 +2,7 @@
- {{#if (or isGM data.identifie)}} + {{#if (or isGM system.identifie)}}

{{else}}

Inconnue

@@ -12,31 +12,31 @@ {{!-- Sheet Body --}}
- {{#if (or isGM data.identifie)}} + {{#if (or isGM system.identifie)}}
- +
- +
- +
- +
- +
- {{#if (or isGM data.remedesconnus)}} + {{#if (or isGM system.remedesconnus)}}
- +
{{/if}} {{/if}} diff --git a/templates/item-meditation-sheet.html b/templates/item-meditation-sheet.html index f308665e..48cd1b5d 100644 --- a/templates/item-meditation-sheet.html +++ b/templates/item-meditation-sheet.html @@ -11,7 +11,7 @@
+
- +
- +
- +
- +
@@ -58,7 +58,7 @@ {{#if isGM}} {{else}} - + {{/if}}
diff --git a/templates/item-monnaie-sheet.html b/templates/item-monnaie-sheet.html index 83f80417..246d35d8 100644 --- a/templates/item-monnaie-sheet.html +++ b/templates/item-monnaie-sheet.html @@ -10,19 +10,19 @@
- +
{{#if isGM}} - + {{else}} - + {{/if}}
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-munition-sheet.html b/templates/item-munition-sheet.html index 754c2fa5..723ed15c 100644 --- a/templates/item-munition-sheet.html +++ b/templates/item-munition-sheet.html @@ -10,19 +10,19 @@
- +
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-musique-sheet.html b/templates/item-musique-sheet.html index 444bb1c0..b49496b8 100644 --- a/templates/item-musique-sheet.html +++ b/templates/item-musique-sheet.html @@ -10,11 +10,11 @@
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-nombreastral-sheet.html b/templates/item-nombreastral-sheet.html index 7bd827d6..86f8a9a0 100644 --- a/templates/item-nombreastral-sheet.html +++ b/templates/item-nombreastral-sheet.html @@ -10,19 +10,19 @@
- +
- +
- +
- +
diff --git a/templates/item-nourritureboisson-sheet.html b/templates/item-nourritureboisson-sheet.html index f0951c62..c19bb669 100644 --- a/templates/item-nourritureboisson-sheet.html +++ b/templates/item-nourritureboisson-sheet.html @@ -9,49 +9,49 @@ {{!-- Sheet Body --}}
- - + +
- - + +
- {{#if data.boisson}} + {{#if system.boisson}}
- - + +
- - + +
- {{#if data.alcoolise}} + {{#if system.alcoolise}}
- +
{{/if}} {{/if}}
- - + +
- - + +
- - Encombrement +
- - + +
- - + +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-objet-sheet.html b/templates/item-objet-sheet.html index f86683f5..7d812a86 100644 --- a/templates/item-objet-sheet.html +++ b/templates/item-objet-sheet.html @@ -10,23 +10,23 @@
- +
- +
- +
- +
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-oeuvre-sheet.html b/templates/item-oeuvre-sheet.html index e0079929..5a7d2d26 100644 --- a/templates/item-oeuvre-sheet.html +++ b/templates/item-oeuvre-sheet.html @@ -11,7 +11,7 @@
@@ -19,7 +19,7 @@
+
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-ombre-sheet.html b/templates/item-ombre-sheet.html index f79c3130..663b6373 100644 --- a/templates/item-ombre-sheet.html +++ b/templates/item-ombre-sheet.html @@ -10,7 +10,7 @@
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-poison-sheet.html b/templates/item-poison-sheet.html index 312802c6..d25ee4c8 100644 --- a/templates/item-poison-sheet.html +++ b/templates/item-poison-sheet.html @@ -2,7 +2,7 @@
- {{#if (or isGM data.identifie)}} + {{#if (or isGM system.identifie)}}

{{else}}

Inconnue

@@ -14,33 +14,33 @@
- +
- {{#if (or isGM data.identifie)}} + {{#if (or isGM system.identifie)}}
- +
- +
- +
- +
- +
- {{#if (or isGM data.remedesconnus)}} + {{#if (or isGM system.remedesconnus)}}
- +
{{/if}} {{/if}} diff --git a/templates/item-possession-sheet.html b/templates/item-possession-sheet.html index 4a13aa17..8676271f 100644 --- a/templates/item-possession-sheet.html +++ b/templates/item-possession-sheet.html @@ -10,15 +10,15 @@
- +
- +
- +
diff --git a/templates/item-potion-sheet.html b/templates/item-potion-sheet.html index 62feb46d..7e6847f1 100644 --- a/templates/item-potion-sheet.html +++ b/templates/item-potion-sheet.html @@ -15,20 +15,20 @@
- +
- +
- +
@@ -36,7 +36,7 @@
@@ -45,46 +45,46 @@
- +
- +
{{/if}} {{#if isRepos}}
- +
- +
- +
{{/if}} - {{#if data.magique}} + {{#if system.magique}}
- +
- +
{{#if isHerbe}}
diff --git a/templates/item-queue-sheet.html b/templates/item-queue-sheet.html index f79c3130..663b6373 100644 --- a/templates/item-queue-sheet.html +++ b/templates/item-queue-sheet.html @@ -10,7 +10,7 @@
- +
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-recettealchimique-sheet.html b/templates/item-recettealchimique-sheet.html index d0f46e85..b0149575 100644 --- a/templates/item-recettealchimique-sheet.html +++ b/templates/item-recettealchimique-sheet.html @@ -10,30 +10,30 @@
- +
- {{editor data.manipulation_update target="system.manipulation" button=true owner=owner editable=editable}} + {{editor system.manipulation_update target="system.manipulation" button=true owner=owner editable=editable}}
- {{editor data.utilisation target="system.utilisation" button=true owner=owner editable=editable}} + {{editor system.utilisation target="system.utilisation" button=true owner=owner editable=editable}}
- {{editor data.enchantement target="system.enchantement" button=true owner=owner editable=editable}} + {{editor system.enchantement target="system.enchantement" button=true owner=owner editable=editable}}
- {{editor data.sureffet target="system.sureffet" button=true owner=owner editable=editable}} + {{editor system.sureffet target="system.sureffet" button=true owner=owner editable=editable}}
diff --git a/templates/item-recettecuisine-sheet.html b/templates/item-recettecuisine-sheet.html index 944580a0..5db2f1f4 100644 --- a/templates/item-recettecuisine-sheet.html +++ b/templates/item-recettecuisine-sheet.html @@ -10,28 +10,28 @@
- +
- +
system
- +
- +
- +
- {{editor data.ingredients target="system.ingredients" button=true owner=owner editable=editable}} + {{editor system.ingredients target="system.ingredients" button=true owner=owner editable=editable}}
diff --git a/templates/item-sheet.html b/templates/item-sheet.html index 76b83b11..c49fe411 100644 --- a/templates/item-sheet.html +++ b/templates/item-sheet.html @@ -5,11 +5,11 @@

- +
- +
@@ -25,7 +25,7 @@ {{!-- Description Tab --}}
- {{editor data.description target="system.description" button=true owner=owner editable=editable}} + {{editor system.description target="system.description" button=true owner=owner editable=editable}}
{{!-- Attributes Tab --}} @@ -39,7 +39,7 @@
    - {{#each data.attributes as |attr key|}} + {{#each system.attributes as |attr key|}}
  1. {{#if attr.isCheckbox}} diff --git a/templates/item-signedraconique-sheet.html b/templates/item-signedraconique-sheet.html index 985dc6ba..faccb23f 100644 --- a/templates/item-signedraconique-sheet.html +++ b/templates/item-signedraconique-sheet.html @@ -10,31 +10,31 @@ {{!-- Sheet Body --}}
    - - Difficulte +
    - +
    + value="{{system.valeur.norm}}" min="1" max="100" data-dtype="Number" /> Sign. + value="{{system.valeur.sign}}" min="1" max="100" data-dtype="Number" /> Part. + value="{{system.valeur.part}}" min="1" max="100" data-dtype="Number" />
    - - + +
    - {{#if data.ephemere}} + {{#if system.ephemere}}
    - - + +
    {{/if}}
    diff --git a/templates/item-sort-sheet.html b/templates/item-sort-sheet.html index b9dd8774..7edd1940 100644 --- a/templates/item-sort-sheet.html +++ b/templates/item-sort-sheet.html @@ -11,7 +11,7 @@
    @@ -19,7 +19,7 @@
    +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    {{#if owner}} {{#each bonusCaseList as |bcData key|}} diff --git a/templates/item-tache-sheet.html b/templates/item-tache-sheet.html index 0bf36919..e0455353 100644 --- a/templates/item-tache-sheet.html +++ b/templates/item-tache-sheet.html @@ -11,7 +11,7 @@
    - {{#select data.competence}} + {{#select system.competence}} {{#each competences as |competence key|}} {{/each}} @@ -30,24 +30,24 @@
    - +
    - +
    - +
    {{#if isGM}}
    - +
    - +
    {{else}}
    @@ -55,22 +55,22 @@ {{#if system.cacher_points_de_tache}} {{else}} - + {{/if}}
    {{/if}}
    - +
    - +
    - +
    {{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}} diff --git a/templates/item-tarot-sheet.html b/templates/item-tarot-sheet.html index ad0aa08b..5e2ab701 100644 --- a/templates/item-tarot-sheet.html +++ b/templates/item-tarot-sheet.html @@ -11,12 +11,12 @@
    - +
    diff --git a/templates/partial-item-description.html b/templates/partial-item-description.html index 8e77ad41..cc30d1f6 100644 --- a/templates/partial-item-description.html +++ b/templates/partial-item-description.html @@ -1,14 +1,14 @@
    - {{editor data.description target="system.description" button=true owner=owner editable=editable}} + {{editor system.description target="system.description" button=true owner=owner editable=editable}}
    {{#if isGM}}
    - {{editor data.descriptionmj target="system.descriptionmj" button=true owner=owner editable=editable}} + {{editor system.descriptionmj target="system.descriptionmj" button=true owner=owner editable=editable}}
    {{/if}} \ No newline at end of file diff --git a/templates/post-item.html b/templates/post-item.html index 57ef44aa..380dcdcc 100644 --- a/templates/post-item.html +++ b/templates/post-item.html @@ -4,7 +4,7 @@ {{/if}} -

    {{{data.description}}}

    +

    {{{system.description}}}

    {{#each properties as |property p|}} {{{property}}}