示例#1
0
        private async Task IsFishComboEvent(IntPtr hWnd, SearchImage.RECT rect)
        {
            Point Scan = Point.Empty;

            while (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 305, 380, 325, 400), FishColorEvent).IsEmpty&& !IsFinished)
            {
                target2 = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom);
                if (!SearchImage.Find(target2, Resources.fish_Arrow_left, out Scan).IsEmpty&& !IsFinished)
                {
                    await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, 5);

                    await Task.Delay(80);
                }
                if (!SearchImage.Find(target2, Resources.fish_Arrow_top, out Scan).IsEmpty&& !IsFinished)
                {
                    await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_UP, 5);

                    await Task.Delay(80);
                }
                if (!SearchImage.Find(target2, Resources.fish_Arrow_right, out Scan).IsEmpty&& !IsFinished)
                {
                    await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5);

                    await Task.Delay(80);
                }
                if (!SearchImage.Find(target2, Resources.fish_Arrow_Bottom, out Scan).IsEmpty&& !IsFinished)
                {
                    await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_DOWN, 5);

                    await Task.Delay(80);
                }
                await Task.Delay(20);
            }
        }
示例#2
0
        public async void RunTask(IntPtr hWnd, int Amount, SearchImage.RECT rect, int BotID, bool UseRewardCoupon)
        {
            Console.WriteLine("SawMill Bot created for HWID: {0}, Bot ID: {1}, Times: {2}", hWnd, BotID, Amount);
            IsFinished = true;
            IsFailed   = false;
            Times      = 0;
            Point  Scan;
            Bitmap target;

            while (Program.botRunning)
            {
                int RandomStep = new Random().Next(0, 5);

                target = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom);


                if (!SearchImage.Find(target, Resources.chicken_right, out Scan).IsEmpty)
                {
                    await Task.Delay(10);

                    await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5);
                }



                await Task.Delay(10);
            }
            Console.WriteLine("SawMill Bot Stopped for HWID: {0}, Bot ID: {1}, Times played: {2}/{3}", hWnd, BotID, Times, Amount);
        }
示例#3
0
 private void ScreenCapEvent(IntPtr hWnd, SearchImage.RECT rect)
 {
     while (Program.botRunning)
     {
         target = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom);
         Thread.Sleep(10);
     }
 }
示例#4
0
 static extern bool GetClientRect(IntPtr hwnd, out SearchImage.RECT lpRect);
