From 5463b0c7ed567523fbd12a21b1d758e02a898ec0 Mon Sep 17 00:00:00 2001 From: moliloo Date: Sat, 2 Aug 2025 02:14:58 -0300 Subject: [PATCH] fix labels in duality rolls messages and style experience and effects messages --- .../applications/sheets/actors/character.mjs | 8 +++- module/applications/sheets/api/base-actor.mjs | 32 +++++++++++---- module/documents/activeEffect.mjs | 12 +++--- styles/less/ui/chat/chat.less | 40 ++++++++++++------- styles/less/utils/colors.less | 16 +++----- templates/ui/chat/chat-message.hbs | 17 ++++---- 6 files changed, 79 insertions(+), 46 deletions(-) diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index abe36e25..6e38e25d 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -614,7 +614,13 @@ export default class CharacterSheet extends DHBaseActorSheet { }, hasRoll: true }; - this.document.diceRoll(config); + this.document.diceRoll({ + ...config, + headerTitle: `${game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll')}: ${this.actor.name}`, + title: game.i18n.format('DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle', { + ability: abilityLabel + }) + }); } //TODO: redo toggleEquipItem method diff --git a/module/applications/sheets/api/base-actor.mjs b/module/applications/sheets/api/base-actor.mjs index 346a0ab6..56e48232 100644 --- a/module/applications/sheets/api/base-actor.mjs +++ b/module/applications/sheets/api/base-actor.mjs @@ -121,21 +121,37 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) { */ static async #sendExpToChat(_, button) { const experience = this.document.system.experiences[button.dataset.id]; + const cls = getDocumentClass('ChatMessage'); const systemData = { - name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'), - description: `${experience.name} ${experience.value.signedString()}` + actor: { name: this.actor.name, img: this.actor.img }, + author: game.users.get(game.user.id), + action: { + name: `${experience.name} ${experience.value.signedString()}`, + img: '/icons/sundries/misc/admission-ticket-blue.webp' + }, + itemOrigin: { + name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single') + }, + description: experience.description }; - foundry.documents.ChatMessage.implementation.create({ - type: 'abilityUse', + const msg = { user: game.user.id, - system: systemData, content: await foundry.applications.handlebars.renderTemplate( - 'systems/daggerheart/templates/ui/chat/ability-use.hbs', + 'systems/daggerheart/templates/ui/chat/action.hbs', systemData - ) - }); + ), + title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'), + speaker: cls.getSpeaker(), + flags: { + daggerheart: { + cssClass: 'dh-chat-message dh-style' + } + } + }; + + cls.create(msg); } /* -------------------------------------------- */ diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index 2f031b97..9eec2ffa 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -115,20 +115,22 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect { async toChat(origin) { const cls = getDocumentClass('ChatMessage'); + const actor = game.actors.get(cls.getSpeaker().actor); const systemData = { - title: game.i18n.localize('DAGGERHEART.CONFIG.ActionType.action'), + action: { img: this.img, name: this.name }, + actor: { name: actor.name, img: actor.img }, + author: this.author, + speaker: cls.getSpeaker(), origin: origin, - img: this.img, - name: this.name, description: this.description, actions: [] }; const msg = { - type: 'abilityUse', + title: game.i18n.localize('DAGGERHEART.GENERAL.Effect.single'), user: game.user.id, system: systemData, content: await foundry.applications.handlebars.renderTemplate( - 'systems/daggerheart/templates/ui/chat/ability-use.hbs', + 'systems/daggerheart/templates/ui/chat/action.hbs', systemData ) }; diff --git a/styles/less/ui/chat/chat.less b/styles/less/ui/chat/chat.less index 3c5a25f6..69bdd6f5 100644 --- a/styles/less/ui/chat/chat.less +++ b/styles/less/ui/chat/chat.less @@ -364,7 +364,8 @@ } } -.daggerheart, #chat-notifications { +.daggerheart, +#chat-notifications { .chat-message { --text-color: light-dark(@dark-blue, @golden); --bg-color: light-dark(@dark-blue-40, @golden-40); @@ -373,7 +374,8 @@ &.hope { --text-color: @golden; --bg-color: @golden-40; - .message-header, .message-content { + .message-header, + .message-content { background-color: @golden-bg; } } @@ -381,7 +383,8 @@ &.fear { --text-color: @chat-blue; --bg-color: @chat-blue-40; - .message-header, .message-content { + .message-header, + .message-content { background-color: @chat-blue-bg; } } @@ -389,7 +392,8 @@ &.critical { --text-color: @chat-purple; --bg-color: @chat-purple-40; - .message-header, .message-content { + .message-header, + .message-content { background-color: @chat-purple-bg; } } @@ -418,17 +422,18 @@ padding: 0 10px; } - &:before, &:after { + &:before, + &:after { content: ' '; height: 1px; } &:before { - background: linear-gradient(90deg,rgba(0, 0, 0, 0) 0%, var(--text-color) 100%); + background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, var(--text-color) 100%); } &:after { - background: linear-gradient(90deg,var(--text-color) 0%, rgba(0, 0, 0, 0) 100%); + background: linear-gradient(90deg, var(--text-color) 0%, rgba(0, 0, 0, 0) 100%); } } @@ -458,7 +463,7 @@ > :first-child:not(.target-selector) { margin-top: 5px; } - + > :last-child { margin-bottom: 5px; } @@ -468,6 +473,7 @@ .roll-result-container { display: flex; justify-content: center; + align-items: center; gap: 10px; color: var(--text-color); font-weight: 700; @@ -550,13 +556,14 @@ text-align: center; } - .button-target-selection:hover, .target-selected { + .button-target-selection:hover, + .target-selected { font-weight: bold; text-shadow: 0px 0px 8px var(--text-color); } } } - + i { text-align: center; } @@ -608,7 +615,8 @@ margin: auto; } - .roll-difficulty, .target-hit-status { + .roll-difficulty, + .target-hit-status { color: @green; background-color: @green-10; border: 1px solid currentColor; @@ -628,9 +636,10 @@ margin-top: 2px; } - div[data-action="expandRoll"] { + div[data-action='expandRoll'] { .roll-part-header > div > span { - &:before, &:after { + &:before, + &:after { content: '\f078'; font-family: var(--font-awesome); color: var(--text-color); @@ -653,7 +662,8 @@ &.expanded { .roll-part-header > div > span { - &:before, &:after { + &:before, + &:after { transform: rotate(180deg); } } @@ -690,7 +700,7 @@ } } } - + .roll-buttons { display: flex; gap: 5px; diff --git a/styles/less/utils/colors.less b/styles/less/utils/colors.less index 1668f9f7..757fedfb 100755 --- a/styles/less/utils/colors.less +++ b/styles/less/utils/colors.less @@ -11,18 +11,14 @@ @chat-blue-40: #8f87ee40; @chat-blue-bg: #14142599; -@chat-purple: #f3c267; -@chat-purple-10: #f3c26710; -@chat-purple-40: #f3c26740; +@chat-purple: #a778b1; +@chat-purple-10: #a778b110; +@chat-purple-40: #a778b140; @chat-purple-bg: #2a152e99; -@red: #a778b1; -@red-10: #a778b110; -@red-40: #a778b140; - -@medium-red: #D04747; -@medium-red-10: #D0474710; -@medium-red-40: #D0474740; +@medium-red: #d04747; +@medium-red-10: #d0474710; +@medium-red-40: #d0474740; @dark-golden: #2b1d03; @dark-golden-80: #2b1d0380; diff --git a/templates/ui/chat/chat-message.hbs b/templates/ui/chat/chat-message.hbs index b3d29268..85cf03e2 100644 --- a/templates/ui/chat/chat-message.hbs +++ b/templates/ui/chat/chat-message.hbs @@ -3,14 +3,17 @@
-
-

{{ifThen message.title message.title alias}}

- {{#if actor.name}} + {{#if (eq message.type 'base')}} +
+

{{actor.name}}

+
{{author.name}}
+
+ {{else}} +
+

{{ifThen message.title message.title alias}}

{{actor.name}} {{#if author.isGM}}(GM){{/if}}
- {{else unless (eq message.type 'base')}} -
{{alias}}
- {{/if}} -
+
+ {{/if}}