Fix message d'expérience invisibles

Les messages d'expérience sur mêlée/tir/lancer (à répartir)
n'étaient plus visibles
This commit is contained in:
Vincent Vandemeulebrouck 2022-12-01 01:22:25 +01:00
parent 02c48f4796
commit 3a29570bae
2 changed files with 21 additions and 8 deletions

View File

@ -2266,13 +2266,19 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
if (!this.isPersonnage()) return;
hideChatMessage = hideChatMessage == 'hide' || (game.settings.get("core", "rollMode") != 'blindroll' && !game.user.isGM)
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
if (xpData && !hideChatMessage) {
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData)
});
if (xpData) {
const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData);
if (hideChatMessage) {
ChatUtility.blindMessageToGM({ content: content});
}
else{
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: content
});
}
}
}

View File

@ -120,13 +120,20 @@ export class Misc {
return Misc.firstConnectedGM()?.id ?? game.user.id;
}
static isRollModeHiddenToPlayer() {
switch (game.settings.get("core", "rollMode")) {
case CONST.DICE_ROLL_MODES.BLIND:
case CONST.DICE_ROLL_MODES.SELF: return true;
}
return false
}
static getActiveUser(id) {
return game.users.find(u => u.id == id && u.active);
}
static firstConnectedGM() {
return game.users.filter(u => u.isGM && u.active).sort(Misc.ascending(u => u.id)).find(u => u.isGM && u.active);
}
static isOwnerPlayer(actor, user=undefined) {