Esempio n. 1
0
 public ManifestAttributeCandidate <T> GetTop()
 {
     return(Values
            .AsEnumerable()
            .Reverse()
            .OrderByDescending(c => c.Confidence)
            .ThenBy(c => c.Value == null)
            .ThenByDescending(c => _secondarySort(c.Value))
            .FirstOrDefault(c => c.Confidence > Confidence.None));
 }
        public IEnumerable <ShopItem> Search(int categoryType, int partType, int heroType)
        {
            var list = Values.AsEnumerable();

            list = list.Where(p => p.Enable && p.CategoryType == categoryType);
            if (categoryType == ShopCategoryType.Parts)
            {
                if (partType == ItemPartType.Set)
                {
                    var set = _itemPartDataStore.ByHero(heroType);
                    list = list.Where(p => p.Item0 > 0 && p.Item1 > 0 && set.Contains(p.Item1));
                }
                else
                {
                    var set = _itemPartDataStore.ByTypeAndHero(partType, heroType);
                    list = list.Where(p => p.Item1 == 0 && set.Contains(p.Item0));
                }
            }
            else if (categoryType == ShopCategoryType.HouseDecoration)
            {
                var set = _houseDecorationDataStore.ByKind(partType);
                list = list.Where(p => set.Contains(p.Item0));
            }
            else if (categoryType == ShopCategoryType.Recipe)
            {
                var set = _recipeDataStore.ByKindAndHero(partType, heroType);
                list = list.Where(p => set.Contains(p.Item0));
            }
            else if (categoryType == ShopCategoryType.Enchant)
            {
                var set = _enchantDataStore.ByKind(partType);
                list = list.Where(p => set.Contains(p.Item0));
            }
            else if (categoryType == ShopCategoryType.Lottery)
            {
                list = list.Where(p => p.PriceType == partType);
            }
            return(list);
        }