Fix retour en arrière sur le calendrier

This commit is contained in:
sladecraven 2020-12-21 15:14:49 +01:00
parent 8091b5a2e1
commit e9a6d9c5af
2 changed files with 9 additions and 2 deletions

View File

@ -64,7 +64,7 @@ export class RdDCalendrier extends Application {
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
}
/* -------------------------------------------- */
_loadListNombreAstral() {
return Object.values(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral"));
}
@ -120,6 +120,10 @@ export class RdDCalendrier extends Application {
getNombreAstral( index ) {
const liste = this.listeNombreAstral || this._loadListNombreAstral();
let astralData = liste.find( (nombreAstral, i) => nombreAstral.index == index );
if ( astralData == undefined ) {
this.rebuildListeNombreAstral();
astralData = liste.find( (nombreAstral, i) => nombreAstral.index == index );
}
return astralData.nombreAstral || "N/A";
}
@ -131,7 +135,8 @@ export class RdDCalendrier extends Application {
// Nettoyage des nombres astraux anciens
let jourCourant = this.getCurrentDayIndex();
let newList = this.listeNombreAstral.filter( (nombreAstral, i) => nombreAstral.index >= jourCourant );
let jourFin = jourCourant + 12;
let newList = this.listeNombreAstral.filter( (nombreAstral, i) => nombreAstral && nombreAstral.index >= jourCourant && nombreAstral.index < jourFin);
//console.log("LSTES", this.listeNombreAstral, newList );
let lastDay = jourCourant;

View File

@ -37,6 +37,7 @@ export class RdDTokenHud {
});
}
/* -------------------------------------------- */
static buildListeActionsCombat(combatant) {
let armesList = RdDUtility.buildArmeList(combatant);
for (let armeIndex = 0; armeIndex < armesList.length; armeIndex++) {
@ -46,6 +47,7 @@ export class RdDTokenHud {
return armesList;
}
/* -------------------------------------------- */
static async _configureSubMenu(insertionPoint, template, data, onMenuItem) {
const hud = $(await renderTemplate(template, data));
const imgHud = hud.find('img.rdd-hud-togglebutton');