public PriceInfo GetPrice(TypeId typeId, SolarSystemId solarSystem) { var url = string.Format("http://api.eve-central.com/api/marketstat/json?typeid={0}&usesystem={1}", typeId.Id, solarSystem.Id); var results = GetJsonArray(url)[0]; return(new PriceInfo((decimal)results.buy.max, (decimal)results.sell.min)); }
public int GetNumberOfJumps(SolarSystemId start, SolarSystemId end) { var url = string.Format("http://api.eve-central.com/api/route/from/{0}/to/{1}", start.Id, end.Id); // the route api gives us a json array of the jumps required, so just count those return(GetJsonArray(url).Count); }
public TradeInfo(TypeId type, PriceInfo sourcePrice, PriceInfo targetPrice, SolarSystemId sourceSystem, SolarSystemId targetSystem, int numJumps) { Type = type; SourcePrice = sourcePrice; TargetPrice = targetPrice; SourceSystem = sourceSystem; TargetSystem = targetSystem; NumJumps = numJumps; }
public void PullsPricesFromPriceSite() { var jita = new SolarSystemId(30000142, "Jita"); var amarr = new SolarSystemId(30002187, "Amarr"); var subject = new SolarSystemRouteFinder(); var result = subject.GetNumberOfJumps(jita, amarr); result.Should().Be(9, "Amarr to Jita is 10 systems (9 jumps)"); }
public void PullsPricesFromPriceSite() { var jita = new SolarSystemId(30000142, "Jita"); var trit = new TypeId(34, "Tritanium"); var subject = new PriceChecker(); var result = subject.GetPrice(trit, jita); result.SellMin.Should().BeLessThan(10, "trit should not be crazy expensive"); result.SellMin.Should().BeGreaterThan(0, "trit should not be free"); }
/* Methods */ /// <summary> /// Computes a compound ID for the specified sub-IDs. /// </summary> /// <param name="fromSolarSystemId"> /// The ID of the origin constellation. /// </param> /// <param name="toSolarSystemId"> /// The ID of the destination constellation. /// </param> /// <returns> /// A compound ID combining the two sub-IDs. /// </returns> public static IConvertible CreateCacheKey(SolarSystemId fromSolarSystemId, SolarSystemId toSolarSystemId) { return(EveCache.CreateCompoundCacheKey(fromSolarSystemId, toSolarSystemId)); }