37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
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,
|
||
});
|
||
});
|