2021-08-24 12:08:30 +01:00
|
|
|
|
using Common;
|
2021-09-18 22:36:59 +01:00
|
|
|
|
using Common.Models.Input;
|
|
|
|
|
using Common.Models.Output;
|
2021-08-13 16:24:05 +01:00
|
|
|
|
using Generator.Helpers.Gear;
|
2021-08-12 16:52:06 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Generator
|
|
|
|
|
{
|
2021-09-01 19:19:44 +03:00
|
|
|
|
public static class BotGearGenerator
|
2021-08-12 16:52:06 +01:00
|
|
|
|
{
|
2021-09-05 12:27:17 +01:00
|
|
|
|
public static IEnumerable<Bot> AddGear(this IEnumerable<Bot> baseBots, IEnumerable<Datum> rawBots)
|
2021-08-12 16:52:06 +01:00
|
|
|
|
{
|
|
|
|
|
var stopwatch = Stopwatch.StartNew();
|
|
|
|
|
LoggingHelpers.LogToConsole("Started processing bot gear");
|
|
|
|
|
|
2021-09-01 19:19:44 +03:00
|
|
|
|
foreach (var botToUpdate in baseBots)
|
2021-08-12 16:52:06 +01:00
|
|
|
|
{
|
2023-08-15 09:29:16 +00:00
|
|
|
|
var botType = botToUpdate.botType.ToString();
|
|
|
|
|
var rawParsedBotOfCurrentType = rawBots.Where(x => x.Info.Settings.Role.Equals(botType, StringComparison.OrdinalIgnoreCase))
|
2021-09-05 12:27:17 +01:00
|
|
|
|
.ToList();
|
2021-08-17 18:33:55 +01:00
|
|
|
|
|
|
|
|
|
if (rawParsedBotOfCurrentType.Count == 0)
|
|
|
|
|
{
|
2021-08-18 21:42:49 +01:00
|
|
|
|
continue;
|
2021-08-17 18:33:55 +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-17 18:33:55 +01:00
|
|
|
|
GearHelpers.AddEquippedGear(botToUpdate, rawParsedBot);
|
2023-08-15 09:29:16 +00:00
|
|
|
|
GearHelpers.AddAmmo(botToUpdate, rawParsedBot);
|
2021-08-17 18:33:55 +01:00
|
|
|
|
GearHelpers.AddEquippedMods(botToUpdate, rawParsedBot);
|
2023-08-15 09:29:16 +00:00
|
|
|
|
//GearHelpers.AddCartridges(botToUpdate, 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
|
|
|
|
|
2021-09-01 19:19:44 +03:00
|
|
|
|
return baseBots;
|
2021-08-12 16:52:06 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|