示例#1
0
        public SingleTrip(Map map, Station source, Station destination)
        {
            this.map         = map;
            this.source      = source;
            this.destination = destination;

            jumpsSecure   = map.DistanceBetween(source.System, destination.System, true);
            jumpsShortest = map.DistanceBetween(source.System, destination.System, false);

            if ((jumpsSecure == jumpsShortest) && (jumpsSecure != int.MaxValue))
            {
                security = SecurityStatus.Level.HighSec;
            }
            else if ((jumpsSecure > jumpsShortest) && (jumpsSecure != int.MaxValue))
            {
                security = SecurityStatus.Level.LowSecShortcut;
            }
            else if ((jumpsSecure == int.MaxValue) && (jumpsShortest != int.MaxValue))
            {
                security = SecurityStatus.Level.LowSecOnly;
            }
            else
            {
                security = SecurityStatus.Level.Isolated;
            }
        }
        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
        public SingleTrip(Map map, Station source, Station destination)
        {
            this.map = map;
            this.source = source;
            this.destination = destination;

            jumpsSecure = map.DistanceBetween(source.System, destination.System, true);
            jumpsShortest = map.DistanceBetween(source.System, destination.System, false);

            if ((jumpsSecure == jumpsShortest) && (jumpsSecure != int.MaxValue))
            {
                security = SecurityStatus.Level.HighSec;
            }
            else if ((jumpsSecure > jumpsShortest) && (jumpsSecure != int.MaxValue))
            {
                security = SecurityStatus.Level.LowSecShortcut;
            }
            else if ((jumpsSecure == int.MaxValue) && (jumpsShortest != int.MaxValue))
            {
                security = SecurityStatus.Level.LowSecOnly;
            }
            else
            {
                security = SecurityStatus.Level.Isolated;
            }
        }
示例#7
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);
                    }
                }
            }
        }