Ejemplo n.º 1
0
        private void FrmMain_Shown(object sender, EventArgs e)
        {
            try
            {
                ConfigFile.Initialize();

                chkDisableOverlay.Checked = ConfigFile.DisableOverlay;
                chkDisableOverlay_CheckedChanged(null, null);

                //Log.Write(OperatingSystem);

                if (GameDVR.IsAppCapturedEnabled || GameDVR.IsGameDVREnabled)
                {
                    var dialogResult = MessageBox.Show("Game DVR is currently ENABLED on this machine. Would you like to disable it? PixelMagic will NOT function correctly with it enabled.",
                                                       "DisableGameDVR", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialogResult == DialogResult.Yes)
                    {
                        GameDVR.SetAppCapturedEnabled(0);
                        GameDVR.SetGameDVREnabled(0);
                        MessageBox.Show("Game DVR has been disabled. A restart maybe required to take effect.", "PixelMagic", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        Log.Write("PixelMagic cannot run until GameDVR is disabled", Color.Red);
                        return;
                    }
                }
                else
                {
                    Log.Write("GameDVR is disabled in Xbox app", Color.Green);
                }

                var i = 0;
                foreach (var screen in Screen.AllScreens)
                {
                    i++;
                    Log.Write($"Screen [{i}] - depth: {screen.BitsPerPixel}bit - resolution: {screen.Bounds.Width}x{screen.Bounds.Height}");
                }

                foreach (var item in classes)
                {
                    if (!Directory.Exists(Application.StartupPath + "\\Rotations\\" + item.Value))
                    {
                        Directory.CreateDirectory(Application.StartupPath + "\\Rotations\\" + item.Value);
                    }
                }

                nudPulse.Value = ConfigFile.Pulse;

                //if (!Debugger.IsAttached)
                //{
                frmSelect.ShowDialog();
                //}
                //else
                //{
                //    process = Process.GetProcessesByName("Wow-64").FirstOrDefault();
                //}

                if (process == null)
                {
                    Close();
                }

                ReloadHotkeys();

                WoW.Initialize(process);

                Log.Write("WoW Path: " + WoW.InstallPath, Color.Gray);
                Log.Write("AddOn Path: " + WoW.AddonPath, Color.Gray);

                var hwnd = WoW.Process.MainWindowHandle;

                var myRect = new Rectangle();

                RECT rct;

                if (!GetWindowRect(hwnd, out rct))
                {
                    MessageBox.Show("Unable to find wow resolution from exe, please ensure WoW is running.", "PixelMagic", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                myRect.X      = rct.Left;
                myRect.Y      = rct.Top;
                myRect.Width  = rct.Right - rct.Left + 1;
                myRect.Height = rct.Bottom - rct.Top + 1;

                Log.Write($"Current WoW Resolution is '{myRect.Width - 1}x{myRect.Height - 1}'");

                if (myRect.Width != 1921 || myRect.Height != 1081)
                {
                    if (myRect.Width == 2561)
                    {
                        Log.Write("You are not running an officially supported resolution", Color.OrangeRed);
                        // Allow this res for Suitz he swears it works, if it breaks he will support you with it :P
                    }
                    else
                    {
                        MessageBox.Show("Please ensure you are running wow in 1920x1080 or 2560x1080 resolutions, others are not supported.", "PixelMagic", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Log.Write($"Current WoW Resolution is '{myRect.Width - 1}x{myRect.Height - 1}' only 1920x1080 or 2560x1080 is supported", Color.Red);
                    }
                }


                Log.DrawHorizontalLine();
                Log.Write("Please select a rotation to load from 'File' -> 'Load Rotation...'", Color.Green);
                Log.Write("Please note that you can only start a bot, or setup the spellbook, once you have loaded a rotation", Color.Black);
                Log.DrawHorizontalLine();

                var lastRotation = ConfigFile.ReadValue("PixelMagic", "LastProfile");

                if (!File.Exists(lastRotation))
                {
                    return;
                }

                if (!LoadProfile(lastRotation))
                {
                    Log.Write("Failed to load profile, please select a valid file.", Color.Red);
                }

                // For testing only
                if (!Debugger.IsAttached)
                {
                    // ReSharper disable once RedundantJumpStatement
                    return;
                }

                //var rot = new WindwalkerMonk();
                //rot.Load(this);
                //combatRoutine = rot.combatRoutine;
                //combatRoutine.FileName = Application.StartupPath + @"\Rotations\Monk\Monk-Windwalker-Mixo.cs";
                //Log.Write("Successfully loaded combat routine: " + combatRoutine.Name, Color.Green);
                //if (SpellBook.Initialize(Application.StartupPath + @"\Rotations\Monk\Monk-Windwalker-Mixo.cs"))
                //{
                //    spellbookToolStripMenuItem.Enabled = true;
                //    cmdStartBot.Enabled = true;
                //    cmdStartBot.BackColor = Color.LightGreen;
                //    cmdRotationSettings.Enabled = true;
                //}
                //else
                //{
                //    spellbookToolStripMenuItem.Enabled = false;
                //    cmdStartBot.Enabled = false;
                //    cmdStartBot.BackColor = Color.WhiteSmoke;
                //}
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message, Color.Red);
            }
        }
Ejemplo n.º 2
0
        private void FrmMain_Shown(object sender, EventArgs e)
        {
            try
            {
                ConfigFile.Initialize();

                Log.Write(OperatingSystem);

                var i = 0;
                foreach (var screen in Screen.AllScreens)
                {
                    i++;
                    Log.Write($"Screen [{i}] - depth: {screen.BitsPerPixel}bit - resolution: {screen.Bounds.Width}x{screen.Bounds.Height}");
                }

                foreach (var item in classes)
                {
                    if (!Directory.Exists(Application.StartupPath + "\\Rotations\\" + item.Value))
                    {
                        Directory.CreateDirectory(Application.StartupPath + "\\Rotations\\" + item.Value);
                    }
                }

                nudPulse.Value = ConfigFile.Pulse;

                SelectWoWProcessToAttachTo f = new SelectWoWProcessToAttachTo(this);
                f.ShowDialog();

                if (process == null)
                {
                    Close();
                }

                ReloadHotkeys();

                WoW.Initialize(process);

                Log.Write("WoW Path: " + WoW.InstallPath, Color.Gray);
                Log.Write("AddOn Path: " + WoW.AddonPath, Color.Gray);

                var mousePos = new Thread(delegate()
                {
                    while (true)
                    {
                        Threads.UpdateTextBox(txtMouseXY, Cursor.Position.X + "," + Cursor.Position.Y);
                        Thread.Sleep(10);
                    }
                    // ReSharper disable once FunctionNeverReturns
                })
                {
                    IsBackground = true
                };
                mousePos.Start();

                Log.DrawHorizontalLine();
                Log.Write("Please select a rotation to load from 'File' -> 'Load Rotation...'", Color.Green);
                Log.Write("Please note that you can only start a bot, or setup the spellbook, once you have loaded a rotation", Color.Black);
                Log.DrawHorizontalLine();

                //// For testing only
                //if (!Debugger.IsAttached || Environment.MachineName != "BRETT-PC")
                //    return;

                //var rot = new Warrior();
                //rot.Load(this);
                //combatRoutine = rot.combatRoutine;
                //combatRoutine.FileName = Application.StartupPath + @"\Rotations\Warrior\Warrior.cs";
                //Log.Write("Successfully loaded combat routine: " + combatRoutine.Name, Color.Green);
                //Overlay.showOverlay(new Point(20, 680));
                //if (SpellBook.Initialize(Application.StartupPath + @"\Rotations\Warrior\Warrior.cs"))
                //{
                //    spellbookToolStripMenuItem.Enabled = true;
                //    submitTicketToolStripMenuItem.Enabled = true;
                //    cmdStartBot.Enabled = true;
                //    cmdStartBot.BackColor = Color.LightGreen;
                //    cmdRotationSettings.Enabled = true;
                //}
                //else
                //{
                //    spellbookToolStripMenuItem.Enabled = false;
                //    submitTicketToolStripMenuItem.Enabled = false;
                //    cmdStartBot.Enabled = false;
                //    cmdStartBot.BackColor = Color.WhiteSmoke;
                //}
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message, Color.Red);
            }
        }
Ejemplo n.º 3
0
        private void FrmMain_Shown(object sender, EventArgs e)
        {
            try
            {
                ConfigFile.Initialize();

                Log.Write(OperatingSystem);

                var i = 0;
                foreach (var screen in Screen.AllScreens)
                {
                    i++;
                    Log.Write($"Screen [{i}] - depth: {screen.BitsPerPixel}bit - resolution: {screen.Bounds.Width}x{screen.Bounds.Height}");
                }

                foreach (var item in classes)
                {
                    if (!Directory.Exists(Application.StartupPath + "\\Rotations\\" + item.Value))
                        Directory.CreateDirectory(Application.StartupPath + "\\Rotations\\" + item.Value);
                }

                nudPulse.Value = ConfigFile.Pulse;

                SelectWoWProcessToAttachTo f = new SelectWoWProcessToAttachTo(this);
                f.ShowDialog();

                if (process == null)
                {
                    Close();
                }

                ReloadHotkeys();

                WoW.Initialize(process);

                Log.Write("WoW Path: " + WoW.InstallPath, Color.Gray);
                Log.Write("AddOn Path: " + WoW.AddonPath, Color.Gray);

                var mousePos = new Thread(delegate ()
                {
                    while (true)
                    {
                        Threads.UpdateTextBox(txtMouseXY, Cursor.Position.X + "," + Cursor.Position.Y);
                        Thread.Sleep(10);
                    }
                    // ReSharper disable once FunctionNeverReturns
                })
                { IsBackground = true };
                mousePos.Start();

                Log.DrawHorizontalLine();
                Log.Write("Please select a rotation to load from 'File' -> 'Load Rotation...'", Color.Green);
                Log.Write("Please note that you can only start a bot, or setup the spellbook, once you have loaded a rotation", Color.Black);
                Log.DrawHorizontalLine();

                //// For testing only
                //if (!Debugger.IsAttached || Environment.MachineName != "BRETT-PC")
                //    return;

                //var rot = new Warrior();
                //rot.Load(this);
                //combatRoutine = rot.combatRoutine;
                //combatRoutine.FileName = Application.StartupPath + @"\Rotations\Warrior\Warrior.cs";
                //Log.Write("Successfully loaded combat routine: " + combatRoutine.Name, Color.Green);
                //Overlay.showOverlay(new Point(20, 680));
                //if (SpellBook.Initialize(Application.StartupPath + @"\Rotations\Warrior\Warrior.cs"))
                //{
                //    spellbookToolStripMenuItem.Enabled = true;
                //    submitTicketToolStripMenuItem.Enabled = true;
                //    cmdStartBot.Enabled = true;
                //    cmdStartBot.BackColor = Color.LightGreen;
                //    cmdRotationSettings.Enabled = true;
                //}
                //else
                //{
                //    spellbookToolStripMenuItem.Enabled = false;
                //    submitTicketToolStripMenuItem.Enabled = false;
                //    cmdStartBot.Enabled = false;
                //    cmdStartBot.BackColor = Color.WhiteSmoke;
                //}
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message, Color.Red);
            }
        }