La recherche par milieu fonctionnelle #586

Merged
uberwald merged 5 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-12-03 10:05:50 +01:00
Showing only changes of commit b07cea40e2 - Show all commits

View File

@ -52,7 +52,7 @@ export class SystemCompendiums extends FormApplication {
} }
static getPack(compendium) { 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) { static async getPackContent(compendium, docType) {
@ -213,11 +213,11 @@ export class CompendiumTableHelpers {
let max = 0; let max = 0;
const total = elements.map(it => itemFrequence(it)).reduce(Misc.sum(), 0); const total = elements.map(it => itemFrequence(it)).reduce(Misc.sum(), 0);
return elements.map(it => { return elements.map(it => {
const frequence = itemFrequence(it); const frequence = itemFrequence(it);
let row = { document: it, frequence: frequence, min: max + 1, max: max + frequence, total: total }; let row = { document: it, frequence: frequence, min: max + 1, max: max + frequence, total: total };
max += frequence; max += frequence;
return row; return row;
}); });
} }
static async getRandom(table, type, subTypes, forcedRoll = undefined, localisation = undefined) { static async getRandom(table, type, subTypes, forcedRoll = undefined, localisation = undefined) {