Utilisation de tables custom du monde

This commit is contained in:
sladecraven 2022-01-30 21:49:35 +01:00
parent 3ad6aa01cc
commit 91f9e8832d
2 changed files with 8 additions and 5 deletions

View File

@ -2,10 +2,13 @@ export class RdDRollTables {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async genericGetTableResult(tableName, toChat) { static async genericGetTableResult(tableName, toChat) {
let table = game.tables.find(table => table.name.toLowerCase() == tableName.toLowerCase())
if ( !table) {
const pack = game.packs.get("foundryvtt-reve-de-dragon.tables-diverses"); const pack = game.packs.get("foundryvtt-reve-de-dragon.tables-diverses");
const index = await pack.getIndex(); const index = await pack.getIndex();
const entry = index.find(e => e.name === tableName); const entry = index.find(e => e.name === tableName);
const table = await pack.getDocument(entry._id); table = await pack.getDocument(entry._id);
}
const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"}); const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"});
console.log("RdDRollTables", tableName, toChat, ":", draw); console.log("RdDRollTables", tableName, toChat, ":", draw);
return draw.results.length > 0 ? draw.results[0] : undefined; return draw.results.length > 0 ? draw.results[0] : undefined;

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.5.60", "version": "1.5.61",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0", "minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "9", "compatibleCoreVersion": "9",