Exemplo n.º 1
0
        private void RunRepair(RepairOptions opt)
        {
            var groups          = new HashSet <InvGrps>(opt.Groups);
            var processedGroups = new List <InvGrps>(groups.Count);

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.exosuit))
            {
                _gs.InventoryExosuitGeneral.Repair();
                _gs.InventoryExosuitTechOnly.Repair();
                processedGroups.Add(InvGrps.exosuit);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.freighter))
            {
                _gs.InventoryFreighterTechOnly.Repair();
                processedGroups.Add(InvGrps.freighter);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.multitool))
            {
                _gs.InventoryMultitool.Repair();
                processedGroups.Add(InvGrps.multitool);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.ship))
            {
                _gs.InventoryPrimaryShipGeneral.Repair();
                _gs.InventoryPrimaryShipTechOnly.Repair();
                processedGroups.Add(InvGrps.ship);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.vehicle))
            {
                _gs.InventoryPrimaryVehicle.Repair();
                processedGroups.Add(InvGrps.vehicle);
            }

            Log("Repaired items in the following inventory groups: {0}.", string.Join(", ", processedGroups));
        }
Exemplo n.º 2
0
        private bool RunRepair(RepairOptions opt)
        {
            var inventories        = OptInvGrpsToInventories(opt.Groups);
            var updatedInventories = new List <Inventory>(inventories.Count);

            foreach (var inventory in inventories)
            {
                if (inventory.Repair())
                {
                    updatedInventories.Add(inventory);
                }
            }

            if (updatedInventories.Count != 0)
            {
                Log("Repaired items in the following inventory groups:\n  {0}.", string.Join("\n  ", updatedInventories));
                return(true);
            }

            Log("Nothing to repair in selected inventories");
            return(false);
        }