示例#5
0
        public async void RunTask(IntPtr hWnd, int Amount, int Level, SearchImage.RECT rect, int BotID, bool UseRewardCoupon, bool UseProductionCoupon, int LootTimeA, int LootTimeB, double FailChance, int fishCatchTime)
        {
            Console.WriteLine("FishPond Bot Created for Hwid: {0}, Bot ID: {1}, Times: {2}", hWnd, BotID, Amount);
            IsFinished       = true;
            IsFailed         = false;
            ProductionNeeded = false;
            Times            = 0;
            Wanted_Level     = Level;
            Point Scan;

            System.Timers.Timer FastMode = new System.Timers.Timer();
            FastMode.Elapsed  += TriggerFastMode;
            FastMode.Interval += 100000;
            FastMode.AutoReset = false;
            WaitTime           = fishCatchTime;
            Thread ScreenCap = new Thread(delegate() { ScreenCapEvent(hWnd, rect); });

            ScreenCap.Start();
            await Task.Delay(1000);

            // FastMode Timer

            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();



            switch (Wanted_Level)
            {
            case 1:
                RewardButton = Level1;
                break;

            case 2:
                RewardButton = Level2;
                break;

            case 3:
                RewardButton = Level3;
                break;

            case 4:
                RewardButton = Level4;
                break;

            case 5:
                RewardButton = Level5;
                break;

            default:
                RewardButton = Level5;
                break;
            }

            while (Program.botRunning)
            {
                if (!IsFinished)
                {
                    if (!SearchImage.Find(target, Resources.Reward_FishPond, out Scan).IsEmpty)
                    {
                        await Task.Delay(500);

                        await BackgroundHelper.SendClick(hWnd, 375, 441, 250);

                        await Task.Delay(2000);

                        IsFailed   = true;
                        IsFinished = true;
                    }

                    if (!SearchImage.Find(target, Resources.score_FishPond, out Scan).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, 5);

                        await Task.Delay(1000);

                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5);

                        await Task.Delay(1000);

                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_UP, 5);

                        await Task.Delay(1000);

                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_DOWN, 5);

                        await Task.Delay(1000);

                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_UP, 5);

                        await Task.Delay(1000);

                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, 5);

                        await Task.Delay(1000);

                        IsFinished = true;
                    }

                    await IsFishComboEvent(hWnd, rect);



                    #region Catch Fish Detection
                    if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 664, 371, 668, 375), FishColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 639, 289, 647, 297), FishCatechedColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 312, 386, 320, 394), FishColorEvent).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 620, 306, 670, 361), StupidCarpWiggle).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 617, 376, 632, 395), DamonColorRight).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, PressTime);

                        await Task.Delay(WaitTime);
                        await IsFishComboEvent(hWnd, rect);
                    }

                    if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 505, 425, 510, 430), FishColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 483, 344, 491, 352), FishCatechedColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 312, 386, 320, 394), FishColorEvent).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 463, 370, 513, 420), StupidCarpWiggle).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 463, 434, 482, 459), DamonColorLeft).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_DOWN, PressTime);

                        await Task.Delay(WaitTime);
                        await IsFishComboEvent(hWnd, rect);
                    }
                    //++
                    if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 388, 367, 396, 375), FishColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 371, 285, 379, 293), FishCatechedColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 312, 386, 320, 394), FishColorEvent).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 355, 320, 392, 355), StupidCarpWiggle).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 381, 368, 397, 405), DamonColorLeftLeft).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, PressTime);

                        await Task.Delay(WaitTime);
                        await IsFishComboEvent(hWnd, rect);
                    }
                    //++
                    if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 544, 319, 552, 327), FishColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 520, 241, 528, 249), FishCatechedColor).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 312, 386, 320, 394), FishColorEvent).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 507, 276, 547, 317), StupidCarpWiggle).IsEmpty&&
                        SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 494, 330, 507, 345), DamonColorRight).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_UP, PressTime);

                        await Task.Delay(WaitTime);
                        await IsFishComboEvent(hWnd, rect);
                    }
                    #endregion
                }
                else
                {
                    if (!ProductionNeeded)
                    {
                        if (!SearchImage.Find(target, Resources.Reward_FishPond, out Scan).IsEmpty&& !IsFailed)
                        {
                            /*
                             * if( new Random().NextDouble() < Convert.ToInt32(FailChance))
                             * {
                             *  Console.WriteLine("BOT: " + BotID + "(FishPond): " + " Fake Fail, Retry!");
                             *  await Task.Delay(500);
                             *  await BackgroundHelper.SendClick(hWnd, 375, 441, 250);
                             *  await Task.Delay(2000);
                             *  IsFailed = true;
                             *  IsFinished = true;
                             * }
                             */
                            Console.WriteLine("BOT: " + BotID + "(FishPond): " + " Get Reward!");
                            await Task.Delay(250 + new Random().Next(500, 1500));

                            await Task.Delay(new Random().Next(LootTimeA, LootTimeB));

                            await BackgroundHelper.SendClick(hWnd, 640, 438, 250);

                            await Task.Delay(1000);
                        }


                        if (!SearchImage.Find(target, Resources.TryAgain_FishPond, out Scan).IsEmpty&& !IsFailed)
                        {
                            Console.WriteLine("BOT: " + BotID + "(FishPond): " + "Click Try Again!");
                            await Task.Delay(250);

                            await BackgroundHelper.SendClick(hWnd, 457, 466, 250);

                            await Task.Delay(1000);
                        }

                        if (!SearchImage.Find(target, Resources.Start_FishPond, out Scan).IsEmpty)
                        {
                            Console.WriteLine("BOT: " + BotID + "(FishPond): " + "Start Playing!");
                            await Task.Delay(250);

                            await BackgroundHelper.SendClick(hWnd, 514, 550, 250);

                            await Task.Delay(2000);

                            FastModeEnabled = false;
                            FastMode.Stop();
                            PressTime = 409;
                            WaitTime  = fishCatchTime;
                            FastMode.Start();

                            stopwatch.Stop();
                            TimeSpan time = stopwatch.Elapsed;
                            stopwatch.Reset();
                            Console.WriteLine("Time Taken: " + time.Minutes + ":" + time.Seconds);
                            stopwatch.Start();
                            IsFinished = false;
                            IsFailed   = false;
                        }

                        if (!SearchImage.Find(target, Resources.Production_Coupon_Trigger, out Scan).IsEmpty&& !IsFailed)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_ESCAPE, 250);
                            }
                            if (UseProductionCoupon)
                            {
                                ProductionNeeded = true;
                            }
                            else
                            {
                                MessageBox.Show("No Points Left, stopped.");
                                while (Program.botRunning)
                                {
                                    await Task.Delay(100);
                                }
                            }
                        }


                        if (!SearchImage.Find(target, Resources.Level5, out Scan).IsEmpty&& !IsFailed)
                        {
                            Console.WriteLine("BOT: " + BotID + "(FishPond): " + " Get Level " + Wanted_Level + " Reward!");
                            await Task.Delay(250);

                            await BackgroundHelper.SendClick(hWnd, RewardButton[0], RewardButton[1], 250);

                            await Task.Delay(1000);

                            if (UseRewardCoupon)
                            {
                                await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RETURN, 50);

                                await Task.Delay(250);
                            }
                            else
                            {
                                await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_ESCAPE, 50);

                                await Task.Delay(250);
                            }
                            Times++;
                            Console.WriteLine("Bot:" + BotID + "(FishPond): Finished! Played: " + Times + "/" + Amount);
                            if (Times >= Amount)
                            {
                                MessageBox.Show("Done!");

                                while (Program.botRunning)
                                {
                                    await Task.Delay(100);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!SearchImage.Find(target, Resources.Stop_Button, out Scan).IsEmpty&& !IsFailed)  // ORIG Stop Button
                        {
                            await Task.Delay(250);

                            await BackgroundHelper.SendClick(hWnd, 565, 467, 250); // ORIG 565, 467

                            await Task.Delay(2000);


                            if (!SearchImage.Find(target, Resources.Production_Coupon, out Scan).IsEmpty&& !IsFailed)
                            {
                                await Task.Delay(250);

                                await BackgroundHelper.SendClick(hWnd, Scan.X, Scan.Y, 250);

                                await Task.Delay(500);

                                await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RETURN, 50);

                                await Task.Delay(500);

                                await BackgroundHelper.SendClick(hWnd, 511, 371, 250);

                                await Task.Delay(500);

                                await BackgroundHelper.SendClick(hWnd, 478, 534, 250);

                                ProductionNeeded = false;
                                await Task.Delay(500);

                                if (SearchImage.Find(target, Resources.Start_FishPond, out Scan).IsEmpty)
                                {
                                    MessageBox.Show("Failed to use Production Coupons, stopped.");
                                    while (Program.botRunning)
                                    {
                                        await Task.Delay(100);
                                    }
                                }
                            }
                            else
                            {
                                MessageBox.Show("No Production Points Coupons found, stopped.");
                                while (Program.botRunning)
                                {
                                    await Task.Delay(100);
                                }
                            }
                        }
                        await Task.Delay(50);
                    }
                    await Task.Delay(50);
                }
                await Task.Delay(20);
            }
        }
示例#6
0
        public async void RunTask(IntPtr hWnd, int Amount, SearchImage.RECT rect, int BotID, bool UseRewardCoupon)
        {
            Console.WriteLine("Quarry Bot created for HWID: {0}, Bot ID: {1}, Times: {2}", hWnd, BotID, Amount);
            IsFinished = true;
            IsFailed   = false;
            Times      = 0;
            Point  Scan;
            Bitmap target;

            while (Program.botRunning)
            {
                int RandomStep = new Random().Next(0, 5);

                target = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom);

                if (!IsFinished)
                {
                    await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_UP, 5);


                    if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 387, 527, 422, 572), WormColorLeft).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, 5);

                        await Task.Delay(50);
                    }

                    if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 580, 520, 635, 585), WormColorRight).IsEmpty)
                    {
                        await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5);

                        await Task.Delay(50);
                    }


                    if (!SearchImage.Find(target, Resources.Score_Stone, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(Quarry): " + "Enough Points!");
                        await Task.Delay(6000);

                        IsFinished = true;
                    }

                    if (!SearchImage.Find(target, Resources.Failed_Stone, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(Quarry): " + "Failed, Retry!");
                        await BackgroundHelper.SendClick(hWnd, 377, 435, 250);

                        await Task.Delay(1500);

                        IsFailed   = true;
                        IsFinished = true;
                    }
                }

                if (IsFinished)
                {
                    //Console.WriteLine("Finished!");

                    if (!SearchImage.Find(target, Resources.Reward_Button_Stone, out Scan).IsEmpty&& !IsFailed)
                    {
                        Console.WriteLine("BOT: " + BotID + "(Quarry): " + "Click Reward Button!");
                        await BackgroundHelper.SendClick(hWnd, Scan.X + 25, Scan.Y + 15, 250);

                        await Task.Delay(1000);
                    }

                    if (!SearchImage.Find(target, Resources.Level5, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(Quarry): " + "Click Level 5 Button!");
                        await BackgroundHelper.SendClick(hWnd, Scan.X + 5, Scan.Y + 5, 250);

                        await Task.Delay(500);

                        if (UseRewardCoupon)
                        {
                            await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RETURN, 50);

                            await Task.Delay(250);
                        }
                    }

                    if (!SearchImage.Find(target, Resources.TryAgain_Stone, out Scan).IsEmpty)
                    {
                        Console.WriteLine("Bot:" + BotID + "(FishPond): Finished! Played: " + Times + "/" + Amount);

                        Console.WriteLine("BOT: " + BotID + "(Quarry): " + "Click Try Again Button!");
                        await BackgroundHelper.SendClick(hWnd, 456, 464, 250);

                        await Task.Delay(1000);

                        Times++;
                        if (Times >= Amount)
                        {
                            MessageBox.Show("Done!");

                            while (Program.botRunning)
                            {
                                await Task.Delay(100);
                            }
                        }
                    }

                    if (!SearchImage.Find(target, Resources.Start_Stone, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(Quarry): " + "Click Start Button!");
                        await Task.Delay(500);

                        await BackgroundHelper.SendClick(hWnd, Scan.X + 50, Scan.Y + 30, 250);

                        await Task.Delay(2000);

                        IsFinished = false;
                        IsFailed   = false;
                    }
                }
                await Task.Delay(10);
            }
            Console.WriteLine("Quarry Bot Stopped for HWID: {0}, Bot ID: {1}, Times played: {2}/{3}", hWnd, BotID, Times, Amount);
        }
