diff --git a/module/applications/sheets/actors/adversary.mjs b/module/applications/sheets/actors/adversary.mjs index ada7af6d..06dd4a0f 100644 --- a/module/applications/sheets/actors/adversary.mjs +++ b/module/applications/sheets/actors/adversary.mjs @@ -34,7 +34,7 @@ export default class AdversarySheet extends DHBaseActorSheet { ], contextMenus: [ { - handler: AdversarySheet.#getStandardAttackContextOptions, + handler: DHBaseActorSheet.getBaseAttackContextOptions, selector: '[data-item-uuid][data-type="attack"]', options: { parentClassHooks: false, @@ -274,43 +274,6 @@ export default class AdversarySheet extends DHBaseActorSheet { }); } - /** - * Get the set of ContextMenu options for the standard attack. - * @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance - * @this {CharacterSheet} - * @protected - */ - static #getStandardAttackContextOptions() { - /**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */ - return [ - { - label: 'DAGGERHEART.CONFIG.RollTypes.attack.name', - icon: 'fa-solid fa-burst', - onClick: async (event, target) => (await getDocFromElement(target)).use(event) - }, - { - label: 'DAGGERHEART.GENERAL.damage', - icon: 'fa-solid fa-explosion', - onClick: async (event, target) => { - const doc = await getDocFromElement(target), - action = doc?.system?.attack ?? doc; - const config = action.prepareConfig(event); - config.effects = await game.system.api.data.actions.actionsTypes.base.getEffects( - this.document, - doc - ); - config.hasRoll = false; - return action && action.workflow.get('damage').execute(config, null, true); - } - }, - { - label: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat', - icon: 'fa-solid fa-message', - onClick: async (_, target) => (await getDocFromElement(target)).toChat(this.document.uuid) - } - ]; - } - /* -------------------------------------------- */ /* Application Listener Actions */ /* -------------------------------------------- */ diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index 43b5ce52..e4d0e6d9 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -66,7 +66,7 @@ export default class CharacterSheet extends DHBaseActorSheet { } }, { - handler: CharacterSheet.#getBaseAttackContextOptions, + handler: DHBaseActorSheet.getBaseAttackContextOptions, selector: '[data-item-uuid][data-type="attack"]', options: { parentClassHooks: false, @@ -388,43 +388,6 @@ export default class CharacterSheet extends DHBaseActorSheet { ]; } - /** - * Get the set of ContextMenu options for the base attack. - * @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance - * @this {CharacterSheet} - * @protected - */ - static #getBaseAttackContextOptions() { - /**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */ - return [ - { - label: 'DAGGERHEART.CONFIG.RollTypes.attack.name', - icon: 'fa-solid fa-burst', - onClick: async (event, target) => (await getDocFromElement(target)).use(event) - }, - { - label: 'DAGGERHEART.GENERAL.damage', - icon: 'fa-solid fa-explosion', - onClick: async (event, target) => { - const doc = await getDocFromElement(target), - action = doc?.system?.attack ?? doc; - const config = action.prepareConfig(event); - config.effects = await game.system.api.data.actions.actionsTypes.base.getEffects( - this.document, - doc - ); - config.hasRoll = false; - return action && action.workflow.get('damage').execute(config, null, true); - } - }, - { - label: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat', - icon: 'fa-solid fa-message', - onClick: async (_, target) => (await getDocFromElement(target)).toChat(this.document.uuid) - } - ]; - } - /** * Get the set of ContextMenu options for DomainCards. * @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance diff --git a/module/applications/sheets/actors/companion.mjs b/module/applications/sheets/actors/companion.mjs index 392fb5a1..a49c568f 100644 --- a/module/applications/sheets/actors/companion.mjs +++ b/module/applications/sheets/actors/companion.mjs @@ -15,7 +15,7 @@ export default class DhCompanionSheet extends DHBaseActorSheet { }, contextMenus: [ { - handler: DhCompanionSheet.#getAttackContextOptions, + handler: DHBaseActorSheet.getBaseAttackContextOptions, selector: '[data-item-uuid][data-type="attack"]', options: { parentClassHooks: false, @@ -49,47 +49,6 @@ export default class DhCompanionSheet extends DHBaseActorSheet { } }; - /* -------------------------------------------- */ - /* Context Menu */ - /* -------------------------------------------- */ - - /** - * Get the set of ContextMenu options for the companion's attack. - * @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance - * @this {CharacterSheet} - * @protected - */ - static #getAttackContextOptions() { - /**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */ - return [ - { - label: 'DAGGERHEART.CONFIG.RollTypes.attack.name', - icon: 'fa-solid fa-burst', - onClick: async (event, target) => (await getDocFromElement(target)).use(event) - }, - { - label: 'DAGGERHEART.GENERAL.damage', - icon: 'fa-solid fa-explosion', - onClick: async (event, target) => { - const doc = await getDocFromElement(target), - action = doc?.system?.attack ?? doc; - const config = action.prepareConfig(event); - config.effects = await game.system.api.data.actions.actionsTypes.base.getEffects( - this.document, - doc - ); - config.hasRoll = false; - return action && action.workflow.get('damage').execute(config, null, true); - } - }, - { - label: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat', - icon: 'fa-solid fa-message', - onClick: async (_, target) => (await getDocFromElement(target)).toChat(this.document.uuid) - } - ]; - } - /* -------------------------------------------- */ /* Application Clicks Actions */ /* -------------------------------------------- */ diff --git a/module/applications/sheets/api/base-actor.mjs b/module/applications/sheets/api/base-actor.mjs index 5cd0f6a5..7b820822 100644 --- a/module/applications/sheets/api/base-actor.mjs +++ b/module/applications/sheets/api/base-actor.mjs @@ -189,6 +189,43 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) { return this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true }); } + /** + * Get the set of ContextMenu options for the base attack. + * @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance + * @this {CharacterSheet} + * @protected + */ + static getBaseAttackContextOptions() { + /**@type {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} */ + return [ + { + label: 'DAGGERHEART.CONFIG.RollTypes.attack.name', + icon: 'fa-solid fa-burst', + onClick: async (event, target) => (await getDocFromElement(target)).use(event) + }, + { + label: 'DAGGERHEART.GENERAL.damage', + icon: 'fa-solid fa-explosion', + onClick: async (event, target) => { + const doc = await getDocFromElement(target), + action = doc?.system?.attack ?? doc; + const config = action.prepareConfig(event); + config.effects = await game.system.api.data.actions.actionsTypes.base.getEffects( + this.document, + doc + ); + config.hasRoll = false; + return action && action.workflow.get('damage').execute(config, null, true); + } + }, + { + label: 'DAGGERHEART.APPLICATIONS.ContextMenu.sendToChat', + icon: 'fa-solid fa-message', + onClick: async (_, target) => (await getDocFromElement(target)).toChat(this.document.uuid) + } + ]; + } + /* -------------------------------------------- */ /* Application Listener Actions */ /* -------------------------------------------- */