Esempio n. 1
0
        private void RunRecharge(RechargeOptions 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.Recharge();
                _gs.InventoryExosuitTechOnly.Recharge();
                processedGroups.Add(InvGrps.exosuit);
            }

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

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

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

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

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

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

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

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