First row of tests and fixes

This commit is contained in:
2026-03-05 23:43:45 +01:00
parent f28df2ae76
commit 95b19c8f02
9 changed files with 430 additions and 86 deletions
@@ -27,12 +27,12 @@ export default class AwECharacterSheet extends AwEActorSheet {
header: {
template: "systems/fvtt-adventures-with-emmy/templates/character-header.hbs"
},
main: {
template: "systems/fvtt-adventures-with-emmy/templates/character-main.hbs"
},
tabs: {
template: "templates/generic/tab-navigation.hbs"
},
main: {
template: "systems/fvtt-adventures-with-emmy/templates/character-main.hbs"
},
biography: {
template: "systems/fvtt-adventures-with-emmy/templates/character-biography.hbs"
},
+48 -1
View File
@@ -6,7 +6,7 @@ export default class AwECreatureSheet extends AwEActorSheet {
classes: ["creature"],
position: {
width: 700,
height: "auto"
height: 700
},
window: {
contentClasses: ["creature-content"]
@@ -15,17 +15,64 @@ export default class AwECreatureSheet extends AwEActorSheet {
/** @override */
static PARTS = {
header: {
template: "systems/fvtt-adventures-with-emmy/templates/creature-header.hbs"
},
tabs: {
template: "templates/generic/tab-navigation.hbs"
},
main: {
template: "systems/fvtt-adventures-with-emmy/templates/creature-main.hbs"
},
description: {
template: "systems/fvtt-adventures-with-emmy/templates/creature-description.hbs"
},
eureka: {
template: "systems/fvtt-adventures-with-emmy/templates/creature-eureka.hbs"
}
}
/** @override */
tabGroups = {
sheet: "main"
}
#getTabs() {
const tabs = {
main: { id: "main", group: "sheet", icon: "fa-solid fa-dragon", label: "AWEMMY.Sheet.Tab.Main" },
description: { id: "description", group: "sheet", icon: "fa-solid fa-scroll", label: "AWEMMY.Sheet.Tab.Description" },
eureka: { id: "eureka", group: "sheet", icon: "fa-solid fa-lightbulb", label: "AWEMMY.Sheet.Tab.Eureka" }
}
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id
v.cssClass = v.active ? "active" : ""
}
return tabs
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.tabs = this.#getTabs()
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.description, { async: true }
)
return context
}
/** @override */
async _preparePartContext(partId, context) {
switch (partId) {
case "main":
context.tab = context.tabs.main
break
case "description":
context.tab = context.tabs.description
break
case "eureka":
context.tab = context.tabs.eureka
break
}
return context
}
}
+4 -2
View File
@@ -17,7 +17,8 @@ export default class AwECharacter extends foundry.abstract.TypeDataModel {
schema.backgroundName = new fields.StringField({ initial: "", required: false, nullable: true })
// Core stats
schema.level = new fields.NumberField({ ...requiredInteger, initial: 1, min: 1, max: 10 })
schema.level = new fields.NumberField({ ...requiredInteger, initial: 1, min: 1, max: 10,
choices: Object.fromEntries([1,2,3,4,5,6,7,8,9,10].map(v => [v, String(v)])) })
schema.stride = new fields.NumberField({ ...requiredInteger, initial: 5, min: 0 })
// Hit Points
@@ -39,7 +40,8 @@ export default class AwECharacter extends foundry.abstract.TypeDataModel {
// dc = 10 + mod (computed)
// bonus: manual +/- bonus
const attributeField = () => new fields.SchemaField({
boostLevel: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 4 }),
boostLevel: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 4,
choices: {0:"0", 1:"1", 2:"2", 3:"3", 4:"4"} }),
bonus: new fields.NumberField({ required: true, nullable: false, integer: true, initial: 0 })
})