BotGenerator/Generator/BotGearGenerator.cs

49 lines
1.6 KiB
C#
Raw Normal View History

2021-08-12 16:52:06 +01:00
using Generator.Helpers;
using Generator.Helpers.Gear;
2021-08-12 16:52:06 +01:00
using Generator.Models.Input;
using Generator.Models.Output;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Generator
{
public class BotGearGenerator
{
private readonly List<Bot> _baseBots;
private readonly List<Datum> _rawParsedBots;
public BotGearGenerator(List<Bot> baseBots, List<Datum> parsedBots)
{
_baseBots = baseBots;
_rawParsedBots = parsedBots;
}
internal List<Bot> AddGear()
{
var stopwatch = Stopwatch.StartNew();
LoggingHelpers.LogToConsole("Started processing bot gear");
foreach (var bot in _baseBots)
{
GearChanceHelpers.AddEquipmentChances(bot);
GearChanceHelpers.AddGenerationChances(bot);
GearChanceHelpers.AddModChances(bot);
foreach (var rawParsedBot in _rawParsedBots.Where(x => x.Info.Settings.Role.Equals(bot.botType.ToString(), StringComparison.OrdinalIgnoreCase)))
2021-08-12 16:52:06 +01:00
{
GearHelpers.AddEquippedGear(bot, rawParsedBot);
GearHelpers.AddEquippedMods(bot, rawParsedBot);
GearHelpers.AddCartridges(bot, rawParsedBot);
2021-08-12 16:52:06 +01:00
}
}
stopwatch.Stop();
2021-08-12 21:31:15 +01:00
LoggingHelpers.LogToConsole($"Finished processing bot gear. Took {LoggingHelpers.LogTimeTaken(stopwatch.Elapsed.TotalSeconds)} seconds");
2021-08-12 16:52:06 +01:00
return _baseBots;
}
}
}