From c454c035a344f77b521d20c4b1a552f41c6aebd3 Mon Sep 17 00:00:00 2001 From: Jacob Lucas Date: Thu, 3 Jun 2021 14:20:03 +0100 Subject: [PATCH] Fixed new character sheet's send language to chat function - Cleaned up unused variables - Updated _id get to 0.8 standard - Patched fetching languages failing - Patched blind and gm chat option not doing anything while simultaneously calling a non existent function and dying - Patched self chat option still sending to everyone --- module/actor/sheets/newSheet/character.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/module/actor/sheets/newSheet/character.js b/module/actor/sheets/newSheet/character.js index 05221186..38b0b1c8 100644 --- a/module/actor/sheets/newSheet/character.js +++ b/module/actor/sheets/newSheet/character.js @@ -243,11 +243,11 @@ export default class ActorSheet5eCharacterNew extends ActorSheet5e { // Send Languages to Chat onClick html.find('[data-options="share-languages"]').click(event => { event.preventDefault(); - let langs = this.actor.data.data.traits.languages.value.map(l => SW5E.languages[l] || l).join(", "); + let langs = this.actor.data.data.traits.languages.value.map(l => CONFIG.SW5E.languages[l] || l).join(", "); let custom = this.actor.data.data.traits.languages.custom; if (custom) langs += ", " + custom.replace(/;/g, ","); let content = ` -
+

Known Languages

@@ -257,21 +257,25 @@ export default class ActorSheet5eCharacterNew extends ActorSheet5e { `; // Send to Chat - let rollWhisper = null; let rollBlind = false; let rollMode = game.settings.get("core", "rollMode"); - if (["gmroll", "blindroll"].includes(rollMode)) rollWhisper = ChatMessage.getWhisperIDs("GM"); if (rollMode === "blindroll") rollBlind = true; - ChatMessage.create({ + let data = { user: game.user.data._id, content: content, + blind: rollBlind, speaker: { actor: this.actor.data._id, token: this.actor.token, alias: this.actor.name }, type: CONST.CHAT_MESSAGE_TYPES.OTHER - }); + }; + + if (["gmroll", "blindroll"].includes(rollMode)) data["whisper"] = ChatMessage.getWhisperRecipients("GM"); + else if (rollMode === "selfroll") data["whisper"] = [game.users.get(game.user.data._id)]; + + ChatMessage.create(data); }); // Item Delete Confirmation