private static IList <ItemInfo> fetchProspects(SearchConfig search) { // get rarities IList <Rarity> rarities = new RarityListRequest().Execute().Results; // get types IList <ItemType> types = new TypeListRequest().Execute().Results; // get all armors that i want to sell IList <ItemInfo> items = new FullItemListRequest().Execute() .Results .Where(i => (search.Types.Count == 0 ? true : types.Where(t => search.Types.Contains(t.Name)).Select(t => t.Id).Contains(i.TypeId))) .Where(i => (search.Rarities.Count == 0 ? true : rarities.Where(r => search.Rarities.Contains(r.Name)).Select(r => r.Id).Contains(i.Rarity))) .Where(i => (search.MaximumLevel < 0 ? true : i.RestrictionLevel <= search.MaximumLevel) && (search.MinimumLevel < 0 ? true : i.RestrictionLevel >= search.MinimumLevel)) .Where(i => i.OfferAvailability > 0 && i.SaleAvailability > 0) .Select <ItemData, ItemInfo>(a => ItemInfo.FromItemData(a, rarities, types)) .Where(a => (search.MinimumProfitMargin < 0 ? true : (search.MarginIsPercent ? a.ProfitMargin >= a.BuyPrice * (search.MinimumProfitMargin / 100.0) : a.ProfitMargin >= search.MinimumProfitMargin))) .OrderBy(a => a.BuyPrice) .ToList(); return(items); }
public override void Run() { // get data ItemType typeUC = GetItemType("Upgrade Component"); IList<ItemData> upgrade_components = new FullItemListRequest(typeUC) .Execute() .Results .ToList(); IList<ItemData> major_sigils = upgrade_components .Where(i => i.Name.StartsWith("Major Sigil of")) .ToList(); IList<ItemData> superior_sigils = upgrade_components .Where(i => i.Name.StartsWith("Superior Sigil of")) .ToList(); Console.WriteLine("Gathering Data:"); Console.Write(" Capital [10 00 00]: "); string sCapital = Console.ReadLine(); int capital; if (!int.TryParse(sCapital.Replace(" ", string.Empty).Trim(), out capital)) capital = 100000; Console.WriteLine("Calculating using the following:"); Console.WriteLine(" Capital: {0}", capital.ToString("#### ## #0").Trim()); int buy_price = major_sigils.Select<ItemData, int>(i => i.MaxOfferUnitPrice).Min(); int sell_price = (int)Math.Floor(superior_sigils.Select<ItemData, int>(i => i.MinSaleUnitPrice).Average()); int total_available = (int)Math.Floor((double)capital / (double)buy_price); int total_cost = buy_price * total_available; Console.WriteLine("Rare sigil buy price (based on cheapest rare sigils): {0}", buy_price.ToString("#### ## #0").Trim()); Console.WriteLine("Exotic sigil sell price (based on average exotic sigils): {0}", sell_price.ToString("#### ## #0").Trim()); Console.WriteLine("Total sigils purchased: {0}", total_available); Console.WriteLine("Total cost: {0}", total_cost.ToString("#### ## #0").Trim()); double drop_rate = 0.2; // mystic forge loop int total_sellables = 0; int total_forges = 0; while (total_available >= 4) { // how many sigils we get back int returns = total_available / 4; // remainder total_available %= 4; // how many sellables we should get int sellables = (int)Math.Floor((double)returns * drop_rate); total_available += (returns - sellables); total_sellables += sellables; total_forges += returns; } Console.WriteLine("Estimated forges: {0}", total_forges); Console.WriteLine("Estimated sellables: {0}", total_sellables); int total_revenue = (int)Math.Floor(total_sellables * sell_price * 0.85); int total_profit = total_revenue - total_cost; Console.WriteLine("Estimates:"); Console.WriteLine(" Revenue: {0}", total_revenue.ToString("#### ## #0").Trim()); Console.WriteLine(" Profit: {0}", total_profit.ToString("#### ## #0").Trim()); }
public override void Run() { string sMinLevel, sMaxLevel; int minLevel, maxLevel; Rarity rarity; Console.WriteLine("Gathering search data:"); Console.Write(" Rarity [Exotic]: "); rarity = GetRarity(Console.ReadLine()); Console.Write(" Minimum Level [80]: "); sMinLevel = Console.ReadLine(); Console.Write(" Maximum Level [80]: "); sMaxLevel = Console.ReadLine(); if (rarity.Id < 0) { rarity = GetRarity("Exotic"); } if (!int.TryParse(sMinLevel, out minLevel)) { minLevel = 80; } if (!int.TryParse(sMaxLevel, out maxLevel)) { maxLevel = 80; } Console.WriteLine("Pulling averages for the following data:"); Console.WriteLine(" Rarity: {0}", rarity.Name); Console.WriteLine(" Minimum Level: {0}", minLevel); Console.WriteLine(" Maximum Level: {0}", maxLevel); IList <ItemData> all_items = new FullItemListRequest().Execute().Results .Where(i => i.RestrictionLevel <= maxLevel && i.RestrictionLevel >= minLevel) .Where(i => i.Rarity == rarity.Id) .Where(i => i.OfferAvailability > 0 && i.SaleAvailability > 0) .ToList(); Console.WriteLine("Averages:"); Console.WriteLine("{0,-10} | {1,-10} | {2}", "Avg Buy", "Avg Sell", "Type"); Console.WriteLine("-----------+------------+-----------------------------"); foreach (ItemType type in Types) { IList <ItemData> items = all_items.Where(a => a.TypeId == type.Id).ToList(); if (items.Count == 0) { continue; } int avg_buy = (int)Math.Floor(items.Select <ItemData, int>(i => i.MaxOfferUnitPrice).InterquartileMean()); int avg_sell = (int)Math.Floor(items.Select <ItemData, int>(i => i.MinSaleUnitPrice).InterquartileMean()); Console.WriteLine("{0,10} | {1,10} | {2}", avg_buy.ToString("#### ## #0").Trim(), avg_sell.ToString("#### ## #0").Trim(), type.Name); foreach (ItemSubType sub_type in type.SubTypes) { IList <ItemData> sub_items = items.Where(a => a.SubTypeId == sub_type.Id).ToList(); if (sub_items.Count == 0) { continue; } int sub_avg_buy = (int)Math.Floor(sub_items.Select <ItemData, int>(i => i.MaxOfferUnitPrice).InterquartileMean()); int sub_avg_sell = (int)Math.Floor(sub_items.Select <ItemData, int>(i => i.MinSaleUnitPrice).InterquartileMean()); Console.WriteLine("{0,10} | {1,10} | {2}", sub_avg_buy.ToString("#### ## #0").Trim(), sub_avg_sell.ToString("#### ## #0").Trim(), sub_type.Name); } Console.WriteLine("-----------+------------+-----------------------------"); } }
private static IList<ItemInfo> fetchProspects(SearchConfig search) { // get rarities IList<Rarity> rarities = new RarityListRequest().Execute().Results; // get types IList<ItemType> types = new TypeListRequest().Execute().Results; // get all armors that i want to sell IList<ItemInfo> items = new FullItemListRequest().Execute() .Results .Where(i => (search.Types.Count == 0 ? true : types.Where(t => search.Types.Contains(t.Name)).Select(t => t.Id).Contains(i.TypeId))) .Where(i => (search.Rarities.Count == 0 ? true : rarities.Where(r => search.Rarities.Contains(r.Name)).Select(r => r.Id).Contains(i.Rarity))) .Where(i => (search.MaximumLevel < 0 ? true : i.RestrictionLevel <= search.MaximumLevel) && (search.MinimumLevel < 0 ? true : i.RestrictionLevel >= search.MinimumLevel)) .Where(i => i.OfferAvailability > 0 && i.SaleAvailability > 0) .Select<ItemData, ItemInfo>(a => ItemInfo.FromItemData(a, rarities, types)) .Where(a => (search.MinimumProfitMargin < 0 ? true : (search.MarginIsPercent ? a.ProfitMargin >= a.BuyPrice * (search.MinimumProfitMargin / 100.0) : a.ProfitMargin >= search.MinimumProfitMargin))) .OrderBy(a => a.BuyPrice) .ToList(); return items; }
public override void Run() { string sMinLevel, sMaxLevel; int minLevel, maxLevel; Rarity rarity; Console.WriteLine("Gathering search data:"); Console.Write(" Rarity [Exotic]: "); rarity = GetRarity(Console.ReadLine()); Console.Write(" Minimum Level [80]: "); sMinLevel = Console.ReadLine(); Console.Write(" Maximum Level [80]: "); sMaxLevel = Console.ReadLine(); if (rarity.Id < 0) rarity = GetRarity("Exotic"); if (!int.TryParse(sMinLevel, out minLevel)) minLevel = 80; if (!int.TryParse(sMaxLevel, out maxLevel)) maxLevel = 80; Console.WriteLine("Pulling averages for the following data:"); Console.WriteLine(" Rarity: {0}", rarity.Name); Console.WriteLine(" Minimum Level: {0}", minLevel); Console.WriteLine(" Maximum Level: {0}", maxLevel); IList<ItemData> all_items = new FullItemListRequest().Execute().Results .Where(i => i.RestrictionLevel <= maxLevel && i.RestrictionLevel >= minLevel) .Where(i => i.Rarity == rarity.Id) .Where(i => i.OfferAvailability > 0 && i.SaleAvailability > 0) .ToList(); Console.WriteLine("Averages:"); Console.WriteLine("{0,-10} | {1,-10} | {2}", "Avg Buy", "Avg Sell", "Type"); Console.WriteLine("-----------+------------+-----------------------------"); foreach (ItemType type in Types) { IList<ItemData> items = all_items.Where(a => a.TypeId == type.Id).ToList(); if (items.Count == 0) continue; int avg_buy = (int)Math.Floor(items.Select<ItemData, int>(i => i.MaxOfferUnitPrice).InterquartileMean()); int avg_sell = (int)Math.Floor(items.Select<ItemData, int>(i => i.MinSaleUnitPrice).InterquartileMean()); Console.WriteLine("{0,10} | {1,10} | {2}", avg_buy.ToString("#### ## #0").Trim(), avg_sell.ToString("#### ## #0").Trim(), type.Name); foreach (ItemSubType sub_type in type.SubTypes) { IList<ItemData> sub_items = items.Where(a => a.SubTypeId == sub_type.Id).ToList(); if (sub_items.Count == 0) continue; int sub_avg_buy = (int)Math.Floor(sub_items.Select<ItemData, int>(i => i.MaxOfferUnitPrice).InterquartileMean()); int sub_avg_sell = (int)Math.Floor(sub_items.Select<ItemData, int>(i => i.MinSaleUnitPrice).InterquartileMean()); Console.WriteLine("{0,10} | {1,10} | {2}", sub_avg_buy.ToString("#### ## #0").Trim(), sub_avg_sell.ToString("#### ## #0").Trim(), sub_type.Name); } Console.WriteLine("-----------+------------+-----------------------------"); } }
public override void Run() { // get data ItemType typeA = GetItemType("Armor"); ItemType typeW = GetItemType("Weapon"); IList<ItemData> armor = new FullItemListRequest(typeA).Execute().Results; IList<ItemData> weapons = new FullItemListRequest(typeW).Execute().Results; Console.WriteLine("Gathering Data:"); Console.Write(" Capital [10 00 00]: "); string sCapital = Console.ReadLine(); Console.Write(" Maximum buy price [2 00]: "); string sMaxBuyPrice = Console.ReadLine(); Console.Write(" Buy rarity [Masterwork]: "); Rarity rarityB = GetRarity(Console.ReadLine()); int capital, max_buy_price; if (!int.TryParse(sCapital.Replace(" ", string.Empty).Trim(), out capital)) capital = 100000; if (!int.TryParse(sMaxBuyPrice.Replace(" ", string.Empty).Trim(), out max_buy_price)) max_buy_price = 200; if (rarityB.Id < 0) rarityB = GetRarity("Masterwork"); Rarity rarityS = GetPromotedRarity(rarityB); Console.WriteLine("Calculating using the following:"); Console.WriteLine(" Capital: {0}", capital.ToString("#### ## #0").Trim()); Console.WriteLine(" Maximum buy price: {0}", max_buy_price.ToString("#### ## #0").Trim()); Console.WriteLine(" Buy rarity: {0}", rarityB.Name); Console.WriteLine(" Sell rarity: {0}", rarityS.Name); IDictionary<int, int> buy_level_profits = new Dictionary<int, int>(); for (int min_buy_level = (68 - 5); min_buy_level <= 68; min_buy_level++) { Console.WriteLine("Performing speculation on minimum buy level: {0}", min_buy_level); int min_forge_level = min_buy_level + 5; int max_forge_level = min_buy_level + 12; Console.WriteLine(" Forged item range: {0} - {1}", min_forge_level, max_forge_level); IList<ItemData> buy_weapons = weapons .Where(i => i.Rarity == rarityB.Id && i.MinSaleUnitPrice > 0 && i.RestrictionLevel >= min_buy_level) .ToList(); IList<ItemData> sell_weapons = weapons .Where(i => i.Rarity == rarityS.Id && i.MinSaleUnitPrice > 0 && i.RestrictionLevel >= min_forge_level && i.RestrictionLevel <= max_forge_level) .ToList(); int buy_price = (int)Math.Floor((double)(buy_weapons.Select<ItemData, int>(i => i.MinSaleUnitPrice).Min() + max_buy_price)/2.0); int sell_price = (int)Math.Floor(sell_weapons.Select<ItemData, int>(i => i.MinSaleUnitPrice).InterquartileMean()); int total_available = (int)Math.Floor((double)capital / (double)buy_price); int total_cost = buy_price * total_available; Console.WriteLine(" {0} Weapon buy price (based on average of cheapest and maximum buy price): {1}", rarityB.Name, buy_price.ToString("#### ## #0").Trim()); Console.WriteLine(" {0} Weapon sell price (based on IQM of current sale prices): {1}", rarityS.Name, sell_price.ToString("#### ## #0").Trim()); Console.WriteLine(" Total weapons purchased: {0}", total_available); Console.WriteLine(" Total cost: {0}", total_cost.ToString("#### ## #0").Trim()); // mystic forge loop int total_rares = 0; int total_forges = 0; while (total_available >= 4) { // how many weapons we get back int returns = total_available / 4; // remainder total_available %= 4; // how many sellables we should get int upgrades = (int)Math.Floor((double)returns * PromotionRate); total_available += (returns - upgrades); total_rares += upgrades; total_forges += returns; } Console.WriteLine(" Estimated forges: {0}", total_forges); Console.WriteLine(" Estimated rares: {0}", total_rares); int total_rare_revenue = (int)Math.Floor(total_rares * sell_price * 0.85); int total_profit = total_rare_revenue - total_cost; Console.WriteLine(" Estimated Revenue: {0}", total_rare_revenue.ToString("#### ## #0").Trim()); Console.WriteLine(" Estimated Profit: {0}", total_profit.ToString("#### ## #0").Trim()); buy_level_profits[total_profit] = min_buy_level; } int suggested_min_buy_level = buy_level_profits[buy_level_profits.Keys.Max()]; Console.WriteLine("Suggested minimum buy level: {0}", suggested_min_buy_level); }
public override void Run() { // get data ItemType typeUC = GetItemType("Upgrade Component"); IList <ItemData> upgrade_components = new FullItemListRequest(typeUC) .Execute() .Results .ToList(); IList <ItemData> major_runes = upgrade_components .Where(i => i.Name.StartsWith("Major Rune of")) .ToList(); IList <ItemData> superior_runes = upgrade_components .Where(i => i.Name.StartsWith("Superior Rune of")) .ToList(); Console.WriteLine("Gathering Data:"); Console.Write(" Capital [10 00 00]: "); string sCapital = Console.ReadLine(); int capital; if (!int.TryParse(sCapital.Replace(" ", string.Empty).Trim(), out capital)) { capital = 100000; } Console.WriteLine("Calculating using the following:"); Console.WriteLine(" Capital: {0}", capital.ToString("#### ## #0").Trim()); int buy_price = major_runes.Select <ItemData, int>(i => i.MaxOfferUnitPrice).Min(); int sell_price = (int)Math.Floor(superior_runes.Select <ItemData, int>(i => i.MinSaleUnitPrice).Average()); int total_available = (int)Math.Floor((double)capital / (double)buy_price); int total_cost = buy_price * total_available; Console.WriteLine("Rare rune buy price (based on cheapest rare rune): {0}", buy_price.ToString("#### ## #0").Trim()); Console.WriteLine("Exotic rune sell price (based on average exotic rune): {0}", sell_price.ToString("#### ## #0").Trim()); Console.WriteLine("Total rune purchased: {0}", total_available); Console.WriteLine("Total cost: {0}", total_cost.ToString("#### ## #0").Trim()); double drop_rate = 0.2; // mystic forge loop int total_sellables = 0; int total_forges = 0; while (total_available >= 4) { // how many sigils we get back int returns = total_available / 4; // remainder total_available %= 4; // how many sellables we should get int sellables = (int)Math.Floor((double)returns * drop_rate); total_available += (returns - sellables); total_sellables += sellables; total_forges += returns; } Console.WriteLine("Estimated forges: {0}", total_forges); Console.WriteLine("Estimated sellables: {0}", total_sellables); int total_revenue = (int)Math.Floor(total_sellables * sell_price * 0.85); int total_profit = total_revenue - total_cost; Console.WriteLine("Estimates:"); Console.WriteLine(" Revenue: {0}", total_revenue.ToString("#### ## #0").Trim()); Console.WriteLine(" Profit: {0}", total_profit.ToString("#### ## #0").Trim()); }
public static void Main(string[] args) { string sType, sSubtype, sRarity, sLevel, sBuy, sSell, sMargin; Interval level = new Interval("[75,inf)"); Interval buy = new Interval("(-inf,3000)"); Interval sell = new Interval("(-inf,inf)"); Interval margin = new Interval("(-inf,inf)"); Console.WriteLine("Gathering search data:"); Console.Write(" Type [Weapon/Staff]: "); sType = Console.ReadLine(); Console.Write(" Rarity [Rare]: "); sRarity = Console.ReadLine(); Console.Write(" Level Range [{0}]: ", level.ToString()); sLevel = Console.ReadLine(); Console.Write(" Buy Offer Range [{0}]: ", buy.ToString()); sBuy = Console.ReadLine(); Console.Write(" Sell Offer Range [{0}]: ", sell.ToString()); sSell = Console.ReadLine(); Console.Write(" Margin Range [{0}]: ", margin.ToString()); sMargin = Console.ReadLine(); if (string.IsNullOrWhiteSpace(sType)) { sType = "Weapon/Staff"; } if (string.IsNullOrWhiteSpace(sRarity)) { sRarity = "Rare"; } if (!string.IsNullOrWhiteSpace(sLevel)) { level.Parse(sLevel); } if (!string.IsNullOrWhiteSpace(sBuy)) { buy.Parse(sBuy); } if (!string.IsNullOrWhiteSpace(sSell)) { sell.Parse(sSell); } if (!string.IsNullOrWhiteSpace(sMargin)) { margin.Parse(sMargin); } if (sType == "*") { sType = null; sSubtype = null; } else if (sType.Contains("/")) { string[] s = sType.Split('/'); sType = s[0]; sSubtype = s[1]; } else { sSubtype = null; } if (sRarity == "*") { sRarity = null; } // get type ItemType type = null; if (!string.IsNullOrWhiteSpace(sType)) { type = new TypeListRequest().Execute() .Results .Where(t => string.Equals(t.Name, sType, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); } // get subtype ItemSubType subtype = null; if (type != null && !string.IsNullOrWhiteSpace(sSubtype)) { subtype = type.SubTypes .Where(st => string.Equals(st.Name, sSubtype, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); } // get rarity Rarity rarity = null; if (!string.IsNullOrWhiteSpace(sRarity)) { rarity = new RarityListRequest().Execute() .Results .Where(r => string.Equals(r.Name, sRarity, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); } Console.WriteLine("Finding items for the following data:"); Console.WriteLine(" Type: {0}", (type == null ? "*" : type.Name)); Console.WriteLine(" Subtype: {0}", (subtype == null ? "*" : subtype.Name)); Console.WriteLine(" Rarity: {0}", (rarity == null ? "*" : rarity.Name)); Console.WriteLine(" Level Range: {0}", level.ToString()); Console.WriteLine(" Buy Offer Range: {0}", buy.ToString()); Console.WriteLine(" Sell Offer Range: {0}", sell.ToString()); Console.WriteLine(" Margin Range: {0}", margin.ToString()); Console.WriteLine(" Order by: Sell price, ascending"); // get all armors that i want to sell IList <ItemData> items = new FullItemListRequest(type).Execute() .Results .Where(i => subtype == null || i.SubTypeId == subtype.Id) .Where(i => rarity == null || i.Rarity == rarity.Id) .Where(i => level.Contains(i.RestrictionLevel)) .Where(i => buy.Contains(i.MaxOfferUnitPrice)) .Where(i => sell.Contains(i.MinSaleUnitPrice)) .Where(i => margin.Contains((int)(i.MinSaleUnitPrice * 0.85) - i.MaxOfferUnitPrice)) .OrderBy(i => i.MinSaleUnitPrice) .ToList(); if (items.Count > 0) { Console.WriteLine("Found {0} items. Press any key to view the next result (Esc to exit):", items.Count); Console.WriteLine("{0,-10} | {1,-10} | {2,-10} | {3,-5} | {4}", "Sell", "Buy", "Margin", "Level", "Name"); foreach (ItemData item in items) { Console.WriteLine(string.Format("{0,10} | {1,10} | {2,10} | {3,5} | {4}", item.MinSaleUnitPrice.ToString("#### ## #0").Trim(), item.MaxOfferUnitPrice.ToString("#### ## #0").Trim(), ((int)(item.MinSaleUnitPrice * 0.85) - item.MaxOfferUnitPrice).ToString("#### ## #0").Trim(), item.RestrictionLevel, item.Name)); ConsoleKeyInfo key = Console.ReadKey(true); if (key.Key == ConsoleKey.Escape) { break; } } } else { Console.WriteLine("Found 0 items. Press any key to exit."); Console.ReadKey(true); } }
public override void Run() { // get data ItemType typeA = GetItemType("Armor"); ItemType typeW = GetItemType("Weapon"); IList <ItemData> armor = new FullItemListRequest(typeA).Execute().Results; IList <ItemData> weapons = new FullItemListRequest(typeW).Execute().Results; Console.WriteLine("Gathering Data:"); Console.Write(" Capital [10 00 00]: "); string sCapital = Console.ReadLine(); Console.Write(" Maximum buy price [2 00]: "); string sMaxBuyPrice = Console.ReadLine(); Console.Write(" Buy rarity [Masterwork]: "); Rarity rarityB = GetRarity(Console.ReadLine()); int capital, max_buy_price; if (!int.TryParse(sCapital.Replace(" ", string.Empty).Trim(), out capital)) { capital = 100000; } if (!int.TryParse(sMaxBuyPrice.Replace(" ", string.Empty).Trim(), out max_buy_price)) { max_buy_price = 200; } if (rarityB.Id < 0) { rarityB = GetRarity("Masterwork"); } Rarity rarityS = GetPromotedRarity(rarityB); Console.WriteLine("Calculating using the following:"); Console.WriteLine(" Capital: {0}", capital.ToString("#### ## #0").Trim()); Console.WriteLine(" Maximum buy price: {0}", max_buy_price.ToString("#### ## #0").Trim()); Console.WriteLine(" Buy rarity: {0}", rarityB.Name); Console.WriteLine(" Sell rarity: {0}", rarityS.Name); IDictionary <int, int> buy_level_profits = new Dictionary <int, int>(); for (int min_buy_level = (68 - 5); min_buy_level <= 68; min_buy_level++) { Console.WriteLine("Performing speculation on minimum buy level: {0}", min_buy_level); int min_forge_level = min_buy_level + 5; int max_forge_level = min_buy_level + 12; Console.WriteLine(" Forged item range: {0} - {1}", min_forge_level, max_forge_level); IList <ItemData> buy_weapons = weapons .Where(i => i.Rarity == rarityB.Id && i.MinSaleUnitPrice > 0 && i.RestrictionLevel >= min_buy_level) .ToList(); IList <ItemData> sell_weapons = weapons .Where(i => i.Rarity == rarityS.Id && i.MinSaleUnitPrice > 0 && i.RestrictionLevel >= min_forge_level && i.RestrictionLevel <= max_forge_level) .ToList(); int buy_price = (int)Math.Floor((double)(buy_weapons.Select <ItemData, int>(i => i.MinSaleUnitPrice).Min() + max_buy_price) / 2.0); int sell_price = (int)Math.Floor(sell_weapons.Select <ItemData, int>(i => i.MinSaleUnitPrice).InterquartileMean()); int total_available = (int)Math.Floor((double)capital / (double)buy_price); int total_cost = buy_price * total_available; Console.WriteLine(" {0} Weapon buy price (based on average of cheapest and maximum buy price): {1}", rarityB.Name, buy_price.ToString("#### ## #0").Trim()); Console.WriteLine(" {0} Weapon sell price (based on IQM of current sale prices): {1}", rarityS.Name, sell_price.ToString("#### ## #0").Trim()); Console.WriteLine(" Total weapons purchased: {0}", total_available); Console.WriteLine(" Total cost: {0}", total_cost.ToString("#### ## #0").Trim()); // mystic forge loop int total_rares = 0; int total_forges = 0; while (total_available >= 4) { // how many weapons we get back int returns = total_available / 4; // remainder total_available %= 4; // how many sellables we should get int upgrades = (int)Math.Floor((double)returns * PromotionRate); total_available += (returns - upgrades); total_rares += upgrades; total_forges += returns; } Console.WriteLine(" Estimated forges: {0}", total_forges); Console.WriteLine(" Estimated rares: {0}", total_rares); int total_rare_revenue = (int)Math.Floor(total_rares * sell_price * 0.85); int total_profit = total_rare_revenue - total_cost; Console.WriteLine(" Estimated Revenue: {0}", total_rare_revenue.ToString("#### ## #0").Trim()); Console.WriteLine(" Estimated Profit: {0}", total_profit.ToString("#### ## #0").Trim()); buy_level_profits[total_profit] = min_buy_level; } int suggested_min_buy_level = buy_level_profits[buy_level_profits.Keys.Max()]; Console.WriteLine("Suggested minimum buy level: {0}", suggested_min_buy_level); }
public static void Main(string[] args) { string sType, sSubtype, sRarity, sLevel, sBuy, sSell, sMargin; Interval level = new Interval("[75,inf)"); Interval buy = new Interval("(-inf,3000)"); Interval sell = new Interval("(-inf,inf)"); Interval margin = new Interval("(-inf,inf)"); Console.WriteLine("Gathering search data:"); Console.Write(" Type [Weapon/Staff]: "); sType = Console.ReadLine(); Console.Write(" Rarity [Rare]: "); sRarity = Console.ReadLine(); Console.Write(" Level Range [{0}]: ", level.ToString()); sLevel = Console.ReadLine(); Console.Write(" Buy Offer Range [{0}]: ", buy.ToString()); sBuy = Console.ReadLine(); Console.Write(" Sell Offer Range [{0}]: ", sell.ToString()); sSell = Console.ReadLine(); Console.Write(" Margin Range [{0}]: ", margin.ToString()); sMargin = Console.ReadLine(); if (string.IsNullOrWhiteSpace(sType)) sType = "Weapon/Staff"; if (string.IsNullOrWhiteSpace(sRarity)) sRarity = "Rare"; if (!string.IsNullOrWhiteSpace(sLevel)) level.Parse(sLevel); if (!string.IsNullOrWhiteSpace(sBuy)) buy.Parse(sBuy); if (!string.IsNullOrWhiteSpace(sSell)) sell.Parse(sSell); if (!string.IsNullOrWhiteSpace(sMargin)) margin.Parse(sMargin); if (sType == "*") { sType = null; sSubtype = null; } else if (sType.Contains("/")) { string[] s = sType.Split('/'); sType = s[0]; sSubtype = s[1]; } else { sSubtype = null; } if (sRarity == "*") sRarity = null; // get type ItemType type = null; if (!string.IsNullOrWhiteSpace(sType)) type = new TypeListRequest().Execute() .Results .Where(t => string.Equals(t.Name, sType, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); // get subtype ItemSubType subtype = null; if (type != null && !string.IsNullOrWhiteSpace(sSubtype)) subtype = type.SubTypes .Where(st => string.Equals(st.Name, sSubtype, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); // get rarity Rarity rarity = null; if (!string.IsNullOrWhiteSpace(sRarity)) rarity = new RarityListRequest().Execute() .Results .Where(r => string.Equals(r.Name, sRarity, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); Console.WriteLine("Finding items for the following data:"); Console.WriteLine(" Type: {0}", (type == null ? "*" : type.Name)); Console.WriteLine(" Subtype: {0}", (subtype == null ? "*" : subtype.Name)); Console.WriteLine(" Rarity: {0}", (rarity == null ? "*" : rarity.Name)); Console.WriteLine(" Level Range: {0}", level.ToString()); Console.WriteLine(" Buy Offer Range: {0}", buy.ToString()); Console.WriteLine(" Sell Offer Range: {0}", sell.ToString()); Console.WriteLine(" Margin Range: {0}", margin.ToString()); Console.WriteLine(" Order by: Sell price, ascending"); // get all armors that i want to sell IList<ItemData> items = new FullItemListRequest(type).Execute() .Results .Where(i => subtype == null || i.SubTypeId == subtype.Id) .Where(i => rarity == null || i.Rarity == rarity.Id) .Where(i => level.Contains(i.RestrictionLevel)) .Where(i => buy.Contains(i.MaxOfferUnitPrice)) .Where(i => sell.Contains(i.MinSaleUnitPrice)) .Where(i => margin.Contains((int)(i.MinSaleUnitPrice * 0.85) - i.MaxOfferUnitPrice)) .OrderBy(i => i.MinSaleUnitPrice) .ToList(); if (items.Count > 0) { Console.WriteLine("Found {0} items. Press any key to view the next result (Esc to exit):", items.Count); Console.WriteLine("{0,-10} | {1,-10} | {2,-10} | {3,-5} | {4}", "Sell", "Buy", "Margin", "Level", "Name"); foreach (ItemData item in items) { Console.WriteLine(string.Format("{0,10} | {1,10} | {2,10} | {3,5} | {4}", item.MinSaleUnitPrice.ToString("#### ## #0").Trim(), item.MaxOfferUnitPrice.ToString("#### ## #0").Trim(), ((int)(item.MinSaleUnitPrice * 0.85) - item.MaxOfferUnitPrice).ToString("#### ## #0").Trim(), item.RestrictionLevel, item.Name)); ConsoleKeyInfo key = Console.ReadKey(true); if (key.Key == ConsoleKey.Escape) break; } } else { Console.WriteLine("Found 0 items. Press any key to exit."); Console.ReadKey(true); } }