From db500e1b4c541b0d119e0cc6e70605171c7a8348 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 29 Nov 2020 18:21:34 +0100 Subject: [PATCH] Modif sur gestion equipement --- module/actor-sheet.js | 2 +- module/actor.js | 13 +++++++--- module/rdd-tmr-dialog.js | 19 ++++++++++++--- module/rdd-tmr-rencontre-dialog.js | 39 ++++++++++++++++++++++++++++++ module/rdd-utility.js | 1 + packs/competences-entites.db | 22 ++++++++--------- 6 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 module/rdd-tmr-rencontre-dialog.js diff --git a/module/actor-sheet.js b/module/actor-sheet.js index bf6a53a0..1aaa6d3a 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -15,7 +15,7 @@ export class RdDActorSheet extends ActorSheet { classes: ["rdd", "sheet", "actor"], template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html", width: 640, - height: 720, + //height: 720, tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}], dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}], editCaracComp: false diff --git a/module/actor.js b/module/actor.js index 8724a3f8..8c95e89a 100644 --- a/module/actor.js +++ b/module/actor.js @@ -130,7 +130,7 @@ export class RdDActor extends Actor { let rolled = await RdDResolutionTable.roll(rollData.caracValue, rollData.finalLevel); //rolled.isPart = true; // Pour tester le particulières rollData.rolled = rolled; // garder le résultat - console.log("performRoll", rollData, rolled) + //console.log("performRoll", rollData, rolled) if ( !rollData.attackerRoll) // Store in the registry if not a defense roll game.system.rdd.rollDataHandler[this.data._id] = rollData; @@ -331,7 +331,9 @@ export class RdDActor extends Actor { } if (closeTMR) { this.currentTMR.close(); // Close TMR ! - } + } else { + this.currentTMR.maximize(); // Re-display TMR + } return explications } @@ -1096,7 +1098,8 @@ export class RdDActor extends Actor { surencMalusApply: false, isNatation: false, useEncForNatation: false - } + } + if ( this.currentTMR) this.currentTMR.minimize(); // Hide let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-sort.html', rollData); new RdDRollDialog("sort", html, rollData, this ).render(true); } @@ -1157,6 +1160,10 @@ export class RdDActor extends Actor { } } + // Notification au MJ + ChatMessage.create( { content: game.user.name + " est monté dans les TMR en mode : " + mode, whisper: ChatMessage.getWhisperRecipients("GM") } ); + + // Ouverture TMR let data = { fatigue: { malus: RdDUtility.calculMalusFatigue(this.data.data.sante.fatigue.value, this.data.data.sante.endurance.max), diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 6a0bc2aa..2fc5391a 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -6,6 +6,7 @@ import { RdDUtility } from "./rdd-utility.js"; import { TMRUtility } from "./tmr-utility.js"; import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; +import { RdDTMRRencontreDialog } from "./rdd-tmr-rencontre-dialog.js"; /* -------------------------------------------- */ const tmrConstants = { @@ -253,6 +254,8 @@ export class RdDTMRDialog extends Dialog { console.log("manageRencontre", rencontre) this.currentRencontre = duplicate(rencontre); + let dialog = new RdDTMRRencontreDialog("", this, this.currentRencontre); + /* let dialog = new Dialog({ title: "Rencontre en TMR!", content: "Vous recontrez un " + rencontre.name + " de force " + rencontre.force + "
", @@ -262,7 +265,7 @@ export class RdDTMRDialog extends Dialog { maitiser: { icon: '', label: "Maîtriser", callback: () => this.maitriser() } }, default: "derober" - }); + });*/ dialog.render(true); } } @@ -313,31 +316,39 @@ export class RdDTMRDialog extends Dialog { // TODO: ajouter l'état général? const etatGeneral = this.actor.data.data.compteurs.etat.value let difficulte = draconic.data.niveau - 7; - let rolled = RdDResolutionTable.roll(carac, difficulte); + let rolled = await RdDResolutionTable.roll(carac, difficulte); console.log("manageCaseHumide >>", rolled); let explication = ""; + let msg2MJ = ""; this.toclose = rolled.isEchec; if (rolled.isEchec) { explication += "Vous êtes entré sur une case humide, et vous avez raté votre maîtrise ! Vous quittez les Terres Médianes !" + msg2MJ += game.user.name + " est rentré sur une case humides : Echec !"; } else { explication += "Vous êtes entré sur une case humide, et vous avez réussi votre maîtrise !" + msg2MJ += game.user.name + " est rentré sur une case humides : Réussite !"; } explication += "
Test : Rêve actuel / " + draconic.name + " / " + cellDescr.type + "" + RdDResolutionTable.explain(rolled); if (rolled.isETotal) { - let souffle = RdDRollTables.getSouffle(); + let souffle = await RdDRollTables.getSouffle(); explication += "
Vous avez fait un Echec Total. Vous subissez un Souffle de Dragon : " + souffle.name; + msg2MJ += "
Et a reçu un Souffle de Dragon : " + souffle.name; this.actor.createOwnedItem(souffle); } if (rolled.isPart) { explication += "
Vous avez fait une Réussite Particulière"; - explication += RdDResolutionTable.buildXpMessage(rolled, difficulte) + explication += RdDResolutionTable.buildXpMessage(rolled, difficulte); + msg2MJ += "
Et a fait une réussite particulière"; } + // Notification au MJ + ChatMessage.create( { content: msg2MJ, whisper: ChatMessage.getWhisperRecipients("GM") } ); + // Et au joueur (ca pourrait être un message de tchat d'ailleurs) let humideDiag = new Dialog({ title: "Case humide", content: explication, diff --git a/module/rdd-tmr-rencontre-dialog.js b/module/rdd-tmr-rencontre-dialog.js new file mode 100644 index 00000000..c1ded3eb --- /dev/null +++ b/module/rdd-tmr-rencontre-dialog.js @@ -0,0 +1,39 @@ +/* -------------------------------------------- */ +export class RdDTMRRencontreDialog extends Dialog { + + /* -------------------------------------------- */ + constructor(html, tmrApp, rencontreData) { + const dialogConf = { + title: "Rencontre en TMR!", + content: "Vous recontrez un " + rencontreData.name + " de force " + rencontreData.force + "
", + buttons: { + derober: { icon: '', label: "Se dérober", callback: () => { this.toClose = true; this.tmrApp.derober() } }, + refouler: { icon: '', label: "Refouler", callback: () => { this.toClose = true;this.tmrApp.refouler() } }, + maitiser: { icon: '', label: "Maîtriser", callback: () => { this.toClose = true;this.tmrApp.maitriser() } } + }, + default: "derober" + } + + const dialogOptions = { + classes: ["tmrrencdialog"], + width: 320, height: 240, + 'z-index': 20 + } + super(dialogConf, dialogOptions); + + this.toClose = false; + this.rencontreData = duplicate(rencontreData); + this.tmrApp = tmrApp; + this.tmrApp.minimize(); + } + + /* -------------------------------------------- */ + close() { + if ( this.toClose ) { + this.tmrApp.maximize(); + return super.close(); + } + ui.notifications.info("Vous devez résoudre la rencontre."); + } + +} diff --git a/module/rdd-utility.js b/module/rdd-utility.js index f7543996..4f38a261 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -650,6 +650,7 @@ export class RdDUtility { } } + /* -------------------------------------------- */ static _handleMsgDefense(data) { let defenderActor = game.actors.get(data.defenderid); if (defenderActor) { diff --git a/packs/competences-entites.db b/packs/competences-entites.db index a425d32c..377a69a2 100644 --- a/packs/competences-entites.db +++ b/packs/competences-entites.db @@ -1,11 +1,11 @@ -{"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","effects":[],"_id":"0Ms9iKxqigNNpZEx"} -{"_id":"18wcei5hlEInsBFO","name":"Attaque","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} -{"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]} -{"_id":"9Y83OsQgeyR5oCdH","name":"Griffes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} -{"_id":"QGULMUoC9JXFze0r","name":"Bouclier Lourd","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_bouclier.png","effects":[]} -{"_id":"WsYnwR8GcOxfuCI0","name":"Bras-Galet","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_course.png","effects":[]} -{"name":"Corps à Corps","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.png","effects":[],"_id":"c0I93Q53i4ZmxpyT"} -{"name":"Bec","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":""},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.os88Rsp7mBkahqmh"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","effects":[],"_id":"d5SZ09sFaG3cL2Rg"} -{"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]} -{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]} -{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","effects":[],"_id":"j1xHCzfIeYKgXxoH"} +{"name":"Esquive","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_esquive.png","effects":[],"_id":"0Ms9iKxqigNNpZEx"} +{"_id":"18wcei5hlEInsBFO","name":"Attaque","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} +{"_id":"3Crwg8cx2JOb697T","name":"Parade","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_saut.png","effects":[]} +{"_id":"9Y83OsQgeyR5oCdH","name":"Griffes","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.BjqRrGtHtTzuNpZB"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-griffes.png","effects":[]} +{"_id":"QGULMUoC9JXFze0r","name":"Bouclier Lourd","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_bouclier.png","effects":[]} +{"_id":"WsYnwR8GcOxfuCI0","name":"Bras-Galet","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_course.png","effects":[]} +{"name":"Corps à Corps","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.png","effects":[],"_id":"c0I93Q53i4ZmxpyT"} +{"name":"Bec","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":""},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.os88Rsp7mBkahqmh"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-beak.png","effects":[],"_id":"d5SZ09sFaG3cL2Rg"} +{"_id":"db8E8HwROw1ZcwRR","name":"Crocs","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-creatures.NctG7suzvGE7ZZzj"}},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-brasbouche.png","effects":[]} +{"_id":"gPOQd9NI7AFH0whX","name":"Epée Bâtarde","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":true,"dommages":0,"description":"","carac-value":null},"flags":{"core":{"sourceId":"Compendium.foundryvtt-reve-de-dragon.competences-humanoides.YTKld5ggDsHqwYoR"}},"img":"systems/foundryvtt-reve-de-dragon/icons/competence_epee_1_main.png","effects":[]} +{"name":"Morsure","permission":{"default":0,"Q4cUvqxCxMoTJXDL":3},"type":"competencecreature","data":{"niveau":0,"carac_value":0,"iscombat":false,"dommages":0,"description":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/compcreature-morsure.png","effects":[],"_id":"j1xHCzfIeYKgXxoH"}