From b07cea40e233651059791d58210a95606a4c6e37 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 3 Dec 2022 01:22:30 +0100 Subject: [PATCH] Fallback sur compendium system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit quand le compendium configuré n'existe plus, fallback sur le compendium du système --- module/settings/system-compendiums.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/module/settings/system-compendiums.js b/module/settings/system-compendiums.js index 5700bde7..be1af7d1 100644 --- a/module/settings/system-compendiums.js +++ b/module/settings/system-compendiums.js @@ -52,7 +52,7 @@ export class SystemCompendiums extends FormApplication { } static getPack(compendium) { - return game.packs.get(SystemCompendiums.getCompendium(compendium)); + return game.packs.get(SystemCompendiums.getCompendium(compendium)) ?? game.packs.get(SystemCompendiums._getDefaultCompendium(compendium)); } static async getPackContent(compendium, docType) { @@ -213,11 +213,11 @@ export class CompendiumTableHelpers { let max = 0; const total = elements.map(it => itemFrequence(it)).reduce(Misc.sum(), 0); return elements.map(it => { - const frequence = itemFrequence(it); - let row = { document: it, frequence: frequence, min: max + 1, max: max + frequence, total: total }; - max += frequence; - return row; - }); + const frequence = itemFrequence(it); + let row = { document: it, frequence: frequence, min: max + 1, max: max + frequence, total: total }; + max += frequence; + return row; + }); } static async getRandom(table, type, subTypes, forcedRoll = undefined, localisation = undefined) {