Chronologie et année

Fix jour dans chronologie
Permettre de saisir l'année
This commit is contained in:
Vincent Vandemeulebrouck
2022-11-25 03:17:07 +01:00
parent 8667d77169
commit c435bfa343
5 changed files with 42 additions and 32 deletions

View File

@ -116,7 +116,7 @@ export class RdDCalendrier extends Application {
game.settings.set(SYSTEM_RDD, "calendrier", this.calendrier);
this.listeNombreAstral = this.getListeNombreAstral();
this.rebuildListeNombreAstral(false); // Ensure always up-to-date
this.rebuildListeNombreAstral(HIDE_DICE); // Ensure always up-to-date
}
console.log('RdDCalendrier.constructor()', this.calendrier, this.calendrierPos, this.listeNombreAstral);
}
@ -210,12 +210,13 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */
getNombreAstral(indexDate) {
let astralData = this.getListeNombreAstral().find((nombreAstral, i) => nombreAstral.index == indexDate);
const listNombreAstral = this.getListeNombreAstral();
let astralData = listNombreAstral.find((nombreAstral, i) => nombreAstral.index == indexDate);
return astralData?.nombreAstral;
}
/* -------------------------------------------- */
async rebuildListeNombreAstral(showDice = SHOW_DICE) {
async rebuildListeNombreAstral(showDice = HIDE_DICE) {
if (Misc.isUniqueConnectedGM()) {
let jourCourant = this.getCurrentDayIndex();
let newList = [];
@ -228,9 +229,8 @@ export class RdDCalendrier extends Application {
newList[i] = await this.ajouterNombreAstral(dayIndex, showDice);
}
}
//console.log("SAVE list", newList, jourCourant);
game.settings.set(SYSTEM_RDD, "liste-nombre-astral", newList);
this.listeNombreAstral = newList;
game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral);
}
}
@ -323,6 +323,7 @@ export class RdDCalendrier extends Application {
formData.moisKey = mois.key;
formData.jourMois = this.calendrier.jour + 1;
formData.nomMois = mois.label; // heures et mois nommés identiques
formData.annee = this.calendrier.annee;
formData.iconMois = dossierIconesHeures + mois.icon;
formData.nomHeure = heure.label;
formData.iconHeure = dossierIconesHeures + heure.icon;
@ -471,7 +472,7 @@ export class RdDCalendrier extends Application {
updateDisplay() {
let calendrier = this.fillCalendrierData();
// Rebuild text du calendrier
let dateHTML = `Jour ${calendrier.jourMois} de ${calendrier.nomMois} (${calendrier.nomSaison})`
let dateHTML = `${calendrier.jourMois} ${calendrier.nomMois} ${calendrier.annee} (${calendrier.nomSaison})`
if (game.user.isGM) {
dateHTML = dateHTML + " - NA: " + (this.getCurrentNombreAstral() ?? "indéterminé");
}
@ -494,6 +495,7 @@ export class RdDCalendrier extends Application {
this.calendrier.minutesRelative = Number(calendrierData.minutesRelative);
this.calendrier.jour = Number(calendrierData.jourMois) - 1;
this.calendrier.moisRdD = RdDCalendrier.getChiffreFromSigne(calendrierData.moisKey);
this.calendrier.annee = Number(calendrierData.annee);
this.calendrier.heureRdD = RdDCalendrier.getChiffreFromSigne(calendrierData.heureKey);
game.settings.set(SYSTEM_RDD, "calendrier", duplicate(this.calendrier));