mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Issue 80 Chatmessage fix (#81)
* fix chatmessage to render the template in constructor. Update namespaces. * update all chat messages to render templates
This commit is contained in:
parent
c94051744a
commit
7c792f409f
14 changed files with 230 additions and 171 deletions
|
|
@ -246,22 +246,26 @@ export default class DhpActor extends Actor {
|
|||
}
|
||||
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const systemData = {
|
||||
title: game.i18n.format('DAGGERHEART.Chat.DamageRoll.Title', { damage: title }),
|
||||
roll: rollString,
|
||||
damage: {
|
||||
total: rollResult.total,
|
||||
type: damage.type
|
||||
},
|
||||
dice: dice,
|
||||
modifiers: modifiers,
|
||||
targets: targets
|
||||
};
|
||||
const msg = new cls({
|
||||
type: 'damageRoll',
|
||||
user: game.user.id,
|
||||
sound: CONFIG.sounds.dice,
|
||||
system: {
|
||||
title: game.i18n.format('DAGGERHEART.Chat.DamageRoll.Title', { damage: title }),
|
||||
roll: rollString,
|
||||
damage: {
|
||||
total: rollResult.total,
|
||||
type: damage.type
|
||||
},
|
||||
dice: dice,
|
||||
modifiers: modifiers,
|
||||
targets: targets
|
||||
},
|
||||
content: 'systems/daggerheart/templates/chat/damage-roll.hbs',
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/chat/damage-roll.hbs',
|
||||
systemData
|
||||
),
|
||||
rolls: [roll]
|
||||
});
|
||||
|
||||
|
|
@ -355,11 +359,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 +381,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());
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue