Merge pull request '10.6.14' (#625) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10

Reviewed-on: public/foundryvtt-reve-de-dragon#625
This commit is contained in:
uberwald 2023-02-09 07:22:14 +01:00
commit b7ea857bb4
21 changed files with 609 additions and 370 deletions

View File

@ -32,7 +32,7 @@ import { RdDConfirm } from "./rdd-confirm.js";
import { DialogValidationEncaissement } from "./dialog-validation-encaissement.js"; import { DialogValidationEncaissement } from "./dialog-validation-encaissement.js";
import { RdDRencontre } from "./item/rencontre.js"; import { RdDRencontre } from "./item/rencontre.js";
import { Targets } from "./targets.js"; import { Targets } from "./targets.js";
import { DialogRepos } from "./dialog-repos.js"; 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";
@ -208,6 +208,7 @@ export class RdDActor extends RdDBaseActor {
} }
return etatGeneral return etatGeneral
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getActivePoisons() { getActivePoisons() {
return duplicate(this.items.filter(item => item.type == 'poison' && item.system.active)) return duplicate(this.items.filter(item => item.type == 'poison' && item.system.active))
@ -359,6 +360,33 @@ export class RdDActor extends RdDBaseActor {
dialog.render(true); dialog.render(true);
} }
async prepareChateauDormant(finChateauDormant, consignes) {
if (consignes.ignorer) {
return;
}
if (consignes.stress.valeur > 0) {
await this.distribuerStress('stress', consignes.stress.valeur, consignes.stress.motif);
}
if (!consignes.sommeil?.insomnie) {
await this.update({
"system.sommeil": {
nouveaujour: true,
date: finChateauDormant,
moral: consignes.sommeil?.moral ?? 'neutre',
heures: consignes.sommeil?.heures ?? 4
}
})
}
}
async onTimeChanging(oldTimestamp, newTimestamp) {
await super.onTimeChanging(oldTimestamp, newTimestamp);
const insomnie = EffetsDraconiques.isSujetInsomnie(this);
if (!this.system.sommeil || this.system.sommeil.insomnie || insomnie) {
await this.update({ 'system.sommeil.insomnie': insomnie });
}
}
async repos() { async repos() {
await DialogRepos.create(this); await DialogRepos.create(this);
} }
@ -370,7 +398,7 @@ export class RdDActor extends RdDBaseActor {
content: `${nGrisReve} jours de gris rêve sont passés. ` content: `${nGrisReve} jours de gris rêve sont passés. `
}; };
for (let i = 0; i < nGrisReve; i++) { for (let i = 0; i < nGrisReve; i++) {
await this.dormir(6, { grisReve: true }); await this.dormir(4, { grisReve: true });
await this._recuperationSante(message); await this._recuperationSante(message);
const moralActuel = Misc.toInt(this.system.compteurs.moral.value); const moralActuel = Misc.toInt(this.system.compteurs.moral.value);
@ -381,6 +409,14 @@ export class RdDActor extends RdDBaseActor {
await this.transformerStress(); await this.transformerStress();
this.bonusRecuperationPotion = 0; // Reset potion this.bonusRecuperationPotion = 0; // Reset potion
} }
await this.update({
"system.sommeil": {
nouveaujour: false,
moral: "neutre",
heures: 0
}
})
ChatMessage.create(message); ChatMessage.create(message);
this.sheet.render(true); this.sheet.render(true);
} }
@ -424,25 +460,35 @@ export class RdDActor extends RdDBaseActor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async dormirChateauDormant() { async dormirChateauDormant() {
let message = { if (!ReglesOptionelles.isUsing("chateau-dormant-gardien") || !this.system.sommeil || this.system.sommeil?.nouveaujour) {
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), const message = {
content: "" whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
}; content: ""
};
const blessures = duplicate(this.system.blessures) await this._recuperationSante(message)
await this._recuperationSante(message) await this._jetDeMoralChateauDormant(message);
await this._jetDeMoralChateauDormant(message); await this._recupereChance();
await this._recupereChance(); if (!this.system.sommeil?.insomnie) {
await this.transformerStress(); await this.transformerStress();
await this.retourSeuilDeReve(message); }
this.bonusRecuperationPotion = 0; // Reset potion await this.retourSeuilDeReve(message);
await this.retourSust(message); this.bonusRecuperationPotion = 0; // Reset potion
await this.verifierPotionsEnchantees(); await this.retourSust(message);
if (message.content != "") { await this.verifierPotionsEnchantees();
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`; if (message.content != "") {
ChatMessage.create(message); message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
ChatMessage.create(message);
}
await this.update({
"system.sommeil": {
nouveaujour: false,
moral: "neutre",
heures: 0
}
});
this.sheet.render(true);
} }
this.sheet.render(true);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -456,9 +502,11 @@ export class RdDActor extends RdDBaseActor {
} }
async _jetDeMoralChateauDormant(message) { async _jetDeMoralChateauDormant(message) {
const jetMoral = await this._jetDeMoral('neutre'); const etatMoral = this.system.sommeil?.moral ?? 'neutre';
message.content += ' -- le moral ' + this._messageAjustementMoral(jetMoral.ajustement); const jetMoral = await this._jetDeMoral(etatMoral);
message.content += ` -- le jet de moral est ${etatMoral}, le moral ` + this._messageAjustementMoral(jetMoral.ajustement);
} }
_messageAjustementMoral(ajustement) { _messageAjustementMoral(ajustement) {
switch (Math.sign(ajustement)) { switch (Math.sign(ajustement)) {
case 1: case 1:
@ -591,59 +639,70 @@ export class RdDActor extends RdDBaseActor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async dormir(heures, options = { grisReve: false }) { async dormir(sommeilHeures, options = { grisReve: false, chateauDormant: false }) {
let message = { const sommeil = !this.system.sommeil?.insomnie || options.grisReve;
const message = {
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: "" content: ""
}; };
await this.recupereEndurance(message); await this.recupereEndurance(message);
let sep = "" let sep = ""
let recuperationReve = ""; let recuperationReve = "";
let i = 0; let heuresDormies = 0;
for (; i < heures; i++) { for (; heuresDormies < sommeilHeures; heuresDormies++) {
await this._recupererEthylisme(message); await this._recupererEthylisme(message);
await this.recupererFatigue(message); if (sommeil) {
if (!options.grisReve) { await this.recupererFatigue(message);
let r = await this.recuperationReve(message); if (!options.grisReve) {
if (r >= 0) { if (sommeil) {
recuperationReve += sep + r; let r = await this.recuperationReve(message);
sep = "+"; if (r >= 0) {
} recuperationReve += sep + r;
sep = "+";
}
if (r >= 0 && EffetsDraconiques.isDonDoubleReve(this)) { if (r >= 0 && EffetsDraconiques.isDonDoubleReve(this)) {
r = await this.recuperationReve(message); r = await this.recuperationReve(message);
if (r >= 0) { if (r >= 0) {
recuperationReve += sep + r; recuperationReve += sep + r;
}
}
if (r < 0) {
heuresDormies++;// rêve de dragon pendant l'heure en cours
break;
}
} }
} }
if (r < 0) {
i++;// rêve de dragon pendant l'heure en cours
break;
}
} }
} }
if (!options.grisReve) { if (!options.grisReve) {
message.content = `${this.name}: Vous dormez ${i == 0 ? 'une' : i} heure${i == 1 ? '' : 's'}. ` const repos = this.system.sommeil?.insomnie ? "vous reposez" : "dormez"
message.content = `${this.name}: Vous ${repos} ${heuresDormies <= 1 ? 'une heure' : (heuresDormies + ' heures')}. `
+ (recuperationReve == "" ? "" : `Vous récupérez ${recuperationReve} Points de rêve. `) + (recuperationReve == "" ? "" : `Vous récupérez ${recuperationReve} Points de rêve. `)
+ message.content; + message.content;
ChatMessage.create(message); ChatMessage.create(message);
} }
this.sheet.render(true); if (options.chateauDormant && heuresDormies == sommeilHeures) {
return i; await this.dormirChateauDormant();
}
else {
this.sheet.render(true);
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _recupererEthylisme(message) { async _recupererEthylisme(message) {
let ethylisme = duplicate(this.system.compteurs.ethylisme); let value = Math.min(Number.parseInt(this.system.compteurs.ethylisme.value) + 1, 1);
ethylisme.nb_doses = 0; if (value <= 0) {
ethylisme.jet_moral = false; message.content += `Vous dégrisez un peu (${RdDUtility.getNomEthylisme(value)}). `;
if (ethylisme.value < 1) {
ethylisme.value = Math.min(ethylisme.value + 1, 1);
if (ethylisme.value <= 0) {
message.content += `Vous dégrisez un peu (${RdDUtility.getNomEthylisme(ethylisme.value)}). `;
}
} }
await this.update({ "system.compteurs.ethylisme": ethylisme }); await this.update({
"system.compteurs.ethylisme": {
nb_doses: 0,
jet_moral: false,
value: value
}
});
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -651,7 +710,7 @@ export class RdDActor extends RdDBaseActor {
const manquant = this._computeEnduranceMax() - this.system.sante.endurance.value; const manquant = this._computeEnduranceMax() - this.system.sante.endurance.value;
if (manquant > 0) { if (manquant > 0) {
await this.santeIncDec("endurance", manquant); await this.santeIncDec("endurance", manquant);
message.content += "Vous récuperez " + manquant + " points d'endurance. "; message.content += `Vous récuperez ${manquant} points d'endurance. `;
} }
} }
@ -1012,12 +1071,12 @@ export class RdDActor extends RdDBaseActor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
distribuerStress(compteur, stress, motif) { async distribuerStress(compteur, stress, motif) {
if (game.user.isGM && this.hasPlayerOwner && this.isPersonnage()) { if (game.user.isGM && this.hasPlayerOwner && this.isPersonnage()) {
switch (compteur) { switch (compteur) {
case 'stress': case 'experience': case 'stress': case 'experience':
await this.addCompteurValue(compteur, stress, motif);
const message = `${this.name} a reçu ${stress} points ${compteur == 'stress' ? "de stress" : "d'expérience"} (raison : ${motif})`; const message = `${this.name} a reçu ${stress} points ${compteur == 'stress' ? "de stress" : "d'expérience"} (raison : ${motif})`;
this.addCompteurValue(compteur, stress, motif);
ui.notifications.info(message); ui.notifications.info(message);
game.users.players.filter(player => player.active && player.character?.id == this.id) game.users.players.filter(player => player.active && player.character?.id == this.id)
.forEach(player => ChatUtility.notifyUser(player.id, 'info', message)); .forEach(player => ChatUtility.notifyUser(player.id, 'info', message));
@ -1612,7 +1671,7 @@ export class RdDActor extends RdDBaseActor {
case 'heureux': case 'heureuse': return succes ? 1 : 0; case 'heureux': case 'heureuse': return succes ? 1 : 0;
case 'malheureuse': case 'malheureux': return succes ? 0 : -1; case 'malheureuse': case 'malheureux': return succes ? 0 : -1;
case 'neutre': case 'neutre':
if (succes && moral <= 0) return 1; if (succes && moral < 0) return 1;
if (!succes && moral > 0) return -1; if (!succes && moral > 0) return -1;
} }
return 0; return 0;
@ -3779,9 +3838,10 @@ export class RdDActor extends RdDBaseActor {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
let draconique = Draconique.all().find(it => it.match(item)); let draconique = Draconique.all().find(it => it.match(item));
if (draconique) { if (draconique) {
draconique.onActorCreateOwned(this, item) await draconique.onActorCreateOwned(this, item)
this.notifyGestionTeteSouffleQueue(item, draconique.manualMessage()); this.notifyGestionTeteSouffleQueue(item, draconique.manualMessage());
} }
await this.update({ 'system.sommeil.insomnie': EffetsDraconiques.isSujetInsomnie(this) });
} }
} }
@ -3790,7 +3850,7 @@ export class RdDActor extends RdDBaseActor {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
let draconique = Draconique.all().find(it => it.match(item)); let draconique = Draconique.all().find(it => it.match(item));
if (draconique) { if (draconique) {
draconique.onActorDeleteOwned(this, item) await draconique.onActorDeleteOwned(this, item)
} }
} }
} }
@ -3800,7 +3860,7 @@ export class RdDActor extends RdDBaseActor {
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
let draconique = Draconique.all().find(it => it.isCase(item)); let draconique = Draconique.all().find(it => it.isCase(item));
if (draconique) { if (draconique) {
draconique.onActorDeleteCaseTmr(this, item) await draconique.onActorDeleteCaseTmr(this, item)
} }
} }
} }

View File

@ -1,57 +0,0 @@
export class DialogRepos extends Dialog {
static async create(actor) {
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-repos.html", actor);
const dialog = new DialogRepos(html, actor);
dialog.render(true);
}
constructor(html, actor) {
let options = { classes: ["DialogCreateSigneDraconiqueActorsActors"], width: 400, height: 'fit-content', 'z-index': 99999 };
let conf = {
title: "Se reposer",
content: html,
default: "repos",
buttons: {
"repos": { label: "Se reposer", callback: async it => { this.repos(); } }
}
};
super(conf, options);
this.actor = actor;
}
activateListeners(html) {
super.activateListeners(html);
this.html = html;
}
/* -------------------------------------------- */
async repos() {
await this.html.find("[name='nb-heures']").change();
await this.html.find("[name='nb-jours']").change();
const selection = await this.html.find("[name='repos']:checked").val();
const nbHeures = Number.parseInt(await this.html.find("[name='nb-heures']").val());
const nbJours = Number.parseInt(await this.html.find("[name='nb-jours']").val());
console.log("ACTOR", this.actor)
switch (selection) {
case "sieste": {
await this.actor.dormir(nbHeures);
return;
}
case "nuit": {
let heuresDormies = await this.actor.dormir(nbHeures);
if (heuresDormies == nbHeures) {
await this.actor.dormirChateauDormant();
}
return;
}
case "chateau-dormant":
await this.actor.dormirChateauDormant();
return;
case "gris-reve": {
await this.actor.grisReve(nbJours);
return;
}
}
}
}

View File

