diff --git a/Generator/BaseBotGenerator.cs b/Generator/BaseBotGenerator.cs index 9bc9838..420974a 100644 --- a/Generator/BaseBotGenerator.cs +++ b/Generator/BaseBotGenerator.cs @@ -15,24 +15,24 @@ namespace Generator public static class BaseBotGenerator { //TODO: pass in bot types and use those to create the classes in rawBots list - public static IEnumerable GenerateBaseDetails(IEnumerable parsedBots, string workingPath, IEnumerable botTypes) + public static IEnumerable GenerateBaseDetails(IEnumerable rawBots, string workingPath, IEnumerable botTypes) { var stopwatch = Stopwatch.StartNew(); LoggingHelpers.LogToConsole("Started processing bot base"); // Create a list of bot objects ready to be hydrated - var rawBots = new List(); + var baseBots = new List(); foreach (var botType in botTypes) { var typeToAdd = (BotType)Enum.Parse(typeof(BotType), botType); - rawBots.Add(new Bot(typeToAdd)); + baseBots.Add(new Bot(typeToAdd)); } // Iterate over each bot type wejust made and put some data into them - foreach (var botToUpdate in rawBots) + foreach (var botToUpdate in baseBots) { - var rawBotsOfSameType = parsedBots - .Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)).ToList(); + var rawBotsOfSameType = rawBots.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) + .ToList(); if (rawBotsOfSameType.Count == 0) { @@ -59,7 +59,7 @@ namespace Generator stopwatch.Stop(); LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds"); - return rawBots; + return baseBots; } private static void AddSkills(Bot botToUpdate, IEnumerable rawBotsOfSameType) @@ -88,9 +88,9 @@ namespace Generator botToUpdate.experience.reward.max = firstBotOfDesiredType.Info.Settings.Experience; } - private static void AddVoice(Bot bot, Datum rawParsedBot) + private static void AddVoice(Bot bot, Datum rawBot) { - bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice); + bot.appearance.voice.AddUnique(rawBot.Info.Voice); } private static void AddDifficulties(Bot bot, string workingPath) @@ -103,9 +103,9 @@ namespace Generator DifficultyHelper.AddDifficultySettings(bot, botFiles); } - private static void UpdateBodyPartHealth(Bot botToUpdate, List rawParsedBots) + private static void UpdateBodyPartHealth(Bot botToUpdate, List rawBots) { - var firstBotOfDesiredType = rawParsedBots.FirstOrDefault(); + var firstBotOfDesiredType = rawBots.FirstOrDefault(); if (firstBotOfDesiredType == null) { LoggingHelpers.LogToConsole($"bot type of: {botToUpdate.botType} not found, unable to update body part health."); diff --git a/Generator/BotChancesGenerator.cs b/Generator/BotChancesGenerator.cs index b72cbf9..5d35900 100644 --- a/Generator/BotChancesGenerator.cs +++ b/Generator/BotChancesGenerator.cs @@ -11,14 +11,14 @@ namespace Generator { public static class BotChancesGenerator { - public static IEnumerable AddChances(this IEnumerable botsWithGear, IEnumerable parsedBots) + public static IEnumerable AddChances(this IEnumerable botsToUpdate, IEnumerable rawBots) { var stopwatch = Stopwatch.StartNew(); LoggingHelpers.LogToConsole("Started processing bot gear"); - foreach (var botToUpdate in botsWithGear) + foreach (var botToUpdate in botsToUpdate) { - var rawParsedBotOfCurrentType = parsedBots + var rawParsedBotOfCurrentType = rawBots .Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) .ToList(); @@ -36,7 +36,7 @@ namespace Generator stopwatch.Stop(); LoggingHelpers.LogToConsole($"Finished processing bot chances. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds"); - return botsWithGear; + return botsToUpdate; } } } \ No newline at end of file diff --git a/Generator/BotGearGenerator.cs b/Generator/BotGearGenerator.cs index 9c4fc89..9e0f738 100644 --- a/Generator/BotGearGenerator.cs +++ b/Generator/BotGearGenerator.cs @@ -11,16 +11,15 @@ namespace Generator { public static class BotGearGenerator { - public static IEnumerable AddGear(this IEnumerable baseBots, IEnumerable parsedBots) + public static IEnumerable AddGear(this IEnumerable baseBots, IEnumerable rawBots) { var stopwatch = Stopwatch.StartNew(); LoggingHelpers.LogToConsole("Started processing bot gear"); foreach (var botToUpdate in baseBots) { - var rawParsedBotOfCurrentType = parsedBots - .Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) - .ToList(); + var rawParsedBotOfCurrentType = rawBots.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) + .ToList(); if (rawParsedBotOfCurrentType.Count == 0) { diff --git a/Generator/BotLootGenerator.cs b/Generator/BotLootGenerator.cs index f728faf..b86d3e6 100644 --- a/Generator/BotLootGenerator.cs +++ b/Generator/BotLootGenerator.cs @@ -13,7 +13,7 @@ namespace Generator { public static class BotLootGenerator { - internal static IEnumerable AddLoot(this IEnumerable botsWithGear, IEnumerable parsedBots) + internal static IEnumerable AddLoot(this IEnumerable botsWithGear, IEnumerable rawBots) { var stopwatch = Stopwatch.StartNew(); LoggingHelpers.LogToConsole("Started processing bot loot"); @@ -21,7 +21,7 @@ namespace Generator // Iterate over assault/raider etc Parallel.ForEach(botsWithGear, botToUpdate => { - var rawBotsOfSameType = parsedBots + var rawBotsOfSameType = rawBots .Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) .ToList(); @@ -47,22 +47,22 @@ namespace Generator return botsWithGear; } - private static void AddPocketLoot(Bot botToUpdate, Datum bot) + private static void AddPocketLoot(Bot botToUpdate, Datum rawBot) { // pocket loot - foreach (var lootItem in bot.Inventory.items.Where(x => x?.slotId?.StartsWith("pocket") == true)) + foreach (var lootItem in rawBot.Inventory.items.Where(x => x?.slotId?.StartsWith("pocket") == true)) { botToUpdate.inventory.items.Pockets.AddUnique(lootItem._tpl); } } - private static void AddTacticalVestLoot(Bot botToUpdate, IEnumerable bots) + private static void AddTacticalVestLoot(Bot botToUpdate, IEnumerable rawBots) { - var tacVestItems = GetItemsStoredInEquipmentItem(bots, "TacticalVest"); + var tacVestItems = GetItemsStoredInEquipmentItem(rawBots, "TacticalVest"); botToUpdate.inventory.items.TacticalVest.AddRange(tacVestItems); } - private static void AddBackpackLoot(Bot botToUpdate, IEnumerable bots) + private static void AddBackpackLoot(Bot botToUpdate, IEnumerable rawBots) { // add generic keys to bosses if (botToUpdate.botType.IsBoss()) @@ -70,13 +70,13 @@ namespace Generator botToUpdate.inventory.items.Backpack.AddRange(SpecialLootHelper.GetGenericBossKeys()); } - var backpackItems = GetItemsStoredInEquipmentItem(bots, "Backpack"); + var backpackItems = GetItemsStoredInEquipmentItem(rawBots, "Backpack"); botToUpdate.inventory.items.Backpack.AddRange(backpackItems); } - private static void AddSecureContainerLoot(Bot botToUpdate, IEnumerable bots) + private static void AddSecureContainerLoot(Bot botToUpdate, IEnumerable rawBots) { - var tacVestItems = GetItemsStoredInEquipmentItem(bots, "SecuredContainer"); + var tacVestItems = GetItemsStoredInEquipmentItem(rawBots, "SecuredContainer"); botToUpdate.inventory.items.SecuredContainer.AddRange(tacVestItems); } @@ -85,11 +85,11 @@ namespace Generator botToUpdate.inventory.items.SpecialLoot.AddRange(SpecialLootHelper.GetSpecialLootForBotType(botToUpdate.botType)); } - private static IEnumerable GetItemsStoredInEquipmentItem(IEnumerable bots, string containerName) + private static IEnumerable GetItemsStoredInEquipmentItem(IEnumerable rawBots, string containerName) { var itemsStoredInContainer = new List(); var containers = new List(); - foreach (var bot in bots) + foreach (var bot in rawBots) { // find the container type we want on this bot (backpack etc) // Add to list diff --git a/Generator/Helpers/DifficultyHelper.cs b/Generator/Helpers/DifficultyHelper.cs index ecb0b91..87802db 100644 --- a/Generator/Helpers/DifficultyHelper.cs +++ b/Generator/Helpers/DifficultyHelper.cs @@ -11,12 +11,12 @@ namespace Generator.Helpers { private static readonly string[] _difficulties = new[] { "easy", "normal", "hard", "impossible" }; - public static void AddDifficultySettings(Bot bot, List difficultyFilePaths) + public static void AddDifficultySettings(Bot botToUpdate, List difficultyFilePaths) { // Read bot setting files from assets folder that match this bots type // Save into dictionary with difficulty as key var difficultySettingsJsons = new Dictionary(); - foreach (var path in difficultyFilePaths.Where(x=>x.Contains($"_{bot.botType}", System.StringComparison.InvariantCultureIgnoreCase))) + foreach (var path in difficultyFilePaths.Where(x=>x.Contains($"_{botToUpdate.botType}", System.StringComparison.InvariantCultureIgnoreCase))) { var json = File.ReadAllText(path); var serialisedObject = JsonConvert.DeserializeObject(json); @@ -37,7 +37,7 @@ namespace Generator.Helpers settings = difficultySettingsJsons.FirstOrDefault(x => x.Key != null); } - SaveSettingsIntoBotFile(bot, difficulty, settings.Value); + SaveSettingsIntoBotFile(botToUpdate, difficulty, settings.Value); } } @@ -49,21 +49,21 @@ namespace Generator.Helpers return splitPath.Last().Split("_")[0]; } - private static void SaveSettingsIntoBotFile(Bot bot, string difficulty, DifficultySettings settings) + private static void SaveSettingsIntoBotFile(Bot botToUpdate, string difficulty, DifficultySettings settings) { switch (difficulty) { case "easy": - bot.difficulty.easy = settings; + botToUpdate.difficulty.easy = settings; break; case "normal": - bot.difficulty.normal = settings; + botToUpdate.difficulty.normal = settings; break; case "hard": - bot.difficulty.hard = settings; + botToUpdate.difficulty.hard = settings; break; case "impossible": - bot.difficulty.impossible = settings; + botToUpdate.difficulty.impossible = settings; break; } }