daggerheart/module/applications/chatMessage.mjs
WBHarry c15d55a505
120 - Countdowns (#158)
* Added the shell of the Countdown application

* Added countdown automation

* Fixed overflow layout and added confirmation on countdown removal

* Added ownership to countdowns
2025-06-21 21:37:22 +02:00

23 lines
1,023 B
JavaScript

import { DualityRollColor } from '../data/settings/Appearance.mjs';
import DHDualityRoll from '../data/chat-message/dualityRoll.mjs';
export default class DhpChatMessage extends foundry.documents.ChatMessage {
async renderHTML() {
if (this.type === 'dualityRoll' || this.type === 'adversaryRoll') {
this.content = await foundry.applications.handlebars.renderTemplate(this.content, this.system);
}
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
const html = await super.renderHTML();
if (this.type === 'dualityRoll') {
html.classList.add('duality');
const dualityResult = this.system.dualityResult;
if (dualityResult === DHDualityRoll.dualityResult.hope) html.classList.add('hope');
else if (dualityResult === DHDualityRoll.dualityResult.fear) html.classList.add('fear');
else html.classList.add('critical');
}
return html;
}
}