Handle a bot type with no dumps
This commit is contained in:
parent
c8cf5f847e
commit
76a17e6d6a
@ -57,10 +57,12 @@ namespace Generator
|
|||||||
|
|
||||||
if (rawBotsOfSameType.Count == 0)
|
if (rawBotsOfSameType.Count == 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"no bots of type {botToUpdate.botType.ToString()}");
|
LoggingHelpers.LogToConsole($"no bots of type {botToUpdate.botType}", ConsoleColor.DarkRed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoggingHelpers.LogToConsole($"Found {rawBotsOfSameType.Count} bots of type: {botToUpdate.botType}");
|
||||||
|
|
||||||
UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType);
|
UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType);
|
||||||
AddDifficulties(botToUpdate, _workingPath);
|
AddDifficulties(botToUpdate, _workingPath);
|
||||||
AddExperience(botToUpdate, rawBotsOfSameType);
|
AddExperience(botToUpdate, rawBotsOfSameType);
|
||||||
|
@ -25,20 +25,26 @@ namespace Generator
|
|||||||
var stopwatch = Stopwatch.StartNew();
|
var stopwatch = Stopwatch.StartNew();
|
||||||
LoggingHelpers.LogToConsole("Started processing bot gear");
|
LoggingHelpers.LogToConsole("Started processing bot gear");
|
||||||
|
|
||||||
foreach (var bot in _baseBots)
|
foreach (var botToUpdate in _baseBots)
|
||||||
{
|
{
|
||||||
var rawParsedBotOfCurrentType = _rawParsedBots
|
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();
|
.ToList();
|
||||||
GearChanceHelpers.CalculateEquipmentChances(bot, rawParsedBotOfCurrentType);
|
|
||||||
GearChanceHelpers.AddGenerationChances(bot);
|
if (rawParsedBotOfCurrentType.Count == 0)
|
||||||
GearChanceHelpers.CalculateModChances(bot, rawParsedBotOfCurrentType);
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GearChanceHelpers.CalculateEquipmentChances(botToUpdate, rawParsedBotOfCurrentType);
|
||||||
|
GearChanceHelpers.AddGenerationChances(botToUpdate);
|
||||||
|
GearChanceHelpers.CalculateModChances(botToUpdate, rawParsedBotOfCurrentType);
|
||||||
|
|
||||||
foreach (var rawParsedBot in rawParsedBotOfCurrentType)
|
foreach (var rawParsedBot in rawParsedBotOfCurrentType)
|
||||||
{
|
{
|
||||||
GearHelpers.AddEquippedGear(bot, rawParsedBot);
|
GearHelpers.AddEquippedGear(botToUpdate, rawParsedBot);
|
||||||
GearHelpers.AddEquippedMods(bot, rawParsedBot);
|
GearHelpers.AddEquippedMods(botToUpdate, rawParsedBot);
|
||||||
GearHelpers.AddCartridges(bot, rawParsedBot);
|
GearHelpers.AddCartridges(botToUpdate, rawParsedBot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,12 @@ namespace Generator
|
|||||||
var rawBotsOfSameType = _rawParsedBots
|
var rawBotsOfSameType = _rawParsedBots
|
||||||
.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
if (rawBotsOfSameType.Count == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var rawParsedBot in rawBotsOfSameType)
|
foreach (var rawParsedBot in rawBotsOfSameType)
|
||||||
{
|
{
|
||||||
AddPocketLoot(botToUpdate, rawParsedBot);
|
AddPocketLoot(botToUpdate, rawParsedBot);
|
||||||
|
@ -9,9 +9,9 @@ namespace Generator.Helpers
|
|||||||
return Math.Round(totalSeconds, 2, MidpointRounding.ToEven).ToString();
|
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.ForegroundColor = ConsoleColor.Black;
|
||||||
|
|
||||||
Console.WriteLine(message);
|
Console.WriteLine(message);
|
||||||
|
@ -24,6 +24,11 @@ namespace Generator
|
|||||||
|
|
||||||
foreach (var bot in bots)
|
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);
|
var output = JsonConvert.SerializeObject(bot, Formatting.Indented);
|
||||||
Console.WriteLine($"Writing json file {bot.botType} to {outputPath}");
|
Console.WriteLine($"Writing json file {bot.botType} to {outputPath}");
|
||||||
File.WriteAllText($"{outputPath}\\{bot.botType}.json", output);
|
File.WriteAllText($"{outputPath}\\{bot.botType}.json", output);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user