/// <summary> /// On Game Update subscribed event function. /// </summary> /// <param name="eventArgs"> /// <see cref="System.EventArgs" /> /// </param> private static void Game_OnUpdate(EventArgs eventArgs) { if (!Active || ActiveMode == OrbwalkerMode.None) { return; } if (!_player.IsValid()) { _player = ObjectManager.Player; return; } var args = new OrbwalkerArgs { Mode = ActiveMode, Type = OrbwalkerType.None, Windup = 90 }; if (CanAttack()) { var target = GetTarget(ActiveMode); if (target.IsValidTarget()) { args.Target = target; args.Position = target.Position; args.Type = OrbwalkerType.AutoAttack; } } if (!args.Target.IsValidTarget() && CanMove(args.Windup) && Variables.TickCount > _nextMovementTick) { var position = GetPosition(Game.CursorPos); if (position.IsValid()) { args.Position = position; args.Type = OrbwalkerType.Movement; } } if (OnOrbwalk != null) { OnOrbwalk(args); } Orbwalk(args); }
/// <summary> /// Orbwalk command execution. /// </summary> private static void Orbwalk(OrbwalkerArgs args) { if (BlockOnce) { BlockOnce = false; return; } bool order; switch (args.Type) { case OrbwalkerType.AutoAttack: if (!args.Target.IsValidTarget(_player.GetRealAutoAttackRange()) || !CanAttack()) { break; } order = _player.IssueOrder(GameObjectOrder.AttackUnit, args.Target); if (order) { _lastAutoAttackTick = Variables.TickCount + Game.Ping / 2; } break; case OrbwalkerType.Movement: if (!args.Position.IsValid() && !CanMove(args.Windup)) { break; } order = _player.IssueOrder(GameObjectOrder.MoveTo, args.Position); if (order) { _nextMovementTick = Variables.TickCount + 200; } break; } }