private void MainWindow_Shown(object sender, EventArgs e) { try { var frmSelect = new SelectWoWProcessToAttachTo(this); frmSelect.ShowDialog(); if (process == null) { Close(); } Log.Write("Attempting to connect to running WoW.exe process...", Color.Black); wowHook = new Hook(process); wowHook.InstallHook(); lua = new Lua(wowHook); Log.Write("Connected to process with ID = " + process?.Id, Color.Black); Log.Write("Click 'Fish' to begin fishing.", Color.Green); } catch (Exception ex) { Log.Write(ex.Message, Color.Red); } }
private void MainWindow_Shown(object sender, EventArgs e) { try { Log.Write("Attempting to connect to running WoW.exe process...", Color.Black); var proc = Process.GetProcessesByName("WoW").FirstOrDefault(); while (proc == null) { var res = MessageBox.Show("Please open WoW, and login, and select your character before using the bot.", "FishBot", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (res == DialogResult.Cancel) { Application.Exit(); return; } proc = Process.GetProcessesByName("WoW").FirstOrDefault(); } wowHook = new Hook(proc); wowHook.InstallHook(); lua = new Lua(wowHook); Log.Write("Connected to process with ID = " + proc.Id, Color.Black); textBox1.Text = wowHook.Memory.ReadString(Offsets.PlayerName, Encoding.UTF8, 512, true); Log.Write("Base Address = " + wowHook.Process.BaseOffset().ToString("X")); Log.Write("Target GUID = " + wowHook.Memory.Read <ulong>(Offsets.TargetGUID, true)); var objMgr = wowHook.Memory.Read <IntPtr>(Offsets.CurMgrPointer, true); var curObj = wowHook.Memory.Read <IntPtr>(IntPtr.Add(objMgr, (int)Offsets.FirstObjectOffset)); FirstObj = curObj; Log.Write("First object located @ memory location 0x" + FirstObj.ToString("X"), Color.Black); //Thread mouseOver = new Thread(delegate() // { // for (;;) // { // Log.Write("MouseOverGUID = " + wowHook.Memory.Read<UInt64>(Offsets.MouseOverGUID, false).ToString("X")); // Thread.Sleep(1000); // } // }); //mouseOver.Start(); //lua.DoString("DoEmote('dance')"); Log.Write("Click 'Fish' to begin fishing.", Color.Green); } catch (Exception ex) { Log.Write(ex.Message, Color.Red); } }