new foundry.applications.api.DialogV2({ window: { title: "Damage Roll Configuration" }, content: `
`, buttons: [ { action: "ok", label: "Roll Damage", callback: (event, button, dialog) => { const form = new foundry.applications.ux.FormDataExtended(button.form); console.log(form) const damageRoll = form.object.damageRoll; let flavor = form.object.flavor; const ap = parseInt(form.object.ap) || 0; const options = {}; if (ap > 0) { flavor = `${flavor ? flavor + " - " : ""}AP: ${ap}` options.ap = ap; } // Perform the damage roll and send the message new CONFIG.Dice.DamageRoll(damageRoll, null, options).toMessage({ flavor }); }, }, { action: "cancel", label: "Cancel", }, ], }).render(true);