Compendiums paramétrables

This commit is contained in:
Vincent Vandemeulebrouck
2022-11-06 21:39:47 +01:00
parent ce562b6b8a
commit 73c490a91d
4 changed files with 143 additions and 3 deletions

View File

@ -1,3 +1,5 @@
import { SystemCompendiums } from "./settings/system-compendiums.js";
export class RdDRollTables {
/* -------------------------------------------- */
@ -14,7 +16,7 @@ export class RdDRollTables {
}
static async getSystemTable(tableName) {
const pack = game.packs.get("foundryvtt-reve-de-dragon.tables-diverses");
const pack = SystemCompendiums.getPack("tables-diverses");
const index = await pack.getIndex();
const entry = index.find(e => e.name === tableName);
return await pack.getDocument(entry._id);
@ -24,8 +26,7 @@ export class RdDRollTables {
static async drawItemFromRollTable(tableName, toChat = false) {
const drawResult = await RdDRollTables.genericGetTableResult(tableName, toChat);
const pack = game.packs.get(drawResult.documentCollection)
let doc = await pack.getDocument(drawResult.documentId)
return doc
return await pack.getDocument(drawResult.documentId)
}
/* -------------------------------------------- */