From f77b8fd91e9e4950e84ddd79203e597ff9efc920 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 7 Oct 2021 22:31:14 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Fix=20particuli=C3=A8re=20sur=20jet=20de=20?= =?UTF-8?q?r=C3=AAve=20actuel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La détermination de caractéristique échouait, du coup, le message résultat ne s'affichait pas, l'expérience n'était pas ajoutée --- module/actor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/actor.js b/module/actor.js index 7972110f..9a89f9bd 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2991,8 +2991,8 @@ export class RdDActor extends Actor { } /* -------------------------------------------- */ - getCaracByName(caracName) { - switch (Grammar.toLowerCaseNoAccent(caracName)) { + getCaracByName(name) { + switch (Grammar.toLowerCaseNoAccent(name)) { case 'reve-actuel': case 'reve actuel': return { label: 'Rêve actuel', @@ -3006,14 +3006,14 @@ export class RdDActor extends Actor { type: "number" }; } - return RdDActor._findCaracByName(Misc.templateData(this).carac, caracName); + return RdDActor._findCaracByName(Misc.templateData(this).carac, name); } /* -------------------------------------------- */ static _findCaracByName(carac, name) { name = Grammar.toLowerCaseNoAccent(name); switch (name) { - case 'reve-actuel': case 'rêve actuel': + case 'reve-actuel': case 'reve actuel': return carac.reve; case 'chance-actuelle': case 'chance actuelle': return carac.chance; From 2c48d9581a171a1b9c15ca402be86171505d544f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 7 Oct 2021 22:32:52 +0200 Subject: [PATCH 2/5] Colonne de boutons foundry plus courte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix de bug de style qui fait que la partie de la fenêtre de calendrier au niveau de la deuxième colonne de boutons ne pouvait pas être utilisée --- styles/simple.css | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/styles/simple.css b/styles/simple.css index e925f788..fa959565 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1134,7 +1134,10 @@ ul, li { border-image-width: 4px; border-image-outset: 0px; } - + #controls .control-tools { + max-height: calc(100vh - 156px); + height: auto; +} #controls .scene-control.active, #controls .control-tool.active, #controls .scene-control:hover, #controls .control-tool:hover { background: rgba(72, 46, 28, 1); background-origin: padding-box; From 545dff3b29ded6f06e40f300409e34b652c04154 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 7 Oct 2021 22:36:20 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Incr=C3=A9menter=20l'=C3=A2ge=20des=20bless?= =?UTF-8?q?ures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Même si le nombre de jours est passé, incrémenter l'âge pour aider à suivre le temps de guérison --- module/actor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/module/actor.js b/module/actor.js index 9a89f9bd..f7a319e7 100644 --- a/module/actor.js +++ b/module/actor.js @@ -519,6 +519,7 @@ export class RdDActor extends Actor { await this.santeIncDec("vie", -1); } else { + blessure.jours++; message.content += ` -- une blessure ${type} reste stable`; } } From db8f17fbc5e6f7514190a3b88d6d9fa3680d34d3 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 7 Oct 2021 22:41:22 +0200 Subject: [PATCH 4/5] =?UTF-8?q?Messages=20d'exp=C3=A9rience=20priv=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Toujours envoyer les messages au MJ + joueur, pas à tout le monde Sinon, l'expérience des PNJs est visible en cas de jet publics --- module/actor.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/module/actor.js b/module/actor.js index f7a319e7..c25acfa5 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2112,7 +2112,8 @@ export class RdDActor extends Actor { xp: carac.xp } if (display) { - ChatUtility.createChatWithRollMode(this.name, { + ChatMessage.create({ + whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp) }); } @@ -2143,7 +2144,8 @@ export class RdDActor extends Actor { archetypeWarning: newCompData.data.niveau > compData.data.niveau_archetype } if (display) { - ChatUtility.createChatWithRollMode(this.name, { + ChatMessage.create({ + whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, checkXp) }); } @@ -2157,11 +2159,10 @@ export class RdDActor extends Actor { if (!this.isPersonnage()) return; let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence); if (xpData && display) { - let message = { + ChatMessage.create({ whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData) - } - ChatMessage.create(message); + }); } } From a3a5132f301c62b3b9b7b5c19d626de1a60900d9 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 7 Oct 2021 23:52:02 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Am=C3=A9lioration=20des=20messages=20de=20c?= =?UTF-8?q?ommerce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Envoyé par l'acheteur plutôt que par le MJ - les erreurs sont affichées au joueur plutôt qu'au MJ --- module/actor.js | 5 +++-- module/chat-utility.js | 40 +++++++++++++++++++++++++++++++++++++ module/dialog-item-achat.js | 1 + 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/module/actor.js b/module/actor.js index c25acfa5..c5014b77 100644 --- a/module/actor.js +++ b/module/actor.js @@ -3589,7 +3589,7 @@ export class RdDActor extends Actor { if (acheteur) { let resteAcheteur = await acheteur.depenser(coutDeniers); if (resteAcheteur < 0) { - ui.notifications.warn(`Vous n'avez pas assez d'argent pour payer ${vente.prixTotal} sols !`); + ChatUtility.notifyUser(achat.userId, 'warn', `Vous n'avez pas assez d'argent pour payer ${Math.ceil(coutDeniers/100)} sols !`); return; } } @@ -3598,7 +3598,7 @@ export class RdDActor extends Actor { let itemVenduData = Misc.data(itemVendu); if ("quantite" in itemVenduData.data ? itemVenduData.data.quantite < achat.quantiteTotal : achat.choix.nombreLots != 1) { await acheteur?.ajouterDeniers(coutDeniers); - ui.notifications.warn(`Le vendeur n'a plus assez de ${vente.item.name} !`); + ChatUtility.notifyUser(achat.userId, 'warn', `Le vendeur n'a plus assez de ${vente.item.name} !`); return; } vendeur.ajouterDeniers(coutDeniers); @@ -3630,6 +3630,7 @@ export class RdDActor extends Actor { const chatAchatItem = duplicate(vente); chatAchatItem.quantiteTotal = achat.quantiteTotal; ChatMessage.create({ + speaker: {alias: (acheteur ?? vendeur).name} , whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-achat-item.html', chatAchatItem) }); diff --git a/module/chat-utility.js b/module/chat-utility.js index 30fc0766..dd80bb55 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -9,6 +9,33 @@ export class ChatUtility { static onSocketMessage(sockmsg) { switch (sockmsg.msg) { case "msg_delete_chat_message": return ChatUtility.onRemoveMessages(sockmsg.data); + case "msg_user_ui_notifications": return ChatUtility.onNotifyUser(sockmsg.data); + } + } + + + /* -------------------------------------------- */ + static notifyUser(userId, level = 'info', message) { + const data = { + userId: userId, level: level, message: message + }; + if (game.user.id == userId) { + ChatUtility.onNotifyUser(data); + } + else { + game.socket.emit("system.foundryvtt-reve-de-dragon", { + msg: "msg_user_ui_notifications", data: data + }); + } + } + + static onNotifyUser(data) { + if (game.user.id == data.userId) { + switch (data.level) { + case 'warn': ui.notifications.warn(data.message); break; + case 'error': ui.notifications.error(data.message); break; + default: ui.notifications.info(data.message); break; + } } } @@ -25,6 +52,19 @@ export class ChatUtility { } } + static onRemoveMessages(data) { + if (Misc.isElectedUser()) { + if (data.part) { + const toDelete = game.messages.filter(it => it.data.content.includes(data.part)); + toDelete.forEach(it => it.delete()); + } + if (data.messageId) { + game.messages.get(data.messageId)?.delete(); + } + } + } + /* -------------------------------------------- */ + static removeMessages(data) { if (Misc.isElectedUser()){ ChatUtility.onRemoveMessages(data); diff --git a/module/dialog-item-achat.js b/module/dialog-item-achat.js index 8c3c20f8..0d9c9c90 100644 --- a/module/dialog-item-achat.js +++ b/module/dialog-item-achat.js @@ -79,6 +79,7 @@ export class DialogItemAchat extends Dialog { async onAchat() { await $(".nombreLots").change(); (this.vendeur ?? this.acheteur).achatVente({ + userId: game.user.id, vendeurId: this.vendeur?.id, acheteurId: this.acheteur?.id, prixTotal: this.venteData.prixTotal,