diff --git a/Common.Models/BotType.cs b/Common.Models/BotType.cs index c30fa9d..70b7a3b 100644 --- a/Common.Models/BotType.cs +++ b/Common.Models/BotType.cs @@ -3,7 +3,7 @@ public enum BotType { assault = 1, - pmcBot = 2, + pmcbot = 2, marksman = 3, bossbully = 4, bossgluhar = 5, @@ -24,12 +24,12 @@ sectantpriest = 20, sectantwarrior = 21, usec = 22, - exUsec = 23, + exusec = 23, gifter = 24, bossknight = 25, followerbirdeye = 26, followerbigpipe = 27, - bossZryachiy = 28, - followerZryachiy = 29 + bosszryachiy = 28, + followerzryachiy = 29 } } diff --git a/Common/Bot/BotParser.cs b/Common/Bot/BotParser.cs index 4669f73..d18d369 100644 --- a/Common/Bot/BotParser.cs +++ b/Common/Bot/BotParser.cs @@ -68,15 +68,14 @@ public static class BotParser continue; } - if (!parsedBotsDict.ContainsKey(bot._id)) + if (parsedBotsDict.ContainsKey(bot._id)) { - parsedBotsDict.Add(bot._id, bot); - } - else - { - var existingBot = parsedBotsDict[bot._id]; + //var existingBot = parsedBotsDict[bot._id]; dupeCount++; + continue; } + + parsedBotsDict.Add(bot._id, bot); } totalDupeCount += dupeCount; diff --git a/Common/Extensions/ParallelExtensions.cs b/Common/Extensions/ParallelExtensions.cs new file mode 100644 index 0000000..5cc0cc2 --- /dev/null +++ b/Common/Extensions/ParallelExtensions.cs @@ -0,0 +1,31 @@ +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Common.Extensions +{ + public static class ParallelExtensions + { + public static Task ParallelForEachAsync(this IEnumerable source, int dop, Func body) + { + async Task AwaitPartition(IEnumerator partition) + { + using (partition) + { + while (partition.MoveNext()) + { + await Task.Yield(); // prevents a sync/hot thread hangup + await body(partition.Current); + } + } + } + return Task.WhenAll( + Partitioner + .Create(source) + .GetPartitions(dop) + .AsParallel() + .Select(p => AwaitPartition(p))); + } + } +} diff --git a/Generator/BaseBotGenerator.cs b/Generator/BaseBotGenerator.cs index c02878c..8d07e02 100644 --- a/Generator/BaseBotGenerator.cs +++ b/Generator/BaseBotGenerator.cs @@ -180,7 +180,7 @@ namespace Generator if (name.Length > 1) { // Add lastnames to all bots except raiders - if (botToUpdate.botType != BotType.pmcBot) + if (botToUpdate.botType != BotType.pmcbot) { botToUpdate.lastName.AddUnique(name[1]); } diff --git a/Generator/Helpers/Gear/GearChanceHelpers.cs b/Generator/Helpers/Gear/GearChanceHelpers.cs index 85b1b91..cb5c1b0 100644 --- a/Generator/Helpers/Gear/GearChanceHelpers.cs +++ b/Generator/Helpers/Gear/GearChanceHelpers.cs @@ -114,7 +114,7 @@ namespace Generator.Helpers.Gear case BotType.bosssanitar: botToUpdate.chances.mods["mod_scope"] = 100; break; - case BotType.pmcBot: + case BotType.pmcbot: botToUpdate.chances.mods["mod_stock"] = 100; break; case BotType.followerbully: @@ -140,8 +140,10 @@ namespace Generator.Helpers.Gear botToUpdate.chances.mods["mod_scope"] = 100; botToUpdate.chances.mods["mod_stock"] = 100; break; - case BotType.exUsec: + case BotType.exusec: + botToUpdate.chances.mods["mod_stock"] = 100; botToUpdate.chances.mods["mod_stock_000"] = 100; + botToUpdate.chances.mods["mod_stock_001"] = 100; break; } @@ -243,7 +245,7 @@ namespace Generator.Helpers.Gear min = 0; max = 0; break; - case BotType.exUsec: + case BotType.exusec: min = 2; max = 4; break; diff --git a/Generator/Helpers/Gear/SpecialLootHelper.cs b/Generator/Helpers/Gear/SpecialLootHelper.cs index 2501ad8..e4b7284 100644 --- a/Generator/Helpers/Gear/SpecialLootHelper.cs +++ b/Generator/Helpers/Gear/SpecialLootHelper.cs @@ -70,7 +70,7 @@ namespace Generator.Helpers.Gear { case BotType.assault: break; - case BotType.pmcBot: + case BotType.pmcbot: break; case BotType.marksman: break;