public static void BattleLogic(Action action) { ReloadEliksiry(); combination = ""; alludars = 1; while (true) { OkBtnsOnFight(); if (BotBase.DefaultSettings.Bool("posledUdarov2")) { BotFunc.AddLog("Удары свои"); foreach (int udar_nominal in ParcePosledUdarov()) { Udars(action, udar_nominal); } } if (BotBase.DefaultSettings.Bool("posledUdarov1")) { BotFunc.AddLog("Удары случай"); int random = BotFunc.GetRandomInt(1, 4); while (true) { random = BotFunc.GetRandomInt(1, 4); if (BotBase.DefaultSettings.Bool("udar" + random)) { break; } } Udars(action, random); } } }
public static List <Abdiv> DispatcherAbdiv(string id) { List <Abdiv> newAbdivsList = new List <Abdiv>(); foreach (Abdiv abdiv in SearchAbdiv(id)) { Abdiv newAbdiv = new Abdiv(); newAbdiv.Image = abdiv.Image; newAbdiv.Id = abdiv.Id; newAbdiv.Explore = true; Rectangle rect = Template.Image(new ImageData(abdiv.Image), new ImageData("Images/minus.bmp")); if (rect.Location.X > 0) { BotFunc.AddLog("Сканирование:" + abdiv.Id + " плохой сундук #1"); newAbdiv.Explore = false; } rect = Template.Image(new ImageData(abdiv.Image), new ImageData("Images/nol.bmp")); if (rect.Location.X > 0) { BotFunc.AddLog("Сканирование:" + abdiv.Id + " плохой сундук #2"); newAbdiv.Explore = false; } newAbdivsList.Add(newAbdiv); } return(newAbdivsList); }
public static void SetRupor() { if (!BotBase.DefaultSettings.Bool("RuporSettings")) { BotFunc.JsEx("sendspecial('skill" + BotBase.DefaultSettings.Int("Rupor") + "');"); } }
public static List <Food> GetFood(string[] foods) { List <Inventory> tempListInventories = new List <Inventory>(); List <Food> tempListFoods = new List <Food>(); string getInventory = Requests.GetResponseHtml("http://atlantida-o.ru/inventory.php?section=1&0." + BotFunc.GetRandomNumbers(16)); string toolPattern = @"settooltip\('invitem(.*?)_.*?',.*?'(.*?)'"; // 1 - id, 2 - имя Regex toolRegex = new Regex(toolPattern); foreach (Match match in toolRegex.Matches(getInventory)) { Inventory inventory = new Inventory(); inventory.Id = match.Groups[1].Value; inventory.Name = match.Groups[2].Value; tempListInventories.Add(inventory); } foreach (Inventory tempListInventory in tempListInventories) { for (int i = 0; i < foods.Length; i++) { if (tempListInventory.Name.Contains(foods[i])) { Food food = new Food(); food.Id = tempListInventory.Id; tempListFoods.Add(food); } } } return(tempListFoods); }
private void тестToolStripMenuItem_Click(object sender, EventArgs e) { Auto.GetLocation(); return; List <Auto.Food> food = Auto.GetFood(new string[] { "Пирожок" }); foreach (Auto.Food foodx in food) { BotFunc.AddLog(foodx.Id); } return; BotFunc.Find find = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/eleksiry.bmp")); if (find.Found) { BotSuite.Mouse.MoveRelativeToWindow(BotBase.WebControlHandle, find.Coordinates, false); } //Forms.Debug.ShowHtml showHtml = new Forms.Debug.ShowHtml("http://atlantida-o.ru/locclick.php?&" + BotFunc.GetRandomNumbers(13)); //showHtml.Show(); //BotFunc.JsEx("sendpost2('fields.php', {bid: 1, tab: 1});"); //if (respp.Contains("Отказаться")) //{ // BotFunc.AddLog("Ждем начала"); //} //MessageBox.Show(respp); }
public static void Sposobnosti() { if (!InFight) { return; } int user_mana = 0; try { user_mana = Convert.ToInt32(BotFunc.JsEx("document.getElementById('mana').innerHTML")); } catch { try { string mana = BotFunc.JsEx("document.getElementById('mana').innerHTML"); Regex r = new Regex("(.*?) / (.*?)"); Match match = r.Match(mana); user_mana = Convert.ToInt32(match.Groups[1].Value); } catch { } } //int user_mana_max = Convert.ToInt32(BotFunc.JsEx("usermaxmana")); BotFunc.AddLog(user_mana); bool sp_1 = BotBase.DefaultSettings.Bool("sp_1"); bool sp_2 = BotBase.DefaultSettings.Bool("sp_2"); bool sp_3 = BotBase.DefaultSettings.Bool("sp_3"); bool sp_4 = BotBase.DefaultSettings.Bool("sp_4"); bool sp_5 = BotBase.DefaultSettings.Bool("sp_5"); bool sp_6 = BotBase.DefaultSettings.Bool("sp_6"); bool sp_7 = BotBase.DefaultSettings.Bool("sp_7"); var find3 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/sposobnost_check.bmp")); List <Point> actives = new List <Point>(); if (find3.Found) { find3.Coordinates.X += 7 + 26; find3.Coordinates.Y += 8 + 26; for (int i = 0; i < 7; i++) { int sp_index = i + 1; int add = (i * 55); if (BotBase.DefaultSettings.Bool("sp_" + sp_index) && BotBase.DefaultSettings.Int("sp_" + sp_index + "_man") < user_mana) { actives.Add(new Point(find3.Coordinates.X, find3.Coordinates.Y + add)); } } } if (actives.Count > 1) { int rand = BotFunc.GetRandomInt(0, actives.Count); BotFunc.LeftClick(actives[rand]); } else if (actives.Count == 1) { BotFunc.LeftClick(actives[0]); } }
/// <summary> /// Реализовано в самой игре /// </summary> public static void EatFood() { foreach (Food food in GetFood(new string[] { "Пирожок" })) { BotFunc.JsEx("useitem(" + food.Id + ");"); break; } }
public static void Udars(Action action, int action_udar) { PitEliksiry(alludars); while (true) { if (BattleEnd(action)) { BotFunc.AddLog("Комбо: " + combination); WaitFullHP(BotBase.DefaultSettings.Bool("wait_full_hp")); if (action == Action.Mobs) { AttackMob(action); } if (action == Action.Arena) { Arena(action); } } OkBtnsOnFight(); Sposobnosti(); Point coordPoint = new Point(); var find = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar" + action_udar + ".bmp")); var find2 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar" + action_udar + action_udar + ".bmp")); if (find.Found) { coordPoint = find.Coordinates; } if (find2.Found) { coordPoint = find2.Coordinates; } if (coordPoint.X > 0) { combination += action_udar + "-"; int clicks = BotFunc.GetRandomInt(1, 3); //BotFunc.AddLog("Clicks " + clicks); for (int i = 1; i <= clicks; i++) { BotFunc.LeftClick(find.Coordinates); } alludars++; if (UdarovAfterEleksir != 0) { UdarovAfterEleksir--; } if (UdarovAfterEleksirMochi != 0) { UdarovAfterEleksirMochi--; } Thread.Sleep(2000); break; } Thread.Sleep(2000); } }
public static void ClickEleksir(int element) { int[] x = { 0, +30, +17, +22, +33, +64, +34, -13, -29, -26 }; int[] y = { 0, -170, -122, -73, -26, +17, -235, -209, -155, -96 }; BotFunc.Find find = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/eleksiry.bmp")); if (find.Found) { Point p = new Point(find.Coordinates.X + x[element], find.Coordinates.Y + y[element]); BotFunc.LeftClick(p); } }
public static void Sbor() { int errors = 0; while (true) { while (true) { if (!InFight) { break; } Thread.Sleep(1000); } int wait_seconds = BotBase.DefaultSettings.Int("sbor_wait_seconds"); Location LoctationX = GetLocation(); int need_res = BotBase.DefaultSettings.Int("sbor"); if (need_res > LoctationX.Resourses.Count + 1) { BotFunc.AddLog("Нет доступных ресурсов на локации, жду " + wait_seconds + " секунд."); Thread.Sleep(wait_seconds * 1000); } int i = 0; need_res--; foreach (Resource res in LoctationX.Resourses) { if (i == need_res) { if (res.Count == 0) { BotFunc.AddLog("Ресурсы закончились, ждем завоза " + wait_seconds + " секунд."); Thread.Sleep(wait_seconds * 1000); } //Необходимый ресурс string getRes = Requests.GetResponseHtml("http://atlantida-o.ru/locclick.php?harvest=" + i + "&" + Time()); Regex r = new Regex("val=\"(.*?)\".*?msg>(.*?)<"); Match match = r.Match(getRes); int seconds_wait = Convert.ToInt32(match.Groups[1].Value); string message = match.Groups[2].Value; BotFunc.AddLog(message + " : " + seconds_wait + " секунд ждать"); Thread.Sleep(seconds_wait * 1000); break; } i++; } BotFunc.AddLog("Ожидаем возможность фарма 1 минуту."); Thread.Sleep(60000); if (errors > 0) { BotFunc.AddLog("Сбор ресурсов завершен досрочно. Причина: Не палимся."); break; } } }
public static void AbdivDispose(string id) { foreach (Abdiv abdiv in DispatcherAbdiv(id)) { if (abdiv.Explore) { BotFunc.AddLog("Сканирование: " + abdiv.Id + " нормальный сундук"); BotFunc.JsEx("sendspecial('chest" + abdiv.Id + "');"); } } }
private void Awesomium_Windows_Forms_WebControl_LoadingFrameComplete(object sender, FrameEventArgs e) { if (e.Url == new Uri(BotBase.GameUrl)) { if (Game) { string login = BotBase.DefaultSettings.String("login"); string password = BotBase.DefaultSettings.String("password"); BotFunc.JsEx("document.getElementsByName('login')[0].value = '" + login + "';"); BotFunc.JsEx("document.getElementsByName('pass')[0].value = '" + password + "';"); } } }
private void тест2ToolStripMenuItem_Click(object sender, EventArgs e) { Auto.Sposobnosti(); return; Auto.InFight = true; Auto.OkBtnsOnFight(); Auto.InFight = false; return; Auto.Raschet(); return; Auto.Location LoctationX = Auto.GetLocation(); int need_res = BotBase.DefaultSettings.Int("sbor"); if (need_res > LoctationX.Resourses.Count) { BotFunc.AddLog("Нет доступных ресурсов на локации"); } int i = 0; need_res--; foreach (Auto.Resource res in LoctationX.Resourses) { if (i == need_res) { //Необходимый ресурс string getRes = Requests.GetResponseHtml("http://atlantida-o.ru/locclick.php?harvest=" + i + "&" + Auto.Time()); Regex r = new Regex("val=\"(.*?)\".*?msg>(.*?)<"); Match match = r.Match(getRes); int seconds_wait = Convert.ToInt32(match.Groups[1].Value); string message = match.Groups[2].Value; BotFunc.AddLog(message + " : " + seconds_wait + " секунд ждать"); break; } i++; } return; string mobPattern = "<dirx>.*?<name>(.*?)<.*?<level>(.*?)<.*?id>(.*?)<"; // 1 - имя, 2 - уровень, 3 - Id Regex MobSearchRegex = new Regex(mobPattern); string GetMobsResponse = Requests.GetResponseHtml("http://atlantida-o.ru/locclick.php?&" + BotFunc.GetRandomNumbers(13)); foreach (Match match in MobSearchRegex.Matches(GetMobsResponse)) { BotFunc.AddLog(match.Groups[1].Value + "[" + match.Groups[2].Value + "]" + " " + match.Groups[3].Value); } }
public static int GetMinutes() { string resp = Requests.PostResponseHtml("http://atlantida-o.ru/fields.php"); string respp = System.Text.RegularExpressions.Regex.Unescape(resp); string resppp = BotFunc.RemoveAllNewLines(respp); Regex r = new Regex(@"Арена.*?timeleft.*?>(.*?)мин\."); if (r.IsMatch(resppp)) { return(Convert.ToInt32(r.Match(resppp).Groups[1].Value)); } else { return(0); } }
public static int GetHp() { try { string getHp = BotFunc.JsEx("document.getElementById('hp').innerHTML"); // 161 / 161 //BotBase.DefaultSettings.SaveSetting("usloviePitya1", usloviePitya1.Checked); //BotBase.DefaultSettings.SaveSetting("usloviePitya1_1", (int)usloviePitya1_1.Value); //BotBase.DefaultSettings.SaveSetting("usloviePitya2", usloviePitya2.Checked); string[] splitted = Regex.Split(getHp, " / "); return(GetPercent(Convert.ToInt32(splitted[0]), Convert.ToInt32(splitted[1]))); } catch { return(50); } }
public static bool BattleEnd(Action action) { var find = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/exit.bmp")); var find2 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/exit2.bmp")); if (find.Found || find2.Found) { if (action == Action.Arena) { BotFunc.LeftClick(find.Coordinates); } InFight = false; return(true); } else { return(false); } }
public static void OkBtnsOnFight() { if (InFight) { var find3 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/ok_btn1.bmp")); var find2 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/ok_btn2.bmp")); if (find3.Found || find2.Found) { BotFunc.AddLog("Убираем неприятности"); if (find2.Found) { BotFunc.LeftClick(find2.Coordinates); } if (find3.Found) { BotFunc.LeftClick(find3.Coordinates); } } } }
public static void StartSession() { InFight = false; InArena = false; if (!BotBase.Started) { if (BotBase.DefaultSettings.Bool("action3")) { //Если собираем ресурсы ставим в отдельном потоке =) BotFunc.AddLog("Сессяи Сбор: Старт."); BotBase.SessionResourcer = new Thread(Sbor) { IsBackground = true }; BotBase.SessionResourcer.Start(); } BotBase.MainForm.StartButton.Text = "Стоп сессия"; BotBase.Started = true; BotBase.SessionThread = new Thread(Auto.Session) { IsBackground = true }; BotBase.SessionThread.Start(); BotBase.SessionTimer = new Stopwatch(); BotBase.SessionTimer.Start(); } else { if (BotBase.SessionResourcer != null) { BotFunc.AddLog("Сессяи Сбор: Стоп."); BotBase.SessionResourcer.Abort(); BotBase.SessionResourcer = null; } BotBase.MainForm.StartButton.Text = "Старт сессия"; BotBase.Started = false; BotBase.SessionThread.Abort(); BotBase.SessionTimer.Stop(); BotFunc.AddLog("Сессия : " + Convert.ToInt32(BotBase.SessionTimer.Elapsed.TotalMinutes) + " минут " + BotBase.SessionTimer.Elapsed.Seconds + " секунд."); } }
public static ArenaInfo GetArenaInfo() { arenaInfo = new ArenaInfo(); string resp = Requests.PostResponseHtml("http://atlantida-o.ru/fields.php"); string respp = Regex.Unescape(resp); string resppp = BotFunc.RemoveAllNewLines(respp); Regex r = new Regex(@"Арена.*?timeleft.*?>(.*?)мин\..*?bid:1,tab:1"); if (r.IsMatch(resppp)) { arenaInfo.Minutes = Convert.ToInt32(r.Match(resppp).Groups[1].Value); arenaInfo.Enter = resppp.Contains("Отказаться"); return(arenaInfo); } else { arenaInfo.Enter = false; arenaInfo.Minutes = 0; return(arenaInfo); } }
private void парсингБотовToolStripMenuItem_Click(object sender, EventArgs e) { IniFile file = new IniFile("Mobs.ini"); List <Auto.Bot> mobsList = Auto.GetMobs(); foreach (Auto.Bot mob in mobsList) { bool found = false; foreach (string name in file.GetKeyNames("Мобы")) { if (name == mob.Name) { found = true; } } if (!found) { BotFunc.AddLog("Добавили " + mob.Name + "[" + mob.Level + "]"); file.WriteValue("Мобы", mob.Name, mob.Level); } } }
private void Awesomium_Windows_Forms_WebControl_DocumentReady(object sender, Awesomium.Core.UrlEventArgs urlEventArgs) { if (urlEventArgs.Url == new Uri(BotBase.GameUrl + "game.php")) { BotBase.InGame = true; BotBase.CcDictionary.Clear(); string cookies = BotFunc.JsEx("document.cookie"); string[] cooks = cookies.Split(";".ToCharArray()); Regex r = new Regex("(.*?)=(.*)"); foreach (string ms in cooks) { Match n = r.Match(ms); try { BotBase.CcDictonaryNet.Add(new Cookie(n.Groups[1].Value, n.Groups[2].Value, "/", BotBase.GameDomain)); BotBase.CcDictonaryCollection.Add(new Cookie(n.Groups[1].Value, n.Groups[2].Value)); } catch {} BotBase.CcDictionary.Add(n.Groups[1].Value, n.Groups[2].Value); } } }
public static void Arena(Action action) { arenaInfo = GetArenaInfo(); //Поставим ждать на арену if (!arenaInfo.Enter) { string jsresp = BotFunc.JsEx("sendpost2('fields.php', {bid: 1, tab: 1});"); Thread.Sleep(1000); arenaInfo = GetArenaInfo(); if (arenaInfo.Enter) { Stavka = 0; BotFunc.AddLog("Ждем начала"); WaitBattleStart(action); BattleLogic(action); } else { if (Stavka == 0) { Stavka++; BotFunc.AddLog("Пробуем поставить еще раз"); Arena(action); } else { StartSession(); } } } else { Stavka = 0; BotFunc.AddLog("Ждем начала"); WaitBattleStart(action); BattleLogic(action); } }
private void тест34ToolStripMenuItem_Click(object sender, EventArgs e) { string mobPattern = "<dirx>.*?<name>(.*?)<.*?<level>(.*?)<.*?id>(.*?)<"; // 1 - имя, 2 - уровень, 3 - Id Regex MobSearchRegex = new Regex(mobPattern); string GetMobsResponse = Requests.GetResponseHtml("http://atlantida-o.ru/locclick.php?&" + BotFunc.GetRandomNumbers(13)); foreach (Match match in MobSearchRegex.Matches(GetMobsResponse)) { BotFunc.AddLog(match.Groups[1].Value + "[" + match.Groups[2].Value + "]" + " " + match.Groups[3].Value); if (match.Groups[2].Value == "3" || match.Groups[2].Value == "2") { BotFunc.AddLog("Нападаю"); string AttackMobResponse = Requests.GetResponseHtml("http://atlantida-o.ru/attack.php?bot=" + match.Groups[3].Value + "&0." + BotFunc.GetRandomNumbers(17)); if (AttackMobResponse.Contains("Ok")) { BotFunc.AddLog("Успешно напали"); } return; } } }
public static void WaitFullHP(bool wait = false) { if (wait) { BotFunc.AddLog("Жду восстановления жизней"); while (true) { if (BotBase.DefaultSettings.Bool("action2_D_1")) { } if (GetHp() == 100) { return; } Thread.Sleep(2000); } } else { //Реализовано в самой игре :(( //EatFood(); } }
public static List <Abdiv> SearchAbdiv(string id) { List <Abdiv> tempAbdivsList = new List <Abdiv>(); string AttackMobResponse = Requests.GetResponseHtml("http://atlantida-o.ru/attack.php?bot=" + id + "&0." + BotFunc.GetRandomNumbers(16)); string PatternAbdiv = @"url\((.*?)\)"; Regex SearchAbdiv = new Regex(PatternAbdiv); foreach (Match match in SearchAbdiv.Matches(AttackMobResponse)) { Abdiv abdiv = new Abdiv(); string url = match.Groups[1].Value; Bitmap abdivBitmap = BotFunc.LoadPicture(BotBase.GameUrl + url); Regex NumAbdiv = new Regex(@"n=(\d)"); int num = Convert.ToInt32(NumAbdiv.Match(url).Groups[1].Value); abdiv.Id = num; abdiv.Image = abdivBitmap; abdiv.Explore = true; tempAbdivsList.Add(abdiv); } return(tempAbdivsList); }
public static void WaitBattleStart(Action action) { if (action == Action.Mobs) { InArena = false; while (true) { var find = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar1.bmp")); var find2 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar11.bmp")); if (find.Found || find2.Found) { return; } Thread.Sleep(1000); } } if (action == Action.Arena) { while (true) { if (BotBase.DefaultSettings.Bool("action2_D_1")) { //Еще и бои проводить... ArenaInfo info = GetArenaInfo(); BotFunc.AddLog(info.Minutes + " минут до начала."); if (info.Minutes > 2 && info.Enter) { InArena = false; BotFunc.JsEx("closemain2();"); BotFunc.AddLog("Закрыть окно арены."); WaitFullHP(BotBase.DefaultSettings.Bool("wait_full_hp")); //Если минут больше 2 и вошли в арену, то бьемся с монстрами AttackMob(action); BattleLogic(action); } else { while (true) { InArena = true; var find3 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar1.bmp")); var find2 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar11.bmp")); if (find3.Found || find2.Found) { InFight = false; return; } Thread.Sleep(2000); } } } var find = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar1.bmp")); var find23 = BotFunc.ImageSearchInGameWindow(new Bitmap("Images/udar11.bmp")); if (find.Found || find23.Found) { BotFunc.AddLog("Дождались битвы на арене."); return; } Thread.Sleep(1000); } } }
public static void SearchLocation() { List <string> awail_locations = new List <string>(); // Локации уже в которых были List <string> locations = new List <string>(); // Локации foreach (string keyName in BotBase.FileSettings.GetKeyNames("ЛокацииБег")) { string location = BotBase.FileSettings.GetString("ЛокацииБег", keyName, ""); locations.Add(location); BotFunc.AddLog("Локация адд " + location); } while (true) { //поиск монстра Location loc = GetLocation(); bool finded_svyaz = false; Link finded_loc = new Link(); foreach (string location in locations) { foreach (Link link in loc.Links) { //BotFunc.AddLog(location + " : " + link.Name); if (location == link.Name && location != loc.Name) { bool find = false; foreach (string l in awail_locations) { if (l == link.Name) { find = true; } } if (!find) { finded_loc = link; finded_svyaz = true; } } if (finded_svyaz) { break; } } if (finded_svyaz) { break; } } BotFunc.AddLog("Буду следовать " + finded_loc.Name); if (!finded_svyaz) { break; } if (loc.MoveTime > 0) { BotFunc.AddLog("Ждем " + loc.MoveTime + " прежде чем перейдем в " + finded_loc.Name); Thread.Sleep(loc.MoveTime * 1000); loc = GetLocation(); } if (loc.MoveTime == 0) { string construct_time = Time().ToString(); int id = finded_loc.Id; Requests.GetResponseHtml("http://atlantida-o.ru/locclick.php?goto=" + id + "&" + construct_time); Thread.Sleep(500); loc = GetLocation(); if (loc.Id == finded_loc.Id) { BotFunc.AddLog("Успешный переход по локации"); //Не нашли записываем что уже тут были bool find = false; foreach (string l in awail_locations) { BotFunc.AddLog("Были на локациях " + l); if (l == loc.Name) { find = true; break; } } if (!find) { awail_locations.Add(loc.Name); } } else { BotFunc.AddLog("Не перешли по локации. Остановка!"); StartSession(); } } //Переходим и короче ищем мобов List <Bot> Mobs = GetMobs(); if (Mobs.Count == 0) { //Не нашли записываем что уже тут были bool find = false; foreach (string l in awail_locations) { if (l == finded_loc.Name) { find = true; break; } } if (!find) { awail_locations.Add(finded_loc.Name); } } else { BotFunc.AddLog("Нашли монстров, останавливаем поиск."); return; } if (awail_locations.Count == locations.Count) { BotFunc.AddLog("Не нашли монстров вообще ни на одной локации. Останавливаем."); StartSession(); } Thread.Sleep(5); // Ждем 5 секунд прежде чем что-то делать } }
public static void AttackMob(Action action) { List <Bot> mobs_all = GetMobs(); WaitFullHP(BotBase.DefaultSettings.Bool("wait_full_hp")); bool attacked = false; if (mobs_all.Count == 0) { BotFunc.AddLog("Не найдены монстры на этой локации"); if (BotBase.DefaultSettings.Bool("БегАктивен")) { BotFunc.AddLog("Но у нас активен бег по локациям. Жду разрешения перехода."); SearchLocation(); mobs_all = GetMobs(); } else { BotFunc.AddLog("Не знаю что делать закрываюсь."); StartSession(); } } foreach (Bot mob in mobs_all) { if (mob.Name == SettingsBot.NameBots[BotFunc.GetRandomInt(SettingsBot.NameBots.Count)]) { BotFunc.AddLog("Нападаю на " + mob.Name + "[" + mob.Level + "]"); string AttackMobResponse = Requests.GetResponseHtml("http://atlantida-o.ru/attack.php?bot=" + mob.Id + "&0." + BotFunc.GetRandomNumbers(17)); if (AttackMobResponse.Contains("ok")) { InFight = true; SettingsBot.FalseAttackCount = 0; BotFunc.AddLog("Напали"); attacked = true; Thread.Sleep(500); ShowBattle(); } else if (AttackMobResponse.Contains("abdiv")) { BotFunc.AddLog("Нашли сундук"); AbdivDispose(mob.Id); Thread.Sleep(1000); AttackMob(action); } break; } } if (attacked) { BotFunc.AddLog("Начинаем ждать мобов"); WaitBattleStart(Action.Mobs); BattleLogic(action); } else { SettingsBot.FalseAttackCount++; BotFunc.AddLog("Не напали, ждем"); if (BotBase.DefaultSettings.Bool("БегАктивен")) { BotFunc.AddLog("Но у нас активен бег по локациям. Жду разрешения перехода."); SearchLocation(); mobs_all = GetMobs(); } else { if (SettingsBot.FalseAttackCount == 5) { MessageBox.Show(CheckErrorList, "Не напали на моба 5 раз подряд, что-то не так.", MessageBoxButtons.OK, MessageBoxIcon.Error); StartSession(); } } Thread.Sleep(5000); AttackMob(action); } }
public static void ShowBattle() { BotFunc.JsEx("showbattle();"); }
public static List <Bot> GetMobs() { List <Bot> tempBotList = new List <Bot>(); string mobPattern = "<bot.*?id>(.*?)<.*?name>(.*?)<.*?level>(.*?)<"; // 2 - имя, 3 - уровень, 1 - Id Regex MobSearchRegex = new Regex(mobPattern); string GetMobsResponse = Requests.GetResponseHtml("http://atlantida-o.ru/locclick.php?&" + BotFunc.GetRandomNumbers(13), true); foreach (Match match in MobSearchRegex.Matches(GetMobsResponse)) { //BotFunc.AddLog(match.Groups[1].Value + "[" + match.Groups[2].Value + "]" + " " + match.Groups[3].Value); Bot bot = new Bot(); bot.Id = match.Groups[1].Value; bot.Name = match.Groups[2].Value; bot.Level = match.Groups[3].Value; tempBotList.Add(bot); } return(tempBotList); }