コード例 #1
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
        public static bool clickToMonster(Point?monsterLocation)
        {
            int   i = 0;
            Point?fightExpMonsterImage = null;

            GameHelper.Log("Finding to fight....");
            while (i < 5)
            {
                fightExpMonsterImage = GameImage.findGameImage(fightImage, "Fight Monster", true, monsterLocation.Value.X - 150, monsterLocation.Value.Y - 250, 300, 300);
                if (fightExpMonsterImage != null)
                {
                    GameImage.clickImage(fightImage, fightExpMonsterImage.Value.X + monsterLocation.Value.X - 150, fightExpMonsterImage.Value.Y + monsterLocation.Value.Y - 250, "Fight Monster");
                    GameHelper.Log("Click to fight exp monster");
                    return(true);
                }
                i++;
                GameHelper.Delay(100);
            }

            if (fightExpMonsterImage == null)
            {
                fightExpMonsterImage = GameImage.findGameImage(bossImage, "Fight BOSS", true, monsterLocation.Value.X - 100, monsterLocation.Value.Y - 300, 200, 300);
                if (fightExpMonsterImage != null)
                {
                    GameImage.clickImage(bossImage, fightExpMonsterImage.Value.X + monsterLocation.Value.X - 100, fightExpMonsterImage.Value.Y + monsterLocation.Value.Y - 250, "Fight Boss");
                }
            }

            if (fightExpMonsterImage == null)
            {
                GameHelper.Log("Found fight image of exp monster Fail");
            }
            return(false);
        }
コード例 #2
0
        public static bool findAndClickImage(Bitmap image, string imageName = "image", bool cropMode = false, int x = 0, int y = 0, int width = 0, int height = 0, bool capture = false, bool recheck = false)
        {
            Point?imageResult = findGameImage(image, imageName, cropMode, x, y, width, height, capture);
            int   i           = 0;

            if (imageResult != null)
            {
                clickImage(image, imageResult.Value.X + x, imageResult.Value.Y + y, imageName);
                while (i < 3 && recheck)
                {
                    GameHelper.Delay(500);
                    imageResult = findGameImage(image, imageName, cropMode, x, y, width, height, false);
                    if (imageResult != null)
                    {
                        clickImage(image, imageResult.Value.X + x, imageResult.Value.Y + y, imageName);
                        i++;
                    }
                    else
                    {
                        return(true);
                    }
                }
                GameHelper.Log("Found " + imageName);
                return(true);
            }
            GameHelper.Log("Cant find " + imageName);
            return(false);
        }
コード例 #3
0
 public static void clickEndBattle()
 {
     GameHelper.clickGame(567, 627);
     GameHelper.Delay(500);
     GameHelper.clickGame(568, 627);
     GameHelper.Delay(500);
     GameHelper.clickGame(568, 627);
 }
コード例 #4
0
        public static ShikiFood findShikiFood(int foodType = 0, List <int> shikiMaxPositions = null)
        {
            /*
             * foodType: 0 => N ; 1 => Daruma ; 2 => R
             */
            GameHelper.Log(foodType.ToString());
            if (foodType > 2 || foodType < 0)
            {
                foodType = 0;
            }
            int[] shikiTypePos = GamePos.shikiTypeButton[foodType];
            GameHelper.Delay(500);
            GameImage.waitGameImage(allShikiImage, 5000, 1000);
            GameHelper.clickRandomArea(GamePos.allShikiButton[0], GamePos.allShikiButton[1], GamePos.allShikiButton[2], GamePos.allShikiButton[3]);
            GameHelper.Delay(1000);
            GameHelper.clickRandomArea(shikiTypePos[0], shikiTypePos[1], shikiTypePos[2], shikiTypePos[3]);
            GameHelper.Delay(1000);
            if (shikiMaxPositions.Count > 0)
            {
                int swipeCount = 0;
                shikiMaxPositions.ForEach(delegate(int position)
                {
                    int[] shikiMaxPos = GamePos.shikiPositionDrag[position];
                    while (swipeCount < 3)
                    {
                        int shikiStartX = findShiki(swipeCount);
                        if (shikiStartX != -1)
                        {
                            GameHelper.Delay(1000);
                            //GameHelper.dragAndDropGame(shikiStartX + 50, 490, shikiMaxPos[0] + (shikiMaxPos[2] - shikiMaxPos[0]) / 2, shikiMaxPos[1] + (shikiMaxPos[3] - shikiMaxPos[1]) / 2);
                            Point point1   = new Point();
                            point1.X       = shikiStartX + 50;
                            point1.Y       = 490;
                            Point point2   = new Point();
                            point2.X       = point1.X;
                            point2.Y       = shikiMaxPos[1];
                            Point point3   = new Point();
                            point3.X       = shikiMaxPos[0] + (shikiMaxPos[2] - shikiMaxPos[0]) / 2;
                            point3.Y       = point2.Y;
                            Point[] points = { point1, point2, point3 };
                            GameHelper.dragAndDropMultiGame(points);
                            GameHelper.Delay(1500);
                            break;
                        }
                        else
                        {
                            GameHelper.dragAndDropGame(903, 541, 201, 531);
                            swipeCount++;
                        }
                    }
                });
            }

            //go to food storage
            return(null);
        }
コード例 #5
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
 public static void exitExploreArea()
 {
     if (isExploreArea() != true)
     {
         return;
     }
     AutoControl.SendKeyBoardPress(Global.mainHandle, VKeys.VK_ESCAPE);
     GameHelper.Delay(1200);
     GameImage.findAndClickImage(okImage);
 }
