From 2e02d95afac5f06a93bf8f31af43ceffa85ecaf4 Mon Sep 17 00:00:00 2001 From: Joaquin Pereyra Date: Sat, 12 Jul 2025 19:49:09 -0300 Subject: [PATCH] FEAT: add template to items sheet --- .../sheets/api/application-mixin.mjs | 64 ++++++++-- module/applications/sheets/api/base-item.mjs | 113 +++++------------- .../applications/sheets/items/beastform.mjs | 16 --- module/applications/sheets/items/class.mjs | 54 ++------- module/applications/sheets/items/feature.mjs | 98 +-------------- module/applications/sheets/items/subclass.mjs | 25 ++-- templates/sheets/actors/adversary/effects.hbs | 2 + .../sheets/actors/adversary/features.hbs | 1 + templates/sheets/actors/character/effects.hbs | 2 + .../sheets/actors/character/features.hbs | 1 + .../sheets/actors/character/inventory.hbs | 35 ++++-- templates/sheets/actors/character/loadout.hbs | 4 +- templates/sheets/actors/companion/effects.hbs | 10 +- .../sheets/actors/environment/features.hbs | 1 + .../global/partials/domain-card-item.hbs | 34 ++---- .../global/partials/feature-section-item.hbs | 32 ++--- .../partials/inventory-fieldset-items-V2.hbs | 11 +- .../global/partials/inventory-item-V2.hbs | 19 ++- templates/sheets/global/tabs/tab-actions.hbs | 24 ++-- templates/sheets/global/tabs/tab-effects.hbs | 43 +++---- templates/sheets/global/tabs/tab-features.hbs | 31 ++--- templates/sheets/items/class/features.hbs | 72 +++++------ templates/sheets/items/class/settings.hbs | 12 +- templates/sheets/items/subclass/features.hbs | 36 +++--- 24 files changed, 283 insertions(+), 457 deletions(-) diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs index 4e3058db..e72b36b1 100644 --- a/module/applications/sheets/api/application-mixin.mjs +++ b/module/applications/sheets/api/application-mixin.mjs @@ -223,19 +223,59 @@ export default function DHApplicationMixin(Base) { * @type {ApplicationClickAction} */ static async #createDoc(event, target) { - const { documentClass, type } = target.dataset; - const parent = this.document; + const { documentClass, type, inVault, disabled } = target.dataset; + const parentIsItem = this.document.documentName === 'Item'; + const parent = parentIsItem && documentClass === 'Item' ? null : this.document; - const cls = getDocumentClass(documentClass); - return await cls.createDocuments( - [ - { - name: cls.defaultName({ type, parent }), - type + if (type === 'action') { + const { type: actionType } = await foundry.applications.api.DialogV2.input({ + window: { title: 'Select Action Type' }, + content: await foundry.applications.handlebars.renderTemplate( + 'systems/daggerheart/templates/actionTypes/actionType.hbs', + { types: CONFIG.DH.ACTIONS.actionTypes } + ), + ok: { + label: game.i18n.format('DOCUMENT.Create', { + type: game.i18n.localize('DAGGERHEART.GENERAL.Action.single') + }), } - ], - { parent, renderSheet: !event.shiftKey } - ); + }); + if (!actionType) return; + const cls = game.system.api.models.actions.actionsTypes[actionType] + const 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 + }); + return action; + + } else { + const cls = getDocumentClass(documentClass); + const data = { + name: cls.defaultName({ type, parent }), + type, + } + if (inVault) data["system.inVault"] = true; + if (disabled) data.disabled = true; + + const doc = await cls.create(data, { parent, renderSheet: !event.shiftKey }); + if (parentIsItem && type === 'feature') { + await this.document.update({ + 'system.features': [...this.document.system.features, doc] + }); + } + return doc; + } + } /** @@ -244,9 +284,9 @@ export default function DHApplicationMixin(Base) { */ static #editDoc(_event, target) { const doc = getDocFromElement(target); + if (doc) return doc.sheet.render({ force: true }); // TODO: REDO this - if (doc) return doc.sheet.render({ force: true }); const { actionId } = target.closest('[data-action-id]').dataset; const { actions, attack } = this.document.system; const action = attack.id === actionId ? attack : actions?.find(a => a.id === actionId); diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index d624acc6..19040f49 100644 --- a/module/applications/sheets/api/base-item.mjs +++ b/module/applications/sheets/api/base-item.mjs @@ -15,15 +15,13 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { static DEFAULT_OPTIONS = { classes: ['item'], position: { width: 600 }, + window: { resizable: true }, form: { submitOnChange: true }, actions: { - addAction: DHBaseItemSheet.#addAction, - editAction: DHBaseItemSheet.#editAction, removeAction: DHBaseItemSheet.#removeAction, addFeature: DHBaseItemSheet.#addFeature, - editFeature: DHBaseItemSheet.#editFeature, removeFeature: DHBaseItemSheet.#removeFeature }, dragDrop: [ @@ -48,8 +46,8 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /* -------------------------------------------- */ /**@inheritdoc */ - async _preparePartContext(partId, context) { - await super._preparePartContext(partId, context); + async _preparePartContext(partId, context, options) { + await super._preparePartContext(partId, context, options); const { TextEditor } = foundry.applications.ux; switch (partId) { @@ -61,76 +59,37 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { secrets: this.item.isOwner }); break; + case "effects": + await this._prepareEffectsContext(context, options) + break; } return context; } + /** + * Prepare render context for the Effect part. + * @param {ApplicationRenderContext} context + * @param {ApplicationRenderOptions} options + * @returns {Promise} + * @protected + */ + async _prepareEffectsContext(context, _options) { + context.effects = { + actives: [], + inactives: [], + }; + + for (const effect of this.item.effects) { + const list = effect.active ? context.effects.actives : context.effects.inactives; + list.push(effect); + } + } + /* -------------------------------------------- */ /* Application Clicks Actions */ /* -------------------------------------------- */ - /** - * Render a dialog prompting the user to select an action type. - * - * @returns {Promise} 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. - * @type {ApplicationClickAction} - */ - static async #addAction(_event, _button) { - const actionType = await DHBaseItemSheet.selectActionType(); - if (!actionType) return; - try { - const cls = - game.system.api.models.actions.actionsTypes[actionType] ?? - game.system.api.models.actions.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 - * @type {ApplicationClickAction} - */ - 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. @@ -162,30 +121,16 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { * @type {ApplicationClickAction} */ static async #addFeature(_event, _button) { - const feature = await game.items.documentClass.create({ + const cls = foundry.documents.Item.implementation; + const feature = await cls.create({ type: 'feature', - name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }) + name: cls.defaultName({ type: 'feature' }), }); await this.document.update({ - 'system.features': [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid] + 'system.features': [...this.document.system.features, feature] }); } - /** - * Edit an existing feature on the item - * @type {ApplicationClickAction} - */ - static async #editFeature(_event, button) { - const target = button.closest('.feature-item'); - const feature = this.document.system.features.find(x => x?.id === target.id); - if (!feature) { - ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing')); - return; - } - - feature.sheet.render(true); - } - /** * Remove a feature from the item. * @type {ApplicationClickAction} diff --git a/module/applications/sheets/items/beastform.mjs b/module/applications/sheets/items/beastform.mjs index 194f3ab1..db769e94 100644 --- a/module/applications/sheets/items/beastform.mjs +++ b/module/applications/sheets/items/beastform.mjs @@ -28,20 +28,4 @@ export default class BeastformSheet extends DHBaseItemSheet { labelPrefix: 'DAGGERHEART.GENERAL.Tabs' } }; - - /**@inheritdoc */ - async _prepareContext(_options) { - const context = await super._prepareContext(_options); - - context.document = context.document.toObject(); - context.document.effects = this.document.effects.map(effect => { - const data = effect.toObject(); - data.id = effect.id; - if (effect.type === 'beastform') data.mandatory = true; - - return data; - }); - - return context; - } } diff --git a/module/applications/sheets/items/class.mjs b/module/applications/sheets/items/class.mjs index c7b84340..05f8601e 100644 --- a/module/applications/sheets/items/class.mjs +++ b/module/applications/sheets/items/class.mjs @@ -10,10 +10,8 @@ export default class ClassSheet extends DHBaseItemSheet { actions: { removeItemFromCollection: ClassSheet.#removeItemFromCollection, removeSuggestedItem: ClassSheet.#removeSuggestedItem, - viewDoc: ClassSheet.#viewDoc, - addFeature: this.addFeature, - editFeature: this.editFeature, - deleteFeature: this.deleteFeature + addFeature: ClassSheet.#addFeature, + deleteFeature: ClassSheet.#deleteFeature }, tagifyConfigs: [ { @@ -157,55 +155,27 @@ export default class ClassSheet extends DHBaseItemSheet { await this.document.update({ [`system.characterGuide.${target}`]: null }); } - /** - * Open the sheet of a item by UUID. - * @param {PointerEvent} _event - - * @param {HTMLElement} button - */ - static async #viewDoc(_event, button) { - const doc = await fromUuid(button.dataset.uuid); - doc.sheet.render({ force: true }); - } + static async #addFeature(_, target) { + const { actionPath } = target.dataset; + const cls = foundry.documents.Item.implementation; - getActionPath(type) { - return type === 'hope' ? 'hopeFeatures' : 'classFeatures'; - } - - static async addFeature(_, target) { - const actionPath = this.getActionPath(target.dataset.type); - const feature = await game.items.documentClass.create({ + const feature = await cls.create({ type: 'feature', - name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }) + name: cls.defaultName({ type: 'feature'}), }); + await this.document.update({ [`system.${actionPath}`]: [ - ...this.document.system[actionPath].filter(x => x).map(x => x.uuid), + ...this.document.system[actionPath], feature.uuid ] }); } - static async editFeature(_, button) { - const target = button.closest('.feature-item'); - const actionPath = this.getActionPath(button.dataset.type); - const feature = this.document.system[actionPath].find(x => x?.id === target.dataset.featureId); - if (!feature) { - ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing')); - return; - } - - feature.sheet.render(true); - } - - static async deleteFeature(event, button) { - event.stopPropagation(); - const target = button.closest('.feature-item'); - const actionPath = this.getActionPath(button.dataset.type); - + static async #deleteFeature(_, button) { + const { actionPath, itemUuid } = button.dataset; await this.document.update({ - [`system.${actionPath}`]: this.document.system[actionPath] - .filter(feature => feature && feature.id !== target.dataset.featureId) - .map(x => x.uuid) + [`system.${actionPath}`]: this.document.system[actionPath].filter(f => f.uuid !== itemUuid) }); } } diff --git a/module/applications/sheets/items/feature.mjs b/module/applications/sheets/items/feature.mjs index a54c3bcb..de4013a3 100644 --- a/module/applications/sheets/items/feature.mjs +++ b/module/applications/sheets/items/feature.mjs @@ -1,5 +1,3 @@ -import { actionsTypes } from '../../../data/action/_module.mjs'; -import DHActionConfig from '../../sheets-configs/action-config.mjs'; import DHBaseItemSheet from '../api/base-item.mjs'; export default class FeatureSheet extends DHBaseItemSheet { @@ -7,13 +5,7 @@ export default class FeatureSheet extends DHBaseItemSheet { static DEFAULT_OPTIONS = { id: 'daggerheart-feature', classes: ['feature'], - position: { height: 600 }, - window: { resizable: true }, - actions: { - addAction: FeatureSheet.#addAction, - editAction: FeatureSheet.#editAction, - removeAction: FeatureSheet.#removeAction - } + actions: {} }; /**@override */ @@ -39,92 +31,4 @@ export default class FeatureSheet extends DHBaseItemSheet { labelPrefix: 'DAGGERHEART.GENERAL.Tabs' } }; - - /* -------------------------------------------- */ - - /**@inheritdoc */ - async _prepareContext(_options) { - const context = await super._prepareContext(_options); - - return context; - } - - /* -------------------------------------------- */ - /* Application Clicks Actions */ - /* -------------------------------------------- */ - - /** - * Render a dialog prompting the user to select an action type. - * - * @returns {Promise} 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)) - }); - } } diff --git a/module/applications/sheets/items/subclass.mjs b/module/applications/sheets/items/subclass.mjs index 7761dcbc..c4f3a993 100644 --- a/module/applications/sheets/items/subclass.mjs +++ b/module/applications/sheets/items/subclass.mjs @@ -8,7 +8,6 @@ export default class SubclassSheet extends DHBaseItemSheet { window: { resizable: false }, actions: { addFeature: this.addFeature, - editFeature: this.editFeature, deleteFeature: this.deleteFeature } }; @@ -38,30 +37,20 @@ export default class SubclassSheet extends DHBaseItemSheet { }; static async addFeature(_, target) { - const feature = await game.items.documentClass.create({ + const cls = foundry.documents.Item.implementation; + const feature = await cls.create({ type: 'feature', - name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }) + name: cls.defaultName({ type: 'feature' }), }); + await this.document.update({ - [`system.${target.dataset.type}`]: feature.uuid + [`system.${target.dataset.type}`]: feature }); } - static async editFeature(_, button) { - const feature = this.document.system[button.dataset.type]; - if (!feature) { - ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.notifications.featureIsMissing')); - return; - } - - feature.sheet.render(true); - } - - static async deleteFeature(event, button) { - event.stopPropagation(); - + static async deleteFeature(_, button) { await this.document.update({ - [`system.${button.dataset.type}`]: null + [`system.${button.dataset.actionPath}`]: null }); } diff --git a/templates/sheets/actors/adversary/effects.hbs b/templates/sheets/actors/adversary/effects.hbs index 13e761a9..ad14895d 100644 --- a/templates/sheets/actors/adversary/effects.hbs +++ b/templates/sheets/actors/adversary/effects.hbs @@ -5,6 +5,7 @@ type='effect' isGlassy=true collection=effects.actives + canCreate=true }} {{> 'daggerheart.inventory-items' @@ -12,5 +13,6 @@ type='effect' isGlassy=true collection=effects.inactives + canCreate=true }} \ No newline at end of file diff --git a/templates/sheets/actors/adversary/features.hbs b/templates/sheets/actors/adversary/features.hbs index 69843c49..1a379802 100644 --- a/templates/sheets/actors/adversary/features.hbs +++ b/templates/sheets/actors/adversary/features.hbs @@ -6,6 +6,7 @@ type='feature' collection=document.system.features hideControls=true + canCreate=true }} \ No newline at end of file diff --git a/templates/sheets/actors/character/effects.hbs b/templates/sheets/actors/character/effects.hbs index c1373594..bf2d1d76 100644 --- a/templates/sheets/actors/character/effects.hbs +++ b/templates/sheets/actors/character/effects.hbs @@ -6,6 +6,7 @@ type='effect' isGlassy=true collection=effects.actives + canCreate=true }} {{> 'daggerheart.inventory-items' @@ -13,5 +14,6 @@ type='effect' isGlassy=true collection=effects.inactives + canCreate=true }} \ No newline at end of file diff --git a/templates/sheets/actors/character/features.hbs b/templates/sheets/actors/character/features.hbs index 15fa4108..befa4ae8 100644 --- a/templates/sheets/actors/character/features.hbs +++ b/templates/sheets/actors/character/features.hbs @@ -8,6 +8,7 @@ title=category.title type='feature' collection=category.values + canCreate=true }} {{/if}} diff --git a/templates/sheets/actors/character/inventory.hbs b/templates/sheets/actors/character/inventory.hbs index e591dc3e..3238edae 100644 --- a/templates/sheets/actors/character/inventory.hbs +++ b/templates/sheets/actors/character/inventory.hbs @@ -1,8 +1,5 @@ -
+
\ No newline at end of file diff --git a/templates/sheets/actors/companion/effects.hbs b/templates/sheets/actors/companion/effects.hbs index e151b397..007d2041 100644 --- a/templates/sheets/actors/companion/effects.hbs +++ b/templates/sheets/actors/companion/effects.hbs @@ -1,13 +1,12 @@ -
+
{{> 'daggerheart.inventory-items' title='DAGGERHEART.GENERAL.activeEffects' type='effect' isGlassy=true collection=effects.actives + canCreate=true + }} {{> 'daggerheart.inventory-items' @@ -15,5 +14,6 @@ type='effect' isGlassy=true collection=effects.inactives + canCreate=true }}
\ No newline at end of file diff --git a/templates/sheets/actors/environment/features.hbs b/templates/sheets/actors/environment/features.hbs index f078c70e..c81fddc1 100644 --- a/templates/sheets/actors/environment/features.hbs +++ b/templates/sheets/actors/environment/features.hbs @@ -9,6 +9,7 @@ type='feature' collection=document.system.features hideControls=true + canCreate=true }}
\ No newline at end of file diff --git a/templates/sheets/global/partials/domain-card-item.hbs b/templates/sheets/global/partials/domain-card-item.hbs index 3f2fe146..5932e3b4 100644 --- a/templates/sheets/global/partials/domain-card-item.hbs +++ b/templates/sheets/global/partials/domain-card-item.hbs @@ -2,30 +2,16 @@
- {{#if (eq type 'weapon')}} - - - - {{/if}} - {{#if (eq type 'armor')}} - - - - {{/if}} - {{#if (eq type 'domainCard')}} - {{#unless item.system.inVault}} - - - - {{else}} - - - - {{/unless}} - - {{/if}} - - + + + + + + + + +
{{item.name}}
diff --git a/templates/sheets/global/partials/feature-section-item.hbs b/templates/sheets/global/partials/feature-section-item.hbs index a1eb6432..617c2dfc 100644 --- a/templates/sheets/global/partials/feature-section-item.hbs +++ b/templates/sheets/global/partials/feature-section-item.hbs @@ -1,30 +1,20 @@ -
  • +
  • {{feature.name}}

    {{#unless hideContrals}} - + {{/unless}}
  • \ No newline at end of file diff --git a/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs b/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs index ad940abe..d26573b4 100644 --- a/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs +++ b/templates/sheets/global/partials/inventory-fieldset-items-V2.hbs @@ -11,6 +11,8 @@ Parameters: - cardView {boolean} : If true and type is 'domainCard', renders using domain card layout. - isActor {boolean} : Passed through to inventory-item partials. - canCreate {boolean} : If true, show createDoc anchor on legend +- inVault {boolean} : If true, the domainCard is created with inVault=true +- disabled {boolean}: If true, the ActiveEffect is created with disabled=true; - categoryAdversary {string} : Category adversary id. - showLabels {boolean} : If true, show label-tags else show simple tags. - hideTooltip {boolean} : If true, disables the tooltip on the item image. @@ -22,7 +24,12 @@ Parameters: {{localize title}} {{#if canCreate}} - + {{/if }} @@ -33,7 +40,7 @@ Parameters: {{> 'systems/daggerheart/templates/sheets/global/partials/domain-card-item.hbs' item=item - type=../type + type='domainCard' }} {{/each}} diff --git a/templates/sheets/global/partials/inventory-item-V2.hbs b/templates/sheets/global/partials/inventory-item-V2.hbs index 453dff4b..6d005e28 100644 --- a/templates/sheets/global/partials/inventory-item-V2.hbs +++ b/templates/sheets/global/partials/inventory-item-V2.hbs @@ -28,7 +28,22 @@ Parameters: {{!-- Weapon Block Start --}} {{#if (eq type 'weapon')}} {{#if (not hideTags)}} -
    +
    +
    + {{localize (concat 'DAGGERHEART.CONFIG.Traits.' item.system.attack.roll.trait '.name')}} +
    +
    + {{localize (concat 'DAGGERHEART.CONFIG.Range.' item.system.attack.range '.name')}} +
    +
    + {{item.system.attack.damage.parts.0.value.dice}}{{#if item.system.attack.damage.parts.0.value.bonus}} + + {{item.system.attack.damage.parts.0.value.bonus}}{{/if}} + ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' item.system.attack.damage.parts.0.type '.abbreviation')}}) +
    +
    + {{localize (concat 'DAGGERHEART.CONFIG.Burden.' item.system.burden)}} +
    +
    {{else if (not hideLabels)}}
    @@ -158,7 +173,7 @@ Parameters: {{/if}} - {{!-- I had to use the {{not}} helper because otherwise the function is called when rendering --}} + {{!-- I had to use the {{not}} helper because otherwise the function is called when rendering --}} {{#unless (not item.toChat)}} diff --git a/templates/sheets/global/tabs/tab-actions.hbs b/templates/sheets/global/tabs/tab-actions.hbs index 54345bed..584cf782 100644 --- a/templates/sheets/global/tabs/tab-actions.hbs +++ b/templates/sheets/global/tabs/tab-actions.hbs @@ -3,21 +3,11 @@ data-tab='{{tabs.actions.id}}' data-group='{{tabs.actions.group}}' > -
    - {{localize "DAGGERHEART.GENERAL.Action.plural"}} -
    - {{#each document.system.actions as |action index|}} -
    - - {{action.name}} -
    - -
    -
    - {{/each}} -
    -
    + +{{> 'daggerheart.inventory-items' + title='DAGGERHEART.GENERAL.Action.plural' + collection=document.system.actions + type='action' + canCreate=true +}}
    \ No newline at end of file diff --git a/templates/sheets/global/tabs/tab-effects.hbs b/templates/sheets/global/tabs/tab-effects.hbs index a75f1b0b..e0715b30 100644 --- a/templates/sheets/global/tabs/tab-effects.hbs +++ b/templates/sheets/global/tabs/tab-effects.hbs @@ -1,26 +1,19 @@ -
    -
    - - {{localize "DAGGERHEART.GENERAL.Effect.plural"}} - - - - -
    - {{#each document.effects as |effect|}} -
    - - {{effect.name}} -
    - - -
    -
    - {{/each}} -
    -
    +
    + + {{> 'daggerheart.inventory-items' + title='DAGGERHEART.GENERAL.activeEffects' + type='effect' + isGlassy=true + collection=effects.actives + canCreate=true + }} + + {{> 'daggerheart.inventory-items' + title='DAGGERHEART.GENERAL.inactiveEffects' + type='effect' + isGlassy=true + collection=effects.inactives + canCreate=true + }}
    \ No newline at end of file diff --git a/templates/sheets/global/tabs/tab-features.hbs b/templates/sheets/global/tabs/tab-features.hbs index 71f6f1f1..96b351a2 100644 --- a/templates/sheets/global/tabs/tab-features.hbs +++ b/templates/sheets/global/tabs/tab-features.hbs @@ -1,23 +1,10 @@ -
    -
    - {{localize "DAGGERHEART.GENERAL.features"}} -
    - {{#each document.system.features as |feature|}} -
    - - {{feature.name}} -
    - -
    -
    - {{/each}} -
    -
    +
    + {{> 'daggerheart.inventory-items' + title='DAGGERHEART.GENERAL.features' + type='feature' + isGlassy=true + collection=document.system.features + canCreate=true + }}
    \ No newline at end of file diff --git a/templates/sheets/items/class/features.hbs b/templates/sheets/items/class/features.hbs index 96ce2655..22b55a16 100644 --- a/templates/sheets/items/class/features.hbs +++ b/templates/sheets/items/class/features.hbs @@ -1,23 +1,32 @@ -
    +
    - {{localize "DAGGERHEART.ITEMS.Class.hopeFeatures"}} + + {{localize "DAGGERHEART.ITEMS.Class.hopeFeatures"}} + + + +
    {{#each source.system.hopeFeatures as |feature|}} - {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='hope' feature=feature}} + {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' + actionPath='hopeFeatures' feature=feature}} {{/each}}
    - {{localize "DAGGERHEART.ITEMS.Class.classFeatures"}} + + {{localize "DAGGERHEART.ITEMS.Class.classFeatures"}} + + + +
    {{#each source.system.classFeatures as |feature|}} - {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='class' feature=feature}} + {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' + actionPath='classFeatures' feature=feature}} {{/each}}
    @@ -27,34 +36,25 @@ {{localize "TYPES.Item.subclass"}}
    {{#each source.system.subclasses as |subclass index|}} -
  • -
    - -

    - {{subclass.name}} -

    - +
  • +
    + +

    + {{subclass.name}} +

    + -
  • +
    + {{/each}}
    - \ No newline at end of file + \ No newline at end of file diff --git a/templates/sheets/items/class/settings.hbs b/templates/sheets/items/class/settings.hbs index b110bf4c..756687b4 100644 --- a/templates/sheets/items/class/settings.hbs +++ b/templates/sheets/items/class/settings.hbs @@ -38,7 +38,7 @@ {{localize "DAGGERHEART.ITEMS.Class.guide.suggestedPrimaryWeaponTitle"}}
    {{#if document.system.characterGuide.suggestedPrimaryWeapon}} -
    +
    {{document.system.characterGuide.suggestedPrimaryWeapon.name}}
    @@ -53,7 +53,7 @@ {{localize "DAGGERHEART.ITEMS.Class.guide.suggestedSecondaryWeaponTitle"}}
    {{#if document.system.characterGuide.suggestedSecondaryWeapon}} -
    +
    {{document.system.characterGuide.suggestedSecondaryWeapon.name}}
    @@ -68,7 +68,7 @@ {{localize "DAGGERHEART.ITEMS.Class.guide.suggestedArmorTitle"}}
    {{#if document.system.characterGuide.suggestedArmor}} -
    +
    {{document.system.characterGuide.suggestedArmor.name}}
    @@ -86,7 +86,7 @@ {{localize "DAGGERHEART.GENERAL.take"}}
    {{#each source.system.inventory.take}} -
    +
    {{this.name}}
    @@ -101,7 +101,7 @@ {{localize "DAGGERHEART.ITEMS.Class.guide.inventory.thenChoose"}}
    {{#each source.system.inventory.choiceA}} -
    +
    {{this.name}}
    @@ -116,7 +116,7 @@ {{localize "DAGGERHEART.ITEMS.Class.guide.inventory.andEither"}}
    {{#each source.system.inventory.choiceB}} -
    +
    {{this.name}}
    diff --git a/templates/sheets/items/subclass/features.hbs b/templates/sheets/items/subclass/features.hbs index d2424d01..4306b9a4 100644 --- a/templates/sheets/items/subclass/features.hbs +++ b/templates/sheets/items/subclass/features.hbs @@ -1,43 +1,51 @@ -
    +
    - {{localize "DAGGERHEART.GENERAL.Tabs.foundation"}} - + {{localize "DAGGERHEART.GENERAL.Tabs.foundation"}} + + +
    {{#if source.system.foundationFeature}} - {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='foundationFeature' feature=source.system.foundationFeature}} + {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' + actionPath='foundationFeature' + feature=source.system.foundationFeature + }} {{/if}}
    - {{localize "DAGGERHEART.GENERAL.Tabs.specialization"}} - + {{localize "DAGGERHEART.GENERAL.Tabs.specialization"}} +
    {{#if source.system.specializationFeature}} - {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='specializationFeature' feature=source.system.specializationFeature}} + {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' + actionPath='specializationFeature' feature=source.system.specializationFeature}} {{/if}}
    - {{localize "DAGGERHEART.GENERAL.Tabs.mastery"}} - + {{localize "DAGGERHEART.GENERAL.Tabs.mastery"}} +
    {{#if source.system.masteryFeature}} - {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='masteryFeature' feature=source.system.masteryFeature}} + {{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' + actionPath='masteryFeature' feature=source.system.masteryFeature}} {{/if}}