Example #1
0
 public CClickMouse(CRuneScape _runescape, ClickButton _button, Point _location, uint rand_diam)
     : base(_runescape)
 {
     this.btnToClick = _button;
     this.ptLocationToClick = _location;
     this.uiRandomDiam = rand_diam;
 }
Example #2
0
        private str_ScanResult BasicScan(CRuneScape runeScape)
        {
            str_ScanResult scan;
            scan.bmpResult = null;
            scan.ptWindow = Point.Empty;
            scan.ptCompensate = Point.Empty;

            KeyValuePair<Point, Size> kpDimensions = GetWindowDimensions(runeScape);
            if (kpDimensions.Value.Width == 0 ||
                kpDimensions.Value.Height == 0) {
                return scan;
            }

            KeyValuePair<Point, Size> kpTrimming = new KeyValuePair<Point, Size>(Point.Empty, Size.Empty);
            Bitmap bmpScanned = PerformScan(runeScape, kpDimensions.Key, kpDimensions.Value);
            Bitmap bmpScanned_Cropped = CropAdvertAndBlackSpace(bmpScanned, kpDimensions, out kpTrimming);

            scan.bmpResult = ((bmpScanned_Cropped == null) ? bmpScanned : bmpScanned_Cropped);
            scan.ptWindow = kpDimensions.Key;
            if (bmpScanned_Cropped == null || kpTrimming.Key != Point.Empty) {
                scan.ptCompensate = new Point(kpTrimming.Key.X,
                    kpTrimming.Key.Y);
            }

            return scan;
        }
Example #3
0
        public str_ScanResult Scan(CRuneScape runeScape, EScanType scanType)
        {
            switch (scanType) {
                case EScanType.Basic:
                    return BasicScan(runeScape);
            }

            str_ScanResult scan;
            scan.bmpResult = null;
            scan.ptWindow = new Point(0, 0);
            scan.ptCompensate = new Point(0, 0);

            return scan;
        }
Example #4
0
        public CGameSnapshot(CRuneScape _osrs,
            CRuneScapeOCR _ocr,
            CScanner _scanner,
            CInteraction _interaction,
            CVirtualCanvas _canvas,
            bool _scribe)
        {
            this.runeScape = _osrs;
            this.opticalCharRecognition = _ocr;
            this.windowScanner = _scanner;
            this.windowInteraction = _interaction;
            this.virtualCanvas = _canvas;

            this.bShouldScribe = _scribe;

            this.char_LastScan = new List<str_Char>();
            this.word_LastScan = new List<CWord>();
        }
Example #5
0
        private Bitmap PerformScan(CRuneScape runeScape, Point ptBegin, Size szDimensions)
        {
            IntPtr hdcSource = CWinAPI.GetDC(runeScape.WindowHandle),
                hdcDestination = CWinAPI.CreateCompatibleDC(hdcSource),
                hBitmap = CWinAPI.CreateCompatibleBitmap(hdcSource, szDimensions.Width, szDimensions.Height),
                hOld = CWinAPI.SelectObject(hdcDestination, hBitmap);

            CWinAPI.SetForegroundWindow(runeScape.WindowHandle);
            CWinAPI.BitBlt(hdcDestination, 0, 0, szDimensions.Width, szDimensions.Height, hdcSource, 0, 0, 0x00CC0020);
            CWinAPI.SelectObject(hdcDestination, hOld);

            Bitmap bmpResult = new Bitmap(Image.FromHbitmap(hBitmap));

            CWinAPI.DeleteDC(hdcDestination);
            CWinAPI.ReleaseDC(runeScape.WindowHandle, hdcSource);
            CWinAPI.DeleteObject(hBitmap);

            return bmpResult;
        }
Example #6
0
        private KeyValuePair<Point, Size> GetWindowDimensions(CRuneScape runeScape)
        {
            WinAPI.Rectangle result = new WinAPI.Rectangle();
            CWinAPI.GetWindowRect(runeScape.WindowHandle, ref result);

            int iWidth = result.Right - result.Left;
            int iHeight = result.Bottom - result.Top;

            return new KeyValuePair<Point, Size>(new Point(result.Left, result.Top),
                new Size(iWidth, iHeight));
        }
Example #7
0
 public CClickMouse(CRuneScape _runescape, ClickButton _button)
     : base(_runescape)
 {
     this.btnToClick = _button;
 }
Example #8
0
 public CClickMouse(CRuneScape _runescape, ClickButton _button, Point _location)
     : base(_runescape)
 {
     this.btnToClick = _button;
     this.ptLocationToClick = _location;
 }
Example #9
0
 public CTypeString(CRuneScape _runescape, string _msg, int _pause, int _rand)
     : base(_runescape)
 {
     this.sMessage = _msg;
     this.iPauseTime = _pause;
     this.iPauseTimeRandom = _rand;
 }
Example #10
0
 public CTypeString(CRuneScape _runescape, string _msg)
     : base(_runescape)
 {
     this.sMessage = _msg;
 }
Example #11
0
 public CKeyPress(CRuneScape _runescape, Keys _key)
     : base(_runescape)
 {
     this.cKey = _key;
 }
Example #12
0
 public CInteraction(CRuneScape _runescape)
 {
     this.runeScape = _runescape;
     this.qCommands = new Queue<CCommand>();
 }
Example #13
0
 public CCommand(CRuneScape _runescape)
 {
     this.runeScape = _runescape;
 }