Esempio n. 1
0
        public void ToggleAutoplayer(bool state)
        {
            if (state && !GameEngine.ValidatePlayableArea())
            {
                MessageBox.Show("Can't find game, please check your settings");
                return;
            }

            if (ClickerThread == null)
            {
                ClickerThread = new Thread(new ThreadStart(PlayerEngine.ClickThread));
                ClickerThread.Start();
                // Sets the culture to English (US)
                ClickerThread.CurrentCulture   = new CultureInfo("en-US");
                ClickerThread.CurrentUICulture = new CultureInfo("en-US");
            }

            lblCursorPos.ForeColor = state ? Color.Red : Color.Black;
            button1.Text           = state ? "Stop ( CTRL + SHIFT + D )" : "Start";
            PlayerEngine.SetThreadActive(state ? 1 : 0);
            parsegame.Enabled          = state;
            useskills.Enabled          = state;
            toolStripMenuItem1.Enabled = !state;

            if (state && Properties.Settings.Default.logging)
            {
                loggingDirectory = string.Format("{0}\\logs", Application.StartupPath);
                if (!Directory.Exists(loggingDirectory))
                {
                    Directory.CreateDirectory(loggingDirectory);
                }

                currentLoggingString = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
                Directory.CreateDirectory(string.Format("{0}\\{1}", loggingDirectory, currentLoggingString));
                Directory.CreateDirectory(string.Format("{0}\\{1}\\screenshots", loggingDirectory, currentLoggingString));
                sw            = File.AppendText(string.Format("{0}\\{1}\\{1}.csv", loggingDirectory, currentLoggingString));
                TimeToNextLog = DateTime.Now;
            }
            else
            {
                if (sw != null)
                {
                    sw.Dispose();
                    sw = null;
                }
            }
        }
Esempio n. 2
0
        public void ToggleAutoplayer(bool state)
        {
            // Load Play Area
            top   = Properties.Settings.Default.top;
            bot   = Properties.Settings.Default.bot;
            left  = Properties.Settings.Default.left;
            right = Properties.Settings.Default.right;

            GameEngine.SetPlayableArea(new Rectangle(left, top, right - left, bot - top));

            if (state && !GameEngine.ValidatePlayableArea())
            {
                MessageBox.Show("Can't find game, please check your settings");
                return;
            }

            if (ClickerThread == null)
            {
                ClickerThread = new Thread(new ThreadStart(PlayerEngine.ClickThread));
                ClickerThread.Start();
                // Sets the culture to English (US)
                ClickerThread.CurrentCulture   = new CultureInfo("en-US");
                ClickerThread.CurrentUICulture = new CultureInfo("en-US");
            }

            // Load Tasks
            string ret = PlayerEngine.ParseTasklist(Properties.Settings.Default.taskList);

            if (ret != null)
            {
                MessageBox.Show(string.Format("Error parsing task list: {0}", ret));
                return;
            }

            // Set Discount
            GameEngine.SetHeroDiscount(1.0 - 0.02 * Properties.Settings.Default.dogcog);

            label1.ForeColor = state ? Color.Red : Color.Black;
            button1.Text     = state ? "Stop ( CTRL + SHIFT + D )" : "Start";
            PlayerEngine.SetThreadActive(state ? 1 : 0);
            parsegame.Enabled          = state;
            useskills.Enabled          = state;
            toolStripMenuItem1.Enabled = !state;

            if (state && Properties.Settings.Default.logging)
            {
                loggingDirectory = string.Format("{0}\\logs", Application.StartupPath);
                if (!Directory.Exists(loggingDirectory))
                {
                    Directory.CreateDirectory(loggingDirectory);
                }

                currentLoggingString = DateTime.Now.ToString("MM-dd-yyyy HH mm ss");
                Directory.CreateDirectory(string.Format("{0}\\{1}", loggingDirectory, currentLoggingString));
                Directory.CreateDirectory(string.Format("{0}\\{1}\\screenshots", loggingDirectory, currentLoggingString));
                sw            = File.AppendText(string.Format("{0}\\{1}\\{1}.csv", loggingDirectory, currentLoggingString));
                TimeToNextLog = DateTime.Now;
            }
            else
            {
                if (sw != null)
                {
                    sw.Dispose();
                    sw = null;
                }
            }
        }