Fix weapon sheet
This commit is contained in:
@@ -22,6 +22,8 @@ export default class OathHammerArmorSheet extends OathHammerItemSheet {
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
const enrich = (v) => foundry.applications.ux.TextEditor.implementation.enrichHTML(v ?? "", { async: true })
|
||||
context.enrichedMagicEffect = await enrich(this.document.system.magicEffect)
|
||||
return context
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||
import { ARMOR_TYPE_CHOICES, WEAPON_PROFICIENCY_GROUPS } from "../../config/system.mjs"
|
||||
|
||||
export default class OathHammerItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||
@@ -68,6 +69,9 @@ export default class OathHammerItemSheet extends HandlebarsApplicationMixin(foun
|
||||
context.apChoices = Object.fromEntries(
|
||||
Array.from({ length: 7 }, (_, i) => [i, String(i)])
|
||||
)
|
||||
// Class proficiency choices (for class-sheet checkboxes)
|
||||
context.armorTypeChoices = ARMOR_TYPE_CHOICES
|
||||
context.weaponGroupChoices = WEAPON_PROFICIENCY_GROUPS
|
||||
return context
|
||||
}
|
||||
|
||||
|
||||
@@ -27,4 +27,16 @@ export default class OathHammerClassSheet extends OathHammerItemSheet {
|
||||
)
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override — collect checkbox sets explicitly so unchecking all works */
|
||||
_prepareSubmitData(event, form, formData) {
|
||||
const data = super._prepareSubmitData(event, form, formData)
|
||||
data["system.armorProficiency"] = Array.from(
|
||||
form.querySelectorAll('input[name="system.armorProficiency"]:checked')
|
||||
).map(el => el.value)
|
||||
data["system.weaponProficiency"] = Array.from(
|
||||
form.querySelectorAll('input[name="system.weaponProficiency"]:checked')
|
||||
).map(el => el.value)
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ export default class OathHammerMagicItemSheet extends OathHammerItemSheet {
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
const enrich = (v) => foundry.applications.ux.TextEditor.implementation.enrichHTML(v ?? "", { async: true })
|
||||
context.enrichedEffect = await enrich(this.document.system.effect)
|
||||
return context
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ export default class OathHammerWeaponSheet extends OathHammerItemSheet {
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
const enrich = (v) => foundry.applications.ux.TextEditor.implementation.enrichHTML(v ?? "", { async: true })
|
||||
context.enrichedMagicEffect = await enrich(this.document.system.magicEffect)
|
||||
return context
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user