2021-08-12 16:52:06 +01:00
|
|
|
|
using Generator.Helpers;
|
2021-08-13 16:24:05 +01:00
|
|
|
|
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)
|
|
|
|
|
{
|
2021-08-13 19:49:32 +01:00
|
|
|
|
var rawParsedBotOfCurrentType = _rawParsedBots
|
|
|
|
|
.Where(x => x.Info.Settings.Role.Equals(bot.botType.ToString(), StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
.ToList();
|
|
|
|
|
GearChanceHelpers.CalculateEquipmentChances(bot, rawParsedBotOfCurrentType);
|
2021-08-13 16:24:05 +01:00
|
|
|
|
GearChanceHelpers.AddGenerationChances(bot);
|
2021-08-13 19:49:32 +01:00
|
|
|
|
GearChanceHelpers.CalculateModChances(bot, rawParsedBotOfCurrentType);
|
2021-08-13 16:24:05 +01:00
|
|
|
|
|
2021-08-13 19:49:32 +01:00
|
|
|
|
foreach (var rawParsedBot in rawParsedBotOfCurrentType)
|
2021-08-12 16:52:06 +01:00
|
|
|
|
{
|
2021-08-13 16:24:05 +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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|