mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
fix chatmessage to render the template in constructor. Update namespaces.
This commit is contained in:
parent
4de3e94fd7
commit
cc6c9a11bc
10 changed files with 117 additions and 76 deletions
|
|
@ -1,19 +1,28 @@
|
|||
import DhpDualityRoll from '../data/dualityRoll.mjs';
|
||||
import { DualityRollColor } from '../data/settings/Appearance.mjs';
|
||||
|
||||
export default class DhpChatMesssage extends ChatMessage {
|
||||
async renderHTML() {
|
||||
if (
|
||||
this.type === 'dualityRoll' ||
|
||||
this.type === 'adversaryRoll' ||
|
||||
this.type === 'damageRoll' ||
|
||||
this.type === 'abilityUse'
|
||||
) {
|
||||
this.content = await foundry.applications.handlebars.renderTemplate(this.content, this.system);
|
||||
}
|
||||
export default class DhpChatMessage extends ChatMessage {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
|
||||
if (
|
||||
data.type === 'dualityRoll' ||
|
||||
data.type === 'adversaryRoll' ||
|
||||
data.type === 'damageRoll' ||
|
||||
data.type === 'abilityUse'
|
||||
) {
|
||||
this.#templateInjection(data);
|
||||
}
|
||||
}
|
||||
|
||||
async #templateInjection(data) {
|
||||
return await foundry.applications.handlebars.renderTemplate(data.content, data.system);
|
||||
}
|
||||
|
||||
async renderHTML() {
|
||||
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
|
||||
const html = await super.renderHTML();
|
||||
|
||||
if (
|
||||
this.type === 'dualityRoll' &&
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue