Пример #1
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_商城);

            // 购买所有可以使用粮食和银币购买的东西
            var itemRects = new List <WxRect>
            {
                new WxRect(262, 301, 332, 327),
                new WxRect(411, 304, 472, 325),
                new WxRect(551, 304, 619, 326),
                new WxRect(266, 418, 329, 439),
                new WxRect(408, 417, 474, 440),
                new WxRect(556, 417, 617, 442)
            };

            foreach (var rect in itemRects)
            {
                if (WlyUtilityBiz.GetAmount(dmGuid, rect, "ffffff-000000", out var _))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(rect.Left, rect.Top));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(415, 470));

                    if (DMService.Instance.FindStr(dmGuid, new WxRect(434, 338, 473, 366), "确定", WlyColor.Normal))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(459, 311));
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(457, 351));
                    }
                }
            }

            return(new WlyTaskInfo(ID, true));
        }
Пример #2
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(5000);

            // 计算助威人数
            WlyUtilityBiz.GetAmount(dmGuid, new WxRect(330, 369, 365, 383), "ebe9cf-101010", out var count1);
            WlyUtilityBiz.GetAmount(dmGuid, new WxRect(340, 421, 364, 434), "ebe9cf-101010", out var count2);

            // 上面数字大就助威上面,下面大助威下面
            var target = count1 >= count2 ? new WxPoint(404, 371) : new WxPoint(405, 423);

            DMService.Instance.LeftClick(dmGuid, target);
            DMService.Instance.LeftClick(dmGuid, target);
            DMService.Instance.LeftClick(dmGuid, target);
            DMService.Instance.LeftClick(dmGuid, target);

            // 助威
            DMService.Instance.LeftClick(dmGuid, new WxPoint(515, 553));

            // 确定
            DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 332));

            // 退出
            DMService.Instance.LeftClick(dmGuid, new WxPoint(911, 549));
            return(new WlyTaskInfo(ID, true));
        }
Пример #3
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_商城);

            DMService.Instance.LeftClick(dmGuid, new WxPoint(559, 468));
            var costStr = string.Empty;
            var wait    = FlowLogicHelper.RepeatRun(() =>
            {
                costStr = DMService.Instance.GetWords(dmGuid, new WxRect(473, 265, 518, 285), "ffff00-101010");
                return(costStr.Contains("金币"));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                throw new InvalidOperationException("无法确认商城刷新的花费");
            }

            if (costStr == "10金币")
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(460, 357), TimeSpan.FromSeconds(2));

                // 购买所有可以使用粮食和银币购买的东西
                var itemRects = new List <WxRect>
                {
                    new WxRect(262, 301, 332, 327),
                    new WxRect(411, 304, 472, 325),
                    new WxRect(551, 304, 619, 326),
                    new WxRect(266, 418, 329, 439),
                    new WxRect(408, 417, 474, 440),
                    new WxRect(556, 417, 617, 442)
                };

                foreach (var rect in itemRects)
                {
                    if (WlyUtilityBiz.GetAmount(dmGuid, rect, "ffffff-000000", out var _))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(rect.Left, rect.Top));
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(415, 470));

                        if (DMService.Instance.FindStr(dmGuid, new WxRect(434, 338, 473, 366), "确定", WlyColor.Normal))
                        {
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(459, 311));
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(457, 351));
                        }
                    }
                }
            }
            else
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(547, 353));
            }

            return(new WlyTaskInfo(ID, 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(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));
        }
Пример #5
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);
            if (DMService.Instance.FindColor(dmGuid, "ff0000-000000", new WxRect(436, 470, 486, 484)))
            {
                return(new WlyTaskInfo(ID, true));
            }

            FlowLogicHelper.RepeatRun(() =>
            {
                if (!DMService.Instance.FindStr(dmGuid, new WxRect(108, 207, 174, 229), "查看奖励", "ffcc00-000000"))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(141, 214));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 330));
                    return(false);
                }

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

            if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(167, 156, 219, 175), "ff9900-000000", out var amount))
            {
                entity.AccountInfo.FightPoint = amount;
            }

            var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(366, 268, 401, 289), WlyColor.White, out var targetLevel);

            if (result && targetLevel > entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level)
            {
                return(new WlyTaskInfo(ID, true));
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(621, 558));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(455, 330));

            DMService.Instance.LeftClick(dmGuid, new WxPoint(499, 386));
            var enemy = DMService.Instance.GetWords(dmGuid, new WxRect(323, 247, 383, 269), "ffffff-000000");

            if (enemy.Contains("海潮"))
            {
                return(new WlyTaskInfo(ID, true));
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(354, 325));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 328));

            // 直接结束,不再等待
            throw new InvalidOperationException();
        }
