From 57f19c41cd3dafbd553f634949f50115f53a2ec0 Mon Sep 17 00:00:00 2001 From: moliloo Date: Fri, 1 Aug 2025 02:06:14 -0300 Subject: [PATCH] fix _getTags type error and add a alias label for non base messages --- module/documents/item.mjs | 24 +++++++++++-------- .../less/sheets/actors/adversary/sidebar.less | 1 + .../less/sheets/actors/character/sidebar.less | 1 + styles/less/ui/chat/ability-use.less | 1 + templates/ui/chat/chat-message.hbs | 2 ++ 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 05cba838..3c074f44 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -74,8 +74,8 @@ export default class DHItem extends foundry.documents.Item { isInventoryItem === true ? 'Inventory Items' //TODO localize : isInventoryItem === false - ? 'Character Items' //TODO localize - : 'Other'; //TODO localize + ? 'Character Items' //TODO localize + : 'Other'; //TODO localize return { value: type, label, group }; } @@ -102,9 +102,9 @@ export default class DHItem extends foundry.documents.Item { * Generate an array of localized tag. * @returns {string[]} An array of localized tag strings. */ - getTags() { + _getTags() { const tags = []; - if (this.system.getTags) tags.push(...this.system.getTags()); + if (this.system._getTags) tags.push(...this.system._getTags()); return tags; } @@ -137,20 +137,24 @@ export default class DHItem extends foundry.documents.Item { this.type === 'ancestry' ? game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.ancestryTitle') : this.type === 'community' - ? game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.communityTitle') - : this.type === 'feature' - ? game.i18n.localize('TYPES.Item.feature') - : game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.subclassFeatureTitle'), + ? game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.communityTitle') + : this.type === 'feature' + ? game.i18n.localize('TYPES.Item.feature') + : game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.subclassFeatureTitle'), origin: origin, img: this.img, - item: { name: this.name, img: this.img, tags: this.tags ? this.tags : ['Spell', 'Arcana', 'Lv 10'] }, + item: { + name: this.name, + img: this.img, + tags: this._getTags() + }, description: this.system.description, actions: this.system.actions }; const msg = { type: 'abilityUse', user: game.user.id, - actor: this.actor, + actor: game.actors.get(cls.getSpeaker().actor), author: this.author, speaker: cls.getSpeaker(), system: systemData, diff --git a/styles/less/sheets/actors/adversary/sidebar.less b/styles/less/sheets/actors/adversary/sidebar.less index f8a34874..9df34d0b 100644 --- a/styles/less/sheets/actors/adversary/sidebar.less +++ b/styles/less/sheets/actors/adversary/sidebar.less @@ -262,6 +262,7 @@ display: flex; flex-direction: column; gap: 5px; + margin-bottom: 10px; .inventory-item { padding: 0 10px; diff --git a/styles/less/sheets/actors/character/sidebar.less b/styles/less/sheets/actors/character/sidebar.less index 7cfeffac..dade67ea 100644 --- a/styles/less/sheets/actors/character/sidebar.less +++ b/styles/less/sheets/actors/character/sidebar.less @@ -351,6 +351,7 @@ display: flex; flex-direction: column; gap: 5px; + margin-bottom: 10px; .inventory-item { padding: 0 10px; diff --git a/styles/less/ui/chat/ability-use.less b/styles/less/ui/chat/ability-use.less index 687579cb..3e747380 100644 --- a/styles/less/ui/chat/ability-use.less +++ b/styles/less/ui/chat/ability-use.less @@ -64,6 +64,7 @@ .tags { display: flex; gap: 10px; + flex-wrap: wrap; .tag { display: flex; diff --git a/templates/ui/chat/chat-message.hbs b/templates/ui/chat/chat-message.hbs index 4132e495..b3d29268 100644 --- a/templates/ui/chat/chat-message.hbs +++ b/templates/ui/chat/chat-message.hbs @@ -7,6 +7,8 @@

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

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