public void Execute() { if (Finished) { return; } WowGameobject lootableObject = WowInterface.ObjectManager.WowObjects.OfType <WowGameobject>() .Where(e => e.DisplayId == ObjectDisplayId) .OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)) .FirstOrDefault(); if (lootableObject != null) { if (lootableObject.Position.GetDistance(WowInterface.ObjectManager.Player.Position) > 3.0) { WowInterface.MovementEngine.SetMovementAction(MovementAction.Moving, lootableObject.Position); } else { if (RightClickEvent.Run()) { WowInterface.MovementEngine.Reset(); WowInterface.HookManager.WowStopClickToMove(); WowInterface.HookManager.WowObjectRightClick(lootableObject); } } } else { AreaNode selectedArea = Area .OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)) .FirstOrDefault(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < e.Radius); if (selectedArea != null) { WowInterface.MovementEngine.SetMovementAction(MovementAction.Moving, selectedArea.Position); } } }
public void Execute() { if (Finished) { return; } IWowGameobject lootableObject = Bot.Objects.WowObjects.OfType <IWowGameobject>() .Where(e => e.DisplayId == ObjectDisplayId) .OrderBy(e => e.Position.GetDistance(Bot.Player.Position)) .FirstOrDefault(); if (lootableObject != null) { if (lootableObject.Position.GetDistance(Bot.Player.Position) > 3.0) { Bot.Movement.SetMovementAction(MovementAction.Move, lootableObject.Position); } else { if (RightClickEvent.Run()) { Bot.Movement.Reset(); Bot.Wow.StopClickToMove(); Bot.Wow.InteractWithObject(lootableObject.BaseAddress); } } } else { AreaNode selectedArea = Area .OrderBy(e => e.Position.GetDistance(Bot.Player.Position)) .FirstOrDefault(e => e.Position.GetDistance(Bot.Player.Position) < e.Radius); if (selectedArea != null) { Bot.Movement.SetMovementAction(MovementAction.Move, selectedArea.Position); } } }