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."))); }
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 });