コード例 #6
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
 public static void fightExpMonster(Point?monster)
 {
     if (clickToMonster(monster) == false)
     {
         return;
     }
     if (GameBattle.waitBattleReady() == false)
     {
         return;
     }
     checkFoodFullExp();
     GameHelper.Delay(500);
     GameBattle.battleStart();
     GameBattle.waitBattleEnd();
     GameHelper.Delay(500);
     GameBattle.clickEndBattle();
     GameHelper.Delay(500);
     GameImage.waitGameImage(yingbingImage);
     checkTurnFight();
 }
コード例 #7
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
        public static void findAndAttackExpMonster()
        {
            int i = 0;

            GameHelper.Delay(1000);
            while (i < 3 && !Global.isStop)
            {
                var expMonster = findExpMonster();
                if (expMonster != null)
                {
                    fightExpMonster(expMonster);
                }
                else
                {
                    swipeToNextExplore();
                    expMonster = null;
                    i++;
                }
            }
            return;
        }
コード例 #8
0
        public static bool waitBattleEnd()
        {
            Bitmap[]   images      = { loseImage, goldImage };
            List <int> imageResult = new List <int>();
            int        i           = 0;

            while (i < 20)
            {
                GameHelper.Delay(3000);
                imageResult = GameImage.findMultiGameImage(images);
                if (imageResult.Count() > 0)
                {
                    break;
                }
                i++;
            }
            if (imageResult.Count() < 1)
            {
                GameHelper.Log("Battle Error");
                return(false);
            }
            if (imageResult[0] == 1)
            {
                GameHelper.Log("Win Battle");
                return(true);
            }
            if (imageResult[0] == 0)
            {
                GameHelper.Log("Lose Battle");
                return(true);
            }

            /*bool result = GameImage.waitGameImage(goldImage, 100000, 5000);
             * if (result == true)
             * {
             *  GameHelper.Log("End Battle");
             *  return true;
             * }*/
            return(false);
        }
コード例 #9
0
        public static bool waitGameImage(Bitmap image, int max_time = 10000, int delay_time = 1000, bool quit = false)
        {
            int   i = 0;
            Point?findImageResult = null;

            while (i < max_time / 1000)
            {
                GameHelper.Delay(1000);
                findImageResult = findGameImage(image);
                if (findImageResult != null)
                {
                    return(true);
                }
                i++;
            }
            if (quit == true)
            {
                Global.closeGame();
            }

            return(false);
        }
コード例 #10
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
        public static List <int> checkFoodFullExp()
        {
            List <int> result = new List <int>();

            if (GameImage.findGameImage(maxLvlImage, "Max exp image", true, GamePos.shikiCenterBattle[0], GamePos.shikiCenterBattle[1], GamePos.shikiCenterBattle[2] - GamePos.shikiCenterBattle[0], GamePos.shikiCenterBattle[3] - GamePos.shikiCenterBattle[1]) != null)
            {
                result.Add(1);
            }
            if (GameImage.findGameImage(maxLvlImage, "Max exp image", true, GamePos.shikiRightBattle[0], GamePos.shikiRightBattle[1], GamePos.shikiRightBattle[2] - GamePos.shikiRightBattle[0], GamePos.shikiRightBattle[3] - GamePos.shikiRightBattle[1]) != null)
            {
                result.Add(2);
            }

            if (result.Count > 0)
            {
                GameHelper.Log("Click to change shiki");
                GameHelper.clickGame(655, 482, true);
                GameHelper.Delay(1000);
                ShikiFood.findShikiFood(foodType, result);
            }
            return(result);
        }
コード例 #11
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
        public static Point?findExpMonster()
        {
            int   i = 0;
            Point?expMonsterImage = null;
            Image scene           = null;;

            GameHelper.Log("Finding exp monster....");
            while (i < 5)
            {
                scene           = CaptureHelper.CaptureWindow(Global.mainHandle);
                expMonsterImage = ImageScanOpenCV.FindOutPoint((Bitmap)scene, expImage);
                //expMonsterImage = GameImage.findGameImage(expImage);
                if (expMonsterImage != null)
                {
                    GameHelper.Log("Found Exp Monster(Middle)!!!");
                    break;
                }
                expMonsterImage = ImageScanOpenCV.FindOutPoint((Bitmap)scene, nearExpImage);
                if (expMonsterImage != null)
                {
                    GameHelper.Log("Found Exp Monster(Near)!!!");
                    break;
                }
                expMonsterImage = ImageScanOpenCV.FindOutPoint((Bitmap)scene, farExpImage);
                if (expMonsterImage != null)
                {
                    GameHelper.Log("Found Exp Monster(Far)!!!");
                    break;
                }
                i++;
                GameHelper.Delay(200);
            }
            if (expMonsterImage == null)
            {
                GameHelper.Log("Found Exp Monster Fail!!!");
            }
            return(expMonsterImage);
        }
コード例 #12
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
 public static void ExploreAction()
 {
     GameHelper.Log("Start new Explore");
     if (GameImage.waitGameImage(exploreImage, 100000, 1000, true) == false)
     {
         Global.isStop = true;
         return;
     }
     clickExplore();
     GameHelper.Delay(516);
     if (isExploreArea() != true)
     {
         Global.isStop = true;
         return;
     }
     GameHelper.Delay(525);
     swipeToNextExplore();
     GameHelper.Delay(525);
     findAndAttackExpMonster();
     GameHelper.Delay(525);
     exitExploreArea();
     GameHelper.Delay(528);
 }
コード例 #13
0
ファイル: Explore.cs プロジェクト: QuangChienPTIT/ToolOnmyoji
 public static void swipeToNextExplore()
 {
     GameHelper.Log("Swipe");
     AutoControl.SendDragAndDropOnPosition(Global.mainHandle, 1077, 85, 385, 83, 10, 10, 0.01);
     GameHelper.Delay(1230);
 }