Пример #1
0
        public Item[] GetUnfilteredRelevantItems(CalculationsBase model, CharacterRace race)
        {
            List <Item> itemList = new List <Item>(AllItems).FindAll(new Predicate <Item>(
                                                                         delegate(Item item)
            {
                return(model.IsItemRelevant(item) && item.FitsFaction(race));
            }));

            return(itemList.ToArray());
        }
Пример #2
0
        internal Item[] GetRelevantItemsInternal(CalculationsBase model, Character character, bool ignoreFilters = false)
        {
            List <Item> itemList = new List <Item>(AllItems).FindAll(new Predicate <Item>(
                                                                         delegate(Item item) {
                return(model.IsItemRelevant(item) &&  // Model Relevance
                       (ignoreFilters || ItemFilter.IsItemRelevant(model, item)) &&  // Filters Relevance
                       (character == null || item.FitsFaction(character.Race)) &&  // Faction Relevance
                       (character == null || character.ItemMatchesiLvlCheck(item)) &&   // iLvl check from UI Filter (non-tree)
                       (character == null || character.ItemMatchesBindCheck(item)) &&   // Bind check from UI Filter (non-tree)
                       (character == null || character.ItemMatchesProfCheck(item)) &&   // Prof check from UI Filter (non-tree)
                       (character == null || character.ItemMatchesDropCheck(item)));    // Drop check from UI Filter (non-tree)
            }));

            return(itemList.ToArray());
        }
Пример #3
0
        private void CacheRelevantItems(CalculationsBase model, Character character, bool ignoreFilters = false)
        {
            List <Item> itemList = new List <Item>(AllItems).FindAll(new Predicate <Item>(
                                                                         delegate(Item item)
            {
                return(model.IsItemRelevant(item) &&  // Model Relevance
                       item.FitsFaction(character.Race) &&  // Faction Relevance
                       (ignoreFilters || ItemFilter.IsItemRelevant(model, item)) &&  // Filters Relevance
                       character.ItemMatchesiLvlCheck(item) &&   // iLvl check from UI Filter (non-tree)
                       character.ItemMatchesBindCheck(item) &&   // Bind check from UI Filter (non-tree)
                       character.ItemMatchesProfCheck(item) &&   // Prof check from UI Filter (non-tree)
                       character.ItemMatchesDropCheck(item));    // Drop check from UI Filter (non-tree)
            }));

            cachedRelevantItems = itemList.ToArray();
            List <Optimizer.SuffixItem> suffixItemList = new List <Optimizer.SuffixItem>();

            foreach (var item in cachedRelevantItems)
            {
                if (item.AllowedRandomSuffixes == null || item.AllowedRandomSuffixes.Count == 0)
                {
                    suffixItemList.Add(new Optimizer.SuffixItem()
                    {
                        Item = item, RandomSuffixId = 0
                    });
                }
                else
                {
                    foreach (var suffix in item.AllowedRandomSuffixes)
                    {
                        suffixItemList.Add(new Optimizer.SuffixItem()
                        {
                            Item = item, RandomSuffixId = suffix
                        });
                    }
                }
            }
            cachedRelevantSuffixItems = suffixItemList.ToArray();
            lastModel = model;
            lastRace  = character.Race;
        }
Пример #4
0
 public Item[] GetRelevantItems(CalculationsBase model, CharacterRace race)
 {
     if (cachedRelevantItems == null || model != lastModel || race != lastRace)
     {
         lock (syncLock)
         {
             // test again because of race conditions, but we still want to avoid the lock if we can because that'll be the majority case
             if (cachedRelevantItems == null || model != lastModel || race != lastRace)
             {
                 List <Item> itemList = new List <Item>(AllItems).FindAll(new Predicate <Item>(
                                                                              delegate(Item item)
                 {
                     return(model.IsItemRelevant(item) && ItemFilter.IsItemRelevant(model, item) && item.FitsFaction(race));
                 }));
                 cachedRelevantItems = itemList.ToArray();
                 lastModel           = model;
                 lastRace            = race;
             }
         }
     }
     return(cachedRelevantItems);
 }