@ -7,6 +7,8 @@ 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 { RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
import { DialogChateauDormant } from "./sommeil/dialog-chateau-dormant.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
const RDD_JOUR_PAR_MOIS = 28; const RDD_JOUR_PAR_MOIS = 28;
const RDD_HEURES_PAR_JOUR = 12; const RDD_HEURES_PAR_JOUR = 12;
@ -67,17 +69,17 @@ export class RdDCalendrier extends Application {
this.html.find('.calendar-btn').click(ev => this.onCalendarButton(ev)); this.html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
this.html.find('.calendar-btn-edit').click(ev => { this.html.find('.calendar-set-datetime').click(ev => {
ev.preventDefault(); ev.preventDefault();
this.showCalendarEditor(); this.showCalendarEditor();
}); });
this.html.find('.astrologie-btn-edit').click(ev => { this.html.find('.calendar-astrologie').click(ev => {
ev.preventDefault(); ev.preventDefault();
this.showAstrologieEditor(); this.showAstrologieEditor();
}); });
this.html.find('#calendar-move-handle').mousedown(ev => { this.html.find('.calendar-title').mousedown(ev => {
ev.preventDefault(); ev.preventDefault();
ev = ev || window.event; ev = ev || window.event;
let isRightMB = false; let isRightMB = false;
@ -169,7 +171,7 @@ export class RdDCalendrier extends Application {
getCurrentMinute() { return this.timestamp.indexMinute; } getCurrentMinute() { return this.timestamp.indexMinute; }
getTimestampFinChateauDormant(nbJours = 0) { getTimestampFinChateauDormant(nbJours = 0) {
return this.timestamp.nouveauJour().addJour(nbJours); return this.timestamp.nouveauJour().addJours(nbJours);
} }
getTimestampFinHeure(nbHeures = 0) { getTimestampFinHeure(nbHeures = 0) {
@ -257,8 +259,12 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
async setNewTimestamp(newTimestamp) { async setNewTimestamp(newTimestamp) {
game.actors.forEach(actor => actor.onTimeChanging(this.timestamp, newTimestamp)); const oldTimestamp = this.timestamp;
game.actors.forEach(actor => actor.onTimeChanging(oldTimestamp, newTimestamp));
RdDTimestamp.setWorldTime(newTimestamp); RdDTimestamp.setWorldTime(newTimestamp);
if (oldTimestamp.indexDate + 1 == newTimestamp.indexDate && ReglesOptionelles.isUsing("chateau-dormant-gardien")) {
await DialogChateauDormant.create();
}
this.timestamp = newTimestamp; this.timestamp = newTimestamp;
await this.rebuildListeNombreAstral(); await this.rebuildListeNombreAstral();
this.updateDisplay(); this.updateDisplay();
@ -292,10 +298,8 @@ export class RdDCalendrier extends Application {
async positionnerHeure(heure) { async positionnerHeure(heure) {
const indexDate = this.timestamp.indexDate; const indexDate = this.timestamp.indexDate;
const addDay = this.timestamp.heure < heure ? 0 : 1; const addDay = this.timestamp.heure < heure ? 0 : 1;
await this.setNewTimestamp(new RdDTimestamp({ const newTimestamp = new RdDTimestamp({ indexDate: indexDate + addDay}).addHeures(heure);
indexDate: indexDate + addDay, indexHeure: 0 await this.setNewTimestamp(newTimestamp)
})
.addHeures(heure))
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -428,13 +432,13 @@ export class RdDCalendrier extends Application {
if (game.user.isGM) { if (game.user.isGM) {
dateHTML = dateHTML + "<br>Nombre Astral: " + (this.getNombreAstral() ?? "?"); dateHTML = dateHTML + "<br>Nombre Astral: " + (this.getNombreAstral() ?? "?");
} }
for (let handle of document.getElementsByClassName("calendar-date-rdd")) { for (let handle of document.getElementsByClassName("calendar-title")) {
handle.innerHTML = dateHTML; handle.innerHTML = dateHTML;
} }
for (let heure of document.getElementsByClassName("calendar-heure-texte")) { for (let heure of document.getElementsByClassName("calendar-heure-texte")) {
heure.innerHTML = calendrier.heure.label; heure.innerHTML = calendrier.heure.label;
} }
for (const minute of document.getElementsByClassName("calendar-time-disp")) { for (const minute of document.getElementsByClassName("calendar-minute-texte")) {
minute.innerHTML = `${calendrier.minute} minutes`; minute.innerHTML = `${calendrier.minute} minutes`;
} }
for (const heureImg of document.getElementsByClassName("calendar-heure-img")) { for (const heureImg of document.getElementsByClassName("calendar-heure-img")) {

View File

@ -2,7 +2,8 @@
import { DialogChronologie } from "./dialog-chronologie.js"; import { DialogChronologie } from "./dialog-chronologie.js";
import { DialogCreateSigneDraconique } from "./dialog-create-signedraconique.js"; import { DialogCreateSigneDraconique } from "./dialog-create-signedraconique.js";
import { DialogStress } from "./dialog-stress.js"; import { DialogChateauDormant } from "./sommeil/dialog-chateau-dormant.js";
import { DialogStress } from "./sommeil/dialog-stress.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDCarac } from "./rdd-carac.js"; import { RdDCarac } from "./rdd-carac.js";
@ -13,7 +14,6 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js";
import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js"; import { RdDRollResolutionTable } from "./rdd-roll-resolution-table.js";
import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDRollTables } from "./rdd-rolltables.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { CompendiumTableHelpers } from "./settings/system-compendiums.js";
import { FenetreRechercheTirage } from "./tirage/fenetre-recherche-tirage.js"; import { FenetreRechercheTirage } from "./tirage/fenetre-recherche-tirage.js";
import { TMRUtility } from "./tmr-utility.js"; import { TMRUtility } from "./tmr-utility.js";
@ -77,6 +77,7 @@ export class RdDCommands {
this.registerCommand({ path: ["/tirer", "rencontre"], func: (content, msg, params) => this.getRencontreTMR(params), descr: `Détermine une rencontre dans les TMR (synonyme de "/tmrr")` }); this.registerCommand({ path: ["/tirer", "rencontre"], func: (content, msg, params) => this.getRencontreTMR(params), descr: `Détermine une rencontre dans les TMR (synonyme de "/tmrr")` });
this.registerCommand({ path: ["/tirage"], func: (content, msg, params) => this.tirage(), descr: "Ouvre la fenêtre de recherche et tirage" }); this.registerCommand({ path: ["/tirage"], func: (content, msg, params) => this.tirage(), descr: "Ouvre la fenêtre de recherche et tirage" });
this.registerCommand({ path: ["/sommeil"], func: (content, msg, params) => this.sommeil(msg, params), descr: "Prépare le passage de journée pour chateau dormant" });
this.registerCommand({ path: ["/meteo"], func: (content, msg, params) => this.getMeteo(msg, params), descr: "Propose une météo marine" }); this.registerCommand({ path: ["/meteo"], func: (content, msg, params) => this.getMeteo(msg, params), descr: "Propose une météo marine" });
this.registerCommand({ path: ["/nom"], func: (content, msg, params) => RdDNameGen.getName(msg, params), descr: "Génère un nom aléatoire" }); this.registerCommand({ path: ["/nom"], func: (content, msg, params) => RdDNameGen.getName(msg, params), descr: "Génère un nom aléatoire" });
@ -462,13 +463,14 @@ export class RdDCommands {
let name = params[params.length - 1]; let name = params[params.length - 1];
if (name == undefined) { if (name == undefined) {
for (let actor of game.actors) { for (let actor of game.actors) {
actor.distribuerStress('stress', stress, motif); // TODO: ne plus stresser les entités de cauchemar!
await actor.distribuerStress('stress', stress, motif);
} }
} else { } else {
//console.log(stressValue, nomJoueur); //console.log(stressValue, nomJoueur);
let actor = Misc.findActor(name, game.actors.filter(it => it.hasPlayerOwner)) ?? Misc.findPlayer(name)?.character let actor = Misc.findActor(name, game.actors.filter(it => it.hasPlayerOwner)) ?? Misc.findPlayer(name)?.character
if (actor) { if (actor) {
actor.distribuerStress('stress', stress, motif); await actor.distribuerStress('stress', stress, motif);
} }
else { else {
ui.notifications.warn(`Pas de personnage ou de joueur correspondant à ${name}!`); ui.notifications.warn(`Pas de personnage ou de joueur correspondant à ${name}!`);
@ -485,5 +487,8 @@ export class RdDCommands {
async tirage() { async tirage() {
FenetreRechercheTirage.create(); FenetreRechercheTirage.create();
} }
async sommeil() {
DialogChateauDormant.create();
}
} }

View File

@ -235,6 +235,7 @@ export class RdDUtility {
'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/dialog-astrologie-joueur.html',
'systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.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

@ -17,6 +17,7 @@ const listeReglesOptionelles = [
{ group: 'Règles générales', name: 'afficher-prix-joueurs', descr: "Afficher le prix de l'équipement des joueurs", uniquementJoueur: true}, { group: 'Règles générales', name: 'afficher-prix-joueurs', descr: "Afficher le prix de l'équipement des joueurs", uniquementJoueur: true},
{ group: 'Règles générales', name: 'appliquer-fatigue', descr: "Appliquer les règles de fatigue"}, { group: 'Règles générales', name: 'appliquer-fatigue', descr: "Appliquer les règles de fatigue"},
{ group: 'Règles générales', name: 'afficher-colonnes-reussite', descr: "Afficher le nombre de colonnes de réussite ou d'échec", default: false }, { group: 'Règles générales', name: 'afficher-colonnes-reussite', descr: "Afficher le nombre de colonnes de réussite ou d'échec", default: false },
{ group: 'Règles générales', name: 'chateau-dormant-gardien', descr: "Saisie des heures de sommeil/jets de moral par le gardien des rêves", default: true },
{ group: 'Confirmations', name: 'confirmer-combat-sans-cible', descr: "Confirmer avant une attaque sans cible", scope: "client"}, { group: 'Confirmations', name: 'confirmer-combat-sans-cible', descr: "Confirmer avant une attaque sans cible", scope: "client"},
{ group: 'Confirmations', name: 'confirmation-tmr', descr: "Confirmer pour monter dans les TMR", scope: "client"}, { group: 'Confirmations', name: 'confirmation-tmr', descr: "Confirmer pour monter dans les TMR", scope: "client"},

View File

@ -0,0 +1,108 @@
export class DialogChateauDormant extends Dialog {
static async create() {
const date = game.system.rdd.calendrier.dateCourante();
const actorsSettings = game.actors.filter(actor => actor.hasPlayerOwner && actor.isPersonnage())
.map(actor => ({
actor: actor,
insomnie: actor.system.sommeil?.insomnie,
moral: 'neutre'
}));
const dialogData = {
actorsSettings,
date: date,
motifStress: `Nuit du ${date}`,
finChateauDormant: game.system.rdd.calendrier.getTimestampFinChateauDormant()
};
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-chateau-dormant.hbs",
dialogData);
new DialogChateauDormant(dialogData, html)
.render(true);
}
constructor(dialogData, html) {
const options = {
classes: ["rdd-dialog-chateau-dormant"],
width: 600,
height: 'fit-content',
'z-index': 99999
};
const conf = {
title: "De Chateau dormant à Vaisseau",
content: html,
buttons: {
chateauDormant: { label: "Passer à Vaisseau!", callback: it => { this.onChateauDormant(); } }
}
};
super(conf, options);
this.dialogData = dialogData;
}
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find('input.sommeil-insomnie').change(event => this.onInsomnie(event));
this._activateListenerOnActorMoral(this.html);
}
_activateListenerOnActorMoral(html) {
html.find(`span.sommeil-actor-moral a`).click(event => this.onActorMoral(event));
}
onInsomnie(event) {
const sommeilInsomnie = this.html.find(event.currentTarget);
const isInsomnie = sommeilInsomnie.is(':checked');
const sommeilHeures = sommeilInsomnie.parents('.set-sommeil-actor').find('input.sommeil-heures');
sommeilHeures.prop('disabled', isInsomnie);
if (isInsomnie) {
sommeilHeures.val('0');
}
}
async onActorMoral(event) {
const selected = this.html.find(event.currentTarget);
const actorRow = selected.parents('.set-sommeil-actor');
const actorId = actorRow.data('actor-id');
const actorSetting = this.getActorSetting(actorId);
if (actorSetting) {
actorSetting.moral = selected.data('moral');
const htmlMoral = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs', actorSetting)
actorRow.find('.sommeil-actor-moral').html(htmlMoral);
// re-attach listeners for actor row
this._activateListenerOnActorMoral(actorRow);
}
}
getActorSetting(actorId) {
return this.dialogData.actorsSettings.find(it => it.actor.id == actorId);
}
async onChateauDormant() {
const motifStress = this.html.find("form input[name='motifStress']").val();
const sommeilActors = jQuery.map(this.html.find('li.set-sommeil-actor'), it => {
const actorRow = this.html.find(it);
const actorId = actorRow.data('actor-id');
const actorSetting = this.getActorSetting(actorId);
return {
actorId,
ignorer: actorRow.find('input.sommeil-ignorer').is(':checked'),
stress: {
motif: motifStress,
valeur: Number.parseInt(actorRow.find('input.sommeil-stress').val()),
},
sommeil: {
insomnie: actorRow.find('input.sommeil-insomnie').is(':checked'),
heures: Number.parseInt(actorRow.find('input.sommeil-heures').val()),
moral: actorSetting.moral,
}
}
});
await Promise.all(
sommeilActors.filter(it => !it.ignorer)
.map(async it => await game.actors.get(it.actorId)?.prepareChateauDormant(this.dialogData.finChateauDormant, it))
)
}
}

View File

@ -0,0 +1,82 @@
import { ReglesOptionelles } from "../settings/regles-optionelles.js";
export class DialogRepos extends Dialog {
static async create(actor) {
if (!ReglesOptionelles.isUsing("chateau-dormant-gardien")) {
actor.system.sommeil = {
"nouveaujour": true,
"insomnie": false,
"moral": "neutre",
"heures": 4
}
}
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-repos.html", actor);
const dialog = new DialogRepos(html, actor);
dialog.render(true);
}
constructor(html, actor) {
let options = { classes: ["DialogCreateSigneDraconiqueActorsActors"], width: 400, height: 'fit-content', 'z-index': 99999 };
let conf = {
title: "Se reposer",
content: html,
default: "repos",
buttons: {
"repos": { label: "Se reposer", callback: async it => { this.repos(); } }
}
};
super(conf, options);
this.actor = actor;
}
activateListeners(html) {
super.activateListeners(html);
this.html = html;
this.html.find(`.sommeil-actor-moral a`).click(event => this.onActorMoral(event));
}
/* -------------------------------------------- */
async repos() {
const selection = await this.html.find("[name='repos']:checked").val();
switch (selection) {
case "sieste": return await this.sieste();
case "nuit": return await this.nuit();
case "chateau-dormant": return await this.chateauDormant();
case "gris-reve": return await this.grisReve();
}
}
async grisReve() {
await this.html.find("[name='nb-jours']").change();
const nbJours = Number.parseInt(await this.html.find("[name='nb-jours']").val());
await this.actor.grisReve(nbJours);
}
async chateauDormant() {
await this.actor.dormirChateauDormant();
}
async nuit() {
await this.html.find("[name='sommeil.heures']").change();
const sommeilHeures = Number.parseInt(await this.html.find("[name='sommeil.heures']").val());
await this.actor.dormir(sommeilHeures, { chateauDormant: true });
}
async sieste() {
await this.html.find("[name='sieste.heures']").change();
const siesteHeures = Number.parseInt(await this.html.find("[name='sieste.heures']").val());
await this.actor.dormir(siesteHeures);
}
async onActorMoral(event) {
const selected = this.html.find(event.currentTarget);
const parentDiv = selected.parents().find('.sommeil-actor-moral');
const situationMoral = selected.data('moral');
await this.actor.update({"system.sommeil.moral": situationMoral});
const htmlMoral = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs', {
moral: situationMoral
});
parentDiv.html(htmlMoral);
this.html.find(`.sommeil-actor-moral a`).click(event => this.onActorMoral(event));
}
}

View File

@ -15,7 +15,7 @@ export class DialogStress extends Dialog {
) )
}; };
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-stress.html", dialogData); const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/sommeil/dialog-stress.html", dialogData);
new DialogStress(dialogData, html) new DialogStress(dialogData, html)
.render(true); .render(true);
} }
@ -50,7 +50,7 @@ export class DialogStress extends Dialog {
this.dialogData.actors.filter(it => it.selected) this.dialogData.actors.filter(it => it.selected)
.map(it => game.actors.get(it.id)) .map(it => game.actors.get(it.id))
.forEach(actor => actor.distribuerStress(compteur, stress, motif)); .forEach(async actor => await actor.distribuerStress(compteur, stress, motif));
} }
async onSelectActor(event) { async onSelectActor(event) {

View File

@ -189,30 +189,6 @@ export class FenetreRechercheTirage extends Application {
const row = await CompendiumTableHelpers.getRandom(table, 'Item') const row = await CompendiumTableHelpers.getRandom(table, 'Item')
await CompendiumTableHelpers.tableRowToChatMessage(row, 'Item'); await CompendiumTableHelpers.tableRowToChatMessage(row, 'Item');
}) })
// this.html.find('.recherche')
// .each((index, field) => {
// if (this.options.recherche) {
// field.focus();
// field.setSelectionRange(this.options.recherche.start, this.options.recherche.end);
// }
// })
// .keyup(async event => {
// const nouvelleRecherche = this._optionRecherche(event.currentTarget);
// if (this.options.recherche?.text != nouvelleRecherche?.text) {
// this.options.recherche = nouvelleRecherche;
// if (this.timerRecherche) {
// clearTimeout(this.timerRecherche);
// }
// this.timerRecherche = setTimeout(() => {
// this.timerRecherche = undefined;
// this.render(true);
// }, 500);
// }
// })
// .change(async event =>
// this.options.recherche = this._optionRecherche(event.currentTarget)
// );
} }
showFilterGroup(groupDiv, show) { showFilterGroup(groupDiv, show) {

View File

@ -164,6 +164,10 @@ export class EffetsDraconiques {
return actor.items.find(it => EffetsDraconiques.urgenceDraconique.match(it)); return actor.items.find(it => EffetsDraconiques.urgenceDraconique.match(it));
} }
static isSujetInsomnie(actor) {
return actor.items.find(it => ['queue', 'ombre'].includes(it.type) && Grammar.includesLowerCaseNoAccent(it.name, 'Insomnie')) ? true : false;
}
static isPeage(actor) { static isPeage(actor) {
return EffetsDraconiques.filterItems(actor, Draconique.isSouffleDragon, 'péage').length > 0; return EffetsDraconiques.filterItems(actor, Draconique.isSouffleDragon, 'péage').length > 0;
} }

View File

@ -80,7 +80,8 @@
--background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%); --background-custom-button: linear-gradient(to bottom, rgba(33, 55, 74, 0.988) 5%, rgba(21, 40, 51, 0.671) 100%);
--background-custom-button-hover: linear-gradient(to bottom, rgb(128, 0, 0) 5%, rgb(62, 1, 1) 100%); --background-custom-button-hover: linear-gradient(to bottom, rgb(128, 0, 0) 5%, rgb(62, 1, 1) 100%);
--background-tooltip: rgba(220,220,210,0.95); --background-control-selected: linear-gradient(to bottom, hsla(0, 100%, 25%, 0.5) 5%, hsla(0, 100%, 12%, 0.5) 100%);
--background-tooltip: hsla(60, 12%, 85%, 0.95);
--background-error:hsla(16, 100%, 50%, 0.8); --background-error:hsla(16, 100%, 50%, 0.8);
} }
@ -250,7 +251,10 @@ nav.sheet-tabs .item:after {
/* =================== Autres ============ */ /* =================== Autres ============ */
.tabs .item.active, .blessures-list li ul li:first-child:hover, a:hover { .tabs .item.active,
.blessures-list li ul li:first-child:hover,
i.moral-radio-checkmark-off:hover,
a:hover {
text-shadow: 1px 0px 0px #ff6600; text-shadow: 1px 0px 0px #ff6600;
} }
@ -514,7 +518,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
border: 0; border: 0;
vertical-align: bottom; vertical-align: bottom;
} }
:is(.button-img,.button-effect-img:hover,.small-button-direction):hover { :is(.button-img,.button-effect-img,.small-button-direction):hover {
color: var(--color-controls-hover); color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover); border: 1px solid var(--color-control-border-hover);
text-shadow: 1px 0px 0px #ff6600; text-shadow: 1px 0px 0px #ff6600;
@ -602,13 +606,13 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
margin-right: 0.2rem; margin-right: 0.2rem;
margin-left: 0.2rem; margin-left: 0.2rem;
} }
.rdd.sheet .window-content .sheet-body .carac-list .caracteristique .flex-grow-1 { .flex-grow-1 {
flex-grow: 1; flex-grow: 1;
} }
.rdd.sheet .window-content .sheet-body .carac-list .caracteristique .flex-grow-2 { .flex-grow-2 {
flex-grow: 2; flex-grow: 2;
} }
.rdd.sheet .window-content .sheet-body .carac-list .caracteristique .flex-grow-3 { .flex-grow-3 {
flex-grow: 3; flex-grow: 3;
} }
@ -1560,213 +1564,176 @@ table.table-nombres-astraux tr:hover {
position: absolute; position: absolute;
display: block; display: block;
} }
.calendar{
min-width: 150px; .calendar {
grid-row: 1; min-width: 250px;
grid-column: 1;
width: fit-content; width: fit-content;
height: 6rem;
display: grid;
grid-row: 2;
grid-column: 9;
min-height: 5rem;
height: fit-content;
margin: 0; margin: 0;
padding: 0; padding: 0;
border: 1px solid #000; border: 1px solid #000;
border-radius: 3%; border-radius: 0.3rem;
background: rgba(0, 0, 0, 0.5); background: hsla(0, 0%, 0%, 0.5);
font-family: "GoudyAcc"; font-family: "GoudyAcc";
z-index: 100; z-index: 100;
} }
.calendar-hdr{
display: grid; .calendar-title {
font-size: 1rem; grid-column: 1 / span 7;
margin: 0.1rem; grid-row: 1;
padding: 0.2rem;
height: fit-content;
width: fit-content;
min-width: 200px;
border-bottom: 1px solid #111;
color: #CCC;
float: left;
}
.calendar-date-rdd {
font-family: "GoudyAcc";
color: #CCC; color: #CCC;
opacity: 90; opacity: 90;
font-size: 0.9rem; font-size: 0.9rem;
text-align: center; text-align: center;
padding: 0;
margin: 0;
border: none;
flex: 1;
} }
.calendar-date{ .calendar-options {
grid-row: 1; grid-column: 8 / span 2;
grid-column: 2;
float: left;
text-align: center;
padding-top: 0px;
padding-bottom: 0px;
margin-bottom: 5px;
color: #CCC;
cursor: pointer;
} }
.calendar-date, .calendar-title,.calendar-options{
.calendar-date-num { border-bottom: 1px solid hsla(0, 0%, 80%, 0.5);
transition: 0.2s;
} }
.calendar-date-num {
grid-row: 1; .calendar-avance-heure {
grid-column: 2; grid-column: 1 / span 3;
float: left;
text-align: center;
padding-top: 0px;
padding-bottom: 0px;
margin-bottom: 5px;
color: #CCC;
opacity: 0;
cursor: pointer;
} }
.calendar-heure-img{
width: 24px; .calendar-change-heure {
height: 24px; grid-column: 9 / span 1;
flex-grow: 0;
border-width: 0;
opacity: 90;
color: rgba(255, 255, 255, 0.5);
} }
.calendar-hdr:hover .calendar-date {
opacity: 0; .calendar-change-heure .calendar-change-heure-grid {
display: grid;
grid-column: 1;
grid-row: 2;
margin: 2px;
grid-row-gap: 3px;
color: hsla(0, 0%, 80%, 0.5);
} }
.calendar-hdr:hover .calendar-date-num{
opacity: 1; .calendar-avance-heure .calendar-avance-heure-grid {
}
.calendar-container{
min-width: 250px;
padding-top: 3px;
padding-bottom: 20px;
}
.calendar-btn-container-left{
width: 25%;
display: grid; display: grid;
float: left; grid-column: 3;
grid-row: 2;
margin: 2px; margin: 2px;
grid-row-gap: 3px; grid-row-gap: 3px;
color: rgba(0, 0, 0, 0.5); color: hsla(0, 0%, 80%, 0.5);
} }
.calendar-btn-container-right{
width: 15%; .calendar-avance-heure .calendar-avance-heure-grid:hover {
color: #FFF;
cursor: pointer;
}
.calendar-affiche-heure {
grid-column: 4 / span 4;
grid-row: 2;
}
.calendar-affiche-heure .calendar-horloge {
display: grid; display: grid;
float: right; max-width: 100px;
margin: 2px; float: left;
grid-row-gap: 3px; padding-top: 0px;
padding-bottom: 0px;
margin: 0 0.3rem 0 0.3rem;
color: #CCC;
text-align: center;
} }
.astrologie-btn-edit,
.calendar-btn-edit{ .calendar-affiche-heure .calendar-horloge .calendar-heure-texte {
font-size: 1.1rem;
}
.calendar-affiche-heure .calendar-horloge .calendar-minute-texte {
margin: 0;
}
.calendar-affiche-heure .calendar-horloge .calendar-heure-img{
width: 2rem;
height: 2rem;
float: left;
flex-grow: 0;
padding: 0.1rem;
border: 0;
opacity: 0.9;
color: hsla(0, 0%, 100%, 0.5);
}
.calendar :is(.calendar-astrologie,.calendar-set-datetime) {
grid-row: 1; grid-row: 1;
grid-column: 1; grid-column: 1;
} }
:is(.astrologie-btn-edit,.calendar-btn-edit,.calendar-btn){ .calendar :is(.calendar-astrologie,.calendar-set-datetime,.calendar-btn) {
margin: auto; color: hsla(0, 0%, 100%, 0.5);
border: 1px solid rgba(0, 0, 0, 0); border: 1px solid rgba(0, 0, 0, 0);
color: rgba(255, 255, 255, 0.5);
} }
:is(.astrologie-btn-edit,.calendar-btn-edit,.calendar-btn):hover { .calendar :is(.calendar-astrologie,.calendar-set-datetime,.calendar-btn):hover {
color: var(--color-controls-hover); color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover); border: 1px solid var(--color-control-border-hover);
cursor: pointer; cursor: pointer;
} }
.calendar .calendar-affiche-heure .calendar-horloge a {
border: 1px solid rgba(0, 0, 0, 0);
}
.calendar .calendar-affiche-heure .calendar-horloge a:hover {
color: var(--color-controls-hover);
border: 1px solid var(--color-control-border-hover);
cursor: pointer;
}
.calendar-1min{ .calendar-avance-heure .calendar-1min {
grid-row: 1; grid-row: 1;
grid-column: 1; grid-column: 1;
margin-left: 0.2rem;
} }
.calendar-5min{ .calendar-avance-heure .calendar-5min {
grid-row: 1; grid-row: 1;
grid-column: 2; grid-column: 2;
} }
.calendar-15min{ .calendar-avance-heure .calendar-15min {
grid-row: 1; grid-row: 1;
grid-column: 3; grid-column: 3;
margin-right: 0.2rem;
} }
.calendar-avance-heure .calendar-30min {
.calendar-30min{
grid-row: 2; grid-row: 2;
grid-column: 1; grid-column: 1;
margin-left: 0.2rem;
} }
.calendar-avance-heure .calendar-60min {
.calendar-60min{
grid-row: 2; grid-row: 2;
grid-column: 2; grid-column: 2;
} }
.calendar-1heure{ .calendar-avance-heure .calendar-1heure {
grid-row: 2; grid-row: 2;
grid-column: 3; grid-column: 3;
margin-right: 0.2rem;
} }
.calendar-lyre{ .calendar-lyre{
grid-row: 1; grid-row: 1;
grid-column: 1; grid-column: 1;
margin-left: 0.2rem;
margin-right: 0.2rem;
} }
.calendar-vaisseau{ .calendar-vaisseau {
grid-row: 2; grid-row: 2;
grid-column: 1; grid-column: 1;
margin-left: 0.2rem;
margin-right: 0.2rem;
} }
.img-calendar-forward{
color: rgba(255, 255, 255, 0.5); .calendar-change-heure .calendar-btn:is(.calendar-lyre,.calendar-vaisseau) img {
color: hsla(0, 0%, 100%, 0.5);
vertical-align: bottom; vertical-align: bottom;
max-width: 1.2em; max-width: 1.2em;
max-height: 1.2em; max-height: 1.2em;
border-width: 0; border-width: 0;
} }
.calendar-btn-container-left:hover{ div.calendar-timestamp-edit select.calendar-signe-heure {
color: #FFF; width: max-content;
border: 0px solid #000;
cursor: pointer;
}
.calendar-weekday-time{
display: grid;
float: left;
width: 55%;
padding-top: 0px;
padding-bottom: 0px;
margin: auto;
color: #CCC;
}
.calendar-weekday {
grid-column: 1;
grid-row: 1;
text-align: center;
font-size: 1.1rem;
margin: auto;
}
.calendar-time{
grid-column: 1;
grid-row: 2;
text-align: center;
margin: auto;
cursor: pointer;
display: inline-flex;
}
.calendar-nombre-astral{
grid-column: 2;
grid-row: 2;
font-size: 1.1rem;
text-align: right;
margin: auto;
cursor: pointer;
display: inline-flex;
}
.calendar-time-disp{
position: relative;
bottom: 6px;
} }
/* Tooltip container */ /* Tooltip container */

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.13", "version": "10.6.14",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.13.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.14.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

@ -528,6 +528,16 @@
"label": "Experience", "label": "Experience",
"isInput": true "isInput": true
} }
},
"sommeil": {
"nouveaujour": false,
"date":{
"indexDate": -1,
"indexMinute": 0
},
"insomnie": false,
"moral": "",
"heures": 0
} }
} }
}, },

