#52 Gestion astrologie

This commit is contained in:
sladecraven 2020-12-09 00:01:02 +01:00
parent 1c2b2ece78
commit 63e410458e
3 changed files with 24 additions and 10 deletions

View File

@ -54,19 +54,12 @@ export class RdDCalendrier extends Application {
// nombre astral // nombre astral
if ( game.user.isGM) { if ( game.user.isGM) {
this.listeNombreAstral = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral")); this.listeNombreAstral = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "liste-nombre-astral"));
if ( this.listeNombreAstral == undefined ) { this.rebuildListeNombreAstral(); // Ensure always up-to-date
this.rebuildListeNombreAstral();
}
} }
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral); console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
} }
/* -------------------------------------------- */
getCurrentDayIndex( ) {
return (this.calendrier.moisRdD * 28) + this.calendrier.jour;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static get defaultOptions() { static get defaultOptions() {
const options = super.defaultOptions; const options = super.defaultOptions;
@ -76,6 +69,11 @@ export class RdDCalendrier extends Application {
return options; return options;
} }
/* -------------------------------------------- */
getCurrentDayIndex( ) {
return (this.calendrier.moisRdD * 28) + this.calendrier.jour;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
ajouterNombreAstral(index) { ajouterNombreAstral(index) {
return { return {
@ -85,6 +83,12 @@ export class RdDCalendrier extends Application {
} }
} }
/* -------------------------------------------- */
getCurrentNombreAstral() {
let index = this.getCurrentDayIndex();
return this.listeNombreAstral[index].nombreAstral;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
rebuildListeNombreAstral() { rebuildListeNombreAstral() {
// Auto-create if needed // Auto-create if needed
@ -215,10 +219,11 @@ export class RdDCalendrier extends Application {
updateDisplay() { updateDisplay() {
let data = this.fillCalendrierData( ); let data = this.fillCalendrierData( );
// Rebuild data // Rebuild data
document.getElementById("calendar--move-handle").innerHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})`; document.getElementById("calendar--move-handle").innerHTML = `Jour ${data.jourMois} de ${data.nomMois} (${data.nomSaison})` + " - NA: "+this.getCurrentNombreAstral();
document.getElementById("calendar-heure-texte").innerHTML = ` - ${data.nomHeure}`; document.getElementById("calendar-heure-texte").innerHTML = ` - ${data.nomHeure}`;
document.getElementById("calendar-time").innerHTML = `${data.heuresRelative}:${data.minutesRelative}`; document.getElementById("calendar-time").innerHTML = `${data.heuresRelative}:${data.minutesRelative}`;
document.getElementById("calendar-icone-heure").innerHTML = data.lettreFont; document.getElementById("calendar-icone-heure").innerHTML = data.lettreFont;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -1127,6 +1127,15 @@ ul, li {
cursor: pointer; cursor: pointer;
display: inline-flex; display: inline-flex;
} }
.calendar-nombre-astral{
grid-column: 2;
grid-row: 2;
font-size: 1.10rem;
text-align: right;
margin: auto;
cursor: pointer;
display: inline-flex;
}
.calendar-time-disp{ .calendar-time-disp{
position: relative; position: relative;
bottom: 6px; bottom: 6px;

View File

@ -18,7 +18,7 @@
{{/if}} {{/if}}
<div class="calendar-weekday-time"> <div class="calendar-weekday-time">
<p id="calendar-weekday"><span id="calendar-icone-heure">H</span>&nbsp;<span id="calendar-heure-texte">{{nomHeure}}</span></p> <p id="calendar-weekday"><span id="calendar-icone-heure">H</span>&nbsp;<span id="calendar-heure-texte">{{nomHeure}}</span></p>
<span class="calendar-time"><p class="calendar-time-disp" id="calendar-time" title="Start/Stop">{{heuresRelative}}:{{minutesRelative}}</p><span id='calender-time-running'></span></span> <span class="calendar-time"><p class="calendar-time-disp" id="calendar-time" title="Start/Stop">{{heuresRelative}}:{{minutesRelative}} - N. Astral: 1</p></span>
</div> </div>
{{#if isGM}} {{#if isGM}}
<div class="calendar-btn-container-right"> <div class="calendar-btn-container-right">