From 1cb7d1f251231ece162ac6bb271e4f75cb57ae94 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 12 Nov 2020 18:42:41 +0100 Subject: [PATCH] Fix regression /table --- module/rdd-rolltables.js | 52 +++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/module/rdd-rolltables.js b/module/rdd-rolltables.js index 0cf0a1cb..5f06a355 100644 --- a/module/rdd-rolltables.js +++ b/module/rdd-rolltables.js @@ -1,45 +1,43 @@ export class RdDRollTables { - + /* -------------------------------------------- */ - static async genericGetTableResult( tableName, toChat) - { - let pack = game.packs.get("foundryvtt-reve-de-dragon.tables-diverses"); - await pack.getIndex(); - let entry = pack.index.find(e => e.name === tableName); - let rollQueues = await pack.getEntity(entry._id); - let result = await rollQueues.draw( { displayChat: toChat } ); - console.log("CAT", result); + 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.getEntity(entry._id); + const result = await table.draw({ displayChat: toChat }); + console.log("RdDRollTables", tableName, toChat, ":", result); return result; } - + /* -------------------------------------------- */ - static async getSouffle( toChat ) { - return genericGetTableResult( "Souffles de Dragon", toChat); + static async getSouffle(toChat) { + return RdDRollTables.genericGetTableResult("Souffles de Dragon", toChat); } /* -------------------------------------------- */ - static async getQueue( toChat = true) { - return genericGetTableResult( "Queues de dragon", toChat); + static async getQueue(toChat = true) { + return RdDRollTables.genericGetTableResult("Queues de dragon", toChat); } /* -------------------------------------------- */ - static async getTete( toChat = true ) { - return genericGetTableResult( "Têtes de Dragon pour haut-rêvants", toChat); - } - - /* -------------------------------------------- */ - static async getTeteHR( toChat = true ) { - return genericGetTableResult( "Têtes de Dragon pour tous personnages", toChat); + static async getTete(toChat = true) { + return RdDRollTables.genericGetTableResult("Têtes de Dragon pour haut-rêvants", toChat); } /* -------------------------------------------- */ - static async getOmbre( toChat = true ) { - return genericGetTableResult( "Ombre de Thanatos", toChat); + static async getTeteHR(toChat = true) { + return RdDRollTables.genericGetTableResult("Têtes de Dragon pour tous personnages", toChat); } /* -------------------------------------------- */ - static async getTarot( toChat = true ) { - return genericGetTableResult( "Tarot Draconique", toChat); + static async getOmbre(toChat = true) { + return RdDRollTables.genericGetTableResult("Ombre de Thanatos", toChat); } - -} \ No newline at end of file + + /* -------------------------------------------- */ + static async getTarot(toChat = true) { + return RdDRollTables.genericGetTableResult("Tarot Draconique", toChat); + } +}