Пример #1
0
        private void backgroundWorkerBotMain_DoWork(object sender, DoWorkEventArgs e)
        {
            while (huntingLuma)
            {
                //listen if cancellation request was send
                if (backgroundWorkerBotMain.CancellationPending == true)
                {
                    e.Cancel    = true;//cancel background worker
                    huntingLuma = false;
                }
                else
                {
                    huntingLuma = BotMain.LumaHunt(terrain);//run luma hunt function
                    if (huntingLuma == false)
                    {
                    }
                }
            }
            while (expTraining)
            {
                //listen if cancellation request was send
                if (backgroundWorkerBotMain.CancellationPending == true)
                {
                    e.Cancel    = true;//cancel background worker
                    expTraining = false;
                }
                else
                {
                    expTraining = BotMain.ExpTrain(terrain);//run tv train function
                }
            }

            while (freetemFarming)
            {
                //listen if cancellation request was send
                if (backgroundWorkerBotMain.CancellationPending == true)
                {
                    e.Cancel       = true;//cancel background worker
                    freetemFarming = false;
                }
                else
                {
                    freetemFarming = BotMain.FreetemFarm(terrain, catch1SV, healAndBuy, spot);//run freetem farm function
                }
            }
            if (InputSimulations.IsKeyDown(Keys.A))
            {
                InputSimulations.KeyUp((byte)Keys.A);
            }
            if (InputSimulations.IsKeyDown(Keys.D))
            {
                InputSimulations.KeyUp((byte)Keys.D);
            }
        }
