示例#1
0
        public void SortByProfitPerWarpFromStartingSystem(bool secure)
        {
            SolarSystem system = map.GetSystem(parameters.StartingSystem);

            if (system == null)
            {
                throw new CannotFindStartingSystem();
            }

            if ((startingSystem == null) || (startingSystem != system))
            {
                foreach (SingleTrip s in singleTrips)
                {
                    s.StartingSystem = system;
                }

                startingSystem = system;
            }

            if (secure)
            {
                singleTrips.Sort(SingleTrip.CompareByProfitPerWarpFromStartingSystemSecure);
            }
            else
            {
                singleTrips.Sort(SingleTrip.CompareByProfitPerWarpFromStartingSystemShortest);
            }
        }
        public RoundTripDisplayItem(Map map, RoundTrip data, Parameters parameters)
        {
            Text = data.There.TypeName + "/" + data.BackAgain.TypeName;
            profit = (int)data.Profit;
            int profitPercentage = (profit * 100) / (int)parameters.Isk;
            
            profitPerWarp = (int)data.ProfitPerWarp;
            SolarSystem startingSystem = map.GetSystem(parameters.StartingSystem);
            int jumpsFromStart = map.DistanceBetween(startingSystem, data.There.Source.System, true);
            int jumps = data.There.Jumps(true);
            string source = data.There.Source.Name;
            string destination = data.There.Destination.Name;
            float security = data.Security;
            string limitedBy = data.There.LimitedBy.ToString();
            if(data.BackAgain.ItemType != null)
                limitedBy += " / " + data.BackAgain.LimitedBy;

            SubItems.Add(profitPerWarp.ToString());
            SubItems.Add(profitPercentage + "%");
            SubItems.Add(security.ToString());
            SubItems.Add(jumpsFromStart.ToString());
            SubItems.Add(jumps.ToString());
            SubItems.Add(source);
            SubItems.Add(destination);
            SubItems.Add(limitedBy.ToString());
        }
示例#3
0
        public RoundTripDisplayItem(Map map, RoundTrip data, Parameters parameters)
        {
            Text   = data.There.TypeName + "/" + data.BackAgain.TypeName;
            profit = (int)data.Profit;
            int profitPercentage = (profit * 100) / (int)parameters.Isk;

            profitPerWarp = (int)data.ProfitPerWarp;
            SolarSystem startingSystem = map.GetSystem(parameters.StartingSystem);
            int         jumpsFromStart = map.DistanceBetween(startingSystem, data.There.Source.System, true);
            int         jumps          = data.There.Jumps(true);
            string      source         = data.There.Source.Name;
            string      destination    = data.There.Destination.Name;
            float       security       = data.Security;
            string      limitedBy      = data.There.LimitedBy.ToString();

            if (data.BackAgain.ItemType != null)
            {
                limitedBy += " / " + data.BackAgain.LimitedBy;
            }

            SubItems.Add(profitPerWarp.ToString());
            SubItems.Add(profitPercentage + "%");
            SubItems.Add(security.ToString());
            SubItems.Add(jumpsFromStart.ToString());
            SubItems.Add(jumps.ToString());
            SubItems.Add(source);
            SubItems.Add(destination);
            SubItems.Add(limitedBy.ToString());
        }
示例#4
0
        public SingleTripDisplayItem(Map map, SingleTrip data, Parameters parameters)
        {
            Text   = data.TypeName;
            profit = (int)data.Profit;
            int profitPercentage = (profit * 100) / (int)parameters.Isk;

            SolarSystem startingSystem = map.GetSystem(parameters.StartingSystem);

            if (startingSystem == null)
            {
                profitPerWarp = (int)data.ProfitPerWarp(true);
            }
            else
            {
                data.StartingSystem = startingSystem;
                profitPerWarp       = (int)data.ProfitPerWarpFromStartingSystem(true);
            }

            int    jumpsFromStart = map.DistanceBetween(startingSystem, data.Source.System, true);
            int    jumps          = data.Jumps(true);
            string source         = data.Source.Name;
            string destination    = data.Destination.Name;

            SecurityStatus.Level security  = data.Security;
            LimitingFactor       limitedBy = data.LimitedBy;

            SubItems.Add(profitPerWarp.ToString());
            SubItems.Add(profitPercentage + "%");
            SubItems.Add(security.ToString());
            SubItems.Add(jumpsFromStart.ToString());
            SubItems.Add(jumps.ToString());
            SubItems.Add(source);
            SubItems.Add(destination);
            SubItems.Add(limitedBy.ToString());
        }
        public SingleTripDisplayItem(Map map, SingleTrip data, Parameters parameters)
        {
            Text = data.TypeName;
            profit = (int)data.Profit;
            int profitPercentage = (profit * 100) / (int)parameters.Isk;

            SolarSystem startingSystem = map.GetSystem(parameters.StartingSystem);
            if (startingSystem == null)
                profitPerWarp = (int)data.ProfitPerWarp(true);
            else
            {
                data.StartingSystem = startingSystem;
                profitPerWarp = (int)data.ProfitPerWarpFromStartingSystem(true);
            }

            int jumpsFromStart = map.DistanceBetween(startingSystem, data.Source.System, true);
            int jumps = data.Jumps(true);
            string source = data.Source.Name;
            string destination = data.Destination.Name;
            SecurityStatus.Level security = data.Security;
            LimitingFactor limitedBy = data.LimitedBy;

            SubItems.Add(profitPerWarp.ToString());
            SubItems.Add(profitPercentage + "%");
            SubItems.Add(security.ToString());
            SubItems.Add(jumpsFromStart.ToString());
            SubItems.Add(jumps.ToString());
            SubItems.Add(source);
            SubItems.Add(destination);
            SubItems.Add(limitedBy.ToString());
        }
