mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
* Organized language * Organized high level folders * Some deeper organization * More org. That's enough ._. * Capitalized initial system localization categories
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
import DHBaseAction from './baseAction.mjs';
|
|
|
|
export default class DHEffectAction extends DHBaseAction {
|
|
static extraSchemas = ['effects', 'target'];
|
|
|
|
async use(event, ...args) {
|
|
const config = await super.use(event, args);
|
|
if (['error', 'warning'].includes(config.type)) return;
|
|
return await this.chatApplyEffects(event, config);
|
|
}
|
|
|
|
async chatApplyEffects(event, data) {
|
|
const cls = getDocumentClass('ChatMessage'),
|
|
systemData = {
|
|
title: game.i18n.format('DAGGERHEART.UI.Chat.applyEffect.title', { name: this.name }),
|
|
origin: this.actor._id,
|
|
description: '',
|
|
targets: data.targets.map(x => ({ id: x.id, name: x.name, img: x.img, hit: true })),
|
|
action: {
|
|
itemId: this.item._id,
|
|
actionId: this._id
|
|
}
|
|
},
|
|
msg = new cls({
|
|
type: 'applyEffect',
|
|
user: game.user.id,
|
|
system: systemData,
|
|
content: await foundry.applications.handlebars.renderTemplate(
|
|
'systems/daggerheart/templates/ui/chat/apply-effects.hbs',
|
|
systemData
|
|
)
|
|
});
|
|
|
|
cls.create(msg.toObject());
|
|
}
|
|
|
|
get chatTemplate() {
|
|
return 'systems/daggerheart/templates/ui/chat/apply-effects.hbs';
|
|
}
|
|
}
|