From aefc7a434b2492831d86f3b799ec9dba042b96ac Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 9 Dec 2022 01:58:06 +0100 Subject: [PATCH] Fix: lien vers rencontre du compendium --- module/rdd-tmr-dialog.js | 1 - module/tmr-rencontres.js | 12 +++++++----- templates/chat-compendium-table-roll-rencontre.html | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 341191ca..368bcdd3 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -5,7 +5,6 @@ import { TMRUtility } from "./tmr-utility.js"; import { tmrConstants } from "./tmr-constants.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDTMRRencontreDialog } from "./rdd-tmr-rencontre-dialog.js"; -import { TMRRencontres } from "./tmr-rencontres.js"; import { ChatUtility } from "./chat-utility.js"; import { RdDRoll } from "./rdd-roll.js"; import { Poetique } from "./poetique.js"; diff --git a/module/tmr-rencontres.js b/module/tmr-rencontres.js index 0bbe46b3..2c7e6163 100644 --- a/module/tmr-rencontres.js +++ b/module/tmr-rencontres.js @@ -100,19 +100,21 @@ export class TMRRencontres { const row = await this.table.getRandom(frequence, filtreMauvaise); if (row) { - row.document = this.createRencontre(row.document, tmr); - await this.$chatRolledRencontre(row, tmr); + const rencontre = await this.createRencontre(row.document, tmr); + await this.$chatRolledRencontre(row, rencontre, tmr); + return rencontre; } - return row?.document; + return undefined; } /* -------------------------------------------- */ - async $chatRolledRencontre(row, tmr) { + async $chatRolledRencontre(row, rencontre,tmr) { const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table-roll-rencontre.html', { roll: row.roll, - rencontre: row?.document, + rencontre, + row, percentages: (row.total == 100) ? '%' : '', tmr, isGM: game.user.isGM, diff --git a/templates/chat-compendium-table-roll-rencontre.html b/templates/chat-compendium-table-roll-rencontre.html index 2b724e95..3e9991e9 100644 --- a/templates/chat-compendium-table-roll-rencontre.html +++ b/templates/chat-compendium-table-roll-rencontre.html @@ -1,11 +1,11 @@ {{rencontre.name}}

{{#if mauvaise}}Mauvaise rencontre{{else}}Rencontre{{/if}} en {{typeTmr-name tmr.type}}

-
{{rencontre.pack}}
-
Jet: {{roll.formula}} : {{roll.total}}{{percentages}}
+
{{row.document.pack}}
+
Jet: {{row.roll.formula}} : {{row.roll.total}}{{percentages}}

-

{{rencontre.name}} {{rencontre.system.force}} ({{rencontre.system.formule}})

-

{{linkCompendium rencontre.pack rencontre.id rencontre.name}}

+

{{rencontre.name}} de force {{rencontre.system.force}} ({{rencontre.system.formule}})

+

{{linkCompendium row.document.pack row.document.id row.document.name}}

{{#if rencontre.system.description}}
{{{rencontre.system.description}}}