Manage ers

This commit is contained in:
2024-12-22 23:04:15 +01:00
parent 93901d5f1e
commit 15f512ea3a
57 changed files with 1132 additions and 146 deletions

View File

@ -5,14 +5,21 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
static DEFAULT_OPTIONS = {
classes: ["protagonist"],
position: {
width: 840,
width: 848,
height: 620,
},
window: {
contentClasses: ["protagonist-content"],
},
actions: {
createEquipment: CthulhuEternalProtagonistSheet.#onCreateEquipment,
createGear: CthulhuEternalProtagonistSheet.#onCreateGear,
createArmor: CthulhuEternalProtagonistSheet.#onCreateArmor,
createWeapon: CthulhuEternalProtagonistSheet.#onCreateWeapon,
createBond: CthulhuEternalProtagonistSheet.#onCreateBond,
createInjury: CthulhuEternalProtagonistSheet.#onCreateInjury,
createMentalDisorder: CthulhuEternalProtagonistSheet.#onCreateMentalDisorder,
createMotivation: CthulhuEternalProtagonistSheet.#onCreateMotivation,
createSkill: CthulhuEternalProtagonistSheet.#onCreateSkill
},
}
@ -27,6 +34,9 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
skills: {
template: "systems/fvtt-cthulhu-eternal/templates/protagonist-skills.hbs",
},
status: {
template: "systems/fvtt-cthulhu-eternal/templates/protagonist-status.hbs",
},
equipment: {
template: "systems/fvtt-cthulhu-eternal/templates/protagonist-equipment.hbs",
},
@ -43,10 +53,11 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
/**
* Prepare an array of form header tabs.
* @returns {Record<string, Partial<ApplicationTab>>}
*/
*/
#getTabs() {
const tabs = {
skills: { id: "skills", group: "sheet", icon: "fa-solid fa-shapes", label: "CTHULHUETERNAL.Label.skills" },
status: { id: "status", group: "sheet", icon: "fa-solid fa-file-waveform", label: "CTHULHUETERNAL.Label.status" },
equipment: { id: "equipment", group: "sheet", icon: "fa-solid fa-shapes", label: "CTHULHUETERNAL.Label.equipment" },
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "CTHULHUETERNAL.Label.biography" },
}
@ -104,8 +115,15 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
context.armors = doc.itemTypes.armor
context.gears = doc.itemTypes.gear
break
case "status":
context.tab = context.tabs.status
context.injuries = doc.itemTypes.injury
context.mentaldisorders = doc.itemTypes.mentaldisorder
context.bonds = doc.itemTypes.bond
break
case "biography":
context.tab = context.tabs.biography
context.motivations = doc.itemTypes.motivation
context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true })
context.enrichedNotes = await TextEditor.enrichHTML(doc.system.notes, { async: true })
break
@ -118,15 +136,36 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
* @param {Event} event The initiating click event.
* @param {HTMLElement} target The current target of the event listener.
*/
static #onCreateEquipment(event, target) {
// Création d'une armure
if (event.shiftKey) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newArmor"), type: "armor" }])
}
// Création d'une arme
else {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newWeapon"), type: "weapon" }])
}
static #onCreateGear(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newGear"), type: "gear" }])
}
static #onCreateWeapon(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newWeapon"), type: "weapon" }])
}
static #onCreateArmor(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newArmor"), type: "armor" }])
}
static #onCreateBond(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newBond"), type: "bond" }])
}
static #onCreateInjury(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newInjury"), type: "injury" }])
}
static #onCreateMentalDisorder(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newMentalDisorder"), type: "mentaldisorder" }])
}
static #onCreateMotivation(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newMotivation"), type: "motivation" }])
}
static #onCreateSkill(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newSkill"), type: "skill" }])
}
/**