Exemplo n.º 1
0
        public override Task <TypeReaderResult> ReadAsync(ICommandContext ctx, string input, IServiceProvider provider)
        {
            if (CraftHelper.RecipeExists(input))
            {
                return(Task.FromResult(TypeReaderResult.FromSuccess(CraftHelper.GetRecipe(input))));
            }

            return(Task.FromResult(TypeReaderResult.FromError(CommandError.ObjectNotFound, "Could not find a Recipe with the specified ID.")));
        }
Exemplo n.º 2
0
 private static bool MeetsFilter(Item item, ItemFilter filter)
 {
     return(filter switch
     {
         ItemFilter.Ingredient => ItemHelper.IsIngredient(item),
         ItemFilter.Craftable => CraftHelper.CanCraft(item),
         ItemFilter.Sellable => ItemHelper.CanSell(item),
         ItemFilter.Buyable => ItemHelper.CanBuy(item),
         ItemFilter.Usable => item.Usage != null,
         ItemFilter.Tradable => ItemHelper.CanTrade(item),
         ItemFilter.Unique => ItemHelper.IsUnique(item),
         _ => false
     });