mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Feature/chat message styles (#514)
* style items and action chat messages * enhance death move chat message and fix border bottom from title actions * fix padding bottom * Added basic chat-message.hbs * . * style remaing chat messages * style action messages * remove console log * add colapsable descriptions in chat messages * inital style for message rolls * fix deal damage button style * add new partchments * Roll Chat message new design template * j * l * p * y * fix _getTags type error and add a alias label for non base messages * Fix damage & healing roll * Fix conflict * Deleting old templates * Good for now * fix labels in duality rolls messages and style experience and effects messages --------- Co-authored-by: WBHarry <williambjrklund@gmail.com> Co-authored-by: Dapoolp <elcatnet@gmail.com>
This commit is contained in:
parent
a4b1130142
commit
74df2c4e87
72 changed files with 1661 additions and 996 deletions
|
|
@ -115,24 +115,26 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
|
||||
async toChat(origin) {
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const actor = game.actors.get(cls.getSpeaker().actor);
|
||||
const systemData = {
|
||||
title: game.i18n.localize('DAGGERHEART.CONFIG.ActionType.action'),
|
||||
action: { img: this.img, name: this.name },
|
||||
actor: { name: actor.name, img: actor.img },
|
||||
author: this.author,
|
||||
speaker: cls.getSpeaker(),
|
||||
origin: origin,
|
||||
img: this.img,
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
actions: []
|
||||
};
|
||||
const msg = new cls({
|
||||
type: 'abilityUse',
|
||||
const msg = {
|
||||
title: game.i18n.localize('DAGGERHEART.GENERAL.Effect.single'),
|
||||
user: game.user.id,
|
||||
system: systemData,
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
'systems/daggerheart/templates/ui/chat/action.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
};
|
||||
|
||||
cls.create(msg.toObject());
|
||||
cls.create(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -541,12 +541,12 @@ export default class DhpActor extends Actor {
|
|||
}
|
||||
|
||||
canResist(type, resistance) {
|
||||
if (!type) return 0;
|
||||
if (!type?.length) return false;
|
||||
return type.every(t => this.system.resistance[t]?.[resistance] === true);
|
||||
}
|
||||
|
||||
getDamageTypeReduction(type) {
|
||||
if (!type) return 0;
|
||||
if (!type?.length) return 0;
|
||||
const reduction = Object.entries(this.system.resistance).reduce(
|
||||
(a, [index, value]) => (type.includes(index) ? Math.min(value.reduction, a) : a),
|
||||
Infinity
|
||||
|
|
|
|||
|
|
@ -6,13 +6,18 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
_source: this.system._source
|
||||
});
|
||||
|
||||
const actor = game.actors.get(this.speaker.actor);
|
||||
const actorData = actor ?? {
|
||||
img: this.author.avatar ? this.author.avatar : 'icons/svg/mystery-man.svg',
|
||||
name: ''
|
||||
};
|
||||
/* 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({ actor: actorData, author: this.author });
|
||||
this.applyPermission(html);
|
||||
|
||||
if (this.type === 'dualityRoll') {
|
||||
html.classList.add('duality');
|
||||
switch (this.system.roll.result.duality) {
|
||||
switch (this.system.roll?.result?.duality) {
|
||||
case 1:
|
||||
html.classList.add('hope');
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ export default class DHItem extends foundry.documents.Item {
|
|||
* Generate an array of localized tag.
|
||||
* @returns {string[]} An array of localized tag strings.
|
||||
*/
|
||||
getTags() {
|
||||
_getTags() {
|
||||
const tags = [];
|
||||
if (this.system.getTags) tags.push(...this.system.getTags());
|
||||
if (this.system._getTags) tags.push(...this.system._getTags());
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
|
@ -143,20 +143,33 @@ export default class DHItem extends foundry.documents.Item {
|
|||
: game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.subclassFeatureTitle'),
|
||||
origin: origin,
|
||||
img: this.img,
|
||||
name: this.name,
|
||||
item: {
|
||||
name: this.name,
|
||||
img: this.img,
|
||||
tags: this._getTags()
|
||||
},
|
||||
description: this.system.description,
|
||||
actions: []
|
||||
actions: this.system.actions
|
||||
};
|
||||
const msg = new cls({
|
||||
const msg = {
|
||||
type: 'abilityUse',
|
||||
user: game.user.id,
|
||||
actor: game.actors.get(cls.getSpeaker().actor),
|
||||
author: this.author,
|
||||
speaker: cls.getSpeaker(),
|
||||
system: systemData,
|
||||
title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'),
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/ability-use.hbs',
|
||||
systemData
|
||||
)
|
||||
});
|
||||
),
|
||||
flags: {
|
||||
daggerheart: {
|
||||
cssClass: 'dh-chat-message dh-style'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
cls.create(msg.toObject());
|
||||
cls.create(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue