Fix: lien vers rencontre du compendium

This commit is contained in:
Vincent Vandemeulebrouck 2022-12-09 01:58:06 +01:00
parent f02959adee
commit aefc7a434b
3 changed files with 11 additions and 10 deletions

View File

@ -5,7 +5,6 @@ import { TMRUtility } from "./tmr-utility.js";
import { tmrConstants } from "./tmr-constants.js"; import { tmrConstants } from "./tmr-constants.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDTMRRencontreDialog } from "./rdd-tmr-rencontre-dialog.js"; import { RdDTMRRencontreDialog } from "./rdd-tmr-rencontre-dialog.js";
import { TMRRencontres } from "./tmr-rencontres.js";
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { RdDRoll } from "./rdd-roll.js"; import { RdDRoll } from "./rdd-roll.js";
import { Poetique } from "./poetique.js"; import { Poetique } from "./poetique.js";

View File

@ -100,19 +100,21 @@ export class TMRRencontres {
const row = await this.table.getRandom(frequence, filtreMauvaise); const row = await this.table.getRandom(frequence, filtreMauvaise);
if (row) { if (row) {
row.document = this.createRencontre(row.document, tmr); const rencontre = await this.createRencontre(row.document, tmr);
await this.$chatRolledRencontre(row, 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', const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table-roll-rencontre.html',
{ {
roll: row.roll, roll: row.roll,
rencontre: row?.document, rencontre,
row,
percentages: (row.total == 100) ? '%' : '', percentages: (row.total == 100) ? '%' : '',
tmr, tmr,
isGM: game.user.isGM, isGM: game.user.isGM,

View File

@ -1,11 +1,11 @@
<img class="chat-icon" src="{{rencontre.img}}" alt="{{rencontre.name}}" /> <img class="chat-icon" src="{{rencontre.img}}" alt="{{rencontre.name}}" />
<h4>{{#if mauvaise}}Mauvaise rencontre{{else}}Rencontre{{/if}} en {{typeTmr-name tmr.type}}</h4> <h4>{{#if mauvaise}}Mauvaise rencontre{{else}}Rencontre{{/if}} en {{typeTmr-name tmr.type}}</h4>
<div>{{rencontre.pack}}</div> <div>{{row.document.pack}}</div>
<div>Jet: {{roll.formula}} : {{roll.total}}{{percentages}}</div> <div>Jet: {{row.roll.formula}} : {{row.roll.total}}{{percentages}}</div>
<hr> <hr>
<div> <div>
<p>{{rencontre.name}} {{rencontre.system.force}} ({{rencontre.system.formule}})</p> <p>{{rencontre.name}} de force {{rencontre.system.force}} ({{rencontre.system.formule}})</p>
<p>{{linkCompendium rencontre.pack rencontre.id rencontre.name}}</p> <p>{{linkCompendium row.document.pack row.document.id row.document.name}}</p>
{{#if rencontre.system.description}} {{#if rencontre.system.description}}
<div class="poesie-extrait"> <div class="poesie-extrait">
{{{rencontre.system.description}}} {{{rencontre.system.description}}}