private void CraftButton_Click(object sender, RoutedEventArgs e) { BigBox.Text = ""; object c = CurrencyBox.GetSelected(); if (c == null) { BigBox.Text = "No currency selected"; return; } string res; if (c is PoEEssenceData) { res = Bench.ApplyEssence(c as PoEEssenceData); if (res != null) { BigBox.Text = res; } } else if (c is PoECurrencyData) { res = Bench.ApplyCurrency(c as PoECurrencyData); if (res != null) { BigBox.Text = res; } } else { IEnumerable <PoEFossilData> collection = ((System.Collections.IList)c).Cast <PoEFossilData>(); if (collection != null && collection.Count() > 0) { res = Bench.ApplyFossils(collection.ToList()); if (res != null) { BigBox.Text = res; } } else { BigBox.Text = "No fossil selected"; return; } } if (res == null) { ItemSlot.UpdateData(Bench.BenchItem); CollectionViewSource.GetDefaultView(Bench.CurrencySpent).Refresh(); ModPreview.UpdatePreviews(); } }
private void Repeat_Click(object sender, RoutedEventArgs e) { BigBox.Text = ""; object c = CurrencyBox.GetSelected(); if (c == null) { BigBox.Text = "No currency selected"; return; } if (!RepeatCountBox.Valid || !int.TryParse(RepeatCountBox.Text, out int n)) { BigBox.Text = "Error parsing try count"; return; } string res; if (c is PoEEssenceData) { res = Bench.ApplyEssence(c as PoEEssenceData, n); if (res != null) { BigBox.Text = res; } } else if (c is PoECurrencyData) { res = Bench.ApplyCurrency(c as PoECurrencyData, n); if (res != null) { BigBox.Text = res; } } else { IEnumerable <PoEFossilData> collection = ((System.Collections.IList)c).Cast <PoEFossilData>(); if (collection != null && collection.Count() > 0) { res = Bench.ApplyFossils(collection.ToList(), n); if (res != null) { BigBox.Text = res; } } else { BigBox.Text = "No fossil selected"; return; } } if (res == null) { if (c is PoECurrencyData data) { RepeatResults.CurrenciesUsed = new List <PoECurrencyData>() { data } } ; else { //Resonators aren't implemented as actual currencies so just tack their names on to be counted for costs List <PoECurrencyData> fossils = ((System.Collections.IList)c).Cast <PoECurrencyData>().ToList(); if (fossils.Count == 1) { if (Bench.BenchItem.Rarity == ItemRarity.Normal) { fossils.Add(new PoECurrencyData() { name = "Primitive Alchemical Resonator" }); } else { fossils.Add(new PoECurrencyData() { name = "Primitive Chaotic Resonator" }); } } else if (fossils.Count == 2) { if (Bench.BenchItem.Rarity == ItemRarity.Normal) { fossils.Add(new PoECurrencyData() { name = "Potent Alchemical Resonator" }); } else { fossils.Add(new PoECurrencyData() { name = "Potent Chaotic Resonator" }); } } else if (fossils.Count == 3) { if (Bench.BenchItem.Rarity == ItemRarity.Normal) { fossils.Add(new PoECurrencyData() { name = "Powerful Alchemical Resonator" }); } else { fossils.Add(new PoECurrencyData() { name = "Powerful Chaotic Resonator" }); } } else { if (Bench.BenchItem.Rarity == ItemRarity.Normal) { fossils.Add(new PoECurrencyData() { name = "Prime Alchemical Resonator" }); } else { fossils.Add(new PoECurrencyData() { name = "Prime Chaotic Resonator" }); } } RepeatResults.CurrenciesUsed = fossils; } RepeatResults.SortBy = null; RepeatResults.Items = Bench.MassResults; } }