public static bool CardExists(IntPtr wndHandle, int posX, int posY, int width, int height)
        {
            const double scale  = 0.037;            // 40px @ height = 1080
            const double minHue = 90;

            var size = (int)Math.Round(height * scale);

            var capture = Helper.CaptureHearthstone(new Point(posX, posY), size, size, wndHandle);

            if (capture == null)
            {
                return(false);
            }

            return(HueAndBrightness.GetAverage(capture).Hue > minHue);
        }
        public static bool IsZeroCrystalSelected(IntPtr wndHandle, double ratio, int width, int height)
        {
            const double scale         = 0.020;     // 22px @ height = 1080
            const double minBrightness = 0.55;

            var size = (int)Math.Round(height * scale);

            var posX = (int)Helper.GetScaledXPos(Config.Instance.ExportZeroSquareX, width, ratio);
            var posY = (int)(Config.Instance.ExportZeroSquareY * height);

            var capture = Helper.CaptureHearthstone(new Point(posX, posY), size, size, wndHandle);

            if (capture == null)
            {
                return(false);
            }

            return(HueAndBrightness.GetAverage(capture).Brightness > minBrightness);
        }
Exemplo n.º 3
0
        public static bool CardHasLock(IntPtr wndHandle, int posX, int posY, int width, int height)
        {
            // setting this as a "width" value relative to height, maybe not best solution?
            const double xScale        = 0.051;      // 55px @ height = 1080
            const double yScale        = 0.0278;     // 30px @ height = 1080
            const double maxBrightness = 5.0 / 11.0;

            int lockWidth  = (int)Math.Round(height * xScale);
            int lockHeight = (int)Math.Round(height * yScale);

            var capture = Helper.CaptureHearthstone(new Point(posX, posY), lockWidth, lockHeight, wndHandle);

            if (capture == null)
            {
                return(false);
            }

            return(HueAndBrightness.GetAverage(capture).Brightness < maxBrightness);
        }
Exemplo n.º 4
0
        public static async Task <bool> CardHasLock(IntPtr wndHandle, int posX, int posY, int width, int height)
        {
            // setting this as a "width" value relative to height, maybe not best solution?
            const double xScale        = 0.051;      // 55px @ height = 1080
            const double yScale        = 0.0278;     // 30px @ height = 1080
            const double maxBrightness = 5.0 / 11.0;

            // ReSharper disable once SuggestVarOrType_BuiltInTypes
            var lockWidth  = (int)Math.Round(height * xScale);
            var lockHeight = (int)Math.Round(height * yScale);

            var capture = await ScreenCapture.CaptureHearthstoneAsync(new Point(posX, posY), lockWidth, lockHeight, wndHandle);

            if (capture == null)
            {
                return(false);
            }

            return(HueAndBrightness.GetAverage(capture).Brightness < maxBrightness);
        }