示例#7
0
        public async void RunTask(IntPtr hWnd, int Amount, SearchImage.RECT rect, int BotID, bool UseRewardCoupon)
        {
            Console.WriteLine("SawMill Bot created for HWID: {0}, Bot ID: {1}, Times: {2}", hWnd, BotID, Amount);
            IsFinished = true;
            IsFailed   = false;
            Times      = 0;
            Point  Scan;
            Bitmap target;

            while (Program.botRunning)
            {
                int RandomStep = new Random().Next(0, 5);

                target = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom);

                if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 425, 399, 475, 449), SawColorLeft).IsEmpty&& !IsFinished)
                {
                    await Task.Delay(10);

                    BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, 5);
                }

                if (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 427, 500, 479, 547), SawColorLeft).IsEmpty&& !IsFinished)
                {
                    await Task.Delay(10);

                    BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5);
                }

                if (!SearchImage.Find(target, Resources.Score_SawMill, out Scan).IsEmpty)
                {
                    Console.WriteLine("BOT: " + BotID + "(SawMill): " + " Enough Points!");
                    await Task.Delay(3000);

                    IsFinished = true;
                }

                if (!SearchImage.Find(target, Resources.Failed_SawMill, out Scan).IsEmpty&& !IsFinished)
                {
                    Console.WriteLine("BOT: " + BotID + "(SawMill): " + " Failed, Retry!");
                    BackgroundHelper.SendClick(hWnd, Scan.X + 5, Scan.Y + 5, 250);
                    await Task.Delay(1500);

                    IsFinished = !IsFinished;
                }


                if (IsFinished)
                {
                    if (!SearchImage.Find(target, Resources.Reward_Button_SawMill, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(SawMill): " + "Click Reward Button!");
                        BackgroundHelper.SendClick(hWnd, Scan.X + 25, Scan.Y + 15, 250);
                        await Task.Delay(1000);
                    }

                    if (!SearchImage.Find(target, Resources.Level5, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(SawMill): " + "Click Level 5 Button!");
                        //BackgroundHelper.SendClick(hWnd, Scan.X +5, Scan.Y +5, 250);
                        await Task.Delay(1000);
                    }

                    if (!SearchImage.Find(target, Resources.TryAgain, out Scan).IsEmpty)
                    {
                        if (Times >= Amount)
                        {
                            Console.WriteLine("Done!");

                            while (Program.botRunning)
                            {
                                await Task.Delay(100);
                            }
                        }
                        Times++;
                        Console.WriteLine("BOT: " + BotID + "(SawMill): " + "Click Try Again Button!");
                        BackgroundHelper.SendClick(hWnd, Scan.X + 20, Scan.Y + 5, 250);
                        await Task.Delay(1000);
                    }

                    if (!SearchImage.Find(target, Resources.Start_SawMill, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(SawMill): " + "Click Start Button!");
                        await Task.Delay(500);

                        BackgroundHelper.SendClick(hWnd, Scan.X + 50, Scan.Y + 30, 250);
                        await Task.Delay(2000);

                        IsFinished = !IsFinished;
                    }

                    if (!SearchImage.Find(target, Resources.NoPoints, out Scan).IsEmpty)
                    {
                        Console.WriteLine("BOT: " + BotID + "(SawMill): " + "No Points Left!");
                    }
                }
                await Task.Delay(10);
            }
            Console.WriteLine("SawMill Bot Stopped for HWID: {0}, Bot ID: {1}, Times played: {2}/{3}", hWnd, BotID, Times, Amount);
        }