Esempio n. 1
0
        /// <summary>
        /// Calculates the maximum amount of times the recipe can be run in one second.
        /// </summary>
        /// <param name="recipe">The recipe to calculate the production speed for</param>
        /// <returns>The amount of time the recipe can be executed in one second</returns>
        public double MaxProductionFor(Recipe recipe)
        {
            if (recipe == null)
            {
                throw new ArgumentNullException("recipe");
            }
            if (ProductionSpeed <= 0)
            {
                return(0);
            }
            if (!InternalCraftingCategories.Contains(recipe.CraftingCategory))
            {
                return(0);
            }
            if (recipe.Ingredients.Where((i) => !i.Item.IsVirtual).Count() > IngredientCount)
            {
                return(0);
            }

            var duration = recipe.Time / ProductionSpeed;

            return(1 / duration);
        }
Esempio n. 2
0
 public void AddCraftingCategory(string category)
 {
     InternalCraftingCategories.Add(category);
 }