Exemplo n.º 1
0
        public static async Task <int> CannonRange()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                return(ship.CannonCount * 10);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }
Exemplo n.º 2
0
        private static async Task <int> EquipementSpace()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                return((ship.CannonCount + ship.DriveCount + ship.SensorCount + ship.ShieldCount) * 20);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }
Exemplo n.º 3
0
        public static async Task <int> AvailableCargoSpace()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                return(ship.TotalCapacity - await EquipementSpace());
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }
Exemplo n.º 4
0
        public static async Task <Tuple <string, Star> > GetPriceDiff(Star current, Star[] targets)
        {
            try
            {
                List <Tuple <TradeWrapper, Star> > maxList = new List <Tuple <TradeWrapper, Star> >();

                foreach (var star in targets)
                {
                    if (await GetMaxDiff(current, star) != null)
                    {
                        maxList.Add(await GetMaxDiff(current, star));
                    }
                }

                if (maxList.Count > 0)
                {
                    var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                    var maxList2 = maxList.OrderByDescending(x => x.Item1.Profit).ToList().FirstOrDefault();
                    if (maxList2.Item1.TotalProfit > 10000)
                    {
                        return(new Tuple <string, Star>(maxList2.Item1.ProductName, maxList2.Item2));
                    }
                    else if (ship.Money < 100000)
                    {
                        return(new Tuple <string, Star>(maxList2.Item1.ProductName, maxList2.Item2));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);
                throw e;
            }
        }
Exemplo n.º 5
0
        public static async Task <int> UsedCargoSpace()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                int usedCargo = 0;

                foreach (var item in ship.Cargo)
                {
                    usedCargo += item.Stock;
                }

                return(usedCargo);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }