Пример #1
0
        public IEnumerable <SaveAuction> Filter(IEnumerable <SaveAuction> items, Dictionary <string, string> filters)
        {
            var args = new FilterArgs(filters);

            foreach (var filter in filters)
            {
                if (!Filters.TryGetValue(filter.Key, out IFilter filterObject))
                {
                    throw new CoflnetException("filter_unknown", $"The filter {filter.Key} is not know, please remove it");
                }
                items = filterObject.Filter(items, args);
            }

            return(items);
        }
Пример #2
0
        public IQueryable <SaveAuction> AddFilters(IQueryable <SaveAuction> query, Dictionary <string, string> filters)
        {
            var args = new FilterArgs(filters);

            foreach (var filter in filters)
            {
                if (!Filters.TryGetValue(filter.Key, out IFilter filterObject))
                {
                    throw new CoflnetException("filter_unknown", $"The filter {filter.Key} is not know, please remove it");
                }
                query = filterObject.AddQuery(query, args);
            }

            return(query);
        }
Пример #3
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            var rarity = Enum.Parse <Tier>(args.Get(this));

            return(query.Where(a => a.Tier == rarity));
        }
Пример #4
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            var timestamp = args.GetAsTimeStamp(this);

            return(query.Where(a => a.End > timestamp));
        }
Пример #5
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            var key = NBT.GetLookupKey("uid");
            var val = NBT.UidToLong(args.Get(this));

            Console.WriteLine("uuid as int " + val);
            return(query.Where(a => a.NBTLookup.Where(l => l.KeyId == key && l.Value == val).Any()));
        }
Пример #6
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            var item = ItemDetails.Instance.GetItemIdForName(args.Get(this));
            var key  = NBT.GetLookupKey("heldItem");

            Console.WriteLine(item);
            Console.WriteLine(key);
            return(query.Include(a => a.NBTLookup).Where(a => a.NBTLookup.Where(l => l.KeyId == key && l.Value == item).Any()));
        }
Пример #7
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            if (!args.Filters.ContainsKey("Enchantment"))
            {
                throw new CoflnetException("invalid_filter", "You need to select an enchantment and a lvl to filter for");
            }
            var enchant = Enum.Parse <Enchantment.EnchantmentType>(args.Filters["Enchantment"]);
            var lvl     = (short)args.GetAsLong(this);
            var itemid  = int.Parse(args.Filters["ItemId"]);

            Console.WriteLine(itemid);
            return(query.Where(a => a.Enchantments.Where(e => itemid == e.ItemType && e.Type == enchant && e.Level == lvl).Any()));
        }
Пример #8
0
 public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
 {
     return(query);
 }
Пример #9
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            var level = args.GetAsLong(this);

            return(query.Where(a => EF.Functions.Like(a.ItemName, $"[Lvl {level}]%")));
        }
Пример #10
0
 public IEnumerable <SaveAuction> Filter(IEnumerable <SaveAuction> items, FilterArgs args)
 {
     return(items);
 }
Пример #11
0
 abstract public IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args);
Пример #12
0
 public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
 {
     return(query.Where(a => a.Bin));
 }
Пример #13
0
        public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args)
        {
            var rarity = Enum.Parse <ItemReferences.Reforge>(args.Get(this));

            return(query.Where(a => a.Reforge == rarity));
        }