public void thuHoach() { mAuto.writeStatus("Thu hoạch nguyên liệu ..."); mAuto.clickToImage(Constant.ImagePathThuHoachButton); Thread.Sleep(Constant.TimeShort); mAuto.clickToImage(Constant.ImagePathDiemThuHoachButton); mAuto.writeStatus("Đã trồng xong nguyên liệu ..."); }
/* * Function: Chạy Q Trị An * Description: Chạy Q Trị An * Author: Tử La Lan - Facebook: https://www.facebook.com/Tu.La.Lan.NT * Created At: 2019-11-09 - Updated At: 2019-11-09 */ public void runTriAn() { if (mCharacter.Running == 0) { return; } int i = 0; mAuto.writeStatus("Bắt đầu \"Chạy Trị An\" ..."); // Chuyển qua bảng chat "Hệ thống" mAuto.writeStatus("Chuyển qua bảng chat \"Hệ thống\" ..."); mAuto.clickToImage(Constant.ImagePathGlobalChatTabHeThong); // Block khung chat mAuto.writeStatus("Block khung chat ..."); mAuto.clickImageByGroup("global", "blockchat"); // Bật auto mAuto.writeStatus("Bật auto ..."); mAuto.batAuto(); // Nếu vip dưới 6 thì mới chạy cái này if (mCharacter.VipLevel < 6 && mCharacter.VipLevel > 0) { // Xuong mAuto.bayXuong(); } while (!mChayTriAn.completed && i < Constant.MaxLoop && mCharacter.Running == 1) { i++; mChayTriAn.nhanQ(); if (!mChayTriAn.completed) { mChayTriAn.chayQ(); } } }
public void chayQ() { // Xóa ghi chép chat mAuto.clickImageByGroup("global", "chatclear", false, true); List <Bitmap> pos = new List <Bitmap>(); int loop = 0; while (!checkDaDanhNhiemVu()) { loop++; if (loop >= 5) { Helper.showAlert(mCharacter.ID, "Nhiệm vụ phi tặc này có vấn đề"); } // Mở menu phải mAuto.moMenuPhai(); // Nếu vip dưới 6 thì mới chạy cái này if (mCharacter.VipLevel < 6 && mCharacter.VipLevel > 0) { // Bay mAuto.bay(); } // Tìm tới tọa độ và gọi quái while (!checkDaGoiQuai()) { // Mở túi nhiệm vụ mAuto.closeAllDialog(); mAuto.clickToImage(Constant.ImagePathGlobalTui); mAuto.clickImageByGroup("global", "tui_tab_nhiemvu", true, true); // Nhấp đôi vào bản đồ nhiệm vụ mAuto.clickToImage(Constant.ImagePathTriAnBanDoNhiemVu, 0, -20, 2); // Chờ 2s để load map Thread.Sleep(2000); mAuto.closeAllDialog(); // Nếu vip dưới 6 thì mới chạy cái này if (mCharacter.VipLevel < 6 && mCharacter.VipLevel > 0) { do { // Nhấp vào tọa độ mAuto.writeStatus("Nhấp vào tọa độ ..."); mAuto.clickToImage(Constant.ImagePathTriAnToaDo, 10, -25); mAuto.clickToImage(Constant.ImagePathTriAnToaDo2, 10, -25); } while (mAuto.isMoving()); } var full_screen = CaptureHelper.CaptureWindow(mHWnd); // Lưu tracking Bitmap bChuyenKenh = ImageScanOpenCV.GetImage(Constant.ImagePathGlobalChuyenKenh); var pBChuyenKenh = ImageScanOpenCV.FindOutPoint((Bitmap)full_screen, bChuyenKenh); if (pBChuyenKenh != null) { Bitmap tracking = CaptureHelper.CropImage((Bitmap)full_screen, new Rectangle(pBChuyenKenh.Value.X, pBChuyenKenh.Value.Y, 180, 20)); tracking.Save("tracking/trian_" + mCharacter.ID + ".png", ImageFormat.Png); } } mAuto.closeAllDialog(); // Nếu vip dưới 6 thì mới chạy cái này if (mCharacter.VipLevel < 6 && mCharacter.VipLevel > 0) { // Xuống mAuto.bayXuong(); } // Đóng menu phải mAuto.dongMenuPhai(); // Tìm phản quân hoặc phi tặc int x = 0; while (!mAuto.findImage(Constant.ImagePathDoiThoai + "trian" + ".png") && x < lPTPQ.Count) { if (mAuto.findImage(lPTPQ[x].imagePath)) { mAuto.clickToImage(lPTPQ[x].imagePath, lPTPQ[x].x, lPTPQ[x].y); } x++; } // Đánh mAuto.clickToImage(Constant.ImagePathDoiThoai + "trian" + ".png"); // Nghỉ 5s nếu nhân vật đang trong trận đấu while (mAuto.dangTrongTranDau()) { Thread.Sleep(5000); } if (checkDaDanhNhiemVu()) { break; } // Lưu 4 vị trí xung quanh vị trí hiện tại if (pos.Count <= 0) { // Mở bảng đồ mini mAuto.clickToImage(Constant.ImagePathMiniMap); Thread.Sleep(1000); var full_screen = CaptureHelper.CaptureWindow(mHWnd); // Tắt các bảng nổi mAuto.closeAllDialog(); // Lưu 4 vị trí Bitmap iBtn = ImageScanOpenCV.GetImage(Constant.ImagePathInMapChar); var pBtn = ImageScanOpenCV.FindOutPoint((Bitmap)full_screen, iBtn); if (pBtn != null) { pos.Add(CaptureHelper.CropImage((Bitmap)full_screen, new Rectangle(pBtn.Value.X + (-15), pBtn.Value.Y + (-30), 30, 30))); pos.Add(CaptureHelper.CropImage((Bitmap)full_screen, new Rectangle(pBtn.Value.X + (11), pBtn.Value.Y + (0), 30, 30))); pos.Add(CaptureHelper.CropImage((Bitmap)full_screen, new Rectangle(pBtn.Value.X + (-15), pBtn.Value.Y + (20), 30, 30))); pos.Add(CaptureHelper.CropImage((Bitmap)full_screen, new Rectangle(pBtn.Value.X + (-32), pBtn.Value.Y + (0), 30, 30))); } } // Di chuyển đến vị trí quanh ptpq int i = 0; while (!mAuto.findImage(Constant.ImagePathDoiThoai + "trian" + ".png") && i < pos.Count) { // Mở menu phải mAuto.moMenuPhai(); // Bay lên mAuto.bay(); // Mở bảng đồ mini mAuto.clickToImage(Constant.ImagePathMiniMap); // Nhấp vào vị trí xung quanh ptpq mAuto.clickImage(pos[i], 15, -15); // Tắt các bảng nổi mAuto.closeAllDialog(); // Đóng menu phải mAuto.dongMenuPhai(); // Tìm phản quân hoặc phi tặc int y = 0; while (!mAuto.findImage(Constant.ImagePathDoiThoai + "trian" + ".png") && y < lPTPQ.Count) { if (mAuto.findImage(lPTPQ[y].imagePath)) { // Mở menu phải mAuto.moMenuPhai(); // Bay xuống if (mAuto.findImage(Constant.ImagePathGlobalXuong)) { mAuto.bayXuong(); Thread.Sleep(3000); } // Đóng menu phải mAuto.dongMenuPhai(); mAuto.clickToImage(lPTPQ[y].imagePath, lPTPQ[y].x, lPTPQ[y].y); Thread.Sleep(1000); } y++; } i++; } // Đánh mAuto.clickToImage(Constant.ImagePathDoiThoai + "trian" + ".png"); // Nghỉ 5s nếu nhân vật đang trong trận đấu while (mAuto.dangTrongTranDau()) { Thread.Sleep(5000); } } if (!checkHoanThanhNhiemVu()) { // Nhấn vào nhận Q Trị An mAuto.clickImageByGroup("tri_an", "nhiemvutrianchuanhan", false, true); mAuto.clickImageByGroup("tri_an", "nhiemvuphanquandaxong", false, true); mAuto.clickImageByGroup("tri_an", "nhiemvuphitacdaxong", false, true); // Trả nhiệm vụ mAuto.traNhiemVu(); } }
public void findMonsterByCode(string monster_name) { string imageTalkMonster = Constant.ImagePathDoiThoai + monster_name + ".png"; int x = 0; int y = 0; List <Map> maps = new List <Map>(); maps.Add(new Map("leduongbac", 1, 30, -20)); maps.Add(new Map("leduongnam", 1, 10, -20)); maps.Add(new Map("laptuyetdia", 1, 30, -20)); maps.Add(new Map("anhvucanh", 1, 60, -20)); maps.Add(new Map("bangtuyetnguyen", 1, 10, -20)); List <string> tmpPaths = new List <string>(); tmpPaths.Add("resources/event/ldb1.png"); tmpPaths.Add("resources/event/ldb2.png"); tmpPaths.Add("resources/event/ldb3.png"); tmpPaths.Add("resources/event/ldb4.png"); tmpPaths.Add("resources/event/ldb5.png"); maps[0].setPosPaths(tmpPaths); List <string> tmpPathsLDN = new List <string>(); tmpPathsLDN.Add("resources/event/ldn1.png"); tmpPathsLDN.Add("resources/event/ldn2.png"); tmpPathsLDN.Add("resources/event/ldn3.png"); tmpPathsLDN.Add("resources/event/ldn4.png"); tmpPathsLDN.Add("resources/event/ldn5.png"); maps[1].setPosPaths(tmpPathsLDN); List <string> tmpPathsLTD = new List <string>(); tmpPathsLTD.Add("resources/event/ltd1.png"); tmpPathsLTD.Add("resources/event/ltd2.png"); tmpPathsLTD.Add("resources/event/ltd3.png"); tmpPathsLTD.Add("resources/event/ltd4.png"); tmpPathsLTD.Add("resources/event/ltd5.png"); maps[2].setPosPaths(tmpPathsLTD); List <string> tmpPathsAVC = new List <string>(); tmpPathsAVC.Add("resources/event/avc1.png"); tmpPathsAVC.Add("resources/event/avc2.png"); tmpPathsAVC.Add("resources/event/avc3.png"); tmpPathsAVC.Add("resources/event/avc4.png"); tmpPathsAVC.Add("resources/event/avc5.png"); maps[3].setPosPaths(tmpPathsAVC); List <string> tmpPathsBTN = new List <string>(); tmpPathsBTN.Add("resources/event/btn1.png"); tmpPathsBTN.Add("resources/event/btn2.png"); tmpPathsBTN.Add("resources/event/btn3.png"); tmpPathsBTN.Add("resources/event/btn4.png"); tmpPathsBTN.Add("resources/event/btn5.png"); maps[4].setPosPaths(tmpPathsBTN); while (mCharacter.Running == 2) { x = 0; while (x < maps.Count) { // Di chuyển đến Map if (!mAuto.moveToMapNhom(maps[x].name, maps[x].mapIndex, maps[x].x, maps[x].y)) { mAuto.writeStatus("Không thể di chuyển đến " + maps[x].name + ", thử lại ..."); } y = 0; while (y < maps[x].posPaths.Count) { // Check đang di chuyển do { // Nhấp vào code mAuto.clickToImage(maps[x].posPaths[y], -20); if (mAuto.findImageByGroup("global", "movenhom")) { // Tắt các bảng nổi mAuto.closeAllDialog(); } } while (mAuto.isMoving()); Thread.Sleep(1000); // Check có bảng đối thoại ko ? if (mAuto.findImage(imageTalkMonster)) { // Đánh quái mAuto.clickToImage(imageTalkMonster); Thread.Sleep(2000); // Nghỉ 5s nếu nhân vật đang trong trận đấu bool inBattle = false; while (mAuto.dangTrongTranDau()) { inBattle = true; mAuto.clickImageByGroup("global", "inbattleauto"); Thread.Sleep(2000); } if (inBattle) { Thread.Sleep(2000); } } y++; } x++; } } }