diff --git a/system/lang/en-en.json b/system/lang/en-en.json index 38cd292..97951f8 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -40,14 +40,14 @@ "title": "Need help?", "content": "Follow the guide :", "edge": "Go to the Edge-Studio website", - "drive": "Buy a PDF of the game...", + "drivethrurpg": "Buy a PDF of the game...", "discord": "FoundryVTT Official Discord", "src": "systems/l5r5e/assets/l5r-logo.webp", "alt": "Online Help", "edge-info": "your browser will open the EDGE STUDIO website", "edge-link": "https://edge-studio.net/", - "drive-info": "your browser will open the DriveThruRpg site of Edge Studio", - "drive-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", + "drivethrurpg-info": "your browser will open the DriveThruRpg site of Edge Studio", + "drivethrurpg-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", "discord-info": "Your browser will open on the official Foundry discord", "discord-link": "https://discordapp.com/invite/DDBZUDf" }, diff --git a/system/lang/es-es.json b/system/lang/es-es.json index a23098f..98272ae 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -40,14 +40,14 @@ "títle": "¿Necesitas ayuda?", "content": "Sigue la guía :", "edge": "Ir a la página web de Edge-Studio", - "drive": "¿Comprar un PDF del juego?", + "drivethrurpg": "¿Comprar un PDF del juego?", "discord": "Discordia oficial de FoundryVTT", "src": "systems/l5r5e/assets/l5r-logo.webp", "alt": "Ayuda en línea", - "edge-info": "tu navegador abrirá la página web de EDGE STUDIO", + "edge-info": "Tu navegador abrirá la página web de EDGE STUDIO", "edge-link": "https://edge-studio.net/", - "drive-info": "tu navegador abrirá el sitio DriveThruRpg de Edge Studio", - "drive-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", + "drivethrurpg-info": "tu navegador abrirá el sitio DriveThruRpg de Edge Studio", + "drivethrurpg-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", "discord-info": "Su navegador se abrirá a la discordia oficial de la Fundición", "discord-link": "https://discordapp.com/invite/DDBZUDf" }, diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index 5db24ba..c84e5a0 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -40,14 +40,14 @@ "title": "Besoin d'aide ?", "content": "Suivez le guide :", "edge": "Accéder au site de Edge Studio.", - "drive": "Acheter un PDF du jeu ?", - "discord": "rejoignez le Discord Francophone", + "drivethrurpg": "Acheter un PDF du jeu ?", + "discord": "Rejoignez le Discord Francophone", "src": "systems/l5r5e/assets/l5r-logo.webp", "alt": "Aide en Ligne", "edge-info": "Votre navigateur va ouvrir le site de Edge Studio.", "edge-link": "https://edge-studio.net/", - "drive-info": "Votre navigateur va ouvrir le site DriveThruRpg de Edge Studio.", - "drive-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", + "drivethrurpg-info": "Votre navigateur va ouvrir le site DriveThruRpg de Edge Studio.", + "drivethrurpg-link": "https://www.drivethrurpg.com/browse/pub/17946/EDGE-Studio", "discord-info": "Votre navigateur va ouvrir le discord francophone de foundry.", "discord-link": "https://discord.gg/pPSDNJk" }, diff --git a/system/scripts/help/help-dialog.js b/system/scripts/help/help-dialog.js new file mode 100644 index 0000000..596e189 --- /dev/null +++ b/system/scripts/help/help-dialog.js @@ -0,0 +1,66 @@ +/** + * L5R Help dialog + * @extends {FormApplication} + */ +export class HelpDialog extends FormApplication { + /** + * Payload Object + */ + object = {}; + + /** + * Assign the default options + * @override + */ + static get defaultOptions() { + return mergeObject(super.defaultOptions, { + id: "l5r5e-help-dialog", + classes: ["l5r5e", "help-dialog"], + template: CONFIG.l5r5e.paths.templates + "help/help-dialog.html", + title: game.i18n.localize("l5r5e.logo.title"), + width: 400, + height: 200, + closeOnSubmit: false, + submitOnClose: false, + submitOnChange: false, + }); + } + + /** + * Construct and return the data object used to render the HTML template for this form application. + * @param options + * @return {Object} + */ + getData(options = null) { + return { + ...super.getData(options), + }; + } + + /** + * Listen to html elements + * @override + */ + activateListeners(html) { + super.activateListeners(html); + + // Buttons + ["edge", "drivethrurpg", "discord"].forEach((name) => { + html.find(`button[name='${name}']`).on("click", (event) => { + ui.notifications.info(game.i18n.localize(`l5r5e.logo.${name}-info`)); + window.open(game.i18n.localize(`l5r5e.logo.${name}-link`), "_blank"); + }); + }); + } + + /** + * This method is called upon form submission after form data is validated + * @param event {Event} The initial triggering submission event + * @param formData {Object} The object of validated form data with which to update the object + * @returns {Promise} A Promise which resolves once the update operation has completed + * @override + */ + _updateObject(event, formData) { + // Nothing, but needed to be override + } +} diff --git a/system/scripts/main-l5r5e.js b/system/scripts/main-l5r5e.js index 2506e1d..f78172b 100644 --- a/system/scripts/main-l5r5e.js +++ b/system/scripts/main-l5r5e.js @@ -3,6 +3,7 @@ import { L5R5E } from "./config.js"; import { HelpersL5r5e } from "./helpers.js"; import { RegisterSettings } from "./settings.js"; import { PreloadTemplates } from "./preloadTemplates.js"; +import { HelpDialog } from "./help/help-dialog.js"; // Actors import { ActorL5r5e } from "./actor.js"; import { CharacterSheetL5r5e } from "./actors/character-sheet.js"; @@ -63,6 +64,7 @@ Hooks.once("init", async function () { HelpersL5r5e, RollL5r5e, DicePickerDialog, + HelpDialog, }; // Register custom system settings @@ -182,16 +184,16 @@ Hooks.once("init", async function () { // }); /* ------------------------------------ */ -/* Actor Dialog */ -/* ------------------------------------ */ - -/* ------------------------------------ */ -/* When ready */ +/* Do anything once the system is ready */ /* ------------------------------------ */ Hooks.once("ready", function () { - // Do anything once the system is ready // Add title on button dice icon $(".chat-control-icon")[0].title = game.i18n.localize("l5r5e.chatdices.dicepicker"); + + // Open Help dialog on clic on logo + $("#logo") + .on("click", () => new game.l5r5e.HelpDialog().render(true)) + .prop("title", game.i18n.localize("l5r5e.logo.alt")); }); /* ------------------------------------ */ @@ -259,53 +261,3 @@ Hooks.once("diceSoNiceReady", (dice3d) => { "d12" ); }); - -// Logo & Menu options -Hooks.once("ready", async function () { - // -- Function Open Edge-Studio Website - function openEdge() { - ui.notifications.info(game.i18n.localize("l5r5e.logo.edge-info")); - var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.edge-link"), "_blank"); - } - // -- Open Function Edge's DriveThruRpg - function openDrive() { - ui.notifications.info(game.i18n.localize("l5r5e.logo.drive-info")); - var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.drive-link"), "_blank"); - } - // -- Open Function Discord Link - function openDiscord() { - ui.notifications.info(game.i18n.localize("l5r5e.logo.discord-info")); - var windowObjectReference = window.open(game.i18n.localize("l5r5e.logo.discord-link"), "_blank"); - } - - //-- Logo Menu Link - let liensExt = new Dialog({ - title: game.i18n.localize("l5r5e.logo.title"), - content: "
" + game.i18n.localize("l5r5e.logo.content") + "
", - buttons: { - one: { - icon: '', - label: game.i18n.localize("l5r5e.logo.edge"), - callback: () => openEdge(), - }, - two: { - icon: '', - label: game.i18n.localize("l5r5e.logo.drive"), - callback: () => openDrive(), - }, - three: { - icon: '', - label: game.i18n.localize("l5r5e.logo.discord"), - callback: () => openDiscord(), - }, - }, - }); - //-- Logo - var logo = document.getElementById("logo"); - - //-- Open menu on Logo click - logo.setAttribute("title", game.i18n.localize("l5r5e.logo.alt")); - logo.addEventListener("click", function () { - liensExt.render(true); - }); -}); diff --git a/system/templates/help/help-dialog.html b/system/templates/help/help-dialog.html new file mode 100644 index 0000000..e003650 --- /dev/null +++ b/system/templates/help/help-dialog.html @@ -0,0 +1,10 @@ +