コード例 #1
0
        /*
         * Function: runAutoThanTu
         * Description: Tự động auto thần tu
         * Author: Tử La Lan - Facebook: https://www.facebook.com/Tu.La.Lan.NT
         * Created At: 2019-12-29 - Updated At: 2019-12-29
         */
        public void runAutoThanTu()
        {
            if (mCharacter.Running == 0)
            {
                return;
            }

            string npc      = "thanhchuquyenco";
            string location = "autothantu";
            string map      = "quyencothanh";

            mAuto.writeStatus("Bắt đầu \"Auto Thần tu\"");
            mAuto.closeAllDialog();

            // Chạy đến map
            if (!mAuto.moveToMap(map, 1, 7, -18))
            {
                mAuto.writeStatus("Không thể di chuyển đến " + map + " , thử lại ...");
                runAutoThanTu();
            }

            // Bay lên
            mAuto.bay();

            // Chạy đến NPC
            if (!mAuto.moveToNPC(npc, location))
            {
                mAuto.writeStatus("Không thể di chuyển đến vị trí " + location);
                runAutoThanTu();
            }

            // Bay xuống
            mAuto.bayXuong();

            // Nói chuyện với NPC
            if (mAuto.talkToNPC(npc))
            {
                // Chọn Auto Tu Hành
                mAuto.clickImageByGroup("global", "autothantu", false, true);

                // Bấm bắt đầu
                mAuto.clickImageByGroup("global", "batdauautotuhanh", false, false);

                // Bấm có
                mAuto.clickImageByGroup("global", "luachonco", false, true);
            }
        }
コード例 #2
0
        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();
            }
        }