Пример #1
0
        private static bool MatchesAny(Item item, string input)
        {
            if (item.Id == input)
            {
                return(true);
            }

            ItemGroup group = ItemHelper.GetGroup(item.GroupId);

            if (group?.Id == input || (group?.Icon?.Equals(input) ?? false))
            {
                return(true);
            }

            if (item.Rarity.ToString().Equals(input, StringComparison.OrdinalIgnoreCase))
            {
                return(true);
            }

            if (item.Tag.GetFlags().Any(x => x.ToString().Equals(input, StringComparison.OrdinalIgnoreCase)))
            {
                return(true);
            }

            if (Enum.TryParse(input, true, out ItemFilter filter))
            {
                return(MeetsFilter(item, filter));
            }

            return(item.Name.Contains(input, StringComparison.OrdinalIgnoreCase) ||
                   (group?.Name?.Contains(input, StringComparison.OrdinalIgnoreCase)
                    ?? group?.Prefix?.Contains(input, StringComparison.OrdinalIgnoreCase)
                    ?? false));
        }