From 35a6b4f9745e674a410f893f1966074c169b07e9 Mon Sep 17 00:00:00 2001 From: Dorako Date: Sun, 22 May 2022 10:47:23 +0200 Subject: [PATCH] v1.3.23 --- CHANGELOG.md | 4 ++++ README.md | 1 + module.json | 4 ++-- scripts/dorako-ui.js | 32 ++++++++++++++++++++++++++++---- templates/base-chat-message.html | 12 +++++++----- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80e7ac7..630a87c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.3.23 + +Fixed damage-taken and healing-received messages not showing. + # 1.3.22 Fixed chat messages not showing up if PF2e Combat Tracker Images was not present. diff --git a/README.md b/README.md index cc25206..3b038b7 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Works great with: - Polyglot - Damage Log - Combat Carousel +- PF2E Combat Tracker Images Works well with: diff --git a/module.json b/module.json index b87a7bd..9ac1e71 100644 --- a/module.json +++ b/module.json @@ -4,12 +4,12 @@ "description": "Overhauls the Foundry UI and several modules.", "url": "https://github.com/Dorako/pf2e-dorako-ui", "author": "Dorako", - "version": "1.3.22", + "version": "1.3.23", "minimumCoreVersion": "9", "compatibleCoreVersion": "9", "system": ["pf2e"], "scripts": ["scripts/dorako-ui.js"], "templates": ["templates/*"], - "download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.3.22.zip", + "download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.3.23.zip", "manifest": "https://github.com/Dorako/pf2e-dorako-ui/raw/main/module.json" } diff --git a/scripts/dorako-ui.js b/scripts/dorako-ui.js index fc1ca8a..15bf739 100644 --- a/scripts/dorako-ui.js +++ b/scripts/dorako-ui.js @@ -164,7 +164,9 @@ Hooks.once("init", async function () { const speaker = message.speaker; if (speaker) { if (speaker.token) { - const token = game.scenes.get(speaker.scene).tokens?.get(speaker.token); + const token = game.scenes + .get(speaker.scene) + ?.tokens?.get(speaker.token); tokenImg = token?.data.img; } if (speaker.actor) { @@ -197,7 +199,9 @@ Hooks.once("init", async function () { const speaker = message.speaker; if (speaker) { if (speaker.token) { - const token = game.scenes.get(speaker.scene).tokens?.get(speaker.token); + const token = game.scenes + .get(speaker.scene) + ?.tokens?.get(speaker.token); tokenImg = token?.data.img; } if (speaker.actor) { @@ -242,7 +246,9 @@ Hooks.once("init", async function () { const speaker = message.speaker; if (speaker) { if (speaker.token) { - const token = game.scenes.get(speaker.scene).tokens?.get(speaker.token); + const token = game.scenes + .get(speaker.scene) + ?.tokens?.get(speaker.token); tokenImg = token?.data.img; } if (speaker.actor) { @@ -261,6 +267,24 @@ Hooks.once("init", async function () { return combatantImg || actorImg || tokenImg; }); + Handlebars.registerHelper("showHeader", function (message) { + const headerStyle = game.settings.get( + "pf2e-dorako-ui", + "insertSpeakerImage" + ); + + if (headerStyle === "none") return false; + + const speaker = message.speaker; + if ( + speaker && + speaker.token && + game.scenes.get(speaker.scene)?.tokens?.get(speaker.token) + ) { + return true; + } + }); + Handlebars.registerHelper("getHeaderStyle", function (message) { const user = game.users.get(message.user); @@ -314,7 +338,7 @@ Hooks.once("init", async function () { } }); - Handlebars.registerHelper("getTitleStyle", function (message) { + Handlebars.registerHelper("isUsingHeaderTint", function (message) { const headerStyle = game.settings.get("pf2e-dorako-ui", "headerStyle"); if (headerStyle === "tint") { return true; diff --git a/templates/base-chat-message.html b/templates/base-chat-message.html index b652437..a20a91a 100644 --- a/templates/base-chat-message.html +++ b/templates/base-chat-message.html @@ -1,9 +1,10 @@
  • - {{#if (getTitleStyle message)}} -
    - {{else}} -
    - {{/if}} + {{#if (showHeader message)}} + {{#if (isUsingHeaderTint message)}} +
    + {{else}} +
    + {{/if}} {{#if (showSpeakerImage message)}}
    @@ -21,6 +22,7 @@

    {{alias}}

    {{/if}}
    + {{/if}} {{#if isWhisper}}
    {{localize 'CHAT.To'}}: {{whisperTo}}