Préparation Calendrier avant migration

Les migrations peuvent avoir besoin du temps courant.
Le calendrier est recréé après.
This commit is contained in:
Vincent Vandemeulebrouck 2023-03-09 22:46:59 +01:00
parent 5cab418e62
commit 79e9358072
2 changed files with 10 additions and 7 deletions

View File

@ -45,6 +45,14 @@ export class RdDCalendrier extends Application {
Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id)); Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id));
} }
display() {
let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
renderTemplate(templatePath, {}).then(html => {
this.render(true);
});
return this;
}
async onUpdateSetting(setting, update, options, id) { async onUpdateSetting(setting, update, options, id) {
if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) { if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) {
this.timestamp = RdDTimestamp.getWorldTime(); this.timestamp = RdDTimestamp.getWorldTime();

View File

@ -278,6 +278,7 @@ export class SystemReveDeDragon {
} }
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
game.system.rdd.calendrier = new RdDCalendrier();
new Migrations().migrate(); new Migrations().migrate();
} }
@ -286,13 +287,7 @@ export class SystemReveDeDragon {
RdDDice.onReady(); RdDDice.onReady();
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Affiche/Init le calendrier */ /* Affiche/Init le calendrier */
let calendrier = new RdDCalendrier(); game.system.rdd.calendrier = new RdDCalendrier().display();
let templatePath = "systems/foundryvtt-reve-de-dragon/templates/calendar-template.html";
let templateData = {};
renderTemplate(templatePath, templateData).then(html => {
calendrier.render(true);
});
game.system.rdd.calendrier = calendrier; // Reference;
// Avertissement si joueur sans personnage // Avertissement si joueur sans personnage
if (!game.user.isGM && game.user.character == undefined) { if (!game.user.isGM && game.user.character == undefined) {