Astrologie: garder toutes les lectures d'un acteur

This commit is contained in:
2024-05-12 22:40:06 +02:00
parent 611b57c149
commit 19dd3b540c
7 changed files with 74 additions and 75 deletions

View File

@ -31,7 +31,6 @@ export class AppAstrologie extends Application {
constructor(actor, options = {}) {
super(options);
this.actor = actor;
this.hookReference = Hooks.on(APP_ASTROLOGIE_REFRESH, () => this.refreshAstrologie());
}
getData(options) {
@ -85,9 +84,10 @@ export class AppAstrologie extends Application {
const nbAstral = calendrier.getNombreAstral()
const heures = RdDTimestamp.heures();
return {
ajustementsActors:game.actors.filter(actor => actor.isPersonnageJoueur())
ajustementsActors: game.actors.filter(actor => actor.isPersonnageJoueur())
.map(actor => this.getAjustementActor(actor, nbAstral, heures)),
nombresAstraux: calendrier.getNombresAstraux().map(na => this.getDetailNombreAstral(na))
nombresAstraux: game.system.rdd.calendrier.getNombresAstraux()
.map(na => this.getDetailNombreAstral(na))
}
}
return {}
@ -107,12 +107,15 @@ export class AppAstrologie extends Application {
const detail = foundry.utils.duplicate(nombreAstral);
const timestamp = new RdDTimestamp({ indexDate: nombreAstral.index });
detail.date = { mois: timestamp.mois, jour: timestamp.jour + 1 };
detail.valeursFausses.forEach(fausse => fausse.actorName = game.actors.get(fausse.actorId).name ?? "Inconnu");
detail.lectures.forEach(lecture => lecture.actorName = game.actors.get(lecture.actorId).name ?? "Inconnu");
return detail;
}
/* -------------------------------------------- */
activateListeners(html) {
if (!this.hookReference){
this.hookReference = Hooks.on(APP_ASTROLOGIE_REFRESH, () => this.refreshAstrologie());
}
super.activateListeners(html);
this.html = html;
this.html.find('select[name="signe-astral"]').change(event => {
@ -145,8 +148,7 @@ export class AppAstrologie extends Application {
/* -------------------------------------------- */
async onRebuild() {
game.system.rdd.calendrier.resetNombresAstraux();
await game.system.rdd.calendrier.resetNombresAstraux();
await game.system.rdd.calendrier.rebuildNombresAstraux();
}
@ -195,6 +197,8 @@ export class AppAstrologie extends Application {
}
refreshAstrologie() {
this.count = (this.count ?? 0)+1
console.log(`Refreshing ${this.count}`);
this.render(true)
}