예제 #1
0
파일: Program.cs 프로젝트: sulk/nmssavetool
        private bool RunRefurbish(RefurbishOptions opt)
        {
            var inventories        = OptInvGrpsToInventories(opt.Groups);
            var updatedInventories = new List <Inventory>(inventories.Count);

            foreach (var inventory in inventories)
            {
                bool changedSomething = false;

                changedSomething |= inventory.Repair();
                changedSomething |= inventory.Recharge();
                changedSomething |= inventory.Refill();

                if (changedSomething)
                {
                    updatedInventories.Add(inventory);
                }
            }

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

            Log("Nothing to refurbish in selected inventories");
            return(false);
        }
예제 #2
0
        private void RunRefurbish(RefurbishOptions 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.Recharge();
                _gs.InventoryExosuitGeneral.Repair();
                _gs.InventoryExosuitGeneral.Refill();

                _gs.InventoryExosuitTechOnly.Recharge();
                _gs.InventoryExosuitTechOnly.Repair();

                processedGroups.Add(InvGrps.exosuit);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.freighter))
            {
                _gs.InventoryFreighterGeneral.Refill();

                _gs.InventoryFreighterTechOnly.Recharge();
                _gs.InventoryFreighterTechOnly.Repair();

                processedGroups.Add(InvGrps.freighter);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.multitool))
            {
                _gs.InventoryMultitool.Recharge();
                _gs.InventoryMultitool.Repair();

                processedGroups.Add(InvGrps.multitool);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.ship))
            {
                _gs.InventoryPrimaryShipGeneral.Recharge();
                _gs.InventoryPrimaryShipGeneral.Refill();
                _gs.InventoryPrimaryShipGeneral.Repair();

                _gs.InventoryPrimaryShipTechOnly.Recharge();
                _gs.InventoryPrimaryShipTechOnly.Repair();

                processedGroups.Add(InvGrps.ship);
            }

            if (groups.Contains(InvGrps.all) || groups.Contains(InvGrps.vehicle))
            {
                _gs.InventoryPrimaryVehicle.Recharge();
                _gs.InventoryPrimaryVehicle.Refill();
                _gs.InventoryPrimaryVehicle.Repair();

                processedGroups.Add(InvGrps.vehicle);
            }

            Log("Refurbished items in the following inventory groups: {0}.", string.Join(", ", processedGroups));
        }