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, bossboarsniper = 36,
followerboarclose1 = 37, followerboarclose1 = 37,
followerboarclose2 = 38, followerboarclose2 = 38,
bosskolontay = 39, bosskolontay = 43,
followerkolontayassault = 40, followerkolontayassault = 44,
followerkolontaysecurity = 41 followerkolontaysecurity = 45,
shooterbtr = 46,
} }
} }

View File

@ -121,7 +121,8 @@ namespace Generator
foreach (var item in bot.Inventory.items) 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; continue;
} }

View File

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

View File

@ -14,7 +14,7 @@ namespace Generator.Helpers.Gear
{ {
// TODO: Further split these counts by equipment slot? (ex. "FirstPrimaryWeapon", "Holster", etc.) // 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 modCounts = new Dictionary<string, int>();
var slotCounts = 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 template = ItemTemplateHelper.GetTemplateById(inventoryItem._tpl);
var parentTemplate = ItemTemplateHelper.GetTemplateById(baseBot.Inventory.items.Single(i => i._id == inventoryItem.parentId)._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 else
{ {
modCounts.Add(inventoryItem.slotId, 1); modCounts.Add(inventoryItem.slotId.ToLower(), 1);
} }
} }
@ -59,20 +59,30 @@ namespace Generator.Helpers.Gear
continue; 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) if (slot._required)
{ {
continue; 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 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>(); var itemsWithModsInRawBot = new List<Item>();
modItemsInRawBot = rawParsedBot.Inventory.items 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 // Get items with Mods by iterating over mod items and getting the parent item
itemsWithModsInRawBot.AddRange(modItemsInRawBot itemsWithModsInRawBot.AddRange(modItemsInRawBot

View File

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