示例#1
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            if (!entity.AccountInfo.GetSwitchInfo(WlySwitchType.海鲜副本).Enable)
            {
                return(new WlyTaskInfo(ID, true));
            }

            var dmGuid = entity.DMGuid;

            WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_海鲜副本);
            var view = WlyViewMgr.GetView(WlyViewType.导航_日常按钮栏);

            if (view.IsCurrentView(dmGuid))
            {
                view.Exit(dmGuid);
            }

            // 循环执行两分钟
            var startTime = DateTime.Now;

            while (DateTime.Now - startTime < TimeSpan.FromMinutes(2))
            {
                Attack(dmGuid, new WxPoint(803, 441));
            }

            return(new WlyTaskInfo(ID, true));
        }
示例#2
0
        /// <summary>
        /// 程序挂机线程,退出该函数表示本次挂机结束
        /// </summary>
        protected override void InternalBackupWorkThread()
        {
            OnDescriptionChanged("首攻检测");
            var chatView = WlyViewMgr.GetView(WlyViewType.聊天);

            if (chatView.IsCurrentView(DMGuid))
            {
                chatView.Exit(DMGuid);
            }

            WlyUtilityBiz.FreeAttack = true;
            FindFirstAttack();
            WlyUtilityBiz.FreeAttack = false;
        }
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;

            WlyProgressMgr.GoTo(dmGuid, 4);

            // 点开军团
            DMService.Instance.LeftClick(dmGuid, new WxPoint(831, 188), TimeSpan.FromSeconds(1));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(581, 303), TimeSpan.FromSeconds(1));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(724, 475), TimeSpan.FromSeconds(1));

            // 一直死循环点击就行了
            while (true)
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(321, 476), TimeSpan.FromMilliseconds(5200));

                var view = WlyViewMgr.GetView(WlyViewType.略_防沉迷验证);
                if (view.IsCurrentView(dmGuid))
                {
                    view.Exit(dmGuid);
                }
            }
        }
        /// <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(493, 444));

            var wait = FlowLogicHelper.RepeatRun(() => DMService.Instance.FindStr(dmGuid, new WxRect(449, 77, 504, 94), "剩余时间", "00fc39-000000"),
                                                 TimeSpan.FromSeconds(60));

            if (!wait)
            {
                throw new InvalidOperationException("无法进入古代战场");
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(125, 500), TimeSpan.FromSeconds(2));
            if (DMService.Instance.FindStr(dmGuid, new WxRect(331, 373, 360, 393), "战", WlyColor.Normal))
            {
                DMService.Instance.RepeatLeftClick(dmGuid, new WxPoint(344, 382), 6, 10);
                var view = WlyViewMgr.GetView(WlyViewType.场景_战斗);

                FlowLogicHelper.RepeatRun(() =>
                {
                    if (view.IsCurrentView(dmGuid))
                    {
                        view.Exit(dmGuid);
                        return(true);
                    }

                    return(false);
                }, TimeSpan.FromSeconds(30));
                Thread.Sleep(5000);
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(913, 560));
            return(new WlyTaskInfo(ID, true));
        }
示例#5
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();
            //    }
            //}
        }
示例#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 fightView = WlyViewMgr.GetView(WlyViewType.场景_战斗);
            var oldCount  = 0;
            var tryCount  = 0;

            while (true)
            {
                if (DMService.Instance.FindStr(dmGuid, WlyUtilityBiz.GameWndRect, "购买", WlyColor.Normal, out var x, out var y))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 331));
                }

                var countStr = DMService.Instance.GetWords(dmGuid, new WxRect(543, 583, 586, 600), "00ff00-000000");
                if (!string.IsNullOrEmpty(countStr))
                {
                    var count = int.Parse(countStr.Split('/')[0]);
                    if (count == 0)
                    {
                        break;
                    }

                    if (oldCount == count)
                    {
                        tryCount++;
                        if (tryCount >= 10)
                        {
                            throw new InvalidOperationException("可能掉线了游历失败");
                        }
                    }
                    else
                    {
                        oldCount = count;
                        tryCount = 0;
                    }
                }

                if (fightView.IsCurrentView(dmGuid))
                {
                    fightView.Exit(dmGuid);
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(402, 321, 436, 346), "赌场", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(514, 437));
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(613, 440));
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(529, 339, 565, 369), "取消", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(547, 352));
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(478, 337, 521, 372), "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 353));
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(471, 410, 515, 442), "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(494, 428));
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(657, 426, 704, 452), "确定", WlyColor.Normal))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(681, 438));
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(453, 537, 490, 560), "移动", WlyColor.Normal, WlyColor.White))
                {
                    Thread.Sleep(1000);
                    if (DMService.Instance.FindStr(dmGuid, WlyUtilityBiz.GameWndRect, "购买", WlyColor.Normal, out x, out y))
                    {
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y));
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 331));
                    }

                    DMService.Instance.LeftClick(dmGuid, new WxPoint(473, 520), TimeSpan.FromSeconds(2));
                }

                Thread.Sleep(1000);
            }

            return(new WlyTaskInfo(ID, true));
        }
示例#7
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);
        }
示例#8
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            if (m_isInit)
            {
                return;
            }

            m_isInit = true;

            foreach (var type in m_transferHandlers.Keys)
            {
                var view = WlyViewMgr.GetView(type);
                if (view == null)
                {
                    throw new InvalidOperationException($"未定义界面_{type}");
                }

                if (view.Level > Level)
                {
                    view.Level = Level + 1;
                }
            }

            // 构建跳转地图
            foreach (var type in m_transferHandlers.Keys)
            {
                var view = WlyViewMgr.GetView(type);
                if (view == null)
                {
                    throw new InvalidOperationException($"未定义界面_{type}");
                }

                view.Init();
                foreach (var subType in ((WlyUIViewBase)view).m_viewMap.Keys)
                {
                    var v = WlyViewMgr.GetView(subType);
                    if (v.Level <= Level)
                    {
                        continue;
                    }

                    var current = new TransferPath
                    {
                        Target = type,
                        Length = ((WlyUIViewBase)view).m_viewMap[subType].Length + 1
                    };

                    if (m_viewMap.ContainsKey(subType))
                    {
                        var old = m_viewMap[subType];
                        if (old.Length <= current.Length)
                        {
                            continue;
                        }

                        m_viewMap.TryRemove(subType, out var _);
                    }

                    m_viewMap.TryAdd(subType, current);
                }
            }

            m_isInit = true;
        }