Пример #1
0
        public void moveAndFindMonsters(List <Point> mapPoints, List <Monster> monsters, string monster_name, bool is_bug_flight)
        {
            string imageTalkMonster = Constant.ImagePathDoiThoai + monster_name + ".png";
            int    i = 0;

            while (i < mapPoints.Count)
            {
                // Tắt các bảng nổi
                mAuto.closeAllDialog();

                if (!is_bug_flight)
                {
                    // Mở menu phải
                    mAuto.moMenuPhai();

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

                // Mở bảng đồ mini
                //mAuto.clickToImage(Constant.ImagePathMiniMap);
                mAuto.sendKey("~");

                // Nhấp vào vị trí map
                mAuto.clickPoint(mapPoints[i].X, mapPoints[i].Y);

                if (!is_bug_flight)
                {
                    // Đóng menu phải
                    mAuto.dongMenuPhai();
                }

                if (i % 4 == 0)
                {
                    Thread.Sleep(4000);
                }

                // Tắt các bảng nổi
                mAuto.closeAllDialog();

                Thread.Sleep(1000);

                // tìm quái vật
                while (isExistsMonster(monsters))
                {
                    int y = 0;
                    while (!mAuto.findImage(imageTalkMonster) && y < monsters.Count)
                    {
                        if (mAuto.findImage(monsters[y].imagePath))
                        {
                            if (!is_bug_flight)
                            {
                                // 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(monsters[y].imagePath, monsters[y].x, monsters[y].y);
                            Thread.Sleep(1000);
                        }

                        y++;
                    }

                    // Đánh
                    mAuto.clickToImage(imageTalkMonster);

                    // 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(4000);
                    }

                    if (inBattle)
                    {
                        Thread.Sleep(2000);
                    }
                }

                i++;
            }
        }