From a042b838407cb7904efe5cd23d1cc91b15d789f7 Mon Sep 17 00:00:00 2001 From: Dorako Date: Tue, 8 Nov 2022 23:48:06 +0100 Subject: [PATCH] 1.8.2 --- CHANGELOG.md | 8 ++++++++ languages/en.json | 3 +++ module.json | 4 ++-- scripts/dorako-ui.js | 41 +++++++++++++++++++++++++++++++++++++---- styles/chat.css | 16 +++++++++++++--- 5 files changed, 63 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 098ab69..31e5337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 1.8.2 + +Fixed display of DFCE 'in world' timestamps in messages. + +Added a new option to remove attack information from damage rolls, to get a similar look to 1.7.4's combine-attacks-and-damage-rolls feature, when used with DFCE chat merge. + +Fixed bug that caused action costs in restructured spell messages to render as numbers rather than icons. + # 1.8.1 Fixed display of combined messages with Avatars disabled. diff --git a/languages/en.json b/languages/en.json index 2145207..bce166e 100644 --- a/languages/en.json +++ b/languages/en.json @@ -75,6 +75,9 @@ "dorako-ui.settings.combine-attack-and-damage-roll-messages.name": "Combine attack and damage roll messages?", "dorako-ui.settings.combine-attack-and-damage-roll-messages.hint": "Makes damage roll messages take up less space by visually combining them with the attack", + "dorako-ui.settings.remove-attack-info-from-damage-roll-messages.name": "Remove attack info from damage roll messages?", + "dorako-ui.settings.remove-attack-info-from-damage-roll-messages.hint": "Makes damage rolls take up less space by removing redundant hit information. Intended to be used with DFCE chat-merge.", + "dorako-ui.settings.compact-ui.name": "Enable Compact UI?", "dorako-ui.settings.compact-ui.hint": "Resizes controls, and hides inactive controls and navigation elements unless hovered", diff --git a/module.json b/module.json index db07506..707dba5 100644 --- a/module.json +++ b/module.json @@ -12,7 +12,7 @@ "flags": {} } ], - "version": "1.8.1", + "version": "1.8.2", "compatibility": { "minimum": "10", "verified": "10" @@ -59,6 +59,6 @@ ], "styles": ["styles/fonts.css"], "scripts": ["scripts/dorako-ui.js"], - "download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.8.1.zip", + "download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.8.2.zip", "manifest": "https://github.com/Dorako/pf2e-dorako-ui/releases/latest/download/module.json" } diff --git a/scripts/dorako-ui.js b/scripts/dorako-ui.js index db9c84d..4e785f9 100644 --- a/scripts/dorako-ui.js +++ b/scripts/dorako-ui.js @@ -45,13 +45,15 @@ function titleCase(string) { // second return value is whether the first value can be styled as pf2e-icon function getActionGlyph(actionCost) { + // console.log(actionCost); if (actionCost === "1 to 3") return ["1 / 2 / 3", true]; if (actionCost === "1 or 2") return ["1 / 2", true]; if (actionCost === "2 or 3") return ["2 / 3", true]; - if (actionCost.type == "action") { + if (actionCost.type === "action") { return [actionCost.value, true]; - } else if (actionCost.type == "reaction") return ["R", true]; - else if (actionCost.type == "free") return ["F", true]; + } else if (actionCost.type === "reaction") return ["R", true]; + else if (actionCost.type === "free") return ["F", true]; + else if (actionCost.length === 1) return [actionCost, true]; else return [actionCost, false]; } @@ -272,6 +274,18 @@ Hooks.on("renderChatMessage", (chatMessage, html, messageData) => { themeHeader(html, chatMessage); }); +Hooks.on("renderChatMessage", (chatMessage, html, messageData) => { + if (!game.settings.get("pf2e-dorako-ui", "remove-attack-info-from-damage-roll-messages")) return; + + if (chatMessage?.isDamageRoll) { + html[0].classList.add("dorako-damage-roll"); + let flavor = html.find(".flavor-text"); + flavor.each(function () { + $(this).contents().eq(1).wrap(""); + }); + } +}); + // // Combine attack and damage rolls from same source // Hooks.on("renderChatMessage", (chatMessage, html, messageData) => { // if (!game.settings.get("pf2e-dorako-ui", "combine-attack-and-damage-roll-messages")) return; @@ -396,8 +410,15 @@ function themeHeader(html, message) { let textColTheme = calcHeaderTextColor(html, message); messageHeader.classList.add(textColTheme); + // some modules add different timestamps and hide the original, like dfce-simple-timestamp let time = html.find("time")[0]; - time.classList.add("header-meta"); + if (time) { + time.classList.add("header-meta"); + } + // let dfceTime = html.find(".dfce-simple-timestamp")[0]; + // if (dfceTime) { + // dfceTime.classList.add("header-meta"); + // } } function moveFlavorTextToContents(html) { @@ -1205,6 +1226,18 @@ Hooks.once("init", async () => { // }, // }); + game.settings.register("pf2e-dorako-ui", "remove-attack-info-from-damage-roll-messages", { + name: i18n("dorako-ui.settings.remove-attack-info-from-damage-roll-messages.name"), + hint: i18n("dorako-ui.settings.remove-attack-info-from-damage-roll-messages.hint"), + scope: "world", + type: Boolean, + default: true, + config: true, + onChange: () => { + debouncedReload(); + }, + }); + game.settings.register("pf2e-dorako-ui", "compact-ui", { name: i18n("dorako-ui.settings.compact-ui.name"), hint: i18n("dorako-ui.settings.compact-ui.hint"), diff --git a/styles/chat.css b/styles/chat.css index 82c1af6..440cda9 100644 --- a/styles/chat.css +++ b/styles/chat.css @@ -354,7 +354,8 @@ button { - +.dfce-cm-middle .dfce-simple-timestamp, +.dfce-cm-bottom .dfce-simple-timestamp, .dfce-cm-middle>.message-header .sender-wrapper, .dfce-cm-bottom>.message-header .sender-wrapper, .dfce-cm-middle>.message-header>.message-metadata, @@ -366,6 +367,8 @@ button { display: none; } + + /* #chat-log > .chat-message.message.flexcol :not(.chat-message.message.flexcol.dfce-cm-middle), #chat-log > .chat-message.message.flexcol :not(.chat-message.message.flexcol.dfce-cm-bottom){ @@ -1254,7 +1257,7 @@ table.pf2-table td, table.pf2-table th { } .dfce-cm-middle .message-delete, .dfce-cm-bottom .message-delete { - top: 5px; + top: 12px; } .chat-message .message-header .message-sender { @@ -1452,6 +1455,7 @@ div#scrollToBottom:hover { text-shadow: none; } +.dfce-simple-timestamp, .header-meta { border-radius: 3px; padding: 2px; @@ -1509,6 +1513,7 @@ div#scrollToBottom:hover { color: white; } +.message-header.light-header-text .dfce-simple-timestamp, .message-header.light-header-text .header-meta { color: white; background-color: hsla(0, 0%, 50%, 40%); @@ -1517,6 +1522,7 @@ div#scrollToBottom:hover { } .header-meta, +.dfce-simple-timestamp, .message-header.dark-header-text .header-meta { color: hsla(0, 0%, 20%, 100%); background-color: hsla(0, 0%, 90%, 50%); @@ -1754,7 +1760,7 @@ span[data-pf2-check].with-repost { } -.chat-message.dorako-damage-roll .message-content { +/* .chat-message.dorako-damage-roll .message-content { padding: 2px 5px 5px 5px; } @@ -1776,4 +1782,8 @@ span[data-pf2-check].with-repost { .chat-message.dorako-ranged-combat p.action-content { margin-top: 0px; +} */ + +.dorako-damage-roll .flavor-text>*:nth-child(-n+3) { + display: none; } \ No newline at end of file