public static void CheckWalkEnergy()
 {
     try
     {
         var temp     = OCR.OcrImage(Screenshot.CropImage(VCBotScript.image, new Point(65, 54), new Point(166, 78)), "eng");
         var temp_arr = temp.Split('/');
         FullWalkEnergy    = Convert.ToInt32(temp_arr[1]);
         CurrentWalkEnergy = Convert.ToInt32(temp_arr[0]);
         error             = 0;
         Variables.ScriptLog("Current walk energy is " + CurrentWalkEnergy, Color.White);
     }
     catch
     {
         if (FullWalkEnergy == 0)
         {
             CurrentWalkEnergy = 999;
             FullWalkEnergy    = 999;
         }
         error++;
     }
 }
Example #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;
                }
            }
        }
Example #3
0
        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);
        }
Example #4
0
        private static void DemonStage_Enter()
        {
            int error = 0;

            while (!BotCore.RGBComparer(new Point(824, 651), Color.FromArgb(80, 1, 9), 15))
            {
                if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                {
                    ScriptErrorHandler.Reset("Game close, restarting...");
                    return;
                }
                error++;
                if (error > 10)
                {
                    ScriptErrorHandler.Reset("Event Locate Failed!");
                    BotCore.KillGame("com.nubee.valkyriecrusade");
                    return;
                }
                BotCore.Delay(1000, false);
            }
            error = 0;
            Variables.ScriptLog("Demon Realm Event Located", Color.Lime);
            List <Point> BlackListedLocation = new List <Point>();

            Variables.ScriptLog("Fetching stage images", Color.White);
            List <Image> Stage = new List <Image>();

            foreach (var file in Directory.GetFiles("Img\\DemonRealm", "*.png").OrderBy(f => f))
            {
                Stage.Add(Image.FromFile(file));
            }
            Point?p = null;

            while (error < 10 && p == null)
            {
                if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                {
                    return;
                }
                VCBotScript.image = Screenshot.ImageCapture();
                var crop = Screenshot.CropImage(VCBotScript.image, new Point(0, 0), new Point(1280, 615));
                Variables.ScriptLog("Trying to find stages to enter", Color.LightSkyBlue);
                Bitmap screen = Screenshot.Decompress(crop);
                foreach (var blacklist in BlackListedLocation)
                {
                    using (Graphics grf = Graphics.FromImage(screen))
                    {
                        using (Brush brsh = new SolidBrush(ColorTranslator.FromHtml("#000000")))
                        {
                            grf.FillEllipse(brsh, blacklist.X, blacklist.Y, 5, 5);
                        }
                    }
                }
                foreach (var stage in Stage)
                {
                    for (int x = 0; x < 4; x++)
                    {
                        p = BotCore.FindImage(screen, (Bitmap)stage, false, 0.8);
                        if (p != null)
                        {
                            if (!BlackListedLocation.Contains(p.Value))
                            {
                                Variables.ScriptLog("Stage found!", Color.Lime);
                                BotCore.SendTap(p.Value);
                                BotCore.Delay(3000, false);
                                bool StageEnterable = false;
                                for (int y = 0; y < 10; y++)
                                {
                                    if (BotCore.RGBComparer(new Point(543, 122), Color.FromArgb(60, 106, 137), 20))
                                    {
                                        StageEnterable = true;
                                        break;
                                    }
                                    else
                                    {
                                        BotCore.Delay(1000);
                                    }
                                }
                                if (StageEnterable)
                                {
                                    BotCore.SendTap(768, 536);
                                    BotCore.Delay(4500, false);
                                    BotCore.SendTap(970, 614);
                                    BotCore.Delay(2000, false);
                                    BotCore.SendTap(753, 423);
                                }
                                else
                                {
                                    Variables.ScriptLog("Ops, looks like the stage is not able to enter!", Color.Red);
                                    BlackListedLocation.Add(p.Value);
                                    using (Graphics grf = Graphics.FromImage(screen))
                                    {
                                        using (Brush brsh = new SolidBrush(ColorTranslator.FromHtml("#000000")))
                                        {
                                            grf.FillEllipse(brsh, p.Value.X, p.Value.Y, 5, 5);
                                        }
                                    }
                                    continue;
                                }

                                break;
                            }
                        }
                    }
                    if (p != null)
                    {
                        break;
                    }
                    else
                    {
                        p = BotCore.FindImage(screen, Img.Boss, false, 0.85);
                        if (p != null)
                        {
                            Variables.ScriptLog("Boss Stage found!", Color.Lime);
                            if (VCBotScript.runes == 3 && VCBotScript.energy != 5)
                            {
                                VCBotScript.StuckRune();
                                return;
                            }
                            BotCore.SendTap(p.Value);
                            Point?point = null;
                            BotCore.Delay(5000, false);
                            for (int x = 0; x < 20; x++)
                            {
                                VCBotScript.image = Screenshot.ImageCapture();
                                var p3 = BotCore.FindImage(VCBotScript.image, Img.GreenButton, false, 0.9);
                                if (p3 != null)
                                {
                                    BotCore.SendTap(p3.Value);
                                    BotCore.Delay(1000, false);
                                    continue;
                                }
                                if (!BotCore.GameIsForeground("com.nubee.valkyriecrusade"))
                                {
                                    return;
                                }
                                point = BotCore.FindImage(VCBotScript.image, Img.Red_Button, false, 0.9);
                                if (point != null)
                                {
                                    break;
                                }
                                BotCore.Delay(1000, false);
                            }
                            if (point == null)
                            {
                                BotCore.KillGame("com.nubee.valkyriecrusade");
                                ScriptErrorHandler.Reset("No expected UI is shown, restarting game!");
                                return;
                            }
                            BotCore.SendTap(point.Value);
                            break;
                        }
                    }
                }
                VCBotScript.image = Screenshot.ImageCapture();
                Point?p2 = BotCore.FindImage(crop, Img.GreenButton, false, 0.9);
                if (p2 != null)
                {
                    BotCore.SendTap(p2.Value);
                    BotCore.Delay(1000, false);
                    continue;
                }
                error++;
            }
            if (error > 9)
            {
                Variables.ScriptLog("Looks like we are in the trouble!", Color.Red);
                error = 0;
                BotCore.KillGame("com.nubee.valkyriecrusade");
                ScriptErrorHandler.Reset("Restarting game as unable to detect stages properly!");
            }
            PrivateVariable.Instance.Battling = true;
            VCBotScript.stop.Start();
        }
