Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // 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));

            // By moving here, we do not reload the tasklist every time we stop the program with the GHK
            // 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);

            // Set Hotkey
            ghk = new GlobalHotkey(GlobalHotkey.Constants.CTRL + GlobalHotkey.Constants.SHIFT, Keys.D, this);
            if (!ghk.Register())
            {
                throw new Exception("can't register");
            }
        }
Example #2
0
        private void reloadBtn_Click(object sender, EventArgs e)
        {
            string ret = PlayerEngine.ParseTasklist(Properties.Settings.Default.taskList);

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

            TaskBox.Text = Properties.Settings.Default.taskList;
        }
Example #3
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            string ret = PlayerEngine.ParseTasklist(TaskBox.Text);

            if (ret != null)
            {
                MessageBox.Show(string.Format("Error parsing task list: {0}", ret));
            }
            else
            {
                Properties.Settings.Default.taskList = TaskBox.Text;
                Properties.Settings.Default.Save();

                MessageBox.Show("Tasklist Saved!");
            }
        }
Example #4
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;
                }
            }
        }