2020-11-24 15:20:05 +01:00
|
|
|
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
|
|
|
/* -------------------------------------------- */
|
2020-11-24 15:20:05 +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-24 15:20:05 +01:00
|
|
|
|
2020-11-16 03:54:43 +01:00
|
|
|
/* -------------------------------------------- */
|
2020-11-24 15:20:05 +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;
|
2021-01-09 19:33:19 +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);
|
2020-11-24 15:20:05 +01:00
|
|
|
break;
|
|
|
|
case "selfroll":
|
2021-03-25 03:18:27 +01:00
|
|
|
whisper = [game.user.id];
|
2020-11-16 03:54:43 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|