BotGenerator/Generator/Program.cs

103 lines
3.0 KiB
C#
Raw Normal View History

2023-09-18 17:15:30 +01:00
using Common.Models.Input;
using Generator.Helpers;
2023-08-21 16:32:20 +01:00
namespace Generator;
2021-08-12 16:52:06 +01:00
internal static class Program
2021-08-12 16:52:06 +01:00
{
internal static async Task Main(string[] args)
2021-08-12 16:52:06 +01:00
{
// Create list of bots we want to process
string[] botTypes = {
"assault",
2024-05-15 11:39:36 +01:00
"assaultgroup",
"marksman",
"pmcbot",
"exusec",
2023-12-28 09:12:54 +00:00
"bossbully",
"bossgluhar",
"bosskilla",
"bosskojaniy",
"bosssanitar",
"bosstagilla",
"bossknight",
"bosszryachiy",
"bossboar",
"bossboarsniper",
"bosskolontay",
"followerbully",
"followergluharassault",
"followergluharscout",
"followergluharsecurity",
"followergluharsnipe",
"followerkojaniy",
"followersanitar",
"followerstormtrooper",
"followerbirdeye",
"followerbigpipe",
"followerzryachiy",
"followerboar",
2023-12-28 09:12:54 +00:00
"followerboarclose1",
"followerboarclose2",
"followerkolontayassault",
"followerkolontaysecurity",
"ravangezryachiyevent",
"peacefullzryachiyevent",
"cursedassault",
"sectantpriest",
"sectantwarrior",
"gifter",
"arenafighterevent",
"crazyassaultevent",
2024-01-01 20:29:58 +00:00
2024-04-04 11:06:52 +01:00
"shooterbtr",
"spiritspring",
2024-05-15 11:39:36 +01:00
"spiritwinter",
"skier",
"peacemaker"
};
2021-08-12 16:52:06 +01:00
// Read raw bot dumps and turn into c# objects
var workingPath = Directory.GetCurrentDirectory();
var dumpPath = $"{workingPath}//dumps";
2023-09-18 16:30:24 +01:00
var parsedBots = BotParser.ParseAsync(dumpPath, botTypes.ToHashSet());
2021-08-12 16:52:06 +01:00
// Put in dictionary for better use later on
var rawBotsCache = new Dictionary<string, List<Datum>>(45);
2023-09-18 17:15:30 +01:00
foreach (var rawBot in parsedBots)
{
if (rawBotsCache.TryGetValue(rawBot.Info.Settings.Role.ToLower(), out var botList))
{
2023-09-18 17:15:30 +01:00
botList.Add(rawBot);
continue;
}
// Doesnt exist, add key and bot
rawBotsCache.Add(rawBot.Info.Settings.Role.ToLower(), new List<Datum> { rawBot });
2023-09-18 17:15:30 +01:00
}
if (parsedBots.Count == 0)
{
LoggingHelpers.LogToConsole("No bots found, unable to continue");
LoggingHelpers.LogToConsole("Check your dumps are in 'Generator\\bin\\Debug\\net6.0\\dumps' and start with 'resp.' NOT 'req.'");
return;
}
2021-08-12 22:26:25 +01:00
// Generate the base bot class with basic details (health/body part hp etc) and then append everything else
var bots = BaseBotGenerator.GenerateBaseDetails(parsedBots, workingPath, botTypes)
.AddGear(rawBotsCache) // Add weapons/armor
.AddLoot(rawBotsCache)
.AddChances(rawBotsCache); // Add mod/equipment chances
// Output bot to json file
var jsonWriter = new JsonWriter(workingPath, "output");
jsonWriter.WriteJson(bots.ToList());
2021-08-12 16:52:06 +01:00
}
}