diff --git a/scripts/system/hooks.js b/scripts/system/hooks.js index c07d310..f77db54 100644 --- a/scripts/system/hooks.js +++ b/scripts/system/hooks.js @@ -299,11 +299,11 @@ export class LitmHooks { const tokenImg = actor.prototypeToken?.texture?.src; const prototypeToken = isCharacter ? { - sight: { enabled: true }, - actorLink: true, - disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY, - texture: { src: tokenImg || img }, - } + sight: { enabled: true }, + actorLink: true, + disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY, + texture: { src: tokenImg || img }, + } : null; actor.updateSource({ prototypeToken, img }); }); @@ -376,49 +376,47 @@ export class LitmHooks {
  • -
  • `).on("click", "[data-click]", (event) => { - const { click } = event.currentTarget.dataset; - switch (click) { - case "toggle-rendered": - if (!app.rendered) app.render(true); - else app.close(); - break; - case "render-character": - if (!game.user.character) - return ui.notifications.warn(t("Litm.ui.warn-no-character")); - if (!game.user.character.sheet.rendered) - game.user.character.sheet.render(true); - else game.user.character.sheet.close(); - break; - case "render-roll": - if (!game.user.character) - return ui.notifications.warn(t("Litm.ui.warn-no-character")); - game.user.character.sheet.renderRollDialog({ toggle: true }); - break; - } - }); + const { click } = event.currentTarget.dataset; + switch (click) { + case "toggle-rendered": + if (!app.rendered) app.render(true); + else app.close(); + break; + case "render-character": + if (!game.user.character) + return ui.notifications.warn(t("Litm.ui.warn-no-character")); + if (!game.user.character.sheet.rendered) + game.user.character.sheet.render(true); + else game.user.character.sheet.close(); + break; + case "render-roll": + if (!game.user.character) + return ui.notifications.warn(t("Litm.ui.warn-no-character")); + game.user.character.sheet.renderRollDialog({ toggle: true }); + break; + } + }); html.before(buttonSection); }); @@ -523,12 +521,10 @@ export class LitmHooks { static #rendeWelcomeScreen() { Hooks.once("ready", async () => { - let scene = game.scenes.getName("Legend in the Mist"); - if (scene) return; - - ui.sidebar.activateTab("actors"); + if (game.settings.get("litm", "welcomed")) return; + if (!game.user.isGM) return; - scene = await Scene.create({ + const scene = await Scene.create({ name: "Legend in the Mist", permission: { default: 2 }, navigation: true, @@ -557,8 +553,10 @@ export class LitmHooks { const entry = await JournalEntry.create({ name: "Legend in the Mist", permission: { default: 2 }, - content: /*html */ ` -

    Welcome!

    + pages: [{ + name: "Welcome!", + text: { + content: /* html */ `

    I am thrilled to have you try out this system

    @@ -626,7 +624,7 @@ export class LitmHooks {

    Thanks to @Altervayne for creating the online character creator and setting up a Discord community for us.

  • -

    Thanks to @erizocosmico for our first Localisation effort (Spanish).

    +

    Thanks to @erizocosmico (Spanish), @imiri78 (German), and @0rac1e404 (Chinese) for our first localisation efforts.

  • Thanks to the City of Mist Discord for contributing feedback, bug reports and generally being awesome about me barging in the door like I did.

    @@ -638,6 +636,9 @@ export class LitmHooks {

    See you in the mist…

  • `, + } + } + ] }); // Create a "welcome" chat message @@ -645,13 +646,12 @@ export class LitmHooks { title: "Welcome to Legend in the Mist!", content: /* html */ `

    Welcome to Legend in the Mist

    -

    Before you start playing, you should want to read the Legend in the Mist journal entry. It contains some important information about the system, and what to expect.

    +

    Before you start playing, you should want to read the Legend in the Mist journal entry. It contains some important information about the system, and what to expect.

    Once you've read the journal entry, you can click the button below to import all the rules and content required to play the Tinderbox Demo.

    + "Litm.ui.import-adventure", + )}

    Good luck, and have fun!

    `, }); @@ -664,6 +664,9 @@ export class LitmHooks { width: 600, height: 600, }); + + // We're done! + game.settings.set("litm", "welcomed", true); }); Hooks.on("renderChatMessage", (_app, html) => { diff --git a/scripts/system/settings.js b/scripts/system/settings.js index d5aacd1..a21af71 100644 --- a/scripts/system/settings.js +++ b/scripts/system/settings.js @@ -1,5 +1,14 @@ export class LitmSettings { static register() { + game.settings.register("litm", "welcomed", { + name: "Welcome Screen", + hint: "Welcome Scene, Message, and Journal Entry has been created and displayed.", + scope: "world", + config: false, + type: Boolean, + default: false, + }); + game.settings.register("litm", "storytags", { name: "Story Tags", hint: "Tags that are shared between all users.",