コード例 #1
0
ファイル: MainForm.cs プロジェクト: Rassilion/Denemeler
 private static bool IsPopupPresent(Screenshot image)
 {
     var color = Color.FromArgb(171, 103, 45).ToArgb();
     if (image.GetPixelRgb(1, 1) == color)
     {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Rassilion/Denemeler
 private static bool IsCloseBtnPresent(Screenshot image, int x, int y)
 {
     var color = Color.FromArgb(105, 119, 142).ToArgb();
     if (image.GetPixelRgb(x, y) == color)
     {
         color = Color.FromArgb(90, 106, 131).ToArgb();
         if (image.GetPixelRgb(x + 17, y) == color)
         {
             color = Color.FromArgb(178, 188, 204).ToArgb();
             if (image.GetPixelRgb(x + 9, y + 8) == color)
             {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: Rassilion/Denemeler
        private void ClickMilitaryItems(Screenshot image)
        {
            var closeButtonCoords = FindCloseButton(image, 2410, 835, 40, 40);
            var startingMilitaryItemButton = new Coordinate(closeButtonCoords.X - 864, 1142);
            const int distButtons = 178;
            var borderColor = Color.FromArgb(0, 0, 0).ToArgb();
            var activeBorderColor = Color.FromArgb(0, 0, 2).ToArgb();
            var readyColor = Color.FromArgb(177, 106, 49).ToArgb();
            var activeReadyColor = Color.FromArgb(219, 141, 63).ToArgb();
            var unlockColor = Color.FromArgb(117, 116, 115).ToArgb();
            var unlockWithDiamondColor = Color.FromArgb(112, 111, 110).ToArgb();
            for (int i = 0; i < 5; i++)
            {
                //updateStatus(LogType.JustMessage, string.Format("x={0},y={1}", startingMilitaryItemButton.X, startingMilitaryItemButton.Y));
                var pixel = image.GetPixelRgb(startingMilitaryItemButton.X, startingMilitaryItemButton.Y);

                if (pixel == borderColor || pixel == activeBorderColor)
                {
                    //updateStatus(LogType.JustMessage, string.Format("black color found.", i + 1));
                    var unlocked = false;
                    // unlock not working since there's no "moon sign" above the military barrack
                    if (false && Settings.DoMilitaryUnitsUnblock && pixel == unlockColor)
                    {
                        InjectClickAtInvokeForced(startingMilitaryItemButton.X + 50, startingMilitaryItemButton.Y);
                        unlocked = true;
                        UpdateStatus(LogType.JustMessage, string.Format("Unlocking military item #{0}", i + 1));
                        Sleeping(1000);
                    }

                    var pixelPlusOne = image.GetPixelRgb(startingMilitaryItemButton.X + 1, startingMilitaryItemButton.Y);
                    if (unlocked || pixelPlusOne == readyColor || pixelPlusOne == activeReadyColor)
                    {
                        InjectClickAtInvokeForced(startingMilitaryItemButton.X + 50, startingMilitaryItemButton.Y);
                        UpdateStatus(LogType.JustMessage, string.Format(Resource.MainForm_ClickMilitaryItems_MilitaryItemSelected, i + 1));
                        break;
                    }
                }

                startingMilitaryItemButton.X += distButtons;
            }
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: Rassilion/Denemeler
        private Coordinate ScanPicture4ZoomInButton(Screenshot image)
        {
            var colors = new List<int>();
            colors.Add(Color.FromArgb(42, 47, 54).ToArgb()); // @ (0,0)
            colors.Add(Color.FromArgb(25, 30, 37).ToArgb()); // @ (+17,0)
            colors.Add(Color.FromArgb(172, 183, 199).ToArgb()); // @ (+14,+15)
            colors.Add(Color.FromArgb(174, 185, 201).ToArgb()); // @ (+14,+15)
            colors.Add(Color.FromArgb(172, 181, 198).ToArgb()); // @ (+7,+5)
            colors.Add(Color.FromArgb(174, 183, 200).ToArgb()); // @ (+7,+5)
            colors.Add(Color.FromArgb(127, 136, 153).ToArgb()); // @ (+8,+10)
            colors.Add(Color.FromArgb(151, 162, 181).ToArgb()); // @ (+8,+10)

            Coordinate coordinate = null;

            //image.Image.Save("scanZoom.png",ImageFormat.Png);

            // searching in bottom left corner 4 magnifier glass
            //Parallel.For(0, 300, (x,s) =>
            for(int x=0;x<300;x++)
            {
                for (int y = Settings.BotPictureHeight-50; y < Settings.BotPictureHeight; y++)
                {
                    {
                        if (image.GetPixelRgb(x, y) == colors[0] &&
                            image.GetPixelRgb(x+17, y) == colors[1] &&
                            (image.GetPixelRgb(x + 14, y + 15) == colors[2] || image.GetPixelRgb(x + 14, y + 15) == colors[3] )&&
                            (image.GetPixelRgb(x + 7, y + 5) == colors[4] || image.GetPixelRgb(x + 7, y + 5) == colors[5]) &&
                            (image.GetPixelRgb(x + 8, y + 10) == colors[6] || image.GetPixelRgb(x + 8, y + 10) == colors[7])
                            )
                        {
                            coordinate = new Coordinate(x+7, y+7);
                            break;
                        }

                    }
                }
            };
            return coordinate;
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: Rassilion/Denemeler
        private bool CheckForBlueScreen(Screenshot image)
        {
            var blueScreenColor = image.GetPixelRgb(25, 25);
            var surface = ((BitmapSurface)_aweWebView.Surface);
            int min = Math.Min(surface.Height, surface.Width);
            for (int i = 0; i < min;i++ )
                if(image.GetPixelRgb(i, i)!=blueScreenColor)
                    return false;

            return true;
        }