Compare commits

...

1 Commits

Author SHA1 Message Date
uberwald c17aea7371 LIen vers le guide depuis le message de bienvenu
Release Creation / build (release) Successful in 1m19s
2026-05-01 22:47:01 +02:00
+41 -3
View File
@@ -110,7 +110,44 @@ Hooks.once("init", async function () {
});
/* -------------------------------------------- */
function welcomeMessage() {
async function getGuideFoundryJournalLink() {
const isGuideFoundryJournal = name => {
const normalizedName = name?.toLowerCase() ?? "";
return normalizedName.includes("guide de jeu") && normalizedName.includes("foundry");
};
let journal = game.journal.find(j => isGuideFoundryJournal(j.name));
if (!journal) {
for (const pack of game.packs) {
if (pack.documentName !== "JournalEntry") continue;
const entry = pack.index.find(e => isGuideFoundryJournal(e.name));
if (!entry) continue;
journal = await pack.getDocument(entry._id ?? entry.id);
if (journal) break;
}
}
if (!journal) return "";
return foundry.applications.ux.TextEditor.implementation.enrichHTML(
`@UUID[${journal.uuid}]{${journal.name}}`,
{ async: true }
);
}
/* -------------------------------------------- */
async function welcomeMessage() {
const guideFoundryLink = await getGuideFoundryJournalLink();
const guideFoundrySection = guideFoundryLink
? `
<div class="welcome-section">
<i class="fas fa-book"></i>
<p>Consultez aussi le ${guideFoundryLink}.</p>
</div>
`
: "";
ChatMessage.create({
user: game.user.id,
whisper: [game.user.id],
@@ -142,6 +179,7 @@ function welcomeMessage() {
<p>Système développé par <strong>LeRatierBretonnien</strong></p>
<p>Support sur le <a href="https://discord.gg/pPSDNJk" target="_blank"><i class="fab fa-discord"></i> Discord FR de Foundry</a></p>
</div>
${guideFoundrySection}
</div>
</div>
`
@@ -163,7 +201,7 @@ async function importDefaultScene() {
/* -------------------------------------------- */
/* Foundry VTT Initialization */
/* -------------------------------------------- */
Hooks.once("ready", function () {
Hooks.once("ready", async function () {
HeritiersUtility.ready()
@@ -182,7 +220,7 @@ Hooks.once("ready", function () {
}).catch(err =>
console.log("No stats available, giving up.")
)
welcomeMessage();
await welcomeMessage();
importDefaultScene();
});