public static void Demon_Realm()
        {
            Debug_.WriteLine();
            Point?point = null;
            int   error = 0;

            while (true)
            {
                var image = BotCore.ImageCapture();
                point = BotCore.FindImage(image, Img.Close2, false);
                if (point != null)
                {
                    BotCore.SendTap(new Point(point.Value.X, point.Value.Y));
                    BotCore.Delay(1000, false);
                    continue;
                }
                point = BotCore.FindImage(image, Img.GreenButton, false);
                if (point != null)
                {
                    BotCore.SendTap(new Point(point.Value.X, point.Value.Y));
                    BotCore.Delay(1000, false);
                    continue;
                }
                if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                {
                    return;
                }
                if (BotCore.RGBComparer(image, new Point(415, 678), Color.FromArgb(223, 192, 63), 10))
                {
                    PrivateVariable.VCevent       = PrivateVariable.EventType.DemonRealm;
                    PrivateVariable.InEventScreen = true;
                    DemonStage_Enter();
                    return;
                }
                image = BotCore.ImageCapture();
                Variables.ScriptLog("Locating Demon Realm Event UI!", Color.White);
                if (BotCore.RGBComparer(image, new Point(600, 405), Color.FromArgb(59, 30, 37), 15))
                {
                    VCBotScript.Tower_Floor = OCR.OcrImage(BotCore.CropImage(image, new Point(300, 115), new Point(484, 142)), "eng");
                    VCBotScript.Tower_Rank  = OCR.OcrImage(BotCore.CropImage(image, new Point(300, 150), new Point(458, 170)), "eng");
                    Variables.ScriptLog("Demon Realm Event Found!", Color.Lime);
                    PrivateVariable.InEventScreen = true;
                    VCBotScript.energy            = VCBotScript.GetEnergy();
                    VCBotScript.runes             = VCBotScript.GetRune();
                    break;
                }
                else
                {
                    BotCore.Delay(1000, false);
                    error++;
                    if (error > 20)
                    {
                        ScriptErrorHandler.Reset("Unable to locate event. Going back to main screen");
                        return;
                    }
                }
            }

            if (VCBotScript.energy == 0)
            {
                Variables.ScriptLog("Waiting for energy", Color.Yellow);
                Variables.ScriptLog("Close game and wait for energy because of no energy left", Color.Yellow);
                VCBotScript.NoEnergy();
                PrivateVariable.InEventScreen = false;
                PrivateVariable.InMainScreen  = false;
                PrivateVariable.Battling      = false;
                return;
            }
            Variables.ScriptLog("Enterting Stage", Color.White);
            BotCore.SendSwipe(new Point(307, 249), new Point(305, 403), 300);
            BotCore.Delay(1500);
            switch (MainScreen.Level)
            {
            case 0:
                BotCore.SendTap(250, 284);
                break;

            case 1:
                if (BotCore.RGBComparer(VCBotScript.image, new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
                    BotCore.SendTap(250, 284);
                    break;
                }
                BotCore.SendTap(362, 283);
                break;

            case 2:
                if (BotCore.RGBComparer(VCBotScript.image, new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
                    if (BotCore.RGBComparer(VCBotScript.image, new Point(324, 270), Color.FromArgb(51, 16, 5), 20))
                    {
                        Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
                        BotCore.SendTap(250, 284);
                        break;
                    }
                    BotCore.SendTap(362, 283);
                    break;
                }
                BotCore.SendTap(214, 370);
                break;

            case 3:
                if (BotCore.RGBComparer(VCBotScript.image, new Point(324, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("超上级还没被解锁!自动往下挑战中!", Color.Red);
                    if (BotCore.RGBComparer(VCBotScript.image, new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                    {
                        Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
                        if (BotCore.RGBComparer(VCBotScript.image, new Point(324, 270), Color.FromArgb(51, 16, 5), 20))
                        {
                            Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
                            BotCore.SendTap(250, 284);
                            break;
                        }
                        BotCore.SendTap(362, 283);
                        break;
                    }
                }
                BotCore.SendTap(353, 371);
                break;

            case 4:
                if (BotCore.RGBComparer(VCBotScript.image, new Point(324, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("超上级还没被解锁!自动往下挑战中!", Color.Red);
                    if (BotCore.RGBComparer(VCBotScript.image, new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                    {
                        Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
                        if (BotCore.RGBComparer(VCBotScript.image, new Point(324, 270), Color.FromArgb(51, 16, 5), 20))
                        {
                            Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
                            BotCore.SendTap(250, 284);
                            break;
                        }
                        BotCore.SendTap(362, 283);
                        break;
                    }
                }
                BotCore.SendTap(353, 371);
                break;
            }
            bool EnteredStage = false;

            error = 0;
            do
            {
                VCBotScript.image = BotCore.ImageCapture();
                if (BotCore.RGBComparer(VCBotScript.image, new Point(959, 656), 31, 102, 26, 4))
                {
                    Variables.ScriptLog("Start battle", Color.Lime);
                    BotCore.SendTap(new Point(959, 656));
                    BotCore.Delay(2000, false);
                    if (VCBotScript.runes == 4 && VCBotScript.energy == 5)
                    {
                        BotCore.SendSwipe(new Point(640, 473), new Point(640, 280), 1000);
                        BotCore.Delay(500, false);
                    }
                    BotCore.SendTap(new Point(758, 566));
                    BotCore.Delay(6000, 8000);
                    BotCore.SendTap(640, 400); //Tap away Round Battle Text
                    BotCore.Delay(2000, false);
                    VCBotScript.stop.Start();
                    VCBotScript.energy--; //Calculate Energy used
                    if ((VCBotScript.nextOnline - DateTime.Now) < new TimeSpan(3, 15, 0))
                    {
                        VCBotScript.nextOnline = VCBotScript.nextOnline.AddMinutes(45);
                    }
                    EnteredStage = true;
                    BotCore.Delay(5000, false);
                    break;
                }
                else
                {
                    BotCore.Delay(1000, 1500);
                    error++;
                    if (error > 10)
                    {
                        return;
                    }
                }
                if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                {
                    ScriptErrorHandler.Reset("Game is closed! Restarting all!");
                    return;
                }
            }while (!EnteredStage);
            DemonStage_Enter();
        }
Exemple #2
0
        public void Attack()
        {
            Random rnd    = new Random();
            var    KO     = Screenshot.CropImage(VCBotScript.image, new Point(230, 70), new Point(1140, 160));
            var    points = BotCore.FindImages(KO, new Bitmap[] { Resource.Stun1, Resource.Stun2 }, false, 0.9);

            if (points != null && points.Length > 2)
            {
                //Ko Chance
                KOChance = true;
            }
            else
            {
                KOChance = false;
            }
            foreach (var cb in toolParameterComboBoxes)
            {
                int index = 0;
                cb.Invoke((MethodInvoker) delegate { index = cb.SelectedIndex; });
                switch (index)
                {
                case 0:
                    if (!cboxchecked[index] || PrivateVariable.Instance.VCevent != PrivateVariable.EventType.Tower)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(176, 356), new Point(330, 611));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    else if (KOChance)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(176, 356), new Point(330, 611));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    break;

                case 1:
                    if (!cboxchecked[index] || PrivateVariable.Instance.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(357, 356), new Point(543, 610));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(448, 492), new Point(449, 493), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    else if (KOChance)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(448, 492), new Point(449, 493), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    break;

                case 2:
                    if (!cboxchecked[index] || PrivateVariable.Instance.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(546, 376), new Point(724, 597));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(641, 473), new Point(642, 474), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    else if (KOChance)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(641, 473), new Point(642, 474), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    break;

                case 3:
                    if (!cboxchecked[index] || PrivateVariable.Instance.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(761, 356), new Point(921, 613));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(834, 483), new Point(835, 484), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    else if (KOChance)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(834, 483), new Point(835, 484), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    break;

                case 4:
                    if (!cboxchecked[index] || PrivateVariable.Instance.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(934, 356), new Point(1090, 578));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(1017, 470), new Point(1018, 471), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    else if (KOChance)
                    {
                        var crop    = Screenshot.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        var results = BotCore.FindImages(crop, PrivateVariable.Instance.Skills, false, 0.9, true);
                        if (results != null)
                        {
                            Variables.ScriptLog("Skill actived", Color.Blue);
                            BotCore.SendSwipe(new Point(1017, 470), new Point(1018, 471), 1200);
                            for (int x = 0; x < 6; x++)
                            {
                                Thread.Sleep(100);
                                BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                            }
                        }
                    }
                    break;
                }
            }
        }
        public static void SwitchStage()
        {
            //Check do we still can get into the stage
            do
            {
                BotCore.Delay(1000, 1200);
                VCBotScript.image = BotCore.ImageCapture();
                if (BotCore.FindImage(BotCore.CropImage(VCBotScript.image, new Point(634, 374), new Point(694, 421)), Img.Archwitch_Rec, false) != null)
                {
                    Attack();
                    return;
                }
            }while (BotCore.FindImage(VCBotScript.image, Img.SoulWeapon, true) == null);
            int error = 0;

            //Check if we didnt need to switch stage
            do
            {
                var crop       = BotCore.CropImage(VCBotScript.image, new Point(73, 83), new Point(112, 102));
                var tempstring = OCR.OcrImage(crop, "eng");
                var leftTimes  = tempstring.Split('/')[0];
                if (leftTimes == "0")
                {
                    Variables.ScriptLog("Today had already attacked 5 times. Exiting...", Color.Lime);
                    return;
                }
                else
                {
                    //Back to 1-1 first before we continue
                    BotCore.Delay(1000);
                    //BotCore.Minitouch("d 0 290 340 150\nc\nm 0 340 340 150\nc\nm 0 390 340 150\nc\nm 0 440 340 150\nc\nm 0 490 340 150\nc\nm 0 540 340 150\nc\nm 0 590 340 150\nc\nm 0 640 340 150\nc\nm 0 740 340 150\nc\nm 0 840 340 150\nc\nm 0 940 340 150\nc\nu 0\nc\n");
                    BotCore.SendSwipe(290, 340, 990, 360, 3000);//Why it can't swipe????
                    BotCore.Delay(1000);

                    switch (VCBotScript.Weapon_Stage)
                    {
                    case 1.1:
                        BotCore.SendTap(449, 532);
                        break;

                    case 1.2:
                        BotCore.SendTap(577, 422);
                        break;

                    case 1.3:
                        BotCore.SendTap(692, 277);
                        break;

                    case 2.1:
                        BotCore.SendTap(820, 423);
                        break;

                    case 2.2:
                        BotCore.SendTap(944, 306);
                        break;

                    case 2.3:
                        BotCore.SendTap(1053, 210);
                        break;

                    case 3.1:
                        BotCore.SendTap(1191, 310);
                        break;

                    //next page
                    case 3.2:
                        BotCore.SendSwipe(1191, 310, 670, 310, 3000);
                        BotCore.Delay(1000);
                        BotCore.SendTap(315, 427);
                        break;
                    }
                    BotCore.Delay(1000, 1200);
                    VCBotScript.image = BotCore.ImageCapture();
                    if (BotCore.FindImage(VCBotScript.image, Img.GreenButton, false) != null)
                    {
                        BotCore.SendTap(776, 524);
                        BotCore.Delay(1000, 2000);
                        Attack();
                    }
                    else
                    {
                        Variables.ScriptLog("Unexpected error found! Unable to get into stage! Exiting for now!", Color.Red);
                        return;
                    }
                }
                error++;
            }while (error != 10);
            if (error == 10)
            {
                Variables.ScriptLog("Something error happens. Unable to get detect expcted UI", Color.Red);
            }
        }
        private static void SwitchStage()
        {
            Variables.ScriptLog("Entering stage!", Color.Lime);
            do
            {
                BotCore.Delay(1000, 1200);
                VCBotScript.image = BotCore.ImageCapture();
            }while (BotCore.FindImage(VCBotScript.image, Img.Archwitch, true) == null);
            //swipe to start of UI
            BotCore.SendSwipe(new Point(125, 385), new Point(1100, 385), 1000);
            Color notUnlocked = Color.FromArgb(20, 22, 22);

            switch (VCBotScript.Archwitch_Stage)
            {
            case 1.1:
                //Must be unlocked, no detection needed
                BotCore.SendTap(404, 536);
                break;

            case 1.2:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(274, 511), notUnlocked, 10))
                {
                    BotCore.SendTap(274, 512);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 1.3:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(224, 340), notUnlocked, 10))
                {
                    BotCore.SendTap(211, 340);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 2.1:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(339, 170), notUnlocked, 10))
                {
                    BotCore.SendTap(333, 172);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 2.2:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(528, 168), notUnlocked, 10))
                {
                    BotCore.SendTap(527, 171);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 2.3:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(643, 327), notUnlocked, 10))
                {
                    BotCore.SendTap(621, 323);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 3.1:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(739, 457), notUnlocked, 10))
                {
                    BotCore.SendTap(740, 457);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 3.2:
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(890, 517), notUnlocked, 10))
                {
                    BotCore.SendTap(887, 518);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            //stage at next page
            case 3.3:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(445, 546), notUnlocked, 10))
                {
                    BotCore.SendTap(444, 544);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 4.1:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(643, 532), notUnlocked, 10))
                {
                    BotCore.SendTap(643, 532);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 4.2:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(823, 530), notUnlocked, 10))
                {
                    BotCore.SendTap(823, 530);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 4.3:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(1010, 514), notUnlocked, 10))
                {
                    BotCore.SendTap(1010, 514);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 5.1:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(1110, 364), notUnlocked, 10))
                {
                    BotCore.SendTap(1110, 364);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 5.2:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(1100, 222), notUnlocked, 10))
                {
                    BotCore.SendTap(1100, 222);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;

            case 5.3:
                BotCore.SendSwipe(new Point(1100, 385), new Point(125, 385), 1000);
                BotCore.Delay(500, 1000);
                if (!BotCore.RGBComparer(VCBotScript.image, new Point(951, 205), notUnlocked, 10))
                {
                    BotCore.SendTap(951, 205);
                }
                else
                {
                    Variables.ScriptLog("Stage not unlocked, trying to enter previous one!");
                    VCBotScript.Archwitch_Stage--;
                    SwitchStage();
                }
                break;
            }
            Point?p = null;

            do
            {
                BotCore.Delay(1500);
                VCBotScript.image = BotCore.ImageCapture();
                p = BotCore.FindImage(VCBotScript.image, Img.GreenButton, false);
            } while (p == null);
            BotCore.SendTap(p.Value);
            //Entered Stage
            Attack();
        }
        public static void SoulWeaponEnter()
        {
            Variables.ScriptLog("Soul Weapon Event found!", Color.Lime);
            int error = 0;

            //Check if we didnt need to switch stage
            do
            {
                if (!BotCore.GameIsForeground(VCBotScript.game))
                {
                    return;
                }
                VCBotScript.image = Screenshot.ImageCapture();
                if (BotCore.FindImage(VCBotScript.image, Img.SoulArrow, false, 0.9) != null || BotCore.FindImage(Screenshot.CropImage(VCBotScript.image, new Point(445, 355), new Point(815, 430)), Img.Red_Button, false, 0.87) != null)
                {
                    Variables.ScriptLog("Already in a stage, running now...", Color.Lime);
                    Attack();
                }
                PT   = OCR.OcrImage(Screenshot.CropImage(VCBotScript.image, new Point(840, 32), new Point(911, 59)), "en");
                Rank = OCR.OcrImage(Screenshot.CropImage(VCBotScript.image, new Point(854, 74), new Point(911, 92)), "en");
                //Back to 1-1 first before we continue
                BotCore.Delay(1000);
                if (Variables.FindConfig("General", "SoulEv", out string data))
                {
                    if (bool.Parse(data))
                    {
                        var New = BotCore.FindImage(VCBotScript.image, Img.NEW, false, 0.8);
                        if (New != null)
                        {
                            Variables.ScriptLog("Found new stage!", Color.Blue);
                            BotCore.SendTap(New.Value);
                            goto SkipSelectStage;
                        }
                        New = BotCore.FindImage(VCBotScript.image, Img.NEW1, false, 0.8);
                        if (New != null)
                        {
                            Variables.ScriptLog("Found new stage!", Color.Blue);
                            BotCore.SendTap(New.Value);
                            goto SkipSelectStage;
                        }
                        New = BotCore.FindImage(VCBotScript.image, Img.NEW2, false, 0.8);
                        if (New != null)
                        {
                            Variables.ScriptLog("Found new stage!", Color.Blue);
                            BotCore.SendTap(New.Value);
                            goto SkipSelectStage;
                        }
                        New = BotCore.FindImage(VCBotScript.image, Img.NEW3, false, 0.8);
                        if (New != null)
                        {
                            Variables.ScriptLog("Found new stage!", Color.Blue);
                            BotCore.SendTap(New.Value);
                            goto SkipSelectStage;
                        }
                        else
                        {
                            Variables.ScriptLog("New stage not found! Try getting into Boss stage!", Color.Blue);
                            New = BotCore.FindImage(VCBotScript.image, Img.Castle, true, 0.8);
                            if (New != null)
                            {
                                BotCore.SendTap(New.Value);
                                goto SkipSelectStage;
                            }
                            Variables.ScriptLog("No Stage located, force getting into stage!", Color.Red);
                        }
                    }
                }
                BotCore.SendSwipe(500, 440, 1200, 360, 1000);//Why it can't swipe????
                BotCore.Delay(1000);
                switch (VCBotScript.Weapon_Stage)
                {
                case 1.1:
                    BotCore.SendTap(449, 532);
                    break;

                case 1.2:
                    BotCore.SendTap(577, 422);
                    break;

                case 1.3:
                    BotCore.SendTap(692, 277);
                    break;

                case 2.1:
                    BotCore.SendTap(820, 423);
                    break;

                case 2.2:
                    BotCore.SendTap(944, 306);
                    break;

                case 2.3:
                    BotCore.SendTap(1053, 210);
                    break;

                case 3.1:
                    BotCore.SendTap(1191, 310);
                    break;

                //next page
                case 3.2:
                    BotCore.SendSwipe(1191, 310, 670, 310, 3000);
                    BotCore.Delay(1000);
                    BotCore.SendTap(315, 427);
                    break;
                }
SkipSelectStage:
                BotCore.Delay(1000, 1200);
                VCBotScript.image = Screenshot.ImageCapture();
                var point = BotCore.FindImage(VCBotScript.image, Img.GreenButton, false, 0.9);
                if (point != null)
                {
                    BotCore.SendTap(point.Value);
                    BotCore.Delay(1000, 2000);
                    Attack();
                    if (!PrivateVariable.Instance.InEventScreen || BotCore.GameIsForeground(VCBotScript.game))
                    {
                        PrivateVariable.Instance.InEventScreen = false;
                        PrivateVariable.Instance.InMainScreen  = false;
                        return;
                    }
                    error = 0;
                    if (Variables.FindConfig("General", "SoulEv", out data))
                    {
                        if (!bool.Parse(data))
                        {
                            if (VCBotScript.Weapon_Stage < 3.0)
                            {
                                VCBotScript.Weapon_Stage += 0.1;
                                if (VCBotScript.Weapon_Stage % 1 > 0.3)
                                {
                                    VCBotScript.Weapon_Stage += 0.7;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (error > 9)
                    {
                        BotCore.KillGame("com.nubee.valkyriecrusade");
                        ScriptErrorHandler.Reset("Extreme error happens. Restarting game...");
                        return;
                    }
                    else
                    {
                        Variables.ScriptLog("Something error happens. Unable to get detect expcted UI", Color.Red);
                        BotCore.SendSwipe(395, 365, 1100, 380, 1000);
                        error++;
                    }
                }
            }while (error < 10);
        }
Exemple #6
0
        public void Attack()
        {
            Random rnd    = new Random();
            Bitmap bmp    = (Bitmap)Image.FromFile("Img\\KO_Chance\\KO.png");
            var    points = BotCore.FindImage(VCBotScript.image, new Bitmap[] { bmp }, true);

            if (points != null)
            {
                //Ko Chance
                KOChance = true;
            }
            else
            {
                KOChance = false;
            }
            foreach (var cb in toolParameterComboBoxes)
            {
                int index = 0;
                cb.Invoke((MethodInvoker) delegate { index = cb.SelectedIndex; });
                switch (index)
                {
                case 0:
                    if (!cboxchecked[index] || PrivateVariable.VCevent != PrivateVariable.EventType.Tower)
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(176, 356), new Point(330, 611));
                        foreach (var f in PrivateVariable.Skills)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            try
                            {
                                Thread.Sleep(10);
                                Point?p = BotCore.FindImage(crop, f, false);
                                if (p != null)
                                {
                                    Variables.ScriptLog("Skill actived", Color.Blue);
                                    BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                    for (int x = 0; x < 6; x++)
                                    {
                                        Thread.Sleep(100);
                                        BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                    }
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    else if (KOChance)
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(176, 356), new Point(330, 611));
                        foreach (var f in PrivateVariable.Skills)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            try
                            {
                                Thread.Sleep(10);
                                Point?p = BotCore.FindImage(crop, f, false);
                                if (p != null)
                                {
                                    Variables.ScriptLog("Skill actived", Color.Blue);
                                    BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                    for (int x = 0; x < 6; x++)
                                    {
                                        Thread.Sleep(100);
                                        BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                    }
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    break;

                case 1:
                    if (!cboxchecked[index] || PrivateVariable.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(357, 356), new Point(543, 610));
                        foreach (var f in PrivateVariable.Skills)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            try
                            {
                                Thread.Sleep(10);
                                Point?p = BotCore.FindImage(crop, f, false);
                                if (p != null)
                                {
                                    Variables.ScriptLog("Skill actived", Color.Blue);
                                    BotCore.SendSwipe(new Point(448, 492), new Point(449, 493), 1200);
                                    for (int x = 0; x < 6; x++)
                                    {
                                        Thread.Sleep(100);
                                        BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                    }
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        if (BotCore.FindImage(crop, "Img\\KO_Chance\\KO.png", false) != null)    //Ko Chance, active skill
                        {
                            crop = BotCore.CropImage(VCBotScript.image, new Point(357, 356), new Point(543, 610));
                            foreach (var f in PrivateVariable.Skills)
                            {
                                if (!ScriptRun.Run)
                                {
                                    return;
                                }
                                try
                                {
                                    Thread.Sleep(10);
                                    Point?p = BotCore.FindImage(crop, f, false);
                                    if (p != null)
                                    {
                                        Variables.ScriptLog("Skill actived", Color.Blue);
                                        BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                        for (int x = 0; x < 6; x++)
                                        {
                                            Thread.Sleep(100);
                                            BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                        }
                                        break;
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    break;

                case 2:
                    if (!cboxchecked[index] || PrivateVariable.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(546, 376), new Point(724, 597));
                        foreach (var f in PrivateVariable.Skills)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            try
                            {
                                Thread.Sleep(10);
                                Point?p = BotCore.FindImage(crop, f, false);
                                if (p != null)
                                {
                                    Variables.ScriptLog("Skill actived", Color.Blue);
                                    BotCore.SendSwipe(new Point(641, 473), new Point(642, 474), 1200);
                                    for (int x = 0; x < 6; x++)
                                    {
                                        Thread.Sleep(100);
                                        BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                    }
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        if (BotCore.FindImage(crop, "Img\\KO_Chance\\KO.png", false) != null)    //Ko Chance, active skill
                        {
                            crop = BotCore.CropImage(VCBotScript.image, new Point(546, 376), new Point(724, 597));
                            foreach (var f in PrivateVariable.Skills)
                            {
                                if (!ScriptRun.Run)
                                {
                                    return;
                                }
                                try
                                {
                                    Thread.Sleep(10);
                                    Point?p = BotCore.FindImage(crop, f, false);
                                    if (p != null)
                                    {
                                        Variables.ScriptLog("Skill actived", Color.Blue);
                                        BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                        for (int x = 0; x < 6; x++)
                                        {
                                            Thread.Sleep(100);
                                            BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                        }
                                        break;
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    break;

                case 3:
                    if (!cboxchecked[index] || PrivateVariable.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(761, 356), new Point(921, 613));
                        foreach (var f in PrivateVariable.Skills)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            try
                            {
                                Thread.Sleep(10);
                                Point?p = BotCore.FindImage(crop, f, false);
                                if (p != null)
                                {
                                    Variables.ScriptLog("Skill actived", Color.Blue);
                                    BotCore.SendSwipe(new Point(834, 483), new Point(835, 484), 1200);
                                    for (int x = 0; x < 6; x++)
                                    {
                                        Thread.Sleep(100);
                                        BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                    }
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        if (BotCore.FindImage(crop, "Img\\KO_Chance\\KO.png", false) != null)    //Ko Chance, active skill
                        {
                            crop = BotCore.CropImage(VCBotScript.image, new Point(761, 356), new Point(921, 613));
                            foreach (var f in PrivateVariable.Skills)
                            {
                                if (!ScriptRun.Run)
                                {
                                    return;
                                }
                                try
                                {
                                    Thread.Sleep(10);
                                    Point?p = BotCore.FindImage(crop, f, false);
                                    if (p != null)
                                    {
                                        Variables.ScriptLog("Skill actived", Color.Blue);
                                        BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                        for (int x = 0; x < 6; x++)
                                        {
                                            Thread.Sleep(100);
                                            BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                        }
                                        break;
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    break;

                case 4:
                    if (!cboxchecked[index] || PrivateVariable.VCevent != PrivateVariable.EventType.ArchWitch)
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(934, 356), new Point(1090, 578));
                        foreach (var f in PrivateVariable.Skills)
                        {
                            if (!ScriptRun.Run)
                            {
                                return;
                            }
                            try
                            {
                                Thread.Sleep(10);
                                Point?p = BotCore.FindImage(crop, f, false);
                                if (p != null)
                                {
                                    Variables.ScriptLog("Skill actived", Color.Blue);
                                    BotCore.SendSwipe(new Point(1017, 470), new Point(1018, 471), 1200);
                                    for (int x = 0; x < 6; x++)
                                    {
                                        Thread.Sleep(100);
                                        BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                    }
                                    break;
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                        byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(500, 0), new Point(800, 50));
                        if (BotCore.FindImage(crop, "Img\\KO_Chance\\KO.png", false) != null)    //Ko Chance, active skill
                        {
                            crop = BotCore.CropImage(VCBotScript.image, new Point(934, 356), new Point(1090, 578));
                            foreach (var f in PrivateVariable.Skills)
                            {
                                if (!ScriptRun.Run)
                                {
                                    return;
                                }
                                try
                                {
                                    Thread.Sleep(10);
                                    Point?p = BotCore.FindImage(crop, f, false);
                                    if (p != null)
                                    {
                                        Variables.ScriptLog("Skill actived", Color.Blue);
                                        BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                        for (int x = 0; x < 6; x++)
                                        {
                                            Thread.Sleep(100);
                                            BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                        }
                                        break;
                                    }
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }
Exemple #7
0
        public void Attack()
        {
            Random rnd = new Random();

            foreach (var cb in toolParameterComboBoxes)
            {
                int index = 0;
                cb.Invoke((MethodInvoker) delegate { index = cb.SelectedIndex; });
                switch (index)
                {
                case 0:
                    byte[] crop = BotCore.CropImage(VCBotScript.image, new Point(176, 356), new Point(330, 611));
                    foreach (var f in PrivateVariable.Skills)
                    {
                        if (!ScriptRun.Run)
                        {
                            return;
                        }
                        try
                        {
                            Thread.Sleep(10);
                            Point?p = BotCore.FindImage(crop, f, false);
                            if (p != null)
                            {
                                Variables.ScriptLog("Skill actived", Color.Blue);
                                BotCore.SendSwipe(new Point(263, 473), new Point(264, 474), 1200);
                                for (int x = 0; x < 6; x++)
                                {
                                    Thread.Sleep(100);
                                    BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                }
                                break;
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;

                case 1:
                    crop = BotCore.CropImage(VCBotScript.image, new Point(357, 356), new Point(543, 610));
                    foreach (var f in PrivateVariable.Skills)
                    {
                        if (!ScriptRun.Run)
                        {
                            return;
                        }
                        try
                        {
                            Thread.Sleep(10);
                            Point?p = BotCore.FindImage(crop, f, false);
                            if (p != null)
                            {
                                Variables.ScriptLog("Skill actived", Color.Blue);
                                BotCore.SendSwipe(new Point(448, 492), new Point(449, 493), 1200);
                                for (int x = 0; x < 6; x++)
                                {
                                    Thread.Sleep(100);
                                    BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                }
                                break;
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;

                case 2:
                    crop = BotCore.CropImage(VCBotScript.image, new Point(546, 376), new Point(724, 597));
                    foreach (var f in PrivateVariable.Skills)
                    {
                        if (!ScriptRun.Run)
                        {
                            return;
                        }
                        try
                        {
                            Thread.Sleep(10);
                            Point?p = BotCore.FindImage(crop, f, false);
                            if (p != null)
                            {
                                Variables.ScriptLog("Skill actived", Color.Blue);
                                BotCore.SendSwipe(new Point(641, 473), new Point(642, 474), 1200);
                                for (int x = 0; x < 6; x++)
                                {
                                    Thread.Sleep(100);
                                    BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                }
                                break;
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;

                case 3:
                    crop = BotCore.CropImage(VCBotScript.image, new Point(761, 356), new Point(921, 613));
                    foreach (var f in PrivateVariable.Skills)
                    {
                        if (!ScriptRun.Run)
                        {
                            return;
                        }
                        try
                        {
                            Thread.Sleep(10);
                            Point?p = BotCore.FindImage(crop, f, false);
                            if (p != null)
                            {
                                Variables.ScriptLog("Skill actived", Color.Blue);
                                BotCore.SendSwipe(new Point(834, 483), new Point(835, 484), 1200);
                                for (int x = 0; x < 6; x++)
                                {
                                    Thread.Sleep(100);
                                    BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                }
                                break;
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;

                case 4:
                    crop = BotCore.CropImage(VCBotScript.image, new Point(934, 356), new Point(1090, 578));
                    foreach (var f in PrivateVariable.Skills)
                    {
                        if (!ScriptRun.Run)
                        {
                            return;
                        }
                        try
                        {
                            Thread.Sleep(10);
                            Point?p = BotCore.FindImage(crop, f, false);
                            if (p != null)
                            {
                                Variables.ScriptLog("Skill actived", Color.Blue);
                                BotCore.SendSwipe(new Point(1017, 470), new Point(1018, 471), 1200);
                                for (int x = 0; x < 6; x++)
                                {
                                    Thread.Sleep(100);
                                    BotCore.SendTap(rnd.Next(5, 15), rnd.Next(5, 15));
                                }
                                break;
                            }
                        }
                        catch
                        {
                        }
                    }
                    break;
                }
            }
        }