private void RunRefill(RefillOptions opt) { var groups = new HashSet <InvGrps>(opt.Groups); var processedGroups = new List <InvGrps>(groups.Count); if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.container)) { foreach (var inventory in _gs.InventoryContainers) { inventory.Refill(); } processedGroups.Add(InvGrps.container); } if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.exosuit)) { _gs.InventoryExosuitGeneral.Refill(); _gs.InventoryExosuitCargo.Refill(); processedGroups.Add(InvGrps.exosuit); } if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.freighter)) { _gs.InventoryFreighterGeneral.Refill(); processedGroups.Add(InvGrps.freighter); } if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.ship)) { _gs.InventoryPrimaryShipGeneral.Refill(); processedGroups.Add(InvGrps.ship); } if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.vehicle)) { _gs.InventoryPrimaryVehicle.Refill(); processedGroups.Add(InvGrps.vehicle); } Log("Refilled items in the following inventory groups: {0}.", string.Join(", ", processedGroups)); }
private bool RunRefill(RefillOptions opt) { var inventories = OptInvGrpsToInventories(opt.Groups); var updatedInventories = new List <Inventory>(inventories.Count); foreach (var inventory in inventories) { if (inventory.Refill()) { updatedInventories.Add(inventory); } } if (updatedInventories.Count != 0) { Log("Refilled items in the following inventory groups:\n {0}.", string.Join("\n ", updatedInventories)); return(true); } Log("Nothing to refill in selected inventories"); return(false); }