Пример #6
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_主公属性);

            // 升级经济
            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(375, 160));
                return(DMService.Instance.FindStr(dmGuid, new WxRect(485, 188, 518, 206), "经济", "ffcc00-000000"));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                throw new InvalidOperationException("无法打开主公属性经济");
            }

            var key    = false;
            var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(659, 304, 710, 329), WlyColor.White, out var amount);

            if (result && (amount > 0))
            {
                key = true;
            }

            //result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(663, 355, 705, 379), WlyColor.White, out amount);
            //if (result && (amount > 0))
            //{
            //    key = true;
            //}

            //result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(662, 409, 706, 432), WlyColor.White, out amount);
            //if (result && (amount > 0))
            //{
            //    key = true;
            //}

            if (key)
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(507, 474));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 331));
                entity.AccountInfo.ResetMainLevel();
                entity.AccountInfo.Save();
                throw new InvalidOperationException();
            }

            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.功能_生产);
            Thread.Sleep(1000);

            // 勾选使用3金币进行暴击
            if (!DMService.Instance.FindColor(dmGuid, WlyColor.Normal, new WxRect(534, 236, 566, 255)))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(520, 245));
            }

            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(575, 420, 599, 437), "f3f3da-000000", out var amount);
                if (result && (amount == 0))
                {
                    return(true);
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(458, 260, 521, 294), "金币", "ffff00-000000"))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(545, 357));
                }

                FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(554, 457), TimeSpan.FromMilliseconds(200)), amount);
                Thread.Sleep(1000);
                return(false);
            }, TimeSpan.FromSeconds(30));

            if (wait)
            {
                Thread.Sleep(1000);
                if (DMService.Instance.FindStr(dmGuid, new WxRect(531, 342, 561, 364), "取消", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(548, 353));
                }

                // 卖出商品
                DMService.Instance.LeftClick(dmGuid, new WxPoint(710, 456));

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

            return(new WlyTaskInfo(ID, DateTime.Now.AddHours(1)));
        }
Пример #8
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_委派);

            // 主城等级大于100时自动卖出
            if (entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level >= 100)
            {
                // 设置自动卖出
                DMService.Instance.LeftClick(dmGuid, new WxPoint(251, 473));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(442, 341));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(493, 395));
            }

            // 开始委派
            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(294, 429, 312, 449), "fce69a-000000", out var count) && (count == 0))
                {
                    return(true);
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(524, 338, 569, 367), "取消", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(548, 351));
                }

                FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(257, 368), TimeSpan.FromMilliseconds(200)), count);
                Thread.Sleep(1000);
                return(false);
            }, TimeSpan.FromSeconds(30));

            if (DMService.Instance.FindStr(dmGuid, new WxRect(483, 384, 517, 409), "免费", "ffff00-000000"))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(496, 367));
            }

            if (wait)
            {
                return(new WlyTaskInfo(ID, true));
            }

            return(new WlyTaskInfo(ID, DateTime.Now.Add(TimeSpan.FromMinutes(30))));
        }
Пример #9
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);
            if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(642, 561, 663, 588), "31f101-000000", out var count) && (count == 0))
            {
                return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(30)));
            }

            var targets = DMService.Instance.FindPics(dmGuid, WlyPicType.打劫目标, new WxRect(110, 179, 931, 536));

            foreach (var target in targets)
            {
                DMService.Instance.LeftClick(dmGuid, target);
                var wait = DMService.Instance.FindStr(dmGuid, new WxRect(110, 179, 931, 536), "名称", WlyColor.Normal, out var x, out var y);
                if (!wait)
                {
                    continue;
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(x - 5, y - 5, x + 150, y + 50), "墨君", WlyColor.White))
                {
                    var nextTime = WlyUtilityBiz.GetTime(dmGuid, new WxRect(x, y, x + 100, y + 100), WlyColor.Selected);
                    if (nextTime == TimeSpan.Zero)
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(706, 577));
                        nextTime = TimeSpan.FromMinutes(10);
                    }

                    if (DMService.Instance.FindStr(dmGuid, new WxRect(480, 318, 519, 342), "确定", WlyColor.Normal))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(499, 331));
                    }

                    return(new WlyTaskInfo(ID, DateTime.Now.Add(nextTime)));
                }
            }

            return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(30)));
        }
Пример #10
0
        /// <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);
        }
Пример #11
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);
            while (true)
            {
                if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(324, 498, 339, 520), "e9e7cf-000000", out var amount) && (amount == 0))
                {
                    break;
                }

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

            return(new WlyTaskInfo(ID, true));
        }
Пример #12
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);
            FlowLogicHelper.RepeatRun(() =>
            {
                // 计算次数
                if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(466, 526, 477, 541), WlyColor.Normal, out var count) && (count == 0))
                {
                    return(true);
                }

                // 首先检测是否有特殊人物
                if (Special(entity))
                {
                }
                else if (DMService.Instance.FindStr(dmGuid, new WxRect(554, 576, 617, 599), "免费使用", "ff6600-000000"))
                {
                    // 检测是否可以免费喝酒
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(584, 565));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 331), TimeSpan.FromSeconds(1));
                }
                else if (DMService.Instance.FindStr(dmGuid, new WxRect(414, 575, 472, 599), "免费使用", "ff6600-000000"))
                {
                    // 检测是否可以免费另寻他城
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(445, 563));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 331), TimeSpan.FromSeconds(1));
                }
                else
                {
                    // 直接点击
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(89, 116));
                }

                return(false);
            }, TimeSpan.FromSeconds(30));
            return(new WlyTaskInfo(ID, true));
        }
Пример #13
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var now = DateTime.Now;

            if (now.DayOfWeek == DayOfWeek.Sunday && now.Hour >= 4 && now.Hour < 21)
            {
                return(new WlyTaskInfo(ID, DateTime.Now.Add(DateTime.Today.AddHours(21) - now)));
            }

            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_国政);

            // 点开国库
            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(97, 194));
                if (DMService.Instance.FindStr(dmGuid, new WxRect(483, 100, 516, 120), "国政", WlyColor.Normal))
                {
                    return(true);
                }

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

            if (!wait)
            {
                throw new InvalidOperationException();
            }

            Thread.Sleep(1000);
            var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(635, 433, 672, 450), "ffff99-000000", out var amount);

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

            var wish  = (WlyUtilityBiz.GetRefreshTime() - DateTime.Now).Hours * 20;
            var count = Math.Min((1000 - amount - wish) / 2, 10);

            count = Math.Max(0, count);

            // 点击加号开始捐献
            for (var i = 0; i < count; i++)
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(653, 470));
                if (DMService.Instance.FindStr(dmGuid, new WxRect(531, 278, 562, 304), "不足", "e9e7cf-000000"))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(501, 332));
                    break;
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(437, 343, 473, 364), "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(459, 312));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(452, 357));
                }
            }

            // 领取官职奖励
            DMService.Instance.LeftClick(dmGuid, new WxPoint(373, 162));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(746, 477));

            return(new WlyTaskInfo(ID, true));
        }
Пример #14
0
        /// <summary>
        /// 升级主公属性
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <returns></returns>
        public static bool Upgrade(string dmGuid)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_主公属性);

            // 升级进攻
            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(220, 157));
                return(DMService.Instance.FindStr(dmGuid, new WxRect(485, 188, 518, 206), "进攻", "ffcc00-000000"));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                throw new InvalidOperationException("无法打开主公属性进攻");
            }

            while (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(506, 210, 536, 228), "66ff00-000000", out var _))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(750, 265));
            }

            // 升级防御
            wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(296, 158));
                return(DMService.Instance.FindStr(dmGuid, new WxRect(485, 188, 518, 206), "防御", "ffcc00-000000"));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                throw new InvalidOperationException("无法打开主公属性防御");
            }

            while (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(506, 210, 536, 228), "66ff00-000000", out var _))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(751, 420));
            }

            // 升级经济
            wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(375, 160));
                return(DMService.Instance.FindStr(dmGuid, new WxRect(485, 188, 518, 206), "经济", "ffcc00-000000"));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                throw new InvalidOperationException("无法打开主公属性经济");
            }

            while (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(506, 210, 536, 228), "66ff00-000000", out var _))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(745, 264));
            }

            // 升级通用
            wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(452, 160));
                return(DMService.Instance.FindStr(dmGuid, new WxRect(485, 188, 518, 206), "通用", "ffcc00-000000"));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                throw new InvalidOperationException("无法打开主公属性通用");
            }

            while (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(506, 210, 536, 228), "66ff00-000000", out var _))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(750, 420));
            }

            return(true);
        }
Пример #15
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var amount = 0;

            if (DateTime.Today.DayOfWeek == DayOfWeek.Sunday)
            {
                if (DateTime.Now.Hour < 20)
                {
                    return(new WlyTaskInfo(ID, DateTime.Today.AddHours(20).AddMinutes(30)));
                }
            }

            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主界面);

            // 获取银子数量
            var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(133, 26, 217, 47), "f3f3da-000000", out amount);

            if (!result)
            {
                throw new InvalidOperationException("Cannot Get Money Amount");
            }

            if (amount < 30000000)
            {
                return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime()));
            }

            // 捐款2600万获取100政绩
            WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_国政);

            // 点开内政
            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(95, 42));
                if (DMService.Instance.FindStr(dmGuid, new WxRect(483, 100, 516, 120), "国政", WlyColor.Normal))
                {
                    return(true);
                }

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

            if (!wait)
            {
                throw new InvalidOperationException();
            }

            // 捐款
            DMService.Instance.LeftClick(dmGuid, new WxPoint(613, 438));
            DMService.Instance.SendString(dmGuid, entity.WndHwnd, "13000000");

            wait = FlowLogicHelper.RepeatRun(() =>
            {
                if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(577, 429, 671, 447), "e7e7fd-000000", out amount))
                {
                    return(true);
                }

                Thread.Sleep(500);
                return(false);
            }, TimeSpan.FromSeconds(10));
            if (!wait)
            {
                throw new InvalidOperationException();
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(739, 438));
            return(new WlyTaskInfo(ID, true));
        }
Пример #16
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            // 前往海盗活动界面
            WlyViewMgr.GoTo(dmGuid, WlyViewType.日常_海盗);

            if (DMService.Instance.FindStr(dmGuid, new WxRect(523, 280, 559, 299), "海战", "e9e7cf-000000"))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 331));
                return(new WlyTaskInfo(ID, true));
            }

            // 等待活动开始
            var startRect = new WxRect(7, 223, 65, 244);
            var wait      = FlowLogicHelper.RepeatRun(() =>
            {
                Thread.Sleep(400);
                return(DMService.Instance.FindStr(dmGuid, startRect, "剩余时间", "ffff00-101010"));
            }, TimeSpan.FromMinutes(1));

            if (!wait)
            {
                throw new InvalidOperationException("海盗活动未正常开始");
            }

            // 剩余时间
            var lastTimeRect = new WxRect(66, 226, 105, 245);

            // 冷却时间
            var coolTimeRect = new WxRect(65, 205, 105, 224);

            // 得到的分数
            var pointRect = new WxRect(972, 94, 994, 113);

            // 活动结束
            var finalRect = new WxRect(488, 416, 522, 438);

            // 攻击
            void Attack()
            {
                var fr = DMService.Instance.FindPic(dmGuid, WlyPicType.超强炮舰, WlyUtilityBiz.GameWndRect, out var xx, out var yy);

                if (fr)
                {
                    var p = new WxPoint(xx, yy);
                    DMService.Instance.LeftClick(dmGuid, p);
                }

                Thread.Sleep(100);

                // 如果需要金币进行冷却,则确定
                var r = new WxRect(436, 342, 472, 365);

                if (DMService.Instance.FindStr(dmGuid, r, "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 354));
                }
            }

            // 活动运行
            bool Run()
            {
                var lt = WlyUtilityBiz.GetTime(dmGuid, lastTimeRect, "ffffff-000000");
                var ct = WlyUtilityBiz.GetTime(dmGuid, coolTimeRect, "ffffff-000000");

                // 冷却时间到,开始攻击
                if (ct == TimeSpan.Zero)
                {
                    Attack();
                }
                else
                {
                    // 计算已经得到的分数,确定是否需要进行强攻
                    WlyUtilityBiz.GetAmount(dmGuid, pointRect, "ffffff-000000", out var point);
                    var times = point / 33;

                    // 需要在1分30秒之前完成10次攻打
                    if (lt.Add(TimeSpan.FromSeconds(30 * times)) < TimeSpan.FromMinutes(6).Add(TimeSpan.FromSeconds(30)))
                    {
                        Attack();
                    }
                    else
                    {
                        // 等待冷却完成
                        Thread.Sleep(ct.Add(TimeSpan.FromMilliseconds(100)));
                    }
                }

                // 检测活动是否结束
                if (DMService.Instance.FindStr(dmGuid, finalRect, "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(505, 430));
                    return(true);
                }

                return(false);
            }

            // 开始攻打海盗
            FlowLogicHelper.RepeatRun(Run, TimeSpan.FromMinutes(7));
            return(new WlyTaskInfo(ID, true));
        }
Пример #17
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyEntityBiz.UpgradeAllEquipmenets(entity);
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_试炼塔);
            Thread.Sleep(2000);

            // 检测当前的层数
            var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(237, 468, 256, 486), "ffffff-000000", out var level);

            if (!result)
            {
                throw new InvalidOperationException();
            }

            var current = 0;

            for (var i = (10 * (level - 1)) + 1; i <= level * 10; i++)
            {
                if (!DMService.Instance.FindStr(dmGuid, new WxRect(195, 201, 278, 455), $"第{i}层", "e9e7cf-000000", WlyColor.Normal))
                {
                    break;
                }

                current = i;
            }

            // 大于指定层时表示完成推塔
            if (current > m_floor)
            {
                return(new WlyTaskInfo(ID, true));
            }

            int x = 0;
            int y = 0;

            while (current <= m_floor)
            {
                // 开始推塔
                FlowLogicHelper.RepeatRun(() =>
                {
                    if (DMService.Instance.FindStr(dmGuid, new WxRect(195, 201, 278, 455), $"第{current}层", WlyColor.Normal))
                    {
                        return(true);
                    }

                    DMService.Instance.FindStr(dmGuid, new WxRect(195, 201, 278, 455), $"第{current}层", "e9e7cf-000000", out x, out y);
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(x + 5, y + 5));
                    return(true);
                }, TimeSpan.FromSeconds(10));

                DMService.Instance.LeftClick(dmGuid, new WxPoint(367, 470));
                DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 328));

                // 等待进入塔中
                var wait = FlowLogicHelper.RepeatRun(() =>
                {
                    if (DMService.Instance.FindStr(dmGuid, new WxRect(480, 4, 519, 30), $"第{current}层", "ffff00-000000"))
                    {
                        return(true);
                    }

                    Thread.Sleep(500);
                    return(false);
                }, TimeSpan.FromSeconds(10));
                if (!wait)
                {
                    throw new InvalidOperationException();
                }

                if (!DMService.Instance.FindColor(dmGuid, WlyColor.Normal, new WxRect(636, 553, 688, 578)))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(650, 566));
                }

                if (DMService.Instance.FindColor(dmGuid, WlyColor.Normal, new WxRect(813, 550, 906, 580)))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(846, 568));
                }

                // 等待结果
                var key = false;
                wait = FlowLogicHelper.RepeatRun(() =>
                {
                    // 点击进攻
                    if (DMService.Instance.FindPic(dmGuid, WlyPicType.试炼塔目标, WlyUtilityBiz.GameWndRect, out var xx, out var yy))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(xx, yy));
                    }

                    if (DMService.Instance.FindStr(dmGuid, new WxRect(523, 393, 558, 422), "退出", "e9e7cf-000000"))
                    {
                        key = true;
                        return(true);
                    }

                    Thread.Sleep(2000);
                    return(false);
                }, TimeSpan.FromSeconds(30));
                if (!wait)
                {
                    throw new InvalidOperationException();
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(452, 390, 492, 422), "挑战", "e9e7cf-000000"))
                {
                    key = false;
                }

                if (key)
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(540, 409));
                    WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_试炼塔);
                    if ((current % 10) == 0)
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(290, 475));
                    }

                    current++;
                }
                else
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(540, 409));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(452, 331));
                    return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime().AddDays(3)));
                }
            }

            return(new WlyTaskInfo(ID, true));
        }
