converted powers dialog to applicationv2
This commit is contained in:
@@ -59,15 +59,22 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
|
||||
width: 600,
|
||||
height: 'auto',
|
||||
},
|
||||
classes: ['sheet', 'mbSwadeForm', 'mbSwadePowerEffectsForm'],
|
||||
classes: ['standard-form', 'mbSwade', 'mbSwadeForm', 'mbSwadePowerEffectsForm'],
|
||||
window: {
|
||||
icon: 'fa-solid fa-hand-sparkles',
|
||||
title: 'mbSwade.powerEffectsForm.title',
|
||||
title: 'Apply Effect',
|
||||
},
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
body: { template: templates['powerDialog.html'] },
|
||||
header: {
|
||||
template: templates['dialogHeader.html'],
|
||||
classes: ['mbSwade', 'mbSwadeDialogHeader', 'flexrow'],
|
||||
},
|
||||
body: {
|
||||
template: templates['powerDialog.html'],
|
||||
classes: ['mbSwadePowerEffectsBody'],
|
||||
},
|
||||
footer: {
|
||||
template: 'templates/generic/form-footer.hbs',
|
||||
classes: ['sheet-footer', 'flexrow'],
|
||||
@@ -111,6 +118,8 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
|
||||
}
|
||||
const data = {
|
||||
name: this.powerEffect.name,
|
||||
headerTitle: `${this.powerEffect.name} Effect`,
|
||||
headerSubtitle: `Apply the effects from ${this.powerEffect.name}`,
|
||||
icon: this.powerEffect.icon,
|
||||
basePowerPoints: this.powerEffect.basePowerPoints,
|
||||
modifiers,
|
||||
@@ -123,6 +132,10 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
|
||||
targets: [],
|
||||
buttons: this.powerEffect.menuButtons,
|
||||
};
|
||||
for (let button of data.buttons) {
|
||||
button.action = button.value;
|
||||
button.type = button.value === 'cancel' ? 'cancel' : 'submit';
|
||||
}
|
||||
if (this.powerEffect.isTargeted) {
|
||||
if (this.powerEffect.oneTarget) {
|
||||
data.targets = [this.powerEffect.targets?.[0]?.name ?? '<em>No Target Selected!</em>'];
|
||||
@@ -141,9 +154,10 @@ export class PowerFormApplication extends HandlebarsApplicationMixin(Application
|
||||
}
|
||||
|
||||
static async #onSubmit(event, form, formData) {
|
||||
formData.submit = event?.submitter?.value ?? 'cancel';
|
||||
if (formData.submit !== 'cancel') {
|
||||
this.powerEffect.formData = formData;
|
||||
log(this.formData);
|
||||
formData.object.submit = event?.submitter?.dataset?.action ?? 'cancel';
|
||||
if (formData.object.submit !== 'cancel') {
|
||||
this.powerEffect.formData = formData.object;
|
||||
this.powerEffect.applyEffect();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user