From 93b4d2ce7eafa07c983be579661b9380cd138ac4 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sun, 2 May 2021 21:08:50 +0200 Subject: [PATCH] Make TMR great again.... --- module/actor-sheet.js | 2 +- module/actor.js | 6 ++++-- module/rdd-tmr-dialog.js | 9 ++++----- module/rdd-utility.js | 1 - module/tmr/debordement.js | 2 +- module/tmr/pelerinage.js | 2 +- module/tmr/periple.js | 2 +- module/tmr/pixi-tmr.js | 8 +++----- module/tmr/pont-impraticable.js | 2 +- module/tmr/present-cites.js | 2 +- module/tmr/rencontre.js | 2 +- module/tmr/reserve-extensible.js | 2 +- module/tmr/sort-reserve.js | 2 +- module/tmr/urgence-draconique.js | 2 +- 14 files changed, 21 insertions(+), 23 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index 5687a6f7..e29ca2f2 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -63,7 +63,7 @@ export class RdDActorSheet extends ActorSheet { // // Copy Active Effects // data.effects = effects; - console.log("---- data"); + //console.log("---- data"); // // Return template data let formData = { diff --git a/module/actor.js b/module/actor.js index caf0ea9f..cd80c2f2 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1300,13 +1300,15 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async updateCoordTMR(coord) { + console.log("UPDATE TMR", coord); await this.update({ "data.reve.tmrpos.coord": coord }); } /* -------------------------------------------- */ async reveActuelIncDec(value) { - let reve = Math.max(Misc.templateData(this).reve.reve.value + value, 0); - await this.update({ "data.reve.reve.value": reve }); + let mydata = Misc.templateData(this); + let reve = Math.max(mydata.reve.reve.value + value, 0); + await this.update( { "data.reve.reve.value": reve }); } /* -------------------------------------------- */ diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 2cf45e56..9c2bbb7a 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -68,7 +68,7 @@ export class RdDTMRDialog extends Dialog { } // load the texture we need - this.pixiTMR.load((loader, resources) => this.createPixiSprites()); + this.pixiTMR.load( (loader, resources) => this.createPixiSprites() ); } /* -------------------------------------------- */ @@ -211,9 +211,9 @@ export class RdDTMRDialog extends Dialog { this.moveFromKey("bottom"); } ); + // Gestion du cout de montée en points de rêve - let reveCout = ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1) - - this.actor.countMonteeLaborieuse(); + let reveCout = ((this.tmrdata.isRapide && !EffetsDraconiques.isDeplacementAccelere(this.actor)) ? -2 : -1) - this.actor.countMonteeLaborieuse(); this.cumulFatigue += this.fatigueParCase; await this.actor.reveActuelIncDec(reveCout); @@ -519,7 +519,7 @@ export class RdDTMRDialog extends Dialog { if (TMRUtility.isForceRencontre() || myRoll == 7) { return await this.rencontreTMRRoll(tmr, this.actor.isRencontreSpeciale()); } - let locTMR = (this.montreTMR) ? tmr.label + " (" + tmr.coord + ")" : "??"; + let locTMR = (this.cacheTMR) ? "??": tmr.label + " (" + tmr.coord + ")"; this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR); } @@ -933,7 +933,6 @@ export class RdDTMRDialog extends Dialog { } } - /* -------------------------------------------- */ async postRencontre(tmr) { if (!(this.viewOnly || this.currentRencontre)) { diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 9b8dca6a..c6123b52 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -488,7 +488,6 @@ export class RdDUtility { /* -------------------------------------------- */ static async loadCompendium(compendium, filter = item => true) { let compendiumData = await RdDUtility.loadCompendiumData(compendium); - console.log(compendiumData); return compendiumData.filter(filter); } diff --git a/module/tmr/debordement.js b/module/tmr/debordement.js index 90362f29..848d531f 100644 --- a/module/tmr/debordement.js +++ b/module/tmr/debordement.js @@ -19,7 +19,7 @@ export class Debordement extends Draconique { code() { return 'debordement' } tooltip(linkData) { return `Débordement en ${this.tmrLabel(linkData)}` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/wave.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/wave.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), { diff --git a/module/tmr/pelerinage.js b/module/tmr/pelerinage.js index 6a950478..deb53cf9 100644 --- a/module/tmr/pelerinage.js +++ b/module/tmr/pelerinage.js @@ -20,7 +20,7 @@ export class Pelerinage extends Draconique { code() { return 'pelerinage' } tooltip(linkData) { return `Votre pèlerinage en ${this.tmrLabel(linkData)}` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/pelerin.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/pelerin.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), { diff --git a/module/tmr/periple.js b/module/tmr/periple.js index e7e06a0f..b49cba13 100644 --- a/module/tmr/periple.js +++ b/module/tmr/periple.js @@ -23,7 +23,7 @@ export class Periple extends Draconique { code() { return 'periple' } tooltip(linkData) { return `Votre Périple passe par ${this.tmrLabel(linkData)}` } - img() { return 'icons/svg/acid.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/pelerin.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), { diff --git a/module/tmr/pixi-tmr.js b/module/tmr/pixi-tmr.js index fe8702c8..17398396 100644 --- a/module/tmr/pixi-tmr.js +++ b/module/tmr/pixi-tmr.js @@ -20,20 +20,18 @@ export class PixiTMR { this.callbacksOnAnimate = []; } - load(onLoad = (loader, resources) => {}) { + load( onLoad = (loader, resources) => {} ) { let loader = this.pixiApp.loader; - console.log("LOADING 1"); for (const [name, img] of Object.entries(PixiTMR.textures)) { loader = loader.add(name, img); } - console.log("LOADING 2"); - loader.load((loader, resources) => { + loader.onLoad.add((error, resaon) => { console.log("ERROR", error, resaon) }); + loader.load( (loader, resources) => { onLoad(loader, resources); for (let onAnimate of this.callbacksOnAnimate) { onAnimate(); } }); - console.log("LOADING 3"); } static register(name, img) { diff --git a/module/tmr/pont-impraticable.js b/module/tmr/pont-impraticable.js index 1bde95fd..3ba56ec9 100644 --- a/module/tmr/pont-impraticable.js +++ b/module/tmr/pont-impraticable.js @@ -20,7 +20,7 @@ export class PontImpraticable extends Draconique { code() { return 'pont-impraticable' } tooltip(linkData) { return `${this.tmrLabel(linkData)} impraticable` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/wave.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/wave.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), diff --git a/module/tmr/present-cites.js b/module/tmr/present-cites.js index d3c992a7..9253786e 100644 --- a/module/tmr/present-cites.js +++ b/module/tmr/present-cites.js @@ -16,7 +16,7 @@ export class PresentCites extends Draconique { code() { return 'present-cites' } tooltip(linkData) { return `La ${this.tmrLabel(linkData)} a un présent` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/gift.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/gift.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), diff --git a/module/tmr/rencontre.js b/module/tmr/rencontre.js index 119a6c68..bf18ab60 100644 --- a/module/tmr/rencontre.js +++ b/module/tmr/rencontre.js @@ -14,7 +14,7 @@ export class Rencontre extends Draconique { code() { return 'rencontre' } tooltip(linkData) { return `${linkData.rencontre.name} de force ${linkData.rencontre.force}` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/heures/hd06.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/heures/hd06.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), { diff --git a/module/tmr/reserve-extensible.js b/module/tmr/reserve-extensible.js index 6ee92d7f..0e75ac2c 100644 --- a/module/tmr/reserve-extensible.js +++ b/module/tmr/reserve-extensible.js @@ -18,7 +18,7 @@ export class ReserveExtensible extends Draconique { code() { return 'reserve_extensible' } tooltip(linkData) { return `Réserve extensible en ${this.tmrLabel(linkData)} !` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/treasure-chest.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/treasure-chest.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), { diff --git a/module/tmr/sort-reserve.js b/module/tmr/sort-reserve.js index b20cb7c1..30229353 100644 --- a/module/tmr/sort-reserve.js +++ b/module/tmr/sort-reserve.js @@ -14,7 +14,7 @@ export class SortReserve extends Draconique { code() { return 'sort' } tooltip(sort) { return `${sort.name}, r${sort.data.ptreve_reel}` } - img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/scroll.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/scroll.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(), { diff --git a/module/tmr/urgence-draconique.js b/module/tmr/urgence-draconique.js index 9a6bad38..fba8da38 100644 --- a/module/tmr/urgence-draconique.js +++ b/module/tmr/urgence-draconique.js @@ -41,7 +41,7 @@ export class UrgenceDraconique extends Draconique { code() { return 'urgence' } tooltip(linkData) { return `Urgence draconique!` } - img() { return 'icons/svg/hazard.svg' } + img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/gift.webp' } createSprite(pixiTMR) { return pixiTMR.sprite(this.code(),