Example #1
0
        public static int OverrideValue(this DodgeAbilityInfo info)
        {
            var combobox = (MenuComboBox)EvadeOverrideMenuByChampion[info.Champion]
                           .FirstOrDefault(s => s.Name == "override_" + info.Champion + info.AbilitySlot.ToFriendlyString());

            return(combobox == null ? 0 : combobox.CurrentValue);
        }
Example #2
0
        public static Vector2 GetJumpPos(this DodgeAbilityInfo data)
        {
            if (MenuHandler.JumpMode == 1)
            {
                return(GetBestJumpPosition(data.Range, (int)(data.Range * 5)));
            }

            return(Main.MouseWorldPos);
        }
Example #3
0
        private static void AddEvadeOverrideEntry(string champ, DodgeAbilityInfo abilityInfo)
        {
            var abilityKey = abilityInfo.AbilitySlot.ToFriendlyString();
            var comboBox   = EvadeOverrideMenu.Add(new MenuComboBox("override_" + champ + abilityKey,
                                                                    "Choose logic for " + champ + "'s " + abilityKey + " (" + abilityInfo.AbilityType.ToFriendlyString() + ")", 0, new[] { "Default" }));

            comboBox.Hidden = true;
            EvadeOverrideMenuByChampion[champ].Add(comboBox);
        }
Example #4
0
        private static void SpellDetector_OnSpellCast(SpellCastArgs args)
        {
            var casting = CastingEvadeSpell();

            if (casting != null && casting.UseInEvade && casting.ShouldUse())
            {
                _castingLastFrame = casting;
            }
        }
        public static bool IsReady(this DodgeAbilityInfo data)
        {
            var slot = data.AbilitySlot == AbilitySlot.EXAbility1 || data.AbilitySlot == AbilitySlot.EXAbility2
                ? data.SharedCooldown
                : data.AbilitySlot;
            var ability = LocalPlayer.GetAbilityHudData(slot);

            return(ability != null && ability.CooldownLeft <= 0 && ability.EnergyCost <= LocalPlayer.Instance.Energized.Energy);
        }
Example #6
0
        private static void AddEvadeSkillsEntry(string champ, DodgeAbilityInfo abilityInfo)
        {
            var abilityKey = abilityInfo.AbilitySlot.ToFriendlyString();

            EvadeSkillsMenuByChampion[champ].Add(EvadeSkillsMenu.Add(new MenuCheckBox(
                                                                         "use_" + champ + abilityKey,
                                                                         "Use " + abilityKey + " (" + abilityInfo.AbilityType.ToFriendlyString() + ")")));
            EvadeSkillsMenuByChampion[champ].Add(EvadeSkillsMenu.Add(new MenuIntSlider(
                                                                         "danger_" + champ + abilityKey, "Minimum danger", abilityInfo.MinDanger, 5, 1)));
            EvadeSkillsMenuByChampion[champ].Add(EvadeSkillsMenu.AddSeparator(5));
        }
Example #7
0
        public static bool ShouldUse(this DodgeAbilityInfo info)
        {
            var champList = EvadeSkillsMenuByChampion[info.Champion];
            var checkbox  = (MenuCheckBox)champList.FirstOrDefault(s =>
                                                                   s.Name == "use_" + info.Champion + info.AbilitySlot.ToFriendlyString());

            if (checkbox != default(MenuCheckBox))
            {
                return(checkbox.CurrentValue);
            }

            Console.WriteLine("[Evade/MenuHandler] Strange! Couldn't find menu item for " + info.Champion +
                              info.AbilitySlot.ToFriendlyString());
            return(false);
        }
