foundryvtt-reve-de-dragon/module/rdd-rolltables.js

44 lines
1.6 KiB
JavaScript
Raw Normal View History

export class RdDRollTables {
2020-11-12 18:42:41 +01:00
/* -------------------------------------------- */
2020-11-12 18:42:41 +01:00
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;
}
2020-11-12 18:42:41 +01:00
/* -------------------------------------------- */
static async getSouffle(toChat = true) {
2020-11-12 18:42:41 +01:00
return RdDRollTables.genericGetTableResult("Souffles de Dragon", toChat);
}
/* -------------------------------------------- */
2020-11-12 18:42:41 +01:00
static async getQueue(toChat = true) {
return RdDRollTables.genericGetTableResult("Queues de dragon", toChat);
}
/* -------------------------------------------- */
2020-11-12 18:42:41 +01:00
static async getTete(toChat = true) {
return RdDRollTables.genericGetTableResult("Têtes de Dragon pour haut-rêvants", toChat);
}
2020-11-12 18:42:41 +01:00
/* -------------------------------------------- */
2020-11-12 18:42:41 +01:00
static async getTeteHR(toChat = true) {
return RdDRollTables.genericGetTableResult("Têtes de Dragon pour tous personnages", toChat);
}
/* -------------------------------------------- */
2020-11-12 18:42:41 +01:00
static async getOmbre(toChat = true) {
return RdDRollTables.genericGetTableResult("Ombre de Thanatos", toChat);
}
/* -------------------------------------------- */
2020-11-12 18:42:41 +01:00
static async getTarot(toChat = true) {
return RdDRollTables.genericGetTableResult("Tarot Draconique", toChat);
}
2020-11-12 18:42:41 +01:00
}