Items : labels de type localisés + nom par défaut à la création

- TYPES.Item.weapon = 'Arme', TYPES.Item.armure = 'Armure' dans fr.json
- Hook preCreateItem : nom par défaut = label du type pour tous les items

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-29 17:14:45 +02:00
parent 1d62f09375
commit 8b9c22ff4d
14 changed files with 37 additions and 5 deletions

View File

@@ -233,3 +233,19 @@ function _onSocketMessage(data) {
} }
} }
} }
/* ─── Nom par défaut des items à la création ─────────────────────────────── */
Hooks.on("preCreateItem", (item, data) => {
const defaultNames = {
weapon: () => game.i18n.localize("TYPES.Item.weapon"),
armure: () => game.i18n.localize("TYPES.Item.armure"),
anomaly: () => game.i18n.localize("TYPES.Item.anomaly"),
aspect: () => game.i18n.localize("TYPES.Item.aspect"),
equipment: () => game.i18n.localize("TYPES.Item.equipment"),
}
const fn = defaultNames[item.type]
if (fn && (!data.name || data.name === "New Item" || data.name === item.type)) {
item.updateSource({ name: fn() })
}
})

View File

@@ -7,7 +7,9 @@
"Item": { "Item": {
"anomaly": "Anomalie", "anomaly": "Anomalie",
"aspect": "Aspect", "aspect": "Aspect",
"equipment": "Équipement" "equipment": "Équipement",
"weapon": "Arme",
"armure": "Armure"
} }
}, },
"CELESTOPOL": { "CELESTOPOL": {

View File

@@ -1 +1 @@
MANIFEST-000002 MANIFEST-000006

View File

@@ -1 +1,3 @@
2026/03/28-09:47:34.669467 7f0018fff6c0 Delete type=3 #1 2026/03/29-17:12:00.740305 7f4bda7ed6c0 Recovering log #4
2026/03/29-17:12:00.787211 7f4bda7ed6c0 Delete type=3 #2
2026/03/29-17:12:00.787276 7f4bda7ed6c0 Delete type=0 #4

View File

@@ -0,0 +1,5 @@
2026/03/28-09:47:34.669467 7f0018fff6c0 Delete type=3 #1
2026/03/29-17:08:09.756858 7effca7fc6c0 Level-0 table #5: started
2026/03/29-17:08:09.756892 7effca7fc6c0 Level-0 table #5: 0 bytes OK
2026/03/29-17:08:09.762851 7effca7fc6c0 Delete type=0 #3
2026/03/29-17:08:09.769416 7effca7fc6c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@@ -1 +1 @@
MANIFEST-000002 MANIFEST-000006

View File

@@ -1 +1,3 @@
2026/03/28-09:47:34.653497 7effcaffd6c0 Delete type=3 #1 2026/03/29-17:12:00.691509 7f4bd9fec6c0 Recovering log #4
2026/03/29-17:12:00.738164 7f4bd9fec6c0 Delete type=3 #2
2026/03/29-17:12:00.738214 7f4bd9fec6c0 Delete type=0 #4

View File

@@ -0,0 +1,5 @@
2026/03/28-09:47:34.653497 7effcaffd6c0 Delete type=3 #1
2026/03/29-17:08:09.762957 7effca7fc6c0 Level-0 table #5: started
2026/03/29-17:08:09.762977 7effca7fc6c0 Level-0 table #5: 0 bytes OK
2026/03/29-17:08:09.769218 7effca7fc6c0 Delete type=0 #3
2026/03/29-17:08:09.769426 7effca7fc6c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end)

Binary file not shown.

Binary file not shown.