示例#6
0
        protected override void InterpretRow(Dictionary <string, string> fields)
        {
            int fromSystemId = ParseId(fields["fromSolarSystemID"]);
            int toSystemId   = ParseId(fields["toSolarSystemID"]);

            SolarSystem from = map.GetSystem(fromSystemId);
            SolarSystem to   = map.GetSystem(toSystemId);

            if (from != null && to != null)
            {
                from.AddGateTo(to);
            }
            else
            {
                Console.WriteLine("I can't link system " + fromSystemId + " to system " + toSystemId + " because one or both are not in my map.");
            }
        }
示例#7
0
        protected override void InterpretRow(Dictionary <string, string> fields)
        {
            int    stationId     = ParseId(fields["stationID"]);
            int    stationTypeId = ParseId(fields["stationTypeID"]);
            string name          = fields["stationName"];
            int    systemId      = ParseId(fields["solarSystemID"]);

            SolarSystem system = map.GetSystem(systemId);

            if (system != null)
            {
                Station station = new Station(stationId, stationTypeId, name, system);
                stationsById.Add(stationId, station);
            }
        }
示例#8
0
        protected override void InterpretRow(Dictionary <string, string> fields)
        {
            float       price       = float.Parse(fields["price"], System.Globalization.CultureInfo.InvariantCulture);
            int         quantity    = (int)float.Parse(fields["volRemaining"], System.Globalization.CultureInfo.InvariantCulture);
            int         minQuantity = (int)float.Parse(fields["minVolume"], System.Globalization.CultureInfo.InvariantCulture);
            int         typeId      = int.Parse(fields["typeID"]);
            int         range       = int.Parse(fields["range"]);
            int         regionId    = int.Parse(fields["regionID"]);
            int         stationId   = int.Parse(fields["stationID"]);
            int         systemId    = int.Parse(fields["solarSystemID"]);
            string      isWanted    = fields["bid"];
            SolarSystem s           = map.GetSystem(systemId);
            Station     station     = map.GetStation(stationId);
            ItemType    type        = itemDatabase.GetItemType(typeId);

            if (s != null && type != null && station != null)
            {
                Trade trade = new Trade(type, price, quantity, minQuantity);
                if (isWanted == "True")
                {
                    // Range is in station only
                    if (range == -1)
                    {
                        station.AddItemWanted(trade);
                        if (!stationsWithItemsWanted.Contains(station))
                        {
                            stationsWithItemsWanted.Add(station);
                        }
                    }
                    // Range it either system or greater
                    else if ((range > -1) & (range < 32767))
                    {
                        foreach (SolarSystem sAtRange in s.Region.Systems)
                        {
                            if (map.DistanceBetween(s, sAtRange, false) <= range)
                            {
                                sAtRange.AddItemWanted(trade);
                                foreach (Station remoteStation in sAtRange.Stations)
                                {
                                    if (!stationsWithItemsWanted.Contains(remoteStation))
                                    {
                                        stationsWithItemsWanted.Add(remoteStation);
                                    }
                                }
                            }
                        }
                    }
                    // Range is regional
                    else if (range == 32767)
                    {
                        s.Region.AddItemWanted(trade);
                        foreach (SolarSystem system in s.Region.Systems)
                        {
                            foreach (Station remoteStation in system.Stations)
                            {
                                if (!stationsWithItemsWanted.Contains(remoteStation))
                                {
                                    stationsWithItemsWanted.Add(remoteStation);
                                }
                            }
                        }
                    }
                }
                else
                {
                    station.AddItemForSale(trade);
                    if (!stationsWithItemsForSale.Contains(station))
                    {
                        stationsWithItemsForSale.Add(station);
                    }
                }
            }
        }