Suppression item Attribut : redondant avec le DataModel personnage

- DataModel CelestopolAttribute supprimé (items.mjs)
- CelestopolAttributeSheet supprimée (item-sheets.mjs)
- Imports/registrations retirés (fvtt-celestopol.mjs)
- Section 'Attributs' supprimée de character-competences.hbs
- Action createAttribute + contexte attributes retirés (character-sheet.mjs)
- Template attribute.hbs supprimé
- Clés i18n attribute/attributes/newAttribute supprimées (fr.json)
- Type 'attribute' retiré des htmlFields (system.json)
- htmlFields anomaly corrigés : technique/narratif/exemples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-29 16:49:16 +02:00
parent a881625515
commit ad118ae60c
10 changed files with 4 additions and 128 deletions

View File

@@ -9,7 +9,6 @@ import {
CelestopolNPC,
CelestopolAnomaly,
CelestopolAspect,
CelestopolAttribute,
CelestopolEquipment,
} from "./module/models/_module.mjs"
import {
@@ -23,7 +22,6 @@ import {
CelestopolNPCSheet,
CelestopolAnomalySheet,
CelestopolAspectSheet,
CelestopolAttributeSheet,
CelestopolEquipmentSheet,
} from "./module/applications/_module.mjs"
@@ -42,7 +40,6 @@ Hooks.once("init", () => {
CONFIG.Item.dataModels.anomaly = CelestopolAnomaly
CONFIG.Item.dataModels.aspect = CelestopolAspect
CONFIG.Item.dataModels.attribute = CelestopolAttribute
CONFIG.Item.dataModels.equipment = CelestopolEquipment
// ── Document classes ────────────────────────────────────────────────────
@@ -88,11 +85,6 @@ Hooks.once("init", () => {
makeDefault: true,
label: "CELESTOPOL.Sheet.aspect",
})
foundry.documents.collections.Items.registerSheet(SYSTEM_ID, CelestopolAttributeSheet, {
types: ["attribute"],
makeDefault: true,
label: "CELESTOPOL.Sheet.attribute",
})
foundry.documents.collections.Items.registerSheet(SYSTEM_ID, CelestopolEquipmentSheet, {
types: ["equipment"],
makeDefault: true,
@@ -204,7 +196,6 @@ function _preloadTemplates() {
`${base}/npc-blessures.hbs`,
`${base}/anomaly.hbs`,
`${base}/aspect.hbs`,
`${base}/attribute.hbs`,
`${base}/equipment.hbs`,
`${base}/roll-dialog.hbs`,
`${base}/chat-message.hbs`,

View File

@@ -7,7 +7,6 @@
"Item": {
"anomaly": "Anomalie",
"aspect": "Aspect",
"attribute": "Attribut",
"equipment": "Équipement"
}
},
@@ -170,11 +169,9 @@
"anomaly": "Anomalie",
"anomalies": "Anomalies",
"aspects": "Aspects",
"attributes": "Attributs",
"equipments": "Équipements",
"newAnomaly": "Nouvelle anomalie",
"newAspect": "Nouvel aspect",
"newAttribute": "Nouvel attribut",
"newEquipment": "Nouvel équipement",
"value": "Valeur",
"scores": "Scores bonus / malus",

View File

@@ -1,3 +1,3 @@
export { default as CelestopolCharacterSheet } from "./sheets/character-sheet.mjs"
export { default as CelestopolNPCSheet } from "./sheets/npc-sheet.mjs"
export { CelestopolAnomalySheet, CelestopolAspectSheet, CelestopolAttributeSheet, CelestopolEquipmentSheet } from "./sheets/item-sheets.mjs"
export { CelestopolAnomalySheet, CelestopolAspectSheet, CelestopolEquipmentSheet } from "./sheets/item-sheets.mjs"

View File

@@ -10,7 +10,6 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
actions: {
createAnomaly: CelestopolCharacterSheet.#onCreateAnomaly,
createAspect: CelestopolCharacterSheet.#onCreateAspect,
createAttribute: CelestopolCharacterSheet.#onCreateAttribute,
createEquipment: CelestopolCharacterSheet.#onCreateEquipment,
useAnomaly: CelestopolCharacterSheet.#onUseAnomaly,
resetAnomalyUses: CelestopolCharacterSheet.#onResetAnomalyUses,
@@ -68,7 +67,6 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
context.tab = context.tabs.competences
context.anomaly = doc.itemTypes.anomaly[0] ?? null
context.aspects = doc.itemTypes.aspect
context.attributes = doc.itemTypes.attribute
if (context.anomaly) {
const def = SYSTEM.ANOMALY_DEFINITIONS[context.anomaly.system.subtype] ?? SYSTEM.ANOMALY_DEFINITIONS.none
context.anomalySkillLabels = def.technicalSkills.map(key => {
@@ -120,12 +118,6 @@ export default class CelestopolCharacterSheet extends CelestopolActorSheet {
}])
}
static #onCreateAttribute() {
this.document.createEmbeddedDocuments("Item", [{
name: game.i18n.localize("CELESTOPOL.Item.newAttribute"), type: "attribute",
}])
}
static #onCreateEquipment() {
this.document.createEmbeddedDocuments("Item", [{
name: game.i18n.localize("CELESTOPOL.Item.newEquipment"), type: "equipment",

View File

@@ -53,27 +53,6 @@ export class CelestopolAspectSheet extends CelestopolItemSheet {
}
}
export class CelestopolAttributeSheet extends CelestopolItemSheet {
static DEFAULT_OPTIONS = {
classes: ["attribute"],
position: { width: 620, height: 520 },
}
static PARTS = {
main: { template: "systems/fvtt-celestopol/templates/attribute.hbs" },
}
async _prepareContext() {
const ctx = await super._prepareContext()
ctx.skills = SYSTEM.SKILLS
ctx.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.description, { async: true })
ctx.enrichedTechnique = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.technique, { async: true })
ctx.enrichedNarratif = await foundry.applications.ux.TextEditor.implementation.enrichHTML(
this.document.system.narratif, { async: true })
return ctx
}
}
export class CelestopolEquipmentSheet extends CelestopolItemSheet {
static DEFAULT_OPTIONS = {
classes: ["equipment"],

View File

@@ -1,3 +1,3 @@
export { default as CelestopolCharacter } from "./character.mjs"
export { default as CelestopolNPC } from "./npc.mjs"
export { CelestopolAnomaly, CelestopolAspect, CelestopolAttribute, CelestopolEquipment } from "./items.mjs"
export { CelestopolAnomaly, CelestopolAspect, CelestopolEquipment } from "./items.mjs"

View File

@@ -1,6 +1,6 @@
import { SYSTEM } from "../config/system.mjs"
/** Schéma partagé pour les bonus/malus par domaine (utilisé dans anomaly/aspect/attribute). */
/** Schéma partagé pour les bonus/malus par domaine (utilisé dans anomaly/aspect). */
function skillScoresSchema() {
const fields = foundry.data.fields
const reqInt = { required: true, nullable: false, integer: true }
@@ -57,21 +57,6 @@ export class CelestopolAspect extends foundry.abstract.TypeDataModel {
}
}
export class CelestopolAttribute extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const reqInt = { required: true, nullable: false, integer: true }
return {
value: new fields.NumberField({ ...reqInt, initial: 0, min: 0, max: 8 }),
scores: skillScoresSchema(),
description: new fields.HTMLField({ required: true, textSearch: true }),
technique: new fields.HTMLField({ required: true, textSearch: true }),
narratif: new fields.HTMLField({ required: true, textSearch: true }),
notes: new fields.HTMLField({ required: true, textSearch: true }),
}
}
}
export class CelestopolEquipment extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields

View File

@@ -42,9 +42,8 @@
}
},
"Item": {
"anomaly": { "htmlFields": ["description", "technique", "narratif", "notes"] },
"anomaly": { "htmlFields": ["technique", "narratif", "exemples"] },
"aspect": { "htmlFields": ["description", "technique", "narratif", "notes"] },
"attribute": { "htmlFields": ["description", "technique", "narratif", "notes"] },
"equipment": { "htmlFields": ["description", "notes"] }
}
},

View File

@@ -1,47 +0,0 @@
<div class="item-sheet attribute">
<header class="item-header">
<div class="item-portrait" data-action="editImage">
<img src="{{item.img}}" alt="{{item.name}}">
</div>
<div class="item-header-fields">
<input type="text" name="name" value="{{item.name}}" {{#unless isEditable}}disabled{{/unless}}>
<div class="item-meta">
<div class="item-value-field">
<label>{{localize "CELESTOPOL.Item.value"}}</label>
{{#if isEditable}}
<input type="number" name="system.value" value="{{system.value}}" min="0" max="8">
{{else}}
<span class="item-value-display">{{system.value}}</span>
{{/if}}
</div>
</div>
</div>
</header>
<nav class="item-tabs sheet-tabs tabs" data-group="item-tabs">
<a class="item active" data-group="item-tabs" data-tab="description">{{localize "CELESTOPOL.Tab.description"}}</a>
<a class="item" data-group="item-tabs" data-tab="technique">{{localize "CELESTOPOL.Tab.technique"}}</a>
<a class="item" data-group="item-tabs" data-tab="scores">{{localize "CELESTOPOL.Item.scores"}}</a>
</nav>
<section class="tab active" data-group="item-tabs" data-tab="description">
<div class="form-group">
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
</div>
</section>
<section class="tab" data-group="item-tabs" data-tab="technique">
<div class="form-group">
<label>{{localize "CELESTOPOL.Item.technique"}}</label>
{{formInput systemFields.technique enriched=enrichedTechnique value=system.technique name="system.technique" toggled=true}}
</div>
<div class="form-group">
<label>{{localize "CELESTOPOL.Item.narratif"}}</label>
{{formInput systemFields.narratif enriched=enrichedNarratif value=system.narratif name="system.narratif" toggled=true}}
</div>
</section>
<section class="tab" data-group="item-tabs" data-tab="scores">
{{> "systems/fvtt-celestopol/templates/partials/item-scores.hbs" skills=skills system=system}}
</section>
</div>

View File

@@ -154,25 +154,5 @@
{{/each}}
</div>
{{!-- Attributs --}}
<div class="items-group">
<div class="items-header">
<span>{{localize "CELESTOPOL.Item.attributes"}}</span>
{{#if isEditMode}}
<a data-action="createAttribute" title="{{localize 'CELESTOPOL.Item.newAttribute'}}"><i class="fas fa-plus"></i></a>
{{/if}}
</div>
{{#each attributes as |item|}}
<div class="item-row" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
<img src="{{item.img}}" class="item-icon" alt="{{item.name}}">
<span class="item-name">{{item.name}}</span>
<span class="item-value">{{item.system.value}}</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>
</div>
</div>