Fix char sheet iteration

This commit is contained in:
2025-03-03 23:35:22 +01:00
parent 5771272cff
commit da9a69b916
11 changed files with 493 additions and 825 deletions

View File

@@ -12,45 +12,31 @@ export default class FTLNomadCharacterSheet extends FTLNomadActorSheet {
contentClasses: ["character-content"],
},
actions: {
setBP: FTLNomadCharacterSheet.#onSetBP,
createGear: FTLNomadCharacterSheet.#onCreateGear,
createArmor: FTLNomadCharacterSheet.#onCreateArmor,
createWeapon: FTLNomadCharacterSheet.#onCreateWeapon,
createBond: FTLNomadCharacterSheet.#onCreateBond,
createInjury: FTLNomadCharacterSheet.#onCreateInjury,
createMentalDisorder: FTLNomadCharacterSheet.#onCreateMentalDisorder,
createMotivation: FTLNomadCharacterSheet.#onCreateMotivation,
createSkill: FTLNomadCharacterSheet.#onCreateSkill,
createRitual: FTLNomadCharacterSheet.#onCreateRitual,
createTome: FTLNomadCharacterSheet.#onCreateTome,
createWeapon: FTLNomadCharacterSheet.#onCreateWeapon
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-ftl-nomad/templates/protagonist-main.hbs",
template: "systems/fvtt-ftl-nomad/templates/character-main.hbs",
},
tabs: {
template: "templates/generic/tab-navigation.hbs",
},
skills: {
template: "systems/fvtt-ftl-nomad/templates/protagonist-skills.hbs",
},
status: {
template: "systems/fvtt-ftl-nomad/templates/protagonist-status.hbs",
},
equipment: {
template: "systems/fvtt-ftl-nomad/templates/protagonist-equipment.hbs",
template: "systems/fvtt-ftl-nomad/templates/character-equipment.hbs",
},
biography: {
template: "systems/fvtt-ftl-nomad/templates/protagonist-biography.hbs",
template: "systems/fvtt-ftl-nomad/templates/character-biography.hbs",
},
}
/** @override */
tabGroups = {
sheet: "skills",
sheet: "main",
}
/**
@@ -59,8 +45,6 @@ export default class FTLNomadCharacterSheet extends FTLNomadActorSheet {
*/
#getTabs() {
const tabs = {
skills: { id: "skills", group: "sheet", icon: "fa-solid fa-shapes", label: "FTLNOMAD.Label.skills" },
status: { id: "status", group: "sheet", icon: "fa-solid fa-file-waveform", label: "FTLNOMAD.Label.status" },
equipment: { id: "equipment", group: "sheet", icon: "fa-solid fa-shapes", label: "FTLNOMAD.Label.equipment" },
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "FTLNOMAD.Label.biography" },
}
@@ -79,15 +63,6 @@ export default class FTLNomadCharacterSheet extends FTLNomadActorSheet {
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
context.enrichedNotes = await TextEditor.enrichHTML(this.document.system.notes, { async: true })
context.tooltipsCharacteristic = {
str: game.i18n.localize("FTLNOMAD.Characteristic.Str"),
dex: game.i18n.localize("FTLNOMAD.Characteristic.Dex"),
con: game.i18n.localize("FTLNOMAD.Characteristic.Con"),
int: game.i18n.localize("FTLNOMAD.Characteristic.Int"),
pow: game.i18n.localize("FTLNOMAD.Characteristic.Pow"),
cha: game.i18n.localize("FTLNOMAD.Characteristic.Cha")
}
return context
}
@@ -97,34 +72,14 @@ export default class FTLNomadCharacterSheet extends FTLNomadActorSheet {
switch (partId) {
case "main":
break
case "skills":
context.tab = context.tabs.skills
context.skills = doc.itemTypes.skill
context.skills.sort((a, b) => a.name.localeCompare(b.name))
break
case "equipment":
context.tab = context.tabs.equipment
context.weapons = doc.itemTypes.weapon
context.weapons.sort((a, b) => a.name.localeCompare(b.name))
context.armors = doc.itemTypes.armor
context.armors.sort((a, b) => a.name.localeCompare(b.name))
context.gears = doc.itemTypes.gear
context.gears.sort((a, b) => a.name.localeCompare(b.name))
context.rituals = doc.itemTypes.ritual
context.rituals.sort((a, b) => a.name.localeCompare(b.name))
context.tomes = doc.itemTypes.tome
context.tomes.sort((a, b) => a.name.localeCompare(b.name))
break
case "status":
context.tab = context.tabs.status
context.injuries = doc.itemTypes.injury
context.injuries.sort((a, b) => a.name.localeCompare(b.name))
context.mentaldisorders = doc.itemTypes.mentaldisorder
context.mentaldisorders.sort((a, b) => a.name.localeCompare(b.name))
context.motivations = doc.itemTypes.motivation
context.motivations.sort((a, b) => a.name.localeCompare(b.name))
context.bonds = doc.itemTypes.bond
context.bonds.sort((a, b) => a.name.localeCompare(b.name))
context.equipments = doc.itemTypes.equipment
context.equipments.sort((a, b) => a.name.localeCompare(b.name))
break
case "biography":
context.tab = context.tabs.biography
@@ -135,14 +90,6 @@ export default class FTLNomadCharacterSheet extends FTLNomadActorSheet {
return context
}
/**
* Creates a new attack item directly from the sheet and embeds it into the document.
* @param {Event} event The initiating click event.
* @param {HTMLElement} target The current target of the event listener.
*/
static #onSetBP(event, target) {
this.document.system.setBP()
}
static #onCreateGear(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newGear"), type: "gear" }])
@@ -156,33 +103,6 @@ export default class FTLNomadCharacterSheet extends FTLNomadActorSheet {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newArmor"), type: "armor" }])
}
static #onCreateBond(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newBond"), type: "bond" }])
}
static #onCreateInjury(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newInjury"), type: "injury" }])
}
static #onCreateMentalDisorder(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newMentalDisorder"), type: "mentaldisorder" }])
}
static #onCreateMotivation(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newMotivation"), type: "motivation" }])
}
static #onCreateSkill(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newSkill"), type: "skill" }])
}
static #onCreateRitual(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newRitual"), type: "ritual" }])
}
static #onCreateTome(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newTome"), type: "tome" }])
}
/**
* Handles the roll action triggered by user interaction.

View File

@@ -20,7 +20,7 @@ export const SKILLS = {
"social": { id: "social", label: "FTLNOMAD.Skill.Social" },
"physical": { id: "physical", label: "FTLNOMAD.Skill.Physical" },
"stealth": { id: "stealth", label: "FTLNOMAD.Skill.Stealth" },
"vehicles": { id: "vehicle", label: "FTLNOMAD.Skill.Vehicles" },
"vehicles": { id: "vehicles", label: "FTLNOMAD.Skill.Vehicles" },
"technology": { id: "technology", label: "FTLNOMAD.Skill.Technology" }
}