internal bool CheckMarketHistory() { var updated = false; var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); var esiMarketHistory = EsiDataInterface.GetMarketHistory(Id, region); if (esiMarketHistory == null) { return(updated); } if (_esiMarketHistory == null) { _esiMarketHistory = esiMarketHistory; updated = true; return(updated); } if (Equals(_esiMarketHistory, esiMarketHistory)) { return(updated); } _esiMarketHistory = esiMarketHistory; updated = true; OnMarketHistoryUpdated(); return(updated); }
public void SolarSystem_Get_ReturnsSame(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId).Value; ss.Id.Should().Be(solarSystemId); }
private static void ImportSolarSystems() { var context = new MassDefectContext(); var json = File.ReadAllText(SolarSystemsPath); var solarSystems = JsonConvert.DeserializeObject <IEnumerable <SolarSystemDTO> >(json); foreach (var solarSystem in solarSystems) { if (solarSystem.Name == null) { throw new ArgumentException("Error: Invalid data."); continue; } var solarSystemEntity = new SolarSystems() { Name = solarSystem.Name }; context.SolarSystems.Add(solarSystemEntity); System.Console.WriteLine($"Successfully imported {solarSystemEntity} {solarSystemEntity.Name}."); } context.SaveChanges(); }
private void OnMarketOrdersUpdated() { var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); if (_esiMarketOrders != null) { var esiMarketOrders = _esiMarketOrders.FirstOrDefault(x => x.Region == region); if (esiMarketOrders != null) { if (esiMarketOrders.Orders.Any(x => !x.is_buy_order)) { _eoiBlueprint.Price = esiMarketOrders.Orders.Where(x => !x.is_buy_order).Min(x => x.price); } else { _eoiBlueprint.Price = 0; } } else { _eoiBlueprint.Price = 0; } } else { _eoiBlueprint.Price = 0; } BlueprintCalculator.Calculate(this); }
public DestinationManager() { InitializeComponent(); Systems = SolarSystems.GetAllSolarSystems(); SystemsComboBox.ItemsSource = Systems; SystemsComboBox.Focus(); }
public SettingsControl() { InitializeComponent(); EnableAutoUpdaterCheckBox.IsChecked = SettingsInterface.GlobalSettings.EnableAutoUpdater; AutoUpdaterIntervalTextBox.Text = Helpers.MilisecondsToMinutes(SettingsInterface.GlobalSettings.AutoUpdaterInterval).ToString(); EnableMarketUpdatesCheckBox.IsChecked = SettingsInterface.GlobalSettings.EnableMarketerUpdates; EnableMarketHistoryUpdatesCheckBox.IsChecked = SettingsInterface.GlobalSettings.EnableMarketHistoryUpdates; EnableCorporationBlueprintsUpdatesCheckBox.IsChecked = SettingsInterface.GlobalSettings.EnableCorporationBlueprintsUpdates; EnableEsiBlueprintsUpdatesCheckBox.IsChecked = SettingsInterface.GlobalSettings.EnableEsiBlueprintsUpdates; CorporationServerTextBox.Text = SettingsInterface.GlobalSettings.CorporationServer; EnableCalculationCheckBox.IsChecked = SettingsInterface.GlobalSettings.EnableCalculation; SaleTaxTextBox.Text = SettingsInterface.GlobalSettings.SaleTax.ToString("N2"); BrokerFeeTextBox.Text = SettingsInterface.GlobalSettings.BrokerFee.ToString("N2"); IndustryTaxTextBox.Text = SettingsInterface.GlobalSettings.IndustryTax.ToString("N2"); StructureTaxBonusTextBox.Text = SettingsInterface.GlobalSettings.StructureTaxBonus.ToString("N2"); StructureMaterialBonusTextBox.Text = SettingsInterface.GlobalSettings.StructureMaterialBonus.ToString("N2"); NotOwnedMeTextBox.Text = SettingsInterface.GlobalSettings.NotOwnedMe.ToString("N0"); NotOwnedTeTextBox.Text = SettingsInterface.GlobalSettings.NotOwnedTe.ToString("N0"); ProfitPerHourForPriceTextBox.Text = SettingsInterface.GlobalSettings.ProfitPerHourForPrice.ToString("N0"); ImportOrderTypeComboBox.SelectedItem = SettingsInterface.GlobalSettings.ImportOrderType; ExportOrderTypeComboBox.SelectedItem = SettingsInterface.GlobalSettings.ExportOrderType; var tradeHub = SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub); TradeHubComboBox.SelectedItem = tradeHub; ShowBlueprintCopiesCheckBox.IsChecked = SettingsInterface.GlobalSettings.ShowBlueprintCopies; }
private bool CheckMarketOrdersImpl() { var updated = false; var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); var esiMarketOrders = EsiDataInterface.GetMarketOrders(Id, region); if (esiMarketOrders == null) { return(updated); } var oldEsiMarketOrders = _esiMarketOrders.FirstOrDefault(x => x.Id == Id && x.Region == region); if (oldEsiMarketOrders == null) { _esiMarketOrders.Add(esiMarketOrders); updated = true; return(updated); } if (Equals(oldEsiMarketOrders, esiMarketOrders)) { return(updated); } _esiMarketOrders.Remove(oldEsiMarketOrders); _esiMarketOrders.Add(esiMarketOrders); updated = true; return(updated); }
public void SolarSystem_Stargates_ReturnsNonEmpty(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId).Value; var gates = ss.Stargates().ToList(); gates.Should().NotHaveCount(0); }
public void SolarSystem_Constellation_HasSameId() { var ss = SolarSystems.Get(30005003).Value; var c = ss.Constellation(); c.Id.Should().Be(ss.ConstellationId); }
public SettingsWindow() { InitializeComponent(); Closing += SettingsWindow_Closing; Systems = SolarSystems.GetAllSolarSystems(); SystemsComboBox.ItemsSource = Systems; SystemsComboBox.SelectedItem = SolarSystems.GetSolarSystemName(Properties.Settings.Default.DestinationSystem); }
public void SolarSystem_Celestials_ReturnsAll(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId).Value; var celestials = ss.Celestials().ToList(); celestials.Should().HaveCountGreaterThan(10); }
public void SolarSystem_Star_ReturnsSome(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId).Value; var star = ss.Star().Value; star.Should().NotBeNull(); }
public void SolarSystem_Planets_ReturnsNonEmpty(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId).Value; var planets = ss.Planets().ToList(); planets.Should().NotHaveCount(0); }
public void SolarSystem_Neighbours_NegativeDepth(int solarSystemId, int depth) { var ss = SolarSystems.Get(solarSystemId).Value; var neighbours = ss.Neighbours(depth).ToList(); neighbours.Count.Should().Be(0); }
private void InitializeEoiBlueprint() { _eoiBlueprint.Id = this.Id; _eoiBlueprint.Name = _staticBlueprint.Name; _eoiBlueprint.Owned = this.Owned; _eoiBlueprint.Inventable = this.Parent?.Owned == true; _eoiBlueprint.Materials.Clear(); foreach (var material in GetEoiMaterials()) { _eoiBlueprint.Materials.Add(material); } _eoiBlueprint.Products = GetEoiProducts(); if (_fileSystemBlueprint != null) { _eoiBlueprint.MaterialEfficency = _fileSystemBlueprint.MaterialEfficency; _eoiBlueprint.TimeEfficency = _fileSystemBlueprint.TimeEfficency; // _eoiBlueprint.Owned = _fileSystemBlueprint.Owned; _eoiBlueprint.Private = _fileSystemBlueprint.Private; _eoiBlueprint.IsCopy = _fileSystemBlueprint.IsCopy; } else { _eoiBlueprint.MaterialEfficency = SettingsInterface.GlobalSettings.NotOwnedMe; _eoiBlueprint.TimeEfficency = SettingsInterface.GlobalSettings.NotOwnedTe; } var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); if (_esiMarketOrders != null) { var esiMarketOrders = _esiMarketOrders.FirstOrDefault(x => x.Region == region); if (esiMarketOrders != null) { if (esiMarketOrders.Orders.Any(x => !x.is_buy_order)) { _eoiBlueprint.Price = esiMarketOrders.Orders.Where(x => !x.is_buy_order).Min(x => x.price); } else { _eoiBlueprint.Price = 0; } } else { _eoiBlueprint.Price = 0; } } else { _eoiBlueprint.Price = 0; } _eoiBlueprint.PropertyChanged += EoiBlueprint_PropertyChanged; }
public void SolarSystem_FindHighsecRoute(int start, int finish, int expected) { var s = SolarSystems.Get(start).Value; var f = SolarSystems.Get(finish).Value; var result = s.FindHighsecGateRoute(f); Assert.Equal(expected, result.Length); }
public void SolarSystem_Get_UnknownId_ThrowsException(int solarSystemId) { Action a = () => { var x = SolarSystems.Get(solarSystemId).Value; }; a.Should().Throw <NullReferenceException>(); }
internal void CheckMarketOrders() { var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); var esiMarketOrders = EsiDataInterface.GetMarketOrders(this.Id, region); if (esiMarketOrders == null) { return; } if (_esiMarketOrders == null) { _esiMarketOrders = esiMarketOrders; } else { //if (Equals(_esiMarketOrders, esiMarketOrders)) // return; _esiMarketOrders = esiMarketOrders; } decimal tradeHubPrice = 0; if (SettingsInterface.GlobalSettings.ExportOrderType == OrderType.Buy) { if (esiMarketOrders != null) { var materialMarketPricesBuyOrders = esiMarketOrders.Orders.Where(x => x.is_buy_order && x.system_id.ToString() == SettingsInterface.GlobalSettings.TradeHub); if (materialMarketPricesBuyOrders.Any()) { tradeHubPrice = materialMarketPricesBuyOrders.Max(x => x.price); } } } else if (SettingsInterface.GlobalSettings.ExportOrderType == OrderType.Sell) { if (esiMarketOrders != null) { var materialMarketPricesBuyOrders = esiMarketOrders.Orders.Where(x => !x.is_buy_order && x.system_id.ToString() == SettingsInterface.GlobalSettings.TradeHub); if (materialMarketPricesBuyOrders.Any()) { tradeHubPrice = materialMarketPricesBuyOrders.Min(x => x.price); } } } foreach (var eoiAsset in _eoiAssets) { eoiAsset.TradeHubPrice = tradeHubPrice; eoiAsset.PriceChange = eoiAsset.TradeHubPrice - eoiAsset.Price; } }
public void SolarSystem_CelestialDistances(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId).Value; var pos = Position.FromCoordinates(1, 1, 1); var results = ss.CelestialDistances(pos).ToList(); var star = ss.Star().Value; results.First().Item1.Id.Should().Be(star.Id); }
internal static void RequestMarketHistory() { if (EveSwaggerInterface.Working()) { return; } var failedRequests = EveSwaggerInterface.GetFailedHistoryRequests(); foreach (var failedRequest in failedRequests) { var esiType = EveSwaggerInterface.GetType(failedRequest.Id); if (esiType == null || !esiType.published) { var product = EoiDataInterface.GetTypeById(failedRequest.Id); if (product != null) { product.Invalid = true; EoiDataInterface.CheckInvalid(); } } } EveSwaggerInterface.ClearFailedHistoryRequests(); var blueprints = EoiDataInterface.GetBlueprints(); foreach (var blueprint in blueprints) { foreach (var product in blueprint.Products) { RawEsiPriceHistory marketHistory = null; var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); marketHistory = EveSwaggerInterface.GetMarketHistory(product.Id, region); if (marketHistory != null) { var esiDataMarketHistory = _marketHistory.FirstOrDefault(x => Equals(x.History, marketHistory)); if (esiDataMarketHistory == null) { var oldEsiDataMarketHistory = _marketHistory.FirstOrDefault(x => x.Id == marketHistory.typeId && x.Region == marketHistory.regionId); if (oldEsiDataMarketHistory != null) { _marketHistory.Remove(oldEsiDataMarketHistory); } _marketHistory.Add(new EsiDataMarketHistory(marketHistory)); } } } } }
public void SolarSystem_BeltsMoonsCrawled(int id, int expectedPlanets) { var s = SolarSystems.Get(id).Value; var planets = s.Planets().ToList(); var xs = planets.Select(p => (p, p.AsteroidBelts().ToList(), p.Moons().ToList())).ToList(); planets.Should().HaveCount(expectedPlanets); xs.Any(t => t.Item2.Count > 0).Should().BeTrue(); xs.Any(t => t.Item3.Count > 0).Should().BeTrue(); }
public void SolarSystem_Neighbours_FindThoseWithinXLightYears(int solarSystemId, int depth, double ly) { var sys = SolarSystems.Get(solarSystemId).Value; var neighbours = sys.Neighbours(depth).SelectMany(xs => xs) .Where(s => s.Level == SecurityLevel.Lowsec || s.Level == SecurityLevel.Nullsec) .Select(s => (Units.MetresToLy(Geometry.GetEuclidean(sys.Position, s.Position)), s)) .Where(t => t.Item1 <= ly) .OrderBy(t => t.Item1) .ToList(); neighbours.Count().Should().BeGreaterThan(0); }
/// <summary>Gets the name of an Eve location from the location ID</summary> /// <param name="locationId">The location id.</param> /// <returns>The <see cref="string" />.</returns> public static string GetLocationName(int locationId) { if (locationId >= 66000000) { if (locationId < 66014933) { locationId = locationId - 6000001; } else { locationId = locationId - 6000000; } } if (Convert.ToDouble(locationId) >= 61000000 & Convert.ToDouble(locationId) <= 61999999) { if (Stations.ContainsKey(locationId)) { // Known Outpost return(Stations[locationId].StationName); } // Unknown outpost! return("Unknown Outpost"); } if (Convert.ToDouble(locationId) < 60000000) { if (SolarSystems.ContainsKey(locationId)) { // Known solar system return(SolarSystems[locationId].Name); } // Unknown solar system return("Unknown System"); } if (Stations.ContainsKey(locationId)) { // Known station return(Stations[locationId].StationName); } // Unknown station return("Unknown Station"); }
public void SolarSystem_Moons_Warmup_ReturnsAll(int solarSystemId) { // Warm up. var allMoons = Regions.GetAll() .SelectMany(r => r.Constellations()) .SelectMany(c => c.SolarSystems()) .SelectMany(s => s.Planets()) .SelectMany(p => p.Moons()) .Count(); var ss = SolarSystems.Get(solarSystemId).Value; var moons = ss.Planets().SelectMany(p => p.Moons()).ToList(); moons.Should().NotHaveCount(0); allMoons.Should().BeGreaterThan(300000); }
internal void Init() { var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); var marketOrders = EsiDataInterface.GetMarketOrders(Id, region); if (marketOrders != null) { _esiMarketOrders.Add(marketOrders); } _fileSystemBlueprint = FileSystemDataInterface.GetBlueprintById(Id); if (_fileSystemBlueprint != null && _fileSystemBlueprint.IsCopy) { this.IsCopy = true; } }
private async void AcceptButton_Click(object sender, RoutedEventArgs e) { try { SystemID = SolarSystems.GetSolarSystemId(SystemsComboBox.SelectedItem.ToString()); foreach (var buzzCharacter in CharacterManager.CurrentInstance.CharacterList) { if (buzzCharacter.IsOnline || Properties.Settings.Default.DestinationManagerIncludeOffline) { await buzzCharacter.SetWaypoints(new List <int>(){ SystemID }, Properties.Settings.Default.ClearOtherWaypointsDestinationManager); } } Close(); } catch (Exception) { MessageBox.Show("Could not find a system with that name."); } }
private void RecalculateSolarSystems(Map spaceMap) { foreach (var solarSystem in spaceMap.Systems) { try { SolarSystems.Add(solarSystem.Name, solarSystem); foreach (var connection in solarSystem.ConnectedSolarSystems) { var connectedSolarSystem = SpaceMap.Systems.FirstOrDefault(system => system.Name == connection); if (connectedSolarSystem?.Name == null) { continue; } if (connectedSolarSystem.IsDeleted) { continue; } var pointFrom = new Point(solarSystem.LocationInMap.X, solarSystem.LocationInMap.Y); var pointTo = new Point(connectedSolarSystem.LocationInMap.X, connectedSolarSystem.LocationInMap.Y); //Draw connection line center var centerLinePoint = new Point((pointFrom.X + pointTo.X) / 2, (pointFrom.Y + pointTo.Y) / 2); var newConnection = new Wormhole { Location = centerLinePoint, SolarSystemFrom = solarSystem.Name, SolarSystemTo = connectedSolarSystem.Name }; Wormholes.Add(newConnection); } } catch (Exception ex) { _commandsLog.ErrorFormat("[MapView.RecalculateSolarSystems] Critical error {0}", ex); } } }
internal void Init() { _esiPrice = EsiDataInterface.GetPriceById(Id); if (_esiPrice != null) { AdjustedPrice = _esiPrice.AdjustedPrice; } else { Invalid = true; } var region = Regions.GetTradehubRegionId(SolarSystems.GetSolarSystem(SettingsInterface.GlobalSettings.TradeHub)); _esiMarketHistory = EsiDataInterface.GetMarketHistory(Id, region); var esiMarketOrders = EsiDataInterface.GetMarketOrders(Id, region); if (esiMarketOrders != null) { _esiMarketOrders.Add(esiMarketOrders); } }
public void SolarSystem_Get_UnknownId_ReturnsNull(int solarSystemId) { var ss = SolarSystems.Get(solarSystemId); ss.Should().BeNull(); }
public void SolarSystem_Get_ReturnsSystem(int solarSystemId, string expectedName) { var ss = SolarSystems.Get(solarSystemId).Value; ss.Name.Should().Be(expectedName); }