private void MainWindow_Shown(object sender = null, EventArgs e = null) { Log.Write("Make sure to run program as administrator", Color.Crimson); Log.Write("Turn off auto-loot for power fishing, or turn on auto loot to gather fish", Color.Crimson); try { Log.Write("Attempting to connect to running WoW.exe process...", Color.Black); var proc = Process.GetProcessesByName("WoW").FirstOrDefault(); if (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); var s_curMgr = wowHook.Memory.Read <IntPtr>(IntPtr.Add(wowHook.Memory.Read <IntPtr>(Offsets.g_clientConnection), (int)Offsets.s_curMgrOffset)); var curObj = wowHook.Memory.Read <IntPtr>(IntPtr.Add(s_curMgr, (int)Offsets.FirstObjectOffset)); FirstObj = curObj; lua.DoString("zoneData = GetZoneText()"); // Thread.Sleep(100); Log.Write("Zone: " + lua.GetLocalizedText("zoneData"), Color.Black); var PlayerBase = new IntPtr(0x00CD87A8); playerbase = wowHook.Memory.Read <IntPtr>( wowHook.Memory.Read <IntPtr>( wowHook.Memory.Read <IntPtr>(PlayerBase) + 0x34) + 0x24); 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); var s_curMgr = wowHook.Memory.Read <IntPtr>(IntPtr.Add(wowHook.Memory.Read <IntPtr>(Offsets.g_clientConnection), (int)Offsets.s_curMgrOffset)); var curObj = wowHook.Memory.Read <IntPtr>(IntPtr.Add(s_curMgr, (int)Offsets.FirstObjectOffset)); FirstObj = curObj; //Log("First object located @ memory location 0x" + FirstObj.ToString("X"), Color.Black); lua.DoString("zoneData = GetZoneText()"); // Thread.Sleep(100); Log.Write("Zone: " + lua.GetLocalizedText("zoneData"), Color.Black); var PlayerBase = new IntPtr(0x00CD87A8); playerbase = wowHook.Memory.Read <IntPtr>( wowHook.Memory.Read <IntPtr>( wowHook.Memory.Read <IntPtr>(PlayerBase) + 0x34) + 0x24); //var x = wowHook.Memory.Read<float>(playerbase + 0x798); //var y = wowHook.Memory.Read<float>(playerbase + 0x79C); //var z = wowHook.Memory.Read<float>(playerbase + 0x7A0); //lua.ctm(5734.542f, 510.5383f, 647.4522f, 0, 4, 1.0f, playerbase); //lua.ctm(x, y, z, 0xF130000FEB01CD9F, 4, 1.0f, playerbase); // public enum ClickToMoveType : uint //{ // FaceTarget = 0x1, // Face = 0x2, // Stop_ThrowsException = 0x3, // Move = 0x4, // NpcInteract = 0x5, // Loot = 0x6, // ObjInteract = 0x7, // FaceOther = 0x8, // Skin = 0x9, // AttackPosition = 0xA, // AttackGuid = 0xB, // ConstantFace = 0xC, // None = 0xD, // Attack = 0x10, // Idle = 0x13, //} Log.Write("Click 'Fish' to begin fishing.", Color.Green); } catch (Exception ex) { Log.Write(ex.Message, Color.Red); } }