Пример #1
0
        private bool checkUsePercent(MItem item, int actualPercent)
        {
            int usePercent = Config.Item(item.menuVariable + "UseOnPercent").GetValue <Slider>().Value;

            return(actualPercent <= usePercent ? true : false);
        }
Пример #2
0
        private void checkAndUse(MItem item, String buff = "", double incDamage = 0, bool ignoreHP = false)
        {
            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.PurifierSpell || item.type == ItemTypeId.OffensiveSpell)
                    {
                        var spellSlot = LeagueSharp.Common.Utility.GetSpellSlot(_player, item.menuVariable);
                        if (spellSlot != SpellSlot.Unknown)
                        {
                            if (_player.Spellbook.CanUseSpell(spellSlot) == SpellState.Ready)
                            {
                                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;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    else
                    {
                        if (Items.HasItem(item.id))
                        {
                            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))
                                        {
                                            Items.UseItem(item.id,
                                                          (item.range == 0 || item.spellType == SpellType.Self) ? null : target);
                                        }
                                    }
                                }
                                else if (item.type == ItemTypeId.HPRegenerator)
                                {
                                    if (checkUsePercent(item, actualHeroHpPercent) && !_player.InFountain() &&
                                        !LeagueSharp.Common.Utility.IsRecalling(_player))
                                    {
                                        if ((buff != "" && !checkBuff(buff)) || buff == "")
                                        {
                                            Items.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))
                                        {
                                            Items.UseItem(item.id);
                                            checkCCTick = LeagueSharp.Common.Utils.TickCount + 2500;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }