public bool HandCarFixed() { string path = "Check//"; bool x = true; Rectangle[] bounds = new Rectangle[] { PointsAndRectangles.HandSlot1, PointsAndRectangles.HandSlot2, PointsAndRectangles.HandSlot3, PointsAndRectangles.HandSlot4, PointsAndRectangles.HandSlot5 }; string[] n = new string[] { "finger1", "finger2", "finger3", "finger4", "finger5" }; for (int i = 0; i < 5; i++) { MasterOfPictures.MakePicture(bounds[i], path + n[i] + "0"); } Thread.Sleep(2000); for (int j = 0; j < 5; j++) { MasterOfPictures.MakePicture(bounds[j], path + n[j] + "1"); } for (int k = 0; k < 5; k++) { if (!MasterOfPictures.Verify(path + n[k] + "0", path + n[k] + "1")) { NotePad.DoLog("Тачка на " + (k + 1) + " месте неисправна"); x = false; break; } } return(x); }
public static void DragnDropFast(Point xy1, Point xy2) { SpecialEvents se = new SpecialEvents(); int error = 0; string x1; string x2; do { if (error == 3) { se.RestartBot(); } x1 = MasterOfPictures.PixelIndicator(xy1);//контрольный пиксель MoveMouse(xy1); Thread.Sleep(100); LMBdown(xy1); Thread.Sleep(1000); MoveMouse(xy2); Thread.Sleep(2500); LMBup(xy2); Thread.Sleep(500); x2 = MasterOfPictures.PixelIndicator(xy1); //контрольный пиксель фото 2 error++; } while (x1 == x2); //переместил ли машину }
public bool CarFixed(int slot) { string path = "Check//"; Rectangle[] bounds = new Rectangle[] { PointsAndRectangles.Car1Bounds, PointsAndRectangles.Car2Bounds, PointsAndRectangles.Car3Bounds, PointsAndRectangles.Car4Bounds, PointsAndRectangles.Car5Bounds, PointsAndRectangles.Car6Bounds, PointsAndRectangles.Car7Bounds, PointsAndRectangles.Car8Bounds }; string[] n = new string[] { "1car", "2car", "3car", "4car", "5car", "6car", "7car", "8car" }; MasterOfPictures.MakePicture(bounds[slot], path + n[slot] + "0"); Thread.Sleep(2000); MasterOfPictures.MakePicture(bounds[slot], path + n[slot] + "1"); return(MasterOfPictures.Verify(path + n[slot] + "0", path + n[slot] + "1")); }
public bool Selection(int eventN) { SpecialEvents se = new SpecialEvents(); Point[] events = { PointsAndRectangles.eventN1, PointsAndRectangles.eventN2, PointsAndRectangles.eventN3, PointsAndRectangles.eventN4 }; bool eventIsOK = false; bool flag; do { flag = true; NotePad.DoLog("Кликаю событие " + eventN); Rat.Clk(events[eventN - 1]); Thread.Sleep(4000); if (fc.EventPage()) { NotePad.DoLog("Вылетел из клубов"); Rat.Clk(PointsAndRectangles.clktoClubs);//Clubs flag = false; Thread.Sleep(15000); } se.UniversalErrorDefense(); Thread.Sleep(2000); } while (flag == false);//клик эвента и обработка ошибок MasterOfPictures.MakePicture(PointsAndRectangles.Condition1Bounds, @"Condition1\test"); MasterOfPictures.MakePicture(PointsAndRectangles.Condition2Bounds, @"Condition2\test"); string cond1 = ConvertPictureToCond(DefineFirstEvevntConditionByPicture(), 1); string cond2 = ConvertPictureToCond(DefineSecondEvevntConditionByPicture(), 2); if (cond1 != "unknown" && cond2 != "unknown")//Исключаю неизвестный { eventIsOK = true; Condition.MakeCondition(cond1, cond2); if (GotRQ() && Condition.minrq != 0) { NotePad.DoLog("Минимальное рк для события " + Condition.minrq); NotePad.DoLog("Требуемое рк для события " + Condition.eventrq); if (Condition.minrq > Condition.eventrq || Condition.minrq > accountLVL) { NotePad.DoLog("Минимальное рк для события больше требуемого"); eventIsOK = false; } } } if (!eventIsOK && eventN == 4) { Rat.Clk(PointsAndRectangles.clkoutofClubs); } return(eventIsOK); }
public bool ConditionActivated() { bool x = false; string active = "Color [A=255, R=56, G=56, B=56]"; Point p = new Point(415, 260); if (MasterOfPictures.PixelIndicator(p) == active) { x = true; } return(x); }
public int[] Weathers() { Rectangle[] c = { PointsAndRectangles.Weather1, PointsAndRectangles.Weather2, PointsAndRectangles.Weather3, PointsAndRectangles.Weather4, PointsAndRectangles.Weather5 }; int n; bool flag; int[] c1 = new int[5]; for (int i = 0; i < 5; i++) { flag = true; MasterOfPictures.BW2Capture(c[i], ("Weather" + (i + 1) + "\\test")); n = 0; for (int i1 = 1; i1 < 10; i1++) { if (File.Exists(weatherDirectory + (i + 1) + "\\" + i1 + ".jpg")) { n = i1; } else { break; } } for (int i2 = 1; i2 < (n + 1); i2++) { if (MasterOfPictures.VerifyBW(("Weather" + (i + 1) + "\\" + i2), ("Weather" + (i + 1) + "\\test"), 30)) { c1[i] = i2; File.Delete(weatherDirectory + (i + 1) + "\\test.jpg"); flag = false; break; } } if (flag == true) { c1[i] = 0; NotePad.DoLog("Добавляю новую погоду"); try { File.Move(weatherDirectory + (i + 1) + "\\test.jpg", weatherDirectory + (i + 1) + "\\" + (n + 1) + ".jpg"); } catch (Exception ex) { } } } return(c1); }
public bool EventPage() { bool x = false; string EventPath = "HeadPictures\\TestEvent"; string EventOriginal = "HeadPictures\\OriginalEvent"; MasterOfPictures.MakePicture(PointsAndRectangles.EventBounds, EventPath); if (MasterOfPictures.Verify(EventPath, EventOriginal)) { x = true; } return(x); }
public bool MainFrameBW(Rectangle bounds, string name, int errors) { bool x = false; string testPicture = "HeadPictures\\Test" + name; string originalPicture = "HeadPictures\\Original" + name; MasterOfPictures.BW2Capture(bounds, testPicture); if (MasterOfPictures.VerifyBW(testPicture, originalPicture, errors)) { x = true; } return(x); }
public bool MainFrame(Rectangle bounds, string name) { bool x = false; string testPicture = "HeadPictures\\Test" + name; string originalPicture = "HeadPictures\\Original" + name; MasterOfPictures.MakePicture(bounds, testPicture); if (MasterOfPictures.Verify(testPicture, originalPicture)) { x = true; } return(x); }
public int[] Tracks() { int n; bool flag; Rectangle[] a = { PointsAndRectangles.Track1, PointsAndRectangles.Track2, PointsAndRectangles.Track3, PointsAndRectangles.Track4, PointsAndRectangles.Track5 }; int[] a1 = new int[5]; for (int i = 0; i < 5; i++) { flag = true; MasterOfPictures.TrackCapture(a[i], ("Track" + (i + 1) + "\\test")); n = 0; for (int i1 = 1; i1 < 100; i1++) { if (File.Exists(trackDirectory + (i + 1) + "\\" + i1 + ".jpg")) { n = i1; } else { break; } } for (int i2 = 1; i2 < (n + 1); i2++) { if (MasterOfPictures.VerifyBW(("Track" + (i + 1) + "\\" + i2), ("Track" + (i + 1) + "\\test"), 120)) { a1[i] = i2; File.Delete(trackDirectory + (i + 1) + "\\test.jpg"); flag = false; break; } } if (flag == true) { a1[i] = 0; NotePad.DoLog("Добавляю новый трэк"); File.Move(trackDirectory + (i + 1) + "\\test.jpg", trackDirectory + (i + 1) + "\\" + (n + 1) + ".jpg"); } } return(a1); }
public int[] Grounds() { Rectangle[] b = { PointsAndRectangles.Ground1, PointsAndRectangles.Ground2, PointsAndRectangles.Ground3, PointsAndRectangles.Ground4, PointsAndRectangles.Ground5 }; int n; bool flag; int[] b1 = new int[5]; for (int i = 0; i < 5; i++) { flag = true; MasterOfPictures.BW2Capture(b[i], ("Ground" + (i + 1) + "\\test")); n = 0; for (int i1 = 1; i1 < 100; i1++) { if (File.Exists(groundDirectory + (i + 1) + "\\" + i1 + ".jpg")) { n = i1; } else { break; } } for (int i2 = 1; i2 < (n + 1); i2++) { if (MasterOfPictures.VerifyBW(("Ground" + (i + 1) + "\\" + i2), ("Ground" + (i + 1) + "\\test"), 150)) { b1[i] = i2; File.Delete(groundDirectory + (i + 1) + "\\test.jpg"); flag = false; break; } } if (flag == true) { b1[i] = 0; NotePad.DoLog("Добавляю новое покрытие"); File.Move(groundDirectory + (i + 1) + "\\test.jpg", groundDirectory + (i + 1) + "\\" + (n + 1) + ".jpg"); } } return(b1); }
bool GotRQ() { bool isRqKnown = false; Condition.eventrq = 0; MasterOfPictures.MakePicture(PointsAndRectangles.RQBounds, RQPath); for (int i = 1; i < 501; i++) { if (File.Exists(@"C:\Bot\RQ\" + i + ".jpg")) { if (MasterOfPictures.Verify(RQPath, @"RQ\" + i)) { Condition.eventrq = i; NotePad.DoLog("рк = " + Condition.eventrq); break; } } } if (Condition.eventrq == 0) { NotePad.DoLog("Unknown rq"); for (int x = 1; x < 500; x++) { if (File.Exists(@"C:\Bot\RQ\UnknownRQ" + x + ".jpg")) { if (MasterOfPictures.Verify(RQPath, (@"RQ\UnknownRQ" + x))) { break; } } else { File.Move(@"C:\Bot\" + RQPath + ".jpg", @"C:\Bot\RQ\UnknownRQ" + x + ".jpg"); break; } } } else { isRqKnown = true; } return(isRqKnown); }
int DefineEvevntConditionByPicture(int conditionNumber) { int x; for (x = 0; x < 500; x++) { if (File.Exists(@"C:\Bot\Condition" + conditionNumber + @"\C" + x + ".jpg")) { if (MasterOfPictures.Verify("Condition" + conditionNumber + @"\test", ("Condition" + conditionNumber + @"\C" + x))) { NotePad.DoLog(conditionNumber + " условие: " + x); break; } } else { NotePad.DoLog("Неизвестное условие"); for (int i = 1; i < 500; i++) { if (File.Exists(@"C:\Bot\Condition" + conditionNumber + @"\UnknownCondition" + i + ".jpg")) { if (MasterOfPictures.Verify("Condition" + conditionNumber + @"\test", ("Condition" + conditionNumber + @"\UnknownCondition" + i))) { break; } } else { File.Move(@"C:\Bot\" + "Condition" + conditionNumber + @"\test" + ".jpg", @"C:\Bot\Condition" + conditionNumber + @"\UnknownCondition" + i + ".jpg"); break; } } x = 500; break; } } return(x); }
public int[] RememberHand() { string carsDB = "Finger"; int lastcar = 3000; int[] carsid = new int[5]; bool flag; Rectangle[] b = { PointsAndRectangles.HandSlot1, PointsAndRectangles.HandSlot2, PointsAndRectangles.HandSlot3, PointsAndRectangles.HandSlot4, PointsAndRectangles.HandSlot5 }; for (int i = 0; i < 5; i++) { MasterOfPictures.MakePicture(b[i], (carsDB + (i + 1) + "\\test")); flag = true; if (i == 0)//для первого пальца { int emptySpaceForCar = 0; for (int i2 = 1; i2 < lastcar; i2++) { if (File.Exists("C:\\Bot\\Finger" + (i + 1) + "\\" + i2 + ".jpg")) { if (MasterOfPictures.Verify(("Finger" + (i + 1) + "\\" + i2), ("Finger" + (i + 1) + "\\test"))) { NotePad.DoLog("На " + (i + 1) + " месте " + i2 + " тачка"); carsid[i] = i2; File.Delete("C:\\Bot\\Finger" + (i + 1) + "\\test.jpg"); flag = false; break; } } else if (emptySpaceForCar == 0) { emptySpaceForCar = i2; } } if (flag == true) { NotePad.DoLog("Добавляю новую тачку"); carsid[i] = emptySpaceForCar; File.Move("C:\\Bot\\Finger" + (i + 1) + "\\test.jpg", "C:\\Bot\\Finger" + (i + 1) + "\\" + carsid[i] + ".jpg"); } } else { for (int i2 = 1; i2 < lastcar; i2++) { if (File.Exists("C:\\Bot\\Finger" + (i + 1) + "\\" + i2 + ".jpg")) //поиск в сортированных { if (MasterOfPictures.Verify(("Finger" + (i + 1) + "\\" + i2), ("Finger" + (i + 1) + "\\test"))) { NotePad.DoLog("На " + (i + 1) + " месте " + i2 + " тачка"); carsid[i] = i2; File.Delete("C:\\Bot\\Finger" + (i + 1) + "\\test.jpg"); flag = false; break; } } } if (flag == true) { int emptySpaceForCar = 0; for (int i2 = 1; i2 < lastcar; i2++) { if (File.Exists("C:\\Bot\\Finger" + (i + 1) + "\\unsorted" + i2 + ".jpg")) //поиск в сортированных { if (MasterOfPictures.Verify(("Finger" + (i + 1) + "\\unsorted" + i2), ("Finger" + (i + 1) + "\\test"))) { NotePad.DoLog("На " + (i + 1) + " месте " + i2 + " неотсортированная тачка"); carsid[i] = 10000; //неотсортированная File.Delete("C:\\Bot\\Finger" + (i + 1) + "\\test.jpg"); flag = false; break; } } else if (emptySpaceForCar == 0) { emptySpaceForCar = i2; } } if (flag == true) { NotePad.DoLog("Добавляю новую тачку"); carsid[i] = 10000; //неотсортированная File.Move("C:\\Bot\\Finger" + (i + 1) + "\\test.jpg", "C:\\Bot\\Finger" + (i + 1) + "\\unsorted" + emptySpaceForCar + ".jpg"); } } } } return(carsid); }