Files
mgt2-compendium-amiral-denisov/scripts/startupNotice.js
T
uberwald c3cf8f176d
Release Creation / build (release) Successful in 50s
REady for v14, with included tools
2026-05-24 17:31:12 +02:00

37 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const MODULE_ID = 'mgt2-compendium-amiral-denisov';
const STARTUP_NOTICE_FLAG = `${MODULE_ID}.startupNoticePosted`;
function isNoticeOwner() {
if (!game.user?.isGM) return false;
const activeGM = game.users?.activeGM;
return !activeGM || activeGM.id === game.user.id;
}
function buildStartupNoticeHtml() {
return `
<div style="padding:6px 8px;border-left:4px solid #c9a227;background:#f5f0e8;color:#2c2c3e;line-height:1.45;">
<strong>MgT2e outils</strong>
<span style="color:#6a5422;">·</span>
<code>/commerce</code> <code>/pnj</code> <code>/rencontre</code> <code>/mission</code>
<div style="margin-top:2px;font-size:0.92em;color:#6a5422;">
par <a href="https://www.uberwald.me" target="_blank" rel="noopener noreferrer">LeRatierBretonnien / Uberwald</a>
</div>
</div>
`;
}
Hooks.once('ready', async () => {
if (!isNoticeOwner()) return;
if (globalThis[STARTUP_NOTICE_FLAG]) return;
globalThis[STARTUP_NOTICE_FLAG] = true;
await ChatMessage.create({
speaker: {
alias: 'MgT2e - Compendium Amiral Denisov',
},
content: buildStartupNoticeHtml(),
style: CONST.CHAT_MESSAGE_STYLES.OTHER,
});
});