From e88c8aa2f679e7d357b5293010f9e5311689a326 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Thu, 28 Jul 2022 13:04:04 +0200 Subject: [PATCH] Added a distinction on clicking on the dice icon on Chat tab --- CHANGELOG.md | 3 +++ system/lang/en-en.json | 3 ++- system/lang/es-es.json | 3 ++- system/lang/fr-fr.json | 3 ++- system/lang/it-it.json | 3 ++- system/scripts/hooks.js | 34 ++++++++++++++++++++++++++++++++-- 6 files changed, 43 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ff2f6..21f6d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ __! Be certain to carefully back up any critical user data before installing thi - Updated the initiative behaviour, he now open the DicePicker for connected players. - Added a `game.user.isFirstGM` property for some traitements (socket and migration) to prevent multiple executions with multiple GM connected. - Added socket API `openDicePicker` to remotely open the DicePicker (see usage below). +- Added a distinction when clicking on the dice icon on Chat tab : + - Left clic, open the DP locally (as usual). + - Right clic (GM only), now open the DP for players with all skill list. - Added `itemUuid` to Roll/RnK for technique and weapons to be readable in ChatMessage (use `fromUuid()` / `fromUuidSync()` to get the object). - Added wiki link in system tab. - Removed restriction on technique types when dropping a technique (Sheet and 20Q. #39). diff --git a/system/lang/en-en.json b/system/lang/en-en.json index 2acc4ee..7e74d64 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -138,7 +138,8 @@ "void_point_tooltip": "Void point", "skill_assistance_label": "Assistance", "roll_label": "Roll", - "bt_add_macro": "Add a macro" + "bt_add_macro": "Add a macro", + "gm_request_dp_to_players": "Roll request sent to players" }, "roll_n_keep": { "title": "Roll & Keep", diff --git a/system/lang/es-es.json b/system/lang/es-es.json index 333d3fa..4218e2b 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -138,7 +138,8 @@ "void_point_tooltip": "Punto de vacío", "skill_assistance_label": "Asistencia", "roll_label": "Tirar", - "bt_add_macro": "Añadir una macro" + "bt_add_macro": "Añadir una macro", + "gm_request_dp_to_players": "Roll request sent to players" }, "roll_n_keep": { "title": "Tirar y guardar", diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index 274e436..d6361ab 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -138,7 +138,8 @@ "void_point_tooltip": "Point de Vide", "skill_assistance_label": "Assistance", "roll_label": "Lancer", - "bt_add_macro": "Ajouter une macro" + "bt_add_macro": "Ajouter une macro", + "gm_request_dp_to_players": "Demande de jet envoyée aux joueurs" }, "roll_n_keep": { "title": "Roll & Keep", diff --git a/system/lang/it-it.json b/system/lang/it-it.json index 1218524..e1a90b6 100644 --- a/system/lang/it-it.json +++ b/system/lang/it-it.json @@ -138,7 +138,8 @@ "void_point_tooltip": "Punto Vuoto", "skill_assistance_label": "Aiuto", "roll_label": "Tira", - "bt_add_macro": "Aggiungi una macro" + "bt_add_macro": "Aggiungi una macro", + "gm_request_dp_to_players": "Roll request sent to players" }, "roll_n_keep": { "title": "Tira e Tieni", diff --git a/system/scripts/hooks.js b/system/scripts/hooks.js index 530dbff..f007f99 100644 --- a/system/scripts/hooks.js +++ b/system/scripts/hooks.js @@ -55,8 +55,38 @@ export default class HooksL5r5e { static renderSidebarTab(app, html, data) { switch (app.tabName) { case "chat": - // Add button on dice icon - html.find(".chat-control-icon").click(async () => new game.l5r5e.DicePickerDialog().render()); + // Add DP on dice icon + html.find(`.chat-control-icon`).on("mousedown", async (event) => { + event.preventDefault(); + event.stopPropagation(); + switch (event.which) { + case 1: + // Left clic - Local DP + new game.l5r5e.DicePickerDialog().render(); + break; + case 3: + // Right clic - Players DP + if (game.user.isGM) { + game.l5r5e.HelpersL5r5e.debounce( + "gm-request-dp", + () => { + game.l5r5e.sockets.openDicePicker({ + users: game.users.players.filter((u) => u.active && u.hasPlayerOwner), + dpOptions: { + skillsList: "artisan,martial,scholar,social,trade", + }, + }); + ui.notifications.info( + game.i18n.localize("l5r5e.dice.dicepicker.gm_request_dp_to_players") + ); + }, + 3000, + true + )(); + } + break; + } + }); // Add title on button dice icon html.find(".chat-control-icon")[0].title = game.i18n.localize("l5r5e.dice.dicepicker.title");