diff --git a/fvtt-celestopol.mjs b/fvtt-celestopol.mjs index 7e4f6c9..2b8c900 100644 --- a/fvtt-celestopol.mjs +++ b/fvtt-celestopol.mjs @@ -206,6 +206,7 @@ function _preloadTemplates() { `${base}/character-competences.hbs`, `${base}/character-blessures.hbs`, `${base}/character-factions.hbs`, + `${base}/character-equipement.hbs`, `${base}/character-biography.hbs`, `${base}/npc-main.hbs`, `${base}/npc-competences.hbs`, diff --git a/lang/fr.json b/lang/fr.json index 9dac84e..d1e6b11 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -102,6 +102,7 @@ "competences": "Domaines", "blessures": "Blessures", "factions": "Factions", + "equipement": "Équipement", "biography": "Biographie", "description": "Description", "technique": "Technique" @@ -194,7 +195,10 @@ "weapons": "Armes", "armures": "Armures", "newWeapon": "Nouvelle arme", - "newArmure": "Nouvelle armure" + "newArmure": "Nouvelle armure", + "noWeapons": "Aucune arme", + "noArmures": "Aucune armure", + "noEquipments": "Aucun équipement" }, "Equipment": { "autre": "Autre", diff --git a/module/applications/sheets/character-sheet.mjs b/module/applications/sheets/character-sheet.mjs index 94987ce..8251c54 100644 --- a/module/applications/sheets/character-sheet.mjs +++ b/module/applications/sheets/character-sheet.mjs @@ -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", }]) } diff --git a/styles/character.less b/styles/character.less index 121a367..8815b79 100644 --- a/styles/character.less +++ b/styles/character.less @@ -290,6 +290,44 @@ .item-qty { font-size: 0.8em; color: var(--cel-border); } } + // Onglet Équipement + .tab.equipement { + .equip-section { + margin-bottom: 14px; + + .section-header { + .cel-section-header(); + display: flex; + align-items: center; + gap: 8px; + i { opacity: 0.75; } + span { flex: 1; } + a { color: var(--cel-orange); cursor: pointer; } + } + + .item-row { + .cel-item-row(); + + .item-tag { + font-size: 0.75em; + padding: 1px 6px; + border-radius: 10px; + border: 1px solid rgba(196,154,26,0.4); + color: var(--cel-orange); + white-space: nowrap; + &.malus { color: #c04444; border-color: rgba(192,68,68,0.4); } + } + } + + .equip-empty { + font-size: 0.85em; + font-style: italic; + color: var(--cel-border); + padding: 4px 8px; + } + } + } + .biography-section, .notes-section { margin-bottom: 12px; .section-header { .cel-section-header(); } diff --git a/templates/character-biography.hbs b/templates/character-biography.hbs index ea17b35..a7a72f5 100644 --- a/templates/character-biography.hbs +++ b/templates/character-biography.hbs @@ -1,24 +1,4 @@
- {{!-- Équipements --}} -
-
- {{localize "CELESTOPOL.Item.equipments"}} - {{#if isEditMode}} - - {{/if}} -
- {{#each equipments as |item|}} -
- - {{item.name}} - ×{{item.system.quantity}} -
- - {{#if ../isEditMode}}{{/if}} -
-
- {{/each}} -
{{!-- Description / Biographie --}}
@@ -32,3 +12,15 @@ {{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
+ +
+
{{localize "CELESTOPOL.Actor.description"}}
+ {{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}} +
+ + {{!-- Notes --}} +
+
{{localize "CELESTOPOL.Actor.notes"}}
+ {{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}} +
+ diff --git a/templates/character-equipement.hbs b/templates/character-equipement.hbs new file mode 100644 index 0000000..3f39439 --- /dev/null +++ b/templates/character-equipement.hbs @@ -0,0 +1,76 @@ +
+ + {{!-- ── Armes ─────────────────────────────────────────────────────────── --}} +
+
+ + {{localize "CELESTOPOL.Item.weapons"}} + {{#if isEditMode}} + + {{/if}} +
+ {{#each weapons as |item|}} +
+ + {{item.name}} + {{#if (eq item.system.type "melee")}}{{localize "CELESTOPOL.Weapon.typeMelee"}}{{else}}{{localize "CELESTOPOL.Weapon.typeDistance"}}{{/if}} + {{localize "CELESTOPOL.Weapon.degats"}} {{item.system.degats}} +
+ + {{#if ../isEditMode}}{{/if}} +
+
+ {{else}} +

{{localize "CELESTOPOL.Item.noWeapons"}}

+ {{/each}} +
+ + {{!-- ── Armures ───────────────────────────────────────────────────────── --}} +
+
+ + {{localize "CELESTOPOL.Item.armures"}} + {{#if isEditMode}} + + {{/if}} +
+ {{#each armures as |item|}} +
+ + {{item.name}} + {{item.system.protection}} + {{#if item.system.malus}}−{{item.system.malus}} {{localize "CELESTOPOL.Armure.malus"}}{{/if}} +
+ + {{#if ../isEditMode}}{{/if}} +
+
+ {{else}} +

{{localize "CELESTOPOL.Item.noArmures"}}

+ {{/each}} +
+ + {{!-- ── Équipements ──────────────────────────────────────────────────── --}} +
+
+ + {{localize "CELESTOPOL.Item.equipments"}} + {{#if isEditMode}} + + {{/if}} +
+ {{#each equipments as |item|}} +
+ + {{item.name}} +
+ + {{#if ../isEditMode}}{{/if}} +
+
+ {{else}} +

{{localize "CELESTOPOL.Item.noEquipments"}}

+ {{/each}} +
+ +