public static bool gotItem(FullItem item, AIHeroClient hero = null) { //If item is bad we skip it! if (failedToFindItemList.Contains(item.Id)) { return(true); } var sameItemList = new List <int>(); sameItemList.Add(item.Id); //Check if transform item! if (item.Into != null) { foreach (var into in item.Into) { var intoItem = getData(into, false); if (intoItem == null || intoItem.Ispurchasable) { continue; } sameItemList.Add(into); } } return((hero ?? ObjectManager.Player).InventoryItems.Any(slot => sameItemList.Contains((int)slot.Id))); }
public FullItem getBest() { if (selected != null) { return(selected); } if (condition == ItemCondition.TAKE_PRIMARY) { selected = primary; } if (condition == ItemCondition.ENEMY_MR) { if (EntityManager.Heroes.Enemies.Sum(ene => ene.SpellBlock) > EntityManager.Heroes.Enemies.Sum(ene => ene.Armor)) { selected = primary; } else { selected = secondary; } } if (condition == ItemCondition.ENEMY_RANGED) { if (EntityManager.Heroes.Enemies.Count(ene => ene.IsRanged) > EntityManager.Heroes.Enemies.Count(ene => ene.IsMelee)) { selected = primary; } else { selected = secondary; } } if (condition == ItemCondition.ENEMY_AP) { if (EntityManager.Heroes.Enemies.Sum(ene => ene.FlatMagicDamageMod) > EntityManager.Heroes.Enemies.Sum(ene => ene.FlatPhysicalDamageMod) * 2.0f) { selected = primary; } else { selected = secondary; } } if (condition == ItemCondition.ENEMY_LOSING) { var allTowers = ObjectManager.Get <Obj_AI_Turret>().ToList(); var eneTowCount = allTowers.Count(tow => !tow.IsDead && tow.IsEnemy); var allyTowCount = allTowers.Count(tow => !tow.IsDead && tow.IsAlly); if (allyTowCount == eneTowCount) { return(Player.Instance.Deaths > Player.Instance.ChampionsKilled ? secondary : primary); } if (eneTowCount < allyTowCount) { selected = primary; } else { selected = secondary; } } return(selected); }
public ConditionalItem(ItemId pri, ItemId sec = ItemId.Unknown, ItemCondition cond = ItemCondition.TAKE_PRIMARY) { primary = AutoShopper.getData((int)pri); secondary = (sec == ItemId.Unknown) ? null : AutoShopper.getData((int)sec); condition = cond; }
public ConditionalItem(int pri, int sec = -1, ItemCondition cond = ItemCondition.TAKE_PRIMARY) { primary = AutoShopper.getData(pri); secondary = (sec == -1)?null:AutoShopper.getData(sec); condition = cond; }
public FullItem getBest() { if (selected != null) { return(selected); } if (condition == ItemCondition.TAKE_PRIMARY) { selected = primary; } if (condition == ItemCondition.ENEMY_MR) { if (HeroManager.Enemies.Sum(ene => ene.SpellBlock) > HeroManager.Enemies.Sum(ene => ene.Armor)) { selected = primary; } else { selected = secondary; } } if (condition == ItemCondition.ENEMY_RANGED) { if (HeroManager.Enemies.Count(ene => ene.IsRanged) > HeroManager.Enemies.Count(ene => ene.IsMelee)) { selected = primary; } else { selected = secondary; } } if (condition == ItemCondition.ENEMY_AP) { if (HeroManager.Enemies.Sum(ene => ene.FlatMagicDamageMod) > HeroManager.Enemies.Sum(ene => ene.FlatPhysicalDamageMod) * 2.0f) { selected = primary; } else { selected = secondary; } } if (condition == ItemCondition.ENEMY_LOSING) { var allTowers = ObjectManager.Get <Obj_AI_Turret>().ToList(); if (allTowers.Count(tow => tow.IsDead && tow.IsEnemy) < allTowers.Count(tow => tow.IsDead && tow.IsAlly)) { selected = primary; } else { selected = secondary; } } return(selected); }