private void Loot(Point bobberPosition) { logger.Info($"Right clicking mouse to Loot."); Sleep(1000); WowProcess.RightClickMouse(logger, bobberPosition); Sleep(1000); }
public void Start() { biteWatcher.FishingEventHandler = (e) => FishingEventHandler?.Invoke(this, e); isEnabled = true; DoTenMinuteKey(); while (isEnabled) { try { logger.Info($"Pressing key {castKey} to Cast."); PressTenMinKeyIfDue(); FishingEventHandler?.Invoke(this, new FishingEvent { Action = FishingAction.Cast }); WowProcess.PressKey(castKey); Watch(2000); WaitForBite(); } catch (Exception e) { logger.Error(e.ToString()); Sleep(2000); } } logger.Error("Bot has Stopped."); }
public MainWindow() { InitializeComponent(); ((Logger)FishingBot.logger.Logger).AddAppender(this); this.DataContext = LogEntries = new ObservableCollection <LogEntry>(); this.pixelClassifier = new PixelClassifier(); pixelClassifier.SetConfiguration(WowProcess.IsWowClassic()); this.bobberFinder = new SearchBobberFinder(pixelClassifier); var imageProvider = bobberFinder as IImageProvider; if (imageProvider != null) { imageProvider.BitmapEvent += ImageProvider_BitmapEvent; } this.biteWatcher = new PositionBiteWatcher(strikeValue); this.WindowSizeChangedTimer = new Timer { AutoReset = false, Interval = 100 }; this.WindowSizeChangedTimer.Elapsed += SizeChangedTimer_Elapsed; this.CardGrid.SizeChanged += MainWindow_SizeChanged; this.Closing += (s, e) => botThread?.Abort(); this.KeyChooser.CastKeyChanged += (s, e) => { this.Settings.Focus(); this.bot?.SetCastKey(this.KeyChooser.CastKey); }; }
public static void RightClickMouse(ILog logger, System.Drawing.Point position) { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); if (wowProcess != null) { var oldPosition = System.Windows.Forms.Cursor.Position; for (int i = 20; i > 0; i--) { SetCursorPos(position.X + i, position.Y + i); Thread.Sleep(1); } Thread.Sleep(100); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONDOWN, Keys.VK_RMB, 0); Thread.Sleep(30 + random.Next(0, 47)); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONUP, Keys.VK_RMB, 0); RefocusOnOldScreen(logger, activeProcess, wowProcess, oldPosition); } }
public static Bitmap GetBitmap() { var wowProcess = WowProcess.Get(); if (wowProcess == null) { return(new Bitmap(0, 0)); } var handle = wowProcess.MainWindowHandle; var rect = new Rect(); GetWindowRect(handle, ref rect); var bounds = new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top); wowWindowdBounds = bounds; var result = new Bitmap(bounds.Width / 2, (bounds.Height / 2)); using (var graphics = Graphics.FromImage(result)) { graphics.CopyFromScreen(new Point(bounds.Left + bounds.Width / 4, bounds.Top + bounds.Height / 4), Point.Empty, bounds.Size); } return(result); //var bmpScreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width / 2, (Screen.PrimaryScreen.Bounds.Height / 2)-100); //var graphics = Graphics.FromImage(bmpScreen); //graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.Width / 4, Screen.PrimaryScreen.Bounds.Height / 4, 0, 0, bmpScreen.Size); //graphics.Dispose(); //return bmpScreen; }
public static void applyLure(ConsoleKey rodKey, ConsoleKey lureKey) { logger.Info($"Applying lure with key {lureKey} on rod key {rodKey}."); WowProcess.PressKey(lureKey); Thread.Sleep(250); WowProcess.PressKey(rodKey); // Wait for the lure to be applied // We also need longer sleep for re-applying to be not too soon Thread.Sleep(15000); }
public static void RightClickMouse() { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); var oldPosition = System.Windows.Forms.Cursor.Position; PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONDOWN, Keys.VK_RMB, 0); Thread.Sleep(30 + random.Next(0, 47)); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONUP, Keys.VK_RMB, 0); }
/// <summary> /// Ten minute key can do anything you want e.g. /// Macro to apply a lure: /// /use Bright Baubles /// /use 16 /// /// Or a macro to delete junk: /// /run for b=0,4 do for s=1,GetContainerNumSlots(b) do local n=GetContainerItemLink(b,s) if n and (strfind(n,"Raw R") or strfind(n,"Raw Spot") or strfind(n,"Raw Glo") or strfind(n,"roup")) then PickupContainerItem(b,s) DeleteCursorItem() end end end /// </summary> private void DoTenMinuteKey() { StartTime = DateTime.Now; logger.Info($"Pressing key {tenMinKey} to run a macro."); FishingEventHandler?.Invoke(this, new FishingEvent { Action = FishingAction.Cast }); foreach (var key in tenMinKey) { WowProcess.PressKey(key); } }
public static void RightClickMouse(ILog logger, System.Drawing.Point position) { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); var oldPosition = System.Windows.Forms.Cursor.Position; System.Windows.Forms.Cursor.Position = position; PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONDOWN, Keys.VK_RMB, 0); Thread.Sleep(30 + random.Next(0, 47)); PostMessage(wowProcess.MainWindowHandle, Keys.WM_RBUTTONUP, Keys.VK_RMB, 0); RefocusOnOldScreen(logger, activeProcess, wowProcess, oldPosition); }
public static void RightClickMouse_LiamCooper(ILog logger, System.Drawing.Point position) { var activeProcess = GetActiveProcess(); var wowProcess = WowProcess.Get(); if (wowProcess != null) { var oldPosition = System.Windows.Forms.Cursor.Position; System.Windows.Forms.Cursor.Position = position; mouse_event((int)MouseEventFlags.RightDown, position.X, position.Y, 0, 0); Thread.Sleep(30 + random.Next(0, 47)); mouse_event((int)MouseEventFlags.RightUp, position.X, position.Y, 0, 0); RefocusOnOldScreen(logger, activeProcess, wowProcess, oldPosition); } }
private void PressTenMinKey() { if ((DateTime.Now - StartTime).TotalMinutes > 10 && tenMinKey.Count > 0) { StartTime = DateTime.Now; logger.Info($"Pressing key {tenMinKey} to run a macro."); FishingEventHandler?.Invoke(this, new FishingEvent { Action = FishingAction.Cast }); foreach (var key in tenMinKey) { WowProcess.PressKey(key); } } }
/// <summary> /// Ten minute key can do anything you want e.g. /// Macro to apply a lure: /// /use Bright Baubles /// /use 16 /// /// Or a macro to delete junk: /// /run for b=0,4 do for s=1,GetContainerNumSlots(b) do local n=GetContainerItemLink(b,s) if n and (strfind(n,"Raw R") or strfind(n,"Raw Spot") or strfind(n,"Raw Glo") or strfind(n,"roup")) then PickupContainerItem(b,s) DeleteCursorItem() end end end /// </summary> private void DoTenMinuteKey() { StartTime = DateTime.Now; if (tenMinKey.Count == 0) { logger.Info($"Ten Minute Key: No keys defined in tenMinKey, so nothing to do (Define in call to FishingBot constructor)."); } FishingEventHandler?.Invoke(this, new FishingEvent { Action = FishingAction.Cast }); foreach (var key in tenMinKey) { logger.Info($"Ten Minute Key: Pressing key {key} to run a macro, delete junk fish or apply a lure etc."); WowProcess.PressKey(key); } }
private void Play_Click(object sender, RoutedEventArgs e) { if (bot == null) { WowProcess.PressKey(ConsoleKey.Spacebar); System.Threading.Thread.Sleep(1500); SetButtonStates(false); botThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.BotThread)); botThread.Start(); // Hide cards after 10 minutes var timer = new Timer { Interval = 1000 * 60 * 10, AutoReset = false }; timer.Elapsed += (s, ev) => this.Dispatch(() => this.LogFlipper.IsFlipped = this.GraphFlipper.IsFlipped = true); timer.Start(); } }