From 64ceb6684b14951615a9a756169e180553aecd84 Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 4 Jul 2022 21:53:51 +0100 Subject: [PATCH] Fix issue with sub items being added to their parents parent instead of their parent e.g. camora being added to the gun instead of the magazine --- Generator/Helpers/Gear/GearHelpers.cs | 38 +++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Generator/Helpers/Gear/GearHelpers.cs b/Generator/Helpers/Gear/GearHelpers.cs index c5b35c3..4328481 100644 --- a/Generator/Helpers/Gear/GearHelpers.cs +++ b/Generator/Helpers/Gear/GearHelpers.cs @@ -15,27 +15,27 @@ namespace Generator.Helpers.Gear var itemsWithModsInRawBot = new List(); - foreach (var inv in rawParsedBot.Inventory.items.Where(x => x.slotId == "mod_magazine")) - { - var count = rawParsedBot.Inventory.items.Where(x => x.slotId == "mod_magazine").Count(); - if (inv._tpl == "60dc519adf4c47305f6d410d") - { - var y = 1; - } - } + //foreach (var inv in rawParsedBot.Inventory.items.Where(x => x.slotId == "mod_magazine")) + //{ + //var count = rawParsedBot.Inventory.items.Where(x => x.slotId == "mod_magazine").Count(); + // if (inv._tpl == "60dc519adf4c47305f6d410d") + // { + // var y = 1; + // } + //} modItemsInRawBot = rawParsedBot.Inventory.items .Where(x => x.slotId != null && (x.slotId.StartsWith("mod_") || x.slotId.StartsWith("patron_in_weapon"))).ToList(); - var x = new List(); - foreach (var item in rawParsedBot.Inventory.items.Where(x=>x.slotId == "mod_magazine")) - { - if (item._tpl == "60dc519adf4c47305f6d410d") - { - var wow = 1; - } - x.Add(item); - } + //var x = new List(); + //foreach (var item in rawParsedBot.Inventory.items.Where(x=>x.slotId == "mod_magazine")) + //{ + // if (item._tpl == "60dc519adf4c47305f6d410d") + // { + // var wow = 1; + // } + // x.Add(item); + //} // get items with Mods by iterating over mod items and getting the parent item itemsWithModsInRawBot.AddRange(modItemsInRawBot @@ -50,13 +50,13 @@ namespace Generator.Helpers.Gear AddItemToDictionary(itemToAdd, modsToAdd, itemsWithModsDictionary); // check if these mods have sub-mods and add those - foreach (var modAdded in modsToAdd.Where(x=>x.slotId == "mod_magazine")) + foreach (var modAdded in modsToAdd.Where(x => x.slotId == "mod_magazine")) { // look for items where parentId is this mods id var subItems = rawParsedBot.Inventory.items.Where(x => x.parentId == modAdded._id && x.slotId != "cartridges").ToList(); if (subItems.Count > 0) { - AddItemToDictionary(itemToAdd, subItems, itemsWithModsDictionary); + AddItemToDictionary(modAdded, subItems, itemsWithModsDictionary); } } }