This commit is contained in:
2020-12-11 08:29:24 +01:00
parent e74031be0b
commit 349f8fc875
13 changed files with 165 additions and 47 deletions

View File

@ -9,6 +9,7 @@ export class ChatUtility {
ChatUtility.createChatMessage(chatOptions, rollMode, name);
}
/* -------------------------------------------- */
static createChatMessage( chatOptions, rollMode, name) {
switch (rollMode) {
case "blindroll": // GM only
@ -29,6 +30,7 @@ export class ChatUtility {
ChatMessage.create(chatOptions);
}
/* -------------------------------------------- */
static prepareChatMessage( rollMode, name) {
return {
user: game.user._id,
@ -36,6 +38,7 @@ export class ChatUtility {
}
}
/* -------------------------------------------- */
static getWhisperRecipients( rollMode, name) {
switch (rollMode) {
case "blindroll": return ChatUtility.getUsers(user => user.isGM);
@ -45,15 +48,18 @@ export class ChatUtility {
return undefined;
}
/* -------------------------------------------- */
static getWhisperRecipientsAndGMs(name) {
return ChatMessage.getWhisperRecipients(name)
.concat(this.getUsers(user => user.isGM));
}
/* -------------------------------------------- */
static getUsers(filter) {
return game.users.filter(filter).map(user => user.data._id);
}
/* -------------------------------------------- */
static blindMessageToGM(chatOptions) {
let chatGM = duplicate(chatOptions);
chatGM.whisper = ChatUtility.getUsers(user => user.isGM);
@ -62,6 +68,7 @@ export class ChatUtility {
game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_gm_chat_message", data: chatGM });
}
/* -------------------------------------------- */
static handleGMChatMessage(data) {
console.log("blindMessageToGM", data);
if (game.user.isGM) { // message privé pour GM only