fBaseXtensions.Game.Hero.Backpack.ReturnBestPotionToUse C# (CSharp) Method

ReturnBestPotionToUse() public static method

public static ReturnBestPotionToUse ( ) : ACDItem
return ACDItem
        public static ACDItem ReturnBestPotionToUse()
        {
            //Always update!
            UpdateItemList();
            var Potions = CacheItemList.Values.Where(i => i.IsPotion).ToList();
            if (Potions.Count > 0)
            {
                //Check for any Bottomless Pots First!
                var BottomlessPotions =
                    Potions.Where(i => i.PotionType != PotionTypes.Regular).ToList();
                if (BottomlessPotions.Count > 0)
                {
                    //TODO:: Base selection on current events!
                    return BottomlessPotions.First().ACDItem;
                }

                //Return normal potion
                return Potions.OrderByDescending(i => i.ThisItemStackQuantity).First().ACDItem;
            }

            return null;
        }