move various power dialogs to DialogV2
This commit is contained in:
parent
a2fa9d3b05
commit
f900cb7d53
@ -78,6 +78,8 @@ import { WishEffect } from './wish.js';
|
|||||||
import { ZombieEffect } from './zombie.js';
|
import { ZombieEffect } from './zombie.js';
|
||||||
import { InquisitorJudgementEffect } from './inquisitor.js';
|
import { InquisitorJudgementEffect } from './inquisitor.js';
|
||||||
|
|
||||||
|
const { DialogV2 } = foundry.applications.api;
|
||||||
|
|
||||||
const PowerClasses = {
|
const PowerClasses = {
|
||||||
'animal-companion': SummonCompanionEffect,
|
'animal-companion': SummonCompanionEffect,
|
||||||
'arcane-protection': ArcaneProtectionEffect,
|
'arcane-protection': ArcaneProtectionEffect,
|
||||||
@ -313,7 +315,7 @@ export async function powerEffectsMenu(options = {}) {
|
|||||||
const powerInst = new powerClass();
|
const powerInst = new powerClass();
|
||||||
powers[powerInst.name] = powerClass;
|
powers[powerInst.name] = powerClass;
|
||||||
}
|
}
|
||||||
let form = `<form>
|
let form = `
|
||||||
<p>Select a power.</p>
|
<p>Select a power.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Power:</label>
|
<label>Power:</label>
|
||||||
@ -332,21 +334,22 @@ export async function powerEffectsMenu(options = {}) {
|
|||||||
}
|
}
|
||||||
form += `<option>${powerName}</option>`;
|
form += `<option>${powerName}</option>`;
|
||||||
}
|
}
|
||||||
form += `</optgroup></select></div></form>`;
|
form += `</optgroup></select></div>`;
|
||||||
const formResult = await Dialog.wait({
|
const formResult = await DialogV2.wait({
|
||||||
|
window: {
|
||||||
title: 'Select a power',
|
title: 'Select a power',
|
||||||
|
icon: 'fa-solid fa-wand-magic-sparkles',
|
||||||
|
},
|
||||||
content: form,
|
content: form,
|
||||||
buttons: {
|
buttons: [
|
||||||
submit: {
|
{
|
||||||
|
action: 'submit',
|
||||||
label: 'Choose Power',
|
label: 'Choose Power',
|
||||||
callback: (html) => {
|
default: true,
|
||||||
const formElement = html[0].querySelector('form');
|
callback: (event, button, dialog) => new FormDataExtended(button.form),
|
||||||
const formData = new FormDataExtended(formElement);
|
|
||||||
return formData;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cancel: { label: 'Cancel' },
|
|
||||||
},
|
},
|
||||||
|
{ action: 'cancel', label: 'Cancel' },
|
||||||
|
],
|
||||||
});
|
});
|
||||||
console.log(formResult);
|
console.log(formResult);
|
||||||
const powerName = formResult.get('power');
|
const powerName = formResult.get('power');
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class BaseAllyEffect extends BaseSummonEffect {
|
|||||||
const skillList = Array.from(skillSet);
|
const skillList = Array.from(skillSet);
|
||||||
skillList.sort();
|
skillList.sort();
|
||||||
const attrList = ['Agility', 'Smarts', 'Spirit', 'Strength', 'Vigor'];
|
const attrList = ['Agility', 'Smarts', 'Spirit', 'Strength', 'Vigor'];
|
||||||
let html = `<form><h2>Increase Attributes</h2><p>(+1 pp each)</p>`;
|
let html = `<div><h2>Increase Attributes</h2><p>(+1 pp each)</p>`;
|
||||||
html += attrList
|
html += attrList
|
||||||
.map(
|
.map(
|
||||||
(name) => `<div class="form-group">
|
(name) => `<div class="form-group">
|
||||||
@ -157,20 +157,21 @@ class BaseAllyEffect extends BaseSummonEffect {
|
|||||||
</div>`,
|
</div>`,
|
||||||
)
|
)
|
||||||
.join('');
|
.join('');
|
||||||
const formData = await Dialog.wait({
|
html += '</div>';
|
||||||
|
const formData = await foundry.applications.api.DialogV2.wait({
|
||||||
|
window: {
|
||||||
title: 'Select Trait increases',
|
title: 'Select Trait increases',
|
||||||
|
icon: 'fa-solid fa-person-arrow-up-from-line',
|
||||||
|
},
|
||||||
content: html,
|
content: html,
|
||||||
buttons: {
|
buttons: [
|
||||||
submit: {
|
{
|
||||||
|
action: 'submit',
|
||||||
label: 'Submit',
|
label: 'Submit',
|
||||||
callback: (html) => {
|
callback: (event, button, dialog) => new FormDataExtended(button.form),
|
||||||
const formElement = html[0].querySelector('form');
|
|
||||||
const formData = new FormDataExtended(formElement);
|
|
||||||
return formData.object;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cancel: { label: 'Cancel' },
|
|
||||||
},
|
},
|
||||||
|
{ action: 'cancel', label: 'Cancel' },
|
||||||
|
],
|
||||||
});
|
});
|
||||||
const mode = CONST.ACTIVE_EFFECT_MODES.ADD;
|
const mode = CONST.ACTIVE_EFFECT_MODES.ADD;
|
||||||
const value = 2;
|
const value = 2;
|
||||||
|
|||||||
@ -159,20 +159,20 @@ export class ZombieEffect extends BaseSummonEffect {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
`;
|
`;
|
||||||
const formData = await Dialog.wait({
|
const formData = await foundry.applications.api.DialogV2.wait({
|
||||||
|
window: {
|
||||||
title: 'Select trait for raise increase',
|
title: 'Select trait for raise increase',
|
||||||
|
icon: 'fa-solid fa-biohazard',
|
||||||
|
},
|
||||||
content: html,
|
content: html,
|
||||||
buttons: {
|
buttons: [
|
||||||
submit: {
|
{
|
||||||
|
action: 'submit',
|
||||||
label: 'Submit',
|
label: 'Submit',
|
||||||
callback: (html) => {
|
callback: (event, button, dialog) => new FormDataExtended(button.form),
|
||||||
const formElement = html[0].querySelector('form');
|
|
||||||
const formData = new FormDataExtended(formElement);
|
|
||||||
return formData.object;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
cancel: { label: 'cancel' },
|
|
||||||
},
|
},
|
||||||
|
{ action: 'cancel', label: 'cancel' },
|
||||||
|
],
|
||||||
});
|
});
|
||||||
const key = formData.trait;
|
const key = formData.trait;
|
||||||
this.data.primaryEffectChanges.push({
|
this.data.primaryEffectChanges.push({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user