From f807d3cd52d9c5b277e484ff539a8ef95c8a964a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:01:41 +0200 Subject: [PATCH 1/7] =?UTF-8?q?Fix:=20flag=20Thanatos=20m=C3=AAme=20en=20c?= =?UTF-8?q?as=20d'=C3=A9chec=20de=20sort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/actor.js b/module/actor.js index de93a0ae..b5528565 100644 --- a/module/actor.js +++ b/module/actor.js @@ -2274,6 +2274,9 @@ export class RdDActor extends Actor { rollData.show = {} rollData.depenseReve = Number(selectedSort.data.ptreve_reel); + if (rollData.competence.name.includes('Thanatos')) { // Si Thanatos + await this.update({ "data.reve.reve.thanatosused": true }); + } let reveActuel = Misc.templateData(this).reve.reve.value; if (rolled.isSuccess) { // Réussite du sort ! if (rolled.isPart) { @@ -2282,9 +2285,6 @@ export class RdDActor extends Actor { if (rollData.isSortReserve) { rollData.depenseReve++; } - if (rollData.competence.name.includes('Thanatos')) { // Si Thanatos - await this.update({ "data.reve.reve.thanatosused": true }); - } if (reveActuel > rollData.depenseReve) { // Incrémenter/gére le bonus de case RdDItemSort.incrementBonusCase(this, selectedSort, rollData.tmr.coord); From d2b612c11c9d7e5d0fccc3140f7eb1ff34218b58 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:07:31 +0200 Subject: [PATCH 2/7] Fix: regression combat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notifier tous les postes clients des données de passe d'arme --- module/rdd-combat.js | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 0fb909b4..7698a484 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -357,6 +357,8 @@ export class RdDCombat { return RdDCombat.onMsgEncaisser(sockmsg.data); case "msg_defense": return RdDCombat.onMsgDefense(sockmsg.data); + case "msg_combat_passearme": + return RdDCombat.onMsgPasseArme(sockmsg.data); } } @@ -427,9 +429,31 @@ export class RdDCombat { return undefined; } + static messagePasseArme(data) { + game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_combat_passearme", data: data }); + RdDCombat.onMsgPasseArme(data); + } + + static onMsgPasseArme(data) { + switch (data.actionPasseArme) { + case "store-attaque": + game.system.rdd.combatStore.attaques[data.id] = data.rollData; + break; + case "store-defense": + game.system.rdd.combatStore.defenses[data.id] = data.rollData; + break; + case "delete-attaque": + delete game.system.rdd.combatStore.attaques[data.id]; + break; + case "delete-defense": + delete game.system.rdd.combatStore.defenses[data.id]; + break; + } + } + /* -------------------------------------------- */ static _storeAttaque(attackerId, attackerRoll) { - game.system.rdd.combatStore.attaques[attackerId] = duplicate(attackerRoll); + RdDCombat.messagePasseArme({ actionPasseArme: "store-attaque", id: attackerId, rollData: attackerRoll }); } /* -------------------------------------------- */ @@ -439,12 +463,12 @@ export class RdDCombat { /* -------------------------------------------- */ static _deleteAttaque(attackerId) { - delete game.system.rdd.combatStore.attaques[attackerId]; + RdDCombat.messagePasseArme({ actionPasseArme: "delete-attaque", id: attackerId }); } /* -------------------------------------------- */ - static _storeDefense(defenderRoll) { - game.system.rdd.combatStore.defenses[defenderRoll.passeArme] = duplicate(defenderRoll); + static _storeDefense(passeArme, defenderRoll) { + RdDCombat.messagePasseArme({ actionPasseArme: "store-defense", id: passeArme, rollData: defenderRoll }); } /* -------------------------------------------- */ @@ -454,7 +478,7 @@ export class RdDCombat { /* -------------------------------------------- */ static _deleteDefense(passeArme) { - delete game.system.rdd.combatStore.defenses[passeArme]; + RdDCombat.messagePasseArme({ actionPasseArme: "delete-defense", id: passeArme }); } /* -------------------------------------------- */ @@ -496,7 +520,7 @@ export class RdDCombat { if (rddCombat) { const defenderRoll = msg.defenderRoll; RdDCombat._storeAttaque(msg.attackerId, defenderRoll.attackerRoll); - RdDCombat._storeDefense(defenderRoll); + RdDCombat._storeDefense(defenderRoll.passeArme, defenderRoll); rddCombat.removeChatMessageActionsPasseArme(defenderRoll.passeArme); rddCombat._chatMessageDefense(msg.paramChatDefense); } @@ -761,7 +785,7 @@ export class RdDCombat { let defenderRoll = { attackerRoll: attackerRoll, passeArme: attackerRoll.passeArme, show: {} } // Save rollData for defender RdDCombat._storeAttaque(this.attackerId, attackerRoll); - RdDCombat._storeDefense(defenderRoll) + RdDCombat._storeDefense(defenderRoll.passeArme, defenderRoll); attackerRoll.show = { cible: this.target ? this.defender.data.name : 'la cible', @@ -996,7 +1020,7 @@ export class RdDCombat { this.removeChatMessageActionsPasseArme(defenderRoll.passeArme); this._sendMessageDefense(defenderRoll.attackerRoll, defenderRoll, { defense: true }); - RdDCombat._storeDefense(defenderRoll); + RdDCombat._storeDefense(defenderRoll.passeArme, defenderRoll); } /* -------------------------------------------- */ @@ -1068,7 +1092,7 @@ export class RdDCombat { this.removeChatMessageActionsPasseArme(defenderRoll.passeArme); this._sendMessageDefense(defenderRoll.attackerRoll, defenderRoll, { defense: true }) - RdDCombat._storeDefense(defenderRoll); + RdDCombat._storeDefense(defenderRoll.passeArme, defenderRoll); } /* -------------------------------------------- */ From 43274ca6b79c4d36845f67cb3fd2165107d9b000 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:08:23 +0200 Subject: [PATCH 3/7] Fix regression sur tour suivant --- module/rdd-combat.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 7698a484..cacc3dd1 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -393,9 +393,11 @@ export class RdDCombat { /* -------------------------------------------- */ static combatNouveauTour(combat) { if (Misc.isElectedUser()) { - let turn = combat.turns.find(t => t.tokenId == combat.current.tokenId); - this.displayActorCombatStatus(combat, turn.actor); - // TODO Playaudio for player?? + let turn = combat.turns.find(t => t.token?.id == combat.current.tokenId); + if (turn?.actor) { + RdDCombat.displayActorCombatStatus(combat, turn.actor); + // TODO Playaudio for player?? + } } } From cc2277c9b7e167807c15fcd7af069ca72fde24ce Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:08:42 +0200 Subject: [PATCH 4/7] Fix typo --- module/dialog-item-achat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/dialog-item-achat.js b/module/dialog-item-achat.js index a6948347..ae1f0e5e 100644 --- a/module/dialog-item-achat.js +++ b/module/dialog-item-achat.js @@ -76,10 +76,10 @@ export class DialogItemAchat extends Dialog { activateListeners(html) { super.activateListeners(html); - html.find(".nombreLots").change(event => this.setnombreLots(Number(event.currentTarget.value))); + html.find(".nombreLots").change(event => this.setNombreLots(Number(event.currentTarget.value))); } - setnombreLots(nombreLots) { + setNombreLots(nombreLots) { this.venteData.nombreLots = nombreLots; this.venteData.prixTotal = (nombreLots * this.venteData.prixLot).toFixed(2); $(".prixTotal").text(this.venteData.prixTotal); From e13750ea6849855eb377424574d6307d253dcf92 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:10:02 +0200 Subject: [PATCH 5/7] removeChatMessageId support undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifie le code de l'appelant préparation pour enchantement de potions --- module/chat-utility.js | 4 +++- module/rdd-utility.js | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/module/chat-utility.js b/module/chat-utility.js index 06eb5fac..8379e146 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -40,7 +40,9 @@ export class ChatUtility { } static removeChatMessageId(messageId) { - ChatUtility.removeMessages({ messageId: messageId }); + if (messageId){ + ChatUtility.removeMessages({ messageId: messageId }); + } } /* -------------------------------------------- */ diff --git a/module/rdd-utility.js b/module/rdd-utility.js index f3c36f7c..68a4a7c0 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -614,10 +614,7 @@ export class RdDUtility { let actor = RdDUtility.getSelectedActor("Pour effectuer le paiement:"); if (actor) { actor.depenserDeniers(sumdenier, objData, quantite, fromActorId); - let chatMessageId = RdDUtility.findChatMessageId(event.currentTarget); - if (chatMessageId) { - ChatUtility.removeChatMessageId(chatMessageId); - } + ChatUtility.removeChatMessageId(RdDUtility.findChatMessageId(event.currentTarget)); } }); } From 5e68a6758323cff2d874eb27d62e865a750b1380 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:10:22 +0200 Subject: [PATCH 6/7] remove unused import --- module/rdd-token-hud.js | 1 - 1 file changed, 1 deletion(-) diff --git a/module/rdd-token-hud.js b/module/rdd-token-hud.js index 8d46bd3d..d748964f 100644 --- a/module/rdd-token-hud.js +++ b/module/rdd-token-hud.js @@ -2,7 +2,6 @@ import { HtmlUtility } from "./html-utility.js"; import { Misc } from "./misc.js"; import { RdDCombatManager } from "./rdd-combat.js"; -import { RdDUtility } from "./rdd-utility.js"; /* -------------------------------------------- */ export class RdDTokenHud { From 4821046c2f581d1fb7dbc81cdb8d8294dbf7de45 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Tue, 1 Jun 2021 00:12:28 +0200 Subject: [PATCH 7/7] Increment version 1.4.14 --- system.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system.json b/system.json index 9c14a6fc..ff795879 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.4.13", + "version": "1.4.14", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "0.8.5",