Rendu des tables de compendiums
This commit is contained in:
@ -236,12 +236,12 @@ export class CompendiumTableHelpers {
|
||||
let max = 0;
|
||||
const total = rows.map(it => it.frequence).reduce(Misc.sum(), 0);
|
||||
return rows.map(row => {
|
||||
const frequence = row.frequence;
|
||||
row.min = max + 1;
|
||||
row.max = max + frequence;
|
||||
const frequence = row.frequence
|
||||
row.min = max + 1
|
||||
row.max = max + frequence
|
||||
row.total = total
|
||||
max += frequence;
|
||||
return row;
|
||||
max += frequence
|
||||
return row
|
||||
})
|
||||
}
|
||||
static async getRandom(table, type, subTypes = ['objet'], forcedRoll = undefined, localisation = undefined) {
|
||||
@ -260,8 +260,8 @@ export class CompendiumTableHelpers {
|
||||
}
|
||||
const total = table[0].total;
|
||||
const formula = `1d${total}`;
|
||||
if (forcedRoll == undefined && (forcedRoll > total || forcedRoll <= 0)) {
|
||||
ui.notifications.warn(`Jet de rencontre ${forcedRoll} en dehors de la table [1..${total}], le jet est relancé`);
|
||||
if (forcedRoll != undefined && (forcedRoll > total || forcedRoll <= 0)) {
|
||||
ui.notifications.warn(`Jet forcé ${forcedRoll} en dehors de la table [1..${total}], le jet est relancé`);
|
||||
forcedRoll = undefined;
|
||||
}
|
||||
const roll = forcedRoll ? { total: forcedRoll, formula } : await RdDDice.roll(formula, { showDice: HIDE_DICE });
|
||||
@ -276,7 +276,7 @@ export class CompendiumTableHelpers {
|
||||
return;
|
||||
}
|
||||
const percentages = (row.total == 100) ? '%' : ''
|
||||
const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table-roll.html', {
|
||||
const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table-roll.hbs', {
|
||||
roll: row.roll,
|
||||
document: row.document,
|
||||
percentages,
|
||||
@ -296,7 +296,7 @@ export class CompendiumTableHelpers {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async tableToChatMessage(table, type, subTypes, typeName = undefined) {
|
||||
const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table.html', {
|
||||
const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table.hbs', {
|
||||
img: RdDItem.getDefaultImg(subTypes[0]),
|
||||
typeName: typeName ?? Misc.typeName(type, subTypes[0]),
|
||||
table,
|
||||
|
Reference in New Issue
Block a user