Updated locations where we parse a number stored as a string into a double to use CultureInfo.InvariantCulture, this resolves errors with languages that don't use commas instead of periods in numbers

This commit is contained in:
Chomp
2025-05-01 17:41:54 +01:00
parent c826f8896f
commit 1976218991
3 changed files with 6 additions and 3 deletions
@@ -1,4 +1,5 @@
using System.Collections.Frozen;
using System.Globalization;
using SPTarkov.Common.Annotations;
using SPTarkov.Server.Core.Helpers;
using SPTarkov.Server.Core.Models.Common;
@@ -305,7 +306,7 @@ public class BotEquipmentModGenerator(
var platesFromDb = existingPlateTplPool.Select(plateTpl => _itemHelper.GetItem(plateTpl).Value);
// Filter plates to the chosen level based on its armorClass property
var platesOfDesiredLevel = platesFromDb.Where(item => item.Properties.ArmorClass.Value == double.Parse(chosenArmorPlateLevelString));
var platesOfDesiredLevel = platesFromDb.Where(item => item.Properties.ArmorClass.Value == double.Parse(chosenArmorPlateLevelString, CultureInfo.InvariantCulture));
if (platesOfDesiredLevel.Any())
{
// Plates found
@@ -1,3 +1,4 @@
using System.Globalization;
using SPTarkov.Common.Annotations;
using SPTarkov.Common.Extensions;
using SPTarkov.Server.Core.Models.Eft.Common;
@@ -67,7 +68,7 @@ public class QuestHelper(
return true;
}
var conditionValue = double.Parse(condition.Value.ToString());
var conditionValue = double.Parse(condition.Value.ToString(), CultureInfo.InvariantCulture);
switch (condition.CompareMethod)
{
case ">=":
@@ -1,3 +1,4 @@
using System.Globalization;
using SPTarkov.Common.Annotations;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
@@ -85,7 +86,7 @@ public class RewardHelper(
_traderHelper.AddStandingToTrader(
sessionId,
reward.Target,
double.Parse(reward.Value.ToString())
double.Parse(reward.Value.ToString(), CultureInfo.InvariantCulture)
);
break;
case RewardType.TraderUnlock: