From 16ce6a58ddc848eb59ceb3854b23184d193bf57f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jul 2022 00:31:27 +0200 Subject: [PATCH 1/4] Fix accorder entite de cauchemar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A priori vieille régression, pas vue depuis. attaquant._id est devenu attaquant.id --- module/actor.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/module/actor.js b/module/actor.js index 5fb2a4e2..0a31555f 100644 --- a/module/actor.js +++ b/module/actor.js @@ -98,7 +98,6 @@ export class RdDActor extends Actor { * @param {Object} options (Unused) Additional options which customize the creation workflow. * */ - static async create(actorData, options) { // Case of compendium global import if (actorData instanceof Array) { @@ -135,13 +134,6 @@ export class RdDActor extends Actor { this.encTotal = 0; this.prixTotalEquipement = 0; - /* - // Auto-resize token - if (this.isToken) { - let tokenSize = actorData.data.carac.taille.value/10; - this.token.update({height: tokenSize, width: tokenSize } ); - }*/ - // Make separate methods for each Actor type (character, npc, etc.) to keep // things organized. if (actorData.type === 'personnage') this._prepareCharacterData(actorData); @@ -3593,7 +3585,7 @@ export class RdDActor extends Actor { isEntiteCauchemarAccordee(attaquant) { if (!this.isEntiteCauchemar()) { return true; } let resonnance = Misc.templateData(this).sante.resonnance; - return (resonnance.actors.find(it => it == attaquant._id)); + return (resonnance.actors.find(it => it == attaquant.id)); } /* -------------------------------------------- */ @@ -3603,11 +3595,11 @@ export class RdDActor extends Actor { return; } let resonnance = duplicate(Misc.templateData(this).sante.resonnance); - if (resonnance.actors.find(it => it == attaquant._id)) { + if (resonnance.actors.find(it => it == attaquant.id)) { // déjà accordé return; } - resonnance.actors.push(attaquant._id); + resonnance.actors.push(attaquant.id); await this.update({ "data.sante.resonnance": resonnance }); return; } From 34cc671f127b2266aaeb3d6c375b7efdf164ba22 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jul 2022 00:36:16 +0200 Subject: [PATCH 2/4] Fix init Autre action --- module/rdd-combat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/rdd-combat.js b/module/rdd-combat.js index c057fbaa..455e76ff 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -320,7 +320,7 @@ export class RdDCombatManager extends Combat { initOffset = 10; caracForInit = combatant.actor.getReveActuel(); initInfo = "Possession" - } else if (action.name == 'autre') { + } else if (action.action == 'autre') { initOffset = 2; initInfo = "Autre Action" } else if (action.action == 'haut-reve') { From d51243d74f542eacf7749894f47cc51618c19cc7 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jul 2022 01:01:46 +0200 Subject: [PATCH 3/4] Fix Bouton "prendre" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le bouton devenait "Acheter" car le prix après la première prise était récupéré sous forme de string (et le template fait une comparaison de nombre) --- module/dialog-item-achat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/dialog-item-achat.js b/module/dialog-item-achat.js index b6b3f6ba..ddf4d78f 100644 --- a/module/dialog-item-achat.js +++ b/module/dialog-item-achat.js @@ -55,7 +55,7 @@ export class DialogItemAchat extends Dialog { static prepareVenteData(buttonAcheter, vendeurId, vendeur, acheteur) { const jsondata = buttonAcheter.attributes['data-jsondata']?.value; - const prixLot = buttonAcheter.attributes['data-prixLot']?.value ?? 0; + const prixLot = parseInt(buttonAcheter.attributes['data-prixLot']?.value ?? 0); let venteData = { item: JSON.parse(jsondata), vendeurId: vendeurId, From 46f5cb67f6b1ece954413c7ee476acd1e70bbb7f Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 22 Jul 2022 01:31:21 +0200 Subject: [PATCH 4/4] =?UTF-8?q?Cr=C3=A9er=20un=20acteur=20depuis=20/nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-namegen.js | 28 +++++++++++++++++++--------- module/rdd-utility.js | 2 ++ templates/chat-command-nom.html | 16 ++++++++++++++++ 3 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 templates/chat-command-nom.html diff --git a/module/rdd-namegen.js b/module/rdd-namegen.js index 52713906..f054f435 100644 --- a/module/rdd-namegen.js +++ b/module/rdd-namegen.js @@ -1,19 +1,29 @@ +import { RdDActor } from "./actor.js"; import { Misc } from "./misc.js"; import { RdDDice } from "./rdd-dice.js"; -const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi', - 'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la', 'al' , 'pul', 'one', 'ner', 'nur', 'mac', 'mery', - 'cat', 'do', 'di', 'der', 'er', 'el', 'far', 'fer', 'go', 'guer', 'hot', 'jor', 'jar', 'ji', 'kri', 'ket', 'lor', 'hur', - 'lar', 'lir', 'lu', 'pot', 'pro', 'pra', 'pit', 'qua', 'qui', 're', 'ral', 'sal', 'sen', 'ted', 'to', 'ta', 'lars', 'ver', - 'vin', 'ov', 'wal', 'ry', 'ly', '' ]; +const words = ['pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i', 'onse', 'iane', 'ane', 'zach', 'arri', 'ba', 'bo', 'bi', + 'alta', 'par', 'pir', 'zor', 'zir', 'de', 'pol', 'tran', 'no', 'la', 'al', 'pul', 'one', 'ner', 'nur', 'mac', 'mery', + 'cat', 'do', 'di', 'der', 'er', 'el', 'far', 'fer', 'go', 'guer', 'hot', 'jor', 'jar', 'ji', 'kri', 'ket', 'lor', 'hur', + 'lar', 'lir', 'lu', 'pot', 'pro', 'pra', 'pit', 'qua', 'qui', 're', 'ral', 'sal', 'sen', 'ted', 'to', 'ta', 'lars', 'ver', + 'vin', 'ov', 'wal', 'ry', 'ly', '']; /* -------------------------------------------- */ export class RdDNameGen { - static async getName( msg, params ) { - let name = Misc.upperFirst( await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words) ) - //console.log(name); - ChatMessage.create( { content: `Nom : ${name}`, whisper: ChatMessage.getWhisperRecipients("GM") } ); + static async getName(msg, params) { + const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-command-nom.html`, { + nom: Misc.upperFirst(await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words)) + }); + ChatMessage.create({ content: html, whisper: ChatMessage.getWhisperRecipients("GM") }); } + static async onCreerActeur(event) { + const button = event.currentTarget; + await RdDActor.create({ + name: button.attributes['data-nom'].value, + type: button.attributes['data-type'].value + }, + {renderSheet: true}); + } } \ No newline at end of file diff --git a/module/rdd-utility.js b/module/rdd-utility.js index d6f26d13..afc4b2e3 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -11,6 +11,7 @@ import { RdDDice } from "./rdd-dice.js"; import { RdDItem } from "./item.js"; import { Monnaie } from "./item-monnaie.js"; import { RdDPossession } from "./rdd-possession.js"; +import { RdDNameGen } from "./rdd-namegen.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 @@ -704,6 +705,7 @@ export class RdDUtility { // gestion bouton tchat Acheter html.on("click", '.button-acheter', event => DialogItemAchat.onButtonAcheter(event)); + html.on("click", '.button-creer-acteur', event => RdDNameGen.onCreerActeur(event)); // Gestion du bouton payer html.on("click", '.payer-button', event => { diff --git a/templates/chat-command-nom.html b/templates/chat-command-nom.html new file mode 100644 index 00000000..8467fe6e --- /dev/null +++ b/templates/chat-command-nom.html @@ -0,0 +1,16 @@ + +

Proposition de nom: {{nom}}

+ + + Créer un Personnage + + + + Créer une créature + +