public IPattern TakeScreenshot()
        {
            _superUser.SendCommand($"/system/bin/screencap {_imgPath}");

            using var f      = File.OpenRead(_imgPath);
            using var reader = new BinaryReader(f, Encoding.ASCII);
            var w      = reader.ReadInt32();
            var h      = reader.ReadInt32();
            var format = reader.ReadInt32();

            if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
            {
                reader.ReadInt32();
            }

            if (_buffer == null)
            {
                // If format is not RGBA, notify
                if (format != 1)
                {
                    AutomataApi.Toast($"Unexpected raw image format: {format}");
                }

                _buffer      = new byte[w * h * 4];
                _rootLoadMat = new Mat(h, w, CvType.Cv8uc4);
            }

            reader.Read(_buffer, 0, _buffer.Length);

            _rootLoadMat.Put(0, 0, _buffer);

            Imgproc.CvtColor(_rootLoadMat, _rootConvertMat, Imgproc.ColorRgba2gray);

            return(new DroidCvPattern(_rootConvertMat, false));
        }
Ejemplo n.º 2
0
        CardScore GetCardType(Region Region)
        {
            if (Region.Exists(ImageLocator.Buster))
            {
                return(CardScore.Buster);
            }

            if (Region.Exists(ImageLocator.Art))
            {
                return(CardScore.Arts);
            }

            if (Region.Exists(ImageLocator.Quick))
            {
                return(CardScore.Quick);
            }

            AutomataApi.Toast($"Failed to determine Card type (X: {Region.X}, Y: {Region.Y}, W: {Region.W}, H: {Region.H})");

            return(CardScore.Buster);
        }
Ejemplo n.º 3
0
        // Reset battle state, then click quest and refill stamina if needed.
        void Menu()
        {
            _battle.ResetState();

            if (Preferences.Instance.Refill.Enabled)
            {
                var refillRepetitions = Preferences.Instance.Refill.Repetitions;
                if (refillRepetitions > 0)
                {
                    AutomataApi.Toast($"{_stonesUsed} refills used out of {refillRepetitions}");
                }
            }

            // Click uppermost quest
            Game.MenuSelectQuestClick.Click();
            AutomataApi.Wait(1.5);

            // Auto refill
            while (Game.StaminaScreenRegion.Exists(ImageLocator.Stamina))
            {
                RefillStamina();
            }
        }