mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
* Added effects for Weapon and Armor traits * Fixed so @ strings can be parsed as active effect values * Added actions
48 lines
1.7 KiB
JavaScript
48 lines
1.7 KiB
JavaScript
import { weaponFeatures } from '../../../config/itemConfig.mjs';
|
|
import { tagifyElement } from '../../../helpers/utils.mjs';
|
|
import DHItemSheetV2 from '../item.mjs';
|
|
|
|
const { ItemSheetV2 } = foundry.applications.sheets;
|
|
export default class WeaponSheet extends DHItemSheetV2(ItemSheetV2) {
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ['weapon']
|
|
};
|
|
|
|
static PARTS = {
|
|
header: { template: 'systems/daggerheart/templates/sheets/items/weapon/header.hbs' },
|
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
|
actions: {
|
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
|
scrollable: ['.actions']
|
|
},
|
|
settings: {
|
|
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
|
scrollable: ['.settings']
|
|
}
|
|
};
|
|
|
|
async _preparePartContext(partId, context) {
|
|
super._preparePartContext(partId, context);
|
|
|
|
switch (partId) {
|
|
case 'settings':
|
|
context.features = this.document.system.features.map(x => x.value);
|
|
break;
|
|
}
|
|
|
|
return context;
|
|
}
|
|
|
|
_attachPartListeners(partId, htmlElement, options) {
|
|
super._attachPartListeners(partId, htmlElement, options);
|
|
|
|
const featureInput = htmlElement.querySelector('.features-input');
|
|
tagifyElement(featureInput, weaponFeatures, this.onFeatureSelect.bind(this));
|
|
}
|
|
|
|
async onFeatureSelect(features) {
|
|
await this.document.update({ 'system.features': features.map(x => ({ value: x.value })) });
|
|
this.render(true);
|
|
}
|
|
}
|