mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-10 19:17:09 +01:00
Updated all item types except Class/Subclass
This commit is contained in:
parent
3753452559
commit
18d6bd7dcf
20 changed files with 250 additions and 174 deletions
|
|
@ -25,7 +25,8 @@
|
||||||
"notifications": {
|
"notifications": {
|
||||||
"adversaryMissing": "The linked adversary doesn't exist in the world.",
|
"adversaryMissing": "The linked adversary doesn't exist in the world.",
|
||||||
"beastformInapplicable": "A beastform can only be applied to a Character.",
|
"beastformInapplicable": "A beastform can only be applied to a Character.",
|
||||||
"beastformAlreadyApplied": "The character already has a beastform applied!"
|
"beastformAlreadyApplied": "The character already has a beastform applied!",
|
||||||
|
"featureIsMissing": "The feature doesn't exist. You should remove it."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Settings": {
|
"Settings": {
|
||||||
|
|
|
||||||
|
|
@ -128,12 +128,20 @@ export default function DHApplicationMixin(Base) {
|
||||||
_createDragDropHandlers() {
|
_createDragDropHandlers() {
|
||||||
return this.options.dragDrop.map(d => {
|
return this.options.dragDrop.map(d => {
|
||||||
d.callbacks = {
|
d.callbacks = {
|
||||||
|
dragstart: this._onDragStart.bind(this),
|
||||||
drop: this._onDrop.bind(this)
|
drop: this._onDrop.bind(this)
|
||||||
};
|
};
|
||||||
return new foundry.applications.ux.DragDrop.implementation(d);
|
return new foundry.applications.ux.DragDrop.implementation(d);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle dragStart event.
|
||||||
|
* @param {DragEvent} event
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
_onDragStart(event) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle drop event.
|
* Handle drop event.
|
||||||
* @param {DragEvent} event
|
* @param {DragEvent} event
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import DHApplicationMixin from './application-mixin.mjs';
|
import DHApplicationMixin from './application-mixin.mjs';
|
||||||
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
|
||||||
import { actionsTypes } from '../../../data/action/_module.mjs';
|
|
||||||
|
|
||||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||||
|
|
||||||
|
|
@ -18,10 +16,14 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
submitOnChange: true
|
submitOnChange: true
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
addAction: DHBaseItemSheet.#addAction,
|
addFeature: DHBaseItemSheet.#addFeature,
|
||||||
editAction: DHBaseItemSheet.#editAction,
|
editFeature: DHBaseItemSheet.#editFeature,
|
||||||
removeAction: DHBaseItemSheet.#removeAction
|
removeFeature: DHBaseItemSheet.#removeFeature
|
||||||
}
|
},
|
||||||
|
dragDrop: [
|
||||||
|
{ dragSelector: null, dropSelector: '.tab.features .drop-section' },
|
||||||
|
{ dragSelector: '.feature-item', dropSelector: null }
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
@ -29,7 +31,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'description' }, { id: 'actions' }, { id: 'settings' }],
|
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }],
|
||||||
initial: 'description',
|
initial: 'description',
|
||||||
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
||||||
}
|
}
|
||||||
|
|
@ -63,77 +65,89 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render a dialog prompting the user to select an action type.
|
* Add a new feature to the item, prompting the user for its type.
|
||||||
*
|
* @param {PointerEvent} _event - The originating click event
|
||||||
* @returns {Promise<object>} An object containing the selected action type.
|
* @param {HTMLElement} _button - The capturing HTML element which defines the [data-action="addFeature"]
|
||||||
*/
|
*/
|
||||||
static async selectActionType() {
|
static async #addFeature(_event, _button) {
|
||||||
const content = await foundry.applications.handlebars.renderTemplate(
|
const feature = await game.items.documentClass.create({
|
||||||
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
id: foundry.utils.randomID(),
|
||||||
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
type: 'feature',
|
||||||
),
|
name: game.i18n.localize('DAGGERHEART.General.newFeature')
|
||||||
title = 'Select Action Type';
|
});
|
||||||
|
await this.document.update({
|
||||||
return foundry.applications.api.DialogV2.prompt({
|
'system.features': [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid]
|
||||||
window: { title },
|
|
||||||
content,
|
|
||||||
ok: {
|
|
||||||
label: title,
|
|
||||||
callback: (event, button, dialog) => button.form.elements.type.value
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new action to the item, prompting the user for its type.
|
* Edit an existing feature on the item
|
||||||
* @param {PointerEvent} _event - The originating click event
|
* @param {PointerEvent} _event - The originating click event
|
||||||
* @param {HTMLElement} _button - The capturing HTML element which defines the [data-action="addAction"]
|
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="editFeature"]
|
||||||
*/
|
*/
|
||||||
static async #addAction(_event, _button) {
|
static async #editFeature(_event, button) {
|
||||||
const actionType = await DHBaseItemSheet.selectActionType();
|
const target = button.closest('.feature-item');
|
||||||
if (!actionType) return;
|
const feature = this.document.system.features.find(x => x?.id === target.id);
|
||||||
try {
|
if (!feature) {
|
||||||
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||||
action = new cls(
|
return;
|
||||||
{
|
}
|
||||||
_id: foundry.utils.randomID(),
|
|
||||||
type: actionType,
|
feature.sheet.render(true);
|
||||||
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
}
|
||||||
...cls.getSourceConfig(this.document)
|
|
||||||
},
|
/**
|
||||||
{
|
* Remove a feature from the item.
|
||||||
parent: this.document
|
* @param {PointerEvent} event - The originating click event
|
||||||
}
|
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeFeature"]
|
||||||
);
|
*/
|
||||||
await this.document.update({ 'system.actions': [...this.document.system.actions, action] });
|
static async #removeFeature(event, button) {
|
||||||
await new DHActionConfig(this.document.system.actions[this.document.system.actions.length - 1]).render({
|
event.stopPropagation();
|
||||||
force: true
|
const target = button.closest('.feature-item');
|
||||||
});
|
|
||||||
} catch (error) {
|
await this.document.update({
|
||||||
console.log(error);
|
'system.features': this.document.system.features
|
||||||
|
.filter(feature => feature && feature.id !== target.id)
|
||||||
|
.map(x => x.uuid)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Application Drag/Drop */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On dragStart on the item.
|
||||||
|
* @param {DragEvent} event - The drag event
|
||||||
|
*/
|
||||||
|
async _onDragStart(event) {
|
||||||
|
const featureItem = event.currentTarget.closest('.feature-item');
|
||||||
|
|
||||||
|
if (featureItem) {
|
||||||
|
const feature = this.document.system.features.find(x => x?.id === featureItem.id);
|
||||||
|
if (!feature) {
|
||||||
|
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const featureData = { type: 'Item', data: { ...feature.toObject(), _id: null }, fromInternal: true };
|
||||||
|
event.dataTransfer.setData('text/plain', JSON.stringify(featureData));
|
||||||
|
event.dataTransfer.setDragImage(featureItem.querySelector('img'), 60, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit an existing action on the item
|
* On drop on the item.
|
||||||
* @param {PointerEvent} _event - The originating click event
|
* @param {DragEvent} event - The drag event
|
||||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="editAction"]
|
|
||||||
*/
|
*/
|
||||||
static async #editAction(_event, button) {
|
async _onDrop(event) {
|
||||||
const action = this.document.system.actions[button.dataset.index];
|
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
||||||
await new DHActionConfig(action).render({ force: true });
|
if (data.fromInternal) return;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
const item = await fromUuid(data.uuid);
|
||||||
* Remove an action from the item.
|
if (item?.type === 'feature') {
|
||||||
* @param {PointerEvent} event - The originating click event
|
const current = this.document.system.features.map(x => x.uuid);
|
||||||
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
await this.document.update({ 'system.features': [...current, item.uuid] });
|
||||||
*/
|
}
|
||||||
static async #removeAction(event, button) {
|
|
||||||
event.stopPropagation();
|
|
||||||
const actionIndex = button.closest('[data-index]').dataset.index;
|
|
||||||
await this.document.update({
|
|
||||||
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ export default class DHHeritageSheet extends DHBaseItemSheet {
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||||
actions: {
|
feature: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.actions']
|
scrollable: ['.feature']
|
||||||
},
|
},
|
||||||
effects: {
|
effects: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
|
||||||
|
|
@ -23,7 +23,7 @@ export default class DHHeritageSheet extends DHBaseItemSheet {
|
||||||
/** @override*/
|
/** @override*/
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'description' }, { id: 'actions' }, { id: 'effects' }],
|
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'effects' }],
|
||||||
initial: 'description',
|
initial: 'description',
|
||||||
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
{
|
{
|
||||||
selector: '.features-input',
|
selector: '.features-input',
|
||||||
options: () => CONFIG.DH.ITEM.armorFeatures,
|
options: () => CONFIG.DH.ITEM.armorFeatures,
|
||||||
callback: ArmorSheet.#onFeatureSelect
|
callback: ArmorSheet.#onArmorFeatureSelect
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
@ -19,9 +19,9 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/items/armor/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/items/armor/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||||
actions: {
|
features: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.actions']
|
scrollable: ['.features']
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
||||||
|
|
@ -35,7 +35,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
|
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
case 'settings':
|
case 'settings':
|
||||||
context.features = this.document.system.features.map(x => x.value);
|
context.armorFeatures = this.document.system.armorFeatures.map(x => x.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
* Callback function used by `tagifyElement`.
|
* Callback function used by `tagifyElement`.
|
||||||
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
|
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
|
||||||
*/
|
*/
|
||||||
static async #onFeatureSelect(selectedOptions) {
|
static async #onArmorFeatureSelect(selectedOptions) {
|
||||||
await this.document.update({ 'system.features': selectedOptions.map(x => ({ value: x.value })) });
|
await this.document.update({ 'system.armorFeatures': selectedOptions.map(x => ({ value: x.value })) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,7 @@ import DHBaseItemSheet from '../api/base-item.mjs';
|
||||||
export default class BeastformSheet extends DHBaseItemSheet {
|
export default class BeastformSheet extends DHBaseItemSheet {
|
||||||
/**@inheritdoc */
|
/**@inheritdoc */
|
||||||
static DEFAULT_OPTIONS = {
|
static DEFAULT_OPTIONS = {
|
||||||
classes: ['beastform'],
|
classes: ['beastform']
|
||||||
dragDrop: [{ dragSelector: null, dropSelector: '.drop-section' }],
|
|
||||||
actions: {
|
|
||||||
editFeature: this.editFeature,
|
|
||||||
removeFeature: this.removeFeature
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@override */
|
/**@override */
|
||||||
|
|
@ -40,26 +35,4 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
static editFeature(event) {
|
|
||||||
const target = event.target.closest('[data-action="editFeature"]');
|
|
||||||
const feature = this.document.system.features[target.dataset.index];
|
|
||||||
feature.sheet.render({ force: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
static async removeFeature(_, target) {
|
|
||||||
const current = this.document.system.features.map(x => x.uuid);
|
|
||||||
await this.document.update({
|
|
||||||
'system.features': current.filter((_, index) => index !== Number(target.dataset.index))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async _onDrop(event) {
|
|
||||||
const data = foundry.applications.ux.TextEditor.implementation.getDragEventData(event);
|
|
||||||
const item = await fromUuid(data.uuid);
|
|
||||||
if (item.type === 'feature') {
|
|
||||||
const current = this.document.system.features.map(x => x.uuid);
|
|
||||||
await this.document.update({ 'system.features': [...current, item.uuid] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ export default class ConsumableSheet extends DHBaseItemSheet {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/items/consumable/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/items/consumable/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||||
actions: {
|
features: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.actions']
|
scrollable: ['.features']
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/consumable/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/consumable/settings.hbs',
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default class DomainCardSheet extends DHBaseItemSheet {
|
||||||
/** @override */
|
/** @override */
|
||||||
static TABS = {
|
static TABS = {
|
||||||
primary: {
|
primary: {
|
||||||
tabs: [{ id: 'description' }, { id: 'actions' }, { id: 'settings' }, { id: 'effects' }],
|
tabs: [{ id: 'description' }, { id: 'features' }, { id: 'settings' }, { id: 'effects' }],
|
||||||
initial: 'description',
|
initial: 'description',
|
||||||
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
labelPrefix: 'DAGGERHEART.Sheets.TABS'
|
||||||
}
|
}
|
||||||
|
|
@ -21,9 +21,9 @@ export default class DomainCardSheet extends DHBaseItemSheet {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/items/domainCard/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/items/domainCard/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||||
actions: {
|
features: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.actions']
|
scrollable: ['.features']
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/domainCard/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/domainCard/settings.hbs',
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { actionsTypes } from '../../../data/action/_module.mjs';
|
||||||
|
import DHActionConfig from '../../sheets-configs/action-config.mjs';
|
||||||
import DHBaseItemSheet from '../api/base-item.mjs';
|
import DHBaseItemSheet from '../api/base-item.mjs';
|
||||||
|
|
||||||
export default class FeatureSheet extends DHBaseItemSheet {
|
export default class FeatureSheet extends DHBaseItemSheet {
|
||||||
|
|
@ -6,7 +8,12 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
||||||
id: 'daggerheart-feature',
|
id: 'daggerheart-feature',
|
||||||
classes: ['feature'],
|
classes: ['feature'],
|
||||||
position: { height: 600 },
|
position: { height: 600 },
|
||||||
window: { resizable: true }
|
window: { resizable: true },
|
||||||
|
actions: {
|
||||||
|
addAction: FeatureSheet.#addAction,
|
||||||
|
editAction: FeatureSheet.#editAction,
|
||||||
|
removeAction: FeatureSheet.#removeAction
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**@override */
|
/**@override */
|
||||||
|
|
@ -41,4 +48,83 @@ export default class FeatureSheet extends DHBaseItemSheet {
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Application Clicks Actions */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a dialog prompting the user to select an action type.
|
||||||
|
*
|
||||||
|
* @returns {Promise<object>} An object containing the selected action type.
|
||||||
|
*/
|
||||||
|
static async selectActionType() {
|
||||||
|
const content = await foundry.applications.handlebars.renderTemplate(
|
||||||
|
'systems/daggerheart/templates/actionTypes/actionType.hbs',
|
||||||
|
{ types: CONFIG.DH.ACTIONS.actionTypes }
|
||||||
|
),
|
||||||
|
title = 'Select Action Type';
|
||||||
|
|
||||||
|
return foundry.applications.api.DialogV2.prompt({
|
||||||
|
window: { title },
|
||||||
|
content,
|
||||||
|
ok: {
|
||||||
|
label: title,
|
||||||
|
callback: (event, button, dialog) => button.form.elements.type.value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new action to the item, prompting the user for its type.
|
||||||
|
* @param {PointerEvent} _event - The originating click event
|
||||||
|
* @param {HTMLElement} _button - The capturing HTML element which defines the [data-action="addAction"]
|
||||||
|
*/
|
||||||
|
static async #addAction(_event, _button) {
|
||||||
|
const actionType = await FeatureSheet.selectActionType();
|
||||||
|
if (!actionType) return;
|
||||||
|
try {
|
||||||
|
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
|
||||||
|
action = new cls(
|
||||||
|
{
|
||||||
|
_id: foundry.utils.randomID(),
|
||||||
|
type: actionType,
|
||||||
|
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
|
||||||
|
...cls.getSourceConfig(this.document)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
parent: this.document
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await this.document.update({ 'system.actions': [...this.document.system.actions, action] });
|
||||||
|
await new DHActionConfig(this.document.system.actions[this.document.system.actions.length - 1]).render({
|
||||||
|
force: true
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit an existing action on the item
|
||||||
|
* @param {PointerEvent} _event - The originating click event
|
||||||
|
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="editAction"]
|
||||||
|
*/
|
||||||
|
static async #editAction(_event, button) {
|
||||||
|
const action = this.document.system.actions[button.dataset.index];
|
||||||
|
await new DHActionConfig(action).render({ force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an action from the item.
|
||||||
|
* @param {PointerEvent} event - The originating click event
|
||||||
|
* @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"]
|
||||||
|
*/
|
||||||
|
static async #removeAction(event, button) {
|
||||||
|
event.stopPropagation();
|
||||||
|
const actionIndex = button.closest('[data-index]').dataset.index;
|
||||||
|
await this.document.update({
|
||||||
|
'system.actions': this.document.system.actions.filter((_, index) => index !== Number.parseInt(actionIndex))
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ export default class MiscellaneousSheet extends DHBaseItemSheet {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/items/miscellaneous/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/items/miscellaneous/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||||
actions: {
|
features: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.actions']
|
scrollable: ['.features']
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
{
|
{
|
||||||
selector: '.features-input',
|
selector: '.features-input',
|
||||||
options: () => CONFIG.DH.ITEM.weaponFeatures,
|
options: () => CONFIG.DH.ITEM.weaponFeatures,
|
||||||
callback: WeaponSheet.#onFeatureSelect
|
callback: WeaponSheet.#onWeaponFeatureSelect
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
@ -18,9 +18,9 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
header: { template: 'systems/daggerheart/templates/sheets/items/weapon/header.hbs' },
|
header: { template: 'systems/daggerheart/templates/sheets/items/weapon/header.hbs' },
|
||||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||||
actions: {
|
features: {
|
||||||
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
|
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
|
||||||
scrollable: ['.actions']
|
scrollable: ['.features']
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
||||||
|
|
@ -34,7 +34,7 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
|
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
case 'settings':
|
case 'settings':
|
||||||
context.features = this.document.system.features.map(x => x.value);
|
context.weaponFeatures = this.document.system.weaponFeatures.map(x => x.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
* Callback function used by `tagifyElement`.
|
* Callback function used by `tagifyElement`.
|
||||||
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
|
* @param {Array<Object>} selectedOptions - The currently selected tag objects.
|
||||||
*/
|
*/
|
||||||
static async #onFeatureSelect(selectedOptions) {
|
static async #onWeaponFeatureSelect(selectedOptions) {
|
||||||
await this.document.update({ 'system.features': selectedOptions.map(x => ({ value: x.value })) });
|
await this.document.update({ 'system.weaponFeatures': selectedOptions.map(x => ({ value: x.value })) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
|
|
||||||
export default class DHAncestry extends BaseDataItem {
|
export default class DHAncestry extends BaseDataItem {
|
||||||
|
|
@ -13,10 +13,9 @@ export default class DHAncestry extends BaseDataItem {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
|
||||||
import { armorFeatures } from '../../config/itemConfig.mjs';
|
import { armorFeatures } from '../../config/itemConfig.mjs';
|
||||||
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
|
|
||||||
export default class DHArmor extends BaseDataItem {
|
export default class DHArmor extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -22,7 +22,7 @@ export default class DHArmor extends BaseDataItem {
|
||||||
tier: new fields.NumberField({ required: true, integer: true, initial: 1, min: 1 }),
|
tier: new fields.NumberField({ required: true, integer: true, initial: 1, min: 1 }),
|
||||||
equipped: new fields.BooleanField({ initial: false }),
|
equipped: new fields.BooleanField({ initial: false }),
|
||||||
baseScore: new fields.NumberField({ integer: true, initial: 0 }),
|
baseScore: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
features: new fields.ArrayField(
|
armorFeatures: new fields.ArrayField(
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
value: new fields.StringField({
|
value: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -40,32 +40,28 @@ export default class DHArmor extends BaseDataItem {
|
||||||
major: new fields.NumberField({ integer: true, initial: 0 }),
|
major: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
severe: new fields.NumberField({ integer: true, initial: 0 })
|
severe: new fields.NumberField({ integer: true, initial: 0 })
|
||||||
}),
|
}),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
get featureInfo() {
|
|
||||||
return this.feature ? CONFIG.DH.ITEM.armorFeatures[this.feature] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async _preUpdate(changes, options, user) {
|
async _preUpdate(changes, options, user) {
|
||||||
const allowed = await super._preUpdate(changes, options, user);
|
const allowed = await super._preUpdate(changes, options, user);
|
||||||
if (allowed === false) return false;
|
if (allowed === false) return false;
|
||||||
|
|
||||||
if (changes.system.features) {
|
if (changes.system?.armorFeatures) {
|
||||||
const removed = this.features.filter(x => !changes.system.features.includes(x));
|
const removed = this.armorFeatures.filter(x => !changes.system.armorFeatures.includes(x));
|
||||||
const added = changes.system.features.filter(x => !this.features.includes(x));
|
const added = changes.system.armorFeatures.filter(x => !this.armorFeatures.includes(x));
|
||||||
|
|
||||||
for (var feature of removed) {
|
for (var armorFeature of removed) {
|
||||||
for (var effectId of feature.effectIds) {
|
for (var effectId of armorFeature.effectIds) {
|
||||||
await this.parent.effects.get(effectId).delete();
|
await this.parent.effects.get(effectId).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
changes.system.actions = this.actions.filter(x => !feature.actionIds.includes(x._id));
|
changes.system.actions = this.actions.filter(x => !armorFeature.actionIds.includes(x._id));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var feature of added) {
|
for (var armorFeature of added) {
|
||||||
const featureData = armorFeatures[feature.value];
|
const featureData = armorFeatures[armorFeature.value];
|
||||||
if (featureData.effects?.length > 0) {
|
if (featureData.effects?.length > 0) {
|
||||||
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
||||||
{
|
{
|
||||||
|
|
@ -74,7 +70,7 @@ export default class DHArmor extends BaseDataItem {
|
||||||
changes: featureData.effects.flatMap(x => x.changes)
|
changes: featureData.effects.flatMap(x => x.changes)
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
feature.effectIds = embeddedItems.map(x => x.id);
|
armorFeature.effectIds = embeddedItems.map(x => x.id);
|
||||||
}
|
}
|
||||||
if (featureData.actions?.length > 0) {
|
if (featureData.actions?.length > 0) {
|
||||||
const newActions = featureData.actions.map(action => {
|
const newActions = featureData.actions.map(action => {
|
||||||
|
|
@ -85,7 +81,7 @@ export default class DHArmor extends BaseDataItem {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
changes.system.actions = [...this.actions, ...newActions];
|
changes.system.actions = [...this.actions, ...newActions];
|
||||||
feature.actionIds = newActions.map(x => x._id);
|
armorFeature.actionIds = newActions.map(x => x._id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// import { actionsTypes } from '../action/_module.mjs';
|
import { actionsTypes } from '../action/_module.mjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes metadata about the item data model type
|
* Describes metadata about the item data model type
|
||||||
|
|
@ -60,8 +60,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
const actionType = {
|
const actionType = {
|
||||||
weapon: 'attack'
|
weapon: 'attack'
|
||||||
}[this.constructor.metadata.type],
|
}[this.constructor.metadata.type],
|
||||||
cls = game.system.api.models.actionsTypes[actionType],
|
cls = actionsTypes[actionType],
|
||||||
// cls = actionsTypes.attack,
|
|
||||||
action = new cls(
|
action = new cls(
|
||||||
{
|
{
|
||||||
_id: foundry.utils.randomID(),
|
_id: foundry.utils.randomID(),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
|
|
||||||
export default class DHCommunity extends BaseDataItem {
|
export default class DHCommunity extends BaseDataItem {
|
||||||
|
|
@ -16,7 +16,7 @@ export default class DHCommunity extends BaseDataItem {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
|
|
||||||
export default class DHConsumable extends BaseDataItem {
|
export default class DHConsumable extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -19,7 +19,7 @@ export default class DHConsumable extends BaseDataItem {
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
consumeOnUse: new fields.BooleanField({ initial: false }),
|
consumeOnUse: new fields.BooleanField({ initial: false }),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
|
|
||||||
export default class DHDomainCard extends BaseDataItem {
|
export default class DHDomainCard extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -30,7 +30,7 @@ export default class DHDomainCard extends BaseDataItem {
|
||||||
}),
|
}),
|
||||||
foundation: new fields.BooleanField({ initial: false }),
|
foundation: new fields.BooleanField({ initial: false }),
|
||||||
inVault: new fields.BooleanField({ initial: false }),
|
inVault: new fields.BooleanField({ initial: false }),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
|
|
||||||
export default class DHMiscellaneous extends BaseDataItem {
|
export default class DHMiscellaneous extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -15,10 +15,9 @@ export default class DHMiscellaneous extends BaseDataItem {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import BaseDataItem from './base.mjs';
|
import BaseDataItem from './base.mjs';
|
||||||
import ActionField from '../fields/actionField.mjs';
|
import { actionsTypes } from '../action/_module.mjs';
|
||||||
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
|
|
||||||
export default class DHWeapon extends BaseDataItem {
|
export default class DHWeapon extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -37,7 +38,7 @@ export default class DHWeapon extends BaseDataItem {
|
||||||
initial: 'physical'
|
initial: 'physical'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
features: new fields.ArrayField(
|
weaponFeatures: new fields.ArrayField(
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
value: new fields.StringField({
|
value: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -48,7 +49,7 @@ export default class DHWeapon extends BaseDataItem {
|
||||||
actionIds: new fields.ArrayField(new fields.StringField({ required: true }))
|
actionIds: new fields.ArrayField(new fields.StringField({ required: true }))
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
actions: new fields.ArrayField(new ActionField())
|
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,20 +57,20 @@ export default class DHWeapon extends BaseDataItem {
|
||||||
const allowed = await super._preUpdate(changes, options, user);
|
const allowed = await super._preUpdate(changes, options, user);
|
||||||
if (allowed === false) return false;
|
if (allowed === false) return false;
|
||||||
|
|
||||||
if (changes.system.features) {
|
if (changes.system?.weaponFeatures) {
|
||||||
const removed = this.features.filter(x => !changes.system.features.includes(x));
|
const removed = this.weaponFeatures.filter(x => !changes.system.weaponFeatures.includes(x));
|
||||||
const added = changes.system.features.filter(x => !this.features.includes(x));
|
const added = changes.system.weaponFeatures.filter(x => !this.weaponFeatures.includes(x));
|
||||||
|
|
||||||
for (var feature of removed) {
|
for (var weaponFeature of removed) {
|
||||||
for (var effectId of feature.effectIds) {
|
for (var effectId of weaponFeature.effectIds) {
|
||||||
await this.parent.effects.get(effectId).delete();
|
await this.parent.effects.get(effectId).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
changes.system.actions = this.actions.filter(x => !feature.actionIds.includes(x._id));
|
changes.system.actions = this.actions.filter(x => !weaponFeature.actionIds.includes(x._id));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var feature of added) {
|
for (var weaponFeature of added) {
|
||||||
const featureData = CONFIG.DH.ITEM.weaponFeatures[feature.value];
|
const featureData = CONFIG.DH.ITEM.weaponFeatures[weaponFeature.value];
|
||||||
if (featureData.effects?.length > 0) {
|
if (featureData.effects?.length > 0) {
|
||||||
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
||||||
{
|
{
|
||||||
|
|
@ -78,18 +79,18 @@ export default class DHWeapon extends BaseDataItem {
|
||||||
changes: featureData.effects.flatMap(x => x.changes)
|
changes: featureData.effects.flatMap(x => x.changes)
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
feature.effectIds = embeddedItems.map(x => x.id);
|
weaponFeature.effectIds = embeddedItems.map(x => x.id);
|
||||||
}
|
}
|
||||||
if (featureData.actions?.length > 0) {
|
if (featureData.actions?.length > 0) {
|
||||||
const newActions = featureData.actions.map(action => {
|
const newActions = featureData.actions.map(action => {
|
||||||
const cls = CONFIG.DH.ACTIONS.actionsTypes[action.type];
|
const cls = actionsTypes[action.type];
|
||||||
return new cls(
|
return new cls(
|
||||||
{ ...action, _id: foundry.utils.randomID(), name: game.i18n.localize(action.name) },
|
{ ...action, _id: foundry.utils.randomID(), name: game.i18n.localize(action.name) },
|
||||||
{ parent: this }
|
{ parent: this }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
changes.system.actions = [...this.actions, ...newActions];
|
changes.system.actions = [...this.actions, ...newActions];
|
||||||
feature.actionIds = newActions.map(x => x._id);
|
weaponFeature.actionIds = newActions.map(x => x._id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@
|
||||||
data-group='{{tabs.features.group}}'
|
data-group='{{tabs.features.group}}'
|
||||||
>
|
>
|
||||||
<fieldset class="one-column drop-section">
|
<fieldset class="one-column drop-section">
|
||||||
<legend>{{localize "DAGGERHEART.Sheets.Global.Features"}}</legend>
|
<legend>{{localize "DAGGERHEART.Sheets.Global.Features"}} <a><i data-action="addFeature" class="fa-solid fa-plus icon-button"></i></a></legend>
|
||||||
<div class="features-list">
|
<div class="features-list">
|
||||||
{{#each document.system.features as |feature index|}}
|
{{#each document.system.features as |feature|}}
|
||||||
<div class="feature-item"
|
<div class="feature-item"
|
||||||
data-action="editFeature"
|
data-action="editFeature"
|
||||||
data-index="{{index}}"
|
id="{{feature.id}}"
|
||||||
>
|
>
|
||||||
<img class="image" src="{{feature.img}}" />
|
<img class="image" src="{{feature.img}}" />
|
||||||
<span>{{feature.name}}</span>
|
<span>{{feature.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a data-action="removeFeature" data-index="{{index}}"><i class="fa-solid fa-trash"></i></a>
|
<a data-action="removeFeature" id="{{feature.id}}"><i class="fa-solid fa-trash"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue