From c63d0b370192c5c5201665f65af4c7ba575cf7bf Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 18 Dec 2021 14:07:32 +0000 Subject: [PATCH] handle revolver gen correctly, dont include patron_in_weapon for them move to generic .net6 --- PMCGenerator/PMCGenerator.csproj | 2 +- PMCGenerator/Program.cs | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/PMCGenerator/PMCGenerator.csproj b/PMCGenerator/PMCGenerator.csproj index 34c9594..34bca22 100644 --- a/PMCGenerator/PMCGenerator.csproj +++ b/PMCGenerator/PMCGenerator.csproj @@ -2,7 +2,7 @@ Exe - net6.0-windows + net6.0 diff --git a/PMCGenerator/Program.cs b/PMCGenerator/Program.cs index 56d9165..f491527 100644 --- a/PMCGenerator/Program.cs +++ b/PMCGenerator/Program.cs @@ -48,8 +48,13 @@ namespace PMCGenerator // Get top level mods types for this gun var uniqueModSlots = flatModList.Where(x => x.ParentId == weapon.Id).Select(x => x.SlotId).Distinct().ToList(); + var chamberedBulletModItemName = "patron_in_weapon"; - uniqueModSlots.AddUnique(chamberedBulletModItemName); + if (weapon.TemplateId != "60db29ce99594040e04c4a27") // shotgun revolver + { + uniqueModSlots.AddUnique(chamberedBulletModItemName); + } + foreach (var modSlotId in uniqueModSlots) { Dictionary> weaponModsToModify = output.mods[weapon.TemplateId]; @@ -61,9 +66,12 @@ namespace PMCGenerator } // Add compatible bullets to weapons gun chamber - var modItemToAddBulletsTo = output.mods[weapon.TemplateId].FirstOrDefault(x => x.Key == chamberedBulletModItemName); var compatibleBullets = GetCompatibileBullets(itemLibrary, weapon); - modItemToAddBulletsTo.Value.AddUniqueRange(compatibleBullets); + var modItemToAddBulletsTo = output.mods[weapon.TemplateId].FirstOrDefault(x => x.Key == chamberedBulletModItemName); + if (modItemToAddBulletsTo.Key != null) // some guns dont have a mod you add bullets to (e.g. revolvers) + { + modItemToAddBulletsTo.Value.AddUniqueRange(compatibleBullets); + } // Add compatabible mods to weapon var modsForWeapon = flatModList.Where(x => x.ParentId == weapon.Id).ToList(); @@ -71,7 +79,7 @@ namespace PMCGenerator foreach (var mod in modsForWeapon) { weaponMods[mod.SlotId].AddUnique(mod.TemplateId); - + if (mod.SlotId == "mod_magazine") { // add special mod item for magazine that gives info on what cartridges can be used @@ -152,7 +160,7 @@ namespace PMCGenerator var workingPath = Directory.GetCurrentDirectory(); - var itemsLibraryJson = File.ReadAllText(workingPath + "\\input" + "\\items.json"); + var itemsLibraryJson = File.ReadAllText(workingPath + "\\Assets" + "\\items.json"); return JsonConvert.DeserializeObject>(itemsLibraryJson); }