From f207cb73253e63596af666111e078dfea4ab9655 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Jul 2024 20:31:24 +0200 Subject: [PATCH 1/5] =?UTF-8?q?Fix:=20Fen=C3=AAtre=20d'=C3=A9dition=20du?= =?UTF-8?q?=20calendrier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout d'un helper Handlebars pour accéder à l'objet RDD_CONFIG sans avoir besoin de l'ajouter dans les données pour rendu du template --- changelog.md | 3 +++ module/actor.js | 3 +-- module/actor/base-actor-sheet.js | 3 +-- module/dialog-chronologie.js | 1 - module/item-sheet.js | 1 - module/rdd-main.js | 6 +++--- module/rdd-utility.js | 7 +++++-- module/time/rdd-calendrier.js | 6 +++--- templates/actor/carac-derivee.html | 2 +- templates/actor/carac-entitee.html | 4 ++-- templates/common/timestamp.hbs | 4 ++-- templates/item/partial-environnement.html | 2 +- 12 files changed, 22 insertions(+), 20 deletions(-) diff --git a/changelog.md b/changelog.md index b0233322..3983e091 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 12.0 +## 12.0.5 - Les mauvais jours d'Astrobazzarh +- Fix: on peut de nouveau ouvrir l'édition de calendrier + ## 12.0.4 - La plaie d'Astrobazzarh - **Support V12** - Fix: les boutons d'encaissement dans le tchat fonctionnent de nouveau diff --git a/module/actor.js b/module/actor.js index 5fa1e100..cc07498b 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1146,8 +1146,7 @@ export class RdDActor extends RdDBaseActorSang { diffNbDoses: -Number(this.system.compteurs.ethylisme.nb_doses || 0), finalLevel: 0, diffConditions: 0, - ajustementsForce: CONFIG.RDD.difficultesLibres, - config: game.system.rdd.config + ajustementsForce: CONFIG.RDD.difficultesLibres } let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-ethylisme.html', rollData); new RdDRollDialogEthylisme(html, rollData, this, r => this.saouler(r.forceAlcool)).render(true); diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 1df6c37d..8af1c89e 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -38,8 +38,7 @@ export class RdDBaseActorSheet extends ActorSheet { description: await TextEditor.enrichHTML(this.actor.system.description, { async: true }), notesmj: await TextEditor.enrichHTML(this.actor.system.notesmj, { async: true }), options: RdDSheetUtility.mergeDocumentRights(this.options, this.actor, this.isEditable), - effects: this.actor.effects, - config: game.system.rdd.config + effects: this.actor.effects } RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); diff --git a/module/dialog-chronologie.js b/module/dialog-chronologie.js index 244589c9..781e31d1 100644 --- a/module/dialog-chronologie.js +++ b/module/dialog-chronologie.js @@ -25,7 +25,6 @@ export class DialogChronologie extends Dialog { journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID), journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)), timestamp: game.system.rdd.calendrier.timestamp, - config: game.system.rdd.config, dateReel: game.system.rdd.calendrier.dateReel() }; const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData); diff --git a/module/item-sheet.js b/module/item-sheet.js index b11efec2..2bfc34b0 100644 --- a/module/item-sheet.js +++ b/module/item-sheet.js @@ -99,7 +99,6 @@ export class RdDItemSheet extends ItemSheet { descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, { async: true }), isComestible: this.item.getUtilisationCuisine(), options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable), - config: game.system.rdd.config } if (this.item.type == TYPES.competencecreature) { formData.isparade = RdDItemCompetenceCreature.isParade(this.item) diff --git a/module/rdd-main.js b/module/rdd-main.js index cca02660..d51f3351 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -71,15 +71,16 @@ import { RdDTMRDialog } from "./rdd-tmr-dialog.js"; * Software License: GNU GPLv3 */ export class SystemReveDeDragon { - + static start() { const system = new SystemReveDeDragon() Hooks.once('init', async () => await system.onInit()) Hooks.once('diceSoNiceReady', (dice3d) => RdDDice.diceSoNiceReady(dice3d)) Hooks.once('ready', () => system.onReady()) } - + constructor() { + this.config = RDD_CONFIG; this.RdDUtility = RdDUtility; this.RdDHotbar = RdDHotbar; this.itemClasses = { @@ -108,7 +109,6 @@ export class SystemReveDeDragon { /* -------------------------------------------- */ async onInit() { game.system.rdd = this; - game.system.rdd.config = RDD_CONFIG; this.AppAstrologie = AppAstrologie; diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 028ab7a1..92cf7e6b 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -19,6 +19,7 @@ import { RdDEmpoignade } from "./rdd-empoignade.js"; import { ExperienceLog } from "./actor/experience-log.js"; import { RdDCoeur } from "./coeur/rdd-coeur.js"; import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js"; +import { RDD_CONFIG } from "./constants.js"; /* -------------------------------------------- */ // This table starts at 0 -> niveau -10 @@ -262,8 +263,6 @@ export class RdDUtility { ]; Handlebars.registerHelper('either', (a, b) => a ?? b); - Handlebars.registerHelper('computeResolutionScore', (row, col) => RdDResolutionTable.computePercentage(row, col)); - Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col)); Handlebars.registerHelper('upperFirst', str => Misc.upperFirst(str ?? 'Null')); Handlebars.registerHelper('lowerFirst', str => Misc.lowerFirst(str ?? 'Null')); Handlebars.registerHelper('upper', str => str?.toUpperCase() ?? ''); @@ -272,6 +271,10 @@ export class RdDUtility { Handlebars.registerHelper('apostrophe', (article, str) => Grammar.apostrophe(article, str)); Handlebars.registerHelper('un', str => Grammar.articleIndetermine(str)); Handlebars.registerHelper('accord', (genre, ...args) => Grammar.accord(genre, args)); + + Handlebars.registerHelper('RDD_CONFIG', path => RDD_CONFIG[path]) + Handlebars.registerHelper('computeResolutionScore', (row, col) => RdDResolutionTable.computePercentage(row, col)); + Handlebars.registerHelper('computeResolutionChances', (row, col) => RdDResolutionTable.computeChances(row, col)); Handlebars.registerHelper('buildLigneInventaire', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildLigneInventaire(item, options)); }); Handlebars.registerHelper('buildInventaireConteneur', (actorId, itemId, options) => { return new Handlebars.SafeString(RdDUtility.buildInventaireConteneur(actorId, itemId, options)); }); Handlebars.registerHelper('buildContenuConteneur', (item, options) => { return new Handlebars.SafeString(RdDUtility.buildContenuConteneur(item, options)); }); diff --git a/module/time/rdd-calendrier.js b/module/time/rdd-calendrier.js index d5f4432d..5e7e88a5 100644 --- a/module/time/rdd-calendrier.js +++ b/module/time/rdd-calendrier.js @@ -123,9 +123,9 @@ export class RdDCalendrier extends Application { /* -------------------------------------------- */ fillCalendrierData(formData = {}) { foundry.utils.mergeObject(formData, this.timestamp.toCalendrier()); - formData.isGM = game.user.isGM; + formData.isGM = game.user.isGM formData.heures = RdDTimestamp.definitions() - formData.horlogeAnalogique = this.horlogeAnalogique; + formData.horlogeAnalogique = this.horlogeAnalogique formData.autoDarkness = AutoAdjustDarkness.isAuto() return formData; } @@ -372,7 +372,7 @@ export class RdDCalendrier extends Application { game.socket.emit(SYSTEM_SOCKET_ID, { msg: "msg_app_astrologie_refresh", data: {} }) } } - + async addNbAstralJoueur(actor, date, nbAstral, isValid) { const nombresAstraux = this.getNombresAstraux() const astralData = nombresAstraux.find(it => it.index == date) diff --git a/templates/actor/carac-derivee.html b/templates/actor/carac-derivee.html index 398a23ad..13b53c43 100644 --- a/templates/actor/carac-derivee.html +++ b/templates/actor/carac-derivee.html @@ -55,7 +55,7 @@
  • diff --git a/templates/actor/carac-entitee.html b/templates/actor/carac-entitee.html index 04f51c64..80e08729 100644 --- a/templates/actor/carac-entitee.html +++ b/templates/actor/carac-entitee.html @@ -2,13 +2,13 @@
  • Catégorie :
  • Type d'entité :
  • {{#each system.attributs as |attr key|}} diff --git a/templates/common/timestamp.hbs b/templates/common/timestamp.hbs index ebddd72e..c98bc21b 100644 --- a/templates/common/timestamp.hbs +++ b/templates/common/timestamp.hbs @@ -6,7 +6,7 @@ type="number" data-dtype="Number" min="1" max="28" name="{{path}}.jourDuMois" value="{{jourDuMois}}" /> {{timestamp-imgSigne mois}} @@ -15,7 +15,7 @@ {{timestamp-imgSigne heure}} diff --git a/templates/item/partial-environnement.html b/templates/item/partial-environnement.html index f6d3aab6..47e03894 100644 --- a/templates/item/partial-environnement.html +++ b/templates/item/partial-environnement.html @@ -27,7 +27,7 @@ {{rangePicker name="milieu-{{key}}-frequence" value=env.frequence min=(rarete-getChamp env.rarete 'min') max=(rarete-getChamp env.rarete 'max') step=1}} From 8561e3f8bca7bbb9caee713c90dac41467318662 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Jul 2024 20:49:57 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Securit=C3=A9:=20limiter=20les=20cleanupCon?= =?UTF-8?q?teneurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dans certains cas mal identifiés, on pouvait avoir un problème de droits sur l'acteur, quand plusieurs joueurs accédaient en même temps à l'équipement porté par une mule, par exemple --- module/actor/base-actor.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index 38124e94..f2a30b12 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -232,11 +232,13 @@ export class RdDBaseActor extends Actor { /* -------------------------------------------- */ async cleanupConteneurs() { - let updates = this.itemTypes['conteneur'] - .filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0) - .map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } }); - if (updates.length > 0) { - await this.updateEmbeddedDocuments("Item", updates) + if (Misc.isOwnerPlayerOrUniqueConnectedGM(this)) { + let updates = this.itemTypes['conteneur'] + .filter(c => c.system.contenu.filter(id => this.getItem(id) == undefined).length > 0) + .map(c => { return { _id: c._id, 'system.contenu': c.system.contenu.filter(id => this.getItem(id) != undefined) } }); + if (updates.length > 0) { + await this.updateEmbeddedDocuments("Item", updates) + } } } From 8f3d56a830adc299b1d25dd5587d186e21209a03 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Jul 2024 21:19:14 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Une=20seule=20fen=C3=AAtres=20de=20lancer?= =?UTF-8?q?=20de=20sort=20=C3=A0=20la=20fois?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On ne peut plus ouvrir de fenêtre de lancer de sort quand une fenêtre est déjà ouverte --- changelog.md | 1 + module/rdd-tmr-dialog.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 3983e091..c259f3a7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,7 @@ # 12.0 ## 12.0.5 - Les mauvais jours d'Astrobazzarh - Fix: on peut de nouveau ouvrir l'édition de calendrier +- Fix: on ne peut plus ouvrir plusieurs fenêtres de lancer de sort ## 12.0.4 - La plaie d'Astrobazzarh - **Support V12** diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index f53962dd..65765504 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -129,7 +129,7 @@ export class RdDTMRDialog extends Dialog { this.html.find('form.tmr-dialog *').click(event => this.subdialog?.bringToTop()); // Roll Sort - this.html.find('.lancer-sort').click(event => this.actor.rollUnSort(this._getCoordActor())); + this.html.find('.lancer-sort').click(event => this.lancerUnSort()); this.html.find('.lire-signe-draconique').click(event => this.actor.rollLireSigneDraconique(this._getCoordActor())); this.html.find('img.tmr-move').click(event => this.deplacementTMR(this.html.find(event.currentTarget)?.data('move'))); @@ -142,6 +142,13 @@ export class RdDTMRDialog extends Dialog { this.updateValuesDisplay(); } + lancerUnSort() { + if (this.subdialog) { + return this.forceTMRContinueAction(); + } + return this.actor.rollUnSort(this._getCoordActor()); + } + async onDeplacement() { await this.manageRencontre(TMRUtility.getTMR(this._getCoordActor())); } From 4cc6e86d791e5063b4df7d4312510bd4f8cbce17 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Jul 2024 21:22:22 +0200 Subject: [PATCH 4/5] Fix: Failed to execute 'getComputedStyle' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dans certains cas (ouverture de fenêtre de lancer de sort), le bringToTop était appelé alors que la fenêtre n'était pas prête --- changelog.md | 1 + module/rdd-tmr-dialog.js | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index c259f3a7..93f954fa 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## 12.0.5 - Les mauvais jours d'Astrobazzarh - Fix: on peut de nouveau ouvrir l'édition de calendrier - Fix: on ne peut plus ouvrir plusieurs fenêtres de lancer de sort +- Fix: Failed to execute 'getComputedStyle' on 'Window' ## 12.0.4 - La plaie d'Astrobazzarh - **Support V12** diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 65765504..7eb633ab 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -171,23 +171,25 @@ export class RdDTMRDialog extends Dialog { async forceTMRDisplay() { if (this.rendered) { this.bringToTop() - if (this.subdialog?.bringToTop) { - this.subdialog.bringToTop(); - } + this.bringSubDialogToTop(); + } + } + + bringSubDialogToTop() { + if (this.subdialog?.bringToTop && this.subdialog?.element[0]) { + this.subdialog.bringToTop(); } } async restoreTMRAfterAction() { this.subdialog = undefined - await this.maximize(); - this.bringToTop(); + await this.maximize() + this.bringToTop() } forceTMRContinueAction() { ui.notifications.warn('Vous devez finir votre action avant de continuer dans les TMR'); - if (this.subdialog?.bringToTop) { - this.subdialog.bringToTop(); - } + this.bringSubDialogToTop(); return; } @@ -309,7 +311,7 @@ export class RdDTMRDialog extends Dialog { } const coord = this._getCoordActor(); HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(coord)); - + let ptsreve = document.getElementById("tmr-pointsreve-value"); ptsreve.innerHTML = this.actor.system.reve.reve.value; From ab698b2124f6c0be504a582e64300221776ae36a Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Thu, 4 Jul 2024 21:30:19 +0200 Subject: [PATCH 5/5] Version 12.0.5 - Les mauvais jours d'Astrobazzarh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix: on peut de nouveau ouvrir l'édition de calendrier - Fix: on ne peut plus ouvrir plusieurs fenêtres de lancer de sort - Fix: Failed to execute 'getComputedStyle' on 'Window' --- system.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system.json b/system.json index 3ed28719..dcc5d447 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "12.0.4", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.4.zip", + "version": "12.0.5", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.5.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "compatibility": {