Calendrier/timestamp, suite
Correction autour des éditeurs/affichages Migration de la date du monde dans les settings
This commit is contained in:
parent
19b3adc222
commit
739fcbdf09
@ -1,5 +1,6 @@
|
||||
import { SYSTEM_RDD } from "./constants.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { RdDTimestamp } from "./rdd-timestamp.js";
|
||||
|
||||
|
||||
const LATEST_USED_JOURNAL_ID = "chronologie-dernier-journal";
|
||||
@ -16,16 +17,13 @@ export class DialogChronologie extends Dialog {
|
||||
});
|
||||
}
|
||||
static async create() {
|
||||
const dateRdD = game.system.rdd.calendrier.getCalendrier();
|
||||
const dialogData = {
|
||||
auteur: game.user.name,
|
||||
isGM: game.user.isGM,
|
||||
information: "",
|
||||
journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID),
|
||||
journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)),
|
||||
dateRdD: dateRdD,
|
||||
jourRdD: dateRdD.jour +1,
|
||||
heureRdD: game.system.rdd.calendrier.heureCourante().key,
|
||||
timestamp: game.system.rdd.calendrier.timestamp,
|
||||
dateReel: DialogChronologie.getCurrentDateTime()
|
||||
};
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);
|
||||
@ -93,11 +91,12 @@ export class DialogChronologie extends Dialog {
|
||||
auteur: this.html.find("form.rdddialogchrono :input[name='auteur']").val(),
|
||||
information: this.html.find("form.rdddialogchrono :input[name='information']").val(),
|
||||
dateRdD: {
|
||||
jour: this.html.find("form.rdddialogchrono :input[name='jourRdD']").val(),
|
||||
moisRdD: this.html.find("form.rdddialogchrono :input[name='dateRdD.moisRdD.key']").val(),
|
||||
annee: this.html.find("form.rdddialogchrono :input[name='dateRdD.annee']").val()
|
||||
jour: this.html.find("form.rdddialogchrono :input[name='chronologie.jourDuMois']").val(),
|
||||
mois: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.mois']").val()),
|
||||
annee: this.html.find("form.rdddialogchrono :input[name='chronologie.annee']").val(),
|
||||
heure: RdDTimestamp.definition(this.html.find("form.rdddialogchrono :input[name='chronologie.heure']").val()),
|
||||
minute: this.html.find("form.rdddialogchrono :input[name='chronologie.minute']").val(),
|
||||
},
|
||||
heureRdD: this.html.find("form.rdddialogchrono :input[name='heureRdD']").val(),
|
||||
dateReel: this.html.find("form.rdddialogchrono :input[name='dateReel']").val().replace('T', ' ')
|
||||
}
|
||||
}
|
||||
|
@ -3,23 +3,28 @@
|
||||
* Extend the base Dialog entity by defining a custom window to perform roll.
|
||||
* @extends {Dialog}
|
||||
*/
|
||||
export class RdDAstrologieEditeur extends Dialog {
|
||||
export class RdDAstrologieEditeur extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(html, calendrier, calendrierData) {
|
||||
|
||||
let myButtons = {
|
||||
resetButton: { label: "Re-tirer les nombres astraux", callback: html => this.resetNombreAstraux() },
|
||||
saveButton: { label: "Fermer", callback: html => this.fillData() }
|
||||
};
|
||||
resetButton: { label: "Re-tirer les nombres astraux", callback: html => this.resetNombreAstraux() },
|
||||
saveButton: { label: "Fermer", callback: html => this.fillData() }
|
||||
};
|
||||
|
||||
// Common conf
|
||||
let dialogConf = { content: html, title: "Editeur d'Astrologie", buttons: myButtons, default: "saveButton" };
|
||||
let dialogOptions = { classes: ["rdd-roll-dialog"], width: 600, height: 'fit-content', 'z-index': 99999 }
|
||||
let dialogOptions = {
|
||||
classes: ["rdd-roll-dialog"], width: 600,
|
||||
height: 'fit-content',
|
||||
'max-height': 800,
|
||||
'z-index': 99999
|
||||
}
|
||||
super(dialogConf, dialogOptions)
|
||||
|
||||
|
||||
this.calendrier = calendrier;
|
||||
this.updateData( calendrierData );
|
||||
this.updateData(calendrierData);
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
@ -28,7 +33,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* -------------------------------------------- */
|
||||
async resetNombreAstraux() {
|
||||
game.system.rdd.calendrier.resetNombreAstral();
|
||||
await game.system.rdd.calendrier.rebuildListeNombreAstral();
|
||||
@ -36,12 +41,12 @@
|
||||
game.system.rdd.calendrier.showAstrologieEditor();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
fillData( ) {
|
||||
/* -------------------------------------------- */
|
||||
fillData() {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
updateData( calendrierData ) {
|
||||
updateData(calendrierData) {
|
||||
this.calendrierData = duplicate(calendrierData);
|
||||
}
|
||||
|
||||
|
@ -26,40 +26,35 @@ export class RdDCalendrierEditeur extends Dialog {
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
this.html = html;
|
||||
this.html.find("input[name='annee']").val(this.calendrierData.annee);
|
||||
this.html.find("select[name='nomMois']").val(this.calendrierData.moisKey);
|
||||
this.html.find("input[name='jourMois']").val(this.calendrierData.jourMois);
|
||||
this.html.find("select[name='nomHeure']").val(this.calendrierData.heureKey);
|
||||
this.html.find("input[name='minutesRelative']").val(this.calendrierData.minutesRelative);
|
||||
|
||||
this.html.find("input[name='jourMois']").change(event => {
|
||||
const jour = Number.parseInt(this.html.find("input[name='jourMois']").val());
|
||||
if (jour < 1) {
|
||||
this.html.find("input[name='jourMois']").val(1);
|
||||
this.html.find("input[name='calendar.annee']").val(this.calendrierData.annee);
|
||||
this.html.find("select[name='calendar.mois']").val(this.calendrierData.mois.key);
|
||||
this.html.find("select[name='calendar.heure']").val(this.calendrierData.heure.key);
|
||||
RdDCalendrierEditeur.setLimited(this.html.find("input[name='calendar.jourDuMois']"), this.calendrierData.jourDuMois, 1, 28);
|
||||
RdDCalendrierEditeur.setLimited(this.html.find("input[name='calendar.minute']"), this.calendrierData.minute, 0, 119);
|
||||
}
|
||||
|
||||
static setLimited(input, init, min, max) {
|
||||
input.val(init);
|
||||
input.change(event => {
|
||||
const val = Number.parseInt(input.val());
|
||||
if (val < min) {
|
||||
input.val(min);
|
||||
}
|
||||
if (jour > 28) {
|
||||
this.html.find("input[name='jourMois']").val(28);
|
||||
if (val > max) {
|
||||
input.val(max);
|
||||
}
|
||||
});
|
||||
this.html.find("input[name='minutesRelative']").change(event => {
|
||||
const minute = Number.parseInt(this.html.find("input[name='minutesRelative']").val());
|
||||
if (minute < 0) {
|
||||
this.html.find("input[name='minutesRelative']").val(0);
|
||||
}
|
||||
if (minute > 119) {
|
||||
this.html.find("input[name='minutesRelative']").val(119);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
saveCalendrier() {
|
||||
const annee = Number.parseInt(this.html.find("input[name='annee']").val());
|
||||
const mois = this.html.find("select[name='nomMois']").val();
|
||||
const jour = Number.parseInt(this.html.find("input[name='jourMois']").val());
|
||||
const heure = this.html.find("select[name='nomHeure']").val();
|
||||
const minute = Number.parseInt(this.html.find("input[name='minutesRelative']").val());
|
||||
const annee = Number.parseInt(this.html.find("input[name='calendar.annee']").val());
|
||||
const mois = this.html.find("select[name='calendar.mois']").val();
|
||||
const jour = Number.parseInt(this.html.find("input[name='calendar.jourDuMois']").val());
|
||||
const heure = this.html.find("select[name='calendar.heure']").val();
|
||||
const minute = Number.parseInt(this.html.find("input[name='calendar.minute']").val());
|
||||
|
||||
this.calendrier.setNewTimestamp(RdDTimestamp.timestamp(annee, mois, jour, heure, minute))
|
||||
}
|
||||
|
@ -6,15 +6,7 @@ import { RdDDice } from "./rdd-dice.js";
|
||||
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 } from "./rdd-timestamp.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const saisonsDef = {
|
||||
"printemps": { label: "Printemps" },
|
||||
"ete": { label: "Eté" },
|
||||
"automne": { label: "Automne" },
|
||||
"hiver": { label: "Hiver" }
|
||||
};
|
||||
import { RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
|
||||
|
||||
const RDD_JOUR_PAR_MOIS = 28;
|
||||
const RDD_HEURES_PAR_JOUR = 12;
|
||||
@ -45,7 +37,7 @@ export class RdDCalendrier extends Application {
|
||||
game.settings.set(SYSTEM_RDD, "calendrier-pos", this.calendrierPos);
|
||||
}
|
||||
// Calendrier
|
||||
this.timestamp = new RdDTimestamp({});
|
||||
this.timestamp = RdDTimestamp.getWorldTime();
|
||||
|
||||
if (Misc.isUniqueConnectedGM()) { // Uniquement si GM
|
||||
RdDTimestamp.setWorldTime(this.timestamp);
|
||||
@ -53,10 +45,14 @@ export class RdDCalendrier extends Application {
|
||||
this.rebuildListeNombreAstral(HIDE_DICE); // Ensure always up-to-date
|
||||
}
|
||||
console.log('RdDCalendrier.constructor()', this.timestamp, this.timestamp.toOldCalendrier(), this.calendrierPos, this.listeNombreAstral);
|
||||
Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id));
|
||||
}
|
||||
|
||||
getCalendrier() {
|
||||
return this.timestamp.toOldCalendrier();
|
||||
async onUpdateSetting(setting, update, options, id) {
|
||||
if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) {
|
||||
this.timestamp = RdDTimestamp.getWorldTime();
|
||||
this.updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -162,6 +158,7 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
isAfterIndexDate(indexDate) {
|
||||
// TODO: standardize
|
||||
return indexDate < this.timestamp.indexDate;
|
||||
}
|
||||
|
||||
@ -339,12 +336,6 @@ export class RdDCalendrier extends Application {
|
||||
await this.setNewTimestamp(this.timestamp.nouveauJour());
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
syncPlayerTime(timestamp) {
|
||||
this.timestamp = new RdDTimestamp(timestamp);
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async positionnerHeure(indexHeure) {
|
||||
await this.setNewTimestamp(new RdDTimestamp({ indexDate: this.timestamp.indexDate + (this.timestamp.heure < indexHeure ? 0 : 1) }).addHeures(indexHeure))
|
||||
@ -355,21 +346,23 @@ export class RdDCalendrier extends Application {
|
||||
const mois = RdDTimestamp.definition(this.timestamp.mois);
|
||||
const heure = RdDTimestamp.definition(this.timestamp.heure);
|
||||
|
||||
formData.timestamp = this.timestamp;
|
||||
formData.annee = this.timestamp.annee;
|
||||
formData.mois = mois;
|
||||
formData.jourDuMois = this.timestamp.jour + 1;
|
||||
formData.jour = this.timestamp.jour;
|
||||
formData.heure = heure;
|
||||
formData.minute = this.timestamp.minute;
|
||||
|
||||
formData.moisKey = mois.key;
|
||||
formData.nomMois = mois.label; // heures et mois nommés identiques
|
||||
formData.iconMois = mois.icon;
|
||||
formData.nomSaison = saisonsDef[mois.saison].label;
|
||||
// formData.nomMois = mois.label; // heures et mois nommés identiques
|
||||
// formData.iconMois = mois.icon;
|
||||
|
||||
formData.jourMois = this.timestamp.jour + 1;
|
||||
// formData.heureKey = heure.key;
|
||||
// formData.heureRdD = formData.heure.heure;
|
||||
// formData.nomHeure = heure.label;
|
||||
// formData.iconHeure = heure.icon;
|
||||
|
||||
formData.heureKey = heure.key;
|
||||
formData.heureRdD = this.timestamp.heure;
|
||||
formData.nomHeure = heure.label;
|
||||
formData.iconHeure = heure.icon;
|
||||
|
||||
formData.minutesRelative = this.timestamp.minute;
|
||||
// formData.minutes = this.timestamp.minute;
|
||||
|
||||
formData.isGM = game.user.isGM;
|
||||
|
||||
@ -509,21 +502,21 @@ export class RdDCalendrier extends Application {
|
||||
updateDisplay() {
|
||||
let calendrier = this.fillCalendrierData();
|
||||
// Rebuild text du calendrier
|
||||
let dateHTML = `${calendrier.jourMois} ${calendrier.nomMois} ${calendrier.annee} (${calendrier.nomSaison})`
|
||||
let dateHTML = `${calendrier.jourDuMois} ${calendrier.mois.label} ${calendrier.annee} (${calendrier.mois.saison})`
|
||||
if (game.user.isGM) {
|
||||
dateHTML = dateHTML + " - NA: " + (this.getCurrentNombreAstral() ?? "indéterminé");
|
||||
dateHTML = dateHTML + " - NA: " + (this.getCurrentNombreAstral() ?? "?");
|
||||
}
|
||||
for (let handle of document.getElementsByClassName("calendar-date-rdd")) {
|
||||
handle.innerHTML = dateHTML;
|
||||
}
|
||||
for (let heure of document.getElementsByClassName("calendar-heure-texte")) {
|
||||
heure.innerHTML = calendrier.nomHeure;
|
||||
heure.innerHTML = calendrier.heure.label;
|
||||
}
|
||||
for (const minute of document.getElementsByClassName("calendar-time-disp")) {
|
||||
minute.innerHTML = `${calendrier.minutesRelative} minutes`;
|
||||
minute.innerHTML = `${calendrier.minute} minutes`;
|
||||
}
|
||||
for (const heureImg of document.getElementsByClassName("calendar-heure-img")) {
|
||||
heureImg.src = calendrier.iconHeure;
|
||||
heureImg.src = calendrier.heure.icon;
|
||||
}
|
||||
}
|
||||
|
||||
@ -531,10 +524,10 @@ export class RdDCalendrier extends Application {
|
||||
async saveEditeur(calendrierData) {
|
||||
const newTimestamp = RdDTimestamp.timestamp(
|
||||
Number.parseInt(calendrierData.annee),
|
||||
RdDTimestamp.definition(calendrierData.moisKey).heure,
|
||||
calendrierData.mois.heure,
|
||||
Number.parseInt(calendrierData.jourMois),
|
||||
RdDTimestamp.definition(calendrierData.heureKey).heure,
|
||||
Number.parseInt(calendrierData.minutesRelative)
|
||||
calendrierData.heure.heure,
|
||||
Number.parseInt(calendrierData.minutes)
|
||||
);
|
||||
await this.setNewTimestamp(newTimestamp);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ import { Grammar } from "./grammar.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
|
||||
export const WORLD_TIMESTAMP_SETTING = "calendrier";
|
||||
|
||||
const RDD_MOIS_PAR_AN = 12;
|
||||
const RDD_JOURS_PAR_MOIS = 28;
|
||||
const RDD_JOURS_PAR_AN = 336; //RDD_JOURS_PAR_MOIS * RDD_MOIS_PAR_AN;
|
||||
@ -10,21 +12,20 @@ const RDD_HEURES_PAR_JOUR = 12;
|
||||
const RDD_MINUTES_PAR_HEURES = 120;
|
||||
const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PAR_HEURES;
|
||||
const ROUNDS_PAR_MINUTE = 10;
|
||||
const CALENDRIER = "calendrier";
|
||||
|
||||
const DEFINITION_HEURES = [
|
||||
{ key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "printemps" },
|
||||
{ key: "sirene", label: "Sirène", lettreFont: 'i', saison: "printemps" },
|
||||
{ key: "faucon", label: "Faucon", lettreFont: 'f', saison: "printemps" },
|
||||
{ key: "couronne", label: "Couronne", lettreFont: '', saison: "ete" },
|
||||
{ key: "dragon", label: "Dragon", lettreFont: 'd', saison: "ete" },
|
||||
{ key: "epees", label: "Epées", lettreFont: 'e', saison: "ete" },
|
||||
{ key: "lyre", label: "Lyre", lettreFont: 'l', saison: "automne" },
|
||||
{ key: "serpent", label: "Serpent", lettreFont: 's', saison: "automne" },
|
||||
{ key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "automne" },
|
||||
{ key: "araignee", label: "Araignée", lettreFont: 'a', saison: "hiver" },
|
||||
{ key: "roseau", label: "Roseau", lettreFont: 'r', saison: "hiver" },
|
||||
{ key: "chateaudormant", label: "Château Dormant", lettreFont: 'c', saison: "hiver" },
|
||||
{ key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps" },
|
||||
{ key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps" },
|
||||
{ key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps" },
|
||||
{ key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté" },
|
||||
{ key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté" },
|
||||
{ key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté" },
|
||||
{ key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne" },
|
||||
{ key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne" },
|
||||
{ key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne" },
|
||||
{ key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver" },
|
||||
{ key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver" },
|
||||
{ key: "chateaudormant", label: "Château Dormant", lettreFont: 'c', saison: "Hiver" },
|
||||
]
|
||||
|
||||
const FORMULES_DUREE = [
|
||||
@ -46,11 +47,11 @@ export class RdDTimestamp {
|
||||
}
|
||||
|
||||
static init() {
|
||||
game.settings.register(SYSTEM_RDD, CALENDRIER, {
|
||||
name: CALENDRIER,
|
||||
game.settings.register(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, {
|
||||
name: WORLD_TIMESTAMP_SETTING,
|
||||
scope: "world",
|
||||
config: false,
|
||||
default: { indexJour: 0, heureRdD: 0, minutesRelative: 0 },
|
||||
default: { indexDate: 0, indexMinute: 0 },
|
||||
type: Object
|
||||
});
|
||||
|
||||
@ -59,7 +60,6 @@ export class RdDTimestamp {
|
||||
DEFINITION_HEURES[i].icon = RdDTimestamp.iconeHeure(i);
|
||||
DEFINITION_HEURES[i].webp = DEFINITION_HEURES[i].icon.replace(".svg", ".webp");
|
||||
}
|
||||
// TODO: positionner les calculs de FORMULES_DUREE
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,6 +124,7 @@ export class RdDTimestamp {
|
||||
static formatIndexDate(indexDate) {
|
||||
return new RdDTimestamp({ indexDate }).formatDate()
|
||||
}
|
||||
|
||||
static splitIndexDate(indexDate) {
|
||||
const timestamp = new RdDTimestamp({ indexDate });
|
||||
return {
|
||||
@ -133,16 +134,21 @@ export class RdDTimestamp {
|
||||
}
|
||||
|
||||
static getWorldTime() {
|
||||
return game.settings.get(SYSTEM_RDD, CALENDRIER);
|
||||
let worldTime = game.settings.get(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING);
|
||||
if (worldTime.indexJour && worldTime.heureRdD) {
|
||||
// Migration
|
||||
worldTime = {
|
||||
indexDate: worldTime.indexJour,
|
||||
indexMinute: worldTime.heureRdD * 120 + worldTime.minutesRelative
|
||||
};
|
||||
RdDTimestamp.setWorldTime(new RdDTimestamp(worldTime))
|
||||
|
||||
}
|
||||
return new RdDTimestamp(worldTime);
|
||||
}
|
||||
|
||||
static setWorldTime(timestamp) {
|
||||
game.settings.set(SYSTEM_RDD, CALENDRIER, timestamp.toOldCalendrier());
|
||||
game.socket.emit(SYSTEM_SOCKET_ID, {
|
||||
msg: "msg_sync_time",
|
||||
data: duplicate(timestamp)
|
||||
});
|
||||
|
||||
game.settings.set(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, duplicate(timestamp));
|
||||
}
|
||||
|
||||
/** construit un RdDTimestamp à partir de l'année/mois/jour/heure?/minute? */
|
||||
@ -164,16 +170,9 @@ export class RdDTimestamp {
|
||||
* @param indexMinute: la minute de la journée à utiliser pour ce timestamp
|
||||
*
|
||||
*/
|
||||
constructor({ indexDate = undefined, indexMinute = undefined }) {
|
||||
function fromSettings() {
|
||||
const fromSettings = RdDTimestamp.getWorldTime();
|
||||
return { indexDate: fromSettings.indexJour, indexMinute: fromSettings.heureRdD * RDD_MINUTES_PAR_HEURES + fromSettings.minutesRelative };
|
||||
}
|
||||
|
||||
const val = Number.isInteger(indexDate) ? { indexDate, indexMinute: indexMinute ?? 0 } : fromSettings();
|
||||
|
||||
this.indexDate = val.indexDate
|
||||
this.indexMinute = val.indexMinute
|
||||
constructor({ indexDate, indexMinute = undefined }) {
|
||||
this.indexDate = indexDate
|
||||
this.indexMinute = indexMinute ?? 0
|
||||
}
|
||||
|
||||
toCalendrier() {
|
||||
@ -182,6 +181,7 @@ export class RdDTimestamp {
|
||||
annee: this.annee,
|
||||
mois: RdDTimestamp.definition(this.mois),
|
||||
jour: this.jour,
|
||||
jourDuMois: this.jour + 1,
|
||||
heure: RdDTimestamp.definition(this.heure),
|
||||
minute: this.minute
|
||||
};
|
||||
@ -191,7 +191,7 @@ export class RdDTimestamp {
|
||||
* Convertit un timestamp en donnée utile à l'affichage d'un calendrier
|
||||
*/
|
||||
toOldCalendrier() {
|
||||
const calendrier = {
|
||||
return {
|
||||
indexJour: this.indexDate,
|
||||
annee: this.annee,
|
||||
moisRdD: this.mois,
|
||||
@ -201,7 +201,6 @@ export class RdDTimestamp {
|
||||
heureLabel: RdDTimestamp.definition(this.heure).label,
|
||||
minutesRelative: this.minute,
|
||||
};
|
||||
return calendrier
|
||||
}
|
||||
get annee() { return Math.floor(this.indexDate / RDD_JOURS_PAR_AN) }
|
||||
get mois() { return Math.floor((this.indexDate % RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) }
|
||||
|
@ -648,8 +648,6 @@ export class RdDUtility {
|
||||
switch (sockmsg.msg) {
|
||||
case "msg_gm_chat_message":
|
||||
return ChatUtility.handleGMChatMessage(sockmsg.data);
|
||||
case "msg_sync_time":
|
||||
return game.system.rdd.calendrier.syncPlayerTime(sockmsg.data);
|
||||
case "msg_request_nombre_astral":
|
||||
return game.system.rdd.calendrier.requestNombreAstral(sockmsg.data);
|
||||
case "msg_response_nombre_astral":
|
||||
|
@ -478,8 +478,8 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
||||
}
|
||||
.img-signe-heure {
|
||||
vertical-align: bottom;
|
||||
max-width: 1.5rem;
|
||||
max-height: 1.5rem;
|
||||
max-width: 1.5em;
|
||||
max-height: 1.5em;
|
||||
border-width: 0;
|
||||
}
|
||||
.button-effect-img {
|
||||
|
@ -37,6 +37,7 @@
|
||||
<span class="flex-grow-2">
|
||||
|{{#each heuresDef as |ajustement|}}
|
||||
<span>
|
||||
<strong>{{ajustement.ajustement}}</strong>
|
||||
{{#each ajustement.heures as |heure|}}
|
||||
{{timestamp-imgSigneHeure heure}}
|
||||
{{/each}}
|
||||
|
@ -8,37 +8,12 @@
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
<div class="form-group">
|
||||
<div class="flexcol flex-shrink">
|
||||
<label for="jourMois">Jour</label>
|
||||
<input type="number" class="number-x4" name="jourMois" value="{{jourMois}}" data-dtype="Number" min="1" max="28"/>
|
||||
</div>
|
||||
<div class="flexcol">
|
||||
<label for="nomMois">Mois</label>
|
||||
<select name="nomMois" data-dtype="String">
|
||||
{{#select nomMois}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flexcol flex-shrink">
|
||||
<label for="annee">Année</label>
|
||||
<input type="number" class="number-x4" name="annee" value="{{annee}}" data-dtype="Number" min="0"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="flexcol">
|
||||
<label for="nomHeure">Heure</label>
|
||||
<select name="nomHeure" data-dtype="String">
|
||||
{{#select nomHeure}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="flexcol flex-shrink">
|
||||
<label for="minutesRelative">Minutes</label>
|
||||
<input type="number" class="number-x4" name="minutesRelative" value="{{minutesRelative}}" data-dtype="Number" min="0" max="119"/>
|
||||
</div>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs"
|
||||
(timestamp-extract timestamp)
|
||||
path='calendar'
|
||||
label='Date courante'
|
||||
disabled=''
|
||||
}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</form>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<i class="astrologie-btn-edit fas fa-cog" title="Astrologie"></i>
|
||||
{{/if}}
|
||||
<div class="calendar-hdr">
|
||||
<p id="calendar-move-handle" class="calendar-date-rdd" title="Deplacer">Jour {{jourMois}} de {{nomMois}} ({{nomSaison}})</p>
|
||||
<p id="calendar-move-handle" class="calendar-date-rdd" title="Deplacer">{{jourDuMois}} {{mois.label}} ({{mois.saison}})</p>
|
||||
</div>
|
||||
<div class="calendar-container">
|
||||
{{#if isGM}}
|
||||
@ -20,15 +20,12 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="calendar-weekday-time">
|
||||
{{#if isGM}}
|
||||
<a class="ajout-chronologie calendar-weekday">
|
||||
<img class="calendar-heure-img" src="{{iconHeure}}" alt="{{nomHeure}}"/> <span class="calendar-heure-texte">{{nomHeure}}</span>
|
||||
</a>
|
||||
<p class="calendar-time-disp calendar-time isGM">{{minutesRelative}} minutes</p>
|
||||
{{else}}
|
||||
<a class="ajout-chronologie">
|
||||
<img class="calendar-heure-img" src="{{iconHeure}}" alt="{{nomHeure}}"/> <span class="calendar-heure-texte">{{nomHeure}}</span>
|
||||
<img class="calendar-heure-img" src="{{heure.icon}}" alt="{{nomHeure}}"/>
|
||||
<span class="calendar-heure-texte">{{heure.label}}</span>
|
||||
</a>
|
||||
{{#if isGM}}
|
||||
<p class="calendar-time-disp calendar-time isGM">{{minute}} minutes</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#if isGM}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h2>{{dateRdD.jour}} {{signeHeure 'label' dateRdD.moisRdD}}, an {{dateRdD.annee}} à l'heure de {{signeHeure 'label' heureRdD}}</h2>
|
||||
<h2>{{dateRdD.jour}} {{dateRdD.mois.label}} {{dateRdD.annee}}, à l'heure de {{dateRdD.heure.label}}</h2>
|
||||
<p>{{information}}</p>
|
||||
<p class="poesie-reference">Par {{auteur}} ({{dateReel}})</p>
|
||||
<hr>
|
||||
|
@ -1,23 +1,27 @@
|
||||
<div class="flexcol">
|
||||
<div class="flexrow">
|
||||
<label>{{label}}</label>
|
||||
<input {{#if disabled}}{{disabled}}{{/if}} type="number" class="flex-shrink number-x2" name="{{path}}.jour" value="{{jour}}" data-dtype="Number" min="1" max="28"/>
|
||||
{{timestamp-imgSigne mois}}
|
||||
<input {{#if disabled}}{{disabled}}{{/if}}
|
||||
class="flex-shrink number-x2"
|
||||
type="number" data-dtype="Number" min="1" max="28"
|
||||
name="{{path}}.jourDuMois" value="{{jourDuMois}}" />
|
||||
<select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.mois" class="flex-shrink" data-dtype="String">
|
||||
{{#select mois.key}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
{{timestamp-imgSigne mois}}
|
||||
<input {{#if disabled}}{{disabled}}{{/if}} type="number" class="number-x2" name="{{path}}.annee" value="{{annee}}" data-dtype="Number"/>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<label>à l'heure de</label>
|
||||
{{timestamp-imgSigne heure}}
|
||||
<select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.heure" class="flex-shrink" data-dtype="String">
|
||||
{{#select heure.key}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
{{timestamp-imgSigne heure}}
|
||||
<input {{#if disabled}}{{disabled}}{{/if}} type="number" class="number-x2" name="{{path}}.minute" value="{{minute}}" data-dtype="Number"/>
|
||||
<label>minutes</label>
|
||||
</div>
|
||||
</div>
|
@ -9,24 +9,12 @@
|
||||
<textarea autocomplete="off" title="Information" name="information">{{information}}</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="heureRdD">Heure</label>
|
||||
<select type="text" name="heureRdD" value="{{heureRdD}}" data-dtype="String" />
|
||||
{{#select heureRdD}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="jourRdD">Date en jeu</label>
|
||||
<span class="flexrow">
|
||||
<input type="text" name="jourRdD" value="{{jourRdD}}" data-dtype="Number" min="1" max="28"/>
|
||||
<select type="text" name="dateRdD.moisRdD.key" value="{{dateRdD.moisRdD.key}}" data-dtype="String" >
|
||||
{{#select dateRdD.moisRdD.key}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<input type="text" name="dateRdD.annee" value="{{dateRdD.annee}}" data-dtype="Number" />
|
||||
</span>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs"
|
||||
(timestamp-extract timestamp)
|
||||
path='chronologie'
|
||||
label='Date en jeu'
|
||||
disabled=''
|
||||
}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="dateReel">Date réelle</label>
|
||||
|
Loading…
Reference in New Issue
Block a user