/// <summary> /// OnProcessSpellCast event for detect the auto attack and auto attack resets /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The args.</param> private void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender.IsMe) { if (Utility.IsAutoAttack(args.SData.Name)) { m_IslastCastedAA = true; OnAttackArgs onAttackArgs = Events.FireOnAttack(this, args.Target as AttackableUnit); if (!onAttackArgs.Cancel) { m_lastAATick = Utils.TickCount - Game.Ping / 2; m_lastWindUpTime = (int)Math.Round(sender.AttackCastDelay * 1000); m_lastAttackCooldown = (int)Math.Round(sender.AttackDelay * 1000); m_lastAttackCompletesAt = m_lastAATick + m_lastWindUpTime; m_lastAttackPos = ObjectManager.Player.ServerPosition.To2D(); m_attackInProgress = true; } if (m_baseAttackSpeed == 0.5f) { SetOrbwalkValues(); } } else { m_IslastCastedAA = false; if (Utility.IsAutoAttackReset(args.SData.Name)) { ResetAATimer(); } else if (!Utility.IsAutoAttackReset(args.SData.Name)) { if (m_attackInProgress) { ResetAATimer(); } } else if (args.SData.Name == "AspectOfTheCougar") { ResetOrbwalkValues(); } } } else { if (sender.Type == GameObjectType.obj_AI_Turret && args.Target.Type == GameObjectType.obj_AI_Minion && sender.Team == ObjectManager.Player.Team && args.Target.Position.Distance(ObjectManager.Player.ServerPosition) <= 2000) { m_towerTarget = args.Target as Obj_AI_Base; m_sourceTower = sender; m_towerAttackTick = Utils.TickCount - Game.Ping / 2; } } }
/// <summary> /// Invokes on attack event /// </summary> /// <param name="instance">Orbwalker instance</param> /// <param name="target">Target</param> /// <returns></returns> public static OnAttackArgs FireOnAttack(Orbwalker instance, AttackableUnit target) { OnAttackArgs args = new OnAttackArgs(); args.Instance = instance; args.Target = target; if (OnAttack != null) { OnAttack(args); } if (args.Cancel) { EloBuddy.Player.IssueOrder(GameObjectOrder.Stop, ObjectManager.Player); } return(args); }
private void Obj_AI_Base_OnBasicAttack(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender.IsMe) { m_IslastCastedAA = true; OnAttackArgs onAttackArgs = Events.FireOnAttack(this, args.Target as AttackableUnit); if (!onAttackArgs.Cancel) { m_lastAATick = Utils.TickCount - Game.Ping / 2; m_lastWindUpTime = (int)Math.Round(sender.AttackCastDelay * 1000); m_lastAttackCooldown = (int)Math.Round(sender.AttackDelay * 1000); m_lastAttackCompletesAt = m_lastAATick + m_lastWindUpTime; m_lastAttackPos = ObjectManager.Player.ServerPosition.To2D(); m_attackInProgress = true; } if (m_baseAttackSpeed == 0.5f) { SetOrbwalkValues(); } } }
/// <summary> /// Invokes on attack event /// </summary> /// <param name="instance">Orbwalker instance</param> /// <param name="target">Target</param> /// <returns></returns> public static OnAttackArgs FireOnAttack(Orbwalker instance, AttackableUnit target) { OnAttackArgs args = new OnAttackArgs(); args.Instance = instance; args.Target = target; if (OnAttack != null) OnAttack(args); if (args.Cancel) ObjectManager.Player.IssueOrder(GameObjectOrder.Stop, ObjectManager.Player); return args; }