public static void SoulWeaponEnter()
 {
     if (UnhandledException)
     {
         Variables.ScriptLog("Unhandled exception had found in SoulWeapon event UI. Skip it! ", Color.Red);
         return;
     }
     do
     {
         VCBotScript.LocateMainScreen();
     }while (!PrivateVariable.InMainScreen);
     BotCore.SendTap(170, 630);
     BotCore.Delay(5000, false);
     for (int x = 0; x < 5; x++)
     {
         VCBotScript.image = BotCore.ImageCapture();
         Point?located = BotCore.FindImage(VCBotScript.image, Environment.CurrentDirectory + "\\Img\\LocateEventSwitch.png", true);
         if (located == null)
         {
             x -= 1;
             BotCore.Delay(1000, false);
             if (error > 10)
             {
                 ScriptErrorHandler.Reset("Unable to locate Event Switch screen! Returning main screen!");
                 error = 0;
                 return;
             }
             error++;
             ScriptErrorHandler.ErrorHandle();
             continue;
         }
         else
         {
             break;
         }
     }
     if (File.Exists("Img\\WeaponEvent.png"))
     {
         var point = BotCore.FindImage(VCBotScript.image, "Img\\WeaponEvent.png", false);
         if (point != null)
         {
             BotCore.SendTap(point.Value);
             //Enter event
             SwitchStage();
         }
         else
         {
             Variables.ScriptLog("Unable to find WeaponEvent.png at event page. Exiting function! ", Color.Red);
         }
     }
     else
     {
         Variables.ScriptLog("WeaponEvent.png not found! Exiting function! ", Color.Red);
     }
 }
 public static void ArchwitchEnter()
 {
     do
     {
         VCBotScript.LocateMainScreen();
     }while (!PrivateVariable.InMainScreen);
     //Enter battle screen
     BotCore.SendTap(170, 630);
     BotCore.Delay(5000, false);
     for (int x = 0; x < 5; x++)
     {
         VCBotScript.image = BotCore.ImageCapture();
         Point?located = BotCore.FindImage(VCBotScript.image, Environment.CurrentDirectory + "\\Img\\LocateEventSwitch.png", true);
         if (located == null)
         {
             x -= 1;
             BotCore.Delay(1000, false);
             if (error > 10)
             {
                 ScriptErrorHandler.Reset("Unable to locate Event Switch screen! Returning main screen!");
                 error = 0;
                 return;
             }
             error++;
             ScriptErrorHandler.ErrorHandle();
             continue;
         }
         else
         {
             break;
         }
     }
     //ArchwitchHunt capture detected, try to get into event
     if (File.Exists("Img\\ArchEvent.png"))
     {
         var point = BotCore.FindImage(VCBotScript.image, "Img\\ArchEvent.png", false);
         if (point != null)
         {
             BotCore.SendTap(point.Value);
             //Enter event
             SwitchStage();
         }
         else
         {
             Variables.ScriptLog("Unable to find ArchEvent.png at event page. Exiting function! ", Color.Red);
         }
     }
     else
     {
         Variables.ScriptLog("ArchEvent.png not found! Exiting function! ", Color.Red);
     }
     //not found, we have to exit now!
     //Our next online time had passed. Online it NOWWWWWW!!!!!
     if (VCBotScript.nextOnline < DateTime.Now)
     {
         do
         {
             VCBotScript.LocateMainScreen();
         }while (!PrivateVariable.InMainScreen);
         VCBotScript.Stuck = false;
     }
     else
     {
         BotCore.KillGame("com.nubee.valkyriecrusade");
     }
     return;
 }
Пример #3
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;
        }