コード例 #1
0
        /// <summary>
        /// heal friendly tem if wounded enough
        /// </summary>
        private static void HealTems()
        {
            if (GetColorAt(new Point(1425, 1028)) == Color.FromArgb(219, 42, 56) ||
                GetColorAt(new Point(1505, 1028)) == Color.FromArgb(219, 42, 56) ||
                GetColorAt(new Point(1585, 1028)) == Color.FromArgb(219, 42, 56) ||
                GetColorAt(new Point(1665, 1028)) == Color.FromArgb(219, 42, 56) ||
                GetColorAt(new Point(1745, 1028)) == Color.FromArgb(219, 42, 56))
            {
                bool found = false;
                HoldKey((byte)Keys.I, 100, 155, 500, 655);
                HoldKey((byte)Keys.E, 100, 155, 500, 655);
                HoldKey((byte)Keys.E, 100, 155, 500, 655);
                HoldKey((byte)Keys.E, 100, 155, 500, 655);
                for (int i = 0; i < 25; i++)
                {
                    HoldKey((byte)Keys.S, 10, 15, 100, 155);
                }
                int xmin = 275, ymin = 195, xmax = 375, ymax = 230;
                //search for balm
Repeat:
                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, "balm"))
                    {
                        found = true;
                        MouseLeftClick(xmin, ymin + (i * 112), 0, 0);
                        HoldKey((byte)Keys.F, 100, 155, 500, 500);
                        HoldKey((byte)Keys.F, 100, 155, 500, 500);
                        HoldKey((byte)Keys.F, 100, 155, 500, 500);
                        break;
                    }
                }
                if (found == false)
                {
                    for (int i = 0; i < 7; i++)
                    {
                        HoldKey((byte)Keys.S, 10, 15, 100, 155);
                    }
                    goto Repeat;
                }
                HoldKey((byte)Keys.Escape, 100, 155, 500, 655);
                HoldKey((byte)Keys.Escape, 100, 155, 500, 655);
            }
        }
コード例 #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);
        }