public void Recalculate() { UnitPriceMethod method; double craftYield = 0; if (Character != null) { UnitCost = ItemCostCalculator.GetUnitPrice(Item, Character, out method); CraftCost = Item.MadeFrom.Any() ? CraftCostCalculator.CostToCraft(Item, Character, out craftYield) : 0; } else { UnitCost = ItemCostCalculator.GetUnitPrice(Item, out method); CraftCost = Item.MadeFrom.Any() ? CraftCostCalculator.CostToCraft(Item, out craftYield) : 0; } CraftYield = craftYield; BestMethod = method; MarketPrice = MarketPriceCalculator.GetMarketPrice(Item); NetRevenue = MarketPriceCalculator.GetNetSaleRevenue(Item); Profit = NetRevenue - UnitCost; MarketCraftDifference = MarketPrice - CraftCost; Refreshed?.Invoke(this, new EventArgs()); }
public static int GetUnitPrice(Item item, Character character, out UnitPriceMethod methodUsed) { int marketPrice = MarketPriceCalculator.GetMarketPrice(item); int craftCost = item.MadeFrom.Any() ? CraftCostCalculator.CostToCraft(item, character) : -1; var price = DetermineUnitPrice(item, craftCost, marketPrice, out methodUsed); return(price); }