diff --git a/Libraries/Core/Controllers/HealthController.cs b/Libraries/Core/Controllers/HealthController.cs index c365f2d4..3d8c576f 100644 --- a/Libraries/Core/Controllers/HealthController.cs +++ b/Libraries/Core/Controllers/HealthController.cs @@ -32,7 +32,7 @@ public class HealthController( /// /// Player profile /// Healing request - /// Player id + /// Player id /// ItemEventRouterResponse public ItemEventRouterResponse OffRaidHeal( PmcData pmcData, @@ -61,10 +61,10 @@ public class HealthController( else { // Get max healing from db - var maxhp = _itemHelper.GetItem(healingItemToUse.Template).Value.Properties.MaxHpResource; + var maxHp = _itemHelper.GetItem(healingItemToUse.Template).Value.Properties.MaxHpResource; healingItemToUse.Upd.MedKit = new UpdMedKit { - HpResource = maxhp - request.Count + HpResource = maxHp - request.Count }; // Subtract amout used from max // request.count appears to take into account healing effects removed, e.g. bleeds // Salewa heals limb for 20 and fixes light bleed = (20+45 = 65) @@ -87,7 +87,7 @@ public class HealthController( return output; } - // Get inital heal amount + // Get initial heal amount var amountToHealLimb = request.Count; // Check if healing item removes negative effects @@ -95,19 +95,18 @@ public class HealthController( if (itemRemovesEffects && bodyPartToHeal.Effects is not null) { // Can remove effects and limb has effects to remove - var effectsOnBodyPart = bodyPartToHeal.Effects.Keys; - foreach (var effectKey in effectsOnBodyPart) + foreach (var effectKvP in bodyPartToHeal.Effects) { // Check if healing item removes the effect on limb - if (!healItemEffectDetails.TryGetValue(Enum.Parse(effectKey), out var matchingEffectFromHealingItem)) + if (!healItemEffectDetails.TryGetValue(Enum.Parse(effectKvP.Key), out var matchingEffectFromHealingItem)) // Healing item doesn't have matching effect, it doesn't remove the effect { continue; } - // Adjust limb heal amount based on if its fixing an effect (request.count is TOTAL cost of hp resource on heal item, NOT amount to heal limb) + // Adjust limb heal amount based on if it's fixing an effect (request.count is TOTAL cost of hp resource on heal item, NOT amount to heal limb) amountToHealLimb -= (int) (matchingEffectFromHealingItem.Cost ?? 0); - bodyPartToHeal.Effects.Remove(effectKey); + bodyPartToHeal.Effects.Remove(effectKvP.Key); } } diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index 16ab859f..5e0ca9c5 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -650,14 +650,14 @@ public class BotEquipmentModGenerator( } else { - var containsModInPool = request.ModPool.Keys.Contains(modToAddTemplate.Value.Id); + var containsModInPool = request.ModPool.ContainsKey(modToAddTemplate.Value.Id); // Sometimes randomised slots are missing sub-mods, if so, get values from mod pool service // Check for a randomisable slot + without data in modPool + item being added as additional slots if (isRandomisableSlot && !containsModInPool && modToAddTemplate.Value.Properties.Slots.Any()) { var modFromService = _botEquipmentModPoolService.GetModsForWeaponSlot(modToAddTemplate.Value.Id); - if (modFromService?.Keys.Count > 0) + if (modFromService?.Count > 0) { request.ModPool[modToAddTemplate.Value.Id] = modFromService.ToDictionary(); containsModInPool = true; @@ -669,7 +669,7 @@ public class BotEquipmentModGenerator( { // Check for required mods the item we've added needs to be classified as 'valid' var modFromService = _botEquipmentModPoolService.GetRequiredModsForWeaponSlot(modToAddTemplate.Value.Id); - if (modFromService?.Keys.Count > 0) + if (modFromService?.Count > 0) { request.ModPool[modToAddTemplate.Value.Id] = modFromService; containsModInPool = true; diff --git a/Libraries/Core/Generators/BotWeaponGenerator.cs b/Libraries/Core/Generators/BotWeaponGenerator.cs index 3877d425..310bbcd5 100644 --- a/Libraries/Core/Generators/BotWeaponGenerator.cs +++ b/Libraries/Core/Generators/BotWeaponGenerator.cs @@ -146,7 +146,7 @@ public class BotWeaponGenerator( } // Add mods to weapon base - if (modPool.Keys.Contains(weaponTpl)) + if (modPool.ContainsKey(weaponTpl)) { // Role to treat bot as e.g. pmc/scav/boss var botEquipmentRole = _botGeneratorHelper.GetBotEquipmentRole(botRole); @@ -579,7 +579,7 @@ public class BotWeaponGenerator( protected string GetWeightedCompatibleAmmo(Dictionary> cartridgePool, TemplateItem weaponTemplate) { var desiredCaliber = GetWeaponCaliber(weaponTemplate); - if (!cartridgePool.TryGetValue(desiredCaliber, out var cartridgePoolForWeapon) || cartridgePoolForWeapon?.Keys.Count == 0) + if (!cartridgePool.TryGetValue(desiredCaliber, out var cartridgePoolForWeapon) || cartridgePoolForWeapon?.Count == 0) { if (_logger.IsLogEnabled(LogLevel.Debug)) { diff --git a/Libraries/Core/Helpers/RagfairServerHelper.cs b/Libraries/Core/Helpers/RagfairServerHelper.cs index b100429b..6458edbd 100644 --- a/Libraries/Core/Helpers/RagfairServerHelper.cs +++ b/Libraries/Core/Helpers/RagfairServerHelper.cs @@ -185,11 +185,11 @@ public class RagfairServerHelper( var currencies = ragfairConfig.Dynamic.Currencies; var bias = new List(); - foreach (var item in currencies.Keys) + foreach (var currentKvP in currencies) { - for (var i = 0; i < currencies[item]; i++) + for (var i = 0; i < currentKvP.Value; i++) { - bias.Add(item); + bias.Add(currentKvP.Key); } }