Ajout de notes chronologiques
This commit is contained in:
parent
42e4f5b391
commit
ecd1652403
124
module/dialog-chronologie.js
Normal file
124
module/dialog-chronologie.js
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import { SYSTEM_RDD } from "./constants.js";
|
||||||
|
import { Grammar } from "./grammar.js";
|
||||||
|
|
||||||
|
|
||||||
|
const LATEST_USED_JOURNAL_ID = "chronologie-dernier-journal";
|
||||||
|
|
||||||
|
export class DialogChronologie extends Dialog {
|
||||||
|
|
||||||
|
static onInit() {
|
||||||
|
game.settings.register(SYSTEM_RDD, LATEST_USED_JOURNAL_ID, {
|
||||||
|
name: "Dernier article de journal utilisé pour enregistrer la chronologie",
|
||||||
|
scope: "client",
|
||||||
|
config: false,
|
||||||
|
default: "",
|
||||||
|
type: String
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static async create() {
|
||||||
|
const dialogData = {
|
||||||
|
auteur: game.user.name,
|
||||||
|
isGM: game.user.isGM,
|
||||||
|
information: "",
|
||||||
|
journalId: game.settings.get(SYSTEM_RDD, LATEST_USED_JOURNAL_ID),
|
||||||
|
journaux: game.journal.filter(it => it.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)),
|
||||||
|
dateRdD: game.system.rdd.calendrier.getCalendrier(),
|
||||||
|
heureRdD: game.system.rdd.calendrier.getCurrentHeure(),
|
||||||
|
dateReel: DialogChronologie.getCurrentDateTime()
|
||||||
|
};
|
||||||
|
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-chronologie.html", dialogData);
|
||||||
|
new DialogChronologie(html).render(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(html) {
|
||||||
|
const options = {
|
||||||
|
classes: ["DialogChronologie"],
|
||||||
|
width: 500,
|
||||||
|
height: 350,
|
||||||
|
'z-index': 99999
|
||||||
|
};
|
||||||
|
const conf = {
|
||||||
|
title: "Chronologie",
|
||||||
|
content: html,
|
||||||
|
buttons: {
|
||||||
|
ajout: { label: "Ajouter", callback: it => this.ajouter() },
|
||||||
|
},
|
||||||
|
default: "ajout"
|
||||||
|
};
|
||||||
|
super(conf, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getCurrentDateTime() {
|
||||||
|
return new Date().toLocaleString("sv-SE", {
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit"
|
||||||
|
}).replace(" ", "T");
|
||||||
|
}
|
||||||
|
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
async ajouter() {
|
||||||
|
await this.forceValidation();
|
||||||
|
const { journalId, journalEntry } = this.findJournal();
|
||||||
|
// ajouter à la page ou créer une page
|
||||||
|
this.addContentToJournal(journalEntry, await this.prepareChronologieEntry());
|
||||||
|
|
||||||
|
this.storeLatestUsedJournalEntry(journalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
async forceValidation() {
|
||||||
|
await $("form.rdddialogchrono :input").change();
|
||||||
|
}
|
||||||
|
|
||||||
|
findJournal() {
|
||||||
|
const journalId = $("form.rdddialogchrono :input[name='journalId']").val();
|
||||||
|
const journalEntry = game.journal.get(journalId);
|
||||||
|
return { journalId, journalEntry };
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepareChronologieEntry() {
|
||||||
|
return await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/chronologie-entry.html", this.extractJournalParameters());
|
||||||
|
}
|
||||||
|
|
||||||
|
extractJournalParameters() {
|
||||||
|
return {
|
||||||
|
auteur: $("form.rdddialogchrono :input[name='auteur']").val(),
|
||||||
|
information: $("form.rdddialogchrono :input[name='information']").val(),
|
||||||
|
dateRdD: {
|
||||||
|
jour: $("form.rdddialogchrono :input[name='dateRdD.jour']").val(),
|
||||||
|
moisRdD: $("form.rdddialogchrono :input[name='dateRdD.moisRdD.key']").val(),
|
||||||
|
annee: $("form.rdddialogchrono :input[name='dateRdD.annee']").val()
|
||||||
|
},
|
||||||
|
heureRdD: $("form.rdddialogchrono :input[name='heureRdD']").val(),
|
||||||
|
dateReel: $("form.rdddialogchrono :input[name='dateReel']").val().replace('T', ' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addContentToJournal(journalEntry, content) {
|
||||||
|
let page = journalEntry.pages.find(p => p.type == 'text' && Grammar.equalsInsensitive(p.name, 'Chronologie'));
|
||||||
|
if (page) {
|
||||||
|
page.update({ 'text.content': content + '\n' + page.text.content });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
journalEntry.createEmbeddedDocuments('JournalEntryPage', [this.newPageChronologie(content)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newPageChronologie(content) {
|
||||||
|
return new JournalEntryPage({
|
||||||
|
name: 'Chronologie',
|
||||||
|
type: 'text',
|
||||||
|
title: { show: true, level: 1 },
|
||||||
|
text: { content: content, format: 1 }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
storeLatestUsedJournalEntry(journalId) {
|
||||||
|
game.settings.set(SYSTEM_RDD, LATEST_USED_JOURNAL_ID, journalId);
|
||||||
|
}
|
||||||
|
}
|
@ -19,10 +19,14 @@ export class Grammar {
|
|||||||
return word.match(/^[aeiouy]/i)
|
return word.match(/^[aeiouy]/i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static equalsInsensitive(a, b) {
|
||||||
|
return Grammar.toLowerCaseNoAccent(a) == Grammar.toLowerCaseNoAccent(b)
|
||||||
|
}
|
||||||
|
|
||||||
static includesLowerCaseNoAccent(value, content) {
|
static includesLowerCaseNoAccent(value, content) {
|
||||||
return Grammar.toLowerCaseNoAccent(value).includes(Grammar.toLowerCaseNoAccent(content));
|
return Grammar.toLowerCaseNoAccent(value).includes(Grammar.toLowerCaseNoAccent(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static toLowerCaseNoAccent(words) {
|
static toLowerCaseNoAccent(words) {
|
||||||
return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words;
|
return words?.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") ?? words;
|
||||||
|
@ -8,23 +8,24 @@ import { Grammar } from "./grammar.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";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
||||||
const heuresList = ["vaisseau", "sirene", "faucon", "couronne", "dragon", "epees", "lyre", "serpent", "poissonacrobate", "araignee", "roseau", "chateaudormant"];
|
const heuresList = ["vaisseau", "sirene", "faucon", "couronne", "dragon", "epees", "lyre", "serpent", "poissonacrobate", "araignee", "roseau", "chateaudormant"];
|
||||||
const heuresDef = {
|
const heuresDef = {
|
||||||
"vaisseau": { label: "Vaisseau", lettreFont: 'v', saison: "printemps", heure: 0, icon: 'hd01.svg' },
|
"vaisseau": {key:"vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "printemps", heure: 0, icon: 'hd01.svg' },
|
||||||
"sirene": { label: "Sirène", lettreFont: 'i', saison: "printemps", heure: 1, icon: 'hd02.svg' },
|
"sirene": { key: "sirene", label: "Sirène", lettreFont: 'i', saison: "printemps", heure: 1, icon: 'hd02.svg' },
|
||||||
"faucon": { label: "Faucon", lettreFont: 'f', saison: "printemps", heure: 2, icon: 'hd03.svg' },
|
"faucon": { key: "faucon", label: "Faucon", lettreFont: 'f', saison: "printemps", heure: 2, icon: 'hd03.svg' },
|
||||||
"couronne": { label: "Couronne", lettreFont: '', saison: "ete", heure: 3, icon: 'hd04.svg' },
|
"couronne": { key: "couronne", label: "Couronne", lettreFont: '', saison: "ete", heure: 3, icon: 'hd04.svg' },
|
||||||
"dragon": { label: "Dragon", lettreFont: 'd', saison: "ete", heure: 4, icon: 'hd05.svg' },
|
"dragon": { key: "dragon", label: "Dragon", lettreFont: 'd', saison: "ete", heure: 4, icon: 'hd05.svg' },
|
||||||
"epees": { label: "Epées", lettreFont: 'e', saison: "ete", heure: 5, icon: 'hd06.svg' },
|
"epees": { key: "epees", label: "Epées", lettreFont: 'e', saison: "ete", heure: 5, icon: 'hd06.svg' },
|
||||||
"lyre": { label: "Lyre", lettreFont: 'l', saison: "automne", heure: 6, icon: 'hd07.svg' },
|
"lyre": { key: "lyre", label: "Lyre", lettreFont: 'l', saison: "automne", heure: 6, icon: 'hd07.svg' },
|
||||||
"serpent": { label: "Serpent", lettreFont: 's', saison: "automne", heure: 7, icon: 'hd08.svg' },
|
"serpent": { key: "serpent", label: "Serpent", lettreFont: 's', saison: "automne", heure: 7, icon: 'hd08.svg' },
|
||||||
"poissonacrobate": { label: "Poisson Acrobate", lettreFont: 'p', saison: "automne", heure: 8, icon: 'hd09.svg' },
|
"poissonacrobate": { key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "automne", heure: 8, icon: 'hd09.svg' },
|
||||||
"araignee": { label: "Araignée", lettreFont: 'a', saison: "hiver", heure: 9, icon: 'hd10.svg' },
|
"araignee": { key: "araignee", label: "Araignée", lettreFont: 'a', saison: "hiver", heure: 9, icon: 'hd10.svg' },
|
||||||
"roseau": { label: "Roseau", lettreFont: 'r', saison: "hiver", heure: 10, icon: 'hd11.svg' },
|
"roseau": { key: "roseau", label: "Roseau", lettreFont: 'r', saison: "hiver", heure: 10, icon: 'hd11.svg' },
|
||||||
"chateaudormant": { label: "Château Dormant", lettreFont: 'c', saison: "hiver", heure: 11, icon: 'hd12.svg' }
|
"chateaudormant": { key: "chateaudormant", label: "Château Dormant", lettreFont: 'c', saison: "hiver", heure: 11, icon: 'hd12.svg' }
|
||||||
};
|
};
|
||||||
const saisonsDef = {
|
const saisonsDef = {
|
||||||
"printemps": { label: "Printemps" },
|
"printemps": { label: "Printemps" },
|
||||||
@ -51,21 +52,50 @@ export class RdDCalendrier extends Application {
|
|||||||
return Object.values(heuresDef).find(h => h.heure == chiffre);
|
return Object.values(heuresDef).find(h => h.heure == chiffre);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getSigneAs(key, value) {
|
||||||
|
const heure = (typeof value == 'string' || typeof value == 'number') && Number.isInteger(Number(value))
|
||||||
|
? Number(value)
|
||||||
|
: (typeof value == 'string') ? RdDCalendrier.getChiffreFromSigne(value)
|
||||||
|
: undefined
|
||||||
|
|
||||||
|
if (heure != undefined && ['key', 'label', 'lettreFont', 'saison', 'heure', 'icon'].includes(key)) {
|
||||||
|
return RdDCalendrier.getDefSigne(heure)[key]
|
||||||
|
}
|
||||||
|
if (heure != undefined && ['webp'].includes(key)) {
|
||||||
|
return RdDCalendrier.getDefSigne(heure)['icon'].replace('svg', 'webp');
|
||||||
|
}
|
||||||
|
console.error(`Appel à getSigneAs('${key}', ${value}) avec une clé/heure incorrects`);
|
||||||
|
return value;
|
||||||
|
|
||||||
|
}
|
||||||
static getChiffreFromSigne(signe) {
|
static getChiffreFromSigne(signe) {
|
||||||
return heuresList.indexOf(signe);
|
return heuresList.indexOf(signe);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getCalendrier(index) {
|
static createCalendrierInitial() {
|
||||||
let calendrier = {
|
return {
|
||||||
|
heureRdD: 0,
|
||||||
|
minutesRelative: 0,
|
||||||
|
indexJour: 0,
|
||||||
|
annee: 0,
|
||||||
|
moisRdD: 0,
|
||||||
|
moisLabel: heuresDef["vaisseau"].label,
|
||||||
|
jour: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getCalendrier(index) {
|
||||||
|
index = index ?? this.getCurrentDayIndex();
|
||||||
|
const moisRdD = Math.floor(index / RDD_JOUR_PAR_MOIS) % RDD_MOIS_PAR_AN;
|
||||||
|
return {
|
||||||
heureRdD: 0, // Index dans heuresList / heuresDef[x].heure
|
heureRdD: 0, // Index dans heuresList / heuresDef[x].heure
|
||||||
minutesRelative: 0,
|
minutesRelative: 0,
|
||||||
indexJour: index,
|
indexJour: index,
|
||||||
annee: Math.floor(index / (RDD_JOUR_PAR_MOIS * RDD_MOIS_PAR_AN)),
|
annee: Math.floor(index / (RDD_JOUR_PAR_MOIS * RDD_MOIS_PAR_AN)),
|
||||||
moisRdD: Math.floor(index / RDD_JOUR_PAR_MOIS) % RDD_MOIS_PAR_AN,
|
moisRdD: RdDCalendrier.getDefSigne(moisRdD),
|
||||||
|
moisLabel: RdDCalendrier.getDefSigne(moisRdD).label,
|
||||||
jour: (index % RDD_JOUR_PAR_MOIS) // Le calendrier stocke le jour en 0-27, mais en 1-28 à l'affichage
|
jour: (index % RDD_JOUR_PAR_MOIS) // Le calendrier stocke le jour en 0-27, mais en 1-28 à l'affichage
|
||||||
}
|
}
|
||||||
calendrier.moisLabel = RdDCalendrier.getDefSigne(calendrier.moisRdD).label;
|
|
||||||
return calendrier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -78,7 +108,7 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calendrier
|
// Calendrier
|
||||||
this.calendrier = duplicate(game.settings.get(SYSTEM_RDD, "calendrier") ?? RdDCalendrier.getCalendrier(0));
|
this.calendrier = duplicate(game.settings.get(SYSTEM_RDD, "calendrier") ?? RdDCalendrier.createCalendrierInitial());
|
||||||
this.calendrier.annee = this.calendrier.annee ?? Math.floor((this.calendrier.moisRdD ?? 0) / RDD_MOIS_PAR_AN);
|
this.calendrier.annee = this.calendrier.annee ?? Math.floor((this.calendrier.moisRdD ?? 0) / RDD_MOIS_PAR_AN);
|
||||||
this.calendrier.moisRdD = (this.calendrier.moisRdD ?? 0) % RDD_MOIS_PAR_AN;
|
this.calendrier.moisRdD = (this.calendrier.moisRdD ?? 0) % RDD_MOIS_PAR_AN;
|
||||||
|
|
||||||
@ -107,13 +137,13 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getDateFromIndex(index) {
|
getDateFromIndex(index) {
|
||||||
const date = RdDCalendrier.getCalendrier(index ?? this.getCurrentDayIndex());
|
const dateRdD = this.getCalendrier(index);
|
||||||
return (date.jour + 1) + ' ' + RdDCalendrier.getDefSigne(date.moisRdD).label;
|
return (dateRdD.jour + 1) + ' ' + RdDCalendrier.getDefSigne(dateRdD.moisRdD).label;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getNumericDateFromIndex(index = undefined) {
|
getDayMonthFromIndex(index = undefined) {
|
||||||
const dateRdD = RdDCalendrier.getCalendrier(index ?? this.getCurrentDayIndex());
|
const dateRdD = this.getCalendrier(index);
|
||||||
return {
|
return {
|
||||||
day: dateRdD.jour + 1,
|
day: dateRdD.jour + 1,
|
||||||
month: heuresList[dateRdD.moisRdD]
|
month: heuresList[dateRdD.moisRdD]
|
||||||
@ -264,7 +294,7 @@ export class RdDCalendrier extends Application {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async incrementerJour() {
|
async incrementerJour() {
|
||||||
const index = this.getCurrentDayIndex() + 1;
|
const index = this.getCurrentDayIndex() + 1;
|
||||||
this.calendrier = RdDCalendrier.getCalendrier(index);
|
this.calendrier = this.getCalendrier(index);
|
||||||
await this.rebuildListeNombreAstral();
|
await this.rebuildListeNombreAstral();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,6 +566,8 @@ export class RdDCalendrier extends Application {
|
|||||||
|
|
||||||
this.updateDisplay();
|
this.updateDisplay();
|
||||||
|
|
||||||
|
html.find('.ajout-chronologie').click(ev => DialogChronologie.create());
|
||||||
|
|
||||||
html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
html.find('.calendar-btn').click(ev => this.onCalendarButton(ev));
|
||||||
|
|
||||||
html.find('.calendar-btn-edit').click(ev => {
|
html.find('.calendar-btn-edit').click(ev => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
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 { DialogStress } from "./dialog-stress.js";
|
||||||
import { Grammar } from "./grammar.js";
|
import { Grammar } from "./grammar.js";
|
||||||
@ -114,6 +115,11 @@ export class RdDCommands {
|
|||||||
<br><strong>/stress 6 Glou Paulo</strong> : Distribue 6 points de Stress au personnage Paulon ou au personnage joueur Paulo, à cause d'un Glou`
|
<br><strong>/stress 6 Glou Paulo</strong> : Distribue 6 points de Stress au personnage Paulon ou au personnage joueur Paulo, à cause d'un Glou`
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rddCommands.registerCommand({
|
||||||
|
path: ["/chrono"], func: (content, msg, params) => DialogChronologie.create(),
|
||||||
|
descr: `Enregistre une entrée de chronologie dans un article de journal`
|
||||||
|
});
|
||||||
|
|
||||||
game.system.rdd.commands = rddCommands;
|
game.system.rdd.commands = rddCommands;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,5 +410,6 @@ export class RdDCommands {
|
|||||||
async getMeteo(msg, params) {
|
async getMeteo(msg, params) {
|
||||||
return await RdDMeteo.getMeteo();
|
return await RdDMeteo.getMeteo();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ export class RdDHerbes extends Item {
|
|||||||
formData.herbesRepos = RdDHerbes.buildHerbesList(this.herbesRepos, 7);
|
formData.herbesRepos = RdDHerbes.buildHerbesList(this.herbesRepos, 7);
|
||||||
formData.jourMoisOptions = RdDCalendrier.buildJoursMois();
|
formData.jourMoisOptions = RdDCalendrier.buildJoursMois();
|
||||||
formData.dateActuelle = game.system.rdd.calendrier.getDateFromIndex();
|
formData.dateActuelle = game.system.rdd.calendrier.getDateFromIndex();
|
||||||
formData.splitDate = game.system.rdd.calendrier.getNumericDateFromIndex(formData.system.prdate);
|
formData.splitDate = game.system.rdd.calendrier.getDayMonthFromIndex(formData.system.prdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -36,6 +36,7 @@ import { RdDPossession } from "./rdd-possession.js";
|
|||||||
import { RdDSigneDraconiqueItemSheet } from "./item-signedraconique-sheet.js";
|
import { RdDSigneDraconiqueItemSheet } from "./item-signedraconique-sheet.js";
|
||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
import { Migrations } from './migrations.js';
|
import { Migrations } from './migrations.js';
|
||||||
|
import { DialogChronologie } from "./dialog-chronologie.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Foundry VTT Initialization */
|
/* Foundry VTT Initialization */
|
||||||
@ -77,7 +78,7 @@ Hooks.once("init", async function () {
|
|||||||
name: "calendrier",
|
name: "calendrier",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
config: false,
|
config: false,
|
||||||
default: RdDCalendrier.getCalendrier(0),
|
default: RdDCalendrier.createCalendrierInitial(),
|
||||||
type: Object
|
type: Object
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -107,6 +108,8 @@ Hooks.once("init", async function () {
|
|||||||
default: RdDCalendrier.createCalendrierPos(),
|
default: RdDCalendrier.createCalendrierPos(),
|
||||||
type: Object
|
type: Object
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", {
|
game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", {
|
||||||
name: "Supprimer les dialogues de combat",
|
name: "Supprimer les dialogues de combat",
|
||||||
@ -140,6 +143,8 @@ Hooks.once("init", async function () {
|
|||||||
default: "aucun"
|
default: "aucun"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DialogChronologie.onInit();
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
// Set an initiative formula for the system
|
// Set an initiative formula for the system
|
||||||
CONFIG.Combat.initiative = {
|
CONFIG.Combat.initiative = {
|
||||||
|
@ -14,6 +14,7 @@ import { RdDPossession } from "./rdd-possession.js";
|
|||||||
import { RdDNameGen } from "./rdd-namegen.js";
|
import { RdDNameGen } from "./rdd-namegen.js";
|
||||||
import { RdDConfirm } from "./rdd-confirm.js";
|
import { RdDConfirm } from "./rdd-confirm.js";
|
||||||
import { RdDActor } from "./actor.js";
|
import { RdDActor } from "./actor.js";
|
||||||
|
import { RdDCalendrier } from "./rdd-calendrier.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
// This table starts at 0 -> niveau -10
|
// This table starts at 0 -> niveau -10
|
||||||
@ -279,6 +280,7 @@ export class RdDUtility {
|
|||||||
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
||||||
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
||||||
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
|
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
|
||||||
|
Handlebars.registerHelper('signeHeure', (key, heure) => RdDCalendrier.getSigneAs(key, heure));
|
||||||
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
|
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
|
||||||
Handlebars.registerHelper('regle-optionnelle', (option) => ReglesOptionelles.isUsing(option));
|
Handlebars.registerHelper('regle-optionnelle', (option) => ReglesOptionelles.isUsing(option));
|
||||||
Handlebars.registerHelper('trier', list => list.sort((a, b) => a.name.localeCompare(b.name)));
|
Handlebars.registerHelper('trier', list => list.sort((a, b) => a.name.localeCompare(b.name)));
|
||||||
|
@ -636,6 +636,18 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
|||||||
margin-bottom: 0.2rem;
|
margin-bottom: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.rdddialogchrono input[type=datetime-local] {
|
||||||
|
min-width: 20px;
|
||||||
|
padding: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.05);
|
||||||
|
border: 1px solid var(--color-border-dark);
|
||||||
|
width: calc(100% - 2px);
|
||||||
|
height: var(--form-field-height);
|
||||||
|
margin: 0;
|
||||||
|
color: var(--color-text-dark-primary);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.window-app .window-content, .window-app.sheet .window-content .sheet-body{
|
.window-app .window-content, .window-app.sheet .window-content .sheet-body{
|
||||||
background: rgb(245,245,240) url(img/bg_left.webp) no-repeat left top;
|
background: rgb(245,245,240) url(img/bg_left.webp) no-repeat left top;
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,16 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="calendar-weekday-time">
|
<div class="calendar-weekday-time">
|
||||||
<p class="calendar-weekday"><img class="calendar-heure-img" src="{{iconHeure}}" alt="{{nomHeure}}"/> <span class="calendar-heure-texte">{{nomHeure}}</span></p>
|
{{#if isGM}}
|
||||||
<span class="calendar-time isGM"><p class="calendar-time-disp">{{minutesRelative}} minutes</p></span>
|
<a class="ajout-chronologie calendar-weekday">
|
||||||
|
<img class="calendar-heure-img" src="{{iconHeure}}" alt="{{nomHeure}}"/> <span class="calendar-heure-texte">{{nomHeure}}</span>
|
||||||
|
</a>
|
||||||
|
<p class="calendar-time-disp calendar-time isGM">{{minutesRelative}} minutes</p>
|
||||||
|
{{else}}
|
||||||
|
<a class="ajout-chronologie">
|
||||||
|
<img class="calendar-heure-img" src="{{iconHeure}}" alt="{{nomHeure}}"/> <span class="calendar-heure-texte">{{nomHeure}}</span>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{#if isGM}}
|
{{#if isGM}}
|
||||||
<div class="calendar-btn-container-right">
|
<div class="calendar-btn-container-right">
|
||||||
|
4
templates/chronologie-entry.html
Normal file
4
templates/chronologie-entry.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<h2>{{dateRdD.jour}} {{signeHeure 'label' dateRdD.moisRdD}}, an {{dateRdD.annee}} à l'heure de {{signeHeure 'label' heureRdD}}</h2>
|
||||||
|
<p>{{information}}</p>
|
||||||
|
<p class="poesie-reference">Par {{auteur}} ({{dateReel}})</p>
|
||||||
|
<hr>
|
55
templates/dialog-chronologie.html
Normal file
55
templates/dialog-chronologie.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<form class="rdddialogchrono">
|
||||||
|
<div class="flexcol">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="auteur">Auteur</label>
|
||||||
|
<input type="text" name="auteur" value="{{auteur}}" data-dtype="String" {{#unless isGM}}disabled{{/unless}}/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="information">Information</label>
|
||||||
|
<textarea autocomplete="off" title="Information" name="information">{{information}}</textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="heureRdD">Heure</label>
|
||||||
|
<select type="text" name="heureRdD" value="{{heureRdD}}" data-dtype="String" />
|
||||||
|
{{#select heureRdD}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="dateRdD.jour">Date en jeu</label>
|
||||||
|
<span class="flexrow">
|
||||||
|
<input type="text" name="dateRdD.jour" value="{{dateRdD.jour}}" data-dtype="Number" min="1" max="28"/>
|
||||||
|
<select type="text" name="dateRdD.moisRdD.key" value="{{dateRdD.moisRdD.key}}" data-dtype="String" >
|
||||||
|
{{#select dateRdD.moisRdD.key}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
<input type="text" name="dateRdD.annee" value="{{dateRdD.annee}}" data-dtype="Number" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="dateReel">Date réelle</label>
|
||||||
|
<input type="datetime-local" name="dateReel" value="{{dateReel}}" data-dtype="String" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="journalId">Journal</label>
|
||||||
|
<select type="text" name="journalId" value="{{journalId}}" data-dtype="String">
|
||||||
|
{{#select journalId}}
|
||||||
|
<option value=""></option>
|
||||||
|
{{#each (trier journaux) as |journal key|}}
|
||||||
|
<option value="{{journal.id}}">
|
||||||
|
{{#if journal.folder}}
|
||||||
|
{{#if journal.folder.ancestors}}
|
||||||
|
{{#each journal.folder.ancestors as |parent key|}}{{parent.name}} / {{/each}}
|
||||||
|
{{/if}}
|
||||||
|
{{journal.folder.name}} /
|
||||||
|
{{/if}}
|
||||||
|
{{journal.name}}
|
||||||
|
</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
Loading…
Reference in New Issue
Block a user