utilisation de renderTemplate "interne"

Import de foundry.applications.handlebars.renderTemplate
au travers d'une constante pour éliminer les warnings
This commit is contained in:
2025-09-30 02:03:02 +02:00
parent 053bc23d12
commit d0ba1ebf99
43 changed files with 57 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
import { SYSTEM_RDD } from "../constants.js";
import { renderTemplate, SYSTEM_RDD } from "../constants.js";
import { RdDUtility } from "../rdd-utility.js";
const DETAIL_VENTE = 'detailVente';

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "../constants.js";
import { Misc } from "../misc.js";
import { RdDUtility } from "../rdd-utility.js";
import { ChatVente } from "./chat-vente.js";

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "../constants.js";
import { HtmlUtility } from "../html-utility.js";
import { RdDUtility } from "../rdd-utility.js";
import { ChatVente } from "./chat-vente.js";

View File

@@ -19,7 +19,7 @@ import { DialogConsommer } from "./dialog-item-consommer.js";
import { DialogFabriquerPotion } from "./dialog-fabriquer-potion.js";
import { RollDataAjustements } from "./rolldata-ajustements.js";
import { RdDPossession } from "./rdd-possession.js";
import { ACTOR_TYPES, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { ACTOR_TYPES, renderTemplate, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { RdDConfirm } from "./rdd-confirm.js";
import { DialogRepos } from "./sommeil/dialog-repos.js";
import { RdDBaseActor } from "./actor/base-actor.js";

View File

@@ -1,4 +1,4 @@
import { ENTITE_INCARNE, SHOW_DICE, SYSTEM_RDD } from "../constants.js";
import { ENTITE_INCARNE, renderTemplate, SHOW_DICE, SYSTEM_RDD } from "../constants.js";
import { Grammar } from "../grammar.js";
import { Misc } from "../misc.js";
import { RdDResolutionTable } from "../rdd-resolution-table.js";

View File

@@ -1,6 +1,6 @@
import { ChatVente } from "../achat-vente/chat-vente.js";
import { ChatUtility } from "../chat-utility.js";
import { SYSTEM_SOCKET_ID } from "../constants.js";
import { renderTemplate, SYSTEM_SOCKET_ID } from "../constants.js";
import { Grammar } from "../grammar.js";
import { Monnaie } from "../item-monnaie.js";
import { ITEM_TYPES } from "../constants.js";
@@ -738,7 +738,7 @@ export class RdDBaseActor extends Actor {
name: this.getAlias(),
system: { description: this.system.description }
}
foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.hbs', chatData)
renderTemplate('systems/foundryvtt-reve-de-dragon/templates/post-actor.hbs', chatData)
.then(html => ChatMessage.create(RdDUtility.chatDataSetup(html, modeOverride)));
}

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "../../constants.js";
export class TextRollManager {

View File

@@ -1,5 +1,5 @@
import { Misc } from "./misc.js";
import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { renderTemplate, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
@@ -190,7 +190,7 @@ export class ChatUtility {
if (rddTimestamp) {
const timestamp = new RdDTimestamp(rddTimestamp);
const timestampData = timestamp.toCalendrier();
const dateHeure = await foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
const dateHeure = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/common/date-heure.hbs', timestampData);
$(html).find('header.message-header .message-sender').after(dateHeure)
}
}

View File

@@ -1,5 +1,6 @@
import { RdDBaseActor } from "../actor/base-actor.js";
import { ChatUtility } from "../chat-utility.js";
import { renderTemplate } from "../constants.js";
const INFO_COEUR = 'info-coeur';

View File

@@ -9,6 +9,8 @@ export const ENTITE_INCARNE = 'incarne'
export const ENTITE_NONINCARNE = 'nonincarne'
export const ENTITE_BLURETTE = 'blurette'
export const renderTemplate = foundry.applications.handlebars.renderTemplate
export const RDD_CONFIG = {
niveauEthylisme : [
{value: "1", label: "Aucun"},

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js"
export class DialogChoixXpCarac extends Dialog {

View File

@@ -1,4 +1,4 @@
import { SYSTEM_RDD } from "./constants.js";
import { renderTemplate, SYSTEM_RDD } from "./constants.js";
import { Grammar } from "./grammar.js";
import { HtmlUtility } from "./html-utility.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";

View File

@@ -1,4 +1,5 @@
import { ChatUtility } from "./chat-utility.js";
import { renderTemplate } from "./constants.js";
import { HtmlUtility } from "./html-utility.js";
import { RdDItemSigneDraconique } from "./item/signedraconique.js";
import { TMRUtility } from "./tmr-utility.js";

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js";
import { Misc } from "./misc.js";
import { RdDUtility } from "./rdd-utility.js";

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js";
import { Misc } from "./misc.js";
export class DialogConsommer extends Dialog {

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js"
export class DialogSelect extends Dialog {
static extractIdNameImg(it) { return { id: it.id, name: it.name, img: it.img } }

View File

@@ -1,4 +1,4 @@
import { Misc } from "./misc.js";
import { renderTemplate } from "./constants.js";
export class DialogSplitItem extends Dialog {

View File

@@ -1,4 +1,4 @@
import { HIDE_DICE, SHOW_DICE } from "./constants.js";
import { HIDE_DICE, renderTemplate, SHOW_DICE } from "./constants.js";
import { RdDUtility } from "./rdd-utility.js";
/**

View File

@@ -1,4 +1,4 @@
import { ITEM_TYPES } from "../constants.js"
import { ITEM_TYPES, renderTemplate } from "../constants.js"
import { RdDItemSort } from "../item-sort.js"
import { Misc } from "../misc.js"

View File

@@ -1,4 +1,4 @@
import { ITEM_TYPES } from "./constants.js";
import { ITEM_TYPES, renderTemplate } from "./constants.js";
import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, CATEGORIES_COMPETENCES, CATEGORIES_COMPETENCES_CREATURES } from "./item/base-items.js";
import { ITEM_ACTIONS, DEFAULT_ACTIONS, COMMON_ACTIONS } from "./item/item-actions.js";

View File

@@ -1,5 +1,5 @@
import { ChatUtility } from "./chat-utility.js";
import { ENTITE_BLURETTE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { ENTITE_BLURETTE, HIDE_DICE, renderTemplate, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDBonus } from "./rdd-bonus.js";

View File

@@ -19,6 +19,7 @@ import { TMRUtility } from "./tmr-utility.js";
import { DialogFatigueVoyage } from "./voyage/dialog-fatigue-voyage.js";
import { ChatUtility } from "./chat-utility.js";
import { RdDRollResult } from "./rdd-roll-result.js";
import { renderTemplate } from "./constants.js";
const rddRollNumeric = /^(\d+)\s*([\+\-]?\d+)?\s*(s)?/;

View File

@@ -1,5 +1,5 @@
import { STATUSES } from "./settings/status-effects.js";
import { ITEM_TYPES } from "./constants.js";
import { ITEM_TYPES, renderTemplate } from "./constants.js";
import { ChatUtility } from "./chat-utility.js";
import { RdDRollResult } from "./rdd-roll-result.js";
import { RdDRoll } from "./rdd-roll.js";

View File

@@ -1,4 +1,5 @@
import { ChatUtility } from "./chat-utility.js"
import { renderTemplate } from "./constants.js"
const vents = [
{ min: 0, max: 0, valeur: 'Calme' },

View File

@@ -1,5 +1,6 @@
import { RdDBaseActor } from "./actor/base-actor.js";
import { ChatUtility } from "./chat-utility.js";
import { renderTemplate } from "./constants.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
@@ -236,7 +237,7 @@ export class RdDResolutionTable {
maxCarac = Math.min(maxCarac, minCarac + 20);
minLevel = Math.max(minLevel, -10);
maxLevel = Math.max(Math.min(maxLevel, 30), minLevel + colonnes);
return await foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/resolution-table.hbs', {
return await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/resolution-table.hbs', {
carac: carac,
difficulte: level,
min: minLevel,

View File

@@ -1,4 +1,4 @@
import { ENTITE_BLURETTE, ENTITE_INCARNE } from "./constants.js";
import { ENTITE_BLURETTE, ENTITE_INCARNE, renderTemplate } from "./constants.js";
import { RdDUtility } from "./rdd-utility.js";
/**

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js";
import { Misc } from "./misc.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";

View File

@@ -1,4 +1,5 @@
import { ChatUtility } from "./chat-utility.js";
import { renderTemplate } from "./constants.js";
export class RdDRollResult {
@@ -13,6 +14,6 @@ export class RdDRollResult {
static async buildRollDataHtml(rollData, template = 'chat-resultat-general.hbs') {
rollData.show = rollData.show || {};
return await foundry.applications.handlebars.renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
}
}

View File

@@ -8,8 +8,7 @@ import { RdDCarac } from "./rdd-carac.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
import { Grammar } from "./grammar.js";
import { ACTOR_TYPES } from "./constants.js";
import { RdDUtility } from "./rdd-utility.js";
import { ACTOR_TYPES, renderTemplate } from "./constants.js";
/**
* Extend the base Dialog entity to select roll parameters
@@ -23,7 +22,7 @@ export class RdDRoll extends Dialog {
RdDRoll._ensureCorrectAction(action);
RdDRoll._setDefaultOptions(actor, rollData);
const html = await foundry.applications.handlebars.renderTemplate(dialogConfig.html, rollData);
const html = await renderTemplate(dialogConfig.html, rollData);
let options = { classes: ["rdd-roll-dialog"], width: 650, height: 'fit-content', 'z-index': 99999, close: html => { } };
if (dialogConfig.close) {
@@ -345,7 +344,7 @@ export class RdDRoll extends Dialog {
/* -------------------------------------------- */
async buildAjustements(rollData) {
return await foundry.applications.handlebars.renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.hbs`, rollData);
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.hbs`, rollData);
}
/* -------------------------------------------- */

View File

@@ -1,4 +1,4 @@
import { SHOW_DICE, SYSTEM_RDD } from "./constants.js";
import { renderTemplate, SHOW_DICE, SYSTEM_RDD } from "./constants.js";
import { RollDataAjustements } from "./rolldata-ajustements.js";
import { RdDUtility } from "./rdd-utility.js";
import { COORD_TMR_INCONNU, TMRUtility } from "./tmr-utility.js";
@@ -47,7 +47,7 @@ export class RdDTMRDialog extends Dialog {
static async create(actor, tmrData) {
await PixiTMR.init()
let html = await foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.hbs', tmrData);
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.hbs', tmrData);
if (tmrData.mode != 'visu' && !game.user.isGM) {
ChatMessage.create({ content: actor.name + " est monté dans les TMR en mode : " + tmrData.mode, whisper: ChatUtility.getGMs() });
}
@@ -508,7 +508,7 @@ export class RdDTMRDialog extends Dialog {
ChatMessage.create({
whisper: ChatUtility.getOwners(this.actor),
content: await foundry.applications.handlebars.renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-rencontre-tmr.hbs`, rencData)
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-rencontre-tmr.hbs`, rencData)
});
this.$updateValuesDisplay();

View File

@@ -1,4 +1,5 @@
/* -------------------------------------------- */
import { renderTemplate } from "./constants.js";
import { HtmlUtility } from "./html-utility.js";
import { RdDCombatManager } from "./rdd-combat.js";
import { Targets } from "./targets.js";
@@ -132,7 +133,7 @@ export class RdDTokenHud {
/* -------------------------------------------- */
static async _configureSubMenu(insertMethod, template, hudData, onMenuItem) {
const hud = $(await foundry.applications.handlebars.renderTemplate(template, hudData));
const hud = $(await renderTemplate(template, hudData));
const list = hud.find('div.rdd-hud-list');
RdDTokenHud._toggleHudListActive(hud, list);

View File

@@ -4,6 +4,7 @@ import { RdDCarac } from "../rdd-carac.js"
import { RdDCombat } from "../rdd-combat.js"
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll-constants.mjs"
import { RdDResolutionTable } from "../rdd-resolution-table.js"
import { RDD_CONFIG, renderTemplate } from "../constants.js"
export default class ChatRollResult {
static init() {
@@ -76,7 +77,7 @@ export default class ChatRollResult {
async buildRollHtml(roll) {
const template = `systems/foundryvtt-reve-de-dragon/templates/roll/result/chat-${roll.type.current}.hbs`
return await foundry.applications.handlebars.renderTemplate(template, roll)
return await renderTemplate(template, roll)
}
async chatListeners(html) {

View File

@@ -39,6 +39,7 @@ import { RollDialogAdapter } from "./roll-dialog-adapter.mjs";
import { ROLLDIALOG_SECTION } from "./roll-part.mjs";
import { ROLL_TYPE_COMP } from "./roll-constants.mjs";
import ChatRollResult from "./chat-roll-result.mjs";
import { renderTemplate } from "../constants.js";
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
@@ -368,7 +369,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
}
async buildHTMLTable(carac, diff) {
return await foundry.applications.handlebars.renderTemplate('roll-table', { carac, diff })
return await renderTemplate('roll-table', { carac, diff })
}
async _prepareContext() {

View File

@@ -1,5 +1,5 @@
import { ChatUtility } from "../chat-utility.js";
import { HIDE_DICE, SYSTEM_RDD } from "../constants.js";
import { HIDE_DICE, renderTemplate, SYSTEM_RDD } from "../constants.js";
import { Grammar } from "../grammar.js";
import { RdDItem } from "../item.js";
import { Misc } from "../misc.js";

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "../constants.js";
export class DialogChateauDormant extends Dialog {
@@ -9,7 +10,7 @@ export class DialogChateauDormant extends Dialog {
motifStress: `Nuit du ${date}`,
finChateauDormant: game.system.rdd.calendrier.getTimestampFinChateauDormant()
};
const html = await foundry.applications.handlebars.renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-chateau-dormant.hbs",
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-chateau-dormant.hbs",
dialogData);
new DialogChateauDormant(dialogData, html)

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "../constants.js";
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
import { EffetsDraconiques } from "../tmr/effets-draconiques.js";

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "../constants.js";
export class DialogStress extends Dialog {

View File

@@ -4,7 +4,7 @@ import { RdDResolutionTable } from "../rdd-resolution-table.js";
import { RdDDice } from "../rdd-dice.js";
import { Misc } from "../misc.js";
import { DialogChronologie } from "../dialog-chronologie.js";
import { HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "../constants.js";
import { HIDE_DICE, renderTemplate, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "../constants.js";
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
import { DialogChateauDormant } from "../sommeil/dialog-chateau-dormant.js";
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "../sommeil/app-astrologie.js";

View File

@@ -4,6 +4,7 @@ import { Misc } from "../misc.js";
import { CompendiumTableHelpers } from '../settings/system-compendiums.js';
import { RdDRaretes } from '../item/raretes.js';
import { Grammar } from '../grammar.js';
import { renderTemplate } from '../constants.js';
const FILTER_GROUPS = [
{ group: 'type', label: "Type d'objet" },

View File

@@ -1,3 +1,4 @@
import { renderTemplate } from "./constants.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
@@ -102,7 +103,7 @@ export class TMRRencontres {
/* -------------------------------------------- */
async $chatRolledRencontre(row, rencontre, tmr) {
const flavorContent = await foundry.applications.handlebars.renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table-roll-rencontre.hbs',
const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table-roll-rencontre.hbs',
{
roll: row.roll,
rencontre,

View File

@@ -1,5 +1,6 @@
import { ExperienceLog, XP_TOPIC } from "../actor/experience-log.js";
import { ChatUtility } from "../chat-utility.js";
import { renderTemplate } from "../constants.js";
import { Poetique } from "../poetique.js";
import { RdDDice } from "../rdd-dice.js";
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";

View File

@@ -1,4 +1,4 @@
import { ITEM_TYPES } from "../constants.js"
import { ITEM_TYPES, renderTemplate } from "../constants.js"
import { RdDItemCompetence } from "../item-competence.js"
import { ChatUtility } from "../chat-utility.js"
import { Misc } from "../misc.js"