Пример #1
0
        /// <summary>
        /// 获取某处颜色数量,执行某个操作,结束后判断数量是否改变
        /// </summary>
        /// <param name="_dm"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="color"></param>
        /// <param name="action"></param>
        /// <param name="sim"></param>
        /// <returns></returns>
        public static bool IsChangeColorNum(this DmPlugin _dm, int x1, int y1, int x2, int y2, string color, Action action, double sim = 0.9)
        {
            int a = _dm.GetColorNum(x1, y1, x2, y2, color, sim);

            action();
            int b = _dm.GetColorNum(x1, y1, x2, y2, color, sim);

            if (a == b)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #2
0
 private bool SupplementarySoldier(int x1, int y1, int x2, int y2, int a, int b)
 {
     if (_dm.GetColorNum(x1, y1, x2, y2, "BF6C61-202020", 1.0) < 50)
     {
         _dm.MoveToClick(a, b);
         _dm.Delay(500);
         return(true);
     }
     return(false);
 }
Пример #3
0
        /// <summary>
        /// 获取某处颜色数量,执行某个操作,执行完后判断数量在某个时间段内是否改变
        /// </summary>
        /// <param name="_dm"></param>
        /// <param name="x1"></param>
        /// <param name="y1"></param>
        /// <param name="x2"></param>
        /// <param name="y2"></param>
        /// <param name="color"></param>
        /// <param name="action"></param>
        /// <param name="time"></param>
        /// <param name="sim"></param>
        /// <returns></returns>
        public static bool IsChangeColorNumEx(this DmPlugin _dm, int x1, int y1, int x2, int y2, string color, Action action, long time = 2000, double sim = 0.9)
        {
            int a, b;

            a = _dm.GetColorNum(x1, y1, x2, y2, color, sim);
            action();
            Stopwatch sw = new Stopwatch();

            sw.Start();
            while (sw.ElapsedMilliseconds <= time)
            {
                b = _dm.GetColorNum(x1, y1, x2, y2, color, sim);
                if (a != b)
                {
                    sw.Stop();
                    break;
                }
            }
            sw.Stop();
            return(sw.ElapsedMilliseconds <= time);
        }
Пример #4
0
        private TaskResult RunStep1(TaskContext context)
        {
            Role     role = (Role)context.Role;
            DmPlugin dm   = role.Window.Dm;

            role.GoToMap("世界");
            role.CloseWindow();
            dm.Delay(1000);
            if (Dm.IsExistPic(862, 454, 961, 537, @"\bmp\菜单打开.bmp"))
            {
                Delegater.WaitTrue(() => Dm.FindPicAndClick(862, 454, 961, 537, @"\bmp\菜单打开.bmp"),
                                   () => Dm.IsExistPic(862, 454, 961, 537, @"\bmp\菜单未打开.bmp"),
                                   () => Dm.Delay(1000), 2000);
            }
            role.OpenMap();

            int intX, intY;

            while (true)
            {
                dm.FindStr(75, 246, 227, 296, "军资奖励", "44.34.64-10.10.25", 0.9, out intX, out intY);
                if (intX > 0 && intY > 0)
                {
                    role.OutSubMessage("领取军资...");
                    dm.MoveToClick(156, 420);
                    dm.Delay(50);
                    if (dm.GetColorNum(157, 242, 227, 293, "f60000-101010", 0.9) > 5)
                    {
                        role.OutSubMessage("军资已经领取完成,正在冷却!");
                        break;
                    }
                    dm.Delay(300);
                }
                else
                {
                    role.OutSubMessage("找不到军资奖励");
                    break;
                }
            }

            role.CloseMap();

            return(TaskResult.Success);
        }
Пример #5
0
        private bool FeiliuLogin(Account account, Role role)
        {
            DmPlugin        Dm          = role.Window.Dm;
            YeShenSimulator ysSimulator = SoftContext.YeShenSimulatorList.FirstOrDefault(x => x.NoxHwnd == role.Hwnd);
            string          noxPath     = "";

            if (File.Exists(@"E:\nox\Nox\bin\nox_adb.exe"))
            {
                noxPath = @"E:\nox\Nox\bin\";
            }
            if (File.Exists(@"E:\Nox\bin\nox_adb.exe"))
            {
                noxPath = @"E:\Nox\bin\";
            }
            string result = CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + @" shell dumpsys window w|findstr \/|findstr name=");

            result = result.Replace("mSurface=Surface(name=", "").Replace(")", "");
            //com.regin.gcld.fl/com.regin.gcld.fl.gcld
            if (result.IndexOf("gcld") > 0) //当前应用程序是攻城掠地
            {
                int index = result.IndexOf('/');
                CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell am force-stop " + result.Remove(index, result.Length - index));
                Dm.Delay(5000);
            }
            switch (account.Platform)
            {
            case Platform.飞流:
                CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell am start -n com.regin.gcld.fl/.gcld");
                Delegater.WaitTrue(() => Dm.IsExistPic(279, 37, 476, 100, @"\bmp\飞流帐号登录.bmp", 0.9), () => Dm.Delay(1000), 20);
                Dm.Delay(1000);
                if (Dm.IsExistPic(279, 37, 476, 100, @"\bmp\飞流帐号登录.bmp", 0.9))
                {
                    Dm.Delay(1000);
                    Dm.MoveToClick(562, 156);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(292, 121, 414, 176, "ffffff-101010", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(string.Format("{0}nox_adb -s {1} shell input keyevent 67", noxPath, ysSimulator.AdbDevicesId));
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }

                    CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.UserName + "\"");
                    Dm.Delay(1000);
                    Dm.MoveToClick(577, 218);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(290, 192, 444, 245, "ffffff-101010", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell input keyevent 67");
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }
                    CmdHelper.ExecuteCmd(noxPath + "nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.Password + "\"");
                    Dm.Delay(1000);
                    Dm.FindPicAndClick(413, 279, 543, 348, @"\bmp\登录.bmp");

                    return(Delegater.WaitTrue(() => {
                        if (Dm.IsExistPic(818, 281, 953, 447, @"\bmp\世界.bmp") || Dm.IsExistPic(818, 281, 953, 447, @"\bmp\副本.bmp"))
                        {
                            while (Dm.IsExistPic(406, 378, 557, 432, @"\bmp\以后再说.bmp", 0.8))
                            {
                                Dm.MoveToClick(544, 414);
                                Dm.Delay(1000);
                            }
                            Dm.Delay(1000);
                            return true;
                        }
                        return false;
                    }, () => Dm.Delay(1000), 25));
                }
                break;

            case Platform.楚游:
                CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell am start -n com.regin.gcld.sy/.gcld");
                Delegater.WaitTrue(() => Dm.GetColorNum(113, 288, 193, 317, "f6c246-202020", 0.9) > 1000, () => Dm.Delay(1000), 20);
                Dm.Delay(1000);
                if (Dm.GetColorNum(113, 288, 193, 317, "f6c246-202020", 0.9) > 1000)
                {
                    Dm.Delay(1000);
                    Dm.MoveToClick(233, 203);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(67, 187, 210, 216, "242424-202030", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(string.Format("{0}nox_adb -s {1} shell input keyevent 67", noxPath, ysSimulator.AdbDevicesId));
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }
                    CmdHelper.ExecuteCmd(noxPath + @"nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.UserName + "\"");
                    Dm.Delay(1000);
                    Dm.MoveToClick(235, 246);
                    Dm.Delay(500);
                    for (int i = 0; i < 20; i++)
                    {
                        if (Dm.GetColorNum(70, 230, 209, 263, "242424-202030", 0.9) > 5)
                        {
                            CmdHelper.ExecuteCmd(string.Format("{0}nox_adb -s {1} shell input keyevent 67", noxPath, ysSimulator.AdbDevicesId));
                            Dm.Delay(200);
                        }
                        else
                        {
                            break;
                        }
                    }
                    CmdHelper.ExecuteCmd(noxPath + "nox_adb -s " + ysSimulator.AdbDevicesId + " shell input text \"" + account.Password + "\"");
                    Dm.Delay(500);
                    Dm.MoveToClick(149, 302);

                    return(Delegater.WaitTrue(() => {
                        if (Dm.IsExistPic(818, 281, 953, 447, @"\bmp\世界.bmp") || Dm.IsExistPic(818, 281, 953, 447, @"\bmp\副本.bmp"))
                        {
                            //while (Dm.IsExistPic(406, 378, 557, 432, @"\bmp\以后再说.bmp", 0.8))
                            //{
                            //    Dm.MoveToClick(544, 414);
                            //    Dm.Delay(1000);
                            //}
                            //Dm.Delay(1000);
                            return true;
                        }
                        return false;
                    }, () => Dm.Delay(1000), 25));
                }
                break;
            }
            return(false);
        }