Dialog chateau-dormant

Pour permettre de pré-remplir les infos de chateau dormant
This commit is contained in:
2023-02-07 18:06:45 +01:00
parent 07d0d92f57
commit c70b6c9d5f
17 changed files with 467 additions and 167 deletions

View File

@ -7,6 +7,8 @@ import { Misc } from "./misc.js";
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { DialogChronologie } from "./dialog-chronologie.js";
import { RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
import { DialogChateauDormant } from "./sommeil/dialog-chateau-dormant.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
const RDD_JOUR_PAR_MOIS = 28;
const RDD_HEURES_PAR_JOUR = 12;
@ -169,7 +171,7 @@ export class RdDCalendrier extends Application {
getCurrentMinute() { return this.timestamp.indexMinute; }
getTimestampFinChateauDormant(nbJours = 0) {
return this.timestamp.nouveauJour().addJour(nbJours);
return this.timestamp.nouveauJour().addJours(nbJours);
}
getTimestampFinHeure(nbHeures = 0) {
@ -257,8 +259,12 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */
async setNewTimestamp(newTimestamp) {
game.actors.forEach(actor => actor.onTimeChanging(this.timestamp, newTimestamp));
const oldTimestamp = this.timestamp;
game.actors.forEach(actor => actor.onTimeChanging(oldTimestamp, newTimestamp));
RdDTimestamp.setWorldTime(newTimestamp);
if (oldTimestamp.indexDate + 1 == newTimestamp.indexDate && ReglesOptionelles.isUsing("chateau-dormant-gardien")) {
await DialogChateauDormant.create();
}
this.timestamp = newTimestamp;
await this.rebuildListeNombreAstral();
this.updateDisplay();
@ -292,10 +298,8 @@ export class RdDCalendrier extends Application {
async positionnerHeure(heure) {
const indexDate = this.timestamp.indexDate;
const addDay = this.timestamp.heure < heure ? 0 : 1;
await this.setNewTimestamp(new RdDTimestamp({
indexDate: indexDate + addDay, indexHeure: 0
})
.addHeures(heure))
const newTimestamp = new RdDTimestamp({ indexDate: indexDate + addDay}).addHeures(heure);
await this.setNewTimestamp(newTimestamp)
}
/* -------------------------------------------- */