private void Update() { var response = Client.GetAsync($"https://poe.ninja/api/data/currencyoverview?league={Properties.Settings.Default.League}&type=Currency&language=en").Result; var responseBody = response.Content.ReadAsStringAsync().Result; var ExchangeRatesJson = JsonConvert.DeserializeObject <CurrenciesJson>(responseBody); CurrenciesList.Clear(); foreach (Line l in ExchangeRatesJson.Lines) { Currency_ExRate c = new Currency_ExRate(l.CurrencyTypeName, l.ChaosEquivalent); CurrenciesList.Add(c); } CurrenciesList.Add(new Currency_ExRate("Chaos Orb", 1)); foreach (CurrencyDetail cd in ExchangeRatesJson.CurrencyDetails) { var img = "Assets/Currencies/" + cd.Name.ToLower().Replace(" ", "") + ".png"; if (!File.Exists(img)) { using (WebClient client = new WebClient()) { client.DownloadFile(cd.Icon, img); } } } _LoggerService.Log("Curencies updated!"); }
private double GetChaosValue() { if (Item.Price.IsSet) { return(this.Item.Price.CurrencyType.ChaosEquivalent * this.Item.Price.Cost * this.Item.Price.ForNumberItems); } Currency_ExRate exRate = PoECurrencyManager.Instance.Currencies.GetCurrencyByName(this.Item.RealName); return(exRate == null ? 0.0 : exRate.ChaosEquivalent *this.Item.SizeInStack); }