From eeea8a00002ab578039e901d2c6b1c1756146e88 Mon Sep 17 00:00:00 2001 From: Archangel Date: Mon, 24 Feb 2025 18:49:25 +0100 Subject: [PATCH] Remove count for any --- Libraries/Core/Generators/BotEquipmentModGenerator.cs | 8 ++++---- Libraries/Core/Generators/LootGenerator.cs | 4 ++-- Libraries/Core/Helpers/DialogueHelper.cs | 2 +- Libraries/Core/Helpers/ProfileHelper.cs | 4 ++-- Libraries/Core/Helpers/QuestHelper.cs | 2 +- Libraries/Core/Services/SeasonalEventService.cs | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index 308d4ce8..ea1b9735 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -1005,7 +1005,7 @@ public class BotEquipmentModGenerator( tpl => _botConfig.LowProfileGasBlockTpls.Contains(tpl) ); - if (onlyLowProfileGasBlocks.Count() > 0) + if (onlyLowProfileGasBlocks.Any()) { modPool = onlyLowProfileGasBlocks.ToHashSet(); } @@ -1016,7 +1016,7 @@ public class BotEquipmentModGenerator( var onlyHighProfileGasBlocks = modPool.Where( tpl => !_botConfig.LowProfileGasBlockTpls.Contains(tpl) ); - if (onlyHighProfileGasBlocks.Count() > 0) + if (onlyHighProfileGasBlocks.Any()) { modPool = onlyHighProfileGasBlocks.ToHashSet(); } @@ -1356,7 +1356,7 @@ public class BotEquipmentModGenerator( // Last ditch, use full pool of items minus conflicts var newListOfModsForSlot = parentSlotCompatibleItems.Where(tpl => !request.ConflictingItemTpls.Contains(tpl)); - if (newListOfModsForSlot.Count() > 0) + if (newListOfModsForSlot.Any()) { return newListOfModsForSlot.ToHashSet(); } @@ -1781,7 +1781,7 @@ public class BotEquipmentModGenerator( // Edge case, what if item is a mount for a scope and not directly a scope? // Check item is mount + has child items var itemDetails = _itemHelper.GetItem(item).Value; - if (_itemHelper.IsOfBaseclass(item, BaseClasses.MOUNT) && itemDetails.Properties.Slots.Count() > 0) + if (_itemHelper.IsOfBaseclass(item, BaseClasses.MOUNT) && itemDetails.Properties.Slots.Any()) { // Check to see if mount has a scope slot (only include primary slot, ignore the rest like the backup sight slots) // Should only find 1 as there's currently no items with a mod_scope AND a mod_scope_000 diff --git a/Libraries/Core/Generators/LootGenerator.cs b/Libraries/Core/Generators/LootGenerator.cs index 18d6b38b..7777bf12 100644 --- a/Libraries/Core/Generators/LootGenerator.cs +++ b/Libraries/Core/Generators/LootGenerator.cs @@ -608,7 +608,7 @@ public class LootGenerator( item.Properties.QuestItem is null ); - if (rewardItemPool.Count() == 0) + if (!rewardItemPool.Any()) { if (_logger.IsLogEnabled(LogLevel.Debug)) { @@ -664,7 +664,7 @@ public class LootGenerator( var relatedItems = linkedItemsToWeapon?.Where( item => item?.Parent == rewardKey && !_itemFilterService.IsItemBlacklisted(item.Id) ); - if (relatedItems is null || relatedItems.Count() == 0) + if (relatedItems is null || !relatedItems.Any()) { if (_logger.IsLogEnabled(LogLevel.Debug)) { diff --git a/Libraries/Core/Helpers/DialogueHelper.cs b/Libraries/Core/Helpers/DialogueHelper.cs index 900fe60b..5b605e3b 100644 --- a/Libraries/Core/Helpers/DialogueHelper.cs +++ b/Libraries/Core/Helpers/DialogueHelper.cs @@ -85,7 +85,7 @@ public class DialogueHelper( } var rewardItems = message.Items.Data?.Where(x => x.Id != itemId); - if (rewardItems.Count() == 0) + if (!rewardItems.Any()) { message.RewardCollected = true; message.HasRewards = false; diff --git a/Libraries/Core/Helpers/ProfileHelper.cs b/Libraries/Core/Helpers/ProfileHelper.cs index 8a1540c1..49649b9a 100644 --- a/Libraries/Core/Helpers/ProfileHelper.cs +++ b/Libraries/Core/Helpers/ProfileHelper.cs @@ -591,7 +591,7 @@ public class ProfileHelper( public double GetBonusValueFromProfile(PmcData pmcProfile, BonusType desiredBonus) { var bonuses = pmcProfile?.Bonuses?.Where(b => b.Type == desiredBonus); - if (bonuses.Count() == 0) + if (!bonuses.Any()) { return 0; } @@ -621,7 +621,7 @@ public class ProfileHelper( // Find all pockets in profile, may be multiple as they could have equipment stand // (1 pocket for each upgrade level of equipment stand) var pockets = pmcProfile.Inventory.Items.Where(i => i.SlotId == "Pockets"); - if (pockets.Count() == 0) + if (!pockets.Any()) { _logger.Error($"Unable to replace profile: {pmcProfile.Id} pocket tpl with: {newPocketTpl} as Pocket item could not be found."); return; diff --git a/Libraries/Core/Helpers/QuestHelper.cs b/Libraries/Core/Helpers/QuestHelper.cs index befbfe2c..705986b7 100644 --- a/Libraries/Core/Helpers/QuestHelper.cs +++ b/Libraries/Core/Helpers/QuestHelper.cs @@ -737,7 +737,7 @@ public class QuestHelper( // Quest found and no repeatable found if (quest is not null && matchingRepeatableQuest is null) { - if (quest.FailMessageText.Trim().Count() > 0) + if (quest.FailMessageText.Trim().Any()) { _mailSendService.SendLocalisedNpcMessageToPlayer( sessionID, diff --git a/Libraries/Core/Services/SeasonalEventService.cs b/Libraries/Core/Services/SeasonalEventService.cs index 153dd450..599da281 100644 --- a/Libraries/Core/Services/SeasonalEventService.cs +++ b/Libraries/Core/Services/SeasonalEventService.cs @@ -412,7 +412,7 @@ public class SeasonalEventService( // Get non-christmas items var nonChristmasTpls = prop.Where(tpl => !christmasItems.Contains(tpl.Key)); - if (nonChristmasTpls.Count() == 0) + if (!nonChristmasTpls.Any()) { continue; }