Пример #1
0
        private async Task PopulateRecipe()
        {
            var _recipeIDs = await ItemAPI.SearchRecipesByOutput(ItemID);

            if (_recipeIDs?.Count > 0)                                                                  //Check for normal recipe
            {
                _recipes = await ItemAPI.Recipes(_recipeIDs);
            }

            /*else if (!ItemAPI.IsPromotionItem(ItemID)) {                                              //Check for Mystic Forge recipe
             *  var mysticForgeRecipes = await ItemAPI.SearchMysticForgeRecipesByOutput(ItemID);
             *
             *  if (mysticForgeRecipes?.Count > 0) {
             *      _recipe = mysticForgeRecipes[0];
             *      foreach (var recipe in mysticForgeRecipes) {
             *          _recipeIDs.Add(recipe.ID);
             *      }
             *  }
             * }*/
            /*else {                                                                                    //This should onlu occur when the item is a consumable recipe
             *  if (_item == null)
             *      _item = await ItemAPI.Items(ItemID);
             *
             *  if (_item?.Details != null && _item?.Details.RecipeID != 0) {
             *      _recipeIDs.Add(_item.Details.RecipeID);
             *      _recipe = await ItemAPI.Recipes(_item.Details.RecipeID);
             *  }
             * }*/
        }
Пример #2
0
        /// <summary>
        /// Used to override a recipe or select a specific one.
        /// </summary>
        /// <param name="recipeID"></param>
        /// <returns></returns>
        public async Task ChangeRecipe(int recipeID)
        {
            if (_recipes.Any(x => x.ID == recipeID))
            {
                _currentRecipeIndex = _recipes.IndexOf(_recipes.FirstOrDefault(x => x.ID == recipeID));
            }
            else
            {
                var newRecipe = await ItemAPI.Recipes(recipeID);

                _recipes = new List <Recipe> {
                    newRecipe
                };
                _currentRecipeIndex = 0;
            }
            await Populate();
        }