예제 #1
0
        /// <summary>
        /// Don't leave this method until after we've ascended
        /// </summary>
        /// <param name="ph"></param>
        /// <param name="curMoney"></param>
        public static void Ascend(ParsedHeroes ph, double curMoney)
        {
            TrashRelics();
            Point AscendButton = GameEngine.GetAscendButton();

            // use candy height and width cuz it's close enough
            int       candyHeight = GameEngine.GetCandyHeight();
            int       candyWidth  = GameEngine.GetCandyWidth();
            Rectangle c           = new Rectangle(AscendButton.X - candyWidth / 2, AscendButton.Y - candyHeight / 2, candyWidth, candyHeight);

            while (true)
            {
                using (Bitmap bitmap = new Bitmap(c.Width, c.Height))
                {
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        g.CopyFromScreen(new Point(c.Left, c.Top), Point.Empty, c.Size);
                    }

                    if (OCREngine.GetBlobDensity(bitmap, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1), new Color[] {
                        Color.FromArgb(68, 215, 35)
                    }) > 0.10)
                    {
                        AddAction(new Action(AscendButton, 0));
                        Thread.Sleep(1000);
                        return;
                    }
                }

                TryUpgradeHero(ph, 19, 3, curMoney);
                Thread.Sleep(1000);
                ph       = GameEngine.GetHeroes();
                curMoney = GameEngine.GetMoney();
            }
        }
예제 #2
0
        /// <summary>
        /// Don't leave this method until after we've ascended
        /// </summary>
        /// <param name="ph"></param>
        /// <param name="curMoney"></param>
        public static void Ascend(ParsedHeroes ph, double curMoney)
        {
            Point AscendButton = GameEngine.GetAscendButton();

            // use candy height and width cuz it's close enough
            int       candyHeight = GameEngine.GetCandyHeight();
            int       candyWidth  = GameEngine.GetCandyWidth();
            Rectangle c           = new Rectangle(AscendButton.X - candyWidth / 2, AscendButton.Y - candyHeight / 2, candyWidth, candyHeight);

            while (true)
            {
                using (Bitmap bitmap = GameEngine.GetImage(c))
                {
                    if (OCREngine.GetBlobDensity(bitmap, new Rectangle(0, 0, bitmap.Width - 1, bitmap.Height - 1), new Color[] {
                        Color.FromArgb(68, 215, 35)
                    }) > 0.10)
                    {
                        AddAction(new Action(AscendButton, 0));
                        Thread.Sleep(1000);
                        return;
                    }
                }

                TryUpgradeHero(ph, 19, 3, curMoney);
                Thread.Sleep(1000);
                ph       = GameEngine.GetHeroes();
                curMoney = GameEngine.GetMoney();
            }
        }