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

35 lines
1.1 KiB
JavaScript
Raw Normal View History

import { ChatUtility } from "./chat-utility.js";
2020-11-16 03:54:43 +01:00
export class RdDDice {
2020-11-21 09:10:31 +01:00
/* -------------------------------------------- */
static async show(roll, rollMode = undefined) {
2020-11-17 11:35:05 +01:00
if (roll.showDice || game.settings.get("foundryvtt-reve-de-dragon", "dice-so-nice") == true) {
2020-11-21 09:10:31 +01:00
await this.showDiceSoNice(roll, rollMode);
2020-11-17 11:35:05 +01:00
}
2020-11-16 03:54:43 +01:00
return roll;
}
2020-11-16 03:54:43 +01:00
/* -------------------------------------------- */
static async showDiceSoNice(roll, rollMode = undefined) {
2020-11-16 03:54:43 +01:00
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
let whisper = null;
let blind = false;
2020-12-31 11:53:41 +01:00
rollMode = rollMode || game.settings.get("core", "rollMode");
2020-11-16 03:54:43 +01:00
switch (rollMode) {
case "blindroll": //GM only
blind = true;
case "gmroll": //GM + rolling player
2020-11-24 18:39:27 +01:00
whisper = ChatUtility.getUsers(user => user.isGM);
2020-11-16 03:54:43 +01:00
break;
case "roll": //everybody
2020-11-24 18:39:27 +01:00
whisper = ChatUtility.getUsers(user => user.active);
break;
case "selfroll":
whisper = [game.user._id];
2020-11-16 03:54:43 +01:00
break;
}
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
}
}
}