mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Changed to instead render the description in the roll message
This commit is contained in:
parent
4f52d541b4
commit
357b94c128
8 changed files with 145 additions and 121 deletions
|
|
@ -31,6 +31,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
|||
static defineSchema() {
|
||||
return {
|
||||
title: new fields.StringField(),
|
||||
actionDescription: new fields.HTMLField(),
|
||||
roll: new fields.ObjectField(),
|
||||
targets: targetsField(),
|
||||
hasRoll: new fields.BooleanField({ initial: false }),
|
||||
|
|
|
|||
|
|
@ -98,8 +98,14 @@ export default class DHRoll extends Roll {
|
|||
static async toMessage(roll, config) {
|
||||
const item = config.data.parent?.items?.get?.(config.source.item) ?? null;
|
||||
const action = item ? item.system.actions.get(config.source.action) : null;
|
||||
if (action?.chatDisplay && !config.actionChatMessageHandled) {
|
||||
await action.toChat();
|
||||
let actionDescription = null;
|
||||
if (action?.chatDisplay) {
|
||||
actionDescription = action
|
||||
? await foundry.applications.ux.TextEditor.implementation.enrichHTML(action.description, {
|
||||
relativeTo: config.data,
|
||||
rollData: config.data.getRollData?.() ?? {}
|
||||
})
|
||||
: null;
|
||||
config.actionChatMessageHandled = true;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +116,7 @@ export default class DHRoll extends Roll {
|
|||
title: roll.title,
|
||||
speaker: cls.getSpeaker({ actor: roll.data?.parent }),
|
||||
sound: config.mute ? null : CONFIG.sounds.dice,
|
||||
system: config,
|
||||
system: { ...config, actionDescription },
|
||||
rolls: [roll]
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
} else if (s.classList.contains('damage-section'))
|
||||
s.classList.toggle('expanded', autoExpandRoll.damage);
|
||||
else if (s.classList.contains('target-section')) s.classList.toggle('expanded', autoExpandRoll.target);
|
||||
else if (s.classList.contains('description-section'))
|
||||
s.classList.toggle('expanded', autoExpandRoll.desc);
|
||||
});
|
||||
if (itemDesc && autoExpandRoll.desc) itemDesc.setAttribute('open', '');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export const preloadHandlebarsTemplates = async function () {
|
|||
'systems/daggerheart/templates/dialogs/downtime/activities.hbs',
|
||||
'systems/daggerheart/templates/dialogs/dice-roll/costSelection.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/roll-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/description-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/target-part.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/parts/button-part.hbs',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue