public void Execute() { if (Finished || WowInterface.ObjectManager.Player.IsCasting) { return; } if (WowInterface.ObjectManager.Target != null && !WowInterface.ObjectManager.Target.IsDead && !WowInterface.ObjectManager.Target.IsNotAttackable && WowInterface.HookManager.GetUnitReaction(WowInterface.ObjectManager.Player, WowInterface.ObjectManager.Target) != WowUnitReaction.Friendly) { WowUnit = WowInterface.ObjectManager.Target; } else { WowInterface.HookManager.ClearTarget(); WowUnit = WowInterface.ObjectManager.WowObjects .OfType <WowUnit>() .Where(e => !e.IsDead && ObjectDisplayIds.Values.Contains(e.DisplayId)) .OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)) .OrderBy(e => ObjectDisplayIds.First(x => x.Value == e.DisplayId).Key) .FirstOrDefault(); } if (WowUnit != null) { if (WowUnit.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 3.0) { WowInterface.HookManager.StopClickToMoveIfActive(); WowInterface.MovementEngine.Reset(); WowInterface.HookManager.UnitOnRightClick(WowUnit); } else { WowInterface.MovementEngine.SetMovementAction(MovementAction.Moving, WowUnit.Position); } } }
public void Execute() { if (Finished || Bot.Player.IsCasting) { return; } if (Bot.Target != null && !Bot.Target.IsDead && !Bot.Target.IsNotAttackable && Bot.Db.GetReaction(Bot.Player, Bot.Target) != WowUnitReaction.Friendly) { Unit = Bot.Target; } else { Bot.Wow.ClearTarget(); Unit = Bot.Objects.All .OfType <IWowUnit>() .Where(e => !e.IsDead && ObjectDisplayIds.Values.Contains(e.DisplayId)) .OrderBy(e => e.Position.GetDistance(Bot.Player.Position)) .OrderBy(e => ObjectDisplayIds.First(x => x.Value == e.DisplayId).Key) .FirstOrDefault(); } if (Unit != null) { if (Unit.Position.GetDistance(Bot.Player.Position) < 3.0) { Bot.Wow.StopClickToMove(); Bot.Movement.Reset(); Bot.Wow.InteractWithUnit(Unit); } else { Bot.Movement.SetMovementAction(MovementAction.Move, Unit.Position); } } }