From d7b21bcf2130f4f279af2594f38be888390e90c0 Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 20 Jan 2025 15:32:58 +0000 Subject: [PATCH] Small issue improvements --- .../Controllers/RepeatableQuestController.cs | 4 ++-- .../Generators/BotEquipmentModGenerator.cs | 20 ++++++++----------- server-csharp.sln.DotSettings | 1 + 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Libraries/Core/Controllers/RepeatableQuestController.cs b/Libraries/Core/Controllers/RepeatableQuestController.cs index 9291d336..2f5f0e35 100644 --- a/Libraries/Core/Controllers/RepeatableQuestController.cs +++ b/Libraries/Core/Controllers/RepeatableQuestController.cs @@ -169,7 +169,7 @@ public class RepeatableQuestController( var repeatableQuestDetails = pmcData.RepeatableQuests.FirstOrDefault( (repeatable) => repeatable.Name == repeatableConfig.Name ); - if (repeatableQuestDetails is not null) + if (repeatableQuestDetails is null) { // Not in profile, generate var hasAccess = _profileHelper.HasAccessToRepeatableFreeRefreshSystem(pmcData); @@ -382,7 +382,7 @@ public class RepeatableQuestController( } var locationBase = _databaseService.GetLocation(location.ToLower())?.Base; - if (locationBase is not null) + if (locationBase is null) { return true; } diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index b667962b..95736e79 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -1483,11 +1483,11 @@ public class BotEquipmentModGenerator( ExhaustableArray exhaustableModPool = null; var modSlot = "cartridges"; var camoraFirstSlot = "camora_000"; - if (itemModPool[modSlot] is not null) + if (itemModPool.TryGetValue(modSlot, out var value)) { - exhaustableModPool = CreateExhaustableArray(itemModPool[modSlot]); + exhaustableModPool = CreateExhaustableArray(value); } - else if (itemModPool[camoraFirstSlot] is not null) + else if (itemModPool.ContainsKey(camoraFirstSlot)) { modSlot = camoraFirstSlot; exhaustableModPool = CreateExhaustableArray(MergeCamoraPools(itemModPool)); @@ -1500,7 +1500,7 @@ public class BotEquipmentModGenerator( } string modTpl = null; - bool found = false; + var found = false; while (exhaustableModPool.HasValues()) { modTpl = exhaustableModPool.GetRandomValue(); @@ -1533,14 +1533,10 @@ public class BotEquipmentModGenerator( /// String array of shells for multiple camora sources public List MergeCamoraPools(Dictionary> camorasWithShells) { - var uniqueShells = new HashSet(); - foreach (var shell in camorasWithShells - .SelectMany(shellKvP => shellKvP.Value)) - { - uniqueShells.Add(shell); - } - - return uniqueShells.ToList(); + return camorasWithShells + .SelectMany(shellKvP => shellKvP.Value) + .Distinct() + .ToList(); } /// diff --git a/server-csharp.sln.DotSettings b/server-csharp.sln.DotSettings index d213ac10..70ece5af 100644 --- a/server-csharp.sln.DotSettings +++ b/server-csharp.sln.DotSettings @@ -16,6 +16,7 @@ True True True + True True True True