mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Fix duplicate messages
This commit is contained in:
parent
c7f3ec8ab3
commit
a8b98bed38
16 changed files with 96 additions and 171 deletions
|
|
@ -1,11 +1,5 @@
|
|||
export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||
async renderHTML() {
|
||||
// if (this.system.messageTemplate)
|
||||
// this.content = await foundry.applications.handlebars.renderTemplate(this.system.messageTemplate, {
|
||||
// ...this.system,
|
||||
// _source: this.system._source
|
||||
// });
|
||||
|
||||
const actor = game.actors.get(this.speaker.actor);
|
||||
const actorData = actor && this.isContentVisible ? actor : {
|
||||
img: this.author.avatar ? this.author.avatar : 'icons/svg/mystery-man.svg',
|
||||
|
|
@ -20,17 +14,6 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
return html;
|
||||
}
|
||||
|
||||
/* async _preCreate(data, options, user) {
|
||||
options.speaker = ChatMessage.getSpeaker();
|
||||
const rollActorOwner = data.rolls?.[0]?.data?.parent?.owner;
|
||||
if (rollActorOwner) {
|
||||
data.author = rollActorOwner ? rollActorOwner.id : data.author;
|
||||
await this.updateSource({ author: rollActorOwner ?? user });
|
||||
}
|
||||
|
||||
return super._preCreate(data, options, rollActorOwner ?? user);
|
||||
} */
|
||||
|
||||
enrichChatMessage(html) {
|
||||
const elements = html.querySelectorAll('[data-perm-id]');
|
||||
elements.forEach(e => {
|
||||
|
|
@ -72,6 +55,10 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
element.addEventListener('mouseleave', this.unhoverTarget);
|
||||
element.addEventListener('click', this.clickTarget);
|
||||
});
|
||||
|
||||
html.querySelectorAll('.button-target-selection').forEach(element => {
|
||||
element.addEventListener('click', this.onTargetSelection.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
getTargetList() {
|
||||
|
|
@ -173,4 +160,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
}
|
||||
game.canvas.pan(token);
|
||||
}
|
||||
|
||||
onTargetSelection(event) {
|
||||
event.stopPropagation();
|
||||
this.system.targetMode = Boolean(event.target.dataset.targetHit);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue