Intégration astrologie
Intégration du thème astral dans les fenêtres d'astrologie
This commit is contained in:
@ -5,10 +5,11 @@ 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;
|
||||
const RDD_HEURES_PAR_JOUR = 12;
|
||||
const RDD_MOIS_PAR_AN = 12;
|
||||
export const RDD_JOURS_PAR_MOIS = 28;
|
||||
export const RDD_HEURES_PAR_JOUR = 12;
|
||||
export const MAX_NOMBRE_ASTRAL = 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;
|
||||
@ -46,16 +47,9 @@ const FORMULES_PERIODE = [
|
||||
{ code: 'jour', label: "Jours", calcul: async (t, nombre) => t.addJours(nombre) },
|
||||
]
|
||||
|
||||
|
||||
export class RdDTimestamp {
|
||||
|
||||
static hh(heure) {
|
||||
return heure < 9 ? `0${heure + 1}` : `${heure + 1}`;
|
||||
}
|
||||
|
||||
static iconeHeure(heure) {
|
||||
return `systems/foundryvtt-reve-de-dragon/icons/heures/hd${RdDTimestamp.hh(heure)}.svg`;
|
||||
}
|
||||
|
||||
static init() {
|
||||
game.settings.register(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, {
|
||||
name: WORLD_TIMESTAMP_SETTING,
|
||||
@ -73,10 +67,35 @@ export class RdDTimestamp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static hh(heure) {
|
||||
return heure < 9 ? `0${heure + 1}` : `${heure + 1}`;
|
||||
}
|
||||
|
||||
static iconeHeure(heure) {
|
||||
return `systems/foundryvtt-reve-de-dragon/icons/heures/hd${RdDTimestamp.hh(heure)}.svg`;
|
||||
}
|
||||
|
||||
static definitions() {
|
||||
return DEFINITION_HEURES
|
||||
}
|
||||
|
||||
static formulesDuree() {
|
||||
return FORMULES_DUREE
|
||||
}
|
||||
|
||||
static formulesPeriode() {
|
||||
return FORMULES_PERIODE
|
||||
}
|
||||
|
||||
static heures() {
|
||||
return Misc.intArray(0, RDD_HEURES_PAR_JOUR)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param signe
|
||||
* @param signe
|
||||
* @returns L'entrée de DEFINITION_HEURES correspondant au signe
|
||||
*/
|
||||
*/
|
||||
static definition(signe) {
|
||||
if (signe == undefined) {
|
||||
signe = 0;
|
||||
@ -91,23 +110,26 @@ export class RdDTimestamp {
|
||||
return definition
|
||||
}
|
||||
|
||||
static definitions() {
|
||||
return DEFINITION_HEURES
|
||||
}
|
||||
static formulesDuree() {
|
||||
return FORMULES_DUREE
|
||||
}
|
||||
|
||||
static formulesPeriode() {
|
||||
return FORMULES_PERIODE
|
||||
}
|
||||
|
||||
static imgSigneHeure(heure) {
|
||||
return RdDTimestamp.imgSigne(RdDTimestamp.definition(heure));
|
||||
}
|
||||
|
||||
static imgSigne(signe) {
|
||||
return signe == undefined ? '' : `<img class="img-signe-heure" src="${signe.webp}" alt="${signe.label}"/>`
|
||||
return signe == undefined ? '' : `<img class="img-signe-heure" src="${signe.webp}" alt="${signe.label}" title="${signe.label}"/>`
|
||||
}
|
||||
|
||||
static ajustementAstrologiqueHeure(hn, nbAstral, heure) {
|
||||
let ecart = (hn + nbAstral - heure) % RDD_HEURES_PAR_JOUR;
|
||||
if (ecart < 0) {
|
||||
ecart = (ecart + RDD_HEURES_PAR_JOUR) % RDD_HEURES_PAR_JOUR;
|
||||
}
|
||||
switch (ecart) {
|
||||
case 0: return 4;
|
||||
case 4: case 8: return 2;
|
||||
case 6: return -4;
|
||||
case 3: case 9: return -2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static handleTimestampEditor(html, path, consumeTimestamp = async (path, timestamp) => { }) {
|
||||
|
Reference in New Issue
Block a user