Utilise RdDRoll pour les caracs

ajout d'un callback dédié à l'expérience
limite de la table de résolution à 60 (rêve actuel jusqu'à 3x limite)
This commit is contained in:
2020-12-06 23:31:23 +01:00
parent 9275f61a08
commit d081dbf230
5 changed files with 109 additions and 72 deletions

View File

@ -6,7 +6,10 @@ export class ChatUtility {
static chatWithRollMode(chatOptions, name) {
let rollMode = game.settings.get("core", "rollMode");
chatOptions.user = game.user._id;
ChatUtility.createChatMessage(chatOptions, rollMode, name);
}
static createChatMessage( chatOptions, rollMode, name) {
switch (rollMode) {
case "blindroll": // GM only
if (!game.user.isGM) {
@ -19,24 +22,29 @@ export class ChatUtility {
chatOptions.whisper = ChatUtility.getUsers(user => user.isGM);
}
break;
case "gmroll": // GM + rolling player
chatOptions.user = game.user._id;
chatOptions.whisper = ChatUtility.getWhisperRecipientsAndGMs(name);
break;
case "selfroll": // only the user
chatOptions.user = game.user._id;
chatOptions.whisper = [game.user._id];
break;
default:
case "roll": // everybody
chatOptions.whisper = undefined;
chatOptions.whisper = ChatUtility.getWhisperRecipients(rollMode, name);
break;
}
console.log("roll message", chatOptions);
ChatMessage.create(chatOptions);
}
static prepareChatMessage( rollMode, name) {
return {
user: game.user._id,
whisper: ChatUtility.getWhisperRecipients(rollMode, name)
}
}
static getWhisperRecipients( rollMode, name) {
switch (rollMode) {
case "blindroll": return ChatUtility.getUsers(user => user.isGM);
case "gmroll": return ChatUtility.getWhisperRecipientsAndGMs(name);
case "selfroll": return [game.user._id];
}
return undefined;
}
static getWhisperRecipientsAndGMs(name) {
return ChatMessage.getWhisperRecipients(name)
.concat(this.getUsers(user => user.isGM));