This commit is contained in:
@@ -16,3 +16,4 @@ export { CDETinjiApp } from "./tinji-app.js"
|
||||
export { updateLoksyuFromRoll, updateTinjiFromRoll } from "./singletons.js"
|
||||
export { CDEWheelApp } from "./wheel-app.js"
|
||||
export { CDEMigrationApp } from "./migration-app.js"
|
||||
export { showWelcomeMessage, injectWelcomeActions } from "./welcome.js"
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Chroniques de l'Étrange — Système FoundryVTT
|
||||
*
|
||||
* Chroniques de l'Étrange est un jeu de rôle édité par Antre-Monde Éditions.
|
||||
* Ce système FoundryVTT est une implémentation indépendante et n'est pas
|
||||
* affilié à Antre-Monde Éditions,
|
||||
* mais a été réalisé avec l'autorisation d'Antre-Monde Éditions.
|
||||
*
|
||||
* @author LeRatierBretonnien
|
||||
* @copyright 2024–2026 LeRatierBretonnien
|
||||
* @license CC BY-NC-SA 4.0 – https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
*/
|
||||
|
||||
import { SYSTEM_ID } from "../../config/constants.js"
|
||||
|
||||
const HELP_JOURNAL_UUID = `Compendium.${SYSTEM_ID}.cde-help.JournalEntry.CDEGuideMain0001`
|
||||
|
||||
/** Post a styled welcome chat message. Called once per session by the GM. */
|
||||
export async function showWelcomeMessage() {
|
||||
const logo = `systems/${SYSTEM_ID}/images/logo_jeu.webp`
|
||||
const content = `
|
||||
<div class="cde-welcome-message">
|
||||
<img class="cde-welcome-logo" src="${logo}" alt="Les Chroniques de l'Étrange" />
|
||||
<h2 class="cde-welcome-title">Les Chroniques de l'Étrange</h2>
|
||||
<p class="cde-welcome-links">
|
||||
Un jeu de rôle édité par
|
||||
<a href="https://antre-monde.com/les-chroniques-de-letrengae/" target="_blank" rel="noopener">Antre-Monde Éditions</a>
|
||||
</p>
|
||||
<p class="cde-welcome-links">
|
||||
Système FoundryVTT réalisé par
|
||||
<a href="https://www.uberwald.me" target="_blank" rel="noopener">LeRatierBretonnien</a>
|
||||
</p>
|
||||
<button type="button" class="cde-welcome-help-btn" data-action="open-cde-help">
|
||||
<i class="fas fa-book-open"></i>
|
||||
${game.i18n.localize("CDE.WelcomeOpenHelp")}
|
||||
</button>
|
||||
</div>`
|
||||
|
||||
await ChatMessage.create({
|
||||
content,
|
||||
speaker: { alias: "Les Chroniques de l'Étrange" },
|
||||
flags: { [SYSTEM_ID]: { welcome: true } },
|
||||
})
|
||||
}
|
||||
|
||||
/** Attach the help-open click handler to a welcome chat message HTML node. */
|
||||
export function injectWelcomeActions(_message, html) {
|
||||
const el = html instanceof HTMLElement ? html : (html[0] ?? html)
|
||||
const btn = el?.querySelector?.("[data-action='open-cde-help']")
|
||||
if (!btn) return
|
||||
|
||||
btn.addEventListener("click", async () => {
|
||||
try {
|
||||
const doc = await fromUuid(HELP_JOURNAL_UUID)
|
||||
doc?.sheet?.render(true)
|
||||
} catch {
|
||||
// Pack not yet loaded — open the compendium browser as fallback
|
||||
game.packs.get(`${SYSTEM_ID}.cde-help`)?.render(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user