Пример #2
0
        public static bool FreetemFarm(string terrain, bool catch1SV, bool healTemsAndBuyCards, string spot)
        {
            int   holdKeysleepMin            = 100;
            int   holdKeySleepMax            = 255;
            int   sleepAfterPressMin         = 355;
            int   sleepAfterPressMax         = 555;
            Point leftPlateFreezeCheckPoint  = new Point(1423, 113);
            Point rightPlateFreezeCheckPoint = new Point(1821, 168);
            Color perfStatColor     = Color.FromArgb(27, 209, 211);
            Color freezeStatusColor = Color.FromArgb(220, 252, 255);

            KeepMoving = true;
            Reconnect();
            SwapTemAfterFaint();
            if (!moveThread.IsAlive)
            {
                moveThread = new Thread(new ParameterizedThreadStart(Move));
                moveThread.Start(terrain);
            }
            //if encouter start
            if (GetColorAt(inCombatPoint) == inCombatColor)
            {
                //if theres no frozen enemy
                if (GetColorAt(animationEndPoint) == animationEndColor && !(GetColorAt(rightPlateFreezeCheckPoint) == freezeStatusColor) && !(GetColorAt(leftPlateFreezeCheckPoint) == freezeStatusColor))
                {
                    //atack
                    HoldKey((byte)Keys.D1, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.F, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.D1, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.F, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                }
                //if right enemy is frozen
                if (GetColorAt(rightPlateFreezeCheckPoint) == freezeStatusColor && GetColorAt(animationEndPoint) == animationEndColor)
                {
                    //throw temcards on right opp
                    HoldKey((byte)Keys.D7, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.E, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.F, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    MouseLeftClick(rightOpponentPlatePoint.X, rightOpponentPlatePoint.Y, 100, 20);
                    HoldKey((byte)Keys.D6, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                }
                //if left enemy is frozen
                if (GetColorAt(leftPlateFreezeCheckPoint) == freezeStatusColor && GetColorAt(animationEndPoint) == animationEndColor)
                {
                    //throw temcards on left opp
                    HoldKey((byte)Keys.D7, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.E, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    HoldKey((byte)Keys.F, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                    MouseLeftClick(leftOpponentPlatePoint.X, leftOpponentPlatePoint.Y, 100, 20);
                    HoldKey((byte)Keys.D6, holdKeysleepMin, holdKeySleepMax, sleepAfterPressMin, sleepAfterPressMax);
                }
            }
            //if temtem was catched
            if (GetColorAt(new Point(728, 428)) == Color.FromArgb(255, 175, 88))
            {
                //if catching 1 sv tems
                if (catch1SV)
                {
                    //check perfect sv stats
                    if (GetColorAt(new Point(1503, 390)) == perfStatColor ||
                        GetColorAt(new Point(1503, 425)) == perfStatColor ||
                        GetColorAt(new Point(1503, 465)) == perfStatColor ||
                        GetColorAt(new Point(1503, 505)) == perfStatColor ||
                        GetColorAt(new Point(1503, 544)) == perfStatColor ||
                        GetColorAt(new Point(1503, 583)) == perfStatColor ||
                        GetColorAt(new Point(1503, 622)) == perfStatColor)
                    {
                        //keep tem
                        MouseLeftClick(870, 940, 60, 20);
                        EncountersCounter++;
                    }
                    else
                    {
                        //release tem
                        MouseLeftClick(1020, 785, 50, 20);
                        MouseLeftClick(850, 650, 70, 20);
                        FreetemCounter++;
                        EncountersCounter++;
                    }
                    Thread.Sleep(2000);
                }
                //if not catching 1 sv tems
                else if (!catch1SV)
                {
                    int   perfStatCounter = 0;
                    int[] coordsArray     = new int[] { 390, 425, 465, 505, 544, 583, 622 };
                    for (int i = 0; i < 7; i++)
                    {
                        //check perfect stats and count them
                        if (GetColorAt(new Point(1503, coordsArray[i])) == perfStatColor)
                        {
                            perfStatCounter++;
                        }
                    }
                    //if 3 or more perfect stats(luma)
                    if (perfStatCounter >= 3)
                    {
                        //keep tem
                        MouseLeftClick(870, 940, 60, 20);
                        EncountersCounter++;
                    }
                    else
                    {
                        //release tem
                        MouseLeftClick(1020, 785, 50, 20);
                        MouseLeftClick(850, 650, 70, 20);
                        EncountersCounter++;
                        FreetemCounter++;
                    }
                    Thread.Sleep(2000);
                }
            }
            //if heal tems and buy cards is enabled
            if (healTemsAndBuyCards)
            {
                //if one of tems is fainted
                if (GetColorAt(new Point(1424, 1028)) == Color.FromArgb(82, 29, 35) ||
                    GetColorAt(new Point(1504, 1028)) == Color.FromArgb(82, 29, 35) ||
                    GetColorAt(new Point(1584, 1028)) == Color.FromArgb(82, 29, 35) ||
                    GetColorAt(new Point(1664, 1028)) == Color.FromArgb(82, 29, 35) ||
                    GetColorAt(new Point(1744, 1028)) == Color.FromArgb(82, 29, 35))
                {
                    KeepMoving = false;
                    if (InputSimulations.IsKeyDown(Keys.A))
                    {
                        InputSimulations.KeyUp((byte)Keys.A);
                    }
                    if (InputSimulations.IsKeyDown(Keys.D))
                    {
                        InputSimulations.KeyUp((byte)Keys.D);
                    }
                    //use smoke bomb
                    Thread.Sleep(1000);
                    HoldKey((byte)Keys.I, 125, 125, 400, 500);
                    HoldKey((byte)Keys.E, 125, 125, 400, 500);
                    int xmin = 275, ymin = 195, xmax = 405, ymax = 230;
                    //search for smoke bomb
                    for (int i = 0; i < 7; i++)
                    {
                        string recognizedString = TextRecognition.Recognize(xmin, ymin + (i * 112), xmax, ymax + (i * 112));
                        //if found, use it
                        if (String.Equals(recognizedString, "smoke"))
                        {
                            MouseLeftClick(xmin, ymin + (i * 112), 0, 0);
                            HoldKey((byte)Keys.F, 100, 155, 400, 500);
                            HoldKey((byte)Keys.F, 100, 155, 400, 500);
                            break;
                        }
                    }
                    Thread.Sleep(3000);
                    SpinWait.SpinUntil(() => GetColorAt(outOfCombatPoint) == outOfCombatColor);
                    if (spot == "Magmis")
                    {
                        //heal tems
                        HoldKey((byte)Keys.A, 280, 280, 10, 20);
                        HoldKey((byte)Keys.W, 100, 100, 10, 20);
                        HoldKey((byte)Keys.F, 100, 100, 10, 20);
                        Thread.Sleep(10000);
                        //buy cards
                        HoldKey((byte)Keys.S, 100, 100, 10, 20);
                        HoldKey((byte)Keys.D, 520, 540, 10, 20);
                        HoldKey((byte)Keys.W, 100, 100, 10, 20);
                        HoldKey((byte)Keys.F, 100, 100, 10, 20);
                        Thread.Sleep(1000);
                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        HoldKey((byte)Keys.S, 100, 100, 200, 300);
                        HoldKey((byte)Keys.S, 100, 100, 200, 300);
                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        for (int i = 0; i < 9; i++)
                        {
                            HoldKey((byte)Keys.D, 100, 100, 200, 300);
                        }
                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        HoldKey((byte)Keys.Escape, 100, 100, 200, 300);
                        //back to spot
                        HoldKey((byte)Keys.S, 470, 470, 10, 20);
                        HoldKey((byte)Keys.A, 3620, 3620, 10, 20);
                        HoldKey((byte)Keys.S, 200, 200, 10, 20);
                        Thread.Sleep(2000);
                        HoldKey((byte)Keys.S, 900, 900, 10, 20);
                    }
                    else if (spot == "Grumvel")
                    {
                        HoldKey((byte)Keys.W, 300, 300, 10, 20);
                        HoldKey((byte)Keys.A, 500, 500, 10, 20);
                        HoldKey((byte)Keys.W, 800, 800, 10, 20);
                        HoldKey((byte)Keys.D, 300, 300, 10, 20);
                        HoldKey((byte)Keys.F, 300, 300, 10, 20);
                        Thread.Sleep(10000);

                        HoldKey((byte)Keys.A, 100, 100, 10, 20);
                        HoldKey((byte)Keys.S, 800, 800, 10, 20);
                        HoldKey((byte)Keys.D, 1300, 1300, 10, 20);
                        HoldKey((byte)Keys.W, 800, 800, 10, 20);

                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        Thread.Sleep(1000);
                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        for (int i = 0; i < 10; i++)
                        {
                            HoldKey((byte)Keys.S, 100, 100, 200, 300);
                        }
                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        for (int i = 0; i < 9; i++)
                        {
                            HoldKey((byte)Keys.D, 100, 100, 200, 300);
                        }
                        HoldKey((byte)Keys.F, 100, 100, 200, 300);
                        HoldKey((byte)Keys.Escape, 100, 100, 200, 300);

                        HoldKey((byte)Keys.S, 500, 500, 10, 20);
                        HoldKey((byte)Keys.A, 700, 700, 10, 20);
                        HoldKey((byte)Keys.S, 500, 500, 10, 20);
                        Thread.Sleep(2000);
                        SpinWait.SpinUntil(() => GetColorAt(outOfCombatPoint) == outOfCombatColor && GetColorAt(new Point(1780, 35)) == outOfCombatColor);
                        HoldKey((byte)Keys.S, 500, 500, 10, 20);
                        HoldKey((byte)Keys.A, 1000, 1000, 10, 20);
                        HoldKey((byte)Keys.S, 600, 600, 10, 20);
                        HoldKey((byte)Keys.A, 1730, 1730, 10, 20);
                        HoldKey((byte)Keys.W, 1000, 1000, 10, 20);
                        Thread.Sleep(2000);
                        SpinWait.SpinUntil(() => GetColorAt(outOfCombatPoint) == outOfCombatColor && GetColorAt(new Point(1780, 35)) == outOfCombatColor);
                        HoldKey((byte)Keys.W, 1000, 3000, 10, 20);
                    }
                }
            }
            return(true);
        }
Пример #3
0
        /// <summary>
        /// simulates move of character
        /// </summary>
        public static void Move(object data)
        {
            //1754
            int rightMin = 1739;
            int rightMax = 1749;
            //1775
            int    leftMin = 1780;
            int    leftMax = 1790;
            int    caveAdd = 10;
            string terrain = data.ToString();

            if (terrain == "Grass")
            {
                //if out of encounter
                while (GetColorAt(outOfCombatPoint) == outOfCombatColor && KeepMoving)
                {
                    //if grass on right from character on minimap, hold A key
                    if ((GetColorAt(new Point(new Random().Next(rightMin, rightMax), 154)) == Color.FromArgb(112, 171, 132) || GetColorAt(new Point(new Random().Next(rightMin, rightMax), 154)) == Color.FromArgb(112, 171, 133)) &&
                        !(InputSimulations.IsKeyDown(Keys.D)))
                    {
                        KeyDown((byte)Keys.A);
                    }

                    else if (InputSimulations.IsKeyDown(Keys.A))
                    {
                        KeyUp((byte)Keys.A);
                    }
                    //if grass on left from character on minimap, hold D key
                    if ((GetColorAt(new Point(new Random().Next(leftMin, leftMax), 154)) == Color.FromArgb(112, 171, 132) || GetColorAt(new Point(new Random().Next(leftMin, leftMax), 154)) == Color.FromArgb(112, 171, 133)) &&
                        !(InputSimulations.IsKeyDown(Keys.A)))
                    {
                        KeyDown((byte)Keys.D);
                    }
                    else if (InputSimulations.IsKeyDown(Keys.D))
                    {
                        KeyUp((byte)Keys.D);
                    }
                }
            }
            if (terrain == "Water")
            {
                //if out of encounter
                while (GetColorAt(outOfCombatPoint) == outOfCombatColor && KeepMoving)
                {
                    //if water on right from character on minimap, hold A key
                    if ((GetColorAt(new Point(new Random().Next(rightMin, rightMax), 154)) == Color.FromArgb(0, 127, 178) || GetColorAt(new Point(new Random().Next(rightMin, rightMax), 154)) == Color.FromArgb(0, 127, 178)) &&
                        !(InputSimulations.IsKeyDown(Keys.D)))
                    {
                        KeyDown((byte)Keys.A);
                    }
                    else if (InputSimulations.IsKeyDown(Keys.A))
                    {
                        KeyUp((byte)Keys.A);
                    }
                    //if water on left from character on minimap, hold D key
                    if ((GetColorAt(new Point(new Random().Next(leftMin, leftMax), 154)) == Color.FromArgb(0, 127, 178) || GetColorAt(new Point(new Random().Next(leftMin, leftMax), 154)) == Color.FromArgb(0, 127, 178)) &&
                        !(InputSimulations.IsKeyDown(Keys.A)))
                    {
                        KeyDown((byte)Keys.D);
                    }
                    else if (InputSimulations.IsKeyDown(Keys.D))
                    {
                        KeyUp((byte)Keys.D);
                    }
                }
            }
            if (terrain == "Cave")
            {
                //if out of encounter
                while (GetColorAt(outOfCombatPoint) == outOfCombatColor && KeepMoving)
                {
                    //if cave on right from character on minimap, hold A key
                    if ((GetColorAt(new Point(new Random().Next(rightMin - caveAdd, rightMax), 154)) == Color.FromArgb(52, 121, 132) || GetColorAt(new Point(new Random().Next(rightMin - caveAdd, rightMax), 154)) == Color.FromArgb(53, 120, 135)) &&
                        !(InputSimulations.IsKeyDown(Keys.D)))
                    {
                        KeyDown((byte)Keys.A);
                    }
                    else if (InputSimulations.IsKeyDown(Keys.A))
                    {
                        KeyUp((byte)Keys.A);
                    }
                    //if cave on left from character on minimap, hold D key
                    if ((GetColorAt(new Point(new Random().Next(leftMin, leftMax + caveAdd), 154)) == Color.FromArgb(52, 121, 132) || GetColorAt(new Point(new Random().Next(leftMin, leftMax + caveAdd), 154)) == Color.FromArgb(53, 120, 135)) &&
                        !(InputSimulations.IsKeyDown(Keys.A)))
                    {
                        KeyDown((byte)Keys.D);
                    }
                    else if (InputSimulations.IsKeyDown(Keys.D))
                    {
                        KeyUp((byte)Keys.D);
                    }
                }
            }

            if (InputSimulations.IsKeyDown(Keys.A))
            {
                InputSimulations.KeyUp((byte)Keys.A);
            }
            if (InputSimulations.IsKeyDown(Keys.D))
            {
                InputSimulations.KeyUp((byte)Keys.D);
            }
        }