From 75c8f9b63af2c54230ce27d9fbc4fa4e2bc3d39f Mon Sep 17 00:00:00 2001 From: Spicy Marinara Date: Wed, 25 Feb 2026 23:58:51 +0100 Subject: [PATCH] Update src/systems/ui/trackerEditor.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/systems/ui/trackerEditor.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/systems/ui/trackerEditor.js b/src/systems/ui/trackerEditor.js index f287847..e84c75b 100644 --- a/src/systems/ui/trackerEditor.js +++ b/src/systems/ui/trackerEditor.js @@ -58,14 +58,14 @@ function set_ids_names(list_with_stats, index, value) { if (extensionSettings.userStats && Object.prototype.hasOwnProperty.call(extensionSettings.userStats, oldId)) { extensionSettings.userStats[newId] = extensionSettings.userStats[oldId]; delete extensionSettings.userStats[oldId]; - } - - if (extensionSettings.classicStats && Object.prototype.hasOwnProperty.call(extensionSettings.classicStats, oldId)) { - extensionSettings.classicStats[newId] = extensionSettings.classicStats[oldId]; - delete extensionSettings.classicStats[oldId]; - } +function setIdsNames(listWithStats, index, value) { + listWithStats[index].name = value; + const ids = listWithStats.toSpliced(index, 1).map(stat => stat.id); + const snakeValue = safeToSnake(value); // new id format + if (snakeValue !== value && !ids.includes(snakeValue)) { // check if this id already exists + listWithStats[index].id = snakeValue; } - return list_with_stats; + return listWithStats; }