示例#1
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()));
        }
示例#2
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()));
        }
示例#3
0
        private static IQueryable <SaveAuction> GetSelect(
            SaveAuction auction,
            HypixelContext context,
            string clearedName,
            int itemId,
            DateTime youngest,
            int matchingCount,
            Enchantment ulti,
            List <Enchantment.EnchantmentType> highLvlEnchantList,
            DateTime oldest,
            ItemReferences.Reforge reforge,
            int limit = 60)
        {
            var select = context.Auctions
                         .Where(a => a.ItemId == itemId)
                         .Where(a => a.HighestBidAmount > 0)
                         .Where(a => a.Tier == auction.Tier);

            byte ultiLevel = 127;

            Enchantment.EnchantmentType ultiType = Enchantment.EnchantmentType.unknown;
            if (ulti != null)
            {
                ultiLevel = ulti.Level;
                ultiType  = ulti.Type;
            }

            if (relevantReforges.Contains(reforge))
            {
                select = select.Where(a => a.Reforge == reforge);
            }


            if (auction.ItemName != clearedName && clearedName != null)
            {
                select = select.Where(a => EF.Functions.Like(a.ItemName, "%" + clearedName));
            }
            else if (auction.Tag.StartsWith("PET"))
            {
                select = AddPetLvlSelect(auction, select);
            }
            else
            {
                select = select.Where(a => a.ItemName == clearedName);
            }

            if (auction.Tag == "MIDAS_STAFF" || auction.Tag == "MIDAS_SWORD")
            {
                try
                {
                    var val   = (long)auction.NbtData.Data["winning_bid"];
                    var keyId = NBT.GetLookupKey(auction.Tag);
                    select  = select.Where(a => a.NBTLookup.Where(n => n.KeyId == keyId && n.Value > val - 2_000_000 && n.Value < val + 2_000_000).Any());
                    oldest -= TimeSpan.FromDays(10);
                } catch
                {}
            }

            select = AddEnchantmentSubselect(auction, matchingCount, highLvlEnchantList, select, ultiLevel, ultiType);
            if (limit == 0)
            {
                return(select);
            }

            return(select
                   .Where(a => a.End > oldest && a.End < youngest)
                   //.OrderByDescending(a=>a.Id)
                   //.Include(a => a.NbtData)
                   .Take(limit));
        }