fix chatmessage to render the template in constructor. Update namespaces.

This commit is contained in:
IrkTheImp 2025-05-29 20:42:25 -05:00
parent 4de3e94fd7
commit cc6c9a11bc
10 changed files with 117 additions and 76 deletions

View file

@ -355,11 +355,14 @@ export default class DhpActor extends Actor {
const cls = getDocumentClass('ChatMessage');
const msg = new cls({
user: game.user.id,
content: await renderTemplate('systems/daggerheart/templates/chat/damage-roll.hbs', {
roll: roll.formula,
total: roll.result,
type: action.damage.type
})
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/chat/damage-roll.hbs',
{
roll: roll.formula,
total: roll.result,
type: action.damage.type
}
)
});
cls.create(msg.toObject());
@ -374,11 +377,14 @@ export default class DhpActor extends Actor {
const cls = getDocumentClass('ChatMessage');
const msg = new cls({
user: game.user.id,
content: await renderTemplate('systems/daggerheart/templates/chat/healing-roll.hbs', {
roll: roll.formula,
total: roll.result,
type: action.healing.type
})
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/chat/healing-roll.hbs',
{
roll: roll.formula,
total: roll.result,
type: action.healing.type
}
)
});
cls.create(msg.toObject());

View file

@ -38,25 +38,28 @@ export default class DhpItem extends Item {
}, {});
// Render the document creation form
const html = await renderTemplate('systems/daggerheart/templates/sidebar/documentCreate.hbs', {
folders,
name: data.name || game.i18n.format('DOCUMENT.New', { type: label }),
folder: data.folder,
hasFolders: folders.length >= 1,
type: data.type || CONFIG[documentName]?.defaultType || typeObjects.armor,
types: {
Items: [typeObjects.armor, typeObjects.weapon, typeObjects.consumable, typeObjects.miscellaneous],
Character: [
typeObjects.class,
typeObjects.subclass,
typeObjects.ancestry,
typeObjects.community,
typeObjects.feature,
typeObjects.domainCard
]
},
hasTypes: types.length > 1
});
const html = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sidebar/documentCreate.hbs',
{
folders,
name: data.name || game.i18n.format('DOCUMENT.New', { type: label }),
folder: data.folder,
hasFolders: folders.length >= 1,
type: data.type || CONFIG[documentName]?.defaultType || typeObjects.armor,
types: {
Items: [typeObjects.armor, typeObjects.weapon, typeObjects.consumable, typeObjects.miscellaneous],
Character: [
typeObjects.class,
typeObjects.subclass,
typeObjects.ancestry,
typeObjects.community,
typeObjects.feature,
typeObjects.domainCard
]
},
hasTypes: types.length > 1
}
);
// Render the confirmation dialog window
return Dialog.prompt({