예제 #1
0
파일: Pooler.cs 프로젝트: Bagoum/danmokou
        public static void Prepare(ItemReferences itemRefs)
        {
            items = itemRefs;
            Pooler <Item> .Prepare();

            Pooler <DropLabel> .Prepare();
        }
예제 #2
0
 public SearchRssViewModel()
 {
     _sitecoreContext          = new SitecoreContext();
     _itemReferences           = new ItemReferences();
     _RssFeedGeneration        = new SearchFeedGenerator();
     _RssItemGeneration        = new SearchRssItemGenerator();
     _RssSitecoreItemRetrieval = new RssSearchResultsItemRetrieval();
 }
예제 #3
0
        public async Task <(List <SaveAuction>, DateTime)> GetRelevantAuctions(SaveAuction auction, HypixelContext context)
        {
            var itemData           = auction.NbtData.Data;
            var clearedName        = auction.Reforge != ItemReferences.Reforge.None ? ItemReferences.RemoveReforge(auction.ItemName) : auction.ItemName;
            var itemId             = ItemDetails.Instance.GetItemIdForName(auction.Tag, false);
            var youngest           = DateTime.Now;
            var relevantEnchants   = auction.Enchantments?.Where(e => UltimateEnchants.ContainsKey(e.Type) || e.Level >= 6).ToList();
            var matchingCount      = relevantEnchants.Count > 2 ? relevantEnchants.Count / 2 : relevantEnchants.Count;
            var ulti               = relevantEnchants.Where(e => UltimateEnchants.ContainsKey(e.Type)).FirstOrDefault();
            var highLvlEnchantList = relevantEnchants.Where(e => !UltimateEnchants.ContainsKey(e.Type)).Select(a => a.Type).ToList();
            var oldest             = DateTime.Now - TimeSpan.FromHours(1);

            IQueryable <SaveAuction> select = GetSelect(auction, context, clearedName, itemId, youngest, matchingCount, ulti, highLvlEnchantList, oldest, auction.Reforge, 10);

            var relevantAuctions = await select
                                   .ToListAsync();

            if (relevantAuctions.Count < 9)
            {
                // to few auctions in last hour, try a whole day
                oldest           = DateTime.Now - TimeSpan.FromDays(1.5);
                relevantAuctions = await GetSelect(auction, context, clearedName, itemId, youngest, matchingCount, ulti, highLvlEnchantList, oldest, auction.Reforge)
                                   .ToListAsync();

                if (relevantAuctions.Count < 50 && PotetialFlipps.Count < 2000)
                {
                    // to few auctions in a day, query a week
                    oldest           = DateTime.Now - TimeSpan.FromDays(8);
                    relevantAuctions = await GetSelect(auction, context, clearedName, itemId, youngest, matchingCount, ulti, highLvlEnchantList, oldest, auction.Reforge, 120)
                                       .ToListAsync();

                    if (relevantAuctions.Count < 10 && clearedName.Contains("✪"))
                    {
                        clearedName      = clearedName.Replace("✪", "").Trim();
                        relevantAuctions = await GetSelect(auction, context, clearedName, itemId, youngest, matchingCount, ulti, highLvlEnchantList, oldest, auction.Reforge, 120)
                                           .ToListAsync();
                    }
                }
            }

            /* got replaced with average overall lookup
             * if (relevantAuctions.Count < 3 && PotetialFlipps.Count < 100)
             * {
             *  oldest = DateTime.Now - TimeSpan.FromDays(25);
             *  relevantAuctions = await GetSelect(auction, context, null, itemId, youngest, matchingCount, ulti, ultiList, highLvlEnchantList, oldest)
             *          .ToListAsync();
             * } */


            return(relevantAuctions, oldest);
        }