Gestion du rollMode

affecte tous les jets d'un actor sur la table de résolution
This commit is contained in:
2020-11-24 15:20:05 +01:00
parent 136c7594d4
commit 8f9b1f1e76
4 changed files with 115 additions and 33 deletions

View File

@ -1,3 +1,5 @@
import { ChatUtility } from "./chat-utility.js";
export class RdDDice {
/* -------------------------------------------- */
@ -9,32 +11,30 @@ export class RdDDice {
/* -------------------------------------------- */
static async show(roll, rollMode = "roll") {
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 = "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 == undefined ? game.settings.get("core", "rollMode") : rollMode;
switch (rollMode) {
case "blindroll": //GM only
blind = true;
case "gmroll": //GM + rolling player
let gmList = game.users.filter(user => user.isGM);
let gmIDList = [];
gmList.forEach(gm => gmIDList.push(gm.data._id));
whisper = gmIDList;
whisper = ChatUtility.getUsersIds(user => user.isGM);
break;
case "roll": //everybody
let userList = game.users.filter(user => user.active);
let userIDList = [];
userList.forEach(user => userIDList.push(user.data._id));
whisper = userIDList;
whisper = ChatUtility.getUsersIds(user => user.active);
break;
case "selfroll":
whisper = [game.user._id];
break;
}
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);