feat: ajoute l'onglet Équipement dans la fiche PJ
- Nouvel onglet 'Équipement' avec 3 sections : Armes, Armures, Équipements - Template character-equipement.hbs avec affichage type/dégâts (armes), protection/malus (armures), et liste simple (équipements) - Actions createWeapon et createArmure dans la fiche personnage - Suppression de la section équipements de l'onglet Biographie - Clés i18n : Tab.equipement, Item.noWeapons/noArmures/noEquipments - CSS : styles .tab.equipement avec .equip-section et .item-tag badges Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,8 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
||||
createAnomaly: CelestopolCharacterSheet.#onCreateAnomaly,
|
||||
createAspect: CelestopolCharacterSheet.#onCreateAspect,
|
||||
createEquipment: CelestopolCharacterSheet.#onCreateEquipment,
|
||||
createWeapon: CelestopolCharacterSheet.#onCreateWeapon,
|
||||
createArmure: CelestopolCharacterSheet.#onCreateArmure,
|
||||
useAnomaly: CelestopolCharacterSheet.#onUseAnomaly,
|
||||
resetAnomalyUses: CelestopolCharacterSheet.#onResetAnomalyUses,
|
||||
},
|
||||
@@ -23,6 +25,7 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
||||
competences:{ template: "systems/fvtt-celestopol/templates/character-competences.hbs" },
|
||||
blessures: { template: "systems/fvtt-celestopol/templates/character-blessures.hbs" },
|
||||
factions: { template: "systems/fvtt-celestopol/templates/character-factions.hbs" },
|
||||
equipement: { template: "systems/fvtt-celestopol/templates/character-equipement.hbs" },
|
||||
biography: { template: "systems/fvtt-celestopol/templates/character-biography.hbs" },
|
||||
}
|
||||
|
||||
@@ -30,10 +33,11 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
||||
|
||||
#getTabs() {
|
||||
const tabs = {
|
||||
competences:{ id: "competences", group: "sheet", icon: "fa-solid fa-dice-d6", label: "CELESTOPOL.Tab.competences" },
|
||||
blessures: { id: "blessures", group: "sheet", icon: "fa-solid fa-heart-crack", label: "CELESTOPOL.Tab.blessures" },
|
||||
factions: { id: "factions", group: "sheet", icon: "fa-solid fa-flag", label: "CELESTOPOL.Tab.factions" },
|
||||
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "CELESTOPOL.Tab.biography" },
|
||||
competences:{ id: "competences", group: "sheet", icon: "fa-solid fa-dice-d6", label: "CELESTOPOL.Tab.competences" },
|
||||
blessures: { id: "blessures", group: "sheet", icon: "fa-solid fa-heart-crack", label: "CELESTOPOL.Tab.blessures" },
|
||||
factions: { id: "factions", group: "sheet", icon: "fa-solid fa-flag", label: "CELESTOPOL.Tab.factions" },
|
||||
equipement: { id: "equipement", group: "sheet", icon: "fa-solid fa-shield-halved",label: "CELESTOPOL.Tab.equipement" },
|
||||
biography: { id: "biography", group: "sheet", icon: "fa-solid fa-book", label: "CELESTOPOL.Tab.biography" },
|
||||
}
|
||||
for (const v of Object.values(tabs)) {
|
||||
v.active = this.tabGroups[v.group] === v.id
|
||||
@@ -91,13 +95,18 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
||||
|
||||
case "biography":
|
||||
context.tab = context.tabs.biography
|
||||
context.equipments = doc.itemTypes.equipment
|
||||
context.equipments.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
doc.system.description, { async: true })
|
||||
context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||
doc.system.notes, { async: true })
|
||||
break
|
||||
|
||||
case "equipement":
|
||||
context.tab = context.tabs.equipement
|
||||
context.weapons = doc.itemTypes.weapon.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.armures = doc.itemTypes.armure.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.equipments= doc.itemTypes.equipment.sort((a, b) => a.name.localeCompare(b.name))
|
||||
break
|
||||
}
|
||||
return context
|
||||
}
|
||||
@@ -120,7 +129,19 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
||||
|
||||
static #onCreateEquipment() {
|
||||
this.document.createEmbeddedDocuments("Item", [{
|
||||
name: game.i18n.localize("CELESTOPOL.Item.newEquipment"), type: "equipment",
|
||||
name: game.i18n.localize("TYPES.Item.equipment"), type: "equipment",
|
||||
}])
|
||||
}
|
||||
|
||||
static #onCreateWeapon() {
|
||||
this.document.createEmbeddedDocuments("Item", [{
|
||||
name: game.i18n.localize("TYPES.Item.weapon"), type: "weapon",
|
||||
}])
|
||||
}
|
||||
|
||||
static #onCreateArmure() {
|
||||
this.document.createEmbeddedDocuments("Item", [{
|
||||
name: game.i18n.localize("TYPES.Item.armure"), type: "armure",
|
||||
}])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user