private void FillInPriceInChaos(PoeNinjaWrapper.Currency currencyWrapper, List <Currency> Currencies) { foreach (var currencyRatioWrapper in currencyWrapper.CurrencyRatios) { //var poeNinjaId = currencyRatioWrapper.PayRatio.PayCurrencyId; Currency currency = Currencies.First(c => c.Name == currencyRatioWrapper.Name); currency.PriceInChaos = currencyRatioWrapper.PriceInChaos; } }
private void InitializeCurrenciesWithBaseData(PoeNinjaWrapper.Currency currencyWrapper, List <Currency> Currencies) { // Create a currency and fill in the base data foreach (var currencyBaseData in currencyWrapper.CurrencyTypes) { Currencies.Add( new Currency { Name = currencyBaseData.Name, PoeNinjaId = currencyBaseData.PoeNinjaId, IconUrl = currencyBaseData.IconUrl, PoeTradeId = currencyBaseData.PoeTradeId } ); } }
public List <Currency> GetCurrencies() { const int ExaltedOrbId = 2; var currencyUrl = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.CurrencyRatios); var fragmentsUrl = PoeNinjaApiUrlBuilder.BuildUrl(PoeNinjaApiUrlBuilder.Category.Fragment); PoeNinjaWrapper.Currency currencyWrapper = WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Currency>(currencyUrl); PoeNinjaWrapper.Currency fragmentsWrapper = WebRequestManager.GetWebRequestDataAsJson <PoeNinjaWrapper.Currency>(fragmentsUrl); var Currencies = new List <Currency>(); InitializeCurrenciesWithBaseData(currencyWrapper, Currencies); FillInPriceInChaos(currencyWrapper, Currencies); FillInPriceInChaos(fragmentsWrapper, Currencies); CalculateExaltedRatio(ExaltedOrbId, Currencies); return(Currencies); }