Example #5
0
        public static void Demon_Realm()
        {
            Debug_.WriteLine();
            Point?point = null;
            int   error = 0;

            while (true)
            {
                var image = Screenshot.ImageCapture();
                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);
                    continue;
                }
                point = BotCore.FindImage(image, Img.GreenButton, false, 0.9);
                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(new Point(824, 651), Color.FromArgb(80, 1, 9), 15) && BotCore.RGBComparer(new Point(466, 673), Color.FromArgb(77, 75, 84), 15))
                {
                    PrivateVariable.Instance.VCevent       = PrivateVariable.EventType.DemonRealm;
                    PrivateVariable.Instance.InEventScreen = true;
                    DemonStage_Enter();
                    return;
                }
                Variables.ScriptLog("Locating Demon Realm Event UI!", Color.White);
                if (BotCore.RGBComparer(new Point(938, 410), Color.FromArgb(36, 34, 38), 15))
                {
                    VCBotScript.Tower_Floor = OCR.OcrImage(Screenshot.CropImage(image, new Point(300, 115), new Point(484, 142)), "eng");
                    VCBotScript.Tower_Rank  = OCR.OcrImage(Screenshot.CropImage(image, new Point(300, 150), new Point(458, 170)), "eng");
                    Variables.ScriptLog("Demon Realm Event Found!", Color.Lime);
                    PrivateVariable.Instance.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.Instance.InEventScreen = false;
                PrivateVariable.Instance.InMainScreen  = false;
                PrivateVariable.Instance.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(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(new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
                    if (BotCore.RGBComparer(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(new Point(324, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("超上级还没被解锁!自动往下挑战中!", Color.Red);
                    if (BotCore.RGBComparer(new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                    {
                        Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
                        if (BotCore.RGBComparer(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(new Point(324, 355), Color.FromArgb(51, 16, 5), 20))
                {
                    Variables.ScriptLog("超上级还没被解锁!自动往下挑战中!", Color.Red);
                    if (BotCore.RGBComparer(new Point(143, 355), Color.FromArgb(51, 16, 5), 20))
                    {
                        Variables.ScriptLog("上级还没被解锁!自动往下挑战中!", Color.Red);
                        if (BotCore.RGBComparer(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
            {
                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(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();
        }
Example #6
0
        private static void Attack()
        {
            do
            {
                BotCore.Delay(1500);
                VCBotScript.image = Screenshot.ImageCapture();
            }while (BotCore.RGBComparer(new Point(400, 400), Color.Black, 10, VCBotScript.image));
            Variables.ScriptLog("Running stage!", Color.Lime);
            int error = 0;

            do
            {
                Random rnd = new Random();
                VCBotScript.image = Screenshot.ImageCapture();
                var   crop    = Screenshot.CropImage(VCBotScript.image, new Point(420, 360), new Point(855, 450));
                Point?buttons = BotCore.FindImage(crop, Img.GreenButton, false, 0.9);
                if (buttons != null)
                {
                    ArchwitchEvent.CheckWalkEnergy();
                    if (ArchwitchEvent.CurrentWalkEnergy <= 15 || (ArchwitchEvent.CurrentBossEnergy <= 3 && ArchwitchEvent.FullBossEnergy > 0))
                    {
                        //No energy
                        Variables.ScriptLog("SoulWeapon Event have no energy. Exiting now! ", Color.Yellow);
                        TimeSpan delay = new TimeSpan(0, ((ArchwitchEvent.FullWalkEnergy - ArchwitchEvent.CurrentWalkEnergy) * 5), 0);
                        VCBotScript.nextOnline = DateTime.Now + delay;
                        Variables.ScriptLog("Estimate online time is " + VCBotScript.nextOnline, Color.Lime);
                        BotCore.KillGame(VCBotScript.game);
                        BotCore.Delay(delay);
                        PrivateVariable.Instance.InEventScreen = false;
                        PrivateVariable.Instance.InMainScreen  = false;
                        PrivateVariable.Instance.Battling      = false;
                        PrivateVariable.Instance.InMap         = false;
                        ArchwitchEvent.CurrentBossEnergy       = ArchwitchEvent.FullBossEnergy;
                        ArchwitchEvent.CurrentWalkEnergy       = ArchwitchEvent.FullWalkEnergy;
                        BotCore.StartGame(VCBotScript.game + VCBotScript.activity);
                        return;
                    }
                    BotCore.SendTap(buttons.Value.X + rnd.Next(430, 845), buttons.Value.Y + rnd.Next(370, 420));
                    BotCore.Delay(2000, 3000);
                    continue;
                }
                buttons = BotCore.FindImage(VCBotScript.image, Img.Return, true, 0.9);
                if (buttons != null)
                {
                    BotCore.SendTap(buttons.Value);
                    BotCore.Delay(1000, 1500);
                    continue;
                }
                buttons = BotCore.FindImage(VCBotScript.image, Img.Close2, true, 0.9);
                if (buttons != null)
                {
                    BotCore.SendTap(buttons.Value);
                    BotCore.Delay(1000, 1500);
                    continue;
                }
                buttons = BotCore.FindImage(crop, Img.Red_Button, false, 0.87);
                if (buttons != null)
                {
                    ArchwitchEvent.CheckBossEnergy();
                    BotCore.SendTap(buttons.Value.X + rnd.Next(430, 845), buttons.Value.Y + rnd.Next(370, 420));
                    BotCore.Delay(2000, 3000);
                    PrivateVariable.Instance.Battling = true;
                    VCBotScript.Battle();
                    continue;
                }
                buttons = BotCore.FindImage(VCBotScript.image, Img.ShopKeeper, true, 0.9);
                if (buttons != null)
                {
                    BotCore.SendTap(770, 640);
                    Variables.ScriptLog("Shop keeper found! Getting in and see what to buy!", Color.White);
                    BotCore.Delay(3000);
                    VCBotScript.image = Screenshot.ImageCapture();
                    if (BotCore.FindImage(VCBotScript.image, Img.MisteryBox, true, 0.9) != null)
                    {
                        Variables.ScriptLog("Mistory Box found! Purchasing all products!", Color.Lime);
                        BotCore.Delay(10000);
                        for (int x = 0; x < 3; x++)
                        {
                            switch (x)
                            {
                            case 0:
                                Variables.ScriptLog("Purchasing First Item", Color.Wheat);
                                BotCore.SendTap(1030, 220);
                                break;

                            case 1:
                                Variables.ScriptLog("Purchasing Second Item", Color.Wheat);
                                BotCore.SendTap(1030, 390);
                                break;

                            case 2:
                                Variables.ScriptLog("Purchasing Third Item", Color.Wheat);
                                BotCore.SendTap(1030, 550);
                                break;
                            }
                            BotCore.Delay(3000);
                            Point?greenButton;
                            do
                            {
                                BotCore.SendTap(2, 2);
                                BotCore.Delay(300);
                                VCBotScript.image = Screenshot.ImageCapture();
                                greenButton       = BotCore.FindImage(VCBotScript.image, Img.GreenButton, false, 0.9);
                            }while (greenButton == null);
                            BotCore.SendTap(greenButton.Value);
                            for (int y = 0; y < 10; y++)
                            {
                                BotCore.SendTap(2, 2);
                                BotCore.Delay(500);
                            }
                            BotCore.Delay(5000);
                        }
                    }
                    BotCore.SendTap(1110, 875);
                    BotCore.Delay(500);
                    continue;
                }
                if (BotCore.FindImage(VCBotScript.image, Img.ArchwitchHunt, true, 0.9) != null)
                {
                    //Stage completed
                    return;
                }
                error++;
                if (error > 30)
                {
                    Screenshot.Decompress(VCBotScript.image).Save("Profiles\\Logs\\error.png");
                    //UnhandledException = true;
                    Variables.ScriptLog("Unhandled exception. Contact PoH98 for fix!", Color.Red);
                    return;
                }
                else
                {
                    BotCore.Delay(1000, 1500);
                }
            }while (true);
        }
Example #7
0
        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);
        }
Example #8
0
        public static void Enter()
        {
            var tempEvent = PrivateVariable.Instance.VCevent;
            var Japan     = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
            var time      = TimeZoneInfo.ConvertTime(DateTime.Now, Japan).TimeOfDay;
            var hour      = time.Hours;

            while (guildwartime.Contains(hour))
            {
                if (!PrivateVariable.Instance.LocatedGuildWar)
                {
                    Variables.ScriptLog("Entering Guildwar!", Color.Lime);
                    PrivateVariable.Instance.VCevent = PrivateVariable.EventType.GuildWar;
                    for (int x = 0; x < 30; x++)
                    {
                        while (!BotCore.GameIsForeground(VCBotScript.game))
                        {
                            PrivateVariable.Instance.LocatedGuildWar = false;
                            BotCore.StartGame(VCBotScript.game + VCBotScript.activity);
                            BotCore.Delay(5000);
                            VCBotScript.LocateMainScreen();
                            x = 0;
                        }
                        var image = Screenshot.ImageCapture();
                        var point = BotCore.FindImage(image, Img.GreenButton, false, 0.9);
                        if (point != null)
                        {
                            BotCore.SendTap(point.Value);
                            BotCore.Delay(500);
                            x--;
                            continue;
                        }
                        point = BotCore.FindImage(Screenshot.CropImage(image, new Point(319, 525), new Point(588, 591)), Img.Start_Game, false, 0.8);
                        if (point != null && BotCore.RGBComparer(new Point(379, 642), Color.FromArgb(37, 37, 37), 15, image))
                        {
                            Variables.ScriptLog("Start Game Button Located!", Color.Lime);
                            BotCore.SendTap(point.Value);
                            PrivateVariable.Instance.InMainScreen    = false;
                            PrivateVariable.Instance.LocatedGuildWar = false;
                            VCBotScript.LocateMainScreen();
                        }
                        if (BotCore.FindImage(image, "Img\\GuildWar\\Locate.png", false, 0.85) != null)
                        {
                            PrivateVariable.Instance.LocatedGuildWar = true;
                            break;
                        }
                        if (x > 10)
                        {
                            Variables.ScriptLog("Somehing is not right! No guild war locate found! Lets get in with different method!", Color.Yellow);
                            if (Variables.FindConfig("GuildWar", "EnterPosX", out string p_x) && Variables.FindConfig("GuildWar", "EnterPosY", out string p_y))
                            {
                                if (BotCore.FindImage(image, Img.MainScreen, true, 0.9) == null)
                                {
                                    BotCore.SendTap(point.Value);
                                    BotCore.Delay(1000, false);
                                    Variables.ScriptLog("Returning main screen", Color.Lime);
                                    BotCore.SendTap(942, 630);
                                    BotCore.Delay(5000, false);
                                    //We are not at mainscreen and having nothing to do
                                    point = BotCore.FindImage(image, Img.Back_to_Village, true, 0.9);
                                    if (point != null)
                                    {
                                        Variables.ScriptLog("Going back to Main screen", Color.Lime);
                                        BotCore.SendTap(point.Value);
                                        do
                                        {
                                            BotCore.Delay(3000);
                                            VCBotScript.image = Screenshot.ImageCapture();
                                        }while (BotCore.FindImage(VCBotScript.image, Img.MainScreen, true, 0.9) == null);
                                    }
                                }
                                Variables.ScriptLog("Screen Located", Color.Lime);
                                BotCore.SendTap(170, 655);
                                BotCore.Delay(5000, false);
                                try
                                {
                                    BotCore.SendTap(Convert.ToInt32(p_x), Convert.ToInt32(p_y));
                                }
                                catch
                                {
                                    Variables.ModifyConfig("GuildWar", "EnterPosX", "620");
                                    Variables.ModifyConfig("GuildWar", "EnterPosY", "90");
                                    continue;
                                }
                            }
                            else
                            {
                                Variables.ModifyConfig("GuildWar", "EnterPosX", "620");
                                Variables.ModifyConfig("GuildWar", "EnterPosY", "90");
                            }
                            x = 0;
                            error++;
                            if (error > 3)
                            {
                                Variables.ScriptLog("Unable to get into guildwar!", Color.Red);
                                Variables.ModifyConfig("GuildWar", "Manual", "true");
                                return;
                            }
                            continue;
                        }
                    }
                }
                GuildWar(time);
                time = TimeZoneInfo.ConvertTime(DateTime.Now, Japan).TimeOfDay;
                hour = time.Hours;
            }
            PrivateVariable.Instance.VCevent         = tempEvent;
            PrivateVariable.Instance.LocatedGuildWar = false;
            return;
        }
 private static void Attack()
 {
     do
     {
         BotCore.Delay(1500);
     }while (BotCore.RGBComparer(new Point(400, 400), Color.Black, 10));
     Variables.ScriptLog("Running stage!", Color.Lime);
     do
     {
         Variables.ScriptLog("Detecting UIs...", Color.White);
         if (!BotCore.GameIsForeground(VCBotScript.game))
         {
             ScriptErrorHandler.Reset("Game closed!");
             return;
         }
         ScriptErrorHandler.ErrorHandle();
         Random rnd = new Random();
         VCBotScript.image = Screenshot.ImageCapture();
         var   crop    = Screenshot.CropImage(VCBotScript.image, new Point(420, 360), new Point(855, 430));
         Point?buttons = BotCore.FindImage(crop, Img.GreenButton, false, 0.9);
         if (buttons != null)
         {
             CheckWalkEnergy();
             if (error > 10)
             {
                 Variables.ScriptLog("Unable to OCR energy! Exiting Event now!", Color.Red);
                 CurrentWalkEnergy = 0;
             }
             if (CurrentWalkEnergy < 15)
             {
                 //No energy
                 Variables.ScriptLog("Archwitch Event have no energy. Exiting now! ", Color.Yellow);
                 return;
             }
             BotCore.SendTap(buttons.Value.X + rnd.Next(430, 845), buttons.Value.Y + rnd.Next(370, 420));
             BotCore.Delay(2000, 3000);
             continue;
         }
         crop    = Screenshot.CropImage(VCBotScript.image, new Point(532, 624), new Point(732, 667));
         buttons = BotCore.FindImage(crop, Img.GreenButton, false, 0.88);
         if (buttons != null)
         {
             BotCore.SendTap(635, 648);
             continue;
         }
         buttons = BotCore.FindImage(VCBotScript.image, Img.Close2, true, 0.9);
         if (buttons != null)
         {
             VCBotScript.image = Screenshot.ImageCapture();
             if (BotCore.FindImage(VCBotScript.image, Img.NoEnergy, true, 0.8) != null)
             {
                 //Means we should kill it as no energy left
                 Variables.ScriptLog("Archwitch Event have no energy. Exiting now! ", Color.Yellow);
                 return;
             }
             BotCore.SendTap(buttons.Value);
             BotCore.Delay(1000, 1500);
             VCBotScript.image = Screenshot.ImageCapture();
         }
         crop    = Screenshot.CropImage(VCBotScript.image, new Point(665, 565), new Point(970, 640));
         buttons = BotCore.FindImage(crop, Img.Red_Button, false, 0.9);
         if (buttons != null)
         {
             BotCore.SendTap(buttons.Value.X + rnd.Next(675, 960), buttons.Value.Y + rnd.Next(575, 630));
             BotCore.Delay(5000);
             do
             {
                 BotCore.Delay(1500);
             }while (BotCore.RGBComparer(new Point(400, 400), Color.Black, 0));
             buttons = null;
             do
             {
                 VCBotScript.image = Screenshot.ImageCapture();
                 crop    = Screenshot.CropImage(VCBotScript.image, new Point(665, 565), new Point(970, 640));
                 buttons = BotCore.FindImage(crop, Img.Red_Button, false, 0.9);
                 if (buttons != null)
                 {
                     BotCore.SendTap(buttons.Value.X + rnd.Next(675, 960), buttons.Value.Y + rnd.Next(575, 630));
                 }
                 crop    = Screenshot.CropImage(VCBotScript.image, new Point(420, 360), new Point(855, 430));
                 buttons = BotCore.FindImage(crop, Img.Red_Button, false, 0.9);
                 if (buttons != null)
                 {
                     CheckBossEnergy();
                     if (error > 10)
                     {
                         Variables.ScriptLog("Unable to OCR energy! Exiting Event now!", Color.Red);
                         CurrentBossEnergy = 0;
                         return;
                     }
                     CurrentBossEnergy--;
                     BotCore.SendTap(buttons.Value.X + rnd.Next(430, 845), buttons.Value.Y + rnd.Next(370, 420));
                     BotCore.Delay(300, 500);
                     BotCore.SendTap(buttons.Value.X + rnd.Next(430, 845), buttons.Value.Y + rnd.Next(370, 420));
                     BotCore.Delay(300, 500);
                     BotCore.SendTap(buttons.Value.X + rnd.Next(430, 845), buttons.Value.Y + rnd.Next(370, 420));
                     BotCore.Delay(2000, 3000);
                     break;
                 }
                 else
                 {
                     BotCore.Delay(1000, 1200);
                 }
             }while (buttons == null);
             PrivateVariable.Instance.Battling = true;
             VCBotScript.Battle();
             if (CurrentBossEnergy == 0)
             {
                 Variables.ScriptLog("Archwitch Event have no energy. Exiting now! ", Color.Yellow);
                 return;
             }
         }
         crop    = Screenshot.CropImage(VCBotScript.image, new Point(420, 360), new Point(855, 430));
         buttons = BotCore.FindImage(crop, Img.Red_Button, false, 0.88);
         if (buttons != null)
         {
             BotCore.SendTap(buttons.Value.X + rnd.Next(410, 880), buttons.Value.Y + rnd.Next(330, 450));
             BotCore.SendTap(buttons.Value.X + rnd.Next(410, 880), buttons.Value.Y + rnd.Next(330, 450));
             BotCore.SendTap(buttons.Value.X + rnd.Next(410, 880), buttons.Value.Y + rnd.Next(330, 450));
             BotCore.Delay(2000, 3000);
             PrivateVariable.Instance.Battling = true;
             VCBotScript.Battle();
             //End Event
             return;
         }
         BotCore.Delay(1000, 2000);
         BotCore.SendTap(635, 390);
     }while (true);
 }