diff --git a/Generator/BaseBotGenerator.cs b/Generator/BaseBotGenerator.cs index f09e78c..1c4689c 100644 --- a/Generator/BaseBotGenerator.cs +++ b/Generator/BaseBotGenerator.cs @@ -39,15 +39,15 @@ namespace Generator var rawBots = new List { - assaultBot, - raiderBot, - marksmanBot, + assaultBot, + raiderBot, + marksmanBot, - bossbully, - bossgluharBot, - bosskillaBot, - bosskojaniyBot, - bosssanitarBot + bossbully, + bossgluharBot, + bosskillaBot, + bosskojaniyBot, + bosssanitarBot }; foreach (var botToUpdate in rawBots) @@ -57,10 +57,12 @@ namespace Generator if (rawBotsOfSameType.Count == 0) { - Console.WriteLine($"no bots of type {botToUpdate.botType.ToString()}"); + LoggingHelpers.LogToConsole($"no bots of type {botToUpdate.botType}", ConsoleColor.DarkRed); break; } + LoggingHelpers.LogToConsole($"Found {rawBotsOfSameType.Count} bots of type: {botToUpdate.botType}"); + UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType); AddDifficulties(botToUpdate, _workingPath); AddExperience(botToUpdate, rawBotsOfSameType); diff --git a/Generator/BotGearGenerator.cs b/Generator/BotGearGenerator.cs index 2a7d8bf..eb83ab0 100644 --- a/Generator/BotGearGenerator.cs +++ b/Generator/BotGearGenerator.cs @@ -25,20 +25,26 @@ namespace Generator var stopwatch = Stopwatch.StartNew(); LoggingHelpers.LogToConsole("Started processing bot gear"); - foreach (var bot in _baseBots) + foreach (var botToUpdate in _baseBots) { var rawParsedBotOfCurrentType = _rawParsedBots - .Where(x => x.Info.Settings.Role.Equals(bot.botType.ToString(), StringComparison.OrdinalIgnoreCase)) + .Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) .ToList(); - GearChanceHelpers.CalculateEquipmentChances(bot, rawParsedBotOfCurrentType); - GearChanceHelpers.AddGenerationChances(bot); - GearChanceHelpers.CalculateModChances(bot, rawParsedBotOfCurrentType); + + if (rawParsedBotOfCurrentType.Count == 0) + { + break; + } + + GearChanceHelpers.CalculateEquipmentChances(botToUpdate, rawParsedBotOfCurrentType); + GearChanceHelpers.AddGenerationChances(botToUpdate); + GearChanceHelpers.CalculateModChances(botToUpdate, rawParsedBotOfCurrentType); foreach (var rawParsedBot in rawParsedBotOfCurrentType) { - GearHelpers.AddEquippedGear(bot, rawParsedBot); - GearHelpers.AddEquippedMods(bot, rawParsedBot); - GearHelpers.AddCartridges(bot, rawParsedBot); + GearHelpers.AddEquippedGear(botToUpdate, rawParsedBot); + GearHelpers.AddEquippedMods(botToUpdate, rawParsedBot); + GearHelpers.AddCartridges(botToUpdate, rawParsedBot); } } diff --git a/Generator/BotLootGenerator.cs b/Generator/BotLootGenerator.cs index b2f277e..b6f54b4 100644 --- a/Generator/BotLootGenerator.cs +++ b/Generator/BotLootGenerator.cs @@ -30,6 +30,12 @@ namespace Generator var rawBotsOfSameType = _rawParsedBots .Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)) .ToList(); + + if (rawBotsOfSameType.Count == 0) + { + break; + } + foreach (var rawParsedBot in rawBotsOfSameType) { AddPocketLoot(botToUpdate, rawParsedBot); diff --git a/Generator/Helpers/LoggingHelpers.cs b/Generator/Helpers/LoggingHelpers.cs index de68475..0005f88 100644 --- a/Generator/Helpers/LoggingHelpers.cs +++ b/Generator/Helpers/LoggingHelpers.cs @@ -9,9 +9,9 @@ namespace Generator.Helpers return Math.Round(totalSeconds, 2, MidpointRounding.ToEven).ToString(); } - public static void LogToConsole(string message) + public static void LogToConsole(string message, ConsoleColor backgroundColour = ConsoleColor.Green) { - Console.BackgroundColor = ConsoleColor.Green; + Console.BackgroundColor = backgroundColour; Console.ForegroundColor = ConsoleColor.Black; Console.WriteLine(message); diff --git a/Generator/JsonWriter.cs b/Generator/JsonWriter.cs index 26800d1..94a5f85 100644 --- a/Generator/JsonWriter.cs +++ b/Generator/JsonWriter.cs @@ -24,6 +24,11 @@ namespace Generator foreach (var bot in bots) { + if (bot.appearance.body.Count == 0) // only process files that have data in them, no body = no dumps + { + Helpers.LoggingHelpers.LogToConsole($"Unable to process bot type: {bot.botType}, skipping", ConsoleColor.DarkRed); + continue; + } var output = JsonConvert.SerializeObject(bot, Formatting.Indented); Console.WriteLine($"Writing json file {bot.botType} to {outputPath}"); File.WriteAllText($"{outputPath}\\{bot.botType}.json", output);