diff --git a/module/actor.js b/module/actor.js
index ef23d288..b5038459 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -365,6 +365,7 @@ export class RdDActor extends RdDBaseActorSang {
whisper: ChatUtility.getOwners(this),
content: ""
}
+ const stressAvant = this.system.compteurs.stress.value
await this._recuperationSante(message)
await this._recupereMoralChateauDormant(message)
@@ -381,6 +382,35 @@ export class RdDActor extends RdDBaseActorSang {
await ChatMessage.create(message)
}
await this.resetInfoSommeil()
+
+ const stressApres = this.system.compteurs.stress.value
+ const date = game.system.rdd.calendrier.dateCourante()
+ const recapMJ = `**${this.name}** — Château Dormant (${date})
Stress : ${stressAvant} → ${stressApres}`
+ await ChatUtility.tellToGM(message.content ? recapMJ + '
' + message.content : recapMJ)
+
+ const journalId = game.settings.get(SYSTEM_RDD, 'cd-suivi-journal')
+ if (journalId) {
+ const journalEntry = game.journal.get(journalId)
+ if (journalEntry?.canUserModify(game.user, 'update')) {
+ const timestamp = game.system.rdd.calendrier.getTimestamp()
+ const jour = timestamp.jour + 1
+ const mois = RdDTimestamp.definition(timestamp.mois).label
+ const annee = timestamp.annee
+ const section = `${jour} ${mois} ${annee}`
+ const log = `
${this.name} — Stress ${stressAvant} → ${stressApres}
` + message.content + let page = journalEntry.pages.find(p => p.type == 'text' && Grammar.equalsInsensitive(p.name, section)) + if (page) { + await page.update({ 'text.content': page.text.content + '\n' + log }) + } else { + await journalEntry.createEmbeddedDocuments('JournalEntryPage', [new JournalEntryPage({ + name: section, + type: 'text', + title: { show: true, level: 1 }, + text: { content: log, format: 1 } + })]) + } + } + } } async resetInfoSommeil() { diff --git a/module/rdd-main.js b/module/rdd-main.js index 44bcfa91..c9bd5fad 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -390,6 +390,16 @@ export class SystemReveDeDragon { type: Number, default: 0 }) + + /* -------------------------------------------- */ + game.settings.register(SYSTEM_RDD, "cd-suivi-journal", { + name: "Journal de suivi Château Dormant", + hint: "ID du journal où enregistrer le récapitulatif quotidien des personnages (stress, moral, événements). Laissez vide pour désactiver.", + scope: "world", + config: true, + type: String, + default: "" + }) } async onReady() {