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:
@@ -206,6 +206,7 @@ function _preloadTemplates() {
|
|||||||
`${base}/character-competences.hbs`,
|
`${base}/character-competences.hbs`,
|
||||||
`${base}/character-blessures.hbs`,
|
`${base}/character-blessures.hbs`,
|
||||||
`${base}/character-factions.hbs`,
|
`${base}/character-factions.hbs`,
|
||||||
|
`${base}/character-equipement.hbs`,
|
||||||
`${base}/character-biography.hbs`,
|
`${base}/character-biography.hbs`,
|
||||||
`${base}/npc-main.hbs`,
|
`${base}/npc-main.hbs`,
|
||||||
`${base}/npc-competences.hbs`,
|
`${base}/npc-competences.hbs`,
|
||||||
|
|||||||
@@ -102,6 +102,7 @@
|
|||||||
"competences": "Domaines",
|
"competences": "Domaines",
|
||||||
"blessures": "Blessures",
|
"blessures": "Blessures",
|
||||||
"factions": "Factions",
|
"factions": "Factions",
|
||||||
|
"equipement": "Équipement",
|
||||||
"biography": "Biographie",
|
"biography": "Biographie",
|
||||||
"description": "Description",
|
"description": "Description",
|
||||||
"technique": "Technique"
|
"technique": "Technique"
|
||||||
@@ -194,7 +195,10 @@
|
|||||||
"weapons": "Armes",
|
"weapons": "Armes",
|
||||||
"armures": "Armures",
|
"armures": "Armures",
|
||||||
"newWeapon": "Nouvelle arme",
|
"newWeapon": "Nouvelle arme",
|
||||||
"newArmure": "Nouvelle armure"
|
"newArmure": "Nouvelle armure",
|
||||||
|
"noWeapons": "Aucune arme",
|
||||||
|
"noArmures": "Aucune armure",
|
||||||
|
"noEquipments": "Aucun équipement"
|
||||||
},
|
},
|
||||||
"Equipment": {
|
"Equipment": {
|
||||||
"autre": "Autre",
|
"autre": "Autre",
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
|||||||
createAnomaly: CelestopolCharacterSheet.#onCreateAnomaly,
|
createAnomaly: CelestopolCharacterSheet.#onCreateAnomaly,
|
||||||
createAspect: CelestopolCharacterSheet.#onCreateAspect,
|
createAspect: CelestopolCharacterSheet.#onCreateAspect,
|
||||||
createEquipment: CelestopolCharacterSheet.#onCreateEquipment,
|
createEquipment: CelestopolCharacterSheet.#onCreateEquipment,
|
||||||
|
createWeapon: CelestopolCharacterSheet.#onCreateWeapon,
|
||||||
|
createArmure: CelestopolCharacterSheet.#onCreateArmure,
|
||||||
useAnomaly: CelestopolCharacterSheet.#onUseAnomaly,
|
useAnomaly: CelestopolCharacterSheet.#onUseAnomaly,
|
||||||
resetAnomalyUses: CelestopolCharacterSheet.#onResetAnomalyUses,
|
resetAnomalyUses: CelestopolCharacterSheet.#onResetAnomalyUses,
|
||||||
},
|
},
|
||||||
@@ -23,6 +25,7 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
|||||||
competences:{ template: "systems/fvtt-celestopol/templates/character-competences.hbs" },
|
competences:{ template: "systems/fvtt-celestopol/templates/character-competences.hbs" },
|
||||||
blessures: { template: "systems/fvtt-celestopol/templates/character-blessures.hbs" },
|
blessures: { template: "systems/fvtt-celestopol/templates/character-blessures.hbs" },
|
||||||
factions: { template: "systems/fvtt-celestopol/templates/character-factions.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" },
|
biography: { template: "systems/fvtt-celestopol/templates/character-biography.hbs" },
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,10 +33,11 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
|||||||
|
|
||||||
#getTabs() {
|
#getTabs() {
|
||||||
const tabs = {
|
const tabs = {
|
||||||
competences:{ id: "competences", group: "sheet", icon: "fa-solid fa-dice-d6", label: "CELESTOPOL.Tab.competences" },
|
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" },
|
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" },
|
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" },
|
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)) {
|
for (const v of Object.values(tabs)) {
|
||||||
v.active = this.tabGroups[v.group] === v.id
|
v.active = this.tabGroups[v.group] === v.id
|
||||||
@@ -91,13 +95,18 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
|||||||
|
|
||||||
case "biography":
|
case "biography":
|
||||||
context.tab = context.tabs.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(
|
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
doc.system.description, { async: true })
|
doc.system.description, { async: true })
|
||||||
context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
|
||||||
doc.system.notes, { async: true })
|
doc.system.notes, { async: true })
|
||||||
break
|
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
|
return context
|
||||||
}
|
}
|
||||||
@@ -120,7 +129,19 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
|
|||||||
|
|
||||||
static #onCreateEquipment() {
|
static #onCreateEquipment() {
|
||||||
this.document.createEmbeddedDocuments("Item", [{
|
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",
|
||||||
}])
|
}])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -290,6 +290,44 @@
|
|||||||
.item-qty { font-size: 0.8em; color: var(--cel-border); }
|
.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 {
|
.biography-section, .notes-section {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
.section-header { .cel-section-header(); }
|
.section-header { .cel-section-header(); }
|
||||||
|
|||||||
@@ -1,24 +1,4 @@
|
|||||||
<div class="tab biography {{tab.cssClass}}" data-group="sheet" data-tab="biography">
|
<div class="tab biography {{tab.cssClass}}" data-group="sheet" data-tab="biography">
|
||||||
{{!-- Équipements --}}
|
|
||||||
<div class="equipments-section">
|
|
||||||
<div class="section-header">
|
|
||||||
<span>{{localize "CELESTOPOL.Item.equipments"}}</span>
|
|
||||||
{{#if isEditMode}}
|
|
||||||
<a data-action="createEquipment" title="{{localize 'CELESTOPOL.Item.newEquipment'}}"><i class="fas fa-plus"></i></a>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{#each equipments as |item|}}
|
|
||||||
<div class="item-row equipment" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
|
|
||||||
<img src="{{item.img}}" class="item-icon">
|
|
||||||
<span class="item-name">{{item.name}}</span>
|
|
||||||
<span class="item-qty">×{{item.system.quantity}}</span>
|
|
||||||
<div class="item-controls">
|
|
||||||
<a data-action="edit" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
|
||||||
{{#if ../isEditMode}}<a data-action="delete" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>{{/if}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{!-- Description / Biographie --}}
|
{{!-- Description / Biographie --}}
|
||||||
<div class="biography-section">
|
<div class="biography-section">
|
||||||
@@ -32,3 +12,15 @@
|
|||||||
{{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
|
{{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="biography-section">
|
||||||
|
<div class="section-header">{{localize "CELESTOPOL.Actor.description"}}</div>
|
||||||
|
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{!-- Notes --}}
|
||||||
|
<div class="notes-section">
|
||||||
|
<div class="section-header">{{localize "CELESTOPOL.Actor.notes"}}</div>
|
||||||
|
{{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
76
templates/character-equipement.hbs
Normal file
76
templates/character-equipement.hbs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<div class="tab equipement {{tab.cssClass}}" data-group="sheet" data-tab="equipement">
|
||||||
|
|
||||||
|
{{!-- ── Armes ─────────────────────────────────────────────────────────── --}}
|
||||||
|
<div class="equip-section">
|
||||||
|
<div class="section-header">
|
||||||
|
<i class="fas fa-khanda"></i>
|
||||||
|
<span>{{localize "CELESTOPOL.Item.weapons"}}</span>
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<a data-action="createWeapon" title="{{localize 'CELESTOPOL.Item.newWeapon'}}"><i class="fas fa-plus"></i></a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#each weapons as |item|}}
|
||||||
|
<div class="item-row weapon" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
|
||||||
|
<img src="{{item.img}}" class="item-icon">
|
||||||
|
<span class="item-name">{{item.name}}</span>
|
||||||
|
<span class="item-tag type">{{#if (eq item.system.type "melee")}}{{localize "CELESTOPOL.Weapon.typeMelee"}}{{else}}{{localize "CELESTOPOL.Weapon.typeDistance"}}{{/if}}</span>
|
||||||
|
<span class="item-tag dmg">{{localize "CELESTOPOL.Weapon.degats"}} {{item.system.degats}}</span>
|
||||||
|
<div class="item-controls">
|
||||||
|
<a data-action="edit" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
{{#if ../isEditMode}}<a data-action="delete" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<p class="equip-empty">{{localize "CELESTOPOL.Item.noWeapons"}}</p>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{!-- ── Armures ───────────────────────────────────────────────────────── --}}
|
||||||
|
<div class="equip-section">
|
||||||
|
<div class="section-header">
|
||||||
|
<i class="fas fa-shield-halved"></i>
|
||||||
|
<span>{{localize "CELESTOPOL.Item.armures"}}</span>
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<a data-action="createArmure" title="{{localize 'CELESTOPOL.Item.newArmure'}}"><i class="fas fa-plus"></i></a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#each armures as |item|}}
|
||||||
|
<div class="item-row armure" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
|
||||||
|
<img src="{{item.img}}" class="item-icon">
|
||||||
|
<span class="item-name">{{item.name}}</span>
|
||||||
|
<span class="item-tag prot"><i class="fas fa-shield"></i> {{item.system.protection}}</span>
|
||||||
|
{{#if item.system.malus}}<span class="item-tag malus">−{{item.system.malus}} {{localize "CELESTOPOL.Armure.malus"}}</span>{{/if}}
|
||||||
|
<div class="item-controls">
|
||||||
|
<a data-action="edit" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
{{#if ../isEditMode}}<a data-action="delete" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<p class="equip-empty">{{localize "CELESTOPOL.Item.noArmures"}}</p>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{!-- ── Équipements ──────────────────────────────────────────────────── --}}
|
||||||
|
<div class="equip-section">
|
||||||
|
<div class="section-header">
|
||||||
|
<i class="fas fa-briefcase"></i>
|
||||||
|
<span>{{localize "CELESTOPOL.Item.equipments"}}</span>
|
||||||
|
{{#if isEditMode}}
|
||||||
|
<a data-action="createEquipment" title="{{localize 'CELESTOPOL.Item.newEquipment'}}"><i class="fas fa-plus"></i></a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#each equipments as |item|}}
|
||||||
|
<div class="item-row equipment" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
|
||||||
|
<img src="{{item.img}}" class="item-icon">
|
||||||
|
<span class="item-name">{{item.name}}</span>
|
||||||
|
<div class="item-controls">
|
||||||
|
<a data-action="edit" data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
|
||||||
|
{{#if ../isEditMode}}<a data-action="delete" data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<p class="equip-empty">{{localize "CELESTOPOL.Item.noEquipments"}}</p>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user