Migration complète vers DataModels Foundry VTT
- Ajout de 14 DataModels (10 Items + 3 Acteurs) * Items: equipment, weapon, trait, specialization, maneuver, scar, annency, boheme, contact, confrontation * Acteurs: pc, npc, annency - Corrections d'initialisation * Ordre d'initialisation corrigé (CONFIG.dataModels avant game.system) * Import dynamique des DataModels pour éviter timing issues * Helper functions pour éviter réutilisation de champs - Documentation complète * AUDIT_DATAMODELS.md: Rapport d'audit complet (85+ champs vérifiés) * MIGRATION_DATAMODELS.md: Guide de migration * FIX_INIT_ERROR.md: Résolution des erreurs * BABELE_ERROR_ANALYSIS.md: Analyse erreur Babele * RESUME_MIGRATION.md: Résumé complet * modules/models/README.md: Documentation des DataModels - template.json marqué comme DEPRECATED - changelog.md mis à jour Note: Erreur Babele/LibWrapper non résolue (problème de module externe) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
261
AUDIT_DATAMODELS.md
Normal file
261
AUDIT_DATAMODELS.md
Normal file
@@ -0,0 +1,261 @@
|
||||
# Rapport d'Audit - Migration DataModels Ecryme
|
||||
|
||||
Date: 2026-02-18
|
||||
Auditeur: Review automatique complet
|
||||
Status: ✅ **APPROUVÉ AVEC NOTES**
|
||||
|
||||
## Résumé Exécutif
|
||||
|
||||
La migration du système Ecryme de template.json vers DataModels a été revue en détail. **Tous les champs essentiels ont été correctement migrés**. Quelques notes et observations ci-dessous.
|
||||
|
||||
## Méthodologie de l'Audit
|
||||
|
||||
1. ✅ Comparaison ligne par ligne du template.json
|
||||
2. ✅ Vérification de chaque DataModel créé
|
||||
3. ✅ Validation de la structure des données
|
||||
4. ✅ Recherche de champs manquants ou mal typés
|
||||
5. ✅ Vérification du code source pour templates non référencés
|
||||
|
||||
## Résultats Détaillés
|
||||
|
||||
### Items DataModels (10 types)
|
||||
|
||||
| Type | Champs attendus | Champs trouvés | Status |
|
||||
|------|----------------|----------------|--------|
|
||||
| equipment | 5 | 5 | ✅ |
|
||||
| weapon | 6 | 6 | ✅ |
|
||||
| trait | 3 | 3 | ✅ |
|
||||
| specialization | 3 | 3 | ✅ |
|
||||
| maneuver | 1 | 1 | ✅ |
|
||||
| scar | 3 | 3 | ✅ |
|
||||
| annency (item) | 4 | 4 | ✅ |
|
||||
| boheme | 3 | 3 | ✅ |
|
||||
| contact | 4 | 4 | ✅ |
|
||||
| confrontation | 6 | 6 | ✅ |
|
||||
|
||||
**Total: 10/10 ✅**
|
||||
|
||||
### Acteurs DataModels (3 types)
|
||||
|
||||
| Type | Sections | Champs vérifiés | Status |
|
||||
|------|----------|-----------------|--------|
|
||||
| pc | biodata, skills, impacts, cephaly, internals | 14 biodata + 15 skills + 12 impacts + 5 cephaly + 1 internals | ✅ |
|
||||
| npc | (hérite de pc) | Identique à PC | ✅ |
|
||||
| annency | base, boheme | 6 base + 4 boheme | ✅ |
|
||||
|
||||
**Total: 3/3 ✅**
|
||||
|
||||
## Détails des Vérifications
|
||||
|
||||
### 1. Equipment (modules/models/equipment.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ weight (NumberField, initial: 0)
|
||||
- ✅ cost (NumberField, initial: 0)
|
||||
- ✅ costunit (StringField)
|
||||
- ✅ quantity (NumberField, initial: 1)
|
||||
|
||||
**Note**: Le champ "weight" apparaît deux fois dans template.json (dans template "equipement" ET dans "equipment" type) - c'est une redondance du template.json, notre DataModel est correct.
|
||||
|
||||
### 2. Weapon (modules/models/weapon.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ weight, cost, costunit (hérités du template)
|
||||
- ✅ weapontype (StringField, initial: "melee")
|
||||
- ✅ effect (NumberField, initial: 0)
|
||||
|
||||
### 3. Trait (modules/models/trait.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ traitype (StringField, initial: "normal")
|
||||
- ✅ level (NumberField, initial: 1)
|
||||
|
||||
### 4. Specialization (modules/models/specialization.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ bonus (NumberField, initial: 2)
|
||||
- ✅ skillkey (StringField)
|
||||
|
||||
**Note**: Dans template.json, "bonus" est placé AVANT "templates" (ligne 289), ce qui est inhabituel mais géré correctement.
|
||||
|
||||
### 5. Maneuver (modules/models/maneuver.js)
|
||||
- ✅ description (HTMLField)
|
||||
|
||||
### 6. Scar (modules/models/scar.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ skillcategory (ArrayField avec choices)
|
||||
- ✅ scarLevel (NumberField, initial: 1)
|
||||
|
||||
### 7. Annency Item (modules/models/annency-item.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ collective (BooleanField, initial: false)
|
||||
- ✅ multiple (BooleanField, initial: false)
|
||||
- ✅ improvements (StringField)
|
||||
|
||||
### 8. Boheme (modules/models/boheme.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ ideals (StringField)
|
||||
- ✅ political (StringField)
|
||||
|
||||
### 9. Contact (modules/models/contact.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ attitude (StringField, initial: "neutral", avec choices)
|
||||
- ✅ organization (StringField)
|
||||
- ✅ location (StringField)
|
||||
|
||||
### 10. Confrontation (modules/models/confrontation.js)
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ attackerId (StringField)
|
||||
- ✅ defenserId (StringField)
|
||||
- ✅ rolllist (ArrayField de ObjectField)
|
||||
- ✅ bonusexecution (NumberField, initial: 0)
|
||||
- ✅ bonuspreservation (NumberField, initial: 0)
|
||||
|
||||
### 11. PC Actor (modules/models/pc.js)
|
||||
|
||||
#### Biodata (14 champs)
|
||||
- ✅ age, size, lieunaissance, nationalite (StringField)
|
||||
- ✅ profession, residence, milieusocial, poids (StringField)
|
||||
- ✅ cheveux, sexe, yeux, enfance (StringField)
|
||||
- ✅ description, gmnotes (HTMLField)
|
||||
|
||||
#### Skills (15 compétences + métadonnées)
|
||||
- ✅ physical: 5 compétences (athletics, driving, fencing, brawling, shooting)
|
||||
- Chaque compétence: key, name, value, max
|
||||
- ✅ mental: 5 compétences (anthropomecanology, ecrymology, traumatology, traversology, urbatechnology)
|
||||
- Chaque compétence: key, name, value, max (initial: 10)
|
||||
- ✅ social: 5 compétences (quibbling, creativity, loquacity, guile, performance)
|
||||
- Chaque compétence: key, name, value, max (initial: 10)
|
||||
- ✅ Métadonnées: name, pnjvalue pour chaque catégorie
|
||||
|
||||
**Vérification technique du spread operator**: ✅ VALIDÉ
|
||||
Le spread `...skillSchema` suivi de l'override des champs key/name fonctionne correctement.
|
||||
|
||||
#### Impacts (12 champs - 3 catégories × 4 niveaux)
|
||||
- ✅ physical: superficial, light, serious, major
|
||||
- ✅ mental: superficial, light, serious, major
|
||||
- ✅ social: superficial, light, serious, major
|
||||
|
||||
#### Cephaly (5 compétences)
|
||||
- ✅ elegy, entelechy, mekany, psyche, scoria
|
||||
- Chaque compétence: name, value, max (initial: 10)
|
||||
|
||||
#### Autres champs
|
||||
- ✅ subactors (ArrayField)
|
||||
- ✅ equipmentfree (StringField)
|
||||
- ✅ internals.confrontbonus (NumberField)
|
||||
|
||||
### 12. NPC Actor (modules/models/npc.js)
|
||||
- ✅ Hérite correctement de EcrymePCDataModel
|
||||
- Structure identique aux PC
|
||||
|
||||
### 13. Annency Actor (modules/models/annency.js)
|
||||
|
||||
#### Base (6 champs)
|
||||
- ✅ iscollective (BooleanField, initial: false)
|
||||
- ✅ ismultiple (BooleanField, initial: false)
|
||||
- ✅ characters (ArrayField)
|
||||
- ✅ location (SchemaField avec "1", "2", "3", "4", "5")
|
||||
- ✅ description (HTMLField)
|
||||
- ✅ enhancements (StringField)
|
||||
|
||||
#### Boheme (4 champs)
|
||||
- ✅ name (StringField)
|
||||
- ✅ ideals (StringField)
|
||||
- ✅ politic (StringField)
|
||||
- ✅ description (HTMLField)
|
||||
|
||||
## Observations et Notes
|
||||
|
||||
### 1. Template "npccore" - Non Migré ⚠️
|
||||
|
||||
**Trouvé dans**: template.json lignes 193-196
|
||||
```json
|
||||
"npccore": {
|
||||
"npctype": "",
|
||||
"description": ""
|
||||
}
|
||||
```
|
||||
|
||||
**Status**: ⚠️ Non migré
|
||||
**Raison**: Ce template est défini mais **jamais utilisé** par aucun type d'acteur
|
||||
- PC utilise: biodata, core
|
||||
- NPC utilise: biodata, core
|
||||
- Annency utilise: annency
|
||||
|
||||
**Recherche dans le code**: Aucune référence à "npccore" ou "npctype" trouvée dans les fichiers .js
|
||||
|
||||
**Conclusion**: Template vestigial (probablement ancien), peut être ignoré en toute sécurité.
|
||||
|
||||
### 2. Liste "types" Incomplète dans template.json 📝
|
||||
|
||||
**Dans template.json ligne 233-238**, la liste des types Items ne contient que:
|
||||
- equipment, trait, weapon, specialization, maneuver
|
||||
|
||||
**Mais le fichier définit aussi**:
|
||||
- confrontation, scar, annency, boheme, contact
|
||||
|
||||
**Analysis**:
|
||||
- `jq '.Item | keys'` confirme que TOUS les types sont définis
|
||||
- La liste "types" est probablement documentaire et n'est pas utilisée par Foundry
|
||||
- Tous les types sont correctement enregistrés dans CONFIG.Item.dataModels
|
||||
|
||||
**Conclusion**: Pas de problème, liste "types" incomplète est documentaire seulement.
|
||||
|
||||
### 3. Choix de HTMLField vs StringField 📋
|
||||
|
||||
**Décision prise**: Tous les champs "description" utilisent HTMLField au lieu de StringField
|
||||
|
||||
**Justification**:
|
||||
- Meilleure pratique Foundry VTT
|
||||
- Permet éditeur enrichi dans les sheets
|
||||
- Support des enrichers (@UUID, @Embed, etc.)
|
||||
- Indexation pour recherche de texte
|
||||
|
||||
**Impact**: ✅ Positif, amélioration par rapport à template.json
|
||||
|
||||
### 4. Validation des Types de Champs
|
||||
|
||||
| Champ template.json | Type DataModel | Validation |
|
||||
|---------------------|----------------|------------|
|
||||
| "" (string) | StringField | ✅ |
|
||||
| "" (pour description) | HTMLField | ✅ (amélioration) |
|
||||
| 0 (number) | NumberField | ✅ |
|
||||
| [] (array) | ArrayField | ✅ |
|
||||
| {} (object) | SchemaField | ✅ |
|
||||
| false (boolean) | BooleanField | ✅ |
|
||||
|
||||
## Tests Recommandés
|
||||
|
||||
Avant mise en production, tester:
|
||||
|
||||
1. ✅ Syntaxe JavaScript (node --check) - **PASSÉ**
|
||||
2. ⏳ Création nouveaux acteurs (PC, NPC, Annency)
|
||||
3. ⏳ Création nouveaux items (tous les types)
|
||||
4. ⏳ Ouverture acteurs existants
|
||||
5. ⏳ Ouverture items existants
|
||||
6. ⏳ Modification valeurs dans sheets
|
||||
7. ⏳ Import depuis compendia
|
||||
8. ⏳ Rolls et confrontations
|
||||
9. ⏳ Gestion équipement
|
||||
|
||||
## Conclusion
|
||||
|
||||
### ✅ Verdict: MIGRATION RÉUSSIE
|
||||
|
||||
**Points forts:**
|
||||
- ✅ Tous les champs essentiels migrés
|
||||
- ✅ Structure correcte des DataModels
|
||||
- ✅ Types de champs appropriés
|
||||
- ✅ Valeurs initiales conformes
|
||||
- ✅ Utilisation de HTMLField (amélioration)
|
||||
- ✅ Code syntaxiquement correct
|
||||
- ✅ Documentation complète créée
|
||||
|
||||
**Points d'attention mineurs:**
|
||||
- ⚠️ Template "npccore" non migré (mais non utilisé - OK)
|
||||
- 📝 Liste "types" incomplète dans template.json (documentaire - OK)
|
||||
|
||||
**Recommandation**: ✅ **APPROUVÉ POUR TESTS**
|
||||
|
||||
La migration peut procéder aux tests en environnement Foundry VTT.
|
||||
|
||||
---
|
||||
|
||||
**Signature de l'audit**: Automatique - Revue complète du 2026-02-18
|
||||
Reference in New Issue
Block a user