示例#1
0
        private void clickyclicky_Tick(object sender, EventArgs e)
        {
            Stopwatch t = new Stopwatch();

            t.Start();

            double       money = GameEngine.GetMoney();
            ParsedHeroes ph    = GameEngine.GetHeroes();

            if (ph != null)
            {
                if (Properties.Settings.Default.useTaskList)
                {
                    label14.Text = PlayerEngine.TryNextTask(ph, money);
                }
                else
                {
                    label14.Text = "None, tasks turned off";
                }

                StringBuilder sb = new StringBuilder();
                if (ph.HeroStats != null)
                {
                    foreach (HeroStats ss in ph.HeroStats)
                    {
                        sb.AppendLine(string.Format("{0}: Lvl {1} Upgrades {2}", ss.Hero.Name, ss.Level, Convert.ToString(ss.UpgradeBitfield, 2)));
                    }
                }
                curHeroesTxt.Text = sb.ToString();
            }
            else
            {
                curHeroesTxt.Text = string.Empty;
            }

            label9.Text = money.ToString();

            if (Properties.Settings.Default.logging && DateTime.Now > TimeToNextLog)
            {
                Stopwatch imgsw = new Stopwatch();
                imgsw.Start();
                sw.WriteLine(string.Format("{0},{1}", DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"), money));

                Rectangle playableArea = GameEngine.GetPlayableArea();
                using (Bitmap bitmap = new Bitmap(playableArea.Width, playableArea.Height)) {
                    using (Graphics g = Graphics.FromImage(bitmap)) {
                        g.CopyFromScreen(new Point(playableArea.Left, playableArea.Top), Point.Empty, playableArea.Size);
                    }

                    bitmap.Save(string.Format("{0}\\{1}\\screenshots\\{2}.png", loggingDirectory, currentLoggingString, DateTime.Now.ToString("MM-dd-yyyy HH mm ss")));
                }
                TimeToNextLog = TimeToNextLog.AddMinutes(1);
                imgsw.Stop();
                label15.Text = string.Format("Image captured at {0} in {1} ms", DateTime.Now.ToString("hh:mm:ss"), imgsw.ElapsedMilliseconds);
            }
            else if (!Properties.Settings.Default.logging)
            {
                label15.Text = "Logging turned off";
            }

            t.Stop();
            label8.Text = string.Format("{0} ms", t.ElapsedMilliseconds);
        }
示例#2
0
        private void clickyclicky_Tick(object sender, EventArgs e)
        {
            Stopwatch t = new Stopwatch();

            t.Start();

            double       money = GameEngine.GetMoney();
            ParsedHeroes ph    = GameEngine.GetHeroes();
            //string dps = GameEngine.GetDamagePerSecond();

            // ooze
            var oozePopupActive = GameEngine.IsRelicOozePopupActive();

            lblIsOozeActive.Text = oozePopupActive?"YES":"NO";
            if (oozePopupActive)
            {
                AddLogMessage("A", "Ooze popup is active, trying to close");
                PlayerEngine.TryCloseOozePopup();
            }

            // Progressmode handling
            var progressMode = GameEngine.IsProgressModeOn();

            lblProgressMode.Text = progressMode?"ON":"OFF";
            if (progressModeWas != progressMode)
            {
                AddLogMessage("A", "Progress mode was " + (progressMode ? "Enabled" : "Disabled"));
                if (!progressMode)
                {
                    lastProgressDisabled = DateTime.Now;
                }
            }
            progressModeWas = progressMode;
            if (!progressMode && Properties.Settings.Default.autoEnableProgress)
            {
                var timeSinceDisabled = Math.Round(DateTime.Now.Subtract(lastProgressDisabled).TotalSeconds);

                lblProgressModeExtra.Text = String.Format("Disabled for {0}s, enabling in {1}s",
                                                          timeSinceDisabled, (Properties.Settings.Default.enableProgressDelay - timeSinceDisabled));

                if (timeSinceDisabled > Properties.Settings.Default.enableProgressDelay)
                {
                    PlayerEngine.ToggleProgressMode();
                    AddLogMessage("A", String.Format("Time since progress mode was disabled: {0}, enabling again", timeSinceDisabled));
                }
            }
            else
            {
                lblProgressModeExtra.Text = "";
            }


            if (ph != null)
            {
                if (Properties.Settings.Default.useTaskList)
                {
                    var newTask = PlayerEngine.TryNextTask(ph, money);
                    if (newTask != lblCurrGoal.Text)
                    {
                        AddLogMessage("T", newTask);
                        lblCurrGoal.Text = newTask;
                    }
                }
                else
                {
                    lblCurrGoal.Text = "None, tasks turned off";
                }

                StringBuilder sb = new StringBuilder();
                if (ph.HeroStats != null)
                {
                    foreach (HeroStats ss in ph.HeroStats)
                    {
                        sb.AppendLine(string.Format("{0}: Lvl {1} Upgrades {2}", ss.Hero.Name, ss.Level, Convert.ToString(ss.UpgradeBitfield, 2)));
                    }
                }
                curHeroesTxt.Text = sb.ToString();
            }
            else
            {
                curHeroesTxt.Text = string.Empty;
            }

            lblCurrMoney.Text = money.ToString();
            //lblCurrentDamagePerSecond.Text = dps.ToString();
            //pictureBox1.Image = GameEngine.GetDamagePerSecondBMP();


            if (Properties.Settings.Default.logging && DateTime.Now > TimeToNextLog)
            {
                Stopwatch imgsw = new Stopwatch();
                imgsw.Start();
                sw.WriteLine(string.Format("{0},{1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), money));

                Rectangle playableArea = GameEngine.GetPlayableArea();
                using (Bitmap bitmap = new Bitmap(playableArea.Width, playableArea.Height)) {
                    using (Graphics g = Graphics.FromImage(bitmap)) {
                        g.CopyFromScreen(new Point(playableArea.Left, playableArea.Top), Point.Empty, playableArea.Size);
                    }

                    bitmap.Save(string.Format("{0}\\{1}\\screenshots\\{2}.png", loggingDirectory, currentLoggingString, DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss")));
                }
                TimeToNextLog = TimeToNextLog.AddMinutes(1);
                imgsw.Stop();
                AddLogMessage("I", string.Format("Screenshot & log @ {0} in {1} ms", DateTime.Now.ToString("HH:mm:ss"), imgsw.ElapsedMilliseconds));
            }
            else if (!Properties.Settings.Default.logging)
            {
                lblMiscInfo.Text = "Logging turned off";
            }

            t.Stop();
            lblParseTime.Text = string.Format("{0} ms", t.ElapsedMilliseconds);
        }