forked from public/foundryvtt-reve-de-dragon
Simplify ChatMessage whispers
Les messages dans les TMRs sont envoyés au GM Simplification des messages de tchat liés à un actor: on peut utiliser les Owners (car les GMs sont owner). Au lieu de passer le name de l'Actor (qui peut être incorrect si deux actors ont le même, mais pas les mêmes propriétaires), on passe directement l'actor pour déterminer mles destinataires de messages
This commit is contained in:
@ -159,7 +159,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const potionUpdates = await Promise.all(potions.map(async it => {
|
||||
const nouveauReve = Math.max(it.system.pr - 1, 0)
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
|
||||
pr: nouveauReve,
|
||||
alias: this.name,
|
||||
@ -210,7 +210,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async grisReve(nbJours) {
|
||||
let message = {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: `${nbJours} jours de gris rêve sont passés. `
|
||||
};
|
||||
for (let i = 0; i < nbJours; i++) {
|
||||
@ -264,7 +264,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
async dormirChateauDormant() {
|
||||
if (!ReglesOptionnelles.isUsing("chateau-dormant-gardien") || !this.system.sommeil || this.system.sommeil.nouveaujour) {
|
||||
const message = {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: ""
|
||||
};
|
||||
|
||||
@ -400,7 +400,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async remiseANeuf() {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: 'Remise à neuf de ' + this.name
|
||||
});
|
||||
await this.supprimerBlessures(it => true);
|
||||
@ -417,7 +417,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async dormir(heures, options = { grisReve: false, chateauDormant: false }) {
|
||||
const message = {
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: this.name + ': '
|
||||
};
|
||||
const insomnie = this.system.sommeil?.insomnie || heures == 0;
|
||||
@ -488,7 +488,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
else {
|
||||
if (!ReglesOptionnelles.isUsing("recuperation-reve")) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: `Pas de récupération de rêve (${reve} points ignorés)`
|
||||
});
|
||||
jetsReve.push(0);
|
||||
@ -919,7 +919,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await this.createEmbeddedDocuments('Item', [souffle]);
|
||||
if (options.chat) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: this.name + " subit un Souffle de Dragon : " + souffle.name
|
||||
});
|
||||
}
|
||||
@ -939,7 +939,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await this.createEmbeddedDocuments('Item', [queue]);
|
||||
if (options.chat) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: this.name + " subit une Queue de Dragon : " + queue.name
|
||||
});
|
||||
}
|
||||
@ -977,7 +977,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
let tmr = await TMRUtility.getTMRAleatoire(tmr => accessible(tmr) && !innaccessible.includes(tmr.coord));
|
||||
ChatMessage.create({
|
||||
content: `${raison} : ré-insertion aléatoire.`,
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
await this.forcerPositionTMRInconnue(tmr);
|
||||
return tmr;
|
||||
@ -1082,7 +1082,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const jetMoral = await this._jetDeMoral(situation);
|
||||
const finMessage = (jetMoral.succes ? messageReussi : messageManque) ?? (jetMoral.ajustement == 0 ? "Vous gardez votre moral" : jetMoral.ajustement > 0 ? "Vous gagnez du moral" : "Vous perdez du moral");
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: `${finMessage} - jet ${jetMoral.succes ? "réussi" : "manqué"} en situation ${situation} (${jetMoral.jet}/${jetMoral.difficulte}).`
|
||||
});
|
||||
return jetMoral.ajustement;
|
||||
@ -1419,7 +1419,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
};
|
||||
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-transformer-stress.html`, stressRollData)
|
||||
});
|
||||
|
||||
@ -1505,7 +1505,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
if (display) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp)
|
||||
});
|
||||
}
|
||||
@ -1537,7 +1537,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
if (display) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, checkXp)
|
||||
});
|
||||
}
|
||||
@ -1563,7 +1563,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
else {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: content
|
||||
});
|
||||
}
|
||||
@ -1666,7 +1666,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
ChatMessage.create({
|
||||
content: "Vous êtes sous le coup d'une Mauvaise Rencontre en Persective." + addMsg,
|
||||
whisper: ChatMessage.getWhisperRecipients(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
}
|
||||
return rencSpecial;
|
||||
@ -1678,7 +1678,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (countInertieDraconique > 0) {
|
||||
ChatMessage.create({
|
||||
content: `Vous êtes sous le coup d'Inertie Draconique : vous perdrez ${countInertieDraconique + 1} cases de Fatigue par déplacement au lieu d'une.`,
|
||||
whisper: ChatMessage.getWhisperRecipients(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
}
|
||||
return countInertieDraconique + 1;
|
||||
@ -1690,7 +1690,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await this.reveActuelIncDec(-1);
|
||||
ChatMessage.create({
|
||||
content: "Vous êtes sous le coup d'un Péage : l'entrée sur cette case vous a coûté 1 Point de Rêve (déduit automatiquement).",
|
||||
whisper: ChatMessage.getWhisperRecipients(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -2270,7 +2270,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
// Cas de désir lancinant, pas d'expérience sur particulière
|
||||
ChatMessage.create({
|
||||
content: `Vous souffrez au moins d'un Désir Lancinant, vous ne pouvez pas gagner d'expérience sur une Particulière tant que le désir n'est pas assouvi`,
|
||||
whisper: ChatMessage.getWhisperRecipients(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
return []
|
||||
}
|
||||
@ -2405,7 +2405,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (countMonteeLaborieuse > 0) {
|
||||
ChatMessage.create({
|
||||
content: `Vous êtes sous le coup d'une Montée Laborieuse : vos montées en TMR coûtent ${countMonteeLaborieuse} Point de Rêve de plus.`,
|
||||
whisper: ChatMessage.getWhisperRecipients(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
}
|
||||
return countMonteeLaborieuse;
|
||||
@ -2453,7 +2453,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (this.getReveActuel() < minReveValue) {
|
||||
ChatMessage.create({
|
||||
content: `Vous n'avez les ${minReveValue} Points de Reve nécessaires pour monter dans les Terres Médianes`,
|
||||
whisper: ChatMessage.getWhisperRecipients(this.name)
|
||||
whisper: ChatUtility.getOwners(this)
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -2850,7 +2850,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await this.setBonusPotionSoin(potionData.system.herbebonus);
|
||||
}
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-soin.html`, potionData)
|
||||
});
|
||||
}
|
||||
@ -2887,7 +2887,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
this.bonusRepos = potionData.system.herbebonus;
|
||||
}
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-repos.html`, potionData)
|
||||
});
|
||||
}
|
||||
@ -2919,7 +2919,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins);
|
||||
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData)
|
||||
});
|
||||
}
|
||||
@ -2944,7 +2944,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
}
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-consommer-potion-generique.html`, potionData)
|
||||
});
|
||||
}
|
||||
@ -3044,7 +3044,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
notifyGestionTeteSouffleQueue(item, manualMessage = true) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: `${this.name} a reçu un/une ${item.type}: ${item.name}, qui ${manualMessage ? "n'est pas" : "est"} géré(e) automatiquement. ${manualMessage ? manualMessage : ''}`
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user