From e19577eab23b6e2523591029124ceb57b7f6b3ea Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 31 May 2024 21:48:19 +0200 Subject: [PATCH] Fix for v12 --- icons/heures/.directory | 4 ++++ module/actor.js | 2 +- module/coeur/rdd-coeur.js | 4 ++-- module/constants.js | 22 +++++++++++++++++++++- module/item/blessure.js | 2 +- module/rdd-combat.js | 2 +- module/rdd-dice.js | 4 ++-- module/rdd-meteo.js | 6 +++--- module/rdd-utility.js | 10 +++++++++- templates/common/periodicite.hbs | 4 +--- templates/common/timestamp.hbs | 8 ++------ templates/item/partial-environnement.html | 4 +--- templates/settings/system-compendiums.html | 2 +- templates/sommeil/astrologie-joueur.hbs | 12 ++---------- 14 files changed, 51 insertions(+), 35 deletions(-) create mode 100644 icons/heures/.directory diff --git a/icons/heures/.directory b/icons/heures/.directory new file mode 100644 index 00000000..b4267c5c --- /dev/null +++ b/icons/heures/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2024,5,29,20,57,41.954 +Version=4 +VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails diff --git a/module/actor.js b/module/actor.js index 962c2b5d..653d6e20 100644 --- a/module/actor.js +++ b/module/actor.js @@ -902,7 +902,7 @@ export class RdDActor extends RdDBaseActorSang { async ajouterRefoulement(value = 1, refouler) { let refoulement = this.system.reve.refoulement.value + value; const roll = new Roll("1d20"); - await roll.evaluate({ async: true }); + await roll.evaluate(); await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` }); if (roll.total <= refoulement) { refoulement = 0; diff --git a/module/coeur/rdd-coeur.js b/module/coeur/rdd-coeur.js index 38b24863..4b85988f 100644 --- a/module/coeur/rdd-coeur.js +++ b/module/coeur/rdd-coeur.js @@ -117,8 +117,8 @@ export class RdDCoeur { } ChatUtility.removeChatMessageId(infoCoeur.chatMessageId) - infoCoeur.target.jetTendre = (await (new Roll('1d6').evaluate({ async: true }))).total - infoCoeur.source.jetTendre = (await (new Roll('1d6').evaluate({ async: true }))).total + infoCoeur.target.jetTendre = (await (new Roll('1d6').evaluate())).total + infoCoeur.source.jetTendre = (await (new Roll('1d6').evaluate())).total const diff = Math.abs(infoCoeur.source.jetTendre - infoCoeur.target.jetTendre) for (let amoureux of [infoCoeur.source, infoCoeur.target]) { const actorAmoureux = game.actors.get(amoureux.actor.id); diff --git a/module/constants.js b/module/constants.js index cd4bb47e..a930be62 100644 --- a/module/constants.js +++ b/module/constants.js @@ -29,5 +29,25 @@ export const RDD_CONFIG = { "incarne": "Incarnée", "nonincarne": "Non Incarnée", "blurette": "Blurette" - } + }, + heuresRdD : [ + {value : "vaisseau", label: "Vaisseau", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd01.webp"}, + {value : "sirene", label: "Sirène", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd02.webp"}, + {value : "faucon", label: "Faucon", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd03.webp"}, + {value : "couronne", label: "Couronne", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd04.webp"}, + {value : "dragon", label: "Dragon", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd05.webp"}, + {value : "epees", label: "Epées", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd06.webp"}, + {value : "lyre", label: "Lyre", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd07.webp"}, + {value : "serpent", label: "Serpent", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd08.webp"}, + {value : "poissonacrobate", label: "Poisson Acrobate", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd09.webp"}, + {value : "araignee", label: "Araignée", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd10.webp"}, + {value : "roseau", label: "Roseau", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd11.webp"}, + {value : "chateaudormant", label: "Chateau Dormant", img: "modules/foundryvtt-reve-de-dragon/icons/heures/hd12.webp"} + ], + raretes: [ + {value: "Commune", label: "Commune"}, + {value: "Frequente", label: "Fréquente"}, + {value: "Rare", label: "Rare"}, + {value: "Rarissime", label: "Rarissime"} + ] } \ No newline at end of file diff --git a/module/item/blessure.js b/module/item/blessure.js index 142d40c5..f35a013e 100644 --- a/module/item/blessure.js +++ b/module/item/blessure.js @@ -48,7 +48,7 @@ export class RdDItemBlessure extends RdDItem { let lostEndurance = 0 let lostVie = 0 if (definition.endurance) { - lostEndurance = new Roll(definition.endurance).roll({async: false}).total; + lostEndurance = await new Roll(definition.endurance).roll().total; actor.santeIncDec("endurance", -Number(lostEndurance)); } if (definition.vie) { diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 771a9f76..444dd378 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -119,7 +119,7 @@ export class RdDCombatManager extends Combat { //console.log("Combatat", c); const roll = combatant.getInitiativeRoll(rollFormula); if (!roll.total) { - roll.evaluate({ async: false }); + await roll.evaluate(); } const total = Math.max(roll.total, 0.00); console.log("Compute init for", rollFormula, roll, total, combatant); diff --git a/module/rdd-dice.js b/module/rdd-dice.js index e9f9dcc2..efc5dbd3 100644 --- a/module/rdd-dice.js +++ b/module/rdd-dice.js @@ -138,7 +138,7 @@ export class RdDDice { static async roll(formula, options = { showDice: SHOW_DICE, rollMode: undefined }) { const roll = new Roll(RdDDice._formulaOrFake(formula, options)); - await roll.evaluate({ async: true }); + await roll.evaluate(); await this.showDiceSoNice(roll, options); return roll; } @@ -216,7 +216,7 @@ export class RdDDice { static async fakeD10(faces) { let roll = new Roll(`1d${faces}`); - await roll.evaluate({ async: true }); + await roll.evaluate(); return roll.total; } diff --git a/module/rdd-meteo.js b/module/rdd-meteo.js index 8dbff49c..8a705747 100644 --- a/module/rdd-meteo.js +++ b/module/rdd-meteo.js @@ -56,7 +56,7 @@ const temperatures = [ export class RdDMeteo { static async getForce() { const roll = new Roll(`1dr`); - await roll.evaluate({ async: true }); + await roll.evaluate(); return roll.total; } @@ -67,14 +67,14 @@ export class RdDMeteo { static async getTemperature() { const degre = await RdDMeteo.getForce(); const rollChaudFroid = new Roll('1d2'); - await rollChaudFroid.evaluate({ async: true }); + await rollChaudFroid.evaluate(); const chaudFroid = rollChaudFroid.total == 1; return chaudFroid.total ? degre : -degre; } static async getDirection(direction) { const roll = new Roll(`1d16`); - await roll.evaluate({ async: true }); + await roll.evaluate(); switch (roll.total % 16) { case 0: return 'Nord'; case 1: return 'Nord Nord Est'; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 35e50a5d..c7032a42 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -300,6 +300,14 @@ export class RdDUtility { Handlebars.registerHelper('plusMoins', diff => (diff > 0 ? '+' : '') + Math.round(diff)) Handlebars.registerHelper('experienceLog-topic', topic => ExperienceLog.labelTopic(topic)); + // Handle v12 removal of this helper + Handlebars.registerHelper('select', function (selected, options) { + const escapedValue = RegExp.escape(Handlebars.escapeExpression(selected)); + const rgx = new RegExp(' value=[\"\']' + escapedValue + '[\"\']'); + const html = options.fn(this); + return html.replace(rgx, "$& selected"); + }); + return loadTemplates(templatePaths); } @@ -624,7 +632,7 @@ export class RdDUtility { /* -------------------------------------------- */ static async _evaluatePerte(formula, over20) { let perte = new Roll(formula, { over20: over20 }); - await perte.evaluate({ async: true }); + await perte.evaluate(); return perte.total; } diff --git a/templates/common/periodicite.hbs b/templates/common/periodicite.hbs index ff23675a..48355430 100644 --- a/templates/common/periodicite.hbs +++ b/templates/common/periodicite.hbs @@ -2,8 +2,6 @@
diff --git a/templates/common/timestamp.hbs b/templates/common/timestamp.hbs index 0b2e2dfd..058bf90c 100644 --- a/templates/common/timestamp.hbs +++ b/templates/common/timestamp.hbs @@ -6,9 +6,7 @@ type="number" data-dtype="Number" min="1" max="28" name="{{path}}.jourDuMois" value="{{jourDuMois}}" /> {{timestamp-imgSigne mois}} @@ -17,9 +15,7 @@ {{timestamp-imgSigne heure}} diff --git a/templates/item/partial-environnement.html b/templates/item/partial-environnement.html index a424e266..a3e905be 100644 --- a/templates/item/partial-environnement.html +++ b/templates/item/partial-environnement.html @@ -26,9 +26,7 @@ {{rangePicker name="milieu-{{key}}-frequence" value=env.frequence min=(rarete-getChamp env.rarete 'min') max=(rarete-getChamp env.rarete 'max') step=1}} diff --git a/templates/settings/system-compendiums.html b/templates/settings/system-compendiums.html index 74e85cd3..fa976734 100644 --- a/templates/settings/system-compendiums.html +++ b/templates/settings/system-compendiums.html @@ -3,7 +3,7 @@ {{#each systemCompendiums as |definition key|}}
  • - {{#select definition.value}} {{#each @root.availableCompendiums as |available key|}} {{#if (eq available.type definition.type)}} diff --git a/templates/sommeil/astrologie-joueur.hbs b/templates/sommeil/astrologie-joueur.hbs index 324ba610..c6f37b02 100644 --- a/templates/sommeil/astrologie-joueur.hbs +++ b/templates/sommeil/astrologie-joueur.hbs @@ -1,19 +1,11 @@