public static void Tower()
        {
            Debug_.WriteLine();
            BotCore.Delay(1000, false);
            var   image = Screenshot.ImageCapture();
            Point?point = BotCore.FindImage(image, Img.Close2, false, 0.8);

            if (point != null)
            {
                BotCore.SendTap(new Point(point.Value.X, point.Value.Y));
                BotCore.Delay(1000, false);
            }
            image = Screenshot.ImageCapture();
            Variables.ScriptLog("Locating Tower Event UI!", Color.White);
            if (BotCore.FindImage(image, Img.Locate_Tower, true, 0.8) != null)
            {
                image = Screenshot.ImageCapture();
                VCBotScript.Tower_Floor = OCR.OcrImage(Screenshot.CropImage(image, new Point(280, 110), new Point(440, 145)), "eng");
                VCBotScript.Tower_Rank  = OCR.OcrImage(Screenshot.CropImage(image, new Point(280, 145), new Point(410, 170)), "eng");
                Variables.ScriptLog("Tower Event Found!", Color.Lime);
                PrivateVariable.Instance.InEventScreen = true;
            }
            else
            {
                PrivateVariable.Instance.InMainScreen  = false;
                PrivateVariable.Instance.InEventScreen = false;
                return;
            }
            image = Screenshot.ImageCapture();
            while (!BotCore.RGBComparer(new Point(135, 526), 13, 46, 74, 10))
            {
                BotCore.Delay(1000, true);
                image = Screenshot.ImageCapture();
            }
            VCBotScript.energy = VCBotScript.GetEnergy();
            VCBotScript.runes  = VCBotScript.GetRune();
            Variables.ScriptLog("Current have " + VCBotScript.energy + " energy and " + VCBotScript.runes + " runes", Color.LightSkyBlue);
            if (VCBotScript.energy == 0)
            {
                Variables.ScriptLog("Waiting for energy", Color.Yellow);
                if (PrivateVariable.Instance.TakePartInNormalStage)
                {
                    BotCore.SendTap(1218, 662);
                    BotCore.Delay(400, 600);
                    BotCore.SendTap(744, 622);
                }
                else
                {
                    if (PrivateVariable.Instance.Use_Item)
                    {
                        if (VCBotScript.runes == 5)
                        {
                            Variables.ScriptLog("Use item as it is now rune!", Color.White);
                        }
                        else
                        {
                            Variables.ScriptLog("Close game and wait for energy because of no energy left", Color.White);
                            VCBotScript.NoEnergy();
                            PrivateVariable.Instance.InEventScreen = false;
                            PrivateVariable.Instance.InMainScreen  = false;
                            PrivateVariable.Instance.Battling      = false;
                            return;
                        }
                    }
                    else
                    {
                        Variables.ScriptLog("Close game and wait for energy because of no energy left", Color.White);
                        VCBotScript.NoEnergy();
                        PrivateVariable.Instance.InEventScreen = false;
                        PrivateVariable.Instance.InMainScreen  = false;
                        PrivateVariable.Instance.Battling      = false;
                        return;
                    }
                }
            }
            Variables.ScriptLog("Entering Stage!", Color.Lime);
            image = Screenshot.ImageCapture();
            if (BotCore.FindImage(image, Img.GreenButton, false, 0.9) == null)
            {
                Variables.ScriptLog("Rune Boss found!", Color.Lime);
            }
            else
            {
                var templevel = MainScreen.Level;
Loop:
                switch (templevel)
                {
                case 0:
                    for (int x = 0; x < 5; x++)
                    {
                        VCBotScript.image = Screenshot.ImageCapture();
                        if (BotCore.FindImage(VCBotScript.image, Img.LV0, true, 0.85) == null)
                        {
                            BotCore.SendTap(rnd.Next(410, 420), rnd.Next(650, 660));
                            BotCore.Delay(500);
                        }
                    }
                    BotCore.SendTap(785, 618);
                    break;

                case 1:
                    for (int x = 0; x < 5; x++)
                    {
                        VCBotScript.image = Screenshot.ImageCapture();
                        if (BotCore.FindImage(VCBotScript.image, Img.LV1, true, 0.85) == null)
                        {
                            BotCore.SendTap(rnd.Next(410, 420), rnd.Next(650, 660));
                            BotCore.Delay(500);
                        }
                    }
                    if (BotCore.FindImage(VCBotScript.image, Img.LV1, true, 0.85) == null)
                    {
                        Variables.ScriptLog("Unable to switch to stage. Stage not unlocked?", Color.Red);
                        templevel--;
                        goto Loop;
                    }
                    BotCore.SendTap(785, 618);
                    break;

                case 2:
                    for (int x = 0; x < 5; x++)
                    {
                        VCBotScript.image = Screenshot.ImageCapture();
                        if (BotCore.FindImage(VCBotScript.image, Img.LV2, true, 0.85) == null)
                        {
                            BotCore.SendTap(rnd.Next(410, 420), rnd.Next(650, 660));
                            BotCore.Delay(500);
                        }
                        else if (BotCore.FindImage(VCBotScript.image, Img.LV3, true, 0.85) != null)
                        {
                            //This is not 上级,this is f*****g 超上级
                            BotCore.SendTap(rnd.Next(410, 420), rnd.Next(650, 660));
                            BotCore.Delay(500);
                        }
                    }
                    if (BotCore.FindImage(VCBotScript.image, Img.LV2, true, 0.85) == null)
                    {
                        Variables.ScriptLog("Unable to switch to stage. Stage not unlocked?", Color.Red);
                        templevel--;
                        goto Loop;
                    }
                    BotCore.SendTap(785, 618);
                    break;

                case 3:
                    for (int x = 0; x < 5; x++)
                    {
                        VCBotScript.image = Screenshot.ImageCapture();
                        if (BotCore.FindImage(VCBotScript.image, Img.LV3, true, 0.85) == null)
                        {
                            BotCore.SendTap(rnd.Next(410, 420), rnd.Next(650, 660));
                            BotCore.Delay(500);
                        }
                    }
                    if (BotCore.FindImage(VCBotScript.image, Img.LV3, true, 0.85) == null)
                    {
                        Variables.ScriptLog("Unable to switch to stage. Stage not unlocked?", Color.Red);
                        templevel--;
                        goto Loop;
                    }
                    BotCore.SendTap(785, 618);
                    break;

                case 4:
                    for (int x = 0; x < 5; x++)
                    {
                        VCBotScript.image = Screenshot.ImageCapture();
                        if (BotCore.FindImage(VCBotScript.image, Img.LV4, true, 0.85) == null)
                        {
                            BotCore.SendTap(rnd.Next(410, 420), rnd.Next(650, 660));
                            BotCore.Delay(500);
                        }
                    }
                    if (BotCore.FindImage(VCBotScript.image, Img.LV4, true, 0.85) == null)
                    {
                        Variables.ScriptLog("Unable to switch to stage. Stage not unlocked?", Color.Red);
                        templevel--;
                        goto Loop;
                    }
                    BotCore.SendTap(785, 618);
                    break;
                }
            }

            BotCore.Delay(2000);
            BotCore.SendTap(800, 660);

            /*
             * image = Screenshot.ImageCapture();
             * switch (MainScreen.Level)
             * {
             *  case 0:
             *      BotCore.SendTap(196, 648);
             *      break;
             *  case 1:
             *      if (BotCore.RGBComparer( new Point(328, 621), Color.FromArgb(13, 12, 12), 35))
             *      {
             *          Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
             *          BotCore.SendTap(196, 648);
             *          break;
             *      }
             *      BotCore.SendTap(391, 648);
             *      break;
             *  case 2:
             *      if (BotCore.RGBComparer( new Point(515, 625), Color.FromArgb(12, 11, 12), 35))
             *      {
             *          Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
             *          if (BotCore.RGBComparer( new Point(328, 621), Color.FromArgb(13, 12, 12), 5))
             *          {
             *              Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
             *              BotCore.SendTap(196, 648);
             *              break;
             *          }
             *          BotCore.SendTap(391, 648);
             *          break;
             *      }
             *      BotCore.SendTap(581, 646);
             *      break;
             *  case 3:
             *      if (BotCore.RGBComparer( new Point(703, 622), Color.FromArgb(32, 30, 30), 35))
             *      {
             *          Variables.ScriptLog("超上级还没被解锁!自动往下挑战中!", Color.Red);
             *          if (BotCore.RGBComparer( new Point(515, 625), Color.FromArgb(12, 11, 12), 35))
             *          {
             *              Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
             *              if (BotCore.RGBComparer( new Point(328, 621), Color.FromArgb(13, 12, 12), 35))
             *              {
             *                  Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
             *                  BotCore.SendTap(196, 648);
             *                  break;
             *              }
             *              BotCore.SendTap(391, 648);
             *              break;
             *          }
             *          BotCore.SendTap(581, 646);
             *          break;
             *      }
             *      BotCore.SendTap(741, 623);
             *      break;
             *  case 4:
             *      if (BotCore.RGBComparer( new Point(885, 621), Color.FromArgb(107, 100, 100), 90))
             *      {
             *          Variables.ScriptLog("霸级还没被解锁!自动往下挑战中!", Color.Red);
             *          if (BotCore.RGBComparer( new Point(703, 621), Color.FromArgb(107, 100, 100), 90))
             *          {
             *              Variables.ScriptLog("超上级还没被解锁!自动往下挑战中!", Color.Red);
             *              if (BotCore.RGBComparer( new Point(515, 621), Color.FromArgb(107, 100, 100), 90))
             *              {
             *                  Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
             *                  if (BotCore.RGBComparer( new Point(328, 621), Color.FromArgb(117, 100, 100), 90))
             *                  {
             *                      Variables.ScriptLog("中级还没被解锁!自动往下挑战中!", Color.Red);
             *                      BotCore.SendTap(196, 648);
             *                      break;
             *                  }
             *                  BotCore.SendTap(391, 648);
             *                  break;
             *              }
             *              BotCore.SendTap(581, 646);
             *              break;
             *          }
             *          BotCore.SendTap(741, 623);
             *          break;
             *      }
             *      BotCore.SendTap(921, 620);
             *      break;
             * }*/
            BotCore.Delay(3000, false);
            do
            {
                if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                {
                    return;
                }

                /*if (PrivateVariable.Use_Item && VCBotScript.energy == 0 && VCBotScript.runes == 5)
                 * {
                 *  image = Screenshot.ImageCapture();
                 *  if (BotCore.GetPixel(new Point(798, 313), image) != Color.FromArgb(27, 95, 22))
                 *  {
                 *      BotCore.Delay(1000, false);
                 *      continue;
                 *  }
                 *  BotCore.SendTap(798, 313);
                 *  image = Screenshot.ImageCapture();
                 *  Point? p = BotCore.FindImage(image, Img.GreenButton, false);
                 *  while (p == null)
                 *  {
                 *      if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                 *      {
                 *          return;
                 *      }
                 *      BotCore.Delay(400, 600);
                 *      image = Screenshot.ImageCapture();
                 *      p = BotCore.FindImage(image, Img.GreenButton, false);
                 *  }
                 *  BotCore.SendTap(p.Value);
                 *  VCBotScript.energy = 5;
                 *  BotCore.Delay(5000, false);
                 * }*/
                image = Screenshot.ImageCapture();
                if (BotCore.RGBComparer(new Point(959, 656), 31, 102, 26, 4))
                {
                    Variables.ScriptLog("Start battle", Color.Lime);
                    BotCore.SendTap(new Point(959, 656));
                    BotCore.Delay(7000, false);
                    BotCore.SendTap(640, 400); //Tap away Round Battle Text
                    BotCore.Delay(2000, false);
                    VCBotScript.stop.Start();
                    PrivateVariable.Instance.Battling = true;
                    VCBotScript.energy--; //Calculate Energy used
                    if (VCBotScript.nextOnline < DateTime.Now)
                    {
                        VCBotScript.nextOnline = DateTime.Now;
                    }
                    VCBotScript.nextOnline = VCBotScript.nextOnline.AddMinutes(45);
                    BotCore.Delay(1000, false);
                    break;
                }
                else
                {
                    image = Screenshot.ImageCapture();
                    var crop = Screenshot.CropImage(image, new Point(125, 600), new Point(1270, 10));
                    point = BotCore.FindImage(crop, Img.Red_Button, false, 0.9);
                    if (point != null)
                    {
                        Variables.ScriptLog("Rune boss found!", Color.Yellow);
                        BotCore.SendTap(new Point(point.Value.X + 125, point.Value.Y));
                        VCBotScript.RuneBoss = true;
                        BotCore.Delay(9000, 12000);
                    }
                    else
                    {
                        ScriptErrorHandler.ErrorHandle();
                    }
                }
                image = Screenshot.ImageCapture();
                ScriptErrorHandler.ErrorHandle();
            }while (!PrivateVariable.Instance.Battling);
        }
        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();
        }
