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); }
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; }