/// <summary> /// проверяем, является ли товар в первой строке магазина маленькой красной бутылкой /// </summary> /// <param name="numberOfString">номер строки, в которой проверяем товар</param> /// <returns> true, если в первой строке маленькая красная бутылка </returns> public bool isRedBottle(int numberOfString) { // PointColor pointFirstString = new PointColor(147 - 5 + xx, 224 - 5 + yy + (numberOfString - 1) * 27, 3360337, 0); //старый вариант PointColor pointFirstString = new PointColor(152 - 5 + xx, 250 - 5 + yy + (numberOfString - 1) * 27, 5933520, 0); return(pointFirstString.isColor()); } //исправлено 23.01.2019
/// <summary> /// Нажимаем Коннект (переводим бота из состояния логаут в состояние казарма) /// </summary> /// <returns></returns> public bool ConnectBH() // возвращает true, если успешно вошли в казарму { bool result = true; const int MAX_NUMBER_ITERATION = 4; //максимальное количество итераций uint count = 0; iPointColor testColor = new PointColor(65 - 5 + botParam.X, 55 - 5 + botParam.Y, 7800000, 5); //запоминаем цвет в координатах 55, 55 для проверки того, сменился ли экран (т.е. принят ли логин-пароль) Pause(500); do { PressConnectButton(); Pause(10000); if (isCheckBugs()) { BugFixes(); } count++; if (count > MAX_NUMBER_ITERATION) { result = false; break; } //if (server.isBarack()) //{ // result = true; // break; //} } while (!isChangeDisplay(testColor.GetPixelColor())); return(result); }
/// <summary> /// проверяем, сменилось ли изображение на экране /// </summary> /// <param name="testColor">тестовая точка</param> /// <returns>true, если сменился экран</returns> private bool isChangeDisplay(uint testColor) { iPointColor currentColor = new PointColor(65 - 5 + botParam.X, 55 - 5 + botParam.Y, 7800000, 5); uint color = currentColor.GetPixelColor(); bool result = (color == testColor); return(!result); }
/// <summary> /// проверяем, является ли товар в первой строке магазина маленькой красной бутылкой /// либо другими красными бутылками /// </summary> /// <returns> true, если в первой строке маленькая красная бутылка </returns> public bool isRedBottle() { //PointColor pointFirstString = new PointColor(147 - 5 + xx, 224 - 5 + yy, 3360337, 0); //return pointFirstString.isColor(); uint Color = new PointColor(149 - 5 + xx, 219 - 5 + yy, 0, 0).GetPixelColor(); return((Color == 5933520) || //500 HP маленькая красная бутылка (Color == 3947742) || //1500 HP (Color == 2634708) || //2500 HP (Color == 1714255) || //Mitridat (Color == 13667914)); //600 SP }
/// <summary> /// Продажа товара, когда список уже не прокручивается /// </summary> public void SaleToEnd() { iPointColor pointCurrentProduct; for (int j = 2; j <= 12; j++) { pointCurrentProduct = new PointColor(149 - 5 + xx, 219 - 5 + yy + (j - 1) * 27, 3360337, 0); //проверяем цвет текущего продукта Pause(50); if (NeedToSellProduct(pointCurrentProduct.GetPixelColor(), j)) //если нужно продать товар в строке j { AddToCartLotProduct(j); //добавляем в корзину весь товар в строке j } } }
/// <summary> /// проверяет включен ли командный режим или нет /// </summary> /// <returns> true, если командный режим включен </returns> public bool isCommandMode() { iPointColor pointCommandMode = new PointColor(123 - 5 + botParam.X, 479 - 5 + botParam.Y, 8000000, 6); return(pointCommandMode.isColor2()); }
/// <summary> /// Нажимаем Коннект (переводим бота из состояния логаут в состояние казарма) /// </summary> /// <returns></returns> public bool Connect() // возвращает true, если успешно вошли в казарму { #region новый вариант //bool result = true; //const int MAX_NUMBER_ITERATION = 4; //максимальное количество итераций //uint count = 0; //iPointColor testColor = new PointColor(65 - 5 + databot.X, 55 - 5 + databot.Y, 7800000, 5); //запоминаем цвет в координатах 55, 55 для проверки того, сменился ли экран (т.е. принят ли логин-пароль) //Pause(500); //do //{ // PressConnectButton(); // Pause(10000); // if (isCheckBugs()) BugFixes(); // count++; // if (count > MAX_NUMBER_ITERATION) // { // result = false; // break; // } // //if (server.isBarack()) // //{ // // result = true; // // break; // //} //} while (!isChangeDisplay(testColor.GetPixelColor())); //return result; #endregion #region старый вариант (но рабочий) //server.WriteToLogFileBH("вошли в процедуру коннект"); //server.WriteToLogFile(botParam.NumberOfInfinity + " " + botParam.Logins[botParam.NumberOfInfinity] + " " + botParam.Passwords[botParam.NumberOfInfinity] + " " + botParam.Parametrs[botParam.NumberOfInfinity]); //server.serverSelection(); //выбираем из списка свой сервер iPointColor point5050 = new PointColor(50 - 5 + botParam.X, 50 - 5 + botParam.Y, 7800000, 5); //запоминаем цвет в координатах 50, 50 для проверки того, сменился ли экран (т.е. принят ли логин-пароль) iPoint pointButtonOk = new Point(525 - 5 + botParam.X, 410 - 5 + botParam.Y); // кнопка Ok в логауте iPoint pointButtonOk2 = new Point(525 - 5 + botParam.X, 445 - 5 + botParam.Y); // кнопка Ok в логауте uint Tek_Color1; uint Test_Color = 0; bool ColorBOOL = true; uint currentColor = 0; const int MAX_NUMBER_ITERATION = 4; //максимальное количество итераций bool aa = true; Test_Color = point5050.GetPixelColor(); //запоминаем цвет в координатах 50, 50 для проверки того, сменился ли экран (т.е. принят ли логин-пароль) Tek_Color1 = Test_Color; ColorBOOL = (Test_Color == Tek_Color1); int counter = 0; //счетчик pointButtonOk.PressMouseL(); //кликаю в кнопку "ОК" Pause(500); pointButtonOk2.PressMouseL(); //кликаю в кнопку "ОК" 3 min Pause(500); server.serverSelection(); //выбираем из списка свой сервер server.WriteToLogFileBH("дошли до while"); while ((aa | (ColorBOOL)) & (counter < MAX_NUMBER_ITERATION)) { counter++; //счетчик Tek_Color1 = point5050.GetPixelColor(); ColorBOOL = (Test_Color == Tek_Color1); server.WriteToLogFileBH("нажимаем на кнопку connect"); //pointButtonOk.PressMouseL(); //кликаю в кнопку "ОК" //Pause(500); //pointButtonOk2.PressMouseL(); //кликаю в кнопку "ОК" 3 min //Pause(500); //server.serverSelection(); //выбираем из списка свой сервер PressConnectButton(); Pause(1500); //pointButtonOk.PressMouseL(); //кликаю в кнопку "ОК" //Pause(500); //pointButtonOk2.PressMouseL(); //кликаю в кнопку "ОК" 3 min //Pause(500); //если есть ошибки в логине-пароле, то возникает сообщение с кнопкой "OK". if (server.isPointConnect()) // Обработка Ошибок. { pointButtonOk.PressMouse(); //кликаю в кнопку "ОК" Pause(500); if (server.isPointConnect()) //проверяем, выскочила ли форма с кнопкой ОК { pointButtonOk.PressMouse(); //кликаю в кнопку "ОК" Pause(500); } pointButtonOk.PressMouseL(); //кликаю в кнопку "ОК" pointButtonOk2.PressMouseL(); //кликаю в кнопку "ОК" 3 min EnterLoginAndPasword(); } else { aa = false; } } bool result = true; Pause(5000); currentColor = point5050.GetPixelColor(); if (currentColor == Test_Color) //проверка входа в казарму. { //тыкнуть в Quit //PressMouseL(600, 530); //если не вошли в казарму, то значит зависли и жмем кнопку Quit //PressMouseL(600, 530); result = false; } return(result); #endregion }
/// <summary> /// проверяет включен ли командный режим или нет /// </summary> /// <returns> true, если командный режим включен </returns> public bool isCommandMode() { iPointColor pointCommandMode = new PointColor(123 - 5 + xx, 479 - 5 + yy, 8000000, 6); return(pointCommandMode.isColor2()); }
/// <summary> /// определяет, анализируется ли нужный товар либо данный товар можно продавать /// </summary> /// <param name="color"> цвет полностью определяет товар, который поступает на анализ </param> /// <returns> true, если анализируемый товар нужный и его нельзя продавать </returns> public bool NeedToSellProduct(uint color, int numberOfString) { bool result = true; //по умолчанию вещь надо продавать, поэтому true iPointColor pointMega = new PointColor(174 - 5 + xx, 214 - 5 + yy + (numberOfString - 1) * 27, 10000000, 7); //буква M в слове Mega switch (color) // Хорошая вещь или нет, сверяем по картотеке { case 394901: // soul crystal ** case 3947742: // красная бутылка 1200HP ** case 2634708: // красная бутылка 2500HP ** case 7171437: // devil whisper ** case 5933520: // маленькая красная бутылка ** case 1714255: // митридат ** case 7303023: // чугун ** case 4487528: // honey ** case 1522446: // green leaf ** case 2112641: // red leaf ** case 1533304: // yelow leaf ** case 13408291: // shiny ** case 3303827: // карта перса ** case 6569293: // warp ** case 662558: // head of Mantis ** case 4497887: // Mana Stone ** case 7305078: // Ящики для джеков ** case 15420103: // Бутылка хрина ** case 9868940: // композитная сталь ** case 5334831: // магическая сфера ** Magic sphere case 16777215: // Wheat flour ** case 13565951: // playtoken ** case 10986144: // Hinge ** case 3481651: // Tube ** case 6593716: // Clock ** case 13288135: // Spring ** case 7233629: // Cogwheel ** case 13820159: // Family Support Token ** case 4222442: // Wolf meat ** case 6719975: // Wild Boar Meat ** case 5072004: // Bone Stick ** case 3559777: // Dragon Lether ** case 1712711: // Dragon Horn ** case 4435935: // Yellow ore ** case 4448154: // Green ore ** case 13865807: // blue ore ** case 4670431: // Red ore ** case 13291199: // Diamond Ore ** ******************************************************* //case 1063140: // Stone of Philos ** //case 8486756: // Ice Crystal ** //case 8633037: // Pure Gold Bar //case 8289818: // Gray Feather //case 13068045: // Blue Stone //case 13627135: // Molar //case 5803426: // Tangler //case 12563070: // Marble //case 6380581: // Leather //case 14210488: // Spool //case 3223857: // Nail ************************************************************* case 573951: // Golden Apple case 4966811: // Cabbage case 13164006: // свекла Beet ** case 5393227: // Ebony Tree case 5131077: // Black Sap case 15575073: // Blue sap case 4143156: // bulk of Coal ** // case 9472397: // Steel piece ** // case 7187897: // Mustang ore //=================== пули =========================== case 1381654: // стрелы эксп case 11258069: // пули эксп Steel Bullet case 2569782: // дробь эксп Metal Shell Ammo case 1843234: // Steel Bolt case 14404589: // Large Calliber Bullet //=================== пули конец ===================== case 5137276: // сундук деревянный как у сфер древней звезды // case 3031912: // Reinforced Lether case 13667914: // 600 SP case 2831927: // Sign G, D case 2828377: // Ancient Orb case 8363835: // Icicle case 12642302: // Bone pick case 15790834: // Soft Cotton case 4543325: // Pebbles case 1457773: // Old Journal case 10401925: // Sharp Horn case 6270101: // Cabosse case 14344416: // Tough Cotton case 13079681: // Silk case 14278629: // Chip 100 case 14542297: // Chip Veteran case 13417421: // Octopus Arm case 3033453: // Clear Rum case 4474675: // Fish Flesh case 10931953: // Psychic Sphere case 656906: // magocal orb case 13748687: // Ressurection Potion case 15595262: // Small Stew обед case 3164547: // Portable Greate обед case 3303027: // книга со стойкой case 11906207: // Crest of Sacred case 5590609: // Crest of Black Knight case 15526903: // Elementium case 1835187: // экспертные чипы case 14146476: // solarion case 16251642: // growth booster case 10992324: // Шахматы case 7830683: // Кожа улитки case 5205119: // Токен 1 case 6848915: // Токен 2 case 12308958: // Токен 3 case 13361389: // Токен 4 case 4345686: // Токен Экстра case 6519909: // Elemental Jewel case 16435563: // Spell Key case 12697783: // Wheel of Time case 8078490: // Stone of Soul case 15521462: // Piece of Naraka Lu case 12835061: // Piece of Naraka Beel case 12566387: // Piece of Naraka Al case 9737463: // Piece of Naraka Mo case 13742236: // Piece of Naraka Ma case 10000596: // Piece of Naraka Than case 9686241: // Piece of Naraka He case 5195666: // Sedative case 2635075: // Elemental Sphere (патроны) case 1585221: // Dried Maroon // case 8633037: // Pure Gold Bar case 1527133: // Armonia Coin case 1023705: // Violet's Vaucher case 5002080: // Карточка кэш персонажа 1 case 5001823: // Карточка кэш персонажа 2 case 16515071: // Devil Dream case 3156778: // Gift Made (по ивенту) case 2040097: // Gift Made (по ивенту) case 1644826: // Gift Made (по ивенту) case 47612: // Triumph Fillers result = false; break; case 14210771: // Mega Etr, Io Talt case 9803667: // Mega A case 7645105: // Mega Qu if (pointMega.isColor()) { result = false; //если еще совпадает и вторая точка, то это мегакварц не работает } break; } return(result); } //товары здесь !!!!!!!!!!!!!!!!
/// <summary> /// проверяем, является ли товар в первой строке магазина маленькой красной бутылкой /// </summary> /// <param name="numberOfString">номер строки, в которой проверяем товар</param> /// <returns> true, если в первой строке маленькая красная бутылка </returns> public bool isRedBottle(int numberOfString) { PointColor pointFirstString = new PointColor(147 - 5 + xx, 224 - 5 + yy + (numberOfString - 1) * 27, 3360337, 0); return(pointFirstString.isColor()); }
/// <summary> /// возвращает цифру от 0 до 9, расположенную в указанных координатах (левый верхний угол) /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> private int Numeral(int x, int y) { iPointColor pointdigit1 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 2, 65000, 3); //1 iPointColor pointdigit2 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 5, 63000, 3); //2 iPointColor pointdigit3 = new PointColor(x - 5 + xx + 2, y - 5 + yy + 4, 65000, 3); //3 iPointColor pointdigit4 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 6, 59000, 3); //4 iPointColor pointdigit5 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 0, 56000, 3); //5 iPointColor pointdigit6 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 1, 60000, 3); //6 iPointColor pointdigit7 = new PointColor(x - 5 + xx + 0, y - 5 + yy + 0, 63000, 3); //7 iPointColor pointdigit8 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 4, 63000, 3); //8 iPointColor pointdigit9 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 4, 65000, 3); //9 iPointColor pointdigit0 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 8, 56000, 3); //0 switch (product.numberOfDigit) { case 3: break; case 4: //зеленые цифры pointdigit1 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 2, 64000, 3); //1 pointdigit2 = new PointColor(x - 5 + xx + 0, y - 5 + yy + 9, 65000, 3); //2 pointdigit3 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 4, 64000, 3); //3 pointdigit4 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 6, 58000, 3); //4 pointdigit5 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 0, 50000, 4); //5 pointdigit6 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 1, 59000, 3); //6 pointdigit7 = new PointColor(x - 5 + xx + 0, y - 5 + yy + 0, 60000, 4); //7 pointdigit8 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 4, 63000, 3); //8 pointdigit9 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 4, 65000, 3); //9 pointdigit0 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 8, 56000, 3); //0 break; case 5: //желтые цифры pointdigit1 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 2, 65000, 3); //1 pointdigit2 = new PointColor(x - 5 + xx + 0, y - 5 + yy + 9, 65000, 3); //2 pointdigit3 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 6, 65000, 3); //3 pointdigit4 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 6, 50000, 4); //4 если 3 и 6, то 59000 pointdigit5 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 0, 50000, 4); //5 pointdigit6 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 1, 60000, 3); //6 pointdigit7 = new PointColor(x - 5 + xx + 0, y - 5 + yy + 0, 63000, 3); //7 pointdigit8 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 4, 63000, 3); //8 pointdigit9 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 4, 65000, 3); //9 pointdigit0 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 8, 56000, 3); //0 break; case 6: //коричневые цифры pointdigit1 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 2, 4090000, 4); //1 pointdigit2 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 5, 4030000, 4); //2 pointdigit3 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 4, 4030000, 4); //3 pointdigit4 = new PointColor(x - 5 + xx + 3, y - 5 + yy + 6, 3760000, 4); //4 pointdigit5 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 0, 3560000, 4); //5 pointdigit6 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 1, 3760000, 4); //6 pointdigit7 = new PointColor(x - 5 + xx + 0, y - 5 + yy + 0, 4030000, 4); //7 pointdigit8 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 4, 4030000, 4); //8 pointdigit9 = new PointColor(x - 5 + xx + 5, y - 5 + yy + 4, 4090000, 4); //9 pointdigit0 = new PointColor(x - 5 + xx + 1, y - 5 + yy + 8, 3560000, 4); //0 break; case 7: break; case 8: break; case 9: break; case 10: break; } if ((pointdigit1.isColor()) || ((pointdigit1.GetPixelColor() > 120000) && (pointdigit1.GetPixelColor() < 130000))) { return(1); } if ((pointdigit2.isColor()) || ((pointdigit2.GetPixelColor() > 120000) && (pointdigit2.GetPixelColor() < 130000))) { return(2); } if ((pointdigit4.isColor()) || ((pointdigit4.GetPixelColor() > 120000) && (pointdigit4.GetPixelColor() < 130000))) { return(4); } if ((pointdigit7.isColor()) || ((pointdigit7.GetPixelColor() > 120000) && (pointdigit7.GetPixelColor() < 130000))) { return(7); } if ((pointdigit5.isColor()) || ((pointdigit5.GetPixelColor() > 120000) && (pointdigit5.GetPixelColor() < 130000))) { return(5); } if ((pointdigit6.isColor()) || ((pointdigit6.GetPixelColor() > 120000) && (pointdigit6.GetPixelColor() < 130000))) { return(6); } if ((pointdigit0.isColor()) || ((pointdigit0.GetPixelColor() > 120000) && (pointdigit0.GetPixelColor() < 130000))) { return(0); } if ((pointdigit9.isColor()) || ((pointdigit9.GetPixelColor() > 120000) && (pointdigit9.GetPixelColor() < 130000))) { return(9); } if ((pointdigit8.isColor()) || ((pointdigit8.GetPixelColor() > 120000) && (pointdigit8.GetPixelColor() < 130000))) { return(8); } if ((pointdigit3.isColor()) || ((pointdigit3.GetPixelColor() > 120000) && (pointdigit3.GetPixelColor() < 130000))) { return(3); } return(0); //возвращаем незанчащий ноль, если никакой цифры на этом месте нет }
/// <summary> /// проверяем, является ли товар в первой строке магазина маленькой красной бутылкой /// </summary> /// <returns> true, если в первой строке маленькая красная бутылка </returns> public bool isRedBottle() { PointColor pointFirstString = new PointColor(152 - 5 + xx, 250 - 5 + yy, 5933520, 0); return(pointFirstString.isColor()); } //исправлено 23.01.2019