コード例 #1
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var endTime = new DateTime(2018, 7, 16, 4, 0, 0);

            if (DateTime.Now > endTime)
            {
                return(new WlyTaskInfo(ID, true));
            }

            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_厉兵秣马);

            // 领取两个大包厢
            DMService.Instance.LeftClick(dmGuid, new WxPoint(228, 227));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(227, 328));

            // 循环领取七天的奖励
            var start = new WxPoint(375, 177);

            for (var i = 0; i < 7; i++)
            {
                DMService.Instance.LeftClick(dmGuid, start.Shift(70 * i, 0), TimeSpan.FromSeconds(1));
                FlowLogicHelper.RepeatRun(() =>
                {
                    var rect  = new WxRect(733, 290, 790, 312);
                    var point = new WxPoint(761, 299);

                    Thread.Sleep(1000);
                    if (DMService.Instance.FindStr(dmGuid, new WxRect(357, 300, 436, 320), "打猎", "fffdd4-000000"))
                    {
                        rect  = new WxRect(732, 378, 792, 400);
                        point = new WxPoint(759, 388);
                    }

                    if (DMService.Instance.FindStr(dmGuid, rect, "领取奖励", WlyColor.Normal, WlyColor.White))
                    {
                        DMService.Instance.LeftClick(dmGuid, point);
                        return(false);
                    }

                    if (DMService.Instance.FindStr(dmGuid, rect, "前往", WlyColor.Normal))
                    {
                        return(true);
                    }

                    if (DMService.Instance.FindStr(dmGuid, new WxRect(485, 317, 518, 342), "确定", WlyColor.Normal))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(495, 330));
                    }

                    return(false);
                }, TimeSpan.FromSeconds(10));
            }

            return(new WlyTaskInfo(ID, true));
        }
コード例 #2
0
        /// <summary>
        /// 更换指定部位的装备
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <param name="staff"></param>
        /// <param name="type"></param>
        /// <param name="staffLevel"></param>
        public static void ChangeEquipmenet(string dmGuid, WlyStaffType staff, WlyEquipType type, int staffLevel)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_装备);
            WlyUtilityBiz.SelectStaffInList(dmGuid, staff);

            var p = _equipSpaceMap[type];

            DMService.Instance.LeftClick(dmGuid, p);
            var currentInfo = GetEquipInfo(dmGuid);

            var startPoint = new WxPoint(551, 240);

            for (var j = 0; j < 4; j++)
            {
                for (var i = 0; i < 2; i++)
                {
                    var clickPoint = startPoint.Shift(i * 60, j * 60);
                    if (DMService.Instance.FindColor(dmGuid, "0a1215-000000", new WxRect(clickPoint, 10)))
                    {
                        return;
                    }

                    DMService.Instance.LeftClick(dmGuid, clickPoint);
                    var equipInfo = GetEquipInfo(dmGuid);

                    if (equipInfo.EquipLevel > staffLevel)
                    {
                        continue;
                    }

                    // 符合更换条件则进行更换
                    if ((equipInfo.Quality > currentInfo.Quality) ||
                        ((equipInfo.Quality == currentInfo.Quality) && (equipInfo.EquipLevel > currentInfo.EquipLevel)))
                    {
                        // 点击更换
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(590, 473));
                        return;
                    }
                }
            }
        }
コード例 #3
0
ファイル: WlyGroupMgr.cs プロジェクト: wjx123xxx/WorkConfig
        /// <summary>
        /// 升级军团科技
        /// </summary>
        /// <param name="dmGuid"></param>
        public static bool Upgrade(string dmGuid)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_军团科技);

            // 检测科技等级
            var res = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(739, 340, 783, 364), "20ef4c-000000", out var l);

            if (res && (l < 100))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(516, 474));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(609, 476));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(587, 287));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(436, 364));
                return(false);
            }

            var startPoint = new WxPoint(237, 256);

            for (int i = 0; i < 6; i++)
            {
                DMService.Instance.LeftClick(dmGuid, startPoint.Shift(74 * i, 0));

                // 检测科技等级
                var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(739, 340, 783, 364), "20ef4c-000000", out var level);
                if (!result)
                {
                    throw new InvalidOperationException("无法检测到科技等级");
                }

                if (level < 100)
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(516, 474));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(609, 476));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(587, 287));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(436, 364));
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_普通砸罐);
            Thread.Sleep(2000);
            var startPoint = new WxPoint(428, 261);

            while (!DMService.Instance.FindStr(dmGuid, new WxRect(801, 351, 842, 384), "需要", WlyColor.Selected))
            {
                for (var i = 0; i < 2; i++)
                {
                    for (var j = 0; j < 4; j++)
                    {
                        var point = startPoint.Shift(i * 86, j * 88);
                        DMService.Instance.LeftClick(dmGuid, point, TimeSpan.FromMilliseconds(600));
                    }
                }
            }

            return(new WlyTaskInfo(ID, true));
        }
コード例 #5
0
        /// <summary>
        /// 升级科技到指定的策略府等级
        /// </summary>
        /// <param name="level"></param>
        /// <param name="dmGuid"></param>
        public static bool UpgradeTechnology(int level, string dmGuid)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_升级科技);

            var startPoint = new WxPoint(239, 249);

            for (int column = 0; column < 6; column++)
            {
                for (int row = 0; row < 2; row++)
                {
                    DMService.Instance.LeftClick(dmGuid, startPoint.Shift(column * 72, row * 72));
                    if (!FlowLogicHelper.RunToTarget(() =>
                    {
                        var str = DMService.Instance.GetWords(dmGuid, new WxRect(719, 358, 800, 382), "33ffff-000000");
                        return(int.Parse(str.Substring(3, str.Length - 4)));
                    }, current => current > level, () => DMService.Instance.LeftClick(dmGuid, new WxPoint(613, 472))))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
コード例 #6
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_活跃);

            Thread.Sleep(1000);
            DMService.Instance.LeftClick(dmGuid, new WxPoint(756, 361));

            var startPoint = new WxPoint(543, 302);

            for (var i = 0; i < 6; i++)
            {
                DMService.Instance.LeftClick(dmGuid, startPoint.Shift(52 * i, 0), TimeSpan.FromMilliseconds(150));
            }

            startPoint = new WxPoint(270, 441);
            for (var i = 0; i < 7; i++)
            {
                DMService.Instance.LeftClick(dmGuid, startPoint.Shift(86 * i, 0), TimeSpan.FromMilliseconds(100));
            }

            return(new WlyTaskInfo(ID, true));
        }
コード例 #7
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_世界地图);
            FlowLogicHelper.RepeatRun(() =>
            {
                WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主城);
                if (DMService.Instance.FindColor("f7654f-000000|e6b3d2-000000", WlyUtilityBiz.GameWndRect, dmGuid, out var x, out var y))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    return(true);
                }

                Thread.Sleep(500);
                return(false);
            }, TimeSpan.FromSeconds(60));

            var leftRect = new WxRect(436, 138, 563, 496);

            Thread.Sleep(2000);
            if (DMService.Instance.FindStr(dmGuid, new WxRect(467, 94, 537, 125), "辅政大臣", WlyColor.Normal))
            {
                for (var i = 0; i < 4; i++)
                {
                    int x, y;
                    while (DMService.Instance.FindStr(dmGuid, new WxRect(585, 137, 677, 498), "开启", WlyColor.Normal, out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    }

                    if (DMService.Instance.FindStr(dmGuid, leftRect, "征兵", "f3f3da-000000", out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    }

                    if (DMService.Instance.FindStr(dmGuid, new WxRect(582, 139, 634, 497), "暴击率", "f3f3da-000000", out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    }

                    if (DMService.Instance.FindStr(dmGuid, leftRect, "俸禄", "f3f3da-000000", out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    }

                    if (DMService.Instance.FindStr(dmGuid, leftRect, "自动免费", "f3f3da-000000", out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    }

                    if (DMService.Instance.FindStr(dmGuid, leftRect, "自动免费", "f3f3da-000000", out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    }

                    // 设置出航贸易
                    if (DMService.Instance.FindStr(dmGuid, new WxRect(406, 146, 486, 498), "出航贸易", "ffffcc-000000", out x, out y))
                    {
                        var start = new WxPoint(x, y);
                        DMService.Instance.LeftClick(dmGuid, start.Shift(170, 28));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(149, 207));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(170, 53));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(148, 231));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(170, 75));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(148, 60));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(170, 101));
                        DMService.Instance.LeftClick(dmGuid, start.Shift(148, 85));
                    }

                    FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(806, 481), TimeSpan.FromMilliseconds(100)), 18);
                }

                // 保存
                DMService.Instance.LeftClick(dmGuid, new WxPoint(297, 468));
                if (DMService.Instance.FindStr(dmGuid, new WxRect(482, 312, 523, 346), "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(503, 333));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(804, 123));
                    // 保存成功
                    return(new WlyTaskInfo(ID, true));
                }
            }

            // 重启测试
            throw new InvalidOperationException();
        }