示例#1
0
        /// <summary>
        /// 强化装备到指定的等级
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <param name="staff"></param>
        /// <param name="equip"></param>
        /// <param name="targetLevel"></param>
        public static WlyEquipInfo UpgradeEquip(string dmGuid, WlyStaffType staff, WlyEquipType equip, int targetLevel)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_强化装备);
            var result = SelectUpgradeEquipCore(dmGuid, staff, equip);

            if (!result)
            {
                WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(10));
                WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_强化装备);
                result = SelectUpgradeEquipCore(dmGuid, staff, equip);
            }

            if (!result)
            {
                return(new WlyEquipInfo
                {
                    Quality = WlyQualityType.Unknow
                });
            }

            // 点击强化
            FlowLogicHelper.RunToTarget(() => GetEquipLevelCore(dmGuid), current => current >= targetLevel,
                                        () => DMService.Instance.LeftClick(dmGuid, new WxPoint(563, 354), TimeSpan.FromMilliseconds(50)));
            return(GetEquipInfo(dmGuid));
        }
示例#2
0
        /// <summary>
        /// 攻击指定位置的npc,获取攻击结果
        /// </summary>
        /// <param name="point"></param>
        /// <param name="dmGuid"></param>
        /// <returns></returns>
        private static bool?Attack(WxPoint point, string dmGuid)
        {
            var wait = FlowLogicHelper.RepeatRun(() =>
            {
                var v = WlyViewMgr.GetView(WlyViewType.导航_日常按钮栏);
                if (v.IsCurrentView(dmGuid))
                {
                    v.Exit(dmGuid);
                }

                v = WlyViewMgr.GetView(WlyViewType.右侧提示);
                if (v.IsCurrentView(dmGuid))
                {
                    v.Exit(dmGuid);
                }

                v = WlyViewMgr.GetView(WlyViewType.略_点击继续);
                if (v.IsCurrentView(dmGuid))
                {
                    v.Exit(dmGuid);
                }

                Thread.Sleep(100);
                WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_副本);
                DMService.Instance.LeftClick(dmGuid, point);
                return(DMService.Instance.FindStr(dmGuid, new WxRect(556, 290, 608, 318), "攻击", WlyColor.Normal));
            }, TimeSpan.FromSeconds(5));

            if (!wait)
            {
                if (DMService.Instance.FindStr(dmGuid, new WxRect(566, 297, 605, 314), "攻击", "cccccc-000000"))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(638, 183));
                    return(null);
                }

                throw new InvalidOperationException("无法点开NPC");
            }

            // 判断NPC是否已经完成攻击
            if (DMService.Instance.FindStr(dmGuid, new WxRect(587, 401, 624, 422), "战斗", "66ff00-000000"))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(638, 183));
                return(null);
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(584, 304));
            var view = WlyViewMgr.GetView(WlyViewType.场景_战斗);

            wait = FlowLogicHelper.RepeatRun(() =>
            {
                Thread.Sleep(2000);
                return(view.IsCurrentView(dmGuid));
            }, TimeSpan.FromSeconds(30));

            if (!wait)
            {
                throw new InvalidOperationException("无法进去战斗画面");
            }

            //if (!DMService.Instance.FindStr(dmGuid, new WxRect(791, 566, 826, 591), "关闭", "f3f3da-000000"))
            //{
            //    DMService.Instance.LeftClick(dmGuid, new WxPoint(817, 576));
            //}

            // 等待战斗结果
            bool key = true;

            wait = FlowLogicHelper.RepeatRun(() =>
            {
                if (DMService.Instance.FindStr(dmGuid, new WxRect(723, 560, 768, 591), "结果", "f3f3da-000000"))
                {
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(751, 576));
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(439, 205, 560, 238), "获得胜利", "e9e7cf-000000"))
                {
                    return(true);
                }

                if (DMService.Instance.FindStr(dmGuid, new WxRect(517, 211, 552, 234), "失败", "e9e7cf-000000"))
                {
                    key = false;
                    return(true);
                }

                return(false);
            }, TimeSpan.FromSeconds(60));
            if (!wait)
            {
                throw new InvalidOperationException("等待不到战斗结果");
            }

            WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(10));
            return(key);
        }