Added a distinction on clicking on the dice icon on Chat tab

This commit is contained in:
Vlyan
2022-07-28 13:04:04 +02:00
parent d500e515e2
commit e88c8aa2f6
6 changed files with 43 additions and 6 deletions

View File

@@ -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. - 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 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 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 `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. - Added wiki link in system tab.
- Removed restriction on technique types when dropping a technique (Sheet and 20Q. #39). - Removed restriction on technique types when dropping a technique (Sheet and 20Q. #39).

View File

@@ -138,7 +138,8 @@
"void_point_tooltip": "Void point", "void_point_tooltip": "Void point",
"skill_assistance_label": "Assistance", "skill_assistance_label": "Assistance",
"roll_label": "Roll", "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": { "roll_n_keep": {
"title": "Roll & Keep", "title": "Roll & Keep",

View File

@@ -138,7 +138,8 @@
"void_point_tooltip": "Punto de vacío", "void_point_tooltip": "Punto de vacío",
"skill_assistance_label": "Asistencia", "skill_assistance_label": "Asistencia",
"roll_label": "Tirar", "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": { "roll_n_keep": {
"title": "Tirar y guardar", "title": "Tirar y guardar",

View File

@@ -138,7 +138,8 @@
"void_point_tooltip": "Point de Vide", "void_point_tooltip": "Point de Vide",
"skill_assistance_label": "Assistance", "skill_assistance_label": "Assistance",
"roll_label": "Lancer", "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": { "roll_n_keep": {
"title": "Roll & Keep", "title": "Roll & Keep",

View File

@@ -138,7 +138,8 @@
"void_point_tooltip": "Punto Vuoto", "void_point_tooltip": "Punto Vuoto",
"skill_assistance_label": "Aiuto", "skill_assistance_label": "Aiuto",
"roll_label": "Tira", "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": { "roll_n_keep": {
"title": "Tira e Tieni", "title": "Tira e Tieni",

View File

@@ -55,8 +55,38 @@ export default class HooksL5r5e {
static renderSidebarTab(app, html, data) { static renderSidebarTab(app, html, data) {
switch (app.tabName) { switch (app.tabName) {
case "chat": case "chat":
// Add button on dice icon // Add DP on dice icon
html.find(".chat-control-icon").click(async () => new game.l5r5e.DicePickerDialog().render()); 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 // Add title on button dice icon
html.find(".chat-control-icon")[0].title = game.i18n.localize("l5r5e.dice.dicepicker.title"); html.find(".chat-control-icon")[0].title = game.i18n.localize("l5r5e.dice.dicepicker.title");