mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +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
|
|
@ -774,7 +774,8 @@
|
||||||
"AbilityCheckTitle": "{ability} Check"
|
"AbilityCheckTitle": "{ability} Check"
|
||||||
},
|
},
|
||||||
"AttackRoll": {
|
"AttackRoll": {
|
||||||
"Title": "Attack - {attack}"
|
"Title": "Attack - {attack}",
|
||||||
|
"RollDamage": "Roll Damage"
|
||||||
},
|
},
|
||||||
"DamageRoll": {
|
"DamageRoll": {
|
||||||
"Title": "Damage - {damage}",
|
"Title": "Damage - {damage}",
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,11 @@
|
||||||
import DhpDualityRoll from '../data/dualityRoll.mjs';
|
import DhpDualityRoll from '../data/dualityRoll.mjs';
|
||||||
import { DualityRollColor } from '../data/settings/Appearance.mjs';
|
import { DualityRollColor } from '../data/settings/Appearance.mjs';
|
||||||
|
|
||||||
export default class DhpChatMesssage extends ChatMessage {
|
export default class DhpChatMessage extends ChatMessage {
|
||||||
async renderHTML() {
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
|
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
|
||||||
const html = await super.renderHTML();
|
const html = await super.renderHTML();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.type === 'dualityRoll' &&
|
this.type === 'dualityRoll' &&
|
||||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,15 @@ export default class DhpDeathMove extends HandlebarsApplicationMixin(Application
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/deathMove.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
player: this.actor.name,
|
'systems/daggerheart/templates/chat/deathMove.hbs',
|
||||||
title: game.i18n.localize(this.selectedMove.name),
|
{
|
||||||
img: this.selectedMove.img,
|
player: this.actor.name,
|
||||||
description: game.i18n.localize(this.selectedMove.description)
|
title: game.i18n.localize(this.selectedMove.name),
|
||||||
})
|
img: this.selectedMove.img,
|
||||||
|
description: game.i18n.localize(this.selectedMove.description)
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
|
||||||
|
|
@ -70,13 +70,16 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/downtime.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
player: this.actor.name,
|
'systems/daggerheart/templates/chat/downtime.hbs',
|
||||||
title: game.i18n.localize(this.selectedActivity.name),
|
{
|
||||||
img: this.selectedActivity.img,
|
player: this.actor.name,
|
||||||
description: game.i18n.localize(this.selectedActivity.description),
|
title: game.i18n.localize(this.selectedActivity.name),
|
||||||
refreshedFeatures: refreshedFeatures
|
img: this.selectedActivity.img,
|
||||||
})
|
description: game.i18n.localize(this.selectedActivity.description),
|
||||||
|
refreshedFeatures: refreshedFeatures
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
|
||||||
|
|
@ -330,15 +330,19 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
const systemData = {
|
||||||
|
roll: roll._formula,
|
||||||
|
total: roll._total,
|
||||||
|
modifiers: modifiers,
|
||||||
|
diceResults: diceResults
|
||||||
|
};
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'adversaryRoll',
|
type: 'adversaryRoll',
|
||||||
system: {
|
system: systemData,
|
||||||
roll: roll._formula,
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
total: roll._total,
|
'systems/daggerheart/templates/chat/adversary-roll.hbs',
|
||||||
modifiers: modifiers,
|
systemData
|
||||||
diceResults: diceResults
|
),
|
||||||
},
|
|
||||||
content: 'systems/daggerheart/templates/chat/adversary-roll.hbs',
|
|
||||||
rolls: [roll]
|
rolls: [roll]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -362,21 +366,25 @@ export default class AdversarySheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
const systemData = {
|
||||||
|
title: button.dataset.name,
|
||||||
|
origin: this.document.id,
|
||||||
|
roll: roll._formula,
|
||||||
|
advantageState,
|
||||||
|
total: roll._total,
|
||||||
|
modifiers: modifiers,
|
||||||
|
dice: dice,
|
||||||
|
targets: targets,
|
||||||
|
damage: { value: button.dataset.damage, type: button.dataset.damageType }
|
||||||
|
};
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'adversaryRoll',
|
type: 'adversaryRoll',
|
||||||
sound: CONFIG.sounds.dice,
|
sound: CONFIG.sounds.dice,
|
||||||
system: {
|
system: systemData,
|
||||||
title: button.dataset.name,
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
origin: this.document.id,
|
'systems/daggerheart/templates/chat/adversary-attack-roll.hbs',
|
||||||
roll: roll._formula,
|
systemData
|
||||||
advantageState,
|
),
|
||||||
total: roll._total,
|
|
||||||
modifiers: modifiers,
|
|
||||||
dice: dice,
|
|
||||||
targets: targets,
|
|
||||||
damage: { value: button.dataset.damage, type: button.dataset.damageType }
|
|
||||||
},
|
|
||||||
content: 'systems/daggerheart/templates/chat/adversary-attack-roll.hbs',
|
|
||||||
rolls: [roll]
|
rolls: [roll]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,10 +123,15 @@ export default class DhpEnvironment extends DaggerheartSheet(DocumentSheetV2) {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/ability-use.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
title: game.i18n.format('DAGGERHEART.Chat.EnvironmentTitle', { actionType: button.dataset.actionType }),
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
card: { name: item.name, img: item.img, description: item.system.description }
|
{
|
||||||
})
|
title: game.i18n.format('DAGGERHEART.Chat.EnvironmentTitle', {
|
||||||
|
actionType: button.dataset.actionType
|
||||||
|
}),
|
||||||
|
card: { name: item.name, img: item.img, description: item.system.description }
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
|
||||||
|
|
@ -494,27 +494,33 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msgData = {
|
|
||||||
type: 'dualityRoll',
|
const systemContent = {
|
||||||
sound: CONFIG.sounds.dice,
|
title: game.i18n.format('DAGGERHEART.Chat.DualityRoll.AbilityCheckTitle', {
|
||||||
system: {
|
ability: game.i18n.localize(abilities[button.dataset.attribute].label)
|
||||||
title: game.i18n.format('DAGGERHEART.Chat.DualityRoll.AbilityCheckTitle', {
|
}),
|
||||||
ability: game.i18n.localize(abilities[button.dataset.attribute].label)
|
origin: this.document.id,
|
||||||
}),
|
roll: roll._formula,
|
||||||
origin: this.document.id,
|
modifiers: modifiers,
|
||||||
roll: roll._formula,
|
hope: hope,
|
||||||
modifiers: modifiers,
|
fear: fear,
|
||||||
hope: hope,
|
advantage: advantage,
|
||||||
fear: fear,
|
disadvantage: disadvantage
|
||||||
advantage: advantage,
|
|
||||||
disadvantage: disadvantage
|
|
||||||
},
|
|
||||||
user: game.user.id,
|
|
||||||
content: 'systems/daggerheart/templates/chat/duality-roll.hbs',
|
|
||||||
rolls: [roll]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await cls.create(msgData);
|
const msg = new cls({
|
||||||
|
type: 'dualityRoll',
|
||||||
|
sound: CONFIG.sounds.dice,
|
||||||
|
system: systemContent,
|
||||||
|
user: game.user.id,
|
||||||
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
|
'systems/daggerheart/templates/chat/duality-roll.hbs',
|
||||||
|
systemContent
|
||||||
|
),
|
||||||
|
rolls: [roll]
|
||||||
|
});
|
||||||
|
|
||||||
|
await cls.create(msg.toObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
static async toggleMarks(_, button) {
|
static async toggleMarks(_, button) {
|
||||||
|
|
@ -588,23 +594,28 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
evasion: x.actor.system.evasion
|
evasion: x.actor.system.evasion
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const systemData = {
|
||||||
|
title: weapon.name,
|
||||||
|
origin: this.document.id,
|
||||||
|
roll: roll._formula,
|
||||||
|
modifiers: modifiers,
|
||||||
|
hope: hope,
|
||||||
|
fear: fear,
|
||||||
|
advantage: advantage,
|
||||||
|
disadvantage: disadvantage,
|
||||||
|
damage: damage,
|
||||||
|
targets: targets
|
||||||
|
};
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'dualityRoll',
|
type: 'dualityRoll',
|
||||||
sound: CONFIG.sounds.dice,
|
sound: CONFIG.sounds.dice,
|
||||||
system: {
|
system: systemData,
|
||||||
title: weapon.name,
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
origin: this.document.id,
|
'systems/daggerheart/templates/chat/attack-roll.hbs',
|
||||||
roll: roll._formula,
|
systemData
|
||||||
modifiers: modifiers,
|
),
|
||||||
hope: hope,
|
|
||||||
fear: fear,
|
|
||||||
advantage: advantage,
|
|
||||||
disadvantage: disadvantage,
|
|
||||||
damage: damage,
|
|
||||||
targets: targets
|
|
||||||
},
|
|
||||||
content: 'systems/daggerheart/templates/chat/attack-roll.hbs',
|
|
||||||
rolls: [roll]
|
rolls: [roll]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -642,17 +653,21 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
const card = this.document.items.find(x => x.uuid === button.dataset.key);
|
const card = this.document.items.find(x => x.uuid === button.dataset.key);
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
const systemData = {
|
||||||
|
title: `${game.i18n.localize('DAGGERHEART.Chat.DomainCard.Title')} - ${capitalize(button.dataset.domain)}`,
|
||||||
|
img: card.img,
|
||||||
|
name: card.name,
|
||||||
|
description: card.system.effect,
|
||||||
|
actions: card.system.actions
|
||||||
|
};
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'abilityUse',
|
type: 'abilityUse',
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: 'systems/daggerheart/templates/chat/ability-use.hbs',
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
system: {
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
title: `${game.i18n.localize('DAGGERHEART.Chat.DomainCard.Title')} - ${capitalize(button.dataset.domain)}`,
|
systemData
|
||||||
img: card.img,
|
),
|
||||||
name: card.name,
|
system: systemData
|
||||||
description: card.system.effect,
|
|
||||||
actions: card.system.actions
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
@ -790,13 +805,16 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/ability-use.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
title: game.i18n.localize('DAGGERHEART.Chat.FeatureTitle'),
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
card: {
|
{
|
||||||
name: `${feature.name} - Roll Of ${feature.system.featureType.data.numbers[index].value}`,
|
title: game.i18n.localize('DAGGERHEART.Chat.FeatureTitle'),
|
||||||
img: feature.img
|
card: {
|
||||||
|
name: `${feature.name} - Roll Of ${feature.system.featureType.data.numbers[index].value}`,
|
||||||
|
img: feature.img
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
@ -852,17 +870,21 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
const item = await fromUuid(button.dataset.id);
|
const item = await fromUuid(button.dataset.id);
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
const systemData = {
|
||||||
|
title: game.i18n.localize('DAGGERHEART.Chat.FeatureTitle'),
|
||||||
|
img: item.img,
|
||||||
|
name: item.name,
|
||||||
|
description: item.system.description,
|
||||||
|
actions: item.system.actions
|
||||||
|
};
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'abilityUse',
|
type: 'abilityUse',
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: 'systems/daggerheart/templates/chat/ability-use.hbs',
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
system: {
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
title: game.i18n.localize('DAGGERHEART.Chat.FeatureTitle'),
|
systemData
|
||||||
img: item.img,
|
),
|
||||||
name: item.name,
|
system: systemData
|
||||||
description: item.system.description,
|
|
||||||
actions: item.system.actions
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
@ -873,22 +895,26 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
const type = button.dataset.type;
|
const type = button.dataset.type;
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
const systemData = {
|
||||||
|
title:
|
||||||
|
type === 'ancestry'
|
||||||
|
? game.i18n.localize('DAGGERHEART.Chat.FoundationCard.AncestryTitle')
|
||||||
|
: type === 'community'
|
||||||
|
? game.i18n.localize('DAGGERHEART.Chat.FoundationCard.CommunityTitle')
|
||||||
|
: game.i18n.localize('DAGGERHEART.Chat.FoundationCard.SubclassFeatureTitle'),
|
||||||
|
img: item.img,
|
||||||
|
name: item.name,
|
||||||
|
description: item.system.description,
|
||||||
|
actions: []
|
||||||
|
};
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
type: 'abilityUse',
|
type: 'abilityUse',
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
system: {
|
system: systemData,
|
||||||
title:
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
type === 'ancestry'
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
? game.i18n.localize('DAGGERHEART.Chat.FoundationCard.AncestryTitle')
|
systemData
|
||||||
: type === 'community'
|
)
|
||||||
? game.i18n.localize('DAGGERHEART.Chat.FoundationCard.CommunityTitle')
|
|
||||||
: game.i18n.localize('DAGGERHEART.Chat.FoundationCard.SubclassFeatureTitle'),
|
|
||||||
img: item.img,
|
|
||||||
name: item.name,
|
|
||||||
description: item.system.description,
|
|
||||||
actions: []
|
|
||||||
},
|
|
||||||
content: 'systems/daggerheart/templates/chat/ability-use.hbs'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
@ -905,10 +931,13 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/ability-use.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
title: game.i18n.localize('DAGGERHEART.Chat.FoundationCard.SubclassFeatureTitle'),
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
card: { name: title, img: item.img, description: ability.description }
|
{
|
||||||
})
|
title: game.i18n.localize('DAGGERHEART.Chat.FoundationCard.SubclassFeatureTitle'),
|
||||||
|
card: { name: title, img: item.img, description: ability.description }
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
@ -921,10 +950,13 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/ability-use.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
title: game.i18n.localize('DAGGERHEART.Chat.FoundationCard.SubclassFeatureTitle'),
|
'systems/daggerheart/templates/chat/ability-use.hbs',
|
||||||
card: { name: item.name, img: item.img, description: item.system.description }
|
{
|
||||||
})
|
title: game.i18n.localize('DAGGERHEART.Chat.FoundationCard.SubclassFeatureTitle'),
|
||||||
|
card: { name: item.name, img: item.img, description: item.system.description }
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ export default class DhpPC extends foundry.abstract.TypeDataModel {
|
||||||
get refreshableFeatures() {
|
get refreshableFeatures() {
|
||||||
return this.parent.items.reduce(
|
return this.parent.items.reduce(
|
||||||
(acc, x) => {
|
(acc, x) => {
|
||||||
if (x.type === 'feature' && x.system.refreshData?.type) {
|
if (x.type === 'feature' && x.system.refreshData?.type === 'feature' && x.system.refreshData?.type) {
|
||||||
acc[x.system.refreshData.type].push(x);
|
acc[x.system.refreshData.type].push(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,12 @@ export default class SelectDialog extends Dialog {
|
||||||
this.data = {
|
this.data = {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
buttons: data.buttons,
|
buttons: data.buttons,
|
||||||
content: renderTemplate('systems/daggerheart/templates/dialog/item-select.hbs', {
|
content: foundry.applications.handlebars.renderTemplate(
|
||||||
items: data.choices
|
'systems/daggerheart/templates/dialog/item-select.hbs',
|
||||||
})
|
{
|
||||||
|
items: data.choices
|
||||||
|
}
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
this.actor = data.actor;
|
this.actor = data.actor;
|
||||||
|
|
|
||||||
|
|
@ -246,22 +246,26 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
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({
|
const msg = new cls({
|
||||||
type: 'damageRoll',
|
type: 'damageRoll',
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
sound: CONFIG.sounds.dice,
|
sound: CONFIG.sounds.dice,
|
||||||
system: {
|
system: systemData,
|
||||||
title: game.i18n.format('DAGGERHEART.Chat.DamageRoll.Title', { damage: title }),
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
roll: rollString,
|
'systems/daggerheart/templates/chat/damage-roll.hbs',
|
||||||
damage: {
|
systemData
|
||||||
total: rollResult.total,
|
),
|
||||||
type: damage.type
|
|
||||||
},
|
|
||||||
dice: dice,
|
|
||||||
modifiers: modifiers,
|
|
||||||
targets: targets
|
|
||||||
},
|
|
||||||
content: 'systems/daggerheart/templates/chat/damage-roll.hbs',
|
|
||||||
rolls: [roll]
|
rolls: [roll]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -355,11 +359,14 @@ export default class DhpActor extends Actor {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/damage-roll.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
roll: roll.formula,
|
'systems/daggerheart/templates/chat/damage-roll.hbs',
|
||||||
total: roll.result,
|
{
|
||||||
type: action.damage.type
|
roll: roll.formula,
|
||||||
})
|
total: roll.result,
|
||||||
|
type: action.damage.type
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
@ -374,11 +381,14 @@ export default class DhpActor extends Actor {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = new cls({
|
const msg = new cls({
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
content: await renderTemplate('systems/daggerheart/templates/chat/healing-roll.hbs', {
|
content: await foundry.applications.handlebars.renderTemplate(
|
||||||
roll: roll.formula,
|
'systems/daggerheart/templates/chat/healing-roll.hbs',
|
||||||
total: roll.result,
|
{
|
||||||
type: action.healing.type
|
roll: roll.formula,
|
||||||
})
|
total: roll.result,
|
||||||
|
type: action.healing.type
|
||||||
|
}
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
cls.create(msg.toObject());
|
cls.create(msg.toObject());
|
||||||
|
|
|
||||||
|
|
@ -38,25 +38,28 @@ export default class DhpItem extends Item {
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
// Render the document creation form
|
// Render the document creation form
|
||||||
const html = await renderTemplate('systems/daggerheart/templates/sidebar/documentCreate.hbs', {
|
const html = await foundry.applications.handlebars.renderTemplate(
|
||||||
folders,
|
'systems/daggerheart/templates/sidebar/documentCreate.hbs',
|
||||||
name: data.name || game.i18n.format('DOCUMENT.New', { type: label }),
|
{
|
||||||
folder: data.folder,
|
folders,
|
||||||
hasFolders: folders.length >= 1,
|
name: data.name || game.i18n.format('DOCUMENT.New', { type: label }),
|
||||||
type: data.type || CONFIG[documentName]?.defaultType || typeObjects.armor,
|
folder: data.folder,
|
||||||
types: {
|
hasFolders: folders.length >= 1,
|
||||||
Items: [typeObjects.armor, typeObjects.weapon, typeObjects.consumable, typeObjects.miscellaneous],
|
type: data.type || CONFIG[documentName]?.defaultType || typeObjects.armor,
|
||||||
Character: [
|
types: {
|
||||||
typeObjects.class,
|
Items: [typeObjects.armor, typeObjects.weapon, typeObjects.consumable, typeObjects.miscellaneous],
|
||||||
typeObjects.subclass,
|
Character: [
|
||||||
typeObjects.ancestry,
|
typeObjects.class,
|
||||||
typeObjects.community,
|
typeObjects.subclass,
|
||||||
typeObjects.feature,
|
typeObjects.ancestry,
|
||||||
typeObjects.domainCard
|
typeObjects.community,
|
||||||
]
|
typeObjects.feature,
|
||||||
},
|
typeObjects.domainCard
|
||||||
hasTypes: types.length > 1
|
]
|
||||||
});
|
},
|
||||||
|
hasTypes: types.length > 1
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Render the confirmation dialog window
|
// Render the confirmation dialog window
|
||||||
return Dialog.prompt({
|
return Dialog.prompt({
|
||||||
|
|
|
||||||
|
|
@ -2828,14 +2828,14 @@ div.daggerheart.views.multiclass {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
src: url(https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-.ttf) format('truetype');
|
src: url(https://fonts.gstatic.com/s/montserrat/v30/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-.ttf) format('truetype');
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Montserrat';
|
font-family: 'Montserrat';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
src: url(https://fonts.gstatic.com/s/montserrat/v29/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCu170w-.ttf) format('truetype');
|
src: url(https://fonts.gstatic.com/s/montserrat/v30/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCu170w-.ttf) format('truetype');
|
||||||
}
|
}
|
||||||
.application.sheet.daggerheart.dh-style h1 {
|
.application.sheet.daggerheart.dh-style h1 {
|
||||||
font-family: 'Cinzel Decorative', serif;
|
font-family: 'Cinzel Decorative', serif;
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="dice-actions">
|
<div class="dice-actions">
|
||||||
<button class="duality-action" data-value="{{this.total}}" data-damage="{{this.damage.value}}" data-damage-type="{{this.damage.type}}" {{#if this.damage.disabled}}disabled{{/if}}><span>Roll Damage</span></button>
|
<button class="duality-action" data-value="{{this.total}}" data-damage="{{this.damage.value}}" data-damage-type="{{this.damage.type}}" {{#if this.damage.disabled}}disabled{{/if}}><span>{{localize "DAGGERHEART.Chat.AttackRoll.RollDamage"}}</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dice-total">{{this.damage.total}}</div>
|
<div class="dice-total">{{this.damage.total}}</div>
|
||||||
<div class="dice-actions">
|
<div class="dice-actions">
|
||||||
<button class="damage-button" data-target-hit="true" {{#if (eq this.targets.length 0)}}disabled{{/if}}>{{localize "DAGGERHEART.Chat.DamageRoll.DealDamageToTargets"}}</button>
|
<button class="damage-button" data-target-hit="true" {{#if (eq this.targets.length 0)}}disabled{{/if}}>{{localize "DAGGERHEART.Chat.DamageRoll.DealDamageToTargets"}}</button>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue