private void PriceBoxOverItem(CustomItem item) { var box = item.Item.GetClientRect(); var drawBox = new RectangleF(box.X, box.Y - 2, box.Width, -Settings.CurrencyTabBoxHeight); var position = new Vector2(drawBox.Center.X, drawBox.Center.Y - Settings.CurrencyTabFontSize.Value / 2); Graphics.DrawText(Math.Round((decimal)item.PriceData.ChaosValue, Settings.CurrenctTabSigDigits.Value).ToString(), Settings.CurrencyTabFontSize.Value, position, Settings.CurrencyTabFontColor, FontDrawFlags.Center); Graphics.DrawBox(drawBox, Settings.CurrencyTabBackgroundColor); Graphics.DrawFrame(drawBox, 1, Settings.CurrencyTabBorderColor); }
/// <summary> /// Displays price for unique items, and highlights the uniques under X value by drawing a border arround them. /// </summary> /// <param name="item"></param> private void HighlightJunkUniques(CustomItem item) { var hoverUi = GameController.Game.IngameState.UIHoverTooltip.Tooltip; if (hoverUi != null && (item.Rarity != ItemRarity.Unique || hoverUi.GetClientRect().Intersects(item.Item.GetClientRect()) && hoverUi.IsVisibleLocal)) { return; } var chaosValueSignificanDigits = Math.Round((decimal)item.PriceData.ChaosValue, Settings.HighlightSignificantDigits.Value); if (chaosValueSignificanDigits >= Settings.InventoryValueCutOff.Value) { return; } var rec = item.Item.GetClientRect(); var fontSize = Settings.HighlightFontSize.Value; // var backgroundBox = Graphics.MeasureText($"{chaosValueSignificanDigits}", fontSize); var position = new Vector2(rec.TopRight.X - fontSize, rec.TopRight.Y); //Graphics.DrawBox(new RectangleF(position.X - backgroundBox.Width, position.Y, backgroundBox.Width, backgroundBox.Height), Color.Black); Graphics.DrawText($"{chaosValueSignificanDigits}", position, Settings.UniTextColor, FontAlign.Center); //Graphics.DrawFrame(item.Item.GetClientRect(), 2, Settings.HighlightColor.Value); }
public override bool Initialise() { Name = "Ninja Price"; //base.InitializeSettingsMenu(); Controller = this; BuildDate = new DateTime(2000, 1, 1).AddDays(Version.Build).AddSeconds(Version.Revision * 2); PluginVersion = $"{Version}"; NinjaDirectory = DirectoryFullName + "\\NinjaData\\"; //LogMessage(DirectoryFullName, 50); // ????? i dont even understand why this is here. // Make folder if it doesnt exist var file = new FileInfo(NinjaDirectory); file.Directory?.Create(); // If the directory already exists, this method does nothing. GatherLeagueNames(); //DownloadChaosIcon(); if (Settings.FirstTime) { LoadJsonData(); UpdatePoeNinjaData(); Settings.FirstTime = true; } else { UpdatePoeNinjaData(); } CurrentLeague = Settings.LeagueList.Value; // Update selected league // Enable Events Settings.ReloadButton.OnPressed += LoadJsonData; CustomItem.InitCustomItem(this); return(true); }
// TODO: Get hovered items && items from inventory - Getting hovered itemw ill become useful later on public override void Render() { try // Im lazy and just want to surpress all errors produced { // only update if the time between last update is more than AutoReloadTimer interval if (Settings.AutoReload && Settings.LastUpDateTime.AddMinutes(Settings.AutoReloadTimer.Value) < DateTime.Now) { LoadJsonData(); Settings.LastUpDateTime = DateTime.Now; } if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.Loop() is Alive", 5, Color.LawnGreen); } #region Reset All Data CurrentLeague = Settings.LeagueList.Value; // Update selected league every tick StashTabValue = 0; Hovereditem = null; ItemsToDrawList.Clear(); InventoryItemsToDrawList.Clear(); StashPanel = GameController.Game.IngameState.ServerData.StashPanel; #endregion if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}: Selected League: {Settings.LeagueList.Value}", 5, Color.White); } // Everything is updated, lets check if we should draw if (!StashPanel.IsVisible) { return; } if (ShouldUpdateValues()) { // Format stash items ItemList.Clear(); ItemList = StashPanel.VisibleStash.VisibleInventoryItems.ToList(); FortmattedItemList = FormatItems(ItemList); // Format Inventory Items InventoryItemList.Clear(); InventoryItemList = GetInventoryItems(); FortmattedInventoryItemList = FormatItems(InventoryItemList); if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.Render() Looping if (ShouldUpdateValues())", 5, Color.LawnGreen); } foreach (var item in FortmattedItemList) { GetValue(item); } } // Gather all information needed before rendering as we only want to itterate through the list once foreach (var item in FortmattedItemList) { if (item == null || item.Item.Address == 0) { continue; // Item is f****d, skip } if (!item.Item.IsVisible && item.ItemType != ItemTypes.None) { continue; // Disregard non visable items as that usually means they arnt part of what we want to look at } StashTabValue += item.PriceData.ChaosValue; ItemsToDrawList.Add(item); } foreach (var item in FortmattedInventoryItemList) { if (item == null || item.Item.Address == 0) { continue; // Item is f****d, skip } if (!item.Item.IsVisible && item.ItemType != ItemTypes.None) { continue; // Disregard non visable items as that usually means they arnt part of what we want to look at } InventoryItemsToDrawList.Add(item); } GetHoveredItem(); // Get information for the hovered item // TODO: Graphical part from gathered data DrawGraphics(); } catch { // ignored } try { PropheccyDisplay(); } catch { LogMessage("Error in: PropheccyDisplay(), restart PoEHUD.", 5); } }
// TODO: Get hovered items && items from inventory - Getting hovered itemw ill become useful later on public override void Render() { #region Reset All Data CurrentLeague = Settings.LeagueList.Value; // Update selected league every tick StashTabValue = 0; InventoryTabValue = 0; Hovereditem = null; StashPanel = GameController.Game.IngameState.IngameUi.StashElement; InventoryPanel = GameController.Game.IngameState.IngameUi.InventoryPanel; #endregion try // Im lazy and just want to surpress all errors produced { // only update if the time between last update is more than AutoReloadTimer interval if (Settings.AutoReload && Settings.LastUpDateTime.AddMinutes(Settings.AutoReloadTimer.Value) < DateTime.Now) { LoadJsonData(); Settings.LastUpDateTime = DateTime.Now; } if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.Loop() is Alive", 5, Color.LawnGreen); } if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}: Selected League: {Settings.LeagueList.Value}", 5, Color.White); } var tabType = StashPanel.VisibleStash?.InvType; // Everything is updated, lets check if we should draw if (StashPanel.IsVisible) { if (ShouldUpdateValues()) { // Format stash items ItemList = new List <NormalInventoryItem>(); switch (tabType) { case InventoryType.BlightStash: ItemList = StashPanel.VisibleStash.VisibleInventoryItems.ToList(); ItemList.RemoveAt(0); ItemList.RemoveAt(ItemList.Count() - 1); break; case InventoryType.MetamorphStash: ItemList = StashPanel.VisibleStash.VisibleInventoryItems.ToList(); ItemList.RemoveAt(0); break; default: ItemList = StashPanel.VisibleStash.VisibleInventoryItems.ToList(); break; } FortmattedItemList = new List <CustomItem>(); FortmattedItemList = FormatItems(ItemList); // Format Inventory Items InventoryItemList = new List <NormalInventoryItem>(); InventoryItemList = GetInventoryItems(); FortmattedInventoryItemList = new List <CustomItem>(); FortmattedInventoryItemList = FormatItems(InventoryItemList); if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.Render() Looping if (ShouldUpdateValues())", 5, Color.LawnGreen); } foreach (var item in FortmattedItemList) { GetValue(item); } foreach (var item in FortmattedInventoryItemList) { GetValue(item); } } // Gather all information needed before rendering as we only want to itterate through the list once ItemsToDrawList = new List <CustomItem>(); foreach (var item in FortmattedItemList) { if (item == null || item.Item.Address == 0) { continue; // Item is f****d, skip } if (!item.Item.IsVisible && item.ItemType != ItemTypes.None) { continue; // Disregard non visable items as that usually means they arnt part of what we want to look at } StashTabValue += item.PriceData.ChaosValue; ItemsToDrawList.Add(item); } InventoryItemsToDrawList = new List <CustomItem>(); foreach (var item in FortmattedInventoryItemList) { if (item == null || item.Item.Address == 0) { continue; // Item is f****d, skip } if (!item.Item.IsVisible && item.ItemType != ItemTypes.None) { continue; // Disregard non visable items as that usually means they arnt part of what we want to look at } InventoryTabValue += item.PriceData.ChaosValue; InventoryItemsToDrawList.Add(item); } } else if (InventoryPanel.IsVisible) { if (ShouldUpdateValuesInventory()) { // Format Inventory Items InventoryItemList = new List <NormalInventoryItem>(); InventoryItemList = GetInventoryItems(); FortmattedInventoryItemList = new List <CustomItem>(); FortmattedInventoryItemList = FormatItems(InventoryItemList); if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.Render() Looping if (ShouldUpdateValues())", 5, Color.LawnGreen); } foreach (var item in FortmattedInventoryItemList) { GetValue(item); } } // Gather all information needed before rendering as we only want to itterate through the list once InventoryItemsToDrawList = new List <CustomItem>(); foreach (var item in FortmattedInventoryItemList) { if (item == null || item.Item.Address == 0) { continue; // Item is f****d, skip } if (!item.Item.IsVisible && item.ItemType != ItemTypes.None) { continue; // Disregard non visable items as that usually means they arnt part of what we want to look at } InventoryTabValue += item.PriceData.ChaosValue; InventoryItemsToDrawList.Add(item); } } // TODO: Graphical part from gathered data GetHoveredItem(); // Get information for the hovered item DrawGraphics(); } catch (Exception e) { // ignored if (Settings.Debug) { LogMessage("Error in: Main Render Loop, restart PoEHUD.", 5, Color.Red); LogMessage(e.ToString(), 5, Color.Orange); } } try { //PropheccyDisplay(); } catch { if (Settings.Debug) { LogMessage("Error in: PropheccyDisplay(), restart PoEHUD.", 5, Color.Red); } } }
public void GetValue(CustomItem item) { try { item.PriceData.ExaltedPrice = (double)CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == "Exalted Orb").ChaosEquivalent; switch (item.ItemType) // easier to get data for each item type and handle logic based on that { // TODO: Complete case ItemTypes.Currency: if (item.BaseName.StartsWith("Chaos ")) { switch (item.CurrencyInfo.IsShard) { case false: item.PriceData.ChaosValue = item.CurrencyInfo.StackSize; break; case true: item.PriceData.ChaosValue = item.CurrencyInfo.StackSize / 20.0; break; } break; } if (item.BaseName.Contains("Ritual Splinter")) { var shardParent = GetShardPartent(item.BaseName); var shardCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == shardParent); if (shardCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)shardCurrencySearch.ChaosEquivalent / 100; item.PriceData.ChangeInLast7Days = (double)shardCurrencySearch.ReceiveSparkLine.TotalChange; } break; } if (item.BaseName.Contains("Crescent Splinter")) { var shardCurrencySearch = CollectedData.Fragments.Lines.Find(x => x.CurrencyTypeName == "Crescent Splinter"); if (shardCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)shardCurrencySearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)shardCurrencySearch.ReceiveSparkLine.TotalChange; } else { var shardParent = GetShardPartent(item.BaseName); shardCurrencySearch = CollectedData.Fragments.Lines.Find(x => x.CurrencyTypeName == shardParent); if (shardCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)shardCurrencySearch.ChaosEquivalent / 10; item.PriceData.ChangeInLast7Days = (double)shardCurrencySearch.ReceiveSparkLine.TotalChange; } } break; } if (item.BaseName.StartsWith("Vial ")) { var vialCurrencySearch = CollectedData.Vials.Lines.Find(x => x.Name == item.BaseName); if (vialCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)vialCurrencySearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)vialCurrencySearch.Sparkline.TotalChange; } break; } switch (item.CurrencyInfo.IsShard) { case false: var normalCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (normalCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)normalCurrencySearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)normalCurrencySearch.ReceiveSparkLine.TotalChange; } break; case true: var shardParent = GetShardPartent(item.BaseName); var shardCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == shardParent); if (shardCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)shardCurrencySearch.ChaosEquivalent / 20; item.PriceData.ChangeInLast7Days = (double)shardCurrencySearch.ReceiveSparkLine.TotalChange; } break; } break; case ItemTypes.Catalyst: var catalystSearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (catalystSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)catalystSearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)catalystSearch.ReceiveSparkLine.TotalChange; } break; case ItemTypes.DivinationCard: var divinationSearch = CollectedData.DivinationCards.Lines.Find(x => x.Name == item.BaseName); if (divinationSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)divinationSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)divinationSearch.Sparkline.TotalChange; } break; case ItemTypes.Essence: var essenceSearch = CollectedData.Essences.Lines.Find(x => x.Name == item.BaseName); if (essenceSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)essenceSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)essenceSearch.Sparkline.TotalChange; } break; case ItemTypes.Oil: var oilSearch = CollectedData.Oils.Lines.Find(x => x.Name == item.BaseName); if (oilSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)oilSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)oilSearch.Sparkline.TotalChange; } break; case ItemTypes.Fragment: var fragmentSearch = CollectedData.Fragments.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (fragmentSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)fragmentSearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)fragmentSearch.ReceiveSparkLine.TotalChange; } break; case ItemTypes.DeliriumOrbs: var deliriumOrbsSearch = CollectedData.DeliriumOrb.Lines.Find(x => x.Name == item.BaseName); if (deliriumOrbsSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)deliriumOrbsSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)deliriumOrbsSearch.Sparkline.TotalChange; } break; case ItemTypes.Incubator: var incubatorSearch = CollectedData.Incubators.Lines.Find(x => x.Name == item.BaseName); if (incubatorSearch != null) { item.PriceData.ChaosValue = (double)incubatorSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)incubatorSearch.Sparkline.TotalChange; } break; case ItemTypes.Scarab: var scarabSearch = CollectedData.Scarabs.Lines.Find(x => x.Name == item.BaseName); if (scarabSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)scarabSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)scarabSearch.Sparkline.TotalChange; } break; case ItemTypes.Prophecy: var prophecySearch = CollectedData.Prophecies.Lines.Find(x => x.Name == item.Item.Item.GetComponent <Prophecy>().DatProphecy.Name); if (prophecySearch != null) { item.PriceData.ChaosValue = (double)prophecySearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)prophecySearch.Sparkline.TotalChange; } break; // TODO: add a quick function to turn known names into the correct name for poe.ninja - See old plugin code case ItemTypes.UniqueAccessory: var uniqueAccessorieSearch = CollectedData.UniqueAccessories.Lines.Find(x => x.Name == item.UniqueName && !x.DetailsId.Contains("-relic")); if (uniqueAccessorieSearch != null) { item.PriceData.ChaosValue = (double)uniqueAccessorieSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueAccessorieSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueArmour: switch (item.LargestLink) { case 0: case 1: case 2: case 3: case 4: var uniqueArmourSearchLinks04 = CollectedData.UniqueArmours.Lines.Find(x => x.Name == item.UniqueName && x.Links <= 4 && x.Links >= 0 && !x.DetailsId.Contains("-relic")); if (uniqueArmourSearchLinks04 != null) { item.PriceData.ChaosValue = (double)uniqueArmourSearchLinks04.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueArmourSearchLinks04.Sparkline.TotalChange; } break; case 5: var uniqueArmourSearch5 = CollectedData.UniqueArmours.Lines.Find(x => x.Name == item.UniqueName && x.Links == 5 && !x.DetailsId.Contains("-relic")); if (uniqueArmourSearch5 != null) { item.PriceData.ChaosValue = (double)uniqueArmourSearch5.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueArmourSearch5.Sparkline.TotalChange; } break; case 6: var uniqueArmourSearch6 = CollectedData.UniqueArmours.Lines.Find(x => x.Name == item.UniqueName && x.Links == 6 && !x.DetailsId.Contains("-relic")); if (uniqueArmourSearch6 != null) { item.PriceData.ChaosValue = (double)uniqueArmourSearch6.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueArmourSearch6.Sparkline.TotalChange; } break; } break; case ItemTypes.UniqueFlask: var uniqueFlaskSearch = CollectedData.UniqueFlasks.Lines.Find(x => x.Name == item.UniqueName && !x.DetailsId.Contains("-relic")); if (uniqueFlaskSearch != null) { item.PriceData.ChaosValue = (double)uniqueFlaskSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueFlaskSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueJewel: var uniqueJewelSearch = CollectedData.UniqueJewels.Lines.Find(x => x.Name == item.UniqueName && !x.DetailsId.Contains("-relic")); if (uniqueJewelSearch != null) { item.PriceData.ChaosValue = (double)uniqueJewelSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueJewelSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueMap: var uniqueMapSearch = CollectedData.UniqueMaps.Lines.Find(x => x.BaseType == item.BaseName && item.MapInfo.MapTier == x.MapTier); if (uniqueMapSearch != null) { item.PriceData.ChaosValue = (double)uniqueMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueMapSearch.Sparkline.TotalChange; } break; case ItemTypes.Resonator: var resonatorSearch = CollectedData.Resonators.Lines.Find(x => x.Name == item.BaseName); if (resonatorSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)resonatorSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)resonatorSearch.Sparkline.TotalChange; } break; case ItemTypes.Fossil: var fossilSearch = CollectedData.Fossils.Lines.Find(x => x.Name == item.BaseName); if (fossilSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * (double)fossilSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)fossilSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueWeapon: switch (item.LargestLink) { case 0: case 1: case 2: case 3: case 4: var uniqueWeaponSearch04 = CollectedData.UniqueWeapons.Lines.Find(x => x.Name == item.UniqueName && x.Links <= 4 && x.Links >= 0 && !x.DetailsId.Contains("-relic")); if (uniqueWeaponSearch04 != null) { item.PriceData.ChaosValue = (double)uniqueWeaponSearch04.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueWeaponSearch04.Sparkline.TotalChange; } break; case 5: var uniqueWeaponSearch5 = CollectedData.UniqueWeapons.Lines.Find(x => x.Name == item.UniqueName && x.Links == 5 && !x.DetailsId.Contains("-relic")); if (uniqueWeaponSearch5 != null) { item.PriceData.ChaosValue = (double)uniqueWeaponSearch5.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueWeaponSearch5.Sparkline.TotalChange; } break; case 6: var uniqueWeaponSearch6 = CollectedData.UniqueWeapons.Lines.Find(x => x.Name == item.UniqueName && x.Links == 6 && !x.DetailsId.Contains("-relic")); if (uniqueWeaponSearch6 != null) { item.PriceData.ChaosValue = (double)uniqueWeaponSearch6.ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueWeaponSearch6.Sparkline.TotalChange; } break; } break; case ItemTypes.Map: // TODO: Deal with old maps, this is literally the last thing i will do as it has next to no gain for having this information switch (item.MapInfo.MapType) { case MapTypes.Blighted: var normalBlightedMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.Name == item.BaseName && item.MapInfo.MapTier == x.MapTier && x.Variant == Settings.LeagueList.Value); if (normalBlightedMapSearch != null) { item.PriceData.ChaosValue = (double)normalBlightedMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)normalBlightedMapSearch.Sparkline.TotalChange; } break; case MapTypes.None: var normalMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.Name == item.BaseName && item.MapInfo.MapTier == x.MapTier && x.Variant == Settings.LeagueList.Value); if (normalMapSearch != null) { item.PriceData.ChaosValue = (double)normalMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)normalMapSearch.Sparkline.TotalChange; } break; } break; } } catch (Exception) { if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.GetValue() Error that i dont understand", 5, Color.Red); } } }
public void GetValue(CustomItem item) { try { switch (item.ItemType) // easier to get data for each item type and handle logic based on that { // TODO: Complete case ItemTypes.Currency: if (item.BaseName.StartsWith("Chaos ")) { switch (item.CurrencyInfo.IsShard) { case false: item.PriceData.ChaosValue = item.CurrencyInfo.StackSize; break; case true: item.PriceData.ChaosValue = item.CurrencyInfo.StackSize / 20.0; break; } break; } switch (item.CurrencyInfo.IsShard) { case false: var normalCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (normalCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * normalCurrencySearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = normalCurrencySearch.ReceiveSparkLine.TotalChange; } break; case true: var shardParent = GetShardPartent(item.BaseName); var shardCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == shardParent); if (shardCurrencySearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * shardCurrencySearch.ChaosEquivalent / 20; item.PriceData.ChangeInLast7Days = shardCurrencySearch.ReceiveSparkLine.TotalChange; } break; } break; case ItemTypes.DivinationCard: var divinationSearch = CollectedData.DivinationCards.Lines.Find(x => x.Name == item.BaseName); if (divinationSearch != null) { item.PriceData.ChaosValue = divinationSearch.ChaosValue; item.PriceData.ChangeInLast7Days = divinationSearch.Sparkline.TotalChange; } break; case ItemTypes.Essence: var essenceSearch = CollectedData.Essences.Lines.Find(x => x.Name == item.BaseName); if (essenceSearch != null) { item.PriceData.ChaosValue = essenceSearch.ChaosValue; item.PriceData.ChangeInLast7Days = essenceSearch.Sparkline.TotalChange; } break; case ItemTypes.Fragment: var fragmentSearch = CollectedData.Fragments.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (fragmentSearch != null) { item.PriceData.ChaosValue = item.CurrencyInfo.StackSize * fragmentSearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = fragmentSearch.ReceiveSparkLine.TotalChange; } break; case ItemTypes.Propecy: var prophecySearch = CollectedData.Prophecies.Lines.Find(x => x.Name == item.Item.Item.GetComponent <Prophecy>().DatProphecy.Name); if (prophecySearch != null) { item.PriceData.ChaosValue = prophecySearch.ChaosValue; item.PriceData.ChangeInLast7Days = prophecySearch.Sparkline.TotalChange; } break; // TODO: add a quick function to turn known names into the correct name for poe.ninja - See old plugin code case ItemTypes.UniqueAccessorie: var uniqueAccessorieSearch = CollectedData.UniqueAccessories.Lines.Find(x => x.Name == item.UniqueName); if (uniqueAccessorieSearch != null) { item.PriceData.ChaosValue = uniqueAccessorieSearch.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueAccessorieSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueArmour: switch (item.LargestLink) { case 0: case 1: case 2: case 3: case 4: var uniqueArmourSearchLinks04 = CollectedData.UniqueArmours.Lines.Find(x => x.Name == item.UniqueName && x.Links <= 4 && x.Links >= 0); if (uniqueArmourSearchLinks04 != null) { item.PriceData.ChaosValue = uniqueArmourSearchLinks04.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueArmourSearchLinks04.Sparkline.TotalChange; } break; case 5: var uniqueArmourSearch5 = CollectedData.UniqueArmours.Lines.Find(x => x.Name == item.UniqueName && x.Links == 5); if (uniqueArmourSearch5 != null) { item.PriceData.ChaosValue = uniqueArmourSearch5.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueArmourSearch5.Sparkline.TotalChange; } break; case 6: var uniqueArmourSearch6 = CollectedData.UniqueArmours.Lines.Find(x => x.Name == item.UniqueName && x.Links == 6); if (uniqueArmourSearch6 != null) { item.PriceData.ChaosValue = uniqueArmourSearch6.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueArmourSearch6.Sparkline.TotalChange; } break; } break; case ItemTypes.UniqueFlask: var uniqueFlaskSearch = CollectedData.UniqueFlasks.Lines.Find(x => x.Name == item.UniqueName); if (uniqueFlaskSearch != null) { item.PriceData.ChaosValue = uniqueFlaskSearch.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueFlaskSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueJewel: var uniqueJewelSearch = CollectedData.UniqueJewels.Lines.Find(x => x.Name == item.UniqueName); if (uniqueJewelSearch != null) { item.PriceData.ChaosValue = uniqueJewelSearch.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueJewelSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueMap: var uniqueMapSearch = CollectedData.UniqueMaps.Lines.Find(x => x.BaseType == item.BaseName); if (uniqueMapSearch != null) { item.PriceData.ChaosValue = uniqueMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueMapSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueWeapon: switch (item.LargestLink) { case 0: case 1: case 2: case 3: case 4: var uniqueWeaponSearch04 = CollectedData.UniqueWeapons.Lines.Find(x => x.Name == item.UniqueName && x.Links <= 4 && x.Links >= 0); if (uniqueWeaponSearch04 != null) { item.PriceData.ChaosValue = uniqueWeaponSearch04.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueWeaponSearch04.Sparkline.TotalChange; } break; case 5: var uniqueWeaponSearch5 = CollectedData.UniqueWeapons.Lines.Find(x => x.Name == item.UniqueName && x.Links == 5); if (uniqueWeaponSearch5 != null) { item.PriceData.ChaosValue = uniqueWeaponSearch5.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueWeaponSearch5.Sparkline.TotalChange; } break; case 6: var uniqueWeaponSearch6 = CollectedData.UniqueWeapons.Lines.Find(x => x.Name == item.UniqueName && x.Links == 6); if (uniqueWeaponSearch6 != null) { item.PriceData.ChaosValue = uniqueWeaponSearch6.ChaosValue; item.PriceData.ChangeInLast7Days = uniqueWeaponSearch6.Sparkline.TotalChange; } break; } break; case ItemTypes.NormalMap: // TODO: Deal with old maps, this is literally the last thing i will do as it has next to no gain for having this information switch (item.MapInfo.IsShapedMap) { case true: var normalSharpedMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.BaseType == $"Shaped {item.BaseName}" && x.Variant == "Atlas2"); if (normalSharpedMapSearch != null) { item.PriceData.ChaosValue = normalSharpedMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = normalSharpedMapSearch.Sparkline.TotalChange; } break; case false: var normalMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.BaseType == item.BaseName && x.Variant == "Atlas2"); if (normalMapSearch != null) { item.PriceData.ChaosValue = normalMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = normalMapSearch.Sparkline.TotalChange; } break; } break; } } catch (Exception e) { if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.GetValue() Error that i dont understand", 5, Color.Red); } } }
public void GetValue(CustomItem item) { try { item.PriceData.ExaltedPrice = (double)CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == "Exalted Orb").ChaosEquivalent; if (item.BaseName.Contains("Infused Engineer's Orb") || item.BaseName.Contains("Rogue's Marker") || item.BaseName.Contains("Perandus Coin")) { item.PriceData.MinChaosValue = 0; } else { switch (item.ItemType) // easier to get data for each item type and handle logic based on that { // TODO: Complete case ItemTypes.Currency: if (item.BaseName.StartsWith("Chaos ")) // Chaos Orb or Shard { switch (item.CurrencyInfo.IsShard) { case false: item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize; break; case true: item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize / 20.0; break; } break; } if (item.BaseName.Contains("Ritual Splinter")) // Ritual { var shardParent = GetShardPartent(item.BaseName); var shardCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == shardParent); if (shardCurrencySearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)shardCurrencySearch.ChaosEquivalent / 100; item.PriceData.ChangeInLast7Days = (double)shardCurrencySearch.ReceiveSparkLine.TotalChange; } break; } switch (item.CurrencyInfo.IsShard) { case false: var normalCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (normalCurrencySearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)normalCurrencySearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)normalCurrencySearch.ReceiveSparkLine.TotalChange; } break; case true: var shardParent = GetShardPartent(item.BaseName); var shardCurrencySearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == shardParent); if (shardCurrencySearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)shardCurrencySearch.ChaosEquivalent / (item.CurrencyInfo.MaxStackSize > 0 ? item.CurrencyInfo.MaxStackSize : 20); item.PriceData.ChangeInLast7Days = (double)shardCurrencySearch.ReceiveSparkLine.TotalChange; } break; } break; case ItemTypes.Catalyst: var catalystSearch = CollectedData.Currency.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (catalystSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)catalystSearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)catalystSearch.ReceiveSparkLine.TotalChange; } break; case ItemTypes.DivinationCard: var divinationSearch = CollectedData.DivinationCards.Lines.Find(x => x.Name == item.BaseName); if (divinationSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)divinationSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)divinationSearch.Sparkline.TotalChange; } break; case ItemTypes.Essence: var essenceSearch = CollectedData.Essences.Lines.Find(x => x.Name == item.BaseName); if (essenceSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)essenceSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)essenceSearch.Sparkline.TotalChange; } break; case ItemTypes.Oil: var oilSearch = CollectedData.Oils.Lines.Find(x => x.Name == item.BaseName); if (oilSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)oilSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)oilSearch.Sparkline.TotalChange; } break; case ItemTypes.Fragment: var fragmentSearch = CollectedData.Fragments.Lines.Find(x => x.CurrencyTypeName == item.BaseName); if (fragmentSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)fragmentSearch.ChaosEquivalent; item.PriceData.ChangeInLast7Days = (double)fragmentSearch.ReceiveSparkLine.TotalChange; } break; case ItemTypes.MavenInvitation: var InvitationSearch = CollectedData.Invitations.Lines.Find(x => x.Name == item.BaseName); if (InvitationSearch != null) { item.PriceData.MinChaosValue = (double)InvitationSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)InvitationSearch.Sparkline.TotalChange; } break; case ItemTypes.DeliriumOrbs: var deliriumOrbsSearch = CollectedData.DeliriumOrb.Lines.Find(x => x.Name == item.BaseName); if (deliriumOrbsSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)deliriumOrbsSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)deliriumOrbsSearch.Sparkline.TotalChange; } break; case ItemTypes.Vials: var vialCurrencySearch = CollectedData.Vials.Lines.Find(x => x.Name == item.BaseName); if (vialCurrencySearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)vialCurrencySearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)vialCurrencySearch.Sparkline.TotalChange; } break; case ItemTypes.Incubator: var incubatorSearch = CollectedData.Incubators.Lines.Find(x => x.Name == item.BaseName); if (incubatorSearch != null) { item.PriceData.MinChaosValue = (double)incubatorSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)incubatorSearch.Sparkline.TotalChange; } break; case ItemTypes.Scarab: var scarabSearch = CollectedData.Scarabs.Lines.Find(x => x.Name == item.BaseName); if (scarabSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)scarabSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)scarabSearch.Sparkline.TotalChange; } break; case ItemTypes.Prophecy: var prophecySearch = CollectedData.Prophecies.Lines.Find(x => x.Name == item.Item.Item.GetComponent <Prophecy>().DatProphecy.Name); if (prophecySearch != null) { item.PriceData.MinChaosValue = (double)prophecySearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)prophecySearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueAccessory: var uniqueAccessorieSearch = CollectedData.UniqueAccessories.Lines.FindAll(x => x.Name == item.UniqueName && !x.DetailsId.Contains("-relic")); if (uniqueAccessorieSearch.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueAccessorieSearch[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueAccessorieSearch[0].Sparkline.TotalChange; } else if (uniqueAccessorieSearch.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueAccessorieSearch.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueAccessorieSearch.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case ItemTypes.UniqueArmour: switch (item.LargestLink) { case 0: case 1: case 2: case 3: case 4: var uniqueArmourSearchLinks04 = CollectedData.UniqueArmours.Lines.FindAll(x => x.Name == item.UniqueName && x.Links != 5 && x.Links != 6 && !x.DetailsId.Contains("-relic")); if (uniqueArmourSearchLinks04.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueArmourSearchLinks04[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueArmourSearchLinks04[0].Sparkline.TotalChange; } else if (uniqueArmourSearchLinks04.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueArmourSearchLinks04.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueArmourSearchLinks04.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case 5: var uniqueArmourSearchLinks05 = CollectedData.UniqueArmours.Lines.FindAll(x => x.Name == item.UniqueName && x.Links == 5 && !x.DetailsId.Contains("-relic")); if (uniqueArmourSearchLinks05.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueArmourSearchLinks05[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueArmourSearchLinks05[0].Sparkline.TotalChange; } else if (uniqueArmourSearchLinks05.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueArmourSearchLinks05.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueArmourSearchLinks05.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case 6: var uniqueArmourSearchLinks06 = CollectedData.UniqueArmours.Lines.FindAll(x => x.Name == item.UniqueName && x.Links == 6 && !x.DetailsId.Contains("-relic")); if (uniqueArmourSearchLinks06.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueArmourSearchLinks06[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueArmourSearchLinks06[0].Sparkline.TotalChange; } else if (uniqueArmourSearchLinks06.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueArmourSearchLinks06.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueArmourSearchLinks06.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; } break; case ItemTypes.UniqueFlask: var uniqueFlaskSearch = CollectedData.UniqueFlasks.Lines.FindAll(x => x.Name == item.UniqueName && !x.DetailsId.Contains("-relic")); if (uniqueFlaskSearch.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueFlaskSearch[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueFlaskSearch[0].Sparkline.TotalChange; } else if (uniqueFlaskSearch.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueFlaskSearch.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueFlaskSearch.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case ItemTypes.UniqueJewel: var uniqueJewelSearch = CollectedData.UniqueJewels.Lines.FindAll(x => x.Name == item.UniqueName && !x.DetailsId.Contains("-relic")); if (uniqueJewelSearch.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueJewelSearch[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueJewelSearch[0].Sparkline.TotalChange; } else if (uniqueJewelSearch.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueJewelSearch.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueJewelSearch.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case ItemTypes.UniqueMap: var uniqueMapSearch = CollectedData.UniqueMaps.Lines.FindAll(x => x.BaseType == item.UniqueName && item.MapInfo.MapTier == x.MapTier); if (uniqueMapSearch.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueMapSearch[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueMapSearch[0].Sparkline.TotalChange; } else if (uniqueMapSearch.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueMapSearch.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueMapSearch.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case ItemTypes.Resonator: var resonatorSearch = CollectedData.Resonators.Lines.Find(x => x.Name == item.BaseName); if (resonatorSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)resonatorSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)resonatorSearch.Sparkline.TotalChange; } break; case ItemTypes.Fossil: var fossilSearch = CollectedData.Fossils.Lines.Find(x => x.Name == item.BaseName); if (fossilSearch != null) { item.PriceData.MinChaosValue = item.CurrencyInfo.StackSize * (double)fossilSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)fossilSearch.Sparkline.TotalChange; } break; case ItemTypes.UniqueWeapon: switch (item.LargestLink) { case 0: case 1: case 2: case 3: case 4: var uniqueWeaponSearch04 = CollectedData.UniqueWeapons.Lines.FindAll(x => x.Name == item.UniqueName && x.Links != 5 && x.Links != 6 && !x.DetailsId.Contains("-relic")); if (uniqueWeaponSearch04.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueWeaponSearch04[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueWeaponSearch04[0].Sparkline.TotalChange; } else if (uniqueWeaponSearch04.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueWeaponSearch04.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueWeaponSearch04.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case 5: var uniqueWeaponSearch5 = CollectedData.UniqueWeapons.Lines.FindAll(x => x.Name == item.UniqueName && x.Links == 5 && !x.DetailsId.Contains("-relic")); if (uniqueWeaponSearch5.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueWeaponSearch5[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueWeaponSearch5[0].Sparkline.TotalChange; } else if (uniqueWeaponSearch5.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueWeaponSearch5.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueWeaponSearch5.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; case 6: var uniqueWeaponSearch6 = CollectedData.UniqueWeapons.Lines.FindAll(x => x.Name == item.UniqueName && x.Links == 6 && !x.DetailsId.Contains("-relic")); if (uniqueWeaponSearch6.Count() == 1) { item.PriceData.MinChaosValue = (double)uniqueWeaponSearch6[0].ChaosValue; item.PriceData.ChangeInLast7Days = (double)uniqueWeaponSearch6[0].Sparkline.TotalChange; } else if (uniqueWeaponSearch6.Count() > 1) { item.PriceData.MinChaosValue = (double)uniqueWeaponSearch6.OrderBy(x => x.ChaosValue).First().ChaosValue; item.PriceData.MaxChaosValue = (double)uniqueWeaponSearch6.OrderBy(x => x.ChaosValue).Last().ChaosValue; item.PriceData.ChangeInLast7Days = 0; } else { item.PriceData.MinChaosValue = 0; item.PriceData.ChangeInLast7Days = 0; } break; } break; case ItemTypes.Map: switch (item.MapInfo.MapType) { case MapTypes.Blighted: WhiteMaps.Line normalBlightedMapSearch; if (Settings.MapVariant.Value) { normalBlightedMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.BaseType == $"Blighted {item.BaseName}" && item.MapInfo.MapTier == x.MapTier && x.Variant == Settings.LeagueList.Value); } else { normalBlightedMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.BaseType == $"Blighted {item.BaseName}" && item.MapInfo.MapTier == x.MapTier); } if (normalBlightedMapSearch != null) { item.PriceData.MinChaosValue = (double)normalBlightedMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)normalBlightedMapSearch.Sparkline.TotalChange; } break; case MapTypes.None: WhiteMaps.Line normalMapSearch; if (Settings.MapVariant.Value) { normalMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.BaseType == item.BaseName && item.MapInfo.MapTier == x.MapTier && x.Variant == Settings.LeagueList.Value); } else { normalMapSearch = CollectedData.WhiteMaps.Lines.Find(x => x.BaseType == item.BaseName && item.MapInfo.MapTier == x.MapTier); } if (normalMapSearch != null) { item.PriceData.MinChaosValue = (double)normalMapSearch.ChaosValue; item.PriceData.ChangeInLast7Days = (double)normalMapSearch.Sparkline.TotalChange; } break; } break; } } } catch (Exception) { if (Settings.Debug) { LogMessage($"{GetCurrentMethod()}.GetValue()", 5, Color.Red); } } finally { if (item.PriceData.MaxChaosValue == 0) { item.PriceData.MaxChaosValue = item.PriceData.MinChaosValue; } } }