Latest fixes for Oath Hammer

This commit is contained in:
2026-03-12 17:29:43 +01:00
parent e8d84615c5
commit 82fddb0cb3
20 changed files with 376 additions and 97 deletions

View File

@@ -0,0 +1,28 @@
import OathHammerItemSheet from "./base-item-sheet.mjs"
export default class OathHammerBuildingSheet extends OathHammerItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["building"],
position: {
width: 640,
},
window: {
contentClasses: ["building-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-oath-hammer/templates/item/building-sheet.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.notes ?? "", { async: true })
return context
}
}

View File

@@ -72,8 +72,26 @@ export default class OathHammerCharacterSheet extends OathHammerActorSheet {
break
case "identity":
context.tab = context.tabs.identity
context.abilities = doc.itemTypes.ability
context.oaths = doc.itemTypes.oath
context.traits = doc.itemTypes.trait.map(a => {
const typeKey = SYSTEM.TRAIT_TYPE_CHOICES[a.system.traitType]
const periodKey = SYSTEM.TRAIT_USAGE_PERIOD[a.system.usagePeriod]
const isPassive = a.system.usagePeriod === "none"
return {
id: a.id, uuid: a.uuid, img: a.img, name: a.name, system: a.system,
_typeLabel: typeKey ? game.i18n.localize(typeKey) : a.system.traitType,
_usageLabel: isPassive
? game.i18n.localize("OATHHAMMER.UsagePeriod.None")
: `${a.system.maxUses > 0 ? a.system.maxUses + " / " : ""}${game.i18n.localize(periodKey)}`
}
})
context.oaths = doc.itemTypes.oath.map(o => {
const typeEntry = SYSTEM.OATH_TYPES[o.system.oathType]
return {
id: o.id, uuid: o.uuid, img: o.img, name: o.name, system: o.system,
_typeLabel: typeEntry ? game.i18n.localize(typeEntry.label) : o.system.oathType,
_violated: o.system.violated
}
})
break
case "skills": {
context.tab = context.tabs.skills
@@ -116,8 +134,32 @@ export default class OathHammerCharacterSheet extends OathHammerActorSheet {
}
case "combat":
context.tab = context.tabs.combat
context.weapons = doc.itemTypes.weapon
context.armors = doc.itemTypes.armor
context.weapons = doc.itemTypes.weapon.map(w => {
const groupKey = SYSTEM.WEAPON_PROFICIENCY_GROUPS[w.system.proficiencyGroup]
const traitsLabel = [...w.system.traits].map(t => {
const tk = SYSTEM.WEAPON_TRAITS[t]
return tk ? game.i18n.localize(tk) : t
}).join(", ")
return {
id: w.id, uuid: w.uuid, img: w.img, name: w.name, system: w.system,
_groupLabel: groupKey ? game.i18n.localize(groupKey) : w.system.proficiencyGroup,
_traitsTooltip: traitsLabel || null,
_isMagic: w.system.isMagic
}
})
context.armors = doc.itemTypes.armor.map(a => {
const typeKey = SYSTEM.ARMOR_TYPE_CHOICES[a.system.armorType]
const traitsLabel = [...a.system.traits].map(t => {
const tk = SYSTEM.ARMOR_TRAITS[t]
return tk ? game.i18n.localize(tk) : t
}).join(", ")
return {
id: a.id, uuid: a.uuid, img: a.img, name: a.name, system: a.system,
_typeLabel: typeKey ? game.i18n.localize(typeKey) : a.system.armorType,
_traitsTooltip: traitsLabel || null,
_isMagic: a.system.isMagic
}
})
context.ammunition = doc.itemTypes.ammunition
break
case "magic":

View File

@@ -1,21 +1,21 @@
import OathHammerItemSheet from "./base-item-sheet.mjs"
export default class OathHammerAbilitySheet extends OathHammerItemSheet {
export default class OathHammerTraitSheet extends OathHammerItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["ability"],
classes: ["trait"],
position: {
width: 620,
},
window: {
contentClasses: ["ability-content"],
contentClasses: ["trait-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-oath-hammer/templates/item/ability-sheet.hbs",
template: "systems/fvtt-oath-hammer/templates/item/trait-sheet.hbs",
},
}