Ajout des queues et souffles automatique
This commit is contained in:
@ -6,38 +6,46 @@ export class RdDRollTables {
|
||||
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;
|
||||
const draw = await table.draw({ displayChat: toChat });
|
||||
console.log("RdDRollTables", tableName, toChat, ":", draw);
|
||||
console.log("RdDRollTables", tableName, toChat, ":", draw.roll, draw.results);
|
||||
return draw;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async drawItemFromRollTable(tableName, toChat) {
|
||||
const draw = await RdDRollTables.genericGetTableResult(tableName, toChat);
|
||||
const drawnItemRef = draw.results.length > 0 ? draw.results[0] : undefined;
|
||||
const pack = game.packs.get(drawnItemRef.collection);
|
||||
return await pack.getEntity(drawnItemRef.resultId);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static async getSouffle(toChat = true) {
|
||||
return RdDRollTables.genericGetTableResult("Souffles de Dragon", toChat);
|
||||
return await RdDRollTables.drawItemFromRollTable("Souffles de Dragon", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getQueue(toChat = true) {
|
||||
return RdDRollTables.genericGetTableResult("Queues de dragon", toChat);
|
||||
return await RdDRollTables.drawItemFromRollTable("Queues de dragon", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getTete(toChat = true) {
|
||||
return RdDRollTables.genericGetTableResult("Têtes de Dragon pour haut-rêvants", toChat);
|
||||
return await RdDRollTables.drawItemFromRollTable("Têtes de Dragon pour haut-rêvants", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getTeteHR(toChat = true) {
|
||||
return RdDRollTables.genericGetTableResult("Têtes de Dragon pour tous personnages", toChat);
|
||||
return await RdDRollTables.drawItemFromRollTable("Têtes de Dragon pour tous personnages", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getOmbre(toChat = true) {
|
||||
return RdDRollTables.genericGetTableResult("Ombre de Thanatos", toChat);
|
||||
return await RdDRollTables.drawItemFromRollTable("Ombre de Thanatos", toChat);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getTarot(toChat = true) {
|
||||
return RdDRollTables.genericGetTableResult("Tarot Draconique", toChat);
|
||||
return await RdDRollTables.drawItemFromRollTable("Tarot Draconique", toChat);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user