mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
* add basic drag drop window * add better field * make effects copy onto actor on attachment * make items from inventory draggable * working drop from inventory * remove duplication issue * add attachment only flag and logic * add weapons to attachables * remove debug logs * try to make it drier * remove unecessary try catch * remove extra configs * remove superfluous comments * remove spurious defenses * make drier * remove unecessary code * deduplicate and simplify * its a desert * standardize to be more similar to class item code * fix bug of duplicate effects being created * fix localization string * fix bug of item equiping and un equiping * remove this since were not going to be using attachmentonly * update attachment tab with comments * remove attachment only logic in favor of just transfer * change flags * change armor and weapon to be attachableItem * change armor and weapon to be attachableItem * change weapon to use mixin * add mixin to armor * move everything to mixin sheet * refactor code for review comments * cleanup and somehow git is ignoring some changes * see if this picks up the changes now * Import/Export updates --------- Co-authored-by: psitacus <walther.johnson@ucalgary.ca> Co-authored-by: WBHarry <williambjrklund@gmail.com>
52 lines
1.9 KiB
JavaScript
52 lines
1.9 KiB
JavaScript
import DHBaseItemSheet from '../api/base-item.mjs';
|
|
import ItemAttachmentSheet from '../api/item-attachment-sheet.mjs';
|
|
|
|
export default class WeaponSheet extends ItemAttachmentSheet(DHBaseItemSheet) {
|
|
/**@inheritdoc */
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ['weapon'],
|
|
tagifyConfigs: [
|
|
{
|
|
selector: '.features-input',
|
|
options: () => CONFIG.DH.ITEM.weaponFeatures,
|
|
callback: WeaponSheet.#onFeatureSelect
|
|
}
|
|
]
|
|
};
|
|
|
|
/**@override */
|
|
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']
|
|
},
|
|
...super.PARTS,
|
|
};
|
|
|
|
/**@inheritdoc */
|
|
async _preparePartContext(partId, context) {
|
|
await super._preparePartContext(partId, context);
|
|
switch (partId) {
|
|
case 'settings':
|
|
context.features = this.document.system.weaponFeatures.map(x => x.value);
|
|
context.systemFields.attack.fields = this.document.system.attack.schema.fields;
|
|
break;
|
|
}
|
|
return context;
|
|
}
|
|
|
|
/**
|
|
* Callback function used by `tagifyElement`.
|
|
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
|
|
*/
|
|
static async #onFeatureSelect(selectedOptions) {
|
|
await this.document.update({ 'system.weaponFeatures': selectedOptions.map(x => ({ value: x.value })) });
|
|
}
|
|
}
|