View File

@ -1,47 +1,47 @@
<div id="calendar-time-container"> <div id="calendar-time-container">
<div class="calendar"> <div class="calendar">
<div> <div class="calendar-title" title="Deplacer">{{jourDuMois}} {{mois.label}} ({{mois.saison}})</div>
<div class="calendar-hdr"> <div class="calendar-options">
<p id="calendar-move-handle" class="calendar-date-rdd" title="Deplacer">{{jourDuMois}} {{mois.label}} ({{mois.saison}})</p>
</div>
{{#if isGM}} {{#if isGM}}
<i class="calendar-btn-edit fa-solid fa-calendar-pen" title="Editer"></i> <i class="calendar-set-datetime fa-solid fa-calendar-pen" title="Editer"></i>
<i class="astrologie-btn-edit fa-solid fa-moon-over-sun" title="Astrologie"></i> <i class="calendar-astrologie fa-solid fa-moon-over-sun" title="Astrologie"></i>
{{/if}} {{/if}}
</div> </div>
<div class="calendar-container"> <div class="calendar-avance-heure">
{{#if isGM}} <div class="calendar-avance-heure-grid">
<div class="calendar-btn-container-left"> {{#if isGM}}
<i class="calendar-btn calendar-1min" data-calendar-avance="1" title="Avancer de 1 minute">+1</i> <i class="calendar-btn calendar-1min" data-calendar-avance="1" title="Avancer de 1 minute">+1</i>
<i class="calendar-btn calendar-5min" data-calendar-avance="5" title="Avancer de 5 minutes">+5</i> <i class="calendar-btn calendar-5min" data-calendar-avance="5" title="Avancer de 5 minutes">+5</i>
<i class="calendar-btn calendar-15min" data-calendar-avance="15" title="Avancer de 15 minutes">+15</i> <i class="calendar-btn calendar-15min" data-calendar-avance="15" title="Avancer de 15 minutes">+15</i>
<i class="calendar-btn calendar-30min" data-calendar-avance="30" title="Avancer de 30 minutes">+30</i> <i class="calendar-btn calendar-30min" data-calendar-avance="30" title="Avancer de 30 minutes">+30</i>
<i class="calendar-btn calendar-60min" data-calendar-avance="60" title="Avancer de 60 minutes" >+60</i> <i class="calendar-btn calendar-60min" data-calendar-avance="60" title="Avancer de 60 minutes" >+60</i>
<i class="calendar-btn calendar-1heure" data-calendar-avance="120" title="Avancer d'1 heure" >+1h</i> <i class="calendar-btn calendar-1heure" data-calendar-avance="120" title="Avancer d'1 heure" >+1h</i>
{{else}}
{{/if}}
</div> </div>
{{else}} </div>
<div class="calendar-btn-container-left"> <div class="calendar-affiche-heure">
</div> <div class="calendar-horloge">
{{/if}} <a class="ajout-chronologie">
<div class="calendar-weekday-time"> <img class="calendar-heure-img" src="{{heure.icon}}" alt="{{nomHeure}}"/>
<a class="ajout-chronologie calendar-weekday">
<img class="calendar-heure-img" src="{{heure.icon}}" alt="{{nomHeure}}"/>&nbsp;
<span class="calendar-heure-texte">{{heure.label}}</span> <span class="calendar-heure-texte">{{heure.label}}</span>
</a> </a>
{{#if isGM}} {{#if isGM}}
<p class="calendar-time-disp calendar-time isGM">{{minute}} minutes</p> <p class="calendar-minute-texte">{{minute}} minutes</p>
{{/if}} {{/if}}
</div> </div>
{{#if isGM}} </div>
<div class="calendar-btn-container-right"> <div class="calendar-change-heure">
<i class="calendar-btn calendar-lyre fas fa-forward" data-calendar-set="6" title="Avancer à Lyre"> <div class="calendar-change-heure-grid">
<img class="img-calendar-forward" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd07.svg" alt="Avancer à Lyre"/> {{#if isGM}}
</i> <i class="calendar-btn calendar-lyre fas fa-forward" data-calendar-set="6" title="Avancer à Lyre">
<i class="calendar-btn calendar-vaisseau fas fa-forward" data-calendar-set="0" title="Avancer au Vaisseau"> <img src="systems/foundryvtt-reve-de-dragon/icons/heures/hd07.svg" alt="Avancer à Lyre"/>
<img class="img-calendar-forward" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd01.svg" alt="Avancer au Vaisseau"/> </i>
</i> <i class="calendar-btn calendar-vaisseau fas fa-forward" data-calendar-set="0" title="Avancer au Vaisseau">
<img src="systems/foundryvtt-reve-de-dragon/icons/heures/hd01.svg" alt="Avancer au Vaisseau"/>
</i>
{{/if}}
</div> </div>
{{/if}}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,11 +1,11 @@
<div class="flexcol"> <div class="flexcol calendar-timestamp-edit">
<div class="flexrow"> <div class="flexrow">
<label>{{label}}</label> <label>{{label}}</label>
<input {{#if disabled}}{{disabled}}{{/if}} <input {{#if disabled}}{{disabled}}{{/if}}
class="flex-shrink number-x2" class="flex-shrink number-x2"
type="number" data-dtype="Number" min="1" max="28" type="number" data-dtype="Number" min="1" max="28"
name="{{path}}.jourDuMois" value="{{jourDuMois}}" /> name="{{path}}.jourDuMois" value="{{jourDuMois}}" />
<select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.mois" class="flex-shrink" data-dtype="String"> <select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.mois" class="calendar-signe-heure" data-dtype="String">
{{#select mois.key}} {{#select mois.key}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
{{/select}} {{/select}}
@ -16,7 +16,7 @@
<div class="flexrow"> <div class="flexrow">
<label></label> <label></label>
<label>heure</label> <label>heure</label>
<select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.heure" class="flex-shrink" data-dtype="String"> <select {{#if disabled}}{{disabled}}{{/if}} name="{{path}}.heure" class="calendar-signe-heure" data-dtype="String">
{{#select heure.key}} {{#select heure.key}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
{{/select}} {{/select}}

View File

@ -1,34 +0,0 @@
<form class="dialog-repos">
<img class="chat-icon" src="{{img}}" title="{{name}}" alt="{{name}}" />
<div class="flexcol">
<div class="flexrow"><span>
<h2>{{name}} se repose</h2>
</span></div>
<div class="flexrow"><span>
<input type="radio" name="repos" id="chateau-dormant" value="chateau-dormant">
<label for="chateau-dormant">Château Dormant</label>
</span></div>
<div class="flexrow"><span><hr></span></div>
<div class="flexrow"><span>
<input class type="radio" name="repos" id="sieste" value="sieste">
<label for="sieste">Sieste de quelques heures</label>
</span></div>
<div class="flexrow"><span>
<input type="radio" name="repos" id="nuit" value="nuit" checked>
<label for="nuit">Dormir la nuit</label>
</span></div>
<div class="flexrow">
<label for="nb-heures">Nombre d'heures</label>
<input type="number" name="nb-heures" value="4" data-dtype="Number" />
</div>
<div class="flexrow"><span><hr></span></div>
<div class="flexrow"><span>
<input type="radio" name="repos" id="gris-reve" value="gris-reve">
<label for="gris-reve">Gris rêve</label>
</span></div>
<div class="flexrow">
<label for="nb-jours">Nombre de jours</label>
<input type="number" name="nb-jours" value="2" data-dtype="Number" />
</div>
</div>
</form>

View File

@ -0,0 +1,48 @@
<form class="chateau-dormant">
<div class="flexcol">
<div class="form-group">
<label for="motifStress">Motif de stress</label>
<input type="text" name="motifStress" value="{{motifStress}}" data-dtype="String" />
</div>
<hr>
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<span class="flex-grow-3">Personnage</span>
<span class="flex-shrink">Insomnie</span>
<span class="flex-grow-1">Sommeil</span>
<span class="flex-shrink">Stress</span>
<span class="flex-grow-1">Moral</span>
<span class="flex-shrink">Ignorer</span>
</li>
{{#each actorsSettings as |actorSetting|}}
<li class="item flexrow list-item set-sommeil-actor" data-actor-id="{{actorSetting.actor.id}}">
<span class="flex-grow-3">
<label>
<img class="chat-icon" src="{{actorSetting.actor.img}}" title="{{actorSetting.actor.name}}" />
<span>{{actorSetting.actor.name}}</span>
</label>
</span>
<span class="flex-shrink">
<input type="checkbox" class="sommeil-insomnie" {{#if actorSetting.insomnie}}checked{{/if}}>
</span>
<span class="flex-grow-1">
<input type="number" class="number-x sommeil-heures" data-dtype="Number"
value="{{#if actorSetting.insomnie}}0{{else}}4{{/if}}"
min="0" max="{{#if actorSetting.insomnie}}0{{else}}12{{/if}}"
{{#if actorSetting.insomnie}}disabled{{/if}}/>
h
</span>
<span class="flex-shrink">
<input type="number" class="number-x2 sommeil-stress" value="0" data-dtype="Number" min="0" max="200"/>
</span>
<span class="flex-grow-1 flexrow sommeil-actor-moral">
{{> "systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs" actorSetting}}
</span>
<span class="flex-shrink">
<input type="checkbox" class="sommeil-ignorer">
</span>
</li>
{{/each}}
</ul>
</div>
</form>

View File

@ -0,0 +1,53 @@
<form class="dialog-repos">
<img class="chat-icon" src="{{img}}" title="{{name}}" alt="{{name}}" />
<div class="flexcol">
<div class="flexrow"><span>
<h2>{{name}} se repose</h2>
</span></div>
{{#if system.sommeil.insomnie}}
<div class="flexrow"><span>
Insomnie, impossible de dormir
</span></div>
{{else}}
<div class="flexrow"><span>
<input class type="radio" name="repos" id="sieste" value="sieste">
<label for="sieste">Sieste de
<input type="number" name="sieste.heures" value="1" data-dtype="Number" />
heures</label>
</span></div>
<div class="flexrow"><span><hr></span></div>
{{#if system.sommeil.nouveaujour}}
<div class="flexrow"><span>
<input type="radio" name="repos" id="chateau-dormant" value="chateau-dormant">
<label for="chateau-dormant">Juste château Dormant</label>
</span></div>
<div class="flexrow"><span>
<input type="radio" name="repos" id="nuit" value="nuit" checked>
<label for="nuit">Dormir
<input type="number" name="sommeil.heures" value="{{system.sommeil.heures}}" data-dtype="Number" />
heures cette nuit
</label>
</span></div>
<div class="flexrow">
<label for="moral">Moral</label>
<div class="sommeil-actor-moral">
{{> "systems/foundryvtt-reve-de-dragon/templates/sommeil/sommeil-actor-moral.hbs" system.sommeil}}
</div>
</div>
{{else}}
<div class="flexrow"><span>
Le gardien des rêves doit faire passer Chateau Dormant
</span></div>
{{/if}}
{{/if}}
<div class="flexrow"><span><hr></span></div>
<div class="flexrow"><span>
<input type="radio" name="repos" id="gris-reve" value="gris-reve">
<label for="gris-reve">Gris rêve</label>
</span></div>
<div class="flexrow">
<label for="nb-jours">Nombre de jours</label>
<input type="number" name="nb-jours" value="2" data-dtype="Number" />
</div>
</div>
</form>

View File

@ -0,0 +1,11 @@
<span>
<a data-moral="malheureux">
<i class="{{#if (eq moral 'malheureux')}}fa-solid{{else}}fa-regular{{/if}} fa-face-sad-tear"></i>
</a>
<a data-moral="neutre">
<i class="{{#if (eq moral 'neutre')}}fa-solid{{else}}fa-regular{{/if}} fa-face-meh"></i>
</a>
<a data-moral="heureux">
<i class="{{#if (eq moral 'heureux')}}fa-solid{{else}}fa-regular{{/if}} fa-face-smile"></i>
</a>
</span>