Example #8
0
 public static void SetStatus(this DodgeAbilityInfo info, bool newValue)
 {
     if (newValue && _activeSpell == null)
     {
         _activeSpell = (MenuCheckBox)EvadeStatusMenuByChampion[info.Champion]
                        .FirstOrDefault(s => s.Name == "isActive_" + info.Champion + info.AbilitySlot.ToFriendlyString());
         if (_activeSpell != null)
         {
             _activeSpell.CurrentValue = true;
         }
     }
     else if (!newValue && _activeSpell != null)
     {
         _activeSpell.CurrentValue = false;
         _activeSpell = null;
     }
 }
Example #9
0
 public static int GetDanger(this DodgeAbilityInfo info)
 {
     return(((MenuIntSlider)EvadeSkillsMenuByChampion[info.Champion]
             .First(s => s.Name == "danger_" + info.Champion + info.AbilitySlot.ToFriendlyString()))
            .CurrentValue);
 }
Example #10
0
 private static void AddEvadeStatusEntry(string champ, DodgeAbilityInfo abilityInfo)
 {
     EvadeStatusMenuByChampion[champ].Add(EvadeStatusMenu.Add(new MenuCheckBox(
                                                                  "isActive_" + champ + abilityInfo.AbilitySlot.ToFriendlyString(),
                                                                  "Active: " + champ + abilityInfo.AbilityId)));
 }
Example #11
0
 public static void Unload()
 {
     Game.OnUpdate             -= OnUpdate;
     SpellDetector.OnSpellCast -= SpellDetector_OnSpellCast;
     _castingLastFrame          = null;
 }
Example #12
0
        private static bool SkillAimLogic()
        {
            var dangerousProjectiles = new List <TrackedProjectile>();

            dangerousProjectiles.AddRange(ObjectTracker.Enemy.Projectiles.TrackedObjects);
            dangerousProjectiles = dangerousProjectiles.Where(p => p.IsDangerous).ToList();
            if (_castingLastFrame != null && LocalPlayer.Instance.AbilitySystem.IsCasting &&
                LocalPlayer.Instance.AbilitySystem.CastingAbilityId == _castingLastFrame.AbilityId)
            {
                var casting = _castingLastFrame;
                casting.SetStatus(true);

                if (casting.OverrideValue() != 0)
                {
                    return(false);
                }

                if (casting.AbilityType == DodgeAbilityType.Jump && casting.UsesMousePos)
                {
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(casting.GetJumpPos());
                }
                else if (casting.AbilityType == DodgeAbilityType.Obstacle && dangerousProjectiles.Any())
                {
                    LocalPlayer.EditAimPosition = true;
                    var projectile = dangerousProjectiles
                                     .OrderByDescending(p => p.Data.Danger)
                                     .First().Projectile;
                    var pos = LocalPlayer.Instance.Pos().Extend(projectile.MapObject.Position, 1.5f);
                    LocalPlayer.Aim(pos);
                }
                else if (casting.AbilityType == DodgeAbilityType.Shield && casting.UsesMousePos && dangerousProjectiles.Any())
                {
                    var projectile = dangerousProjectiles
                                     .OrderByDescending(p => p.Data.Danger)
                                     .First().Projectile;
                    var pos = GeometryLib.NearestPointOnFiniteLine(projectile.MapObject.Position,
                                                                   LocalPlayer.Instance.Pos(), Main.MouseWorldPos);
                    if (LocalPlayer.Instance.Distance(pos) < 1)
                    {
                        pos = LocalPlayer.Instance.Pos().Extend(projectile.MapObject.Position, 1);
                    }
                    LocalPlayer.Aim(pos);
                }
                else if (casting.NeedsSelfCast)
                {
                    LocalPlayer.EditAimPosition = true;
                    LocalPlayer.Aim(LocalPlayer.Instance.Pos());
                }

                return(true);
            }

            if (!LocalPlayer.Instance.AbilitySystem.IsCasting && _castingLastFrame != null)
            {
                _castingLastFrame.SetStatus(false);
                _castingLastFrame           = null;
                LocalPlayer.EditAimPosition = false;
            }

            return(false);
        }