示例#1
0
        private IEnumerable<Obj_AI_Hero> getActiveAllyHeros(MItem item)
        {
            var activeAllyHeros = from hero in ObjectManager.Get<Obj_AI_Hero>()
                                  where hero.Team == _player.Team &&
                                        Config.Item(hero.SkinName).GetValue<bool>() &&
                                        hero.Distance(_player, false) <= item.range &&
                                        !hero.IsDead
                                  select hero;

            return activeAllyHeros;
        }
示例#2
0
        private void teamCheckAndUse(MItem item, String buff = "", double incDmg = 0, Obj_AI_Base attacked = null, Obj_AI_Base attacker = null, bool ignoreHP = false)
        {
            if (Config.Item(item.menuVariable) != null)
            {
                // check if is configured to use
                if (Config.Item(item.menuVariable).GetValue<bool>())
                {
                    #region DeffensiveSpell ManaRegeneratorSpell PurifierSpell
                    if (item.type == ItemTypeId.DeffensiveSpell || item.type == ItemTypeId.ManaRegeneratorSpell || item.type == ItemTypeId.PurifierSpell)
                    {
                        //Console.WriteLine("TCandU-> " + item.name);
                        var spellSlot = Utility.GetSpellSlot(_player, item.menuVariable);
                        if (spellSlot != SpellSlot.Unknown)
                        {
                            var activeAllyHeros = getActiveAllyHeros(item);
                            if (activeAllyHeros.Count() > 0)
                            {
                                int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value;

                                foreach (Obj_AI_Hero hero in activeAllyHeros)
                                {
                                    //Console.WriteLine("Hero-> " + hero.SkinName);
                                    int enemyInRange = Utility.CountEnemiesInRange(hero, 700);
                                    if (enemyInRange >= 1)
                                    {
                                        int actualHeroHpPercent = (int)(((_player.Health - incDmg) / _player.MaxHealth) * 100); //after dmg not Actual ^^
                                        int actualHeroManaPercent = (int)((_player.Mana / _player.MaxMana) * 100);

                                        //Console.WriteLine("actHp% -> " + actualHeroHpPercent + "   useOn%-> " + usePercent + "  IncDMG-> " + incDmg);

                                        if ((item.type == ItemTypeId.DeffensiveSpell && actualHeroHpPercent <= usePercent) ||
                                            (item.type == ItemTypeId.ManaRegeneratorSpell && actualHeroManaPercent <= usePercent))
                                        {
                                            _player.Spellbook.CastSpell(spellSlot);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                    #region TeamAbility TeamAbilityAOE
                    else if (item.type == ItemTypeId.TeamAbility)
                    {
                        try
                        {
                            if (!Config.Item(attacked.SkinName).GetValue<bool>())
                            {
                                return;
                            }

                            if (_player.Distance(attacked, false) <= item.range)
                            {
                                var spellSlot = Utility.GetSpellSlot(_player, item.name);
                                if (spellSlot != SpellSlot.Unknown)
                                {
                                    if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                                    {
                                        int usePercent = !ignoreHP ? Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value : 100;
                                        int manaPercent = Config.Item(item.menuVariable + "UseManaPct") != null ? Config.Item(item.menuVariable + "UseManaPct").GetValue<Slider>().Value : 0;

                                        int actualHeroHpPercent = (int)(((attacked.Health - incDmg) / attacked.MaxHealth) * 100); //after dmg not Actual ^^
                                        int playerManaPercent = (int)((_player.Mana / _player.MaxMana) * 100);
                                        if (playerManaPercent >= manaPercent && actualHeroHpPercent <= usePercent)
                                        {
                                            if (item.type == ItemTypeId.TeamAbility && item.spellType != SpellType.SkillShotCircle && item.spellType != SpellType.SkillShotCone && item.spellType != SpellType.SkillShotLine)
                                            {
                                                _player.Spellbook.CastSpell(item.abilitySlot, attacked);
                                            }
                                            else
                                            {
                                                Vector3 pos = attacked.Position;
                                                // extend 20 to attacker direction THIS 20 COST RANGE
                                                if (attacker != null)
                                                {
                                                    if (_player.Distance(attacked.Position.Extend(attacker.Position, 20), false) <= item.range)
                                                    {
                                                        pos = attacked.Position.Extend(attacker.Position, 20);
                                                    }
                                                }
                                                _player.Spellbook.CastSpell(item.abilitySlot, pos);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Problem with MasterActivator(AutoShieldTeam).");
                            Console.WriteLine(e);
                        }
                    }
                    #endregion
                    #region Others
                    else
                    {
                        if (Items.HasItem(item.id))
                        {
                            if (Items.CanUseItem(item.id))
                            {
                                var activeAllyHeros = getActiveAllyHeros(item);
                                if (activeAllyHeros.Count() > 0)
                                {
                                    foreach (Obj_AI_Hero hero in activeAllyHeros)
                                    {
                                        #region Purifier
                                        if (item.type == ItemTypeId.Purifier)
                                        {
                                            if ((Config.Item("defJustOnCombo").GetValue<bool>() && Config.Item("comboModeActive").GetValue<KeyBind>().Active) ||
                                            (!Config.Item("defJustOnCombo").GetValue<bool>()))
                                            {
                                                if (checkCC(hero))
                                                {
                                                    useItem(item.id, hero);
                                                }
                                            }
                                        }
                                        #endregion
                                        #region Deffensive
                                        else if (item.type == ItemTypeId.Deffensive)
                                        {
                                            int enemyInRange = Utility.CountEnemiesInRange(hero, 700);
                                            if (enemyInRange >= 1)
                                            {
                                                int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value;
                                                int actualHeroHpPercent = (int)((hero.Health / hero.MaxHealth) * 100);
                                                if (actualHeroHpPercent <= usePercent)
                                                {
                                                    if (item.spellType == SpellType.Self)
                                                    {
                                                        useItem(item.id);
                                                    }
                                                    else
                                                    {
                                                        useItem(item.id, hero);
                                                    }
                                                }
                                            }
                                        }
                                        #endregion
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
            }
        }
示例#3
0
 private bool checkUsePercent(MItem item, int actualPercent)
 {
     int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value;
     return actualPercent <= usePercent ? true : false;
 }
示例#4
0
        private void createMenuItem(MItem item, String parent, int defaultValue = 0, bool mana = false, int minManaPct = 0)
        {
            if (item.type == ItemTypeId.Ability || item.type == ItemTypeId.TeamAbility)
            {
                var abilitySlot = Utility.GetSpellSlot(_player, item.name);
                if (abilitySlot != SpellSlot.Unknown && abilitySlot == item.abilitySlot)
                {
                    var menu = new Menu(item.menuName, "menu" + item.menuVariable);
                    menu.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));
                    menu.AddItem(new MenuItem(item.menuVariable + "UseOnPercent", "Use on HP%")).SetValue(new Slider(defaultValue, 0, 100));
                    if (minManaPct > 0)
                    {
                        menu.AddItem(new MenuItem(item.menuVariable + "UseManaPct", "Min Mana%")).SetValue(new Slider(minManaPct, 0, 100));
                    }
                    var menuUseAgainst = new Menu("Filter", "UseAgainst");
                    menuUseAgainst.AddItem(new MenuItem("tower" + item.menuVariable, "Tower").SetValue(true));
                    menuUseAgainst.AddItem(new MenuItem("ignite" + item.menuVariable, "Ignite").SetValue(true));
                    menuUseAgainst.AddItem(new MenuItem("king" + item.menuVariable, "BoRKing").SetValue(false));
                    menuUseAgainst.AddItem(new MenuItem("basic" + item.menuVariable, "Basic ATK").SetValue(false));

                    var enemyHero = from hero in ObjectManager.Get<Obj_AI_Hero>()
                                    where hero.Team != _player.Team
                                    select hero;

                    if (enemyHero.Any())
                    {
                        foreach (Obj_AI_Hero hero in enemyHero)
                        {
                            var menuUseAgainstHero = new Menu(hero.BaseSkinName, "useAgainst" + hero.BaseSkinName);
                            menuUseAgainstHero.AddItem(new MenuItem(item.menuVariable + hero.BaseSkinName, "Enabled").SetValue(true));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.Q + item.menuVariable + hero.BaseSkinName, "Q").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.W + item.menuVariable + hero.BaseSkinName, "W").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.E + item.menuVariable + hero.BaseSkinName, "E").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.R + item.menuVariable + hero.BaseSkinName, "R").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem("ignore" + item.menuVariable + hero.BaseSkinName, "Ignore %HP").SetValue(true));
                            menuUseAgainst.AddSubMenu(menuUseAgainstHero);
                            // Bring all, passives, summoners spells, etc;
                            /*if (hero.Spellbook.Spells.Count() > 0)
                            {
                                var menuUseAgainstHero = new Menu(hero.BaseSkinName, "useAgainst" + hero.BaseSkinName);
                                menuUseAgainstHero.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));
                                foreach(SpellDataInst spell in hero.Spellbook.Spells)
                                {
                                    menuUseAgainstHero.AddItem(new MenuItem("useAgainstSpell" + spell.Name, spell.Name).SetValue(true));
                                }
                                menuUseAgainst.AddSubMenu(menuUseAgainstHero);
                            }
                            else
                            {
                                Console.WriteLine("MasterActivator cant get " + hero.BaseSkinName + " spells!");
                            }*/
                        }
                    }
                    menu.AddSubMenu(menuUseAgainst);
                    Config.SubMenu(parent).AddSubMenu(menu);
                }
            }
            else if (item.type == ItemTypeId.KSAbility)
            {
                var abilitySlot = Utility.GetSpellSlot(_player, item.name);
                if (abilitySlot != SpellSlot.Unknown && abilitySlot == item.abilitySlot)
                {
                    var ksAbMenu = new Menu(item.menuName, "menu" + item.menuVariable);
                    ksAbMenu.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));
                    //choRMenu.AddItem(new MenuItem(choR.menuVariable + "plus", "Plus").SetValue(false));
                    ksAbMenu.AddItem(new MenuItem(item.menuVariable + "drawRange", "Draw Range").SetValue(true));
                    ksAbMenu.AddItem(new MenuItem(item.menuVariable + "drawBar", "Draw Bar").SetValue(true));
                    Config.SubMenu(parent).AddSubMenu(ksAbMenu);
                }
            }
            else
            {
                var menu = new Menu(item.menuName, "menu" + item.menuVariable);
                menu.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));

                if (defaultValue != 0)
                {
                    if (item.type == ItemTypeId.OffensiveAOE)
                    {
                        menu.AddItem(new MenuItem(item.menuVariable + "UseXUnits", "On X Units")).SetValue(new Slider(defaultValue, 1, 5));
                    }
                    else
                    {
                        menu.AddItem(new MenuItem(item.menuVariable + "UseOnPercent", "Use on " + (mana == false ? "%HP" : "%Mana"))).SetValue(new Slider(defaultValue, 0, 100));
                    }
                }
                Config.SubMenu(parent).AddSubMenu(menu);
            }
        }
示例#5
0
        private void checkAndUse(MItem item, String buff = "", double incDamage = 0, bool ignoreHP = false)
        {
            try
            {
                if (Config.Item(item.menuVariable) != null)
                {
                    // check if is configured to use
                    if (Config.Item(item.menuVariable).GetValue<bool>())
                    {
                        int actualHeroHpPercent = (int)(((_player.Health - incDamage) / _player.MaxHealth) * 100); //after dmg not Actual ^^
                        int actualHeroManaPercent = (int)(_player.MaxMana > 0 ? ((_player.Mana / _player.MaxMana) * 100) : 0);

                        #region DeffensiveSpell ManaRegeneratorSpell PurifierSpell OffensiveSpell KSAbility
                        if (item.type == ItemTypeId.DeffensiveSpell || item.type == ItemTypeId.ManaRegeneratorSpell || item.type == ItemTypeId.PurifierSpell || item.type == ItemTypeId.OffensiveSpell || item.type == ItemTypeId.KSAbility)
                        {
                            var spellSlot = Utility.GetSpellSlot(_player, item.menuVariable);
                            if (spellSlot != SpellSlot.Unknown)
                            {
                                if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                                {
                                    if (item.type == ItemTypeId.DeffensiveSpell)
                                    {
                                        int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value;
                                        if (actualHeroHpPercent <= usePercent)
                                        {
                                            _player.Spellbook.CastSpell(spellSlot);
                                        }
                                    }
                                    else if (item.type == ItemTypeId.ManaRegeneratorSpell)
                                    {
                                        int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value;
                                        if (actualHeroManaPercent <= usePercent && !_player.InFountain())
                                        {
                                            _player.Spellbook.CastSpell(spellSlot);
                                        }
                                    }
                                    else if (item.type == ItemTypeId.PurifierSpell)
                                    {
                                        if ((Config.Item("defJustOnCombo").GetValue<bool>() && Config.Item("comboModeActive").GetValue<KeyBind>().Active) ||
                                            (!Config.Item("defJustOnCombo").GetValue<bool>()))
                                        {
                                            if (checkCC(_player))
                                            {
                                                _player.Spellbook.CastSpell(spellSlot);
                                                checkCCTick = LeagueSharp.Common.Utils.TickCount + 2500;
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.OffensiveSpell || item.type == ItemTypeId.KSAbility)
                                    {
                                        #region Ignite
                                        if (item == ignite)
                                        {
                                            // TargetSelector.TargetingMode.LowHP FIX/Check
                                            Obj_AI_Hero target = TargetSelector.GetTarget(item.range); // Check about DamageType
                                            if (target != null)
                                            {

                                                var aaspeed = _player.AttackSpeedMod;
                                                float aadmg = 0;

                                                // attack speed checks
                                                if (aaspeed < 0.8f)
                                                    aadmg = _player.FlatPhysicalDamageMod * 3;
                                                else if (aaspeed > 1f && aaspeed < 1.3f)
                                                    aadmg = _player.FlatPhysicalDamageMod * 5;
                                                else if (aaspeed > 1.3f && aaspeed < 1.5f)
                                                    aadmg = _player.FlatPhysicalDamageMod * 7;
                                                else if (aaspeed > 1.5f && aaspeed < 1.7f)
                                                    aadmg = _player.FlatPhysicalDamageMod * 9;
                                                else if (aaspeed > 2.0f)
                                                    aadmg = _player.FlatPhysicalDamageMod * 11;

                                                // Will calculate for base hp regen, currenthp, etc
                                                float dmg = (_player.Level * 20) + 50;
                                                float regenpersec = (target.FlatHPRegenMod + (target.HPRegenRate * target.Level));
                                                float dmgafter = (dmg - ((regenpersec * 5) / 2));

                                                float aaleft = (dmgafter + target.Health / _player.FlatPhysicalDamageMod);
                                                //var pScreen = Drawing.WorldToScreen(target.Position);

                                                if (target.Health < (dmgafter + aadmg) && _player.Distance(target, false) <= item.range)
                                                {
                                                    bool overIgnite = Config.Item("overIgnite").GetValue<bool>();
                                                    if ((!overIgnite && !target.HasBuff("summonerdot")) || overIgnite)
                                                    {
                                                        _player.Spellbook.CastSpell(spellSlot, target);
                                                        //Drawing.DrawText(pScreen[0], pScreen[1], System.Drawing.Color.Crimson, "Kill in " + aaleft);
                                                    }

                                                }

                                            }
                                        }
                                        #endregion
                                    }
                                }
                            }
                        }
                        #endregion
                        else if (item.type == ItemTypeId.Ability || item.type == ItemTypeId.TeamAbility)
                        {
                            try
                            {
                                var spellSlot = Utility.GetSpellSlot(_player, item.name);
                                if (spellSlot != SpellSlot.Unknown)
                                {
                                    if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                                    {
                                        int usePercent = !ignoreHP ? Config.Item(item.menuVariable + "UseOnPercent").GetValue<Slider>().Value : 100;
                                        int manaPercent = Config.Item(item.menuVariable + "UseManaPct") != null ? Config.Item(item.menuVariable + "UseManaPct").GetValue<Slider>().Value : 0;
                                        //Console.WriteLine("ActualMana%-> " + actualHeroManaPercent + "  Mana%->" + manaPercent + "  Acthp%->" + actualHeroHpPercent + "   Use%->" + usePercent);

                                        if (actualHeroManaPercent >= manaPercent && actualHeroHpPercent <= usePercent)
                                        {
                                            if (item.spellType == SpellType.TargetEnemy)
                                            {
                                                if (checkTarget(item.range))
                                                {
                                                    _player.Spellbook.CastSpell(item.abilitySlot, target);
                                                }
                                            }
                                            else
                                            {
                                                _player.Spellbook.CastSpell(item.abilitySlot, _player);
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Problem with MasterActivator(AutoShield).");
                                Console.WriteLine(e);
                            }
                        }
                        else
                        {
                            if (Items.HasItem(item.id))
                            {
                                //Console.WriteLine("Tem item->" + item.id + item.name);
                                if (Items.CanUseItem(item.id))
                                {
                                    if (item.type == ItemTypeId.Offensive)
                                    {
                                        if (checkTarget(item.range))
                                        {
                                            int actualTargetHpPercent = (int)((target.Health / target.MaxHealth) * 100);
                                            if (checkUsePercent(item, actualTargetHpPercent))
                                            {
                                                useItem(item.id, (item.range == 0 || item.spellType == SpellType.Self) ? null : target);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.OffensiveAOE)
                                    {
                                        if (checkTarget(item.range))
                                        {
                                            // FIX-ME: In frost case, we must check the affected area, not just ppl in range(item).
                                            if (Utility.CountEnemiesInRange(_player, (int)item.range) >= Config.Item(item.menuVariable + "UseXUnits").GetValue<Slider>().Value)
                                            {
                                                useItem(item.id, (item.range == 0 || item.spellType == SpellType.Self) ? null : target);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.HPRegenerator)
                                    {
                                        if (checkUsePercent(item, actualHeroHpPercent) && !_player.InFountain() && !Utility.IsRecalling(_player))
                                        {
                                            if ((buff != "" && !checkBuff(buff)) || buff == "")
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.Deffensive)
                                    {
                                        if (checkUsePercent(item, actualHeroHpPercent) && !_player.InFountain() && (Config.Item("useRecalling").GetValue<bool>() || !Utility.IsRecalling(_player)))
                                        {
                                            if ((buff != "" && !checkBuff(buff)) || buff == "")
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.ManaRegenerator)
                                    {
                                        if (checkUsePercent(item, actualHeroManaPercent) && !_player.InFountain() && !Utility.IsRecalling(_player))
                                        {
                                            if ((buff != "" && !checkBuff(buff)) || buff == "")
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.Buff)
                                    {
                                        if (checkTarget(item.range))
                                        {
                                            if (!checkBuff(item.name))
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                        else
                                        {
                                            if (checkBuff(item.name))
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.Purifier)
                                    {
                                        if ((Config.Item("defJustOnCombo").GetValue<bool>() && Config.Item("comboModeActive").GetValue<KeyBind>().Active) ||
                                            (!Config.Item("defJustOnCombo").GetValue<bool>()))
                                        {
                                            if (checkCC(_player))
                                            {
                                                useItem(item.id);
                                                checkCCTick = LeagueSharp.Common.Utils.TickCount + 2500;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#6
0
        private bool checkUsePercent(MItem item, int actualPercent)
        {
            int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value;

            return(actualPercent <= usePercent ? true : false);
        }
示例#7
0
        private void checkAndUse(MItem item, String buff = "", double incDamage = 0, bool ignoreHP = false)
        {
            try
            {
                if (Config.Item(item.menuVariable) != null)
                {
                    // check if is configured to use
                    if (Config.Item(item.menuVariable).GetValue <bool>())
                    {
                        int actualHeroHpPercent   = (int)(((_player.Health - incDamage) / _player.MaxHealth) * 100); //after dmg not Actual ^^
                        int actualHeroManaPercent = (int)(_player.MaxMana > 0 ? ((_player.Mana / _player.MaxMana) * 100) : 0);

                        #region DeffensiveSpell ManaRegeneratorSpell PurifierSpell OffensiveSpell KSAbility
                        if (item.type == ItemTypeId.DeffensiveSpell || item.type == ItemTypeId.ManaRegeneratorSpell || item.type == ItemTypeId.PurifierSpell || item.type == ItemTypeId.OffensiveSpell || item.type == ItemTypeId.KSAbility)
                        {
                            var spellSlot = Utility.GetSpellSlot(_player, item.menuVariable);
                            if (spellSlot != SpellSlot.Unknown)
                            {
                                if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                                {
                                    if (item.type == ItemTypeId.DeffensiveSpell)
                                    {
                                        int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value;
                                        if (actualHeroHpPercent <= usePercent)
                                        {
                                            _player.Spellbook.CastSpell(spellSlot);
                                        }
                                    }
                                    else if (item.type == ItemTypeId.ManaRegeneratorSpell)
                                    {
                                        int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value;
                                        if (actualHeroManaPercent <= usePercent && !_player.InFountain())
                                        {
                                            _player.Spellbook.CastSpell(spellSlot);
                                        }
                                    }
                                    else if (item.type == ItemTypeId.PurifierSpell)
                                    {
                                        if ((Config.Item("defJustOnCombo").GetValue <bool>() && Config.Item("comboModeActive").GetValue <KeyBind>().Active) ||
                                            (!Config.Item("defJustOnCombo").GetValue <bool>()))
                                        {
                                            if (checkCC(_player))
                                            {
                                                _player.Spellbook.CastSpell(spellSlot);
                                                checkCCTick = LeagueSharp.Common.Utils.TickCount + 2500;
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.OffensiveSpell || item.type == ItemTypeId.KSAbility)
                                    {
                                        #region Ignite
                                        if (item == ignite)
                                        {
                                            // TargetSelector.TargetingMode.LowHP FIX/Check
                                            Obj_AI_Hero target = TargetSelector.GetTarget(item.range); // Check about DamageType
                                            if (target != null)
                                            {
                                                var   aaspeed = _player.AttackSpeedMod;
                                                float aadmg   = 0;

                                                // attack speed checks
                                                if (aaspeed < 0.8f)
                                                {
                                                    aadmg = _player.FlatPhysicalDamageMod * 3;
                                                }
                                                else if (aaspeed > 1f && aaspeed < 1.3f)
                                                {
                                                    aadmg = _player.FlatPhysicalDamageMod * 5;
                                                }
                                                else if (aaspeed > 1.3f && aaspeed < 1.5f)
                                                {
                                                    aadmg = _player.FlatPhysicalDamageMod * 7;
                                                }
                                                else if (aaspeed > 1.5f && aaspeed < 1.7f)
                                                {
                                                    aadmg = _player.FlatPhysicalDamageMod * 9;
                                                }
                                                else if (aaspeed > 2.0f)
                                                {
                                                    aadmg = _player.FlatPhysicalDamageMod * 11;
                                                }

                                                // Will calculate for base hp regen, currenthp, etc
                                                float dmg         = (_player.Level * 20) + 50;
                                                float regenpersec = (target.FlatHPRegenMod + (target.HPRegenRate * target.Level));
                                                float dmgafter    = (dmg - ((regenpersec * 5) / 2));

                                                float aaleft = (dmgafter + target.Health / _player.FlatPhysicalDamageMod);
                                                //var pScreen = Drawing.WorldToScreen(target.Position);

                                                if (target.Health < (dmgafter + aadmg) && _player.Distance(target, false) <= item.range)
                                                {
                                                    bool overIgnite = Config.Item("overIgnite").GetValue <bool>();
                                                    if ((!overIgnite && !target.HasBuff("summonerdot")) || overIgnite)
                                                    {
                                                        _player.Spellbook.CastSpell(spellSlot, target);
                                                        //Drawing.DrawText(pScreen[0], pScreen[1], System.Drawing.Color.Crimson, "Kill in " + aaleft);
                                                    }
                                                }
                                            }
                                        }
                                        #endregion
                                    }
                                }
                            }
                        }
                        #endregion
                        else if (item.type == ItemTypeId.Ability || item.type == ItemTypeId.TeamAbility)
                        {
                            try
                            {
                                var spellSlot = Utility.GetSpellSlot(_player, item.name);
                                if (spellSlot != SpellSlot.Unknown)
                                {
                                    if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                                    {
                                        int usePercent = !ignoreHP?Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value : 100;

                                        int manaPercent = Config.Item(item.menuVariable + "UseManaPct") != null?Config.Item(item.menuVariable + "UseManaPct").GetValue <Slider>().Value : 0;

                                        //Console.WriteLine("ActualMana%-> " + actualHeroManaPercent + "  Mana%->" + manaPercent + "  Acthp%->" + actualHeroHpPercent + "   Use%->" + usePercent);

                                        if (actualHeroManaPercent >= manaPercent && actualHeroHpPercent <= usePercent)
                                        {
                                            if (item.spellType == SpellType.TargetEnemy)
                                            {
                                                if (checkTarget(item.range))
                                                {
                                                    _player.Spellbook.CastSpell(item.abilitySlot, target);
                                                }
                                            }
                                            else
                                            {
                                                _player.Spellbook.CastSpell(item.abilitySlot, _player);
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Problem with MasterActivator(AutoShield).");
                                Console.WriteLine(e);
                            }
                        }
                        else
                        {
                            if (Items.HasItem(item.id))
                            {
                                //Console.WriteLine("Tem item->" + item.id + item.name);
                                if (Items.CanUseItem(item.id))
                                {
                                    if (item.type == ItemTypeId.Offensive)
                                    {
                                        if (checkTarget(item.range))
                                        {
                                            int actualTargetHpPercent = (int)((target.Health / target.MaxHealth) * 100);
                                            if (checkUsePercent(item, actualTargetHpPercent))
                                            {
                                                useItem(item.id, (item.range == 0 || item.spellType == SpellType.Self) ? null : target);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.OffensiveAOE)
                                    {
                                        if (checkTarget(item.range))
                                        {
                                            // FIX-ME: In frost case, we must check the affected area, not just ppl in range(item).
                                            if (Utility.CountEnemiesInRange(_player, (int)item.range) >= Config.Item(item.menuVariable + "UseXUnits").GetValue <Slider>().Value)
                                            {
                                                useItem(item.id, (item.range == 0 || item.spellType == SpellType.Self) ? null : target);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.HPRegenerator)
                                    {
                                        if (checkUsePercent(item, actualHeroHpPercent) && !_player.InFountain() && !Utility.IsRecalling(_player))
                                        {
                                            if ((buff != "" && !checkBuff(buff)) || buff == "")
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.Deffensive)
                                    {
                                        if (checkUsePercent(item, actualHeroHpPercent) && !_player.InFountain() && (Config.Item("useRecalling").GetValue <bool>() || !Utility.IsRecalling(_player)))
                                        {
                                            if ((buff != "" && !checkBuff(buff)) || buff == "")
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.ManaRegenerator)
                                    {
                                        if (checkUsePercent(item, actualHeroManaPercent) && !_player.InFountain() && !Utility.IsRecalling(_player))
                                        {
                                            if ((buff != "" && !checkBuff(buff)) || buff == "")
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.Buff)
                                    {
                                        if (checkTarget(item.range))
                                        {
                                            if (!checkBuff(item.name))
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                        else
                                        {
                                            if (checkBuff(item.name))
                                            {
                                                useItem(item.id);
                                            }
                                        }
                                    }
                                    else if (item.type == ItemTypeId.Purifier)
                                    {
                                        if ((Config.Item("defJustOnCombo").GetValue <bool>() && Config.Item("comboModeActive").GetValue <KeyBind>().Active) ||
                                            (!Config.Item("defJustOnCombo").GetValue <bool>()))
                                        {
                                            if (checkCC(_player))
                                            {
                                                useItem(item.id);
                                                checkCCTick = LeagueSharp.Common.Utils.TickCount + 2500;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#8
0
        private void teamCheckAndUse(MItem item, String buff = "", double incDmg = 0, Obj_AI_Base attacked = null, Obj_AI_Base attacker = null, bool ignoreHP = false)
        {
            if (Config.Item(item.menuVariable) != null)
            {
                // check if is configured to use
                if (Config.Item(item.menuVariable).GetValue <bool>())
                {
                    #region DeffensiveSpell ManaRegeneratorSpell PurifierSpell
                    if (item.type == ItemTypeId.DeffensiveSpell || item.type == ItemTypeId.ManaRegeneratorSpell || item.type == ItemTypeId.PurifierSpell)
                    {
                        //Console.WriteLine("TCandU-> " + item.name);
                        var spellSlot = Utility.GetSpellSlot(_player, item.menuVariable);
                        if (spellSlot != SpellSlot.Unknown)
                        {
                            var activeAllyHeros = getActiveAllyHeros(item);
                            if (activeAllyHeros.Count() > 0)
                            {
                                int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value;

                                foreach (Obj_AI_Hero hero in activeAllyHeros)
                                {
                                    //Console.WriteLine("Hero-> " + hero.SkinName);
                                    int enemyInRange = Utility.CountEnemiesInRange(hero, 700);
                                    if (enemyInRange >= 1)
                                    {
                                        int actualHeroHpPercent   = (int)(((_player.Health - incDmg) / _player.MaxHealth) * 100); //after dmg not Actual ^^
                                        int actualHeroManaPercent = (int)((_player.Mana / _player.MaxMana) * 100);

                                        //Console.WriteLine("actHp% -> " + actualHeroHpPercent + "   useOn%-> " + usePercent + "  IncDMG-> " + incDmg);

                                        if ((item.type == ItemTypeId.DeffensiveSpell && actualHeroHpPercent <= usePercent) ||
                                            (item.type == ItemTypeId.ManaRegeneratorSpell && actualHeroManaPercent <= usePercent))
                                        {
                                            _player.Spellbook.CastSpell(spellSlot);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                    #region TeamAbility TeamAbilityAOE
                    else if (item.type == ItemTypeId.TeamAbility)
                    {
                        try
                        {
                            if (!Config.Item(attacked.SkinName).GetValue <bool>())
                            {
                                return;
                            }

                            if (_player.Distance(attacked, false) <= item.range)
                            {
                                var spellSlot = Utility.GetSpellSlot(_player, item.name);
                                if (spellSlot != SpellSlot.Unknown)
                                {
                                    if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                                    {
                                        int usePercent = !ignoreHP?Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value : 100;

                                        int manaPercent = Config.Item(item.menuVariable + "UseManaPct") != null?Config.Item(item.menuVariable + "UseManaPct").GetValue <Slider>().Value : 0;

                                        int actualHeroHpPercent = (int)(((attacked.Health - incDmg) / attacked.MaxHealth) * 100); //after dmg not Actual ^^
                                        int playerManaPercent   = (int)((_player.Mana / _player.MaxMana) * 100);
                                        if (playerManaPercent >= manaPercent && actualHeroHpPercent <= usePercent)
                                        {
                                            if (item.type == ItemTypeId.TeamAbility && item.spellType != SpellType.SkillShotCircle && item.spellType != SpellType.SkillShotCone && item.spellType != SpellType.SkillShotLine)
                                            {
                                                _player.Spellbook.CastSpell(item.abilitySlot, attacked);
                                            }
                                            else
                                            {
                                                Vector3 pos = attacked.Position;
                                                // extend 20 to attacker direction THIS 20 COST RANGE
                                                if (attacker != null)
                                                {
                                                    if (_player.Distance(attacked.Position.Extend(attacker.Position, 20), false) <= item.range)
                                                    {
                                                        pos = attacked.Position.Extend(attacker.Position, 20);
                                                    }
                                                }
                                                _player.Spellbook.CastSpell(item.abilitySlot, pos);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Problem with MasterActivator(AutoShieldTeam).");
                            Console.WriteLine(e);
                        }
                    }
                    #endregion
                    #region Others
                    else
                    {
                        if (Items.HasItem(item.id))
                        {
                            if (Items.CanUseItem(item.id))
                            {
                                var activeAllyHeros = getActiveAllyHeros(item);
                                if (activeAllyHeros.Count() > 0)
                                {
                                    foreach (Obj_AI_Hero hero in activeAllyHeros)
                                    {
                                        #region Purifier
                                        if (item.type == ItemTypeId.Purifier)
                                        {
                                            if ((Config.Item("defJustOnCombo").GetValue <bool>() && Config.Item("comboModeActive").GetValue <KeyBind>().Active) ||
                                                (!Config.Item("defJustOnCombo").GetValue <bool>()))
                                            {
                                                if (checkCC(hero))
                                                {
                                                    useItem(item.id, hero);
                                                }
                                            }
                                        }
                                        #endregion
                                        #region Deffensive
                                        else if (item.type == ItemTypeId.Deffensive)
                                        {
                                            int enemyInRange = Utility.CountEnemiesInRange(hero, 700);
                                            if (enemyInRange >= 1)
                                            {
                                                int usePercent          = Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value;
                                                int actualHeroHpPercent = (int)((hero.Health / hero.MaxHealth) * 100);
                                                if (actualHeroHpPercent <= usePercent)
                                                {
                                                    if (item.spellType == SpellType.Self)
                                                    {
                                                        useItem(item.id);
                                                    }
                                                    else
                                                    {
                                                        useItem(item.id, hero);
                                                    }
                                                }
                                            }
                                        }
                                        #endregion
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
            }
        }
示例#9
0
        private void createMenuItem(MItem item, String parent, int defaultValue = 0, bool mana = false, int minManaPct = 0)
        {
            if (item.type == ItemTypeId.Ability || item.type == ItemTypeId.TeamAbility)
            {
                var abilitySlot = Utility.GetSpellSlot(_player, item.name);
                if (abilitySlot != SpellSlot.Unknown && abilitySlot == item.abilitySlot)
                {
                    var menu = new Menu(item.menuName, "menu" + item.menuVariable);
                    menu.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));
                    menu.AddItem(new MenuItem(item.menuVariable + "UseOnPercent", "Use on HP%")).SetValue(new Slider(defaultValue, 0, 100));
                    if (minManaPct > 0)
                    {
                        menu.AddItem(new MenuItem(item.menuVariable + "UseManaPct", "Min Mana%")).SetValue(new Slider(minManaPct, 0, 100));
                    }
                    var menuUseAgainst = new Menu("Filter", "UseAgainst");
                    menuUseAgainst.AddItem(new MenuItem("tower" + item.menuVariable, "Tower").SetValue(true));
                    menuUseAgainst.AddItem(new MenuItem("ignite" + item.menuVariable, "Ignite").SetValue(true));
                    menuUseAgainst.AddItem(new MenuItem("king" + item.menuVariable, "BoRKing").SetValue(false));
                    menuUseAgainst.AddItem(new MenuItem("basic" + item.menuVariable, "Basic ATK").SetValue(false));

                    var enemyHero = from hero in ObjectManager.Get <Obj_AI_Hero>()
                                    where hero.Team != _player.Team
                                    select hero;

                    if (enemyHero.Any())
                    {
                        foreach (Obj_AI_Hero hero in enemyHero)
                        {
                            var menuUseAgainstHero = new Menu(hero.BaseSkinName, "useAgainst" + hero.BaseSkinName);
                            menuUseAgainstHero.AddItem(new MenuItem(item.menuVariable + hero.BaseSkinName, "Enabled").SetValue(true));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.Q + item.menuVariable + hero.BaseSkinName, "Q").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.W + item.menuVariable + hero.BaseSkinName, "W").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.E + item.menuVariable + hero.BaseSkinName, "E").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem(SpellSlot.R + item.menuVariable + hero.BaseSkinName, "R").SetValue(false));
                            menuUseAgainstHero.AddItem(new MenuItem("ignore" + item.menuVariable + hero.BaseSkinName, "Ignore %HP").SetValue(true));
                            menuUseAgainst.AddSubMenu(menuUseAgainstHero);
                            // Bring all, passives, summoners spells, etc;

                            /*if (hero.Spellbook.Spells.Count() > 0)
                             * {
                             *  var menuUseAgainstHero = new Menu(hero.BaseSkinName, "useAgainst" + hero.BaseSkinName);
                             *  menuUseAgainstHero.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));
                             *  foreach(SpellDataInst spell in hero.Spellbook.Spells)
                             *  {
                             *      menuUseAgainstHero.AddItem(new MenuItem("useAgainstSpell" + spell.Name, spell.Name).SetValue(true));
                             *  }
                             *  menuUseAgainst.AddSubMenu(menuUseAgainstHero);
                             * }
                             * else
                             * {
                             *  Console.WriteLine("MasterActivator cant get " + hero.BaseSkinName + " spells!");
                             * }*/
                        }
                    }
                    menu.AddSubMenu(menuUseAgainst);
                    Config.SubMenu(parent).AddSubMenu(menu);
                }
            }
            else if (item.type == ItemTypeId.KSAbility)
            {
                var abilitySlot = Utility.GetSpellSlot(_player, item.name);
                if (abilitySlot != SpellSlot.Unknown && abilitySlot == item.abilitySlot)
                {
                    var ksAbMenu = new Menu(item.menuName, "menu" + item.menuVariable);
                    ksAbMenu.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));
                    //choRMenu.AddItem(new MenuItem(choR.menuVariable + "plus", "Plus").SetValue(false));
                    ksAbMenu.AddItem(new MenuItem(item.menuVariable + "drawRange", "Draw Range").SetValue(true));
                    ksAbMenu.AddItem(new MenuItem(item.menuVariable + "drawBar", "Draw Bar").SetValue(true));
                    Config.SubMenu(parent).AddSubMenu(ksAbMenu);
                }
            }
            else
            {
                var menu = new Menu(item.menuName, "menu" + item.menuVariable);
                menu.AddItem(new MenuItem(item.menuVariable, "Enable").SetValue(true));

                if (defaultValue != 0)
                {
                    if (item.type == ItemTypeId.OffensiveAOE)
                    {
                        menu.AddItem(new MenuItem(item.menuVariable + "UseXUnits", "On X Units")).SetValue(new Slider(defaultValue, 1, 5));
                    }
                    else
                    {
                        menu.AddItem(new MenuItem(item.menuVariable + "UseOnPercent", "Use on " + (mana == false ? "%HP" : "%Mana"))).SetValue(new Slider(defaultValue, 0, 100));
                    }
                }
                Config.SubMenu(parent).AddSubMenu(menu);
            }
        }