From 306703549434368e3d2d7e44ab0631b3caf4987c Mon Sep 17 00:00:00 2001 From: Chomp Date: Wed, 25 Aug 2021 20:11:32 +0100 Subject: [PATCH] Loop over all weapons, not just primary --- PMCGenerator/Program.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PMCGenerator/Program.cs b/PMCGenerator/Program.cs index de7ff65..b1c04d2 100644 --- a/PMCGenerator/Program.cs +++ b/PMCGenerator/Program.cs @@ -20,6 +20,9 @@ namespace PMCGenerator // Create flat lists of weapons + list of mods var flatPrimaryWeaponsList = GetWeaponsFromRawFile(parsedPresets); var flatSecondaryWeaponsList = GetSecondaryWeaponsFromRawFile(parsedPresets); + + var flatAllWeaponsList = CombinePrimaryAndSecondaryWeapons(flatPrimaryWeaponsList, flatSecondaryWeaponsList); + var flatModList = GetModsFromRawFile(parsedPresets); // Add weapon mods to output @@ -27,10 +30,12 @@ namespace PMCGenerator FirstPrimaryWeapon = new List(), Holster = new List(), mods = new Dictionary>>() }; + output.FirstPrimaryWeapon.AddRange(flatPrimaryWeaponsList.Select(x => x.TemplateId).Distinct()); output.Holster.AddRange(flatSecondaryWeaponsList.Select(x => x.TemplateId).Distinct()); - foreach (var weapon in flatPrimaryWeaponsList) + // Loop over each gun + foreach (var weapon in flatAllWeaponsList) { // add weapon if its not already here if (!output.mods.ContainsKey(weapon.TemplateId)) @@ -109,6 +114,14 @@ namespace PMCGenerator CreateJsonFile(outputPath, outputJson); } + private static List CombinePrimaryAndSecondaryWeapons(List flatPrimaryWeaponsList, List flatSecondaryWeaponsList) + { + var result = new List(); + result.AddRange(flatPrimaryWeaponsList); + result.AddRange(flatSecondaryWeaponsList); + + return result; + } /// /// Get a strongly typed dictionary of BSGs items library ///