Roll Chat message new design template

This commit is contained in:
Dapoolp 2025-07-30 21:40:42 +02:00
parent f14cb3936a
commit a3ef43aad6
21 changed files with 733 additions and 276 deletions

View file

@ -47,7 +47,7 @@ export default class DhpDeathMove extends HandlebarsApplicationMixin(Application
static async takeMove() {
const cls = getDocumentClass('ChatMessage');
const msg = new cls({
const msg = {
user: game.user.id,
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/ui/chat/deathMove.hbs',
@ -55,20 +55,23 @@ export default class DhpDeathMove extends HandlebarsApplicationMixin(Application
player: this.actor.name,
actor: { name: this.actor.name, img: this.actor.img },
author: game.users.get(game.user.id),
speaker: cls.getSpeaker(),
title: game.i18n.localize(this.selectedMove.name),
img: this.selectedMove.img,
description: game.i18n.localize(this.selectedMove.description)
}
),
title: game.i18n.localize(
'DAGGERHEART.UI.Chat.deathMove.title'
),
speaker: cls.getSpeaker(),
flags: {
daggerheart: {
cssClass: 'dh-chat-message dh-style'
}
}
});
};
cls.create(msg.toObject());
cls.create(msg);
this.close();
}

View file

@ -133,7 +133,7 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
});
const cls = getDocumentClass('ChatMessage');
const msg = new cls({
const msg = {
user: game.user.id,
system: {
moves: moves,
@ -158,9 +158,9 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
cssClass: 'dh-chat-message dh-style'
}
}
});
};
cls.create(msg.toObject());
cls.create(msg);
// Reset selection and update number of taken moves
for (const [catName, category] of Object.entries(this.moveData)) {

View file

@ -74,7 +74,7 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli
this.resetUsed = true;
const cls = getDocumentClass('ChatMessage');
const msg = new cls({
const msg = {
user: game.user.id,
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/ui/chat/resource-roll.hbs',
@ -83,9 +83,9 @@ export default class ResourceDiceDialog extends HandlebarsApplicationMixin(Appli
name: this.item.name
}
)
});
};
cls.create(msg.toObject());
cls.create(msg);
this.close();
}

View file

@ -8,10 +8,6 @@ export default class DHAttackAction extends DHDamageAction {
return parent.parent.type === 'weapon' ? 'attack' : 'spellcast';
}
get chatTemplate() {
return 'systems/daggerheart/templates/ui/chat/duality-roll.hbs';
}
prepareData() {
super.prepareData();
if (!!this.item?.system?.attack) {

View file

@ -69,10 +69,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
: this.item?.actor;
}
get chatTemplate() {
return 'systems/daggerheart/templates/ui/chat/duality-roll.hbs';
}
static getRollType(parent) {
return 'trait';
}

View file

@ -1,4 +1,3 @@
import DHBaseAction from './baseAction.mjs';
import DHDamageAction from './damageAction.mjs';
export default class DHHealingAction extends DHDamageAction {
@ -7,49 +6,4 @@ export default class DHHealingAction extends DHDamageAction {
static getRollType(parent) {
return 'spellcast';
}
/* static extraSchemas = [...super.extraSchemas, 'target', 'effects', 'healing', 'roll'];
static getRollType(parent) {
return 'spellcast';
}
getFormulaValue(data) {
let formulaValue = this.healing.value;
if (this.hasRoll && this.healing.resultBased && data.system.roll.result.duality === -1)
return this.healing.valueAlt;
return formulaValue;
}
async rollHealing(event, data) {
const systemData = data.system ?? data;
let formulas = [
{
formula: this.getFormulaValue(data).getFormula(this.actor),
applyTo: this.healing.applyTo
}
];
const config = {
title: game.i18n.format('DAGGERHEART.UI.Chat.healingRoll.title', {
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.applyTo].label)
}),
roll: formulas,
targets: systemData.targets?.filter(t => t.hit),
messageType: 'healing',
source: systemData.source,
data: this.getRollData(),
event
};
return CONFIG.Dice.daggerheart.DamageRoll.build(config);
}
get chatTemplate() {
return 'systems/daggerheart/templates/ui/chat/healing-roll.hbs';
}
get modifiers() {
return [];
} */
}

View file

@ -2,6 +2,6 @@ import DHAdversaryRoll from './adversaryRoll.mjs';
export default class DHDualityRoll extends DHAdversaryRoll {
get messageTemplate() {
return 'systems/daggerheart/templates/ui/chat/duality-roll.hbs';
return 'systems/daggerheart/templates/ui/chat/duality-roll-temp.hbs';
}
}

View file

@ -19,6 +19,12 @@ export default class D20Roll extends DHRoll {
static DefaultDialog = D20RollDialog;
get title() {
return game.i18n.localize(
"DAGGERHEART.GENERAL.d20Roll"
);
}
get d20() {
if (!(this.terms[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
return this.terms[0];

View file

@ -7,6 +7,12 @@ export default class DHRoll extends Roll {
if (!this.data || !Object.keys(this.data).length) this.data = options.data;
}
get title() {
return game.i18n.localize(
"DAGGERHEART.GENERAL.Roll"
);
}
static messageType = 'adversaryRoll';
static DefaultDialog = D20RollDialog;
@ -85,6 +91,8 @@ export default class DHRoll extends Roll {
msg = {
type: this.messageType,
user: game.user.id,
title: roll.title,
speaker: cls.getSpeaker(),
sound: config.mute ? null : CONFIG.sounds.dice,
system: config,
rolls: [roll]

View file

@ -17,6 +17,12 @@ export default class DualityRoll extends D20Roll {
static DefaultDialog = D20RollDialog;
get title() {
return game.i18n.localize(
"DAGGERHEART.GENERAL.dualityRoll"
);
}
get dHope() {
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
if (!(this.dice[0] instanceof CONFIG.Dice.daggerheart.DualityDie)) this.createBaseDice();

View file

@ -92,7 +92,7 @@ export default class DhActiveEffect extends ActiveEffect {
description: this.description,
actions: []
};
const msg = new cls({
const msg = {
type: 'abilityUse',
user: game.user.id,
system: systemData,
@ -100,8 +100,8 @@ export default class DhActiveEffect extends ActiveEffect {
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
systemData
)
});
};
cls.create(msg.toObject());
cls.create(msg);
}
}

View file

@ -125,7 +125,7 @@ export default class DHItem extends foundry.documents.Item {
description: this.system.description,
actions: this.system.actions
};
const msg = new cls({
const msg = {
type: 'abilityUse',
user: game.user.id,
actor: this.actor,
@ -142,8 +142,8 @@ export default class DHItem extends foundry.documents.Item {
cssClass: 'dh-chat-message dh-style'
}
}
});
};
cls.create(msg.toObject());
cls.create(msg);
}
}