filter bots being processed to just the current type

This commit is contained in:
Chomp 2021-08-13 16:24:45 +01:00
parent 7e742d6bc3
commit 16a59b968c

View File

@ -1,6 +1,7 @@
using Generator.Helpers; using Generator.Helpers;
using Generator.Models.Input; using Generator.Models.Input;
using Generator.Models.Output; using Generator.Models.Output;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -24,16 +25,19 @@ namespace Generator
LoggingHelpers.LogToConsole("Started processing bot loot"); LoggingHelpers.LogToConsole("Started processing bot loot");
// Iterate over assault/raider etc // Iterate over assault/raider etc
foreach (var bot in _botsWithGear) foreach (var botToUpdate in _botsWithGear)
{ {
foreach (var rawParsedBot in _rawParsedBots) var rawBotsOfSameType = _rawParsedBots
.Where(x => x.Info.Settings.Role.Equals(botToUpdate.botType.ToString(), StringComparison.OrdinalIgnoreCase))
.ToList();
foreach (var rawParsedBot in rawBotsOfSameType)
{ {
AddPocketLoot(bot, rawParsedBot); AddPocketLoot(botToUpdate, rawParsedBot);
} }
AddTacticalVestLoot(bot, _rawParsedBots); AddTacticalVestLoot(botToUpdate, rawBotsOfSameType);
AddBackbackLoot(bot, _rawParsedBots); AddBackbackLoot(botToUpdate, rawBotsOfSameType);
AddSecureContainerLoot(bot, _rawParsedBots); AddSecureContainerLoot(botToUpdate, rawBotsOfSameType);
} }
stopwatch.Stop(); stopwatch.Stop();
@ -54,8 +58,6 @@ namespace Generator
finalAssaultBot.inventory.items.Backpack.AddRange(backpackItems); finalAssaultBot.inventory.items.Backpack.AddRange(backpackItems);
} }
private void AddSecureContainerLoot(Bot finalAssaultBot, List<Datum> bots) private void AddSecureContainerLoot(Bot finalAssaultBot, List<Datum> bots)
{ {
var tacVestItems = GetItemsStoredInEquipmentItem(bots, "SecuredContainer"); var tacVestItems = GetItemsStoredInEquipmentItem(bots, "SecuredContainer");