diff --git a/Bots.sln b/Bots.sln
index c18ceb4..500016a 100644
--- a/Bots.sln
+++ b/Bots.sln
@@ -5,9 +5,13 @@ VisualStudioVersion = 16.0.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generator", "Generator\Generator.csproj", "{79CD3722-D6A7-4BA1-8CDF-533A77566D93}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PMCGenerator", "PMCGenerator\PMCGenerator.csproj", "{AA738C3F-2BA0-4754-A7A7-82E290BF51CA}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PMCGenerator", "PMCGenerator\PMCGenerator.csproj", "{AA738C3F-2BA0-4754-A7A7-82E290BF51CA}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{DE50047B-01AB-4B99-A270-95C8F6101D0D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{DE50047B-01AB-4B99-A270-95C8F6101D0D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniqueTemplates", "UniqueTemplates\UniqueTemplates.csproj", "{0C7085A3-0692-4F6B-BF88-B228725A105A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Models", "Common.Models\Common.Models.csproj", "{23BCA0BE-C95E-4BFD-A89F-408729E6BDE0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -27,6 +31,14 @@ Global
{DE50047B-01AB-4B99-A270-95C8F6101D0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE50047B-01AB-4B99-A270-95C8F6101D0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE50047B-01AB-4B99-A270-95C8F6101D0D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0C7085A3-0692-4F6B-BF88-B228725A105A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0C7085A3-0692-4F6B-BF88-B228725A105A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0C7085A3-0692-4F6B-BF88-B228725A105A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0C7085A3-0692-4F6B-BF88-B228725A105A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {23BCA0BE-C95E-4BFD-A89F-408729E6BDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {23BCA0BE-C95E-4BFD-A89F-408729E6BDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {23BCA0BE-C95E-4BFD-A89F-408729E6BDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {23BCA0BE-C95E-4BFD-A89F-408729E6BDE0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Common/Models/BotType.cs b/Common.Models/BotType.cs
similarity index 100%
rename from Common/Models/BotType.cs
rename to Common.Models/BotType.cs
diff --git a/Common.Models/Common.Models.csproj b/Common.Models/Common.Models.csproj
new file mode 100644
index 0000000..2f38174
--- /dev/null
+++ b/Common.Models/Common.Models.csproj
@@ -0,0 +1,11 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
diff --git a/Generator/Models/Input/Settings.cs b/Common.Models/Input/Settings.cs
similarity index 99%
rename from Generator/Models/Input/Settings.cs
rename to Common.Models/Input/Settings.cs
index ce73b9a..f83a1fa 100644
--- a/Generator/Models/Input/Settings.cs
+++ b/Common.Models/Input/Settings.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
-namespace Generator.Models.Input
+namespace Common.Models.Input
{
public class Settings
{
diff --git a/Common/Models/Items.cs b/Common.Models/Items.cs
similarity index 100%
rename from Common/Models/Items.cs
rename to Common.Models/Items.cs
diff --git a/Generator/Models/Output/Difficulty/Difficulty.cs b/Common.Models/Output/Difficulty/Difficulty.cs
similarity index 96%
rename from Generator/Models/Output/Difficulty/Difficulty.cs
rename to Common.Models/Output/Difficulty/Difficulty.cs
index 029a09e..718c28e 100644
--- a/Generator/Models/Output/Difficulty/Difficulty.cs
+++ b/Common.Models/Output/Difficulty/Difficulty.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Generator.Models.Output.Difficulty
+namespace Common.Models.Output.Difficulty
{
public class Difficulty
{
diff --git a/Generator/Models/Output/Equipment.cs b/Common.Models/Output/Equipment.cs
similarity index 98%
rename from Generator/Models/Output/Equipment.cs
rename to Common.Models/Output/Equipment.cs
index 3bd28cd..d91a265 100644
--- a/Generator/Models/Output/Equipment.cs
+++ b/Common.Models/Output/Equipment.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Generator.Models.Output
+namespace Common.Models.Output
{
public class Equipment
{
diff --git a/Generator/Models/Output/Output.cs b/Common.Models/Output/Output.cs
similarity index 98%
rename from Generator/Models/Output/Output.cs
rename to Common.Models/Output/Output.cs
index 33e01f0..f6bad66 100644
--- a/Generator/Models/Output/Output.cs
+++ b/Common.Models/Output/Output.cs
@@ -1,8 +1,7 @@
-using Common.Models;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
using System.Collections.Generic;
-namespace Generator.Models.Output
+namespace Common.Models.Output
{
public class Bot
{
diff --git a/Generator/BotParser.cs b/Common/Bot/BotParser.cs
similarity index 97%
rename from Generator/BotParser.cs
rename to Common/Bot/BotParser.cs
index a625ed8..b38fdca 100644
--- a/Generator/BotParser.cs
+++ b/Common/Bot/BotParser.cs
@@ -1,5 +1,4 @@
-using Common;
-using Generator.Models.Input;
+using Common.Models.Input;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
@@ -9,9 +8,9 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
-namespace Generator
+namespace Common.Bots
{
- internal class BotParser
+ public class BotParser
{
private readonly string _dumpPath;
diff --git a/Common/Common.csproj b/Common/Common.csproj
index 6c72b37..df5691d 100644
--- a/Common/Common.csproj
+++ b/Common/Common.csproj
@@ -8,6 +8,10 @@
+
+
+
+
Always
diff --git a/Generator/JsonWriter.cs b/Common/JsonWriter.cs
similarity index 70%
rename from Generator/JsonWriter.cs
rename to Common/JsonWriter.cs
index b9466d9..ce29c1d 100644
--- a/Generator/JsonWriter.cs
+++ b/Common/JsonWriter.cs
@@ -1,11 +1,11 @@
-using Generator.Models.Output;
+using Common.Models.Output;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
-using Common;
+using Common.Models.Input;
-namespace Generator
+namespace Common
{
public class JsonWriter
{
@@ -36,5 +36,17 @@ namespace Generator
Console.WriteLine($"file {bot.botType} written to {outputPath}");
}
}
+
+ public void WriteJson(List bots, string fileName)
+ {
+ var outputPath = $"{_workingPath}\\{_outputFolderName}";
+ DiskHelpers.CreateDirIfDoesntExist(outputPath);
+
+ var output = JsonConvert.SerializeObject(bots, Formatting.Indented, new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore
+ });
+ File.WriteAllText($"{outputPath}\\{fileName.ToLower()}.json", output);
+ }
}
}
diff --git a/Generator/BaseBotGenerator.cs b/Generator/BaseBotGenerator.cs
index 420974a..2cb1d0e 100644
--- a/Generator/BaseBotGenerator.cs
+++ b/Generator/BaseBotGenerator.cs
@@ -1,9 +1,9 @@
using Common;
using Common.Extensions;
using Common.Models;
+using Common.Models.Input;
+using Common.Models.Output;
using Generator.Helpers;
-using Generator.Models.Input;
-using Generator.Models.Output;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/Generator/BotChancesGenerator.cs b/Generator/BotChancesGenerator.cs
index f71fa96..ed22a3d 100644
--- a/Generator/BotChancesGenerator.cs
+++ b/Generator/BotChancesGenerator.cs
@@ -1,7 +1,7 @@
using Common;
using Generator.Helpers.Gear;
-using Generator.Models.Input;
-using Generator.Models.Output;
+using Common.Models.Input;
+using Common.Models.Output;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/Generator/BotGearGenerator.cs b/Generator/BotGearGenerator.cs
index 9e0f738..5b72a23 100644
--- a/Generator/BotGearGenerator.cs
+++ b/Generator/BotGearGenerator.cs
@@ -1,7 +1,7 @@
using Common;
+using Common.Models.Input;
+using Common.Models.Output;
using Generator.Helpers.Gear;
-using Generator.Models.Input;
-using Generator.Models.Output;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/Generator/BotLootGenerator.cs b/Generator/BotLootGenerator.cs
index b86d3e6..f1b1efe 100644
--- a/Generator/BotLootGenerator.cs
+++ b/Generator/BotLootGenerator.cs
@@ -1,8 +1,8 @@
using Common;
using Common.Extensions;
+using Common.Models.Input;
+using Common.Models.Output;
using Generator.Helpers.Gear;
-using Generator.Models.Input;
-using Generator.Models.Output;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/Generator/Generator.csproj b/Generator/Generator.csproj
index 20725c6..a85ed24 100644
--- a/Generator/Generator.csproj
+++ b/Generator/Generator.csproj
@@ -152,7 +152,12 @@
+
+
+
+
+
diff --git a/Generator/Helpers/DifficultyHelper.cs b/Generator/Helpers/DifficultyHelper.cs
index 87802db..ab96881 100644
--- a/Generator/Helpers/DifficultyHelper.cs
+++ b/Generator/Helpers/DifficultyHelper.cs
@@ -1,5 +1,5 @@
-using Generator.Models.Output;
-using Generator.Models.Output.Difficulty;
+using Common.Models.Output;
+using Common.Models.Output.Difficulty;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.IO;
diff --git a/Generator/Helpers/Gear/GearChanceHelpers.cs b/Generator/Helpers/Gear/GearChanceHelpers.cs
index 968a109..450a455 100644
--- a/Generator/Helpers/Gear/GearChanceHelpers.cs
+++ b/Generator/Helpers/Gear/GearChanceHelpers.cs
@@ -1,6 +1,6 @@
using System;
-using Generator.Models.Input;
-using Generator.Models.Output;
+using Common.Models.Input;
+using Common.Models.Output;
using System.Collections.Generic;
using System.Linq;
using Common.Models;
@@ -94,6 +94,9 @@ namespace Generator.Helpers.Gear
botToUpdate.chances.mods["mod_tactical"] = 100; // force ultima thermal camera
botToUpdate.chances.mods["mod_stock"] = 100;
break;
+ case BotType.pmcBot:
+ botToUpdate.chances.mods["mod_stock"] = 100;
+ break;
}
}
diff --git a/Generator/Helpers/Gear/GearHelpers.cs b/Generator/Helpers/Gear/GearHelpers.cs
index ff4a1e9..f76cc6f 100644
--- a/Generator/Helpers/Gear/GearHelpers.cs
+++ b/Generator/Helpers/Gear/GearHelpers.cs
@@ -1,7 +1,6 @@
using Common.Extensions;
-using Generator.Models.Input;
-using Generator.Models.Output;
-using Newtonsoft.Json;
+using Common.Models.Input;
+using Common.Models.Output;
using System.Collections.Generic;
using System.Linq;
diff --git a/Generator/Helpers/Gear/SpecialLootHelper.cs b/Generator/Helpers/Gear/SpecialLootHelper.cs
index 45874c9..b76a720 100644
--- a/Generator/Helpers/Gear/SpecialLootHelper.cs
+++ b/Generator/Helpers/Gear/SpecialLootHelper.cs
@@ -1,5 +1,4 @@
using Common.Models;
-using Generator.Models;
using System.Collections.Generic;
namespace Generator.Helpers.Gear
diff --git a/Generator/Program.cs b/Generator/Program.cs
index 62c36d2..6f127aa 100644
--- a/Generator/Program.cs
+++ b/Generator/Program.cs
@@ -1,4 +1,6 @@
using Common;
+using Common.Bots;
+using Common.Models.Output;
using System.IO;
using System.Linq;
diff --git a/PMCGenerator/PMCGenerator.csproj b/PMCGenerator/PMCGenerator.csproj
index ffb397f..f53f401 100644
--- a/PMCGenerator/PMCGenerator.csproj
+++ b/PMCGenerator/PMCGenerator.csproj
@@ -10,6 +10,7 @@
+
diff --git a/UniqueTemplates/Extensions/Bot.cs b/UniqueTemplates/Extensions/Bot.cs
new file mode 100644
index 0000000..43301e1
--- /dev/null
+++ b/UniqueTemplates/Extensions/Bot.cs
@@ -0,0 +1,78 @@
+using Common.Models.Input;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace UniqueTemplates.Extensions
+{
+ public static class BotExtensions
+ {
+ public static bool ContainsBot(this List list, Datum botToCheck)
+ {
+ foreach (var bot in list)
+ {
+ var botGear = GetEquippedGear(bot);
+ if (botGear.CheckMatch(botToCheck.GetEquippedGear()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static EquippedGear GetEquippedGear(this Datum bot)
+ {
+ return new EquippedGear
+ {
+ ArmorVest = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "ArmorVest"),
+ Backpack = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "Backpack"),
+ Eyewear = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "Eyewear"),
+ FaceCover = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "FaceCover"),
+ FirstPrimaryWeapon = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "FirstPrimaryWeapon"),
+ Headwear = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "Headwear"),
+ Scabbard = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "Scabbard"),
+ TacticalVest = GeEquipmentItemTemplateIdOrNull(bot.Inventory.items, "TacticalVest"),
+ };
+ }
+
+ private static string GeEquipmentItemTemplateIdOrNull(List- inventoryItems, string itemTypeWanted)
+ {
+ var item = inventoryItems.FirstOrDefault(x => x.slotId == itemTypeWanted);
+ if (item == null)
+ {
+ return null;
+ }
+
+ return item._tpl;
+ }
+
+ public class EquippedGear
+ {
+ public string FirstPrimaryWeapon { get; set; }
+ public string TacticalVest { get; set; }
+ public string Headwear { get; set; }
+ public string Scabbard { get; set; }
+ public string Backpack { get; set; }
+ public string ArmorVest { get; set; }
+ public string FaceCover { get; set; }
+ public string Eyewear { get; set; }
+
+ public bool CheckMatch(EquippedGear gearToCheck)
+ {
+ if (gearToCheck.FirstPrimaryWeapon == FirstPrimaryWeapon
+ && gearToCheck.TacticalVest == TacticalVest
+ && gearToCheck.Headwear == Headwear
+ && gearToCheck.Scabbard == Scabbard
+ && gearToCheck.Backpack == Backpack
+ && gearToCheck.ArmorVest == ArmorVest
+ && gearToCheck.FaceCover == FaceCover
+ && gearToCheck.Eyewear == Eyewear)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+ }
+}
diff --git a/UniqueTemplates/Program.cs b/UniqueTemplates/Program.cs
new file mode 100644
index 0000000..d31ad64
--- /dev/null
+++ b/UniqueTemplates/Program.cs
@@ -0,0 +1,83 @@
+using Common;
+using Common.Bots;
+using Common.Models.Input;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using UniqueTemplates.Extensions;
+
+namespace UniqueTemplates
+{
+ public class Program
+ {
+ static void Main(string[] args)
+ {
+ // Get the unique bot types that bsg generate from live dumps
+
+ // Read raw bot dumps and turn into c# objects
+ var workingPath = Directory.GetCurrentDirectory();
+ var dumpPath = $"{workingPath}//dumps";
+ var botParser = new BotParser(dumpPath);
+ var parsedBots = botParser.Parse();
+
+ if (parsedBots.Count == 0)
+ {
+ LoggingHelpers.LogToConsole("no bots found, unable to continue");
+ LoggingHelpers.LogToConsole("Check your dumps are in 'Generator\\bin\\Debug\\netcoreapp3.1\\dumps' and start with 'resp.' NOT 'req.'");
+ return;
+ }
+
+ //var dupeCount = 0;
+ //var botTemplates = new List();
+ //foreach (var bot in parsedBots)
+ //{
+
+ // if (botTemplates.ContainsBot(bot))
+ // {
+ // dupeCount++;
+ // continue;
+ // }
+
+ // botTemplates.Add(bot);
+ //}
+
+ var dictDupeCount = 0;
+ var uniqueBotTemplates = new Dictionary();
+ foreach (var bot in parsedBots)
+ {
+ if (uniqueBotTemplates.ContainsKey(bot._id))
+ {
+ dictDupeCount++;
+ continue;
+ }
+
+ uniqueBotTemplates.Add(bot._id, bot);
+ }
+
+ //LoggingHelpers.LogToConsole($"LIST templates found: {botTemplates.Count}, {dupeCount} bots rejected as duplicate");
+ LoggingHelpers.LogToConsole($"DICTIONARY templates found: {uniqueBotTemplates.Count}, {dictDupeCount} bots rejected as duplicate");
+
+ var groupedBots = uniqueBotTemplates.GroupBy(x => x.Value.Info.Settings.Role).ToList();
+
+ foreach (var group in groupedBots)
+ {
+ var botList = new List();
+ foreach (var bot in group)
+ {
+ botList.Add(bot.Value);
+ }
+
+ LoggingHelpers.LogToConsole($"{botList.Count} unique {group.Key} bots found");
+
+ var jsonWriter = new JsonWriter(workingPath, "output");
+ jsonWriter.WriteJson(botList, group.Key);
+ }
+ }
+
+
+
+
+
+ }
+}
diff --git a/UniqueTemplates/UniqueTemplates.csproj b/UniqueTemplates/UniqueTemplates.csproj
new file mode 100644
index 0000000..b3c4456
--- /dev/null
+++ b/UniqueTemplates/UniqueTemplates.csproj
@@ -0,0 +1,13 @@
+
+
+
+ Exe
+ netcoreapp3.1
+
+
+
+
+
+
+
+