Пример #5
0
 internal Item[] GetRelevantItemsInternal(CalculationsBase model, Character character, bool ignoreFilters = false)
 {
     List<Item> itemList = new List<Item>(AllItems).FindAll(new Predicate<Item>(
         delegate(Item item) {
             return model.IsItemRelevant(item) // Model Relevance
                 && (ignoreFilters || ItemFilter.IsItemRelevant(model, item)) // Filters Relevance
                 && (character == null || item.FitsFaction(character.Race)) // Faction Relevance
                 && (character == null || character.ItemMatchesiLvlCheck(item))  // iLvl check from UI Filter (non-tree)
                 && (character == null || character.ItemMatchesBindCheck(item))  // Bind check from UI Filter (non-tree)
                 && (character == null || character.ItemMatchesProfCheck(item))  // Prof check from UI Filter (non-tree)
                 && (character == null || character.ItemMatchesDropCheck(item)); // Drop check from UI Filter (non-tree)
         }));
     return itemList.ToArray();
 }
Пример #6
0
 private void CacheRelevantItems(CalculationsBase model, Character character, bool ignoreFilters = false)
 {
     List<Item> itemList = new List<Item>(AllItems).FindAll(new Predicate<Item>(
         delegate(Item item)
         {
             return model.IsItemRelevant(item) // Model Relevance
                 && item.FitsFaction(character.Race) // Faction Relevance
                 && (ignoreFilters || ItemFilter.IsItemRelevant(model, item)) // Filters Relevance
                 && character.ItemMatchesiLvlCheck(item)  // iLvl check from UI Filter (non-tree)
                 && character.ItemMatchesBindCheck(item)  // Bind check from UI Filter (non-tree)
                 && character.ItemMatchesProfCheck(item)  // Prof check from UI Filter (non-tree)
                 && character.ItemMatchesDropCheck(item); // Drop check from UI Filter (non-tree)
         }));
     cachedRelevantItems = itemList.ToArray();
     List<Optimizer.SuffixItem> suffixItemList = new List<Optimizer.SuffixItem>();
     foreach (var item in cachedRelevantItems)
     {
         if (item.AllowedRandomSuffixes == null || item.AllowedRandomSuffixes.Count == 0)
         {
             suffixItemList.Add(new Optimizer.SuffixItem() { Item = item, RandomSuffixId = 0 });
         }
         else
         {
             foreach (var suffix in item.AllowedRandomSuffixes)
             {
                 suffixItemList.Add(new Optimizer.SuffixItem() { Item = item, RandomSuffixId = suffix });
             }
         }
     }
     cachedRelevantSuffixItems = suffixItemList.ToArray();
     lastModel = model;
     lastRace = character.Race;
 }
Пример #7
0
 public Item[] GetUnfilteredRelevantItems(CalculationsBase model, CharacterRace race)
 {
     List<Item> itemList = new List<Item>(AllItems).FindAll(new Predicate<Item>(
         delegate(Item item) 
         { 
             return model.IsItemRelevant(item) && item.FitsFaction(race); 
         }));
     return itemList.ToArray();
 }
Пример #8
0
        internal Item[] GetRelevantItemsInternal(CalculationsBase model)
        {
            List <Item> itemList = new List <Item>(AllItems).FindAll(new Predicate <Item>(
                                                                         delegate(Item item) { return(model.IsItemRelevant(item) && ItemFilter.IsItemRelevant(model, item)); }));

            return(itemList.ToArray());
        }
Пример #9
0
 public Item[] GetRelevantItems(CalculationsBase model)
 {
     if (model == Calculations.Instance)
     {
         return(RelevantItems);
     }
     else
     {
         return(new List <Item>(AllItems).FindAll(new Predicate <Item>(
                                                      delegate(Item item) { return model.IsItemRelevant(item); })).ToArray());
     }
 }