mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +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
|
|
@ -152,8 +152,8 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
|
|||
this.config.roll.type = this.reactionOverride
|
||||
? CONFIG.DH.ITEM.actionTypes.reaction.id
|
||||
: this.config.roll.type === CONFIG.DH.ITEM.actionTypes.reaction.id
|
||||
? null
|
||||
: this.config.roll.type;
|
||||
? null
|
||||
: this.config.roll.type;
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,20 +47,31 @@ 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',
|
||||
{
|
||||
player: this.actor.name,
|
||||
actor: { name: this.actor.name, img: this.actor.img },
|
||||
author: game.users.get(game.user.id),
|
||||
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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,22 +133,34 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
|||
});
|
||||
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const msg = new cls({
|
||||
const msg = {
|
||||
user: game.user.id,
|
||||
system: {
|
||||
moves: moves,
|
||||
actor: this.actor.uuid
|
||||
},
|
||||
speaker: cls.getSpeaker(),
|
||||
title: game.i18n.localize(
|
||||
`DAGGERHEART.APPLICATIONS.Downtime.${this.shortrest ? 'shortRest' : 'longRest'}.title`
|
||||
),
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/downtime.hbs',
|
||||
{
|
||||
title: `${this.actor.name} - ${game.i18n.localize(`DAGGERHEART.APPLICATIONS.Downtime.${this.shortrest ? 'shortRest' : 'longRest'}.title`)}`,
|
||||
title: game.i18n.localize(
|
||||
`DAGGERHEART.APPLICATIONS.Downtime.${this.shortrest ? 'shortRest' : 'longRest'}.title`
|
||||
),
|
||||
actor: { name: this.actor.name, img: this.actor.img },
|
||||
moves: moves
|
||||
}
|
||||
)
|
||||
});
|
||||
),
|
||||
flags: {
|
||||
daggerheart: {
|
||||
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)) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default class DHActionConfig extends DaggerheartSheet(ApplicationV2) {
|
|||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'dh-style', 'dialog'],
|
||||
classes: ['daggerheart', 'dh-style', 'dialog', 'max-800'],
|
||||
window: {
|
||||
icon: 'fa-solid fa-wrench',
|
||||
resizable: false
|
||||
|
|
|
|||
|
|
@ -108,17 +108,15 @@ export default class AdversarySheet extends DHBaseActorSheet {
|
|||
*/
|
||||
static #reactionRoll(event) {
|
||||
const config = {
|
||||
event: event,
|
||||
event,
|
||||
title: `Reaction Roll: ${this.actor.name}`,
|
||||
headerTitle: 'Adversary Reaction Roll',
|
||||
roll: {
|
||||
type: 'reaction'
|
||||
},
|
||||
chatMessage: {
|
||||
type: 'adversaryRoll',
|
||||
template: 'systems/daggerheart/templates/ui/chat/adversary-roll.hbs',
|
||||
mute: true
|
||||
}
|
||||
type: 'trait',
|
||||
hasRoll: true,
|
||||
data: this.actor.getRollData()
|
||||
};
|
||||
|
||||
this.actor.diceRoll(config);
|
||||
|
|
|
|||
|
|
@ -611,9 +611,16 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
}),
|
||||
roll: {
|
||||
trait: button.dataset.attribute
|
||||
}
|
||||
},
|
||||
hasRoll: true
|
||||
};
|
||||
this.document.diceRoll(config);
|
||||
this.document.diceRoll({
|
||||
...config,
|
||||
headerTitle: `${game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll')}: ${this.actor.name}`,
|
||||
title: game.i18n.format('DAGGERHEART.UI.Chat.dualityRoll.abilityCheckTitle', {
|
||||
ability: abilityLabel
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
//TODO: redo toggleEquipItem method
|
||||
|
|
|
|||
|
|
@ -121,21 +121,37 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
*/
|
||||
static async #sendExpToChat(_, button) {
|
||||
const experience = this.document.system.experiences[button.dataset.id];
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
|
||||
const systemData = {
|
||||
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single'),
|
||||
description: `${experience.name} ${experience.value.signedString()}`
|
||||
actor: { name: this.actor.name, img: this.actor.img },
|
||||
author: game.users.get(game.user.id),
|
||||
action: {
|
||||
name: `${experience.name} ${experience.value.signedString()}`,
|
||||
img: '/icons/sundries/misc/admission-ticket-blue.webp'
|
||||
},
|
||||
itemOrigin: {
|
||||
name: game.i18n.localize('DAGGERHEART.GENERAL.Experience.single')
|
||||
},
|
||||
description: experience.description
|
||||
};
|
||||
|
||||
foundry.documents.ChatMessage.implementation.create({
|
||||
type: 'abilityUse',
|
||||
const msg = {
|
||||
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
|
||||
)
|
||||
});
|
||||
),
|
||||
title: game.i18n.localize('DAGGERHEART.ACTIONS.Config.displayInChat'),
|
||||
speaker: cls.getSpeaker(),
|
||||
flags: {
|
||||
daggerheart: {
|
||||
cssClass: 'dh-chat-message dh-style'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
cls.create(msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -15,11 +15,16 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
this.setupHooks();
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ['daggerheart']
|
||||
};
|
||||
|
||||
addChatListeners = async (app, html, data) => {
|
||||
html.querySelectorAll('.duality-action-damage').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollDamage(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.target-save-container').forEach(element =>
|
||||
html.querySelectorAll('.target-save').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollSave(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.roll-all-save-button').forEach(element =>
|
||||
|
|
@ -28,6 +33,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
html.querySelectorAll('.duality-action-effect').forEach(element =>
|
||||
element.addEventListener('click', event => this.onApplyEffect(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.simple-roll-button').forEach(element =>
|
||||
element.addEventListener('click', event => this.onRollSimple(event, data.message))
|
||||
);
|
||||
html.querySelectorAll('.target-container').forEach(element => {
|
||||
element.addEventListener('mouseenter', this.hoverTarget);
|
||||
element.addEventListener('mouseleave', this.unhoverTarget);
|
||||
|
|
@ -119,7 +127,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
event.stopPropagation();
|
||||
if (!game.user.isGM) return;
|
||||
const targets = event.target.parentElement.querySelectorAll(
|
||||
'.target-section > [data-token] .target-save-container'
|
||||
'[data-token] .target-save'
|
||||
);
|
||||
const actor = await this.getActor(message.system.source.actor),
|
||||
action = this.getAction(actor, message.system.source.item, message.system.source.action);
|
||||
|
|
@ -160,8 +168,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
const targetSelection = Boolean(event.target.dataset.targetHit),
|
||||
msg = ui.chat.collection.get(message._id);
|
||||
if (msg.system.targetSelection === targetSelection) return;
|
||||
if (targetSelection !== true && !Array.from(game.user.targets).length)
|
||||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
// if (targetSelection !== true && !Array.from(game.user.targets).length)
|
||||
// return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
msg.system.targetSelection = targetSelection;
|
||||
msg.system.prepareDerivedData();
|
||||
ui.chat.updateMessage(msg);
|
||||
|
|
@ -224,8 +232,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
|
||||
for (let target of targets) {
|
||||
let damages = foundry.utils.deepClone(message.system.damage?.roll ?? message.system.roll);
|
||||
let damages = foundry.utils.deepClone(message.system.damage);
|
||||
if (
|
||||
!message.system.hasHealing &&
|
||||
message.system.onSave &&
|
||||
message.system.targets.find(t => t.id === target.id)?.saved?.success === true
|
||||
) {
|
||||
|
|
@ -244,6 +253,33 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
|||
}
|
||||
}
|
||||
|
||||
async onRollSimple(event, message) {
|
||||
const buttonType = event.target.dataset.type ?? 'damage',
|
||||
total = message.rolls.reduce((a,c) => a + Roll.fromJSON(c).total, 0),
|
||||
damages = {
|
||||
'hitPoints': {
|
||||
parts: [
|
||||
{
|
||||
applyTo: 'hitPoints',
|
||||
damageTypes: [],
|
||||
total
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
targets = Array.from(game.user.targets);
|
||||
|
||||
if (targets.length === 0)
|
||||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
|
||||
targets.forEach(target => {
|
||||
if(buttonType === 'healing')
|
||||
target.actor.takeHealing(damages);
|
||||
else
|
||||
target.actor.takeDamage(damages);
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle visibility of target containers.
|
||||
* @param {MouseEvent} event
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue