Compare commits
5 commits
c83122548a
...
ecbef75db8
Author | SHA1 | Date | |
---|---|---|---|
ecbef75db8 | |||
e30a97d036 | |||
16e1eab24b | |||
a091ce93df | |||
effbe22fa1 |
9 changed files with 59 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
# The Mill's Messages - v0.1.0
|
# The Mill's Messages - v0.2.0
|
||||||
|
|
||||||
This little [FoundryVTT](https://foundryvtt.com/) module gives the GMs a way to send messages to PCs with a bit more flair than
|
This little [FoundryVTT](https://foundryvtt.com/) module gives the GMs a way to send messages to PCs with a bit more flair than
|
||||||
the chat, and more spontaneity than journals !
|
the chat, and more spontaneity than journals !
|
||||||
|
|
BIN
assets/bubble_above_three_players.webp
Normal file
BIN
assets/bubble_above_three_players.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 328 B |
BIN
assets/bubble_above_two_players.webp
Normal file
BIN
assets/bubble_above_two_players.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 B |
|
@ -3,6 +3,8 @@
|
||||||
"UI": {
|
"UI": {
|
||||||
"ToolbarCategory": "Message controls",
|
"ToolbarCategory": "Message controls",
|
||||||
"ToolbarSendMessage": "Send message",
|
"ToolbarSendMessage": "Send message",
|
||||||
|
"ToolbarSendMessageToConnected": "Send message to all connected players",
|
||||||
|
"ToolbarSendMessageToAll": "Send message to all players",
|
||||||
"HistoryJournalTitle": "Messages for {name}"
|
"HistoryJournalTitle": "Messages for {name}"
|
||||||
},
|
},
|
||||||
"Dialogs": {
|
"Dialogs": {
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
"UI": {
|
"UI": {
|
||||||
"ToolbarCategory": "Contrôles messages",
|
"ToolbarCategory": "Contrôles messages",
|
||||||
"ToolbarSendMessage": "Envoyer des 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}"
|
"HistoryJournalTitle": "Messages pour {name}"
|
||||||
},
|
},
|
||||||
"Dialogs": {
|
"Dialogs": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "the-mills-messages",
|
"id": "the-mills-messages",
|
||||||
"title": "The Mill's Messages",
|
"title": "The Mill's Messages",
|
||||||
"description": "A little message-sending modules for GMs",
|
"description": "A little message-sending modules for GMs",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "12",
|
"minimum": "12",
|
||||||
"verified": "12",
|
"verified": "12",
|
||||||
|
@ -49,5 +49,5 @@
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"url": "https://git.tfk-astrodome.net/trotFunky/TheMillsMessages/src/branch/release",
|
"url": "https://git.tfk-astrodome.net/trotFunky/TheMillsMessages/src/branch/release",
|
||||||
"manifest": "https://git.tfk-astrodome.net/trotFunky/TheMillsMessages/raw/branch/release/module.json",
|
"manifest": "https://git.tfk-astrodome.net/trotFunky/TheMillsMessages/raw/branch/release/module.json",
|
||||||
"download": "https://git.tfk-astrodome.net/trotFunky/TheMillsMessages/archive/v0.1.0.zip"
|
"download": "https://git.tfk-astrodome.net/trotFunky/TheMillsMessages/archive/v0.2.0.zip"
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,16 +71,24 @@ async function create_history_journal(user) {
|
||||||
* This allows us to populate the form with previous inputs and go back and forth
|
* This allows us to populate the form with previous inputs and go back and forth
|
||||||
* within the chain, to be able to fix mistakes or send fewer messages.
|
* within the chain, to be able to fix mistakes or send fewer messages.
|
||||||
*
|
*
|
||||||
|
* We also use this to pre-fill the first form with data if any is passed.
|
||||||
|
*
|
||||||
* NOTE: The recipients are the same for all the messages of a chain, to simplify
|
* NOTE: The recipients are the same for all the messages of a chain, to simplify
|
||||||
* the processing later as we only have to build one array of messages, shared among
|
* the processing later as we only have to build one array of messages, shared among
|
||||||
* the recipients.
|
* the recipients.
|
||||||
|
*
|
||||||
|
* @param {MessageFormResponse|null} initial_form_data Data to pre-fill the first form with.
|
||||||
* @returns {Promise<void>} The Promise for the processing of the messages.
|
* @returns {Promise<void>} The Promise for the processing of the messages.
|
||||||
*/
|
*/
|
||||||
async function send_message_dialog() {
|
async function send_message_dialog(initial_form_data = null) {
|
||||||
/** @type{MessageFormResponse[]} */
|
/** @type{MessageFormResponse[]} */
|
||||||
let messages = []
|
let messages = []
|
||||||
let current_message = 0
|
let current_message = 0
|
||||||
|
|
||||||
|
if (initial_form_data !== null) {
|
||||||
|
messages.push(initial_form_data);
|
||||||
|
}
|
||||||
|
|
||||||
let chain = false;
|
let chain = false;
|
||||||
do {
|
do {
|
||||||
if (chain) {
|
if (chain) {
|
||||||
|
@ -324,6 +332,28 @@ function main() {
|
||||||
title: "MM.UI.ToolbarCategory",
|
title: "MM.UI.ToolbarCategory",
|
||||||
icon: "mm-chat-bubble",
|
icon: "mm-chat-bubble",
|
||||||
tools: [{
|
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",
|
name: "send-message",
|
||||||
title: "MM.UI.ToolbarSendMessage",
|
title: "MM.UI.ToolbarSendMessage",
|
||||||
button: true,
|
button: true,
|
||||||
|
|
|
@ -43,7 +43,7 @@ export function validate_form(form_response) {
|
||||||
*/
|
*/
|
||||||
export function prepare_send_message_html(existing_values = null, chain = false) {
|
export function prepare_send_message_html(existing_values = null, chain = false) {
|
||||||
let players_options = []
|
let players_options = []
|
||||||
for (let user of game.users.filter((user) => !user.isGM)) {
|
for (let user of game.users.players) {
|
||||||
players_options.push({
|
players_options.push({
|
||||||
label: user.character ? user.character.name : user.name,
|
label: user.character ? user.character.name : user.name,
|
||||||
value: user.id,
|
value: user.id,
|
||||||
|
|
|
@ -9,6 +9,26 @@
|
||||||
background-image: url("/modules/the-mills-messages/assets/chat_bubble.webp");
|
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
|
* Override Foundry's `.application .scrollable`, whose right margin does not work
|
||||||
* with ProseMirror's editor internal divs which need a 0 right margin.
|
* with ProseMirror's editor internal divs which need a 0 right margin.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue