From 91f9e8832dfa0a1637276dc9d876f1bb2d885553 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 30 Jan 2022 21:49:35 +0100 Subject: [PATCH] Utilisation de tables custom du monde --- module/rdd-rolltables.js | 11 +++++++---- system.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/module/rdd-rolltables.js b/module/rdd-rolltables.js index 89516904..f6aa6be9 100644 --- a/module/rdd-rolltables.js +++ b/module/rdd-rolltables.js @@ -2,10 +2,13 @@ export class RdDRollTables { /* -------------------------------------------- */ static async genericGetTableResult(tableName, toChat) { - const pack = game.packs.get("foundryvtt-reve-de-dragon.tables-diverses"); - const index = await pack.getIndex(); - const entry = index.find(e => e.name === tableName); - const table = await pack.getDocument(entry._id); + 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 index = await pack.getIndex(); + const entry = index.find(e => e.name === tableName); + table = await pack.getDocument(entry._id); + } const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"}); console.log("RdDRollTables", tableName, toChat, ":", draw); return draw.results.length > 0 ? draw.results[0] : undefined; diff --git a/system.json b/system.json index 3f6dd26d..bfeabbf9 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.5.60", + "version": "1.5.61", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "9",