From 501f1f2e4fcdeeff1cfd488a9fe9283dc2e303cc Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Mon, 14 Oct 2024 03:47:04 +0200 Subject: [PATCH] Fix: Messages de maladies non publics Les messages de maladies sont uniquement pour les "owners" (ce qui inclut les MJs) --- changelog.md | 2 ++ module/chat-utility.js | 4 ++++ module/item/maladie.js | 10 +++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index e1d942a5..acdb92cd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ # 12.0 +## 12.0.15 - Le messager d'Astrobazzarh +- Les messages de maladies ne sont plus publics ## 12.0.14 - Les légions d'Astrobazzarh - Feuille de PNJ: - boutons standard (encaissement, ...) diff --git a/module/chat-utility.js b/module/chat-utility.js index 6e0386ff..c5a56534 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -118,6 +118,10 @@ export class ChatUtility { return undefined; } + static getOwners(actor) { + return game.users.filter(it => actor.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) + } + /* -------------------------------------------- */ static getWhisperRecipientsAndGMs(...names) { let recipients = [...ChatMessage.getWhisperRecipients('GM')] diff --git a/module/item/maladie.js b/module/item/maladie.js index c6cef1cf..bdf85e04 100644 --- a/module/item/maladie.js +++ b/module/item/maladie.js @@ -1,3 +1,4 @@ +import { ChatUtility } from "../chat-utility.js"; import { RdDItem } from "../item.js"; import { Misc } from "../misc.js"; import { RdDTimestamp } from "../time/rdd-timestamp.js"; @@ -21,9 +22,12 @@ export class RdDItemMaladie extends RdDItem { const souffrance = mal.system.identifie ? `de ${mal.name}` : `d'un mal inconnu` - ChatMessage.create({ content: `${mal.actor.name} souffre ${souffrance} (${Misc.typeName('Item', mal.type)}): vérifiez que les effets ne se sont pas aggravés !` }); - mal.postItemToChat('gmroll'); - await RdDItemMaladie.prolongerPeriode(mal,oldTimestamp, newTimestamp); + ChatMessage.create({ + whisper: ChatUtility.getOwners(mal.actor), + content: `${mal.actor.name} souffre ${souffrance} (${Misc.typeName('Item', mal.type)}): vérifiez que les effets ne se sont pas aggravés !` + }) + mal.postItemToChat('gmroll') + await RdDItemMaladie.prolongerPeriode(mal, oldTimestamp, newTimestamp) } }