foundryvtt-reve-de-dragon/module/rdd-dice.js
Vincent Vandemeulebrouck 43cf091345 Adaptation Feuilles Acteurs
2021-03-25 03:21:43 +01:00

35 lines
1.1 KiB
JavaScript

import { ChatUtility } from "./chat-utility.js";
export class RdDDice {
/* -------------------------------------------- */
static async show(roll, rollMode = undefined) {
if (roll.showDice || game.settings.get("foundryvtt-reve-de-dragon", "dice-so-nice") == true) {
await this.showDiceSoNice(roll, rollMode);
}
return roll;
}
/* -------------------------------------------- */
static async showDiceSoNice(roll, rollMode = undefined) {
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
let whisper = null;
let blind = false;
rollMode = rollMode ?? game.settings.get("core", "rollMode");
switch (rollMode) {
case "blindroll": //GM only
blind = true;
case "gmroll": //GM + rolling player
whisper = ChatUtility.getUsers(user => user.isGM);
break;
case "roll": //everybody
whisper = ChatUtility.getUsers(user => user.active);
break;
case "selfroll":
whisper = [game.user.id];
break;
}
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
}
}
}