Fixes and enhancements, from issue list

This commit is contained in:
2026-03-27 22:28:47 +01:00
parent c22c3d713b
commit 2bf737a3ef
6 changed files with 126 additions and 105 deletions

View File

@@ -181,22 +181,20 @@ export default class OathHammerNPCSheet extends OathHammerActorSheet {
}
)
const result = await foundry.applications.api.DialogV2.prompt({
window: { title: attack.name, resizable: true },
classes: ["fvtt-oath-hammer"],
position: { width: 420 },
content,
ok: { label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-burst" },
const result = await foundry.applications.api.DialogV2.wait({
window: { title: attack.name, resizable: true },
classes: ["fvtt-oath-hammer"], position: { width: 420 }, content,
rejectClose: false,
buttons: [{ label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-burst",
callback: (_ev, btn) => { const o = {}; for (const el of btn.form.elements) { if (!el.name) continue; o[el.name] = el.type === "checkbox" ? String(el.checked) : el.value } return o }
}],
})
if (!result) return
const form = new DOMParser().parseFromString(result, "text/html")
const getValue = name => form.querySelector(`[name="${name}"]`)?.value
await rollNPCAttackDamage(this.document, attack, {
bonus: parseInt(getValue("bonus")) || 0,
explodeOn5: getValue("explodeOn5") === "true",
visibility: getValue("visibility"),
bonus: parseInt(result.bonus) || 0,
explodeOn5: result.explodeOn5 === "true",
visibility: result.visibility,
})
}
@@ -236,24 +234,22 @@ export default class OathHammerNPCSheet extends OathHammerActorSheet {
}
)
const result = await foundry.applications.api.DialogV2.prompt({
window: { title: spell.name, resizable: true },
classes: ["fvtt-oath-hammer"],
position: { width: 420 },
content,
ok: { label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-wand-sparkles" },
const result = await foundry.applications.api.DialogV2.wait({
window: { title: spell.name, resizable: true },
classes: ["fvtt-oath-hammer"], position: { width: 420 }, content,
rejectClose: false,
buttons: [{ label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-wand-sparkles",
callback: (_ev, btn) => { const o = {}; for (const el of btn.form.elements) { if (!el.name) continue; o[el.name] = el.type === "checkbox" ? String(el.checked) : el.value } return o }
}],
})
if (!result) return
const form = new DOMParser().parseFromString(result, "text/html")
const getValue = name => form.querySelector(`[name="${name}"]`)?.value
await rollNPCSpell(this.document, spell, {
dicePool: parseInt(getValue("dicePool")) || 3,
bonus: parseInt(getValue("bonus")) || 0,
colorOverride: getValue("colorOverride") || null,
explodeOn5: getValue("explodeOn5") === "true",
visibility: getValue("visibility"),
dicePool: parseInt(result.dicePool) || 3,
bonus: parseInt(result.bonus) || 0,
colorOverride: result.colorOverride || null,
explodeOn5: result.explodeOn5 === "true",
visibility: result.visibility,
})
}
@@ -282,23 +278,21 @@ export default class OathHammerNPCSheet extends OathHammerActorSheet {
}
)
const result = await foundry.applications.api.DialogV2.prompt({
window: { title: miracle.name, resizable: true },
classes: ["fvtt-oath-hammer"],
position: { width: 420 },
content,
ok: { label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-hands-praying" },
const result = await foundry.applications.api.DialogV2.wait({
window: { title: miracle.name, resizable: true },
classes: ["fvtt-oath-hammer"], position: { width: 420 }, content,
rejectClose: false,
buttons: [{ label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-hands-praying",
callback: (_ev, btn) => { const o = {}; for (const el of btn.form.elements) { if (!el.name) continue; o[el.name] = el.type === "checkbox" ? String(el.checked) : el.value } return o }
}],
})
if (!result) return
const form = new DOMParser().parseFromString(result, "text/html")
const getValue = name => form.querySelector(`[name="${name}"]`)?.value
await rollNPCMiracle(this.document, miracle, {
dicePool: parseInt(getValue("dicePool")) || 3,
bonus: parseInt(getValue("bonus")) || 0,
explodeOn5: getValue("explodeOn5") === "true",
visibility: getValue("visibility"),
dicePool: parseInt(result.dicePool) || 3,
bonus: parseInt(result.bonus) || 0,
explodeOn5: result.explodeOn5 === "true",
visibility: result.visibility,
})
}
@@ -335,23 +329,21 @@ export default class OathHammerNPCSheet extends OathHammerActorSheet {
}
)
const result = await foundry.applications.api.DialogV2.prompt({
window: { title: game.i18n.localize("OATHHAMMER.Label.ArmorDice"), resizable: true },
classes: ["fvtt-oath-hammer"],
position: { width: 420 },
content,
ok: { label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-dice-d6" },
const result = await foundry.applications.api.DialogV2.wait({
window: { title: game.i18n.localize("OATHHAMMER.Label.ArmorDice"), resizable: true },
classes: ["fvtt-oath-hammer"], position: { width: 420 }, content,
rejectClose: false,
buttons: [{ label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-dice-d6",
callback: (_ev, btn) => { const o = {}; for (const el of btn.form.elements) { if (!el.name) continue; o[el.name] = el.type === "checkbox" ? String(el.checked) : el.value } return o }
}],
})
if (!result) return
const form = new DOMParser().parseFromString(result, "text/html")
const getValue = name => form.querySelector(`[name="${name}"]`)?.value
await rollNPCArmor(actor, {
bonus: parseInt(getValue("bonus")) || 0,
colorOverride: getValue("colorOverride") || null,
explodeOn5: getValue("explodeOn5") === "true",
visibility: getValue("visibility"),
bonus: parseInt(result.bonus) || 0,
colorOverride: result.colorOverride || null,
explodeOn5: result.explodeOn5 === "true",
visibility: result.visibility,
})
}
@@ -395,23 +387,21 @@ export default class OathHammerNPCSheet extends OathHammerActorSheet {
}
)
const result = await foundry.applications.api.DialogV2.prompt({
window: { title: item.name, resizable: true },
classes: ["fvtt-oath-hammer"],
position: { width: 420 },
content,
ok: { label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-dice-d6" },
const result = await foundry.applications.api.DialogV2.wait({
window: { title: item.name, resizable: true },
classes: ["fvtt-oath-hammer"], position: { width: 420 }, content,
rejectClose: false,
buttons: [{ label: game.i18n.localize("OATHHAMMER.Dialog.Roll"), icon: "fa-solid fa-dice-d6",
callback: (_ev, btn) => { const o = {}; for (const el of btn.form.elements) { if (!el.name) continue; o[el.name] = el.type === "checkbox" ? String(el.checked) : el.value } return o }
}],
})
if (!result) return
const form = new DOMParser().parseFromString(result, "text/html")
const getValue = name => form.querySelector(`[name="${name}"]`)?.value
await rollNPCSkill(this.document, item, {
bonus: parseInt(getValue("bonus")) || 0,
colorOverride: getValue("colorOverride") || null,
explodeOn5: getValue("explodeOn5") === "true",
visibility: getValue("visibility"),
bonus: parseInt(result.bonus) || 0,
colorOverride: result.colorOverride || null,
explodeOn5: result.explodeOn5 === "true",
visibility: result.visibility,
})
}