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)
|
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();
|
.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);
|
AddVisualAppearanceItems(botToUpdate, rawParsedBot);
|
||||||
foreach (var rawParsedBot in _rawParsedBots)
|
AddName(botToUpdate, rawParsedBot);
|
||||||
{
|
AddVoice(botToUpdate, rawParsedBot);
|
||||||
AddVisualAppearanceItems(bot, rawParsedBot);
|
|
||||||
AddName(bot, rawParsedBot.Info.Nickname);
|
|
||||||
AddVoice(bot, rawParsedBot);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stopwatch.Stop();
|
stopwatch.Stop();
|
||||||
LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
|
LoggingHelpers.LogToConsole($"Finished processing bot base. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
|
||||||
|
|
||||||
|
|
||||||
return rawBots;
|
return rawBots;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddVoice(Bot bot, Datum rawParsedBot)
|
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);
|
bot.appearance.voice.AddUnique(rawParsedBot.Info.Voice);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddDifficulties(Bot bot, List<Datum> rawParsedBots)
|
private void AddDifficulties(Bot bot, List<Datum> rawParsedBots)
|
||||||
{
|
{
|
||||||
@ -89,10 +79,10 @@ namespace Generator
|
|||||||
|
|
||||||
private void UpdateBodyPartHealth(Bot botToUpdate, List<Datum> rawParsedBots)
|
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)
|
if (firstBotOfDesiredType == null)
|
||||||
{
|
{
|
||||||
LoggingHelpers.LogToConsole($"bottype of: {botToUpdate.botType} not found, unable to update body part health.");
|
LoggingHelpers.LogToConsole($"bot type of: {botToUpdate.botType} not found, unable to update body part health.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,9 +116,9 @@ namespace Generator
|
|||||||
botToUpdate.appearance.feet.AddUnique(rawBot.Customization.Feet);
|
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]);
|
botToUpdate.firstName.AddUnique(name[0]);
|
||||||
if (name.Length > 1)
|
if (name.Length > 1)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user