From a316fb9c61b767b9a327dde83ce7fe3379618ba0 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Tue, 31 Mar 2026 00:53:30 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20ic=C3=B4nes=20SVG=20art-d=C3=A9co=20pou?= =?UTF-8?q?r=20tous=20les=20types=20d'item=20+=20ic=C3=B4nes=20par=20d?= =?UTF-8?q?=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - aspect.svg : diamant à facettes avec coupe brillant et reflet - equipment.svg : clé vintage ornée avec tête circulaire et dents géométriques - preCreateItem hook : définit img par défaut par type d'item Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- assets/icons/aspect.svg | 39 ++++++++++++++++++++++++++++++++++++++ assets/icons/equipment.svg | 39 ++++++++++++++++++++++++++++++++++++++ fvtt-celestopol.mjs | 15 ++++++++++++++- 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 assets/icons/aspect.svg create mode 100644 assets/icons/equipment.svg diff --git a/assets/icons/aspect.svg b/assets/icons/aspect.svg new file mode 100644 index 0000000..e7100b6 --- /dev/null +++ b/assets/icons/aspect.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/icons/equipment.svg b/assets/icons/equipment.svg new file mode 100644 index 0000000..b3e49f0 --- /dev/null +++ b/assets/icons/equipment.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fvtt-celestopol.mjs b/fvtt-celestopol.mjs index 4537a5c..7ddc2f3 100644 --- a/fvtt-celestopol.mjs +++ b/fvtt-celestopol.mjs @@ -330,8 +330,21 @@ Hooks.on("preCreateItem", (item, data) => { aspect: () => game.i18n.localize("TYPES.Item.aspect"), equipment: () => game.i18n.localize("TYPES.Item.equipment"), } + const defaultIcons = { + weapon: "systems/fvtt-celestopol/assets/icons/weapon.svg", + armure: "systems/fvtt-celestopol/assets/icons/armure.svg", + anomaly: "systems/fvtt-celestopol/assets/icons/anomaly.svg", + aspect: "systems/fvtt-celestopol/assets/icons/aspect.svg", + equipment: "systems/fvtt-celestopol/assets/icons/equipment.svg", + } + const updates = {} const fn = defaultNames[item.type] if (fn && (!data.name || data.name === "New Item" || data.name === item.type)) { - item.updateSource({ name: fn() }) + updates.name = fn() } + const defaultIcon = defaultIcons[item.type] + if (defaultIcon && (!data.img || data.img === "icons/svg/item-bag.svg")) { + updates.img = defaultIcon + } + if (Object.keys(updates).length) item.updateSource(updates) })