diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/AbstractDialogChatBot.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/AbstractDialogChatBot.cs index 9c15f735..b07eb7cf 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/AbstractDialogChatBot.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/AbstractDialogChatBot.cs @@ -34,7 +34,7 @@ public abstract class AbstractDialogChatBot( return commandos.FirstOrDefault().Handle(splitCommand[1], GetChatBot(), sessionId, request); } - if (splitCommand.FirstOrDefault()?.ToLower() == "help") + if (string.Equals(splitCommand.FirstOrDefault(), "help", StringComparison.OrdinalIgnoreCase)) { return SendPlayerHelpMessage(sessionId, request); } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs index b7b00123..738fafd3 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/Commando/SptCommands/ProfileCommand/ProfileSptCommand.cs @@ -85,7 +85,7 @@ public class ProfileSptCommand( { var enumSkill = Enum.GetValues() .Cast() - .FirstOrDefault(t => t?.ToString().ToLower() == skill + .FirstOrDefault(t => string.Equals(t?.ToString(), skill, StringComparison.OrdinalIgnoreCase) ); if (enumSkill == null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs index 28fb49c9..4c75081d 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/AreYouABotMessageHandler.cs @@ -18,7 +18,7 @@ public class AreYouABotMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "are you a bot"; + return string.Equals(message, "are you a bot", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs index 3c9b1ddf..4f18b512 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/FishMessageHandler.cs @@ -16,7 +16,7 @@ public class FishMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "fish"; + return string.Equals(message, "fish", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs index bb3c85bc..05979dd5 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceChristmasMessageHandler.cs @@ -21,7 +21,7 @@ public class ForceChristmasMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "hohoho"; + return string.Equals(message, "hohoho", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs index 295972dd..6b4fd428 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceHalloweenMessageHandler.cs @@ -21,7 +21,7 @@ public class ForceHalloweenMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "veryspooky"; + return string.Equals(message, "veryspooky", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs index 3a88b429..8967aece 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSnowMessageHandler.cs @@ -25,7 +25,7 @@ public class ForceSnowMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "itsonlysnowalan"; + return string.Equals(message, "itsonlysnowalan", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs index a92b31e2..41ee72b2 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/ForceSummerMessageHandler.cs @@ -25,7 +25,7 @@ public class ForceSummerMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "givemesunshine"; + return string.Equals(message, "givemesunshine", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs index 50619b70..fd687ba0 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GarbageMessageHandler.cs @@ -18,7 +18,7 @@ public class GarbageMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "garbage"; + return string.Equals(message, "garbage", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs index e522d23c..540c2ba5 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/GiveMeSpaceMessageHandler.cs @@ -25,7 +25,7 @@ public class GiveMeSpaceMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "givemespace"; + return string.Equals(message, "givemespace", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs index a13a0903..6a4a5cab 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/LoveYouChatMessageHandler.cs @@ -19,7 +19,7 @@ public class LoveYouChatMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "love you"; + return string.Equals(message, "love you", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs index 41ecd825..babfbf4a 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/NikitaMessageHandler.cs @@ -18,7 +18,7 @@ public class NikitaMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "nikita"; + return string.Equals(message, "nikita", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs index 33af66b5..bb3469a1 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SPTFriend/Commands/SptMessageHandler.cs @@ -18,7 +18,7 @@ public class SptMessageHandler( public bool CanHandle(string message) { - return message.ToLower() == "spt"; + return string.Equals(message, "spt", StringComparison.OrdinalIgnoreCase); } public void Process(string sessionId, UserDialogInfo sptFriendUser, PmcData? sender, object? extraInfo = null) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs index 0845e788..20ff21c5 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/Dialogue/SptDialogueChatBot.cs @@ -47,7 +47,7 @@ public class SptDialogueChatBot( var sender = _profileHelper.GetPmcProfile(sessionId); var sptFriendUser = GetChatBot(); - if (request.Text?.ToLower() == "help") + if (string.Equals(request.Text, "help", StringComparison.OrdinalIgnoreCase)) { return SendPlayerHelpMessage(sessionId, request); } diff --git a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs index bcaeb61d..b081ef8d 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs @@ -97,7 +97,7 @@ public class LocaleService( /// Locale e.g en/ge/cz/cn public string GetDesiredGameLocale() { - if (_localeConfig.GameLocale.ToLower() == "system") + if (string.Equals(_localeConfig.GameLocale, "system", StringComparison.OrdinalIgnoreCase)) { return GetPlatformForClientLocale(); } @@ -112,7 +112,7 @@ public class LocaleService( /// Locale e.g en/ge/cz/cn public string GetDesiredServerLocale() { - if (_localeConfig.ServerLocale.ToLower() == "system") + if (string.Equals(_localeConfig.ServerLocale, "system", StringComparison.OrdinalIgnoreCase)) { return GetPlatformForServerLocale(); } diff --git a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs index ec5a7db7..1cb3ffbf 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocationLifecycleService.cs @@ -209,7 +209,7 @@ public class LocationLifecycleService /// Maps location base data protected void AdjustExtracts(string playerSide, string location, LocationBase locationData) { - var playerIsScav = playerSide.ToLower() == "savage"; + var playerIsScav = string.Equals(playerSide, "savage", StringComparison.OrdinalIgnoreCase); if (!playerIsScav) { return; @@ -225,7 +225,7 @@ public class LocationLifecycleService } // Find only scav extracts and overwrite existing exits with them - var scavExtracts = mapExtracts.Where(extract => extract.Side.ToLower() == "scav").ToList(); + var scavExtracts = mapExtracts.Where(extract => string.Equals(extract.Side, "scav", StringComparison.OrdinalIgnoreCase)).ToList(); if (scavExtracts.Count > 0) // Scav extracts found, use them { @@ -347,7 +347,7 @@ public class LocationLifecycleService locationBaseClone.UnixDateTime = _timeUtil.GetTimeStamp(); // Don't generate loot for hideout - if (name.ToLower() == "hideout") + if (string.Equals(name, "hideout", StringComparison.OrdinalIgnoreCase)) { return locationBaseClone; } diff --git a/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs b/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs index 46a548e6..f87edcb8 100644 --- a/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/ProfileFixerService.cs @@ -167,7 +167,7 @@ public class ProfileFixerService( // Iterate over clothing var customizationDb = _databaseService.GetTemplates().Customization; var customizationDbArray = customizationDb.Values; - var playerIsUsec = pmcProfile.Info.Side.ToLower() == "usec"; + var playerIsUsec = string.Equals(pmcProfile.Info.Side, "usec", StringComparison.OrdinalIgnoreCase); // Check Head if (customizationDb[pmcProfile.Customization.Head] is null) diff --git a/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs b/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs index 2e847d4a..c68122d7 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RaidTimeAdjustmentService.cs @@ -151,7 +151,7 @@ public class RaidTimeAdjustmentService( }; // Pmc raid, send default - if (request.Side.ToLower() == "pmc") + if (string.Equals(request.Side, "pmc", StringComparison.OrdinalIgnoreCase)) { return result; } diff --git a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs index 28fa04a5..d6854904 100644 --- a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs @@ -714,7 +714,8 @@ public class SeasonalEventService( /// protected void AdjustZryachiyMeleeChance() { - var zryachiyKvP = _databaseService.GetBots().Types.FirstOrDefault(x => x.Key.ToLower() == "bosszryachiy"); + var zryachiyKvP = _databaseService.GetBots().Types + .FirstOrDefault(x => string.Equals(x.Key, "bosszryachiy", StringComparison.OrdinalIgnoreCase)); var value = new Dictionary(); foreach (var chance in zryachiyKvP.Value.BotChances.EquipmentChances) diff --git a/SPTarkov.Server/Modding/ModValidator.cs b/SPTarkov.Server/Modding/ModValidator.cs index 17cb1555..dfa4fe08 100644 --- a/SPTarkov.Server/Modding/ModValidator.cs +++ b/SPTarkov.Server/Modding/ModValidator.cs @@ -374,10 +374,10 @@ public class ModValidator( var modName = mod.PackageJson.Name; var modPath = GetModPath(modName); - var modIsCalledBepinEx = modName.ToLower() == "bepinex"; - var modIsCalledUser = modName.ToLower() == "user"; - var modIsCalledSrc = modName.ToLower() == "src"; - var modIsCalledDb = modName.ToLower() == "db"; + var modIsCalledBepinEx = string.Equals(modName, "bepinex", StringComparison.OrdinalIgnoreCase); + var modIsCalledUser = string.Equals(modName, "user", StringComparison.OrdinalIgnoreCase); + var modIsCalledSrc = string.Equals(modName, "src", StringComparison.OrdinalIgnoreCase); + var modIsCalledDb = string.Equals(modName, "db", StringComparison.OrdinalIgnoreCase); var hasBepinExFolderStructure = fileUtil.DirectoryExists($"{mod.Directory}/plugins"); var containsJs = fileUtil.GetFiles(mod.Directory, true, "*.js").Count > 0; var containsTs = fileUtil.GetFiles(mod.Directory, true, "*.ts").Count > 0;