private static void Attack() { do { BotCore.Delay(1500); VCBotScript.image = BotCore.ImageCapture(); }while (BotCore.RGBComparer(VCBotScript.image, new Point(400, 400), Color.Black, 10)); Variables.ScriptLog("Running stage!", Color.Lime); int error = 0; do { Random rnd = new Random(); VCBotScript.image = BotCore.ImageCapture(); var crop = BotCore.CropImage(VCBotScript.image, new Point(420, 360), new Point(855, 430)); Point?buttons = BotCore.FindImage(crop, Img.GreenButton, false); if (buttons != null) { ArchwitchEvent.CheckWalkEnergy(); if (ArchwitchEvent.CurrentWalkEnergy < 15) { //No energy Variables.ScriptLog("SoulWeapon 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; } buttons = BotCore.FindImage(VCBotScript.image, Img.Return, true); if (buttons != null) { BotCore.SendTap(buttons.Value); BotCore.Delay(1000, 1500); continue; } buttons = BotCore.FindImage(VCBotScript.image, Img.Close2, true); if (buttons != null) { BotCore.SendTap(buttons.Value); BotCore.Delay(1000, 1500); continue; } buttons = BotCore.FindImage(crop, Img.Red_Button, false); if (buttons != null) { ArchwitchEvent.CheckBossEnergy(); if (ArchwitchEvent.CurrentBossEnergy == 0) { Variables.ScriptLog("SoulWeapon 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); PrivateVariable.Battling = true; VCBotScript.Battle(); continue; } buttons = BotCore.FindImage(VCBotScript.image, Img.ShopKeeper, true); if (buttons != null) { BotCore.SendTap(530, 660); BotCore.Delay(1500); continue; } if (BotCore.FindImage(VCBotScript.image, Img.SoulWeapon, true) != null) { //Stage completed return; } error++; if (error > 30) { BotCore.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); }
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); }