Esempio n. 1
0
        public static void FindActionButtons()
        {
            bool FindButtonF = false;
            bool FindButtonG = false;

            for (int y = 550; y < ScreenCapture.LockBitmap.Screen.Height - 190; y++)
            {
                for (int x = 400; x < ScreenCapture.LockBitmap.Screen.Width - 400; x++)
                {
                    if (VisionForm.FindForm(VisionGame.ButtonF, x, y) != null)
                    {
                        FindButtonF  = true;
                        Game.ButtonF = true;
                    }
                    if (VisionForm.FindForm(VisionGame.ButtonG, x, y) != null)
                    {
                        FindButtonG  = true;
                        Game.ButtonG = true;
                    }
                }
            }

            if (FindButtonF == false)
            {
                Game.ButtonF = false;
            }

            if (FindButtonG == false)
            {
                Game.ButtonG = false;
            }
        }
Esempio n. 2
0
        private void EnemyTimer_Tick(object sender, EventArgs e)
        {
            bool FindForm = false;

            if (Hero.Target == true)
            {
                int SearchRangeX;
                if (Enemy.GlobalSearchOnScreen == true)
                {
                    SearchRangeX = 10;
                    Enemy.GlobalSearchOnScreen = false;
                }
                else
                {
                    SearchRangeX = 430;
                }

                for (int y = 10; y < ScreenCapture.LockBitmap.Screen.Height - 300; y++)
                {
                    if (FindForm == true)
                    {
                        break;
                    }
                    for (int x = SearchRangeX; x < ScreenCapture.LockBitmap.Screen.Width - SearchRangeX; x++)
                    {
                        if (FindForm == true)
                        {
                            break;
                        }
                        if (VisionForm.FindForm(VisionEnemy.EnemyTooltips, x, y) != null)
                        {
                            FindForm       = true;
                            Enemy.OnScreen = true;

                            /* Определяем с какой границы экрана у нас полоска ХП */

                            int FindScreenLenght = ScreenCapture.LockBitmap.Screen.Width - SearchRangeX - SearchRangeX;

                            if (x < (SearchRangeX + (FindScreenLenght / 2)))
                            {
                                Enemy.OnScreenPosition = "Left";
                            }
                            else
                            {
                                Enemy.OnScreenPosition = "Right";
                            }
                        }
                    }
                }
            }
            else
            {
                Enemy.GlobalSearchOnScreen = true;
            }

            if (FindForm == false)
            {
                Enemy.OnScreen = false;
            }
        }
Esempio n. 3
0
        private void HeroTimer_Tick(object sender, EventArgs e)
        {
            bool FindForm = false;

            for (int y = 10; y < 100; y++)
            {
                if (FindForm == true)
                {
                    break;
                }
                for (int x = 0; x < ScreenCapture.LockBitmap.Screen.Width - 900; x++)
                {
                    if (FindForm == true)
                    {
                        break;
                    }

                    if (VisionForm.FindForm(VisionHero.HeroBars, x, y) != null)
                    {
                        FindForm = true;

                        /* Определяем количество ХП у героя */
                        int HeroHpLenght;
                        for (HeroHpLenght = 0; HeroHpLenght < 255; ++HeroHpLenght)
                        {
                            if (VisionForm.FindForm(VisionAlliance.AllianceBars, x + HeroHpLenght + 1, y + 2) != null)
                            {
                                //continue;
                            }
                            else
                            {
                                break;
                            }
                        }

                        Hero.Health = HeroHpLenght;

                        /* Определяем количество ХП у героя */
                        int HeroManaLenght;
                        for (HeroManaLenght = 0; HeroManaLenght < 255; ++HeroManaLenght)
                        {
                            if (VisionForm.FindForm(VisionAlliance.ManaBars, x + HeroManaLenght + 1, y + 19) != null)
                            {
                                //continue;
                            }
                            else
                            {
                                break;
                            }
                        }

                        Hero.Mana = HeroManaLenght;
                    }
                }
            }

            if (FindForm == false)
            {
                Hero.Health = null;
                Hero.Mana   = null;
            }
        }
