Reduce Action Selection click number & Style Action Type Dialog (#408)

* Reduce Action Selection click number & Style Action Type Dialog

* fixes

* Action Select buttons color
This commit is contained in:
Dapoulp 2025-07-25 19:13:21 +02:00 committed by GitHub
parent 26e3c38aa9
commit 3f95740b7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 228 additions and 684 deletions

View file

@ -1,3 +1,5 @@
import ActionSelectionDialog from "../applications/dialogs/actionSelectionDialog.mjs";
/**
* Override and extend the basic Item implementation.
* @extends {foundry.documents.Item}
@ -94,41 +96,13 @@ export default class DHItem extends foundry.documents.Item {
});
}
async selectActionDialog(prevEvent) {
const content = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/dialogs/actionSelect.hbs',
{
actions: this.system.actionsList,
itemName: this.name
}
),
title = game.i18n.localize('DAGGERHEART.CONFIG.SelectAction.selectAction');
return foundry.applications.api.DialogV2.prompt({
window: { title },
classes: ['daggerheart', 'dh-style'],
content,
ok: {
label: title,
callback: (event, button, dialog) => {
Object.defineProperty(prevEvent, 'shiftKey', {
get() {
return event.shiftKey;
}
});
return this.system.actionsList.find(a => a._id === button.form.elements.actionId.value);
}
}
});
}
async use(event) {
const actions = new Set(this.system.actionsList);
if (actions?.size) {
let action = actions.first();
if (actions.size > 1 && !event?.shiftKey) {
// Actions Choice Dialog
action = await this.selectActionDialog(event);
action = await ActionSelectionDialog.create(this, event);
}
if (action) return action.use(event);
}