This commit is contained in:
WBHarry 2025-07-21 21:21:57 +02:00
parent d6049ed230
commit 50255b8cda

View file

@ -88,6 +88,7 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
} }
async selectActionType() { async selectActionType() {
return (
(await foundry.applications.api.DialogV2.input({ (await foundry.applications.api.DialogV2.input({
window: { title: game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType') }, window: { title: game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectType') },
content: await foundry.applications.handlebars.renderTemplate( content: await foundry.applications.handlebars.renderTemplate(
@ -99,17 +100,20 @@ export default class DhSettingsActionView extends HandlebarsApplicationMixin(App
type: game.i18n.localize('DAGGERHEART.GENERAL.Action.single') type: game.i18n.localize('DAGGERHEART.GENERAL.Action.single')
}) })
} }
})) ?? {}; })) ?? {}
);
} }
static async addItem() { static async addItem() {
const actionType = await this.selectActionType(); const { type: actionType } = await this.selectActionType();
const cls = actionsTypes[actionType?.type] ?? actionsTypes.attack, if (!actionType) return;
const cls = actionsTypes[actionType] ?? actionsTypes.attack,
action = new cls( action = new cls(
{ {
_id: foundry.utils.randomID(), _id: foundry.utils.randomID(),
type: actionType.type, type: actionType,
name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType.type].name), name: game.i18n.localize(CONFIG.DH.ACTIONS.actionTypes[actionType].name),
img: 'icons/magic/life/cross-worn-green.webp', img: 'icons/magic/life/cross-worn-green.webp',
actionType: 'action', actionType: 'action',
systemPath: this.actionsPath systemPath: this.actionsPath