Various items fixes and enhancements

This commit is contained in:
2024-12-09 16:02:40 +01:00
parent 9775ec9fa1
commit 1de2927d93
51 changed files with 2102 additions and 574 deletions

View File

@ -23,10 +23,16 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
template: "systems/fvtt-lethal-fantasy/templates/character-main.hbs",
},
tabs: {
template: "systems/fvtt-lethal-fantasy/templates/generic/tab-navigation.hbs",
template: "templates/generic/tab-navigation.hbs",
},
items: {
template: "systems/fvtt-lethal-fantasy/templates/character-items.hbs",
skills: {
template: "systems/fvtt-lethal-fantasy/templates/character-skills.hbs",
},
weapons: {
template: "systems/fvtt-lethal-fantasy/templates/character-weapons.hbs",
},
spells: {
template: "systems/fvtt-lethal-fantasy/templates/character-spells.hbs",
},
biography: {
template: "systems/fvtt-lethal-fantasy/templates/character-biography.hbs",
@ -35,7 +41,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
/** @override */
tabGroups = {
sheet: "items",
sheet: "skills",
}
/**
@ -44,8 +50,10 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
*/
#getTabs() {
const tabs = {
items: { id: "items", group: "sheet", icon: "fa-solid fa-shapes", label: "LETHALFANTASY.Character.Label.details" },
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "LETHALFANTASY.Character.Label.biography" },
skills: { id: "skills", group: "sheet", icon: "fa-solid fa-shapes", label: "LETHALFANTASY.Label.skills" },
weapons: { id: "weapons", group: "sheet", icon: "fa-solid fa-swords", label: "LETHALFANTASY.Label.weapons" },
spells: { id: "spells", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-wand-magic-sparkles", label: "LETHALFANTASY.Label.spells" },
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "LETHALFANTASY.Label.biography" },
}
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id
@ -78,15 +86,24 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
const doc = this.document
switch (partId) {
case "main":
context.enrichedBiens = await TextEditor.enrichHTML(doc.system.biens, { async: true })
break
case "items":
context.tab = context.tabs.items
context.weapons = doc.itemTypes.weapon
context.armors = doc.itemTypes.armor
case "skills":
context.tab = context.tabs.skills
context.skills = doc.itemTypes.skill
context.gifts = doc.itemTypes.gifts
context.vulnerabilities = doc.itemTypes.vulnerability
break
case "spells":
context.tab = context.tabs.spells
context.spells = doc.itemTypes.spell
context.hasSpells = context.spells.length > 0
break
case "weapons":
context.tab = context.tabs.weapons
context.weapons = doc.itemTypes.weapon
context.armors = doc.itemTypes.armor
context.equipments = doc.itemTypes.equipment
break
case "biography":
context.tab = context.tabs.biography
context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true })
@ -111,11 +128,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
switch (data.type) {
case "Item":
const item = await fromUuid(data.uuid)
if (!["path", "weapon", "armor", "spell"].includes(item.type)) return
if (item.type === "path") return this.#onDropPathItem(item)
if (item.type === "weapon") return super._onDropItem(item)
if (item.type === "armor") return this._onDropItem(item)
if (item.type === "spell") return this._onDropItem(item)
return this._onDropItem(item)
}
}