Ejemplo n.º 1
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(400);

            // 获取剩余次数
            var countRect = new WxRect(614, 424, 634, 442);

            if (WlyUtilityBiz.GetAmount(dmGuid, countRect, WlyColor.Normal, out var count) && (count == 0))
            {
                WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(30));
                return(new WlyTaskInfo(ID, true));
            }

            // 开始一键探险
            DMService.Instance.LeftClick(dmGuid, new WxPoint(567, 392));
            var wait = SpinWait.SpinUntil(() =>
            {
                Thread.Sleep(1000);
                return(DMService.Instance.FindStr(dmGuid, new WxRect(549, 487, 587, 513), "扫荡", WlyColor.Normal));
            }, TimeSpan.FromSeconds(10));

            if (!wait)
            {
                return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(1)));
            }

            // 勾上选项
            DMService.Instance.LeftClick(dmGuid, new WxPoint(422, 214));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(439, 237));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(423, 420));
            //DMService.Instance.LeftClick(dmGuid, new WxPoint(421, 444));

            // 开始扫荡
            DMService.Instance.LeftClick(dmGuid, new WxPoint(557, 501));

            // 等待扫荡结束
            wait = SpinWait.SpinUntil(() =>
            {
                Thread.Sleep(1000);
                return(DMService.Instance.FindStr(dmGuid, new WxRect(447, 477, 515, 501), "已完成全部", "ff3300-000000"));
            }, TimeSpan.FromSeconds(60));
            if (!wait)
            {
                return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(1)));
            }

            // 完成古城探秘
            DMService.Instance.LeftClick(dmGuid, new WxPoint(763, 126));
            Thread.Sleep(400);
            WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(30));
            return(new WlyTaskInfo(ID, DateTime.Now));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_仓库);

            var startX = 215;
            var startY = 233;
            var column = 8;
            var row    = 3;
            var width  = 56;
            var height = 56;

            var key = true;

            while (key)
            {
                for (var r = 0; r < row; r++)
                {
                    for (var c = 0; c < column; c++)
                    {
                        var x = startX + (c * width);
                        var y = startY + (r * height);

                        if (DMService.Instance.FindColor(dmGuid, "17201d-000000", new WxRect(new WxPoint(x, y), 10, 10)))
                        {
                            continue;
                        }

                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                        if (DMService.Instance.FindStr(dmGuid, new WxRect(438, 259, 468, 277), "仓库", "e9e7cf-000000"))
                        {
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(547, 356));
                            key = false;
                            r   = row;
                            break;
                        }

                        while (WlyEquipMgr.IsEquipment(dmGuid, new WxRect(712, 339, 808, 358)))
                        {
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(412, 419));
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 328));
                        }
                    }
                }

                if (key)
                {
                    for (var count = 0; count < 10; count++)
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(653, 378), TimeSpan.FromMilliseconds(100));
                    }
                }
            }

            // 退出,重新进入,进行一键领取
            WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(5));
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_仓库);
            DMService.Instance.LeftClick(dmGuid, new WxPoint(startX, startY));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 452));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 452));

            // 将器合成
            DMService.Instance.LeftClick(dmGuid, new WxPoint(609, 159));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(365, 467));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(451, 330));

            return(new WlyTaskInfo(ID, true));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 寻找首攻
        /// </summary>
        private bool FindFirstAttack()
        {
            // 处理加入失败,关闭军团战界面,防止被bug消耗军令
            var view = WlyViewMgr.GetView(WlyViewType.略_加入失败);

            if (view.IsCurrentView(DMGuid))
            {
                view.Exit(DMGuid);
                WlyViewMgr.ExitCurrentView(DMGuid, TimeSpan.FromSeconds(5));
            }

            // 组队框
            var teamRect = new WxRect(632, 206, 807, 449);

            string GetTargetStr()
            {
                if (AccountInfo.Point > AccountInfo.PointReserved)
                {
                    return($"加|区|(首|攻)|不耗|首攻|{AccountInfo.SelectedGroupType.ToString()}");
                }

                return("加|区|(首|攻)|不耗|首攻");
            }

            bool Handler()
            {
                // 在聊天框寻找首攻
                var chatRect = new WxRect(0, 470, 277, 600);
                var str      = DMService.Instance.FindStrEx(DMGuid, chatRect, GetTargetStr(), "fff71c-000000|fcffa9-000000|00ff00-000000");

                if (string.IsNullOrEmpty(str))
                {
                    return(false);
                }

                // 字符串分析
                var sp = str.Split('|');

                if (sp.Count(p => p[0] == '0') > 1)
                {
                    // 加字数量过多,需要关闭聊天窗
                    return(false);
                }

                // 激活
                if (sp.Any(p => p[0] == '1'))
                {
                    KeepAlive();
                }

                // 找到了一次军团副本
                if (sp.Any(p => p[0] == '6'))
                {
                    AccountInfo.Point--;
                }

                // 有首攻标识,进行加入
                if (sp.Any(p => int.Parse(p[0].ToString()) > 1))
                {
                    var join = sp.FirstOrDefault(o => o[0] == '0');
                    if (!string.IsNullOrEmpty(join))
                    {
                        var pos   = join.Split(',');
                        var point = new WxPoint(int.Parse(pos[1]) + 5, int.Parse(pos[2]) + 5);
                        DMService.Instance.LeftClick(DMGuid, point, TimeSpan.FromSeconds(2));
                    }
                }

                Thread.Sleep(1000);
                if (DMService.Instance.FindStr(DMGuid, teamRect, "海潮", "e9e7cf-000000"))
                {
                    return(true);
                }

                return(false);
            }

            var result = FlowLogicHelper.RepeatRun(Handler, TimeSpan.FromSeconds(5));

            if (result)
            {
                FlowLogicHelper.RepeatRun(() =>
                {
                    Thread.Sleep(200);
                    return(DMService.Instance.FindStr(DMGuid, teamRect, "海潮", "e9e7cf-000000"));
                }, TimeSpan.FromSeconds(5));
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid    = entity.DMGuid;
            var cityLevel = entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level;

            if (cityLevel <= 80)
            {
                WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_打猎);
                DMService.Instance.LeftClick(dmGuid, new WxPoint(102, 510));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(491, 235));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(746, 405));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(813, 176));
                WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(10));
                WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_打猎);
                Thread.Sleep(1000);
                DMService.Instance.LeftClick(dmGuid, new WxPoint(102, 510));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(491, 235));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(746, 405));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(813, 176));

                var wait = FlowLogicHelper.RepeatRun(() =>
                {
                    if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(324, 498, 339, 520), "e9e7cf-000000", out var amount) && (amount == 0))
                    {
                        return(true);
                    }

                    DMService.Instance.LeftClick(dmGuid, new WxPoint(502, 253));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 352), TimeSpan.FromSeconds(5));

                    WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_打猎);
                    return(false);
                }, TimeSpan.FromSeconds(30));

                if (!wait)
                {
                    throw new InvalidOperationException("打猎未正常完成");
                }

                return(new WlyTaskInfo(ID, true));
            }

            if (cityLevel < 110)
            {
                // 战功大于50的话 直接返回
                var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(274, 47, 321, 72), "f3f3da-000000", out var amount);
                if (!result || (amount >= 500000))
                {
                    return(new WlyTaskInfo(ID, true));
                }
            }

            // 开始打猎
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_打猎);
            Thread.Sleep(1000);
            var ww = FlowLogicHelper.RepeatRun(() =>
            {
                if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(324, 498, 339, 520), "e9e7cf-000000", out var amount) && (amount == 0))
                {
                    return(true);
                }

                DMService.Instance.LeftClick(dmGuid, new WxPoint(502, 253));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 352), TimeSpan.FromSeconds(5));

                WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_打猎);
                return(false);
            }, TimeSpan.FromSeconds(30));

            if (!ww)
            {
                throw new InvalidOperationException("打猎未正常完成");
            }

            return(new WlyTaskInfo(ID, true));
        }