Пример #18
0
        protected override void InternalAfterLogin()
        {
            SubTaskMgr.Instance.InitEntityTasks(this);
            m_loginFlag = true;

            if (!m_subAccountInfo.Check)
            {
                var wait = FlowLogicHelper.RepeatRun(() =>
                {
                    var view  = WlyViewMgr.GetView(WlyViewType.略_防沉迷验证);
                    var view1 = WlyViewMgr.GetView(WlyViewType.略_跳过);
                    return(DMService.Instance.FindPic(DMGuid, WlyPicType.择国家, WlyUtilityBiz.GameWndRect) || view.IsCurrentView(DMGuid) ||
                           view1.IsCurrentView(DMGuid));
                }, TimeSpan.FromSeconds(30));
                if (wait && DMService.Instance.FindPic(DMGuid, WlyPicType.择国家, WlyUtilityBiz.GameWndRect))
                {
                    CreateRole(AutoPlayerVM.Instance.GetAvailableName());
                }
            }

            WxLog.Debug($"SubEntity.InternalAfterLogin AutoPlay Start <{m_subAccountInfo.Name}>");

            // 先检测主公等级
            var level = WlyUtilityBiz.GetMainLevel(DMGuid);

            if (level > m_subAccountInfo.Level)
            {
                WlyMainLevelMgr.Upgrade(DMGuid);
                m_subAccountInfo.Level = level;
                m_subAccountInfo.Save();
            }

            // 检测银币数量是否到达上限
            var result = WlyUtilityBiz.GetPercent(DMGuid, new WxRect(133, 26, 217, 47), "f3f3da-000000", out var percent);

            if (!result)
            {
                throw new InvalidOperationException("Cannot Get Money Amount");
            }

            // 银币超过上限了,想尽办法进行使用
            if (percent >= 0.9)
            {
                GetEuqipments();
                UpgradeEquipments();
            }

            // 如果可以捐国政了,则捐国政
            var now       = DateTime.Now;
            var timeNotOK = (now.DayOfWeek == DayOfWeek.Sunday) && (now.Hour >= 4) && (now.Hour < 21);

            if ((percent >= 0.5) && (m_subAccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level >= 130) && !timeNotOK)
            {
                // 捐款2600万获取100政绩
                WlyViewMgr.GoTo(DMGuid, WlyViewType.场景_国政);

                // 点开内政
                var wait = FlowLogicHelper.RepeatRun(() =>
                {
                    DMService.Instance.LeftClick(DMGuid, new WxPoint(95, 42));
                    if (DMService.Instance.FindStr(DMGuid, new WxRect(483, 100, 516, 120), "国政", WlyColor.Normal))
                    {
                        return(true);
                    }

                    Thread.Sleep(500);
                    return(false);
                }, TimeSpan.FromSeconds(10));
                if (!wait)
                {
                    throw new InvalidOperationException();
                }

                // 捐款铸造
                DMService.Instance.LeftClick(DMGuid, new WxPoint(560, 270));
                DMService.Instance.LeftClick(DMGuid, new WxPoint(613, 438));
                DMService.Instance.SendString(DMGuid, WndHwnd, "50000000");

                wait = FlowLogicHelper.RepeatRun(() =>
                {
                    if (WlyUtilityBiz.GetAmount(DMGuid, new WxRect(577, 429, 671, 447), "e7e7fd-000000", out var amount))
                    {
                        return(true);
                    }

                    Thread.Sleep(500);
                    return(false);
                }, TimeSpan.FromSeconds(10));
                if (!wait)
                {
                    throw new InvalidOperationException();
                }

                DMService.Instance.LeftClick(DMGuid, new WxPoint(739, 438));
            }

            // 如果可以进行开发,则马上开发并立刻结束
            //if (DevelopTime < DateTime.Now)
            //{
            //    WlyUtilityBiz.GetAmount(DMGuid, new WxRect(133, 26, 217, 47), "f3f3da-000000", out var amount);
            //    if (amount > 500000)
            //    {
            //        DevelopCity();
            //        //Stop();
            //    }
            //}
        }
Пример #19
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));
        }