Esempio n. 4
0
        private void ViewDirectionTimer_Tick(object sender, EventArgs e)
        {
            bool FastFind1 = false;
            bool FastFind2 = false;
            bool FastFind3 = false;

            /* Для начала попробуем найти кружочек примерно рядом с последними координатами */
            if (
                ((Hero.PositionX - 5 > 0) && (Hero.PositionY - 5 > 0)) &&
                ((Hero.PositionX + 5 < ScreenCapture.LockBitmap.Screen.Width) && (Hero.PositionY + 5 < ScreenCapture.LockBitmap.Screen.Height))

                )
            {
                bool FindForm = false;
                for (int y = Hero.PositionY - 5; y < Hero.PositionY + 5; y++)
                {
                    if (FindForm == true)
                    {
                        break;
                    }
                    for (int x = Hero.PositionX - 5; x < Hero.PositionX + 5; x++)
                    {
                        if (FindForm == true)
                        {
                            break;
                        }

                        int?HeroCircleForm = VisionForm.FindForm(VisionHeroLocation.HeroCircles, x, y);
                        if (HeroCircleForm != null)
                        {
                            FastFind1 = true;
                            FindForm  = true;
                            int HeroCircleFormNumber = HeroCircleForm ?? default(int);
                            Hero.PositionX = x + VisionHeroLocation.HeroCirclesOffsetsX[HeroCircleFormNumber];
                            Hero.PositionY = y + VisionHeroLocation.HeroCirclesOffsetsY[HeroCircleFormNumber];
                            Hero.Direction = VisionHeroLocation.GetCurrentDirection(HeroCircleFormNumber, x, y);
                        }
                    }
                }
            }


            if (FastFind1 == false)
            {
                /* Для начала попробуем найти кружочек примерно рядом с последними координатами */
                if (
                    ((Hero.PositionX - 10 > 0) && (Hero.PositionY - 10 > 0)) &&
                    ((Hero.PositionX + 10 < ScreenCapture.LockBitmap.Screen.Width) && (Hero.PositionY + 10 < ScreenCapture.LockBitmap.Screen.Height))

                    )
                {
                    bool FindForm = false;
                    for (int y = Hero.PositionY - 10; y < Hero.PositionY + 10; y++)
                    {
                        if (FindForm == true)
                        {
                            break;
                        }
                        for (int x = Hero.PositionX - 10; x < Hero.PositionX + 10; x++)
                        {
                            if (FindForm == true)
                            {
                                break;
                            }

                            int?HeroCircleForm = VisionForm.FindForm(VisionHeroLocation.HeroCircles, x, y);
                            if (HeroCircleForm != null)
                            {
                                FastFind2 = true;
                                FindForm  = true;
                                int HeroCircleFormNumber = HeroCircleForm ?? default(int);
                                Hero.PositionX = x + VisionHeroLocation.HeroCirclesOffsetsX[HeroCircleFormNumber];
                                Hero.PositionY = y + VisionHeroLocation.HeroCirclesOffsetsY[HeroCircleFormNumber];
                                Hero.Direction = VisionHeroLocation.GetCurrentDirection(HeroCircleFormNumber, x, y);
                            }
                        }
                    }
                }
            }

            if ((FastFind1 == false) && (FastFind2 == false))
            {
                /* Для начала попробуем найти кружочек примерно рядом с последними координатами */
                if (
                    ((Hero.PositionX - 20 > 0) && (Hero.PositionY - 20 > 0)) &&
                    ((Hero.PositionX + 20 < ScreenCapture.LockBitmap.Screen.Width) && (Hero.PositionY + 20 < ScreenCapture.LockBitmap.Screen.Height))

                    )
                {
                    bool FindForm = false;
                    for (int y = Hero.PositionY - 20; y < Hero.PositionY + 20; y++)
                    {
                        if (FindForm == true)
                        {
                            break;
                        }
                        for (int x = Hero.PositionX - 20; x < Hero.PositionX + 20; x++)
                        {
                            if (FindForm == true)
                            {
                                break;
                            }

                            int?HeroCircleForm = VisionForm.FindForm(VisionHeroLocation.HeroCircles, x, y);
                            if (HeroCircleForm != null)
                            {
                                FastFind3 = true;
                                FindForm  = true;
                                int HeroCircleFormNumber = HeroCircleForm ?? default(int);
                                Hero.PositionX = x + VisionHeroLocation.HeroCirclesOffsetsX[HeroCircleFormNumber];
                                Hero.PositionY = y + VisionHeroLocation.HeroCirclesOffsetsY[HeroCircleFormNumber];
                                Hero.Direction = VisionHeroLocation.GetCurrentDirection(HeroCircleFormNumber, x, y);
                            }
                        }
                    }
                }
            }

            /* Если не получилось быстро найти кружочек - ищем по всей карте */
            if ((FastFind1 == false) && (FastFind2 == false) && (FastFind3 == false))
            {
                bool FindForm = false;
                for (int y = 50; y < ScreenCapture.LockBitmap.Screen.Height - 300; y++)
                {
                    if (FindForm == true)
                    {
                        break;
                    }
                    for (int x = 250; x < ScreenCapture.LockBitmap.Screen.Width - 50; x++)
                    {
                        if (FindForm == true)
                        {
                            break;
                        }

                        int?HeroCircleForm = VisionForm.FindForm(VisionHeroLocation.HeroCircles, x, y);
                        if (HeroCircleForm != null)
                        {
                            FindForm = true;
                            int HeroCircleFormNumber = HeroCircleForm ?? default(int);
                            Hero.PositionX = x + VisionHeroLocation.HeroCirclesOffsetsX[HeroCircleFormNumber];
                            Hero.PositionY = y + VisionHeroLocation.HeroCirclesOffsetsY[HeroCircleFormNumber];
                            Hero.Direction = VisionHeroLocation.GetCurrentDirection(HeroCircleFormNumber, x, y);
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        private void TargetTimer_Tick(object sender, EventArgs e)
        {
            bool FindForm = false;

            for (int y = 100; y < 200; y++)
            {
                if (FindForm == true)
                {
                    break;
                }
                for (int x = 0; x < ScreenCapture.LockBitmap.Screen.Width - 900; x++)
                {
                    if (FindForm == true)
                    {
                        break;
                    }

                    int?TargetBarForm = VisionForm.FindForm(VisionTarget.TargetBars, x, y);
                    if (TargetBarForm != null)
                    {
                        FindForm    = true;
                        Hero.Target = true;
                        int TargetBarFormNumber = TargetBarForm ?? default(int);

                        /* Определяем количество ХП у врага */
                        int EnemyHpLenght;
                        for (EnemyHpLenght = 0; EnemyHpLenght < 365; ++EnemyHpLenght)
                        {
                            if (VisionForm.FindForm(VisionEnemy.EnemyBars, x + EnemyHpLenght + 1, y + 2) != null)
                            {
                                //continue;
                            }
                            else
                            {
                                break;
                            }
                        }

                        /* Определяем дистанцию для разных типов монстров */
                        if (TargetBarFormNumber == 0)
                        {
                            /* Обычный моб */
                            Enemy.Distance = VisionNumbers.GetDistance(x + 215, y - 12);
                            Enemy.Type     = "Normal";
                        }
                        else if (TargetBarFormNumber == 1)
                        {
                            /* Босс */
                            Enemy.Distance = VisionNumbers.GetDistance(x + 325, y - 12);
                            Enemy.Type     = "Boss";
                        }
                        else if (TargetBarFormNumber == 2)
                        {
                            /* Слабый моб */
                            Enemy.Distance = VisionNumbers.GetDistance(x + 110, y - 12);
                            Enemy.Type     = "Easy";
                        }

                        Enemy.Health = EnemyHpLenght;
                    }
                }
            }

            if (FindForm == false)
            {
                Hero.Target    = false;
                Enemy.Distance = null;
                Enemy.Health   = null;
            }
        }