Update to support armor mods

This commit is contained in:
Dev 2024-01-01 20:29:58 +00:00
parent f0cc991e75
commit 5d9cfa776c
6 changed files with 42 additions and 15 deletions

View File

@ -38,9 +38,10 @@
bossboarsniper = 36,
followerboarclose1 = 37,
followerboarclose2 = 38,
bosskolontay = 39,
followerkolontayassault = 40,
followerkolontaysecurity = 41
bosskolontay = 43,
followerkolontayassault = 44,
followerkolontaysecurity = 45,
shooterbtr = 46,
}
}

View File

@ -121,7 +121,8 @@ namespace Generator
foreach (var item in bot.Inventory.items)
{
if (item.parentId == null)
// Filter out root items and equipment mod items
if (item.parentId == null || item.location == null)
{
continue;
}

View File

@ -252,6 +252,9 @@
<None Update="Assets\normal_sectactPriestEvent_BotGlobalSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\normal_shooterBTR_BotGlobalSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\__BotGlobalSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>

View File

@ -14,7 +14,7 @@ namespace Generator.Helpers.Gear
{
// TODO: Further split these counts by equipment slot? (ex. "FirstPrimaryWeapon", "Holster", etc.)
var validSlots = new List<string> { "FirstPrimaryWeapon", "SecondPrimaryWeapon", "Holster", "Headwear" };
var validSlots = new List<string> { "FirstPrimaryWeapon", "SecondPrimaryWeapon", "Holster", "Headwear", "ArmorVest" };
var modCounts = new Dictionary<string, int>();
var slotCounts = new Dictionary<string, int>();
@ -41,15 +41,15 @@ namespace Generator.Helpers.Gear
var template = ItemTemplateHelper.GetTemplateById(inventoryItem._tpl);
var parentTemplate = ItemTemplateHelper.GetTemplateById(baseBot.Inventory.items.Single(i => i._id == inventoryItem.parentId)._tpl);
if ((inventoryItem.slotId?.StartsWith("mod_") ?? false) && !(parentTemplate?._props?.Slots?.FirstOrDefault(s => s._name == inventoryItem.slotId)?._required ?? false))
if (!(parentTemplate?._props?.Slots?.FirstOrDefault(slot => slot._name == inventoryItem.slotId)?._required ?? false))
{
if (modCounts.ContainsKey(inventoryItem.slotId))
if (modCounts.ContainsKey(inventoryItem.slotId.ToLower()))
{
modCounts[inventoryItem.slotId]++;
modCounts[inventoryItem.slotId.ToLower()]++;
}
else
{
modCounts.Add(inventoryItem.slotId, 1);
modCounts.Add(inventoryItem.slotId.ToLower(), 1);
}
}
@ -59,20 +59,30 @@ namespace Generator.Helpers.Gear
continue;
}
foreach (var slot in template._props.Slots.Where(s => s._name.StartsWith("mod_")))
foreach (var slot in template._props.Slots)
{
if (slot._name == "Back_plate")
{
var x = 1;
}
if (slot._required)
{
continue;
}
if (slotCounts.ContainsKey(slot._name))
if (slot._name.StartsWith("camora"))
{
slotCounts[slot._name]++;
continue;
}
if (slotCounts.ContainsKey(slot._name.ToLower()))
{
slotCounts[slot._name.ToLower()]++;
}
else
{
slotCounts.Add(slot._name, 1);
slotCounts.Add(slot._name.ToLower(), 1);
}
}
}

View File

@ -13,7 +13,17 @@ namespace Generator.Helpers.Gear
var itemsWithModsInRawBot = new List<Item>();
modItemsInRawBot = rawParsedBot.Inventory.items
.Where(x => x.slotId != null && (x.slotId.StartsWith("mod_") || x.slotId.StartsWith("patron_in_weapon"))).ToList();
.Where(x => x.slotId != null
&& (x.slotId.StartsWith("mod_")
|| x.slotId.ToLower().StartsWith("patron_in_weapon")
|| x.slotId.ToLower().StartsWith("helmet_")
|| x.slotId.ToLower().StartsWith("front_")
|| x.slotId.ToLower().StartsWith("back_")
|| x.slotId.ToLower().StartsWith("collar")
|| x.slotId.ToLower().StartsWith("groin")
|| x.slotId.ToLower().StartsWith("left")
|| x.slotId.ToLower().StartsWith("right")
|| x.slotId.ToLower().StartsWith("soft_"))).ToList();
// Get items with Mods by iterating over mod items and getting the parent item
itemsWithModsInRawBot.AddRange(modItemsInRawBot

View File

@ -48,7 +48,9 @@ internal static class Program
"sectantwarrior",
"gifter",
"arenafighterevent",
"crazyassaultevent"
"crazyassaultevent",
"shooterbtr"
};
// Read raw bot dumps and turn into c# objects