mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-06 04:44:16 +02:00
Fixed Companion base attack context menu
This commit is contained in:
parent
f24bd23f1a
commit
93ea6f990f
1 changed files with 53 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { getDocFromElement } from '../../../helpers/utils.mjs';
|
||||||
import DhCompanionLevelUp from '../../levelup/companionLevelup.mjs';
|
import DhCompanionLevelUp from '../../levelup/companionLevelup.mjs';
|
||||||
import DHBaseActorSheet from '../api/base-actor.mjs';
|
import DHBaseActorSheet from '../api/base-actor.mjs';
|
||||||
|
|
||||||
|
|
@ -11,7 +12,17 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
|
||||||
toggleStress: DhCompanionSheet.#toggleStress,
|
toggleStress: DhCompanionSheet.#toggleStress,
|
||||||
actionRoll: DhCompanionSheet.#actionRoll,
|
actionRoll: DhCompanionSheet.#actionRoll,
|
||||||
levelManagement: DhCompanionSheet.#levelManagement
|
levelManagement: DhCompanionSheet.#levelManagement
|
||||||
|
},
|
||||||
|
contextMenus: [
|
||||||
|
{
|
||||||
|
handler: DhCompanionSheet.#getAttackContextOptions,
|
||||||
|
selector: '[data-item-uuid][data-type="attack"]',
|
||||||
|
options: {
|
||||||
|
parentClassHooks: false,
|
||||||
|
fixed: true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
static PARTS = {
|
static PARTS = {
|
||||||
|
|
@ -38,6 +49,47 @@ 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 */
|
/* Application Clicks Actions */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue