mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[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:
parent
45b3569cba
commit
85982bac8c
7 changed files with 33 additions and 34 deletions
|
|
@ -124,15 +124,20 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ChatMessage to display this document’s 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: []
|
||||
};
|
||||
|
|
|
|||
|
|
@ -142,19 +142,16 @@ export default class DHItem extends foundry.documents.Item {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ChatMessage to display this document’s 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'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue