diff --git a/module/applications/sheets-configs/adversary-settings.mjs b/module/applications/sheets-configs/adversary-settings.mjs index 4b849907..fbd38c41 100644 --- a/module/applications/sheets-configs/adversary-settings.mjs +++ b/module/applications/sheets-configs/adversary-settings.mjs @@ -1,36 +1,15 @@ -const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; +import DHBaseActorSettings from "../sheets/api/actor-setting.mjs"; -export default class DHAdversarySettings extends HandlebarsApplicationMixin(ApplicationV2) { - constructor(actor) { - super({}); - - this.actor = actor; - this._dragDrop = this._createDragDropHandlers(); - } - - get title() { - return `${game.i18n.localize('DAGGERHEART.GENERAL.Tabs.settings')}`; - } +/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */ +export default class DHAdversarySettings extends DHBaseActorSettings { + /**@inheritdoc */ static DEFAULT_OPTIONS = { - tag: 'form', - classes: ['daggerheart', 'dh-style', 'dialog', 'adversary-settings'], - window: { - icon: 'fa-solid fa-wrench', - resizable: false - }, + classes: ['adversary-settings'], position: { width: 455, height: 'auto' }, actions: { - addExperience: this.#addExperience, - removeExperience: this.#removeExperience, - addFeature: this.#addFeature, - editFeature: this.#editFeature, - removeFeature: this.#removeFeature - }, - form: { - handler: this.updateForm, - submitOnChange: true, - closeOnSubmit: false + addExperience: DHAdversarySettings.#addExperience, + removeExperience: DHAdversarySettings.#removeExperience, }, dragDrop: [ { dragSelector: null, dropSelector: '.tab.features' }, @@ -38,6 +17,7 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl ] }; + /**@override */ static PARTS = { header: { id: 'header', @@ -62,116 +42,36 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl } }; + + /** @override */ static TABS = { - details: { - active: true, - cssClass: '', - group: 'primary', - id: 'details', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.details' - }, - attack: { - active: false, - cssClass: '', - group: 'primary', - id: 'attack', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.attack' - }, - experiences: { - active: false, - cssClass: '', - group: 'primary', - id: 'experiences', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.experiences' - }, - features: { - active: false, - cssClass: '', - group: 'primary', - id: 'features', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.features' + primary: { + tabs: [{ id: 'details' }, { id: 'attack' }, { id: 'experiences' }, { id: 'features' }], + initial: 'details', + labelPrefix: 'DAGGERHEART.GENERAL.Tabs' } }; - async _prepareContext(_options) { - const context = await super._prepareContext(_options); - context.document = this.actor; - context.tabs = this._getTabs(this.constructor.TABS); - context.systemFields = this.actor.system.schema.fields; - context.systemFields.attack.fields = this.actor.system.attack.schema.fields; - context.isNPC = true; - - return context; - } - - _attachPartListeners(partId, htmlElement, options) { - super._attachPartListeners(partId, htmlElement, options); - - this._dragDrop.forEach(d => d.bind(htmlElement)); - } - - _createDragDropHandlers() { - return this.options.dragDrop.map(d => { - d.callbacks = { - dragstart: this._onDragStart.bind(this), - drop: this._onDrop.bind(this) - }; - return new foundry.applications.ux.DragDrop.implementation(d); - }); - } - - _getTabs(tabs) { - for (const v of Object.values(tabs)) { - v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; - v.cssClass = v.active ? 'active' : ''; - } - - return tabs; - } + /* -------------------------------------------- */ + /** + * Adds a new experience entry to the actor. + * @type {ApplicationClickAction} + */ static async #addExperience() { const newExperience = { name: 'Experience', modifier: 0 }; await this.actor.update({ [`system.experiences.${foundry.utils.randomID()}`]: newExperience }); - this.render(); } + /** + * Removes an experience entry from the actor. + * @type {ApplicationClickAction} + */ static async #removeExperience(_, target) { await this.actor.update({ [`system.experiences.-=${target.dataset.experience}`]: null }); - this.render(); - } - - static async #addFeature(_, _button) { - await this.actor.createEmbeddedDocuments('Item', [ - { - type: 'feature', - name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }), - img: 'icons/skills/melee/weapons-crossed-swords-black.webp' - } - ]); - this.render(); - } - - static async #editFeature(event, target) { - event.stopPropagation(); - this.actor.items.get(target.id).sheet.render(true); - } - - static async #removeFeature(event, target) { - event.stopPropagation(); - await this.actor.deleteEmbeddedDocuments('Item', [target.id]); - this.render(); - } - - static async updateForm(event, _, formData) { - await this.actor.update(formData.object); - this.render(); } async _onDragStart(event) { @@ -192,7 +92,6 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl const item = await fromUuid(data.uuid); if (item.type === 'feature') { await this.actor.createEmbeddedDocuments('Item', [item]); - this.render(); } } } diff --git a/module/applications/sheets-configs/companion-settings.mjs b/module/applications/sheets-configs/companion-settings.mjs index e25b401d..47e0de27 100644 --- a/module/applications/sheets-configs/companion-settings.mjs +++ b/module/applications/sheets-configs/companion-settings.mjs @@ -1,37 +1,20 @@ import { GMUpdateEvent, socketEvent } from '../../systemRegistration/socket.mjs'; import DhCompanionlevelUp from '../levelup/companionLevelup.mjs'; +import DHBaseActorSettings from '../sheets/api/actor-setting.mjs'; -const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; - -export default class DHCompanionSettings extends HandlebarsApplicationMixin(ApplicationV2) { - constructor(actor) { - super({}); - - this.actor = actor; - } - - get title() { - return `${game.i18n.localize('DAGGERHEART.GENERAL.Tabs.settings')}`; - } +/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */ +export default class DHCompanionSettings extends DHBaseActorSettings { + /**@inheritdoc */ static DEFAULT_OPTIONS = { - tag: 'form', - classes: ['daggerheart', 'dh-style', 'dialog', 'companion-settings'], - window: { - icon: 'fa-solid fa-wrench', - resizable: false - }, + classes: ['companion-settings'], position: { width: 455, height: 'auto' }, actions: { - levelUp: this.levelUp + levelUp: DHCompanionSettings.#levelUp }, - form: { - handler: this.updateForm, - submitOnChange: true, - closeOnSubmit: false - } }; + /**@inheritdoc */ static PARTS = { header: { id: 'header', @@ -52,109 +35,67 @@ export default class DHCompanionSettings extends HandlebarsApplicationMixin(Appl } }; + + /** @inheritdoc */ static TABS = { - details: { - active: true, - cssClass: '', - group: 'primary', - id: 'details', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.details' - }, - experiences: { - active: false, - cssClass: '', - group: 'primary', - id: 'experiences', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.experiences' - }, - attack: { - active: false, - cssClass: '', - group: 'primary', - id: 'attack', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.attack' + primary: { + tabs: [{ id: 'details' }, { id: 'attack' }, { id: 'experiences' }], + initial: 'details', + labelPrefix: 'DAGGERHEART.GENERAL.Tabs' } }; - _attachPartListeners(partId, htmlElement, options) { - super._attachPartListeners(partId, htmlElement, options); - - htmlElement.querySelector('.partner-value')?.addEventListener('change', this.onPartnerChange.bind(this)); + /**@inheritdoc */ + async _onRender(context, options) { + await super._onRender(context, options); + this.element.querySelector('.partner-value')?.addEventListener('change', this.onPartnerChange.bind(this)); } + /**@inheritdoc */ async _prepareContext(_options) { const context = await super._prepareContext(_options); - context.document = this.actor; - context.tabs = this._getTabs(this.constructor.TABS); - context.systemFields = this.actor.system.schema.fields; - context.systemFields.attack.fields = this.actor.system.attack.schema.fields; - context.isNPC = true; + context.playerCharacters = game.actors - .filter( - x => - x.type === 'character' && - (x.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) || - this.document.system.partner?.uuid === x.uuid) - ) + .filter(x => x.type === 'character' && (x.isOwner || this.document.system.partner?.uuid === x.uuid)) .map(x => ({ key: x.uuid, name: x.name })); return context; } - _getTabs(tabs) { - for (const v of Object.values(tabs)) { - v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; - v.cssClass = v.active ? 'active' : ''; - } - - return tabs; - } - + /** + * Handles changes to the actor's partner selection. + * @param {Event} event - The change event triggered by the partner input element. + */ async onPartnerChange(event) { - const partnerDocument = event.target.value - ? await foundry.utils.fromUuid(event.target.value) + const value = event.target.value; + const partnerDocument = value + ? await foundry.utils.fromUuid(value) : this.actor.system.partner; - const partnerUpdate = { 'system.companion': event.target.value ? this.actor.uuid : null }; + const partnerUpdate = { 'system.companion': value ? this.actor.uuid : null }; - if (!partnerDocument.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)) { + if (!partnerDocument.isOwner) { await game.socket.emit(`system.${CONFIG.DH.id}`, { action: socketEvent.GMUpdate, data: { action: GMUpdateEvent.UpdateDocument, uuid: partnerDocument.uuid, - update: update + update: partnerUpdate } }); } else { await partnerDocument.update(partnerUpdate); } - await this.actor.update({ 'system.partner': event.target.value }); + await this.actor.update({ 'system.partner': value }); - if (!event.target.value) { - await this.actor.updateLevel(1); - } - - this.render(); + if (!value) await this.actor.updateLevel(1); } - async viewActor(_, button) { - const target = button.closest('[data-item-uuid]'); - const actor = await foundry.utils.fromUuid(target.dataset.itemUuid); - if (!actor) return; - - actor.sheet.render(true); - } - - static async levelUp() { - new DhCompanionlevelUp(this.actor).render(true); - } - - static async updateForm(event, _, formData) { - await this.actor.update(formData.object); - this.render(); + /** + * Opens the companion level-up dialog for the associated actor. + * @type {ApplicationClickAction} + */ + static async #levelUp() { + new DhCompanionlevelUp(this.actor).render({ force: true }); } } diff --git a/module/applications/sheets-configs/environment-settings.mjs b/module/applications/sheets-configs/environment-settings.mjs index 69ae7f87..6b5605f8 100644 --- a/module/applications/sheets-configs/environment-settings.mjs +++ b/module/applications/sheets-configs/environment-settings.mjs @@ -1,39 +1,17 @@ -const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; +import DHBaseActorSettings from "../sheets/api/actor-setting.mjs"; -export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(ApplicationV2) { - constructor(actor) { - super({}); - - this.actor = actor; - this._dragDrop = this._createDragDropHandlers(); - } - - get title() { - return `${game.i18n.localize('DAGGERHEART.GENERAL.Tabs.settings')}`; - } +/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */ +export default class DHEnvironmentSettings extends DHBaseActorSettings { + /**@inheritdoc */ static DEFAULT_OPTIONS = { - tag: 'form', - classes: ['daggerheart', 'dh-style', 'dialog', 'environment-settings'], - window: { - icon: 'fa-solid fa-wrench', - resizable: false - }, - position: { width: 455, height: 'auto' }, + classes: ['environment-settings'], actions: { - addFeature: this.#addFeature, - editFeature: this.#editFeature, - removeFeature: this.#removeFeature, - addCategory: this.#addCategory, - deleteProperty: this.#deleteProperty, + addCategory: DHEnvironmentSettings.#addCategory, + removeCategory: DHEnvironmentSettings.#removeCategory, viewAdversary: this.#viewAdversary, deleteAdversary: this.#deleteAdversary }, - form: { - handler: this.updateForm, - submitOnChange: true, - closeOnSubmit: false - }, dragDrop: [ { dragSelector: null, dropSelector: '.category-container' }, { dragSelector: null, dropSelector: '.tab.features' }, @@ -41,6 +19,7 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap ] }; + /**@override */ static PARTS = { header: { id: 'header', @@ -61,100 +40,34 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap } }; + /** @inheritdoc */ static TABS = { - details: { - active: true, - cssClass: '', - group: 'primary', - id: 'details', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.details' - }, - features: { - active: false, - cssClass: '', - group: 'primary', - id: 'features', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.features' - }, - adversaries: { - active: false, - cssClass: '', - group: 'primary', - id: 'adversaries', - icon: null, - label: 'DAGGERHEART.GENERAL.Tabs.adversaries' + primary: { + tabs: [{ id: 'details' }, { id: 'features' }, { id: 'adversaries' }], + initial: 'details', + labelPrefix: 'DAGGERHEART.GENERAL.Tabs' } }; - async _prepareContext(_options) { - const context = await super._prepareContext(_options); - context.document = this.actor; - context.tabs = this._getTabs(this.constructor.TABS); - context.systemFields = this.actor.system.schema.fields; - context.isNPC = true; - - return context; - } - - _attachPartListeners(partId, htmlElement, options) { - super._attachPartListeners(partId, htmlElement, options); - - this._dragDrop.forEach(d => d.bind(htmlElement)); - } - - _createDragDropHandlers() { - return this.options.dragDrop.map(d => { - d.callbacks = { - dragstart: this._onDragStart.bind(this), - drop: this._onDrop.bind(this) - }; - return new foundry.applications.ux.DragDrop.implementation(d); - }); - } - - _getTabs(tabs) { - for (const v of Object.values(tabs)) { - v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active; - v.cssClass = v.active ? 'active' : ''; - } - - return tabs; - } - - static async #addFeature(_, _button) { - await this.actor.createEmbeddedDocuments('Item', [ - { - type: 'feature', - name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }), - img: 'icons/magic/perception/orb-crystal-ball-scrying-blue.webp' - } - ]); - this.render(); - } - - static async #editFeature(_, target) { - this.actor.items.get(target.id).sheet.render(true); - } - - static async #removeFeature(_, target) { - await this.actor.deleteEmbeddedDocuments('Item', [target.id]); - this.render(); - } + /** + * Adds a new category entry to the actor. + * @type {ApplicationClickAction} + */ static async #addCategory() { await this.actor.update({ [`system.potentialAdversaries.${foundry.utils.randomID()}.label`]: game.i18n.localize( 'DAGGERHEART.ACTORS.Environment.newAdversary' ) }); - this.render(); } - static async #deleteProperty(_, target) { - await this.actor.update({ [`${target.dataset.path}.-=${target.id}`]: null }); - this.render(); + /** + * Removes an category entry from the actor. + * @type {ApplicationClickAction} + */ + static async #removeCategory(_, target) { + await this.actor.update({ [`system.potentialAdversaries.-=${target.dataset.categoryId}`]: null }); } static async #viewAdversary(_, button) { @@ -164,17 +77,17 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap return; } - adversary.sheet.render(true); + adversary.sheet.render({ force: true }); } static async #deleteAdversary(event, target) { const adversaryKey = target.dataset.adversary; const path = `system.potentialAdversaries.${target.dataset.potentialAdversary}.adversaries`; + console.log(target.dataset.potentialAdversar); const newAdversaries = foundry.utils .getProperty(this.actor, path) .filter(x => x && (x?.uuid ?? x) !== adversaryKey); await this.actor.update({ [path]: newAdversaries }); - this.render(); } async _onDragStart(event) { @@ -206,9 +119,4 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap this.render(); } } - - static async updateForm(event, _, formData) { - await this.actor.update(formData.object); - this.render(); - } } diff --git a/module/applications/sheets/api/_modules.mjs b/module/applications/sheets/api/_modules.mjs index 4c80133d..3043feeb 100644 --- a/module/applications/sheets/api/_modules.mjs +++ b/module/applications/sheets/api/_modules.mjs @@ -2,3 +2,4 @@ export { default as DHApplicationMixin } from './application-mixin.mjs'; export { default as DHBaseItemSheet } from './base-item.mjs'; export { default as DHHeritageSheet } from './heritage-sheet.mjs'; export { default as DHBaseActorSheet } from "./base-actor.mjs"; +export { default as DHBaseActorSettings } from "./actor-setting.mjs"; diff --git a/module/applications/sheets/api/actor-setting.mjs b/module/applications/sheets/api/actor-setting.mjs new file mode 100644 index 00000000..adc10566 --- /dev/null +++ b/module/applications/sheets/api/actor-setting.mjs @@ -0,0 +1,51 @@ +import DHApplicationMixin from './application-mixin.mjs'; +const { DocumentSheetV2 } = foundry.applications.api; + +/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */ + +/** + * Base settings sheet for Daggerheart actors. + * @extends {DHApplicationMixin} + */ +export default class DHBaseActorSettings extends DHApplicationMixin(DocumentSheetV2) { + + /**@inheritdoc */ + static DEFAULT_OPTIONS = { + classes: ['dialog'], + window: { + icon: 'fa-solid fa-wrench', + resizable: false, + title: "DAGGERHEART.GENERAL.Tabs.settings" + }, + position: { width: 455, height: 'auto' }, + actions: {}, + form: { + submitOnChange: true, + }, + dragDrop: [ + { dragSelector: null, dropSelector: '.tab.features' }, + { dragSelector: '.feature-item', dropSelector: null } + ] + }; + + /** @inheritDoc */ + _initializeApplicationOptions(options) { + options = super._initializeApplicationOptions(options); + options.classes = options.classes.filter(c => c !== "sheet"); + return options; + } + + /**@returns {foundry.documents.Actor} */ + get actor() { + return this.document; + } + + /**@inheritdoc */ + async _prepareContext(options) { + const context = await super._prepareContext(options); + context.systemFields.attack.fields = this.actor.system.attack.schema.fields; + context.isNPC = this.actor.isNPC; + + return context + } +} \ No newline at end of file diff --git a/module/applications/sheets/api/application-mixin.mjs b/module/applications/sheets/api/application-mixin.mjs index 929a72c8..cbc97c62 100644 --- a/module/applications/sheets/api/application-mixin.mjs +++ b/module/applications/sheets/api/application-mixin.mjs @@ -221,17 +221,15 @@ export default function DHApplicationMixin(Base) { * @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeAction"] */ static async #createDoc(event, button) { - const { type } = button.dataset; - const operation = { - parent: this.document, - pack: this.document.pack, - renderSheet: !event.shiftKey, - } + const { documentClass, type } = button.dataset; + console.log(documentClass, type); + const parent = this.document; - const cls = getDocumentClass(type); + const cls = getDocumentClass(documentClass); return await cls.createDocuments([{ - name: cls.defaultName(operation) - }], operation); + name: cls.defaultName({ type, parent }), + type, + }], { parent, renderSheet: !event.shiftKey }); } /** diff --git a/module/applications/sheets/api/base-actor.mjs b/module/applications/sheets/api/base-actor.mjs index 0647857f..252f2d9f 100644 --- a/module/applications/sheets/api/base-actor.mjs +++ b/module/applications/sheets/api/base-actor.mjs @@ -1,3 +1,4 @@ +import DHBaseActorSettings from './actor-setting.mjs'; import DHApplicationMixin from './application-mixin.mjs'; const { ActorSheetV2 } = foundry.applications.sheets; @@ -25,14 +26,13 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) { dragDrop: [], }; - /** - * - */ + /**@type {typeof DHBaseActorSettings}*/ #settingSheet; + /**@returns {DHBaseActorSettings|null} */ get settingSheet() { const SheetClass = this.document.system.metadata.settingSheet; - return this.#settingSheet ??= SheetClass ? new SheetClass(this.document): null; + return this.#settingSheet ??= SheetClass ? new SheetClass({document: this.document}): null; } /**@inheritdoc */ @@ -43,7 +43,7 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) { } /** - * + * Open the Actor Setting Sheet * @type {ApplicationClickAction} */ static async #openSettings() { diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index 5e7e8d59..99c01ac6 100644 --- a/module/applications/sheets/api/base-item.mjs +++ b/module/applications/sheets/api/base-item.mjs @@ -3,6 +3,8 @@ import DHApplicationMixin from './application-mixin.mjs'; const { ItemSheetV2 } = foundry.applications.sheets; +/**@typedef {import('@client/applications/_types.mjs').ApplicationClickAction} ApplicationClickAction */ + /** * A base item sheet extending {@link ItemSheetV2} via {@link DHApplicationMixin} * @extends ItemSheetV2 @@ -92,8 +94,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** * 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"] + * @type {ApplicationClickAction} */ static async #addAction(_event, _button) { const actionType = await DHBaseItemSheet.selectActionType(); @@ -124,8 +125,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** * 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"] + * @type {ApplicationClickAction} */ static async #editAction(_event, button) { const action = this.document.system.actions[button.dataset.index]; @@ -134,8 +134,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** * 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"] + * @type {ApplicationClickAction} */ static async #removeAction(event, button) { event.stopPropagation(); @@ -147,8 +146,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** * Add a new feature 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="addFeature"] + * @type {ApplicationClickAction} */ static async #addFeature(_event, _button) { const feature = await game.items.documentClass.create({ @@ -162,8 +160,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** * Edit an existing feature on the item - * @param {PointerEvent} _event - The originating click event - * @param {HTMLElement} button - The capturing HTML element which defines the [data-action="editFeature"] + * @type {ApplicationClickAction} */ static async #editFeature(_event, button) { const target = button.closest('.feature-item'); @@ -178,8 +175,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** * Remove a feature from the item. - * @param {PointerEvent} event - The originating click event - * @param {HTMLElement} button - The capturing HTML element which defines the [data-action="removeFeature"] + * @type {ApplicationClickAction} */ static async #removeFeature(event, button) { event.stopPropagation(); diff --git a/module/data/actor/base.mjs b/module/data/actor/base.mjs index d4afa51f..1b90968d 100644 --- a/module/data/actor/base.mjs +++ b/module/data/actor/base.mjs @@ -1,10 +1,12 @@ +import DHBaseActorSettings from "../../applications/sheets/api/actor-setting.mjs"; + /** * Describes metadata about the actor data model type * @typedef {Object} ActorDataModelMetadata * @property {string} label - A localizable label used on application. * @property {string} type - The system type that this data model represents. * @property {Boolean} isNPC - This data model represents a NPC? - * @property {typeof foundry.applications.api.DocumentSheetV2} settingSheet - The sheet class used to render the settings UI for this actor type. + * @property {typeof DHBaseActorSettings} settingSheet - The sheet class used to render the settings UI for this actor type. */ export default class BaseDataActor extends foundry.abstract.TypeDataModel { /** @returns {ActorDataModelMetadata}*/ diff --git a/templates/sheets-settings/adversary-settings/experiences.hbs b/templates/sheets-settings/adversary-settings/experiences.hbs index 26ac5d44..fb758a40 100644 --- a/templates/sheets-settings/adversary-settings/experiences.hbs +++ b/templates/sheets-settings/adversary-settings/experiences.hbs @@ -3,7 +3,7 @@ data-tab='{{tabs.experiences.id}}' data-group='{{tabs.experiences.group}}' > - diff --git a/templates/sheets-settings/adversary-settings/features.hbs b/templates/sheets-settings/adversary-settings/features.hbs index e0a1bfce..f232dae9 100644 --- a/templates/sheets-settings/adversary-settings/features.hbs +++ b/templates/sheets-settings/adversary-settings/features.hbs @@ -3,7 +3,7 @@ data-tab='{{tabs.features.id}}' data-group='{{tabs.features.group}}' > -
@@ -16,8 +16,8 @@ {{feature.name}}
- - + +
{{/each}} diff --git a/templates/sheets-settings/companion-settings/details.hbs b/templates/sheets-settings/companion-settings/details.hbs index 802db637..2811377d 100644 --- a/templates/sheets-settings/companion-settings/details.hbs +++ b/templates/sheets-settings/companion-settings/details.hbs @@ -13,11 +13,11 @@
- {{selectOptions playerCharacters selected=document.system.partner.uuid labelAttr="name" valueAttr="key" blank=""}}
- + \ No newline at end of file diff --git a/templates/sheets-settings/environment-settings/adversaries.hbs b/templates/sheets-settings/environment-settings/adversaries.hbs index 8d75f943..4d8fa066 100644 --- a/templates/sheets-settings/environment-settings/adversaries.hbs +++ b/templates/sheets-settings/environment-settings/adversaries.hbs @@ -3,18 +3,20 @@ data-tab='{{tabs.adversaries.id}}' data-group='{{tabs.adversaries.group}}' > - - {{#each document.system.potentialAdversaries}} -
- {{this.label}} + {{#each document.system.potentialAdversaries as |category id|}} +
+ {{category.label}}
- - + + + +
- {{#each this.adversaries as |adversary|}} + {{#each category.adversaries as |adversary|}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=adversary type='adversary' isActor=true categoryAdversary=@../key}}
diff --git a/templates/sheets-settings/environment-settings/features.hbs b/templates/sheets-settings/environment-settings/features.hbs index e0a1bfce..f232dae9 100644 --- a/templates/sheets-settings/environment-settings/features.hbs +++ b/templates/sheets-settings/environment-settings/features.hbs @@ -3,7 +3,7 @@ data-tab='{{tabs.features.id}}' data-group='{{tabs.features.group}}' > -
@@ -16,8 +16,8 @@ {{feature.name}}
- - + +
{{/each}} diff --git a/templates/sheets/actors/character/header.hbs b/templates/sheets/actors/character/header.hbs index 038a8571..2b4ae13c 100644 --- a/templates/sheets/actors/character/header.hbs +++ b/templates/sheets/actors/character/header.hbs @@ -13,7 +13,8 @@

{{#if (or document.system.needsCharacterSetup document.system.levelData.canLevelUp)}} -

{{> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} -
diff --git a/templates/sheets/actors/environment/header.hbs b/templates/sheets/actors/environment/header.hbs index ca49e764..1318eecb 100644 --- a/templates/sheets/actors/environment/header.hbs +++ b/templates/sheets/actors/environment/header.hbs @@ -42,7 +42,7 @@
{{> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}} -
diff --git a/templates/sheets/global/tabs/tab-effects.hbs b/templates/sheets/global/tabs/tab-effects.hbs index 7ad940a7..744ef8e1 100644 --- a/templates/sheets/global/tabs/tab-effects.hbs +++ b/templates/sheets/global/tabs/tab-effects.hbs @@ -6,7 +6,7 @@
{{localize "DAGGERHEART.GENERAL.Effect.plural"}} - + diff --git a/templates/sheets/items/weapon/header.hbs b/templates/sheets/items/weapon/header.hbs index f381de0a..541a3e35 100644 --- a/templates/sheets/items/weapon/header.hbs +++ b/templates/sheets/items/weapon/header.hbs @@ -14,7 +14,6 @@ - {{localize (concat 'DAGGERHEART.CONFIG.Range.' source.system.range '.name')}} - - {{log this}} {{source.system.damage.dice}} + {{source.system.damage.bonus}} ({{localize (concat 'DAGGERHEART.CONFIG.DamageType.' source.system.damage.type '.abbreviation')}}) -