Exemple #1
0
        public void CheckRequirement()
        {
            var requiredItems    = RecipeManager.GetItemRequirement(currentItem.Code);
            var slotRequirements = requiredItems.Count;

            if (CookingEntity.SlotRequiredLevel(slotRequirements) > CookingEntity.NeededSkillLevel)
            {
                SetVisibility(SlotLock);
                return;
            }

            if (RecipeManager.HaveEnoughIngredients(currentRecipe, AvailableIngredients))
            {
                SetVisibility(Available);

                if (!SeenRecipes.Contains(currentItem.Code))
                {
                    SeenRecipes.Add(currentItem.Code);
                }
            }
            else
            {
                SetVisibility(CookedRecipes.Contains(currentItem.Code) ||
                              SeenRecipes.Contains(currentItem.Code) ?
                              Locked : Hidden);
            }
        }
Exemple #2
0
        public ItemCode GetItem()
        {
            var lastCookItemCode = CookingEntity.LastCookedItem;

            return(RecipeManager.HaveEnoughIngredients(lastCookItemCode, CookingHandler.AvailableIngredients) ?
                   lastCookItemCode : GetCookableRecipe());
        }
Exemple #3
0
        private ItemCode GetCookableRecipe()
        {
            var cookableRecipes = new List <ItemCode>();

            foreach (var recipe in RecipeManager.Recipes)
            {
                if (RecipeManager.HaveEnoughIngredients(recipe, CookingHandler.AvailableIngredients) &&
                    SlotRequiredLevel(recipe.itemsRequired.Count) <= Stats.SkillLevel(Skill.Type.Cooking))
                {
                    cookableRecipes.Add(recipe.RecipeOutcome);
                }
            }

            if (cookableRecipes.Count > 0)
            {
                return(cookableRecipes[Random.Range(0, cookableRecipes.Count - 1)]);
            }

            return(CookingEntity.DefaultCookItem);
        }