Skip to content

Conversation

@DrakiaXYZ
Copy link
Contributor

No description provided.

@qodo-merge-for-open-source
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Prevent incomplete item localisation data

Refactor the logic to add Name, ShortName, and Description to locale data
independently. This ensures that if one property already exists, the others are
still added, preventing incomplete localization data.

Libraries/SPTarkov.Server.Core/Services/Mod/CustomItemService.cs [255-263]

 if (!localeData.TryAdd($"{newItemId} Name", newLocaleDetails.Name))
 {
     logger.Error($"Error adding locale `{newItemId} Name` to {shortNameKey.Key}, duplicate key");
 }
-else
+
+if (!localeData.TryAdd($"{newItemId} ShortName", newLocaleDetails.ShortName))
 {
-    localeData.TryAdd($"{newItemId} ShortName", newLocaleDetails.ShortName);
-    localeData.TryAdd($"{newItemId} Description", newLocaleDetails.Description);
+    logger.Error($"Error adding locale `{newItemId} ShortName` to {shortNameKey.Key}, duplicate key");
 }
 
+if (!localeData.TryAdd($"{newItemId} Description", newLocaleDetails.Description))
+{
+    logger.Error($"Error adding locale `{newItemId} Description` to {shortNameKey.Key}, duplicate key");
+}
+
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a logic bug in the PR where if adding an item's Name fails, its ShortName and Description are not added, leading to incomplete data. The proposed fix is more robust.

Medium
  • More

@chompDev chompDev merged commit cb043f3 into sp-tarkov:develop Oct 17, 2025
5 checks passed
@DrakiaXYZ DrakiaXYZ deleted the fix-dupeitemlocale branch October 28, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants