forked from chomp/BotGenerator
Filter bots to just the type being processed
This commit is contained in:
parent
52da9c254b
commit
085effb080
@ -36,40 +36,30 @@ namespace Generator
|
||||
|
||||
foreach (var botToUpdate in rawBots)
|
||||
{
|
||||
var rawBotData = _rawParsedBots
|
||||
var rawBotsOfSameType = _rawParsedBots
|
||||
.Where(x => string.Equals(x.Info.Settings.Role, botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
UpdateBodyPartHealth(botToUpdate, rawBotData);
|
||||
}
|
||||
|
||||
foreach (var bot in rawBots)
|
||||
UpdateBodyPartHealth(botToUpdate, rawBotsOfSameType);
|
||||
AddDifficulties(botToUpdate, rawBotsOfSameType);
|
||||
|
||||
foreach (var rawParsedBot in rawBotsOfSameType)
|
||||
{
|
||||
AddDifficulties(bot, _rawParsedBots);
|
||||
foreach (var rawParsedBot in _rawParsedBots)
|
||||
{
|
||||
AddVisualAppearanceItems(bot, rawParsedBot);
|
||||
AddName(bot, rawParsedBot.Info.Nickname);
|
||||
AddVoice(bot, rawParsedBot);
|
||||
AddVisualAppearanceItems(botToUpdate, rawParsedBot);
|
||||
AddName(botToUpdate, rawParsedBot);
|
||||
AddVoice(botToUpdate, rawParsedBot);
|
||||
}
|
||||
}
|
||||
|
||||
stopwatch.Stop();
|
||||
LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
|
||||
|
||||
|
||||
return rawBots;
|
||||
}
|
||||
|
||||
private void AddVoice(Bot bot, Datum rawParsedBot)
|
||||
{
|
||||
if (bot.botType == BotType.assault || bot.botType == BotType.marksman)
|
||||
{
|
||||
if (rawParsedBot.Info.Voice.StartsWith("scav", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AddDifficulties(Bot bot, List<Datum> rawParsedBots)
|
||||
{
|
||||
@ -89,7 +79,7 @@ namespace Generator
|
||||
|
||||
private void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawParsedBots)
|
||||
{
|
||||
var firstBotOfDesiredType = rawParsedBots.FirstOrDefault(x => x.Info.Settings.Role == botToUpdate.botType.ToString());
|
||||
var firstBotOfDesiredType = rawParsedBots.FirstOrDefault();
|
||||
if (firstBotOfDesiredType == null)
|
||||
{
|
||||
LoggingHelpers.LogToConsole($"bot type of: {botToUpdate.botType} not found, unable to update body part health.");
|
||||
@ -126,9 +116,9 @@ namespace Generator
|
||||
botToUpdate.appearance.feet.AddUnique(rawBot.Customization.Feet);
|
||||
}
|
||||
|
||||
private void AddName(Bot botToUpdate, string nickName)
|
||||
private void AddName(Bot botToUpdate, Datum rawBot)
|
||||
{
|
||||
var name = nickName.Split();
|
||||
var name = rawBot.Info.Nickname.Split();
|
||||
botToUpdate.firstName.AddUnique(name[0]);
|
||||
if (name.Length > 1)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user