Beispiel #3
0
        //Guild wars
        private static void GuildWar(TimeSpan time)
        {
            var image = Screenshot.ImageCapture();
            //Read energy
            var greenbutton = BotCore.FindImage(image, Img.GreenButton, false, 0.9);

            if (greenbutton != null)
            {
                BotCore.SendTap(greenbutton.Value);
                BotCore.Delay(1000);
                return;
            }
            VCBotScript.energy = VCBotScript.GetEnergy();
            VCBotScript.runes  = VCBotScript.GetRune();
            if (VCBotScript.energy > 0)
            {
                if (time.Minutes < 50)
                {
                    if (VCBotScript.energy < 5 && VCBotScript.runes > 3 && VCBotScript.runes < 6)
                    {
                        if (waittime == 0)
                        {
                            Variables.ScriptLog("Waiting Energy before Fever", Color.Yellow);
                        }
                        else if (waittime % 5 == 0)
                        {
                            BotCore.SendTap(797, 187);
                            BotCore.Delay(5000);
                            waittime = 0;
                        }
                        BotCore.Delay(5000);
                        waittime++;
                        return;
                    }
                }
                PrivateVariable.Instance.Battling = true;
                var redbutton = BotCore.FindImage(image, Img.Red_Button, false, 0.9);
                if (redbutton != null)
                {
                    BotCore.SendTap(redbutton.Value);
                    int x = 0;
                    do
                    {
                        if (BotCore.RGBComparer(new Point(247, 356), Color.Black, 10))
                        {
                            break;
                        }
                        else
                        {
                            BotCore.Delay(1000);
                            x++;
                        }
                    }while (x < 20);
                    VCBotScript.Battle();
                }
            }
            else
            {
                if (waittime == 0)
                {
                    Variables.ScriptLog("Waiting Energy", Color.Yellow);
                }
                else if (waittime % 5 == 0)
                {
                    Variables.ScriptLog("Refreshing Map", Color.Cyan);
                    BotCore.SendTap(797, 187);
                    BotCore.Delay(5000);
                    waittime = 0;
                }
                BotCore.Delay(5000);
                waittime++;
                return;
            }
        }