Fix sheets

This commit is contained in:
2024-12-10 07:25:55 +01:00
parent 4eb360252f
commit 27c420200e
32 changed files with 65 additions and 215 deletions

View File

@ -4,7 +4,6 @@ export { default as LethalFantasyWeaponSheet } from "./sheets/weapon-sheet.mjs"
export { default as LethalFantasySkillSheet } from "./sheets/skill-sheet.mjs"
export { default as LethalFantasyGiftSheet } from "./sheets/gift-sheet.mjs"
export { default as LethalFantasyVulnerabilitySheet } from "./sheets/vulnerability-sheet.mjs"
export { default as LethalFantasySaveSheet } from "./sheets/save-sheet.mjs"
export { default as LethalFantasyArmorSheet } from "./sheets/armor-sheet.mjs"
export { default as LethalFantasySpellSheet } from "./sheets/spell-sheet.mjs"
export { default as LethalFantasyEquipmentSheet } from "./sheets/equipment-sheet.mjs"

View File

@ -19,9 +19,12 @@ export default class LethalFantasyArmorSheet extends LethalFantasyItemSheet {
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -22,6 +22,7 @@ export default class LethalFantasyEquipmentSheet extends LethalFantasyItemSheet
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -18,4 +18,12 @@ export default class LethalFantasyMiracleSheet extends LethalFantasyItemSheet {
template: "systems/fvtt-lethal-fantasy/templates/miracle.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -1,28 +0,0 @@
import LethalFantasyItemSheet from "./base-item-sheet.mjs"
export default class LethalFantasyGiftSheet extends LethalFantasyItemSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["save"],
position: {
width: 600,
},
window: {
contentClasses: ["save-content"],
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-lethal-fantasy/templates/save.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -22,6 +22,7 @@ export default class LethalFantasyShieldSheet extends LethalFantasyItemSheet {
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -18,4 +18,12 @@ export default class LethalFantasySpellSheet extends LethalFantasyItemSheet {
template: "systems/fvtt-lethal-fantasy/templates/spell.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -18,4 +18,12 @@ export default class LethalFantasyWeaponSheet extends LethalFantasyItemSheet {
template: "systems/fvtt-lethal-fantasy/templates/weapon.hbs",
},
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
return context
}
}

View File

@ -7,6 +7,5 @@ export { default as LethalFantasyArmor } from "./armor.mjs"
export { default as LethalFantasyShield } from "./shield.mjs"
export { default as LethalFantasyGift } from "./gift.mjs"
export { default as LethalFantasyVulnerability } from "./vulnerability.mjs"
export { default as LethalFantasySave } from "./save.mjs"
export { default as LethalFantasyEquipment } from "./equipment.mjs"
export { default as LethalFantasyMiracle } from "./miracle.mjs"

View File

@ -6,13 +6,13 @@ export default class LethalFantasyArmor extends foundry.abstract.TypeDataModel {
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.armortype = new fields.StringField({ required: true, initial: "light", choices: SYSTEM.ARMOR_TYPE })
schema.armorType = new fields.StringField({ required: true, initial: "light", choices: SYSTEM.ARMOR_TYPE })
schema.defense = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: -50 })
schema.movementreduction = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.maximumMovement = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.hp = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.damagereduction = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.damageReduction = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.load = new fields.StringField({ required: true, initial: "L" })
schema.encLoad = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })
@ -23,7 +23,4 @@ export default class LethalFantasyArmor extends foundry.abstract.TypeDataModel {
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Armor"]
get weaponCategory() {
return game.i18n.localize(CATEGORY[this.category].label)
}
}

View File

@ -9,7 +9,7 @@ export default class LethalFantasyEquipment extends foundry.abstract.TypeDataMod
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.category = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.EQUIPMENT_CATEGORIES })
schema.load = new fields.StringField({ required: true, initial: "L" })
schema.encLoad = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.hi = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.medium = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.lo = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })

View File

@ -1,17 +0,0 @@
export default class LethalFantasySave extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.cost = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.value = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Save"]
}

View File

@ -28,7 +28,7 @@ export default class LethalFantasyShield extends foundry.abstract.TypeDataModel
piercing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
})
schema.load = new fields.StringField({ required: true, initial: "L" })
schema.encLoad = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })

View File

@ -40,7 +40,7 @@ export default class LethalFantasySkill extends foundry.abstract.TypeDataModel {
outOfSkill: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
})
schema.load = new fields.StringField({ required: true, initial: "L" })
schema.encLoad = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.cost = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })