From e30a97d036dfe353c82ee88c730310751b2ec1bc Mon Sep 17 00:00:00 2001 From: trotFunky Date: Wed, 28 May 2025 19:06:48 +0100 Subject: [PATCH] Add new tools to pre-select players Selecting all present players can be tedious, especially if they are many or when multiple messagess need to be sent. Add two new buttons to the toolbar that allow pre-filling the form with all connected players, or all players. Add translations and icons for those new tools. --- assets/bubble_above_three_players.webp | Bin 0 -> 328 bytes assets/bubble_above_two_players.webp | Bin 0 -> 330 bytes lang/en.json | 2 ++ lang/fr.json | 2 ++ scripts/mills_messages.mjs | 22 ++++++++++++++++++++++ styles/mills_messages.css | 20 ++++++++++++++++++++ 6 files changed, 46 insertions(+) create mode 100644 assets/bubble_above_three_players.webp create mode 100644 assets/bubble_above_two_players.webp diff --git a/assets/bubble_above_three_players.webp b/assets/bubble_above_three_players.webp new file mode 100644 index 0000000000000000000000000000000000000000..e85f5a2264f4b1bab2dd33ae327805d57f733dc4 GIT binary patch literal 328 zcmWIYbaQiHWMBw)bqWXzu!!JdU|6&w_n*Gdw4n+-FV*d<(Fuq~^!TvD+1HS?P5&p*fr~mtF6xcJa9zV=FV*|tA+5f*q zOO&sznI8PAA)(c-e){#3Ha!{IE8Y}eVv>*E{l)%Y*_sadEh#7Tz9iIt_&4qU-`_i0 zb8?PGL`}5e*NM+;-?&74?&Z$Kd-T4yy7=bx8g2NtAyI!=3gs5t;yoT{$0t>vuWM$vWJ>k)<9V`hssr4$A1fK-zJyE YqWWXv&0TN*&uRDnrkJf`E6l(E01L{ADF6Tf literal 0 HcmV?d00001 diff --git a/assets/bubble_above_two_players.webp b/assets/bubble_above_two_players.webp new file mode 100644 index 0000000000000000000000000000000000000000..e1c498cd60d1570c305b35064cf27fb01f13410c GIT binary patch literal 330 zcmV-Q0k!^8Nk&FO0RRA3MM6+kP&il$0000G0000F000jF06|PpNGAXQ00CgoHj<<8 zC+#cWpFl)RK)GDG`GD8EQ(fy(&ZyuBo`_DV;0S&I09H^qAoKtL08j@2odGHk01yBG zz!D{-08RkpVmu4tpN)6`7|I`jaR6!-{$Kd3>;?GG;*anTGe5)+fuHC9kQ^pwXw}EV z5B%960R6Ln>@!2;O;O@Yz^f*g$5ylRcS2cVK7MOb8epl1nf-JBpLx`%QHIW2Y{ z;t>S@{rG%=xL=d>e&XtMv3;psjcY{h!;A>PV=t{ozM8fVzk+888++_|gkD+O?64x6 zJ!S*rEZWL!=rGGa+nfY=?0xH-%GQ3opzraP;CW4Kr;dxoe;yxhb%UAxxxiZz7v2T` cu^rx;yY>X?FF>Mi>#)2J{>q1UqieMQ05Cq7X#fBK literal 0 HcmV?d00001 diff --git a/lang/en.json b/lang/en.json index 311ef90..9418595 100644 --- a/lang/en.json +++ b/lang/en.json @@ -3,6 +3,8 @@ "UI": { "ToolbarCategory": "Message controls", "ToolbarSendMessage": "Send message", + "ToolbarSendMessageToConnected": "Send message to all connected players", + "ToolbarSendMessageToAll": "Send message to all players", "HistoryJournalTitle": "Messages for {name}" }, "Dialogs": { diff --git a/lang/fr.json b/lang/fr.json index ade8c2e..0680f44 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -3,6 +3,8 @@ "UI": { "ToolbarCategory": "Contrôles messages", "ToolbarSendMessage": "Envoyer des messages", + "ToolbarSendMessageToConnected": "Envoyer un message à tous les joueurs connectés", + "ToolbarSendMessageToAll": "Envoyer des messages à tous les joueurs", "HistoryJournalTitle": "Messages pour {name}" }, "Dialogs": { diff --git a/scripts/mills_messages.mjs b/scripts/mills_messages.mjs index 578841a..15ddffd 100644 --- a/scripts/mills_messages.mjs +++ b/scripts/mills_messages.mjs @@ -332,6 +332,28 @@ function main() { title: "MM.UI.ToolbarCategory", icon: "mm-chat-bubble", tools: [{ + name: "send-message-to-all", + title: "MM.UI.ToolbarSendMessageToAll", + button: true, + visible: true, + icon: "mm-bubble-above-three-players", + onClick: () => send_message_dialog({ + recipients: game.users.players.map((user) => user.id) + }) + }, + { + name: "send-message-to-connected", + title: "MM.UI.ToolbarSendMessageToConnected", + button: true, + visible: true, + icon: "mm-bubble-above-two-players", + onClick: () => send_message_dialog({ + recipients: game.users.players + .filter((user) => user.active) + .map((user) => user.id) + }) + }, + { name: "send-message", title: "MM.UI.ToolbarSendMessage", button: true, diff --git a/styles/mills_messages.css b/styles/mills_messages.css index f205cb0..79443fe 100644 --- a/styles/mills_messages.css +++ b/styles/mills_messages.css @@ -9,6 +9,26 @@ background-image: url("/modules/the-mills-messages/assets/chat_bubble.webp"); } +.mm-bubble-above-two-players { + display: inline-block; + width: 32px; + height: 32px; + background-size: cover; + cursor: pointer; + image-rendering: pixelated; + background-image: url("/modules/the-mills-messages/assets/bubble_above_two_players.webp"); +} + +.mm-bubble-above-three-players { + display: inline-block; + width: 32px; + height: 32px; + background-size: cover; + cursor: pointer; + image-rendering: pixelated; + background-image: url("/modules/the-mills-messages/assets/bubble_above_three_players.webp"); +} + /* * Override Foundry's `.application .scrollable`, whose right margin does not work * with ProseMirror's editor internal divs which need a 0 right margin.