Merge pull request 'Version 10.6.21 - La théière de Pralinor' (#632) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10

Reviewed-on: public/foundryvtt-reve-de-dragon#632
This commit is contained in:
uberwald 2023-03-08 23:17:45 +01:00
commit 67735197bc
25 changed files with 577 additions and 584 deletions

View File

@ -4,7 +4,6 @@ import { RdDRollDialogEthylisme } from "./rdd-roll-ethylisme.js";
import { RdDRoll } from "./rdd-roll.js"; import { RdDRoll } from "./rdd-roll.js";
import { RdDTMRDialog } from "./rdd-tmr-dialog.js"; import { RdDTMRDialog } from "./rdd-tmr-dialog.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDAstrologieJoueur } from "./rdd-astrologie-joueur.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDRollTables } from "./rdd-rolltables.js";
@ -36,6 +35,7 @@ import { DialogRepos } from "./sommeil/dialog-repos.js";
import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDBaseActor } from "./actor/base-actor.js";
import { RdDTimestamp } from "./rdd-timestamp.js"; import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDItemTache } from "./item-tache.js"; import { RdDItemTache } from "./item-tache.js";
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "./sommeil/app-astrologie.js";
const POSSESSION_SANS_DRACONIC = { const POSSESSION_SANS_DRACONIC = {
img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp',
@ -2916,7 +2916,7 @@ export class RdDActor extends RdDBaseActor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async resetNombreAstral() { async resetNombresAstraux() {
let toDelete = this.listItems('nombreastral'); let toDelete = this.listItems('nombreastral');
const deletions = toDelete.map(it => it._id); const deletions = toDelete.map(it => it._id);
await this.deleteEmbeddedDocuments("Item", deletions); await this.deleteEmbeddedDocuments("Item", deletions);
@ -2936,24 +2936,23 @@ export class RdDActor extends RdDBaseActor {
} }
}; };
await this.createEmbeddedDocuments("Item", [item]); await this.createEmbeddedDocuments("Item", [item]);
// Affichage Dialog game.system.rdd.calendrier.notifyChangeNombresAstraux();
this.astrologieNombresAstraux();
} }
async supprimerAnciensNombresAstraux() { async supprimerAnciensNombresAstraux() {
const toDelete = this.listItems('nombreastral') const calendrier = game.system.rdd.calendrier;
.filter(it => game.system.rdd.calendrier.isAfterIndexDate(it.system.jourindex)) if (calendrier) {
.map(it => it._id); const toDelete = this.listItems('nombreastral')
await this.deleteEmbeddedDocuments("Item", toDelete); .filter(it => calendrier.isAfterIndexDate(it.system.jourindex))
.map(it => it._id);
await this.deleteEmbeddedDocuments("Item", toDelete);
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async astrologieNombresAstraux() { async astrologieNombresAstraux() {
// Suppression des anciens nombres astraux
await this.supprimerAnciensNombresAstraux(); await this.supprimerAnciensNombresAstraux();
await AppAstrologie.create(this);
// Afficher l'interface spéciale
await RdDAstrologieJoueur.create(this);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -26,10 +26,13 @@ export class RdDBaseActor extends Actor {
case "msg_remote_actor_call": case "msg_remote_actor_call":
return RdDBaseActor.onRemoteActorCall(sockmsg.data, sockmsg.userId); return RdDBaseActor.onRemoteActorCall(sockmsg.data, sockmsg.userId);
case "msg_reset_nombre_astral": case "msg_reset_nombre_astral":
console.log("RESET ASTRAL", game.user.character); game.user.character.resetNombresAstraux();
game.user.character.resetNombreAstral(); game.system.rdd.calendrier.notifyChangeNombresAstraux();
return; return;
} case "msg_refresh_nombre_astral":
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
return;
}
} }
static remoteActorCall(callData, userId = undefined) { static remoteActorCall(callData, userId = undefined) {

View File

@ -119,6 +119,17 @@ export class Misc {
} }
} }
/**
* @returns an array of incremental integers (including from / excluding to).
* if max<min, the array is decrementing integers
*/
static intArray(from, to) {
if (from > to) {
return Array.from(Array(from - to).keys()).map(i => from - i)
}
return Array.from(Array(to - from).keys()).map(i => from + i)
}
static distinct(array) { static distinct(array) {
return [...new Set(array)]; return [...new Set(array)];
} }

View File

@ -1,54 +0,0 @@
import { ThemeAstral } from "./sommeil/theme-astral.js";
/**
* Extend the base Dialog entity by defining a custom window to perform roll.
* @extends {Dialog}
*/
export class RdDAstrologieEditeur extends Dialog {
/* -------------------------------------------- */
constructor(html, calendrier, calendrierData) {
let dialogConf = {
title: "Editeur d'Astrologie",
content: html,
default: "fermer",
buttons: {
fermer: { label: "Fermer", callback: html => { } }
}
};
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);
}
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find('[name="theme-astral"]').click(event => ThemeAstral.create());
this.html.find('[name="reset-nombres-astraux"]').click(event => this.resetNombreAstraux());
}
/* -------------------------------------------- */
async resetNombreAstraux() {
game.system.rdd.calendrier.resetNombreAstral();
await game.system.rdd.calendrier.rebuildListeNombreAstral();
game.system.rdd.calendrier.showAstrologieEditor();
this.close()
}
/* -------------------------------------------- */
updateData(calendrierData) {
this.calendrierData = duplicate(calendrierData);
}
}

View File

@ -1,100 +0,0 @@
import { RdDItemCompetence } from "./item-competence.js";
import { Misc } from "./misc.js";
import { SYSTEM_SOCKET_ID } from "./constants.js";
import { ThemeAstral } from "./sommeil/theme-astral.js";
/**
* Extend the base Dialog entity by defining a custom window to perform roll.
* @extends {Dialog}
*/
export class RdDAstrologieJoueur extends Dialog {
/* -------------------------------------------- */
static async create(actor) {
let dialogData = {
nombres: this.organizeNombres(actor),
dates: game.system.rdd.calendrier.getJoursSuivants(10),
etat: actor.getEtatGeneral(),
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
astrologie: RdDItemCompetence.findCompetence(actor.items, 'Astrologie')
}
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html', dialogData);
const options = { classes: ["rdd-roll-dialog"], width: 600, height: 'fit-content', 'z-index': 99999 };
const dialog = new RdDAstrologieJoueur(html, actor, dialogData, options);
dialog.render(true);
}
/* -------------------------------------------- */
constructor(html, actor, dialogData, dialogOptions) {
const dialogConf = {
title: "Nombres Astraux",
content: html,
default: "saveButton",
buttons: {
saveButton: { label: "Fermer", callback: html => {} }
},
};
super(dialogConf, dialogOptions);
this.actor = actor;
this.dataNombreAstral = duplicate(dialogData);
}
/* -------------------------------------------- */
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find("[name='diffConditions']").val(0);
this.html.find('[name="jet-astrologie"]').click(event => {
this.requestJetAstrologie();
});
this.html.find('[name="theme-astral"]').click(event => {
ThemeAstral.create();
});
}
/* -------------------------------------------- */
static organizeNombres(actor) {
let itemNombres = actor.listItems('nombreastral');
let itemFiltered = {};
for (let item of itemNombres) {
if (itemFiltered[item.system.jourindex]) {
itemFiltered[item.system.jourindex].listValues.push(item.system.value);
} else {
itemFiltered[item.system.jourindex] = {
listValues: [item.system.value],
jourlabel: item.system.jourlabel
}
}
}
return itemFiltered;
}
/* -------------------------------------------- */
requestJetAstrologie() {
let socketData = {
id: this.actor.id,
carac_vue: this.actor.system.carac['vue'].value,
etat: this.dataNombreAstral.etat,
astrologie: this.dataNombreAstral.astrologie,
conditions: this.html.find('[name="diffConditions"]').val(),
date: this.html.find('[name="joursAstrologie"]').val(),
userId: game.user.id
}
if (Misc.isUniqueConnectedGM()) {
game.system.rdd.calendrier.requestNombreAstral(socketData);
} else {
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_request_nombre_astral",
data: socketData
});
}
this.close();
}
}

View File

@ -1,19 +1,14 @@
import { RdDCalendrierEditeur } from "./rdd-calendrier-editeur.js"; import { RdDCalendrierEditeur } from "./rdd-calendrier-editeur.js";
import { RdDAstrologieEditeur } from "./rdd-astrologie-editeur.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { RdDDice } from "./rdd-dice.js"; import { RdDDice } from "./rdd-dice.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { HIDE_DICE, SHOW_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { DialogChronologie } from "./dialog-chronologie.js"; import { DialogChronologie } from "./dialog-chronologie.js";
import { RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js"; import { MAX_NOMBRE_ASTRAL, RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
import { DialogChateauDormant } from "./sommeil/dialog-chateau-dormant.js"; import { DialogChateauDormant } from "./sommeil/dialog-chateau-dormant.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js"; import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { APP_ASTROLOGIE_REFRESH, AppAstrologie } from "./sommeil/app-astrologie.js";
const RDD_JOUR_PAR_MOIS = 28;
const RDD_HEURES_PAR_JOUR = 12;
const MAX_NOMBRE_ASTRAL = 12;
const JOURS_DU_MOIS = Array(RDD_JOUR_PAR_MOIS).fill().map((item, index) => 1 + index);
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDCalendrier extends Application { export class RdDCalendrier extends Application {
@ -43,10 +38,10 @@ export class RdDCalendrier extends Application {
if (Misc.isUniqueConnectedGM()) { // Uniquement si GM if (Misc.isUniqueConnectedGM()) { // Uniquement si GM
RdDTimestamp.setWorldTime(this.timestamp); RdDTimestamp.setWorldTime(this.timestamp);
this.listeNombreAstral = this.getListeNombreAstral(); this.nombresAstraux = this.getNombresAstraux();
this.rebuildListeNombreAstral(HIDE_DICE); // Ensure always up-to-date this.rebuildNombresAstraux(HIDE_DICE); // Ensure always up-to-date
} }
console.log('RdDCalendrier.constructor()', this.timestamp, this.timestamp.toCalendrier(), this.calendrierPos, this.listeNombreAstral); console.log('RdDCalendrier.constructor()', this.timestamp, this.timestamp.toCalendrier(), this.calendrierPos, this.nombresAstraux);
Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id)); Hooks.on('updateSetting', async (setting, update, options, id) => this.onUpdateSetting(setting, update, options, id));
} }
@ -54,6 +49,7 @@ export class RdDCalendrier extends Application {
if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) { if (setting.key == SYSTEM_RDD + '.' + WORLD_TIMESTAMP_SETTING) {
this.timestamp = RdDTimestamp.getWorldTime(); this.timestamp = RdDTimestamp.getWorldTime();
this.updateDisplay(); this.updateDisplay();
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
} }
} }
@ -150,7 +146,7 @@ export class RdDCalendrier extends Application {
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getListeNombreAstral() { getNombresAstraux() {
return game.settings.get(SYSTEM_RDD, "liste-nombre-astral") ?? []; return game.settings.get(SYSTEM_RDD, "liste-nombre-astral") ?? [];
} }
@ -190,12 +186,8 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
getJoursSuivants(count) { getJoursSuivants(count) {
let jours = []; return Misc.intArray(this.timestamp.indexDate, this.timestamp.indexDate + count)
let indexDate = this.timestamp.indexDate; .map(i => { return { label: RdDTimestamp.formatIndexDate(i), index: i } })
for (let i = 0; i < count; i++, indexDate++) {
jours[i] = { label: RdDTimestamp.formatIndexDate(indexDate), index: indexDate };
}
return jours;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -216,8 +208,8 @@ export class RdDCalendrier extends Application {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
resetNombreAstral() { resetNombresAstraux() {
this.listeNombreAstral = []; this.nombresAstraux = [];
game.settings.set(SYSTEM_RDD, "liste-nombre-astral", []); game.settings.set(SYSTEM_RDD, "liste-nombre-astral", []);
game.socket.emit(SYSTEM_SOCKET_ID, { game.socket.emit(SYSTEM_SOCKET_ID, {
@ -237,30 +229,39 @@ export class RdDCalendrier extends Application {
if (indexDate == undefined) { if (indexDate == undefined) {
indexDate = this.timestamp.indexDate; indexDate = this.timestamp.indexDate;
} }
const listNombreAstral = this.getListeNombreAstral(); this.nombresAstraux = this.getNombresAstraux();
let astralData = listNombreAstral.find((nombreAstral, i) => nombreAstral.index == indexDate); let astralData = this.nombresAstraux.find((nombreAstral, i) => nombreAstral.index == indexDate);
return astralData?.nombreAstral ?? 0; return astralData?.nombreAstral ?? 0;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rebuildListeNombreAstral(showDice = HIDE_DICE) { async rebuildNombresAstraux(showDice = HIDE_DICE) {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
let newList = []; let newList = [];
for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) { for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) {
let dayIndex = this.timestamp.indexDate + i; let dayIndex = this.timestamp.indexDate + i;
let na = this.listeNombreAstral.find(n => n.index == dayIndex); let na = this.nombresAstraux.find(n => n.index == dayIndex);
if (na) { if (na) {
newList[i] = na; newList[i] = na;
} else { } else {
newList[i] = await this.ajouterNombreAstral(dayIndex, showDice); newList[i] = await this.ajouterNombreAstral(dayIndex, showDice);
} }
} }
this.listeNombreAstral = newList; this.nombresAstraux = newList;
game.settings.set(SYSTEM_RDD, "liste-nombre-astral", newList); game.settings.set(SYSTEM_RDD, "liste-nombre-astral", newList);
game.actors.forEach(actor => actor.deleteEmbeddedDocuments("Item", actor.listItems('nombreastral').map(it => it.id))); game.actors.filter(it => it.isPersonnage()).forEach(actor => actor.supprimerAnciensNombresAstraux());
this.notifyChangeNombresAstraux();
} }
} }
notifyChangeNombresAstraux() {
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_refresh_nombre_astral",
data: {}
});
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async setNewTimestamp(newTimestamp) { async setNewTimestamp(newTimestamp) {
const oldTimestamp = this.timestamp; const oldTimestamp = this.timestamp;
@ -270,7 +271,7 @@ export class RdDCalendrier extends Application {
await DialogChateauDormant.create(); await DialogChateauDormant.create();
} }
this.timestamp = newTimestamp; this.timestamp = newTimestamp;
await this.rebuildListeNombreAstral(); await this.rebuildNombresAstraux();
this.updateDisplay(); this.updateDisplay();
} }
@ -286,6 +287,7 @@ export class RdDCalendrier extends Application {
this.positionnerHeure(Number(calendarSet.value)); this.positionnerHeure(Number(calendarSet.value));
} }
this.updateDisplay(); this.updateDisplay();
Hooks.callAll(APP_ASTROLOGIE_REFRESH);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -366,16 +368,16 @@ export class RdDCalendrier extends Application {
} }
addNbAstralIncorect(actorId, date, nbAstral) { addNbAstralIncorect(actorId, date, nbAstral) {
let astralData = this.listeNombreAstral.find((nombreAstral, i) => nombreAstral.index == date); let astralData = this.nombresAstraux.find((nombreAstral, i) => nombreAstral.index == date);
astralData.valeursFausses.push({ actorId: actorId, nombreAstral: nbAstral }); astralData.valeursFausses.push({ actorId: actorId, nombreAstral: nbAstral });
game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.listeNombreAstral); game.settings.set(SYSTEM_RDD, "liste-nombre-astral", this.nombresAstraux);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getAjustementAstrologique(heureNaissance, name = undefined) { getAjustementAstrologique(heureNaissance, name = undefined) {
let defHeure = RdDTimestamp.findHeure(heureNaissance); let defHeure = RdDTimestamp.findHeure(heureNaissance);
if (defHeure) { if (defHeure) {
return RdDCalendrier.ajustementAstrologiqueHeure(defHeure.heure, this.getNombreAstral(), this.timestamp.heure); return RdDTimestamp.ajustementAstrologiqueHeure(defHeure.heure, this.getNombreAstral(), this.timestamp.heure);
} }
else if (name) { else if (name) {
ui.notifications.warn(name + " n'a pas d'heure de naissance, ou elle est incorrecte : " + heureNaissance); ui.notifications.warn(name + " n'a pas d'heure de naissance, ou elle est incorrecte : " + heureNaissance);
@ -386,20 +388,6 @@ export class RdDCalendrier extends Application {
return 0; return 0;
} }
static ajustementAstrologiqueHeure(hn, nbAstral, heure) {
switch (RdDCalendrier.ecartHeureChance(hn, nbAstral, heure)) {
case 0: return 4;
case 4: case 8: return 2;
case 6: return -4;
case 3: case 9: return -2;
}
return 0;
}
static ecartHeureChance(heureNaissance, nombreAstral, heure) {
return ((heureNaissance + nombreAstral - heure) % RDD_HEURES_PAR_JOUR + RDD_HEURES_PAR_JOUR) % RDD_HEURES_PAR_JOUR;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
getData() { getData() {
let formData = super.getData(); let formData = super.getData();
@ -473,41 +461,8 @@ export class RdDCalendrier extends Application {
this.editeur.render(true); this.editeur.render(true);
} }
static buildJoursMois() { return JOURS_DU_MOIS; }
/* -------------------------------------------- */ /* -------------------------------------------- */
async showAstrologieEditor() { async showAstrologieEditor() {
const calendrierData = duplicate(this.fillCalendrierData()); await AppAstrologie.create();
this.listeNombreAstral = this.listeNombreAstral || [];
calendrierData.astrologieData = this.listeNombreAstral.map(astro => {
const timestamp = new RdDTimestamp({ indexDate: astro.index });
astro.date = { mois: timestamp.mois, jour: timestamp.jour + 1 }
for (let vf of astro.valeursFausses) {
let actor = game.actors.get(vf.actorId);
vf.actorName = (actor) ? actor.name : "Inconnu";
}
return astro;
});
const nbAstral = this.getNombreAstral()
calendrierData.heures = Array.from(Array(RDD_HEURES_PAR_JOUR).keys());
calendrierData.ajustementsActeur = game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner).map(actor => {
return {
actor,
ajustements: calendrierData.heures.map(heure => {
const hn = RdDTimestamp.findHeure(actor.getHeureNaissance())?.heure;
return {
heure,
ajustement: RdDCalendrier.ajustementAstrologiqueHeure(hn, nbAstral, heure)
}
})
}
});
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/calendar-astrologie-template.html', calendrierData);
let astrologieEditeur = new RdDAstrologieEditeur(html, this, calendrierData)
astrologieEditeur.updateData(calendrierData);
astrologieEditeur.render(true);
} }
} }

View File

@ -55,7 +55,7 @@ import { RdDFauneItemSheet } from "./item/sheet-faune.js";
import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js"; import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js";
import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js"; import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js";
import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js"; import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js";
import { ThemeAstral } from "./sommeil/theme-astral.js"; import { AppAstrologie } from "./sommeil/app-astrologie.js";
/** /**
* RdD system * RdD system
@ -97,7 +97,7 @@ export class SystemReveDeDragon {
/* -------------------------------------------- */ /* -------------------------------------------- */
async onInit() { async onInit() {
game.system.rdd = this; game.system.rdd = this;
this.ThemeAstral = ThemeAstral; this.AppAstrologie = AppAstrologie;
console.log(`Initializing Reve de Dragon System`); console.log(`Initializing Reve de Dragon System`);

View File

@ -283,12 +283,9 @@ export class RdDResolutionTable {
carac: carac, carac: carac,
difficulte: level, difficulte: level,
min: minLevel, min: minLevel,
rows: RdDResolutionTable.incrementalArray(minCarac, maxCarac), rows: Misc.intArray(minCarac, maxCarac+1),
cols: RdDResolutionTable.incrementalArray(minLevel, maxLevel) cols: Misc.intArray(minLevel, maxLevel+1)
}); });
} }
static incrementalArray(min, max) {
return Array.from(Array(max-min+1).keys()).map(i=>i+min)
}
} }

View File

@ -5,10 +5,11 @@ import { RdDDice } from "./rdd-dice.js";
export const WORLD_TIMESTAMP_SETTING = "calendrier"; 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_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_HEURES = 120;
const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PAR_HEURES; const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PAR_HEURES;
const ROUNDS_PAR_MINUTE = 10; const ROUNDS_PAR_MINUTE = 10;
@ -46,16 +47,9 @@ const FORMULES_PERIODE = [
{ code: 'jour', label: "Jours", calcul: async (t, nombre) => t.addJours(nombre) }, { code: 'jour', label: "Jours", calcul: async (t, nombre) => t.addJours(nombre) },
] ]
export class RdDTimestamp { 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() { static init() {
game.settings.register(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, { game.settings.register(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, {
name: 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 * @returns L'entrée de DEFINITION_HEURES correspondant au signe
*/ */
static definition(signe) { static definition(signe) {
if (signe == undefined) { if (signe == undefined) {
signe = 0; signe = 0;
@ -91,23 +110,26 @@ export class RdDTimestamp {
return definition return definition
} }
static definitions() {
return DEFINITION_HEURES
}
static formulesDuree() {
return FORMULES_DUREE
}
static formulesPeriode() {
return FORMULES_PERIODE
}
static imgSigneHeure(heure) { static imgSigneHeure(heure) {
return RdDTimestamp.imgSigne(RdDTimestamp.definition(heure)); return RdDTimestamp.imgSigne(RdDTimestamp.definition(heure));
} }
static imgSigne(signe) { 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) => { }) { static handleTimestampEditor(html, path, consumeTimestamp = async (path, timestamp) => { }) {
@ -230,6 +252,7 @@ export class RdDTimestamp {
get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) } get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) }
get minute() { return this.indexMinute % RDD_MINUTES_PAR_HEURES } get minute() { return this.indexMinute % RDD_MINUTES_PAR_HEURES }
get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) } get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) }
get pourcentageDuJour() { return this.indexMinute / RDD_MINUTES_PAR_JOUR }
formatDate() { formatDate() {
const jour = this.jour + 1; const jour = this.jour + 1;

View File

@ -19,9 +19,9 @@ import { RdDRaretes } from "./item/raretes.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
// This table starts at 0 -> niveau -10 // This table starts at 0 -> niveau -10
const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"]; const carac_array = ["taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10]; const difficultesLibres = Misc.intArray(0, -11);
const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10]; const ajustementsConditions = Misc.intArray(-10, 11);
const ajustementsEncaissement = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10, +11, +12, +13, +14, +15, +16, +17, +18, +19, +20, +21, +22, +23, +24, +25]; const ajustementsEncaissement = Misc.intArray(-10, 26);
/* -------------------------------------------- */ /* -------------------------------------------- */
function _buildAllSegmentsFatigue(max) { function _buildAllSegmentsFatigue(max) {
@ -234,8 +234,10 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html', 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-meditation.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', 'systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html', 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-alchimie.html',
'systems/foundryvtt-reve-de-dragon/templates/dialog-astrologie-joueur.html',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs', 'systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-gardien.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-joueur.hbs',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-theme.hbs',
// Calendrier // Calendrier
'systems/foundryvtt-reve-de-dragon/templates/calendar-template.html', 'systems/foundryvtt-reve-de-dragon/templates/calendar-template.html',
'systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html', 'systems/foundryvtt-reve-de-dragon/templates/calendar-editor-template.html',

View File

@ -0,0 +1,216 @@
import { SYSTEM_RDD } from "../constants.js";
import { Misc } from "../misc.js";
import { RdDTimestamp } from "../rdd-timestamp.js";
export const APP_ASTROLOGIE_REFRESH = `${SYSTEM_RDD}-refresh-astrologie`
export class AppAstrologie extends Application {
static async create(actor = undefined, options = {}) {
if (actor == undefined && !game.user.isGM) {
actor = game.user.character
}
if (!actor && !game.user.isGM) {
console.error("AppAstrologie uniquement accessible pour le MJ, ou depuis un personnage pour un joueur")
}
new AppAstrologie(actor, options).render(true);
}
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/sommeil/app-astrologie.hbs",
title: "Astrologie",
width: 'fit-content',
height: 'fit-content',
popOut: true,
resizable: false
});
}
constructor(actor, options = {}) {
super(options);
this.actor = actor;
this.hookReference = Hooks.on(APP_ASTROLOGIE_REFRESH, () => this.refreshAstrologie());
}
getData(options) {
this.appData = super.getData(options)
const calendrier = game.system.rdd.calendrier;
mergeObject(this.appData, {
isGM: game.user.isGM,
isActor: this.actor != undefined,
calendrier: calendrier.getTimestamp().toCalendrier(),
dates: calendrier.getJoursSuivants(10),
heures: RdDTimestamp.definitions(),
actorAstrologie: this.getActorAstrologie(),
gmAstrologie: this.getGMAstrologie(calendrier),
theme: {
signeAstral: RdDTimestamp.definition(0),
signeNaissance: RdDTimestamp.definition(0)
}
})
return this.appData;
}
getActorAstrologie() {
if (this.actor) {
return {
actor: this.actor,
nombres: this._organizeNombresAstraux(this.actor.listItems('nombreastral')),
ajustements: CONFIG.RDD.difficultesLibres,
etat: this.actor.getEtatGeneral(),
astrologie: this.actor.getCompetence('Astrologie')
}
}
return {}
}
_organizeNombresAstraux(nombresAstraux) {
let organized = {};
nombresAstraux.forEach(na => {
if (!organized[na.system.jourindex]) {
organized[na.system.jourindex] = {
listValues: [],
jourlabel: na.system.jourlabel
}
}
organized[na.system.jourindex].listValues.push(na.system.value);
})
return organized;
}
getGMAstrologie(calendrier) {
if (game.user.isGM) {
const nbAstral = calendrier.getNombreAstral()
const heures = RdDTimestamp.heures();
return {
ajustementsActors: game.actors.filter(it => it.isPersonnage() && it.hasPlayerOwner)
.map(actor => this.getAjustementActor(actor, nbAstral, heures)),
nombresAstraux: calendrier.getNombresAstraux().map(na => this.getDetailNombreAstral(na))
}
}
return {}
}
getAjustementActor(actor, nbAstral, heures) {
const hn = RdDTimestamp.findHeure(actor.getHeureNaissance())?.heure ?? 0;
return {
actor,
ajustements: heures.map(heure => {
return { heure, ajustement: RdDTimestamp.ajustementAstrologiqueHeure(hn, nbAstral, heure) };
})
}
}
getDetailNombreAstral(nombreAstral) {
const detail = 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");
return detail;
}
/* -------------------------------------------- */
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find('select[name="signe-astral"]').change(event => {
this.selectNombreAstral(this.html.find('select[name="signe-astral"]').val());
})
this.html.find('select[name="signe-naissance"]').change(event => {
this.selectHeureNaissance(this.html.find('select[name="signe-naissance"]').val());
})
this.html.find('td.nombre-astral').click(event => {
this.selectNombreAstral(Number.parseInt(event.currentTarget.attributes['data-nombre-astral'].value) - 1);
})
this.html.find('tr.heure-naissance').click(event => {
this.selectHeureNaissance(event.currentTarget.attributes['data-heure-naissance'].value);
})
this.html.find('[name="jet-astrologie"]').click(event => this.requestJetAstrologie());
this.html.find('[name="rebuild-nombres-astraux"]').click(event => this.rebuildNombresAstraux());
this.onCalculThemeAstral();
}
selectHeureNaissance(heureNaissance) {
this.appData.theme.signeNaissance = RdDTimestamp.definition(heureNaissance);
this.onCalculThemeAstral();
}
selectNombreAstral(nombreAstral) {
this.appData.theme.signeAstral = RdDTimestamp.definition(nombreAstral);
this.onCalculThemeAstral();
}
/* -------------------------------------------- */
async rebuildNombresAstraux() {
game.system.rdd.calendrier.resetNombresAstraux();
await game.system.rdd.calendrier.rebuildNombresAstraux();
}
onCalculThemeAstral() {
const chiffreAstral = this.appData.theme.signeAstral.heure + 1;
const heureNaissance = this.appData.theme.signeNaissance.heure + 1;
RdDTimestamp.definitions().forEach(dh => {
const ajustement = RdDTimestamp.ajustementAstrologiqueHeure(heureNaissance, chiffreAstral, dh.heure + 1);
const txtAjustement = ajustement == 0 ? '' : Misc.toSignedString(ajustement);
this.html.find(`div.astro-ajustement.ajustement-${dh.hh}`).text(txtAjustement)
});
this.html.find(`select[name="signe-astral"]`).val(this.appData.theme.signeAstral.key)
this.html.find(`select[name="signe-naissance"]`).val(this.appData.theme.signeNaissance.key)
const angleAstrologie = ((chiffreAstral + heureNaissance) * 30) % 360;
this.html.find(`div.astro-roue div.astro-disque img`).css(this.cssRotation(angleAstrologie));
const timestamp = game.system.rdd.calendrier.getTimestamp();
const angleHeure = timestamp.pourcentageDuJour * 360
this.html.find(`div.astro-roue div.astro-horloge img`).css(this.cssRotation(angleHeure));
}
cssRotation(angleAstrologie) {
const rotation = `rotate(${angleAstrologie}deg)`;
const cssRotation = {
'transform': rotation,
'-ms-transform': rotation,
'-moz-transform': rotation,
'-webkit-transform': rotation,
'-o-transform': rotation
};
return cssRotation;
}
requestJetAstrologie() {
if (!this.appData?.isActor) {
return
}
let socketData = {
id: this.appData.actorAstrologie.actor.id,
carac_vue: this.actor.system.carac['vue'].value,
etat: this.actor.getEtatGeneral(),
astrologie: this.actor.getCompetence('Astrologie'),
conditions: this.html.find('[name="diffConditions"]').val(),
date: this.html.find('[name="joursAstrologie"]').val(),
userId: game.user.id
}
if (Misc.isUniqueConnectedGM()) {
game.system.rdd.calendrier.requestNombreAstral(socketData);
} else {
game.socket.emit(SYSTEM_SOCKET_ID, {
msg: "msg_request_nombre_astral",
data: socketData
});
}
}
refreshAstrologie() {
this.render(true)
}
async close(options) {
Hooks.off(APP_ASTROLOGIE_REFRESH, this.hookReference);
this.hookReference = undefined
await super.close(options)
}
}

View File

@ -4,7 +4,10 @@ import { EffetsDraconiques } from "../tmr/effets-draconiques.js";
export class DialogRepos extends Dialog { export class DialogRepos extends Dialog {
static async create(actor) { static async create(actor) {
if (!ReglesOptionelles.isUsing("chateau-dormant-gardien")) { if (!actor.isPersonnage()) {
return
}
if (!ReglesOptionelles.isUsing("chateau-dormant-gardien") || !actor.hasPlayerOwner) {
actor.system.sommeil = { actor.system.sommeil = {
"nouveaujour": true, "nouveaujour": true,
"insomnie": EffetsDraconiques.isSujetInsomnie(actor), "insomnie": EffetsDraconiques.isSujetInsomnie(actor),

View File

@ -1,58 +0,0 @@
import { Misc } from "../misc.js";
import { RdDCalendrier } from "../rdd-calendrier.js";
import { RdDTimestamp } from "../rdd-timestamp.js";
export class ThemeAstral extends Application {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/sommeil/theme-astral.hbs",
title: "Thème astral",
width: 'fit-content',
height: 'fit-content',
popOut: true,
resizable: false
});
}
static async create() {
new ThemeAstral().render(true);
}
constructor() {
super({});
}
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find('select[name="signe-astral"]').change(event => {
this.onCalculThemeAstral();
})
this.html.find('select[name="signe-naissance"]').change(event => {
this.onCalculThemeAstral();
})
this.onCalculThemeAstral();
}
onCalculThemeAstral() {
const signeAstral = RdDTimestamp.definition(this.html.find('select[name="signe-astral"]').val())
const chiffreAstral = signeAstral.heure + 1;
const signeNaissance = RdDTimestamp.definition(this.html.find('select[name="signe-naissance"]').val())
const heureNaissance = signeNaissance.heure + 1;
const heureChance = (chiffreAstral + heureNaissance) % 12 + 1
RdDTimestamp.definitions().forEach(dh => {
const ajustement = RdDCalendrier.ajustementAstrologiqueHeure(heureNaissance, chiffreAstral, dh.heure + 1);
const txtAjustement = ajustement == 0 ? '' : Misc.toSignedString(ajustement);
this.html.find(`div.astro-ajustement.ajustement-${dh.hh}`).text(txtAjustement)
});
const angle = (heureChance * 30 + 330) % 360;
const rotation = `rotate(${angle}deg)`;
this.html.find(`div.astro-roue div.astro-disque img`).css({
'transform': rotation,
'-ms-transform': rotation,
'-moz-transform': rotation,
'-webkit-transform': rotation,
'-o-transform': rotation
});
}
}

View File

@ -8,6 +8,6 @@
{"name":"Encaissement","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/svg/bones.svg","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.encaisser();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671234017623,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"WD6T8AdRbX2Ylxqe"} {"name":"Encaissement","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/svg/bones.svg","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.encaisser();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671234017623,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"WD6T8AdRbX2Ylxqe"}
{"name":"Jet quelconque","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/sundries/gaming/dice-runed-tan.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.roll();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233500655,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"bnJnbKDHpbqY8Pr9"} {"name":"Jet quelconque","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/sundries/gaming/dice-runed-tan.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.roll();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233500655,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"bnJnbKDHpbqY8Pr9"}
{"name":"Recherche et tirage","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/tools/scribal/magnifying-glass.webp","command":"game.system.rdd.commands.tirage()","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.ZFWPNdQBjQs9z0YW"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.5.4","coreVersion":"10.291","createdTime":1673472449426,"modifiedTime":1673655461651,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"iVZnxOxhCMpkvYh3"} {"name":"Recherche et tirage","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/tools/scribal/magnifying-glass.webp","command":"game.system.rdd.commands.tirage()","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.ZFWPNdQBjQs9z0YW"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.5.4","coreVersion":"10.291","createdTime":1673472449426,"modifiedTime":1673655461651,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"iVZnxOxhCMpkvYh3"}
{"name":"Thème astral","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/magic/nature/symbol-moon-stars-white.webp","command":"game.system.rdd.ThemeAstral.create();","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.oA0HPFeFK6YMspAX"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.6.19","coreVersion":"10.291","createdTime":1678127868791,"modifiedTime":1678150559112,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"koqhiDJSGP4gQ4vf"} {"name":"Thème astral","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/magic/nature/symbol-moon-stars-white.webp","command":"game.system.rdd.AppAstrologie.create()","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.oA0HPFeFK6YMspAX"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.6.19","coreVersion":"10.291","createdTime":1678127868791,"modifiedTime":1678237392810,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"koqhiDJSGP4gQ4vf"}
{"name":"Jet d'éthylisme","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/consumables/drinks/alcohol-beer-stein-wooden-metal-brown.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.jetEthylisme();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233646086,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"mvub1dRHNFmWjRr7"} {"name":"Jet d'éthylisme","type":"script","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"icons/consumables/drinks/alcohol-beer-stein-wooden-metal-brown.webp","command":"const selected = game.system.rdd.RdDUtility.getSelectedActor();\nif (selected) {\n selected.jetEthylisme();\n}\nelse {\n ui.notifications.info('Pas de personnage sélectionné');\n}","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.XHNbjnGKXaCiCadq"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1671220038331,"modifiedTime":1671233646086,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"mvub1dRHNFmWjRr7"}
{"name":"Tirer le tarot","type":"chat","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp","command":"/tirer tarot","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.HBZSKR9OHCQbLcTC"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1669469547231,"modifiedTime":1671237401618,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"vTfJTFYYiRu8X5LM"} {"name":"Tirer le tarot","type":"chat","scope":"global","author":"Hp9ImM4o9YRTSdfu","img":"systems/foundryvtt-reve-de-dragon/icons/tarots/dos-tarot.webp","command":"/tirer tarot","ownership":{"default":0,"Hp9ImM4o9YRTSdfu":3},"flags":{"core":{"sourceId":"Macro.HBZSKR9OHCQbLcTC"}},"_stats":{"systemId":"foundryvtt-reve-de-dragon","systemVersion":"10.3.15","coreVersion":"10.291","createdTime":1669469547231,"modifiedTime":1671237401618,"lastModifiedBy":"Hp9ImM4o9YRTSdfu"},"folder":null,"sort":0,"_id":"vTfJTFYYiRu8X5LM"}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -870,12 +870,16 @@ form.rdddialogchrono input[type=datetime-local] {
color: var(--color-text-dark-primary); color: var(--color-text-dark-primary);
border-radius: 3px; border-radius: 3px;
} }
div.theme-astral{
width: 14rem;
margin: 0.4rem;
}
form.dialog-astro { form.dialog-astro {
width: 17rem; width: 17rem;
} }
form.dialog-astro div.astro-roue { div.astro-roue {
position: relative; position: relative;
left: 2rem; left: calc(50% - 6.5rem);
width: 13rem; width: 13rem;
height: 13rem; height: 13rem;
} }
@ -903,7 +907,15 @@ div.astro-roue div.astro-disque {
width: calc(100% - 5rem); width: calc(100% - 5rem);
height: calc(100% - 5rem); height: calc(100% - 5rem);
} }
div.astro-roue div.astro-disque img { border: none; } div.astro-roue div.astro-horloge {
position: absolute;
border: none;
top: calc(50% - 3.5rem);
left: calc(50% - 3.5rem);
width: calc(100% - 6rem);
height: calc(100% - 6rem);
}
div.astro-roue div:is(.astro-disque,.astro-horloge) img { border: none; }
div.astro-roue div.astro-heure img.astro-heure-img { div.astro-roue div.astro-heure img.astro-heure-img {
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "10.6.20", "version": "10.6.21",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.20.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.21.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",

View File

@ -1,56 +0,0 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="header-fields">
<h1 class="charname">Horoscope</h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<table class='table-nombres-astraux'>
<tr class='table-nombres-astraux-td'>
<th>Date</th>
{{#each astrologieData as |nombreData key|}}
<td class='table-nombres-astraux-td'>{{nombreData.date.jour}}{{timestamp-imgSigneHeure nombreData.date.mois}}</td>
{{/each}}
</tr>
<tr class='table-nombres-astraux-td'>
<th>Nombre astral</th>
{{#each astrologieData as |nombreData key|}}
<td class='table-nombres-astraux-td'>
<ol>
<b>{{nombreData.nombreAstral}}</b>
{{#each nombreData.valeursFausses as |fausseVal key|}}
<li>{{fausseVal.actorName}} - {{fausseVal.nombreAstral}}</li>
{{/each}}
</ol>
</td>
{{/each}}
</tr>
</table>
</div>
<div>
<table>
<tr>
<td></td>
<td><strong>+4</strong></td>
<td><strong>+2</strong></td>
<td><strong>-2</strong></td>
<td><strong>-4</strong></td>
</tr>
{{#each heuresParActeur as |heuresDef name|}}
<tr>
<td><strong>{{name}}</strong>:</td>
{{#each heuresDef as |ajustement|}}
<td>
{{#each ajustement.heures as |heure|}}
{{timestamp-imgSigneHeure heure}}
{{/each}}
</td>
{{/each}}
</tr>
{{/each}}
</table>
</div>
</section>
</form>

View File

@ -1,68 +0,0 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="header-fields">
<h1 class="charname">Horoscope</h1>
</div>
<div class="header-fields">
<a class="chat-card-button" name="theme-astral">Thème astral</a>
<a class="chat-card-button" name="reset-nombres-astraux">Réinitialiser les nombres astraux</a>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<table class='table-nombres-astraux'>
<tr>
<th>Date</th>
{{#each astrologieData as |nombreData key|}}
<th>{{nombreData.date.jour}}{{timestamp-imgSigneHeure nombreData.date.mois}}</th>
{{/each}}
</tr>
<tr>
<th>Nombre astral</th>
{{#each astrologieData as |nombreData key|}}
<td>
<ol>
<b>{{nombreData.nombreAstral}}</b>
{{#each nombreData.valeursFausses as |fausseVal key|}}
<li>{{fausseVal.actorName}} - {{fausseVal.nombreAstral}}</li>
{{/each}}
</ol>
</td>
{{/each}}
</tr>
</table>
</div>
<div>
<table class='table-nombres-astraux'>
<tr>
<th></th>
{{#each heures as |heure|}}
<th>
{{timestamp-imgSigneHeure heure}}
</th>
{{/each}}
</tr>
{{#each ajustementsActeur as |ajustementActeur|}}
<tr>
<td>
<img class="img-signe-heure" src="{{actor.img}}" title="{{actor.name}}" />
{{actor.name}} {{timestamp-imgSigneHeure actor.system.heure}}
</td>
{{#each ajustementActeur.ajustements as |ajustement|}}
<td>{{#if (ne ajustement.ajustement 0)}}
<strong>
{{numberFormat ajustement.ajustement decimals=0 sign=true}}
</strong>
{{else}}
<div class="dimmed">
{{timestamp-imgSigneHeure ajustement.heure}}
</div>
{{/if}}</td>
{{/each}}
</tr>
{{/each}}
</table>
</div>
</section>
</form>

View File

@ -1,61 +0,0 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<div class="header-fields">
<h1 class="charname">Astrologie</h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div>
<label>Conditions</label>
<select name="diffConditions" data-dtype="Number">
{{#select diffConditions}}
{{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
{{/each}}
{{/select}}
</select>
<label>&nbsp;&nbsp;Jours</label>
<select name="joursAstrologie" data-dtype="Number">
{{#select joursSuivants}}
{{#each dates as |date key|}}
<option value={{date.index}}>{{date.label}}</option>
{{/each}}
{{/select}}
</select>
<label>
&nbsp;&nbsp;Etat Général: {{etat}}
</label>
</div>
<div class="form-group">
<a class="chat-card-button" name="jet-astrologie">Lire les étoiles</a>
<a class="chat-card-button" name="theme-astral">Thème astral</a>
</div>
<div class="form-group">
<label for="astralList">Nombres Astraux</label>
<table class='table-nombres-astraux'>
<tr class='table-nombres-astraux-td'>
{{#each nombres as |nombreData key|}}
<td class='table-nombres-astraux-td'>{{nombreData.jourlabel}}</td>
{{/each}}
</tr>
<tr class='table-nombres-astraux-td'>
{{#each nombres as |nombreData key|}}
<td class='table-nombres-astraux-td'>
<ol>
{{#each nombreData.listValues as |nombreAstral key|}}
<li>{{nombreAstral}}</li>
{{/each}}
</ol>
</td>
{{/each}}
</tr>
</table>
</div>
</section>
</form>

View File

@ -0,0 +1,18 @@
<form class="app-calendar-astrologie" autocomplete="off">
<div class="flexrow">
<div class="flex-grow">
<div class="header-fields">
<h1 class="charname">Astrologie {{#if isActor}}: {{actorAstrologie.actor.name}}{{/if}}</h1>
</div>
{{log 'astrologie' this}}
{{#if isActor}}
{{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-joueur.hbs'}}
{{else}}
{{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-gardien.hbs'}}
{{/if}}
</div>
<div>
{{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-theme.hbs'}}
</div>
</div>
</form>

View File

@ -0,0 +1,57 @@
<div>
<a class="chat-card-button" name="rebuild-nombres-astraux">Réinitialiser les nombres astraux</a>
</div>
<div class="form-group">
<table class='table-nombres-astraux'>
<tr>
<th>Date</th>
{{#each gmAstrologie.nombresAstraux as |nba|}}
<th>{{nba.date.jour}}{{timestamp-imgSigneHeure nba.date.mois}}</th>
{{/each}}
</tr>
<tr>
<th>Nombre astral</th>
{{#each gmAstrologie.nombresAstraux as |nba|}}
<td class="nombre-astral" data-nombre-astral="{{nba.nombreAstral}}">
<ol>
<b>{{nba.nombreAstral}}</b>
{{#each nba.valeursFausses as |fausse|}}
<li>{{fausse.actorName}} - {{fausse.nombreAstral}}</li>
{{/each}}
</ol>
</td>
{{/each}}
</tr>
</table>
</div>
<div>
<table class='table-nombres-astraux'>
<tr>
<th></th>
{{#each heures as |heure|}}
<td>
{{timestamp-imgSigneHeure heure.heure}}
</td>
{{/each}}
</tr>
{{#each gmAstrologie.ajustementsActors as |ajustementActeur|}}
<tr class="heure-naissance" data-heure-naissance="{{actor.system.heure}}">
<td>
<img class="img-signe-heure" src="{{actor.img}}" title="{{actor.name}}" />
{{actor.name}} {{timestamp-imgSigneHeure actor.system.heure}}
</td>
{{#each ajustementActeur.ajustements as |ajustement|}}
<td>{{#if (ne ajustement.ajustement 0)}}
<strong>
{{numberFormat ajustement.ajustement decimals=0 sign=true}}
</strong>
{{else}}
<div class="dimmed">
{{timestamp-imgSigneHeure ajustement.heure}}
</div>
{{/if}}</td>
{{/each}}
</tr>
{{/each}}
</table>
</div>

View File

@ -0,0 +1,43 @@
<div>
<label>Conditions</label>
<select name="diffConditions" data-dtype="Number">
{{#select '0'}}
{{#each actorAstrologie.ajustements as |ajustement|}}
<option value={{ajustement}}>{{ajustement}}</option>
{{/each}}
{{/select}}
</select>
<label>&nbsp;&nbsp;Jours</label>
<select name="joursAstrologie" data-dtype="Number">
{{#select ''}}
{{#each dates as |date|}}
<option value={{date.index}}>{{date.label}}</option>
{{/each}}
{{/select}}
</select>
<label>
&nbsp;&nbsp;Etat Général: {{actorAstrologie.etat}}
</label>
<a class="chat-card-button" name="jet-astrologie">Lire les étoiles</a>
</div>
<div class="form-group">
<label for="astralList">Nombres Astraux</label>
<table class='table-nombres-astraux'>
<tr class='table-nombres-astraux-td'>
{{#each actorAstrologie.nombres as |nombre|}}
<th class='table-nombres-astraux-td'>{{nombre.jourlabel}}</th>
{{/each}}
</tr>
<tr class='table-nombres-astraux-td'>
{{#each actorAstrologie.nombres as |nombre|}}
<td class='table-nombres-astraux-td'>
<ol>
{{#each nombre.listValues as |value|}}
<li>{{value}}</li>
{{/each}}
</ol>
</td>
{{/each}}
</tr>
</table>
</div>

View File

@ -0,0 +1,35 @@
<div class="theme-astral">
<div class="flexcol">
<label for="signe-astral">Nombre Astral</label>
<select name="signe-astral" class="calendar-signe-heure" data-dtype="String">
{{#select "vaisseau"}}
{{#each heures as |heure|}}
<option value="{{heure.key}}">{{numberFormat heure.hh}} - {{heure.label}}</option>
{{/each}}
{{/select}}
</select>
<label for="signe-naissance">Heure de Naissance</label>
<select name="signe-naissance" class="calendar-signe-heure" data-dtype="String">
{{#select "vaisseau"}}
{{#each heures as |heure|}}
<option value="{{heure.key}}">{{numberFormat heure.hh}} - {{heure.label}}</option>
{{/each}}
{{/select}}
</select>
</div>
<hr>
<div><label>Heures de chance et malchance</label></div>
<div class="astro-roue">
<div class="astro-cercle1"></div>
<div class="astro-disque">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/astro-disque.svg" alt="">
</div>
{{#each heures as |heure|}}
<div class="astro-heure heure-{{heure.hh}}"><img class="astro-heure-img" src="{{heure.webp}}" title="{{heure.label}}"></div>
<div class="astro-ajustement ajustement-{{heure.hh}}"></div>
{{/each}}
<div class="astro-horloge">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/rdd-aiguille-horloge.svg" alt="">
</div>
</div>
</div>

View File

@ -1,52 +0,0 @@
<form class="dialog-astro">
<div class="form-group">
<label for="signe-astral">Chiffre Astral</label>
<select name="signe-astral" class="calendar-signe-heure" data-dtype="String">
{{#select "vaisseau"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
{{/select}}
</select>
</div>
<div class="form-group">
<label for="signe-naissance">Heure</label>
<select name="signe-naissance" class="calendar-signe-heure" data-dtype="String">
{{#select "vaisseau"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
{{/select}}
</select>
</div>
<hr>
<div><label>Heures de chance et malchance</label></div>
<div class="astro-roue">
<div class="astro-cercle1"></div>
<div class="astro-disque">
<img src="systems/foundryvtt-reve-de-dragon/styles/img/ui/astro-disque.svg" alt="">
</div>
<div class="astro-heure heure-01"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd01.webp" alt=""></div>
<div class="astro-heure heure-02"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd02.webp" alt=""></div>
<div class="astro-heure heure-03"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd03.webp" alt=""></div>
<div class="astro-heure heure-04"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd04.webp" alt=""></div>
<div class="astro-heure heure-05"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd05.webp" alt=""></div>
<div class="astro-heure heure-06"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd06.webp" alt=""></div>
<div class="astro-heure heure-07"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd07.webp" alt=""></div>
<div class="astro-heure heure-08"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd08.webp" alt=""></div>
<div class="astro-heure heure-09"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd09.webp" alt=""></div>
<div class="astro-heure heure-10"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd10.webp" alt=""></div>
<div class="astro-heure heure-11"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd11.webp" alt=""></div>
<div class="astro-heure heure-12"><img class="astro-heure-img" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd12.webp" alt=""></div>
<div class="astro-ajustement ajustement-01"></div>
<div class="astro-ajustement ajustement-02"></div>
<div class="astro-ajustement ajustement-03">-2</div>
<div class="astro-ajustement ajustement-04">+2</div>
<div class="astro-ajustement ajustement-05"></div>
<div class="astro-ajustement ajustement-06">-4</div>
<div class="astro-ajustement ajustement-07"></div>
<div class="astro-ajustement ajustement-08">+2</div>
<div class="astro-ajustement ajustement-09">-2</div>
<div class="astro-ajustement ajustement-10"></div>
<div class="astro-ajustement ajustement-11"></div>
<div class="astro-ajustement ajustement-12">+4</div>
</div>
</form>