[BUG] - Sending an active effect to chat doesnt work (#727)

Fixes #616

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-08-08 18:32:32 -03:00 committed by GitHub
parent 45b3569cba
commit 85982bac8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 33 additions and 34 deletions

View file

@ -124,15 +124,20 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
return tags;
}
/**
* Create a new ChatMessage to display this documents data.
* @param {String} origin - uuid of a document. TODO: This needs to be reviewed.
*/
async toChat(origin) {
/**@type {foundry.documents.ChatMessage} */
const cls = getDocumentClass('ChatMessage');
const actor = game.actors.get(cls.getSpeaker().actor);
const speaker = cls.getSpeaker();
const actor = cls.getSpeakerActor(speaker);
const systemData = {
action: { img: this.img, name: this.name },
actor: { name: actor.name, img: actor.img },
author: this.author,
speaker: cls.getSpeaker(),
origin: origin,
actor: { name: actor?.name, img: actor?.img },
speaker,
origin,
description: this.description,
actions: []
};

View file

@ -142,19 +142,16 @@ export default class DHItem extends foundry.documents.Item {
}
}
/**
* Create a new ChatMessage to display this documents data
* @param {String} origin - uuid of a document. TODO: This needs to be reviewed.
*/
async toChat(origin) {
/**@type {foundry.documents.ChatMessage} */
const cls = getDocumentClass('ChatMessage');
const item = await foundry.utils.fromUuid(origin);
const systemData = {
title:
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'),
origin: origin,
img: this.img,
item: {
@ -170,7 +167,6 @@ export default class DHItem extends foundry.documents.Item {
type: 'abilityUse',
user: game.user.id,
actor: item.parent,
author: this.author,
speaker: cls.getSpeaker(),
system: systemData,
title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'),