From 8406c8434ae00de0b2768a17cf553f0406bb299d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 13 Jan 2025 19:24:21 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20lien=20jets=20de=20d=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - les boutons pour envoyer dans le tchat sont affichés - les jets de carac utilisent bien les compétences et difficulté --- module/apps/rdd-text-roll-editor.js | 8 ++++---- module/apps/textroll/text-roll-carac-competence.js | 5 ++++- .../apps/textroll/link-text-roll-carac-competence.hbs | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/module/apps/rdd-text-roll-editor.js b/module/apps/rdd-text-roll-editor.js index 1cadfbfa..33463eca 100644 --- a/module/apps/rdd-text-roll-editor.js +++ b/module/apps/rdd-text-roll-editor.js @@ -9,16 +9,17 @@ import { TextRollManager } from "./textroll/text-roll-formatter.js"; const TEXT_ROLL_MANAGERS = [ new TextRollAlchimie(), new TextRollCaracCompetence(), - new TextRollFormula()]; + new TextRollFormula()] export class RdDTextEditor { static registerChatCallbacks(html) { html.on("click", '.roll-text', async event => await RdDTextEditor.rollText(event)) } - static async enrichHTML(text, object, options = {}) { + static async enrichHTML(text, object, options = {showlink:true}) { const context = { - text, object, + text, + object, options, competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage), } @@ -29,7 +30,6 @@ export class RdDTextEditor { context.text = await manager.onReplaceRoll(context); } - // TEXT_ROLL_MANAGERS.forEach(async manager => await RdDTextEditor._applyReplaceAll(manager, context)) return await TextEditor.enrichHTML(context.text, { relativeTo: object, secrets: object?.isOwner, diff --git a/module/apps/textroll/text-roll-carac-competence.js b/module/apps/textroll/text-roll-carac-competence.js index 1f0f23c2..c7511696 100644 --- a/module/apps/textroll/text-roll-carac-competence.js +++ b/module/apps/textroll/text-roll-carac-competence.js @@ -5,7 +5,10 @@ import { RdDItemCompetence } from "../../item-competence.js"; import { RdDUtility } from "../../rdd-utility.js"; import { TextRollManager } from "./text-roll-formatter.js"; -const REGEXP_ROLL_CARAC_COMP = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)(\\/(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?(/(?[\\+\\-]?\\d+))?" +const REGECP_CARAC = "(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" +const REGEXP_COMP = "(\\/(?[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?" +const REGEXP_DIFF = "(/(?[\\+\\-]?\\d+))?" +const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu') /** diff --git a/templates/apps/textroll/link-text-roll-carac-competence.hbs b/templates/apps/textroll/link-text-roll-carac-competence.hbs index af0528c8..212628a7 100644 --- a/templates/apps/textroll/link-text-roll-carac-competence.hbs +++ b/templates/apps/textroll/link-text-roll-carac-competence.hbs @@ -2,8 +2,8 @@ data-code="{{param.code}}" data-json="{{json-stringify param}}" data-carac-code="{{param.carac.code}}" - {{#if competence}}data-competence="{{param.competence}}"{{/if~}} - {{#if diff}}data-diff="{{param.diff}}"{{/if~}}> + {{#if param.competence}}data-competence="{{param.competence}}"{{/if~}} + {{#if param.diff}}data-diff="{{param.diff}}"{{/if~}}> {{~uppercase param.carac.label~}} {{#if param.competence}} / {{upperFirst param.competence}}{{/if~}}