From 6675539c5900a4e32faeab12ee1ab3e1bf4d2de2 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 10 Feb 2021 11:24:14 +0100 Subject: [PATCH] =?UTF-8?q?#140=20Permettre=20des=20jets=20de=20carac=20d?= =?UTF-8?q?=C3=A9riv=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 2 +- module/chat-utility.js | 4 +++- module/rdd-main.js | 7 ++++++- module/rdd-utility.js | 9 ++++++++- templates/actor-sheet.html | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/module/actor.js b/module/actor.js index 6a0d0f62..d82abf96 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2530,7 +2530,7 @@ export class RdDActor extends Actor { verifierForceMin( item ) { if ( item.type == 'arme' && item.data.force > this.data.data.carac.force.value ) { ChatMessage.create( { content: `${this.name} s'est équipé(e) de l'arme ${item.name}, mais n'a pas une force suffisante pour l'utiliser normalement - (${item.data.force} nécessaire pour unr Force de ${this.data.data.carac.force.value})` } ); + (${item.data.force} nécessaire pour une Force de ${this.data.data.carac.force.value})` } ); } } diff --git a/module/chat-utility.js b/module/chat-utility.js index be3c737b..d38514ca 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -4,12 +4,14 @@ */ export class ChatUtility { + /* -------------------------------------------- */ static onSocketMessage(sockmsg) { switch (sockmsg.msg) { case "msg_delete_chat_message": return ChatUtility.onRemoveMessages(sockmsg.part, sockmsg.gmId); } } + /* -------------------------------------------- */ static onRemoveMessages(part, gmId) { if (game.user._id == gmId) { const toDelete = game.messages.filter(it => it.data.content.includes(part)); @@ -107,5 +109,5 @@ export class ChatUtility { ChatMessage.create(data); } } - + } diff --git a/module/rdd-main.js b/module/rdd-main.js index 7bf9ebeb..ac026714 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -300,4 +300,9 @@ Hooks.on("chatMessage", (html, content, msg) => { /* -------------------------------------------- */ Hooks.on("getCombatTrackerEntryContext", (html, options) => { RdDUtility.pushInitiativeOptions(html, options); -}) +}); + +/* -------------------------------------------- */ +Hooks.on("renderChatMessage", async (app, html, msg) => { + RdDUtility.onRenderChatMessage(app, html, msg); +}); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 086b1519..cd1b1c32 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -1024,7 +1024,7 @@ export class RdDUtility { } } - /* -------------------------------------------- */ + /*-------------------------------------------- */ static checkThanatosXP(compName) { if ( compName.includes('Thanatos') ) { let message = "Vous avez mis des points d'Expérience dans la Voie de Thanatos !
Vous devez réduire manuellement d'un même montant d'XP une autre compétence Draconique."; @@ -1034,4 +1034,11 @@ export class RdDUtility { }); } } + + /*-------------------------------------------- */ + static async onRenderChatMessage( app, html, msg ) { + // TODO + //console.log(app, html, msg); + } + } diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 169ba52e..2ae3963d 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -128,7 +128,7 @@