Exemple #1
0
        /// <summary>
        /// 获取指定武将指定部位的装备信息
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <param name="staff"></param>
        /// <param name="equipType"></param>
        /// <returns></returns>
        public static WlyEquipInfo GetStaffEquipInfo(string dmGuid, WlyStaffType staff, WlyEquipType equipType)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_装备);
            WlyUtilityBiz.SelectStaffInList(dmGuid, staff);
            DMService.Instance.LeftClick(dmGuid, _equipSpaceMap[equipType], TimeSpan.FromSeconds(1));
            var info = GetEquipInfo(dmGuid);

            return(info);
        }
Exemple #2
0
        public static void UnequipStaff(string dmGuid, WlyStaffType staff, WlyEquipType equipType)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_装备);
            if (!WlyUtilityBiz.SelectStaffInList(dmGuid, staff))
            {
                return;
            }

            // 点击全部卸载
            DMService.Instance.LeftClick(dmGuid, _equipSpaceMap[equipType]);
            DMService.Instance.LeftClick(dmGuid, new WxPoint(460, 469));
        }
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid       = entity.DMGuid;
            var level        = Math.Min(m_level, entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level);
            var currentLevel = WlyStaffMgr.GetStaffLevel(dmGuid, m_staff);
            var growLevel    = WlyStaffMgr.GetStaffGrowLevel(dmGuid, m_staff);

            if (growLevel > level && currentLevel >= level)
            {
                return(new WlyTaskInfo(ID, true));
            }

            // 先尝试一键突飞
            WlyStaffMgr.PractiseStaff(m_staff, dmGuid);
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_训练);
            WlyUtilityBiz.SelectStaffInList(dmGuid, m_staff);
            DMService.Instance.LeftClick(dmGuid, new WxPoint(376, 465));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(418, 398));


            // 如果转生等级大于需求等级,则突飞到需求等级,然后完成培养
            if (growLevel > level)
            {
                //WlyStaffMgr.Upgrade(m_staff, level, dmGuid);
                //var l = entity.AccountInfo.GetStaffInfo(m_staff).Level = WlyStaffMgr.GetStaffLevel(dmGuid, m_staff);

                //if (l == level)
                //{
                //    return new WlyTaskInfo(ID, true);
                //}

                return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime()));
            }

            // 如果离转生等级较近则突飞到指定等级
            if ((currentLevel + 10 >= growLevel) && (currentLevel < growLevel))
            {
                WlyStaffMgr.Upgrade(m_staff, growLevel, dmGuid);
            }
            else
            {
                WlyStaffMgr.PractiseStaff(m_staff, dmGuid);
            }

            // 转生
            WlyStaffMgr.Grow(dmGuid, m_staff);
            entity.AccountInfo.GetStaffInfo(m_staff).Level     = WlyStaffMgr.GetStaffLevel(dmGuid, m_staff);
            entity.AccountInfo.GetStaffInfo(m_staff).GrowLevel = WlyStaffMgr.GetStaffGrowLevel(dmGuid, m_staff);

            return(new WlyTaskInfo(ID, DateTime.Now.Add(TimeSpan.FromHours(10))));
        }
Exemple #4
0
        /// <summary>
        /// 选择武将
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <param name="staff"></param>
        /// <param name="view"></param>
        public static void SelectStaff(string dmGuid, WlyStaffType staff, WlyViewType view)
        {
            // 首先跳转到训练界面
            WlyViewMgr.GoTo(dmGuid, view);
            if (!WlyUtilityBiz.SelectStaffInList(dmGuid, staff))
            {
                GetStaff(dmGuid, staff);
                WlyViewMgr.GoTo(dmGuid, view);
                WlyUtilityBiz.SelectStaffInList(dmGuid, staff);
            }

            if (DMService.Instance.FindStr(dmGuid, new WxRect(529, 321, 562, 341), "取消", WlyColor.Normal))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(546, 329));
            }
        }
Exemple #5
0
        /// <summary>
        /// 武将转职
        /// </summary>
        /// <param name="staff"></param>
        /// <param name="dmGuid"></param>
        public static void Evolve(WlyStaffType staff, string dmGuid)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_武将);
            var result = WlyUtilityBiz.SelectStaffInList(dmGuid, staff);

            if (!result)
            {
                throw new InvalidOperationException($"未能选择到武将{staff.ToString()}");
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(581, 341));
            if (DMService.Instance.FindStr(dmGuid, new WxRect(429, 342, 475, 371), "确定", WlyColor.Normal))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 360));
            }
        }
Exemple #6
0
        /// <summary>
        /// 武将下野
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <param name="staff"></param>
        /// <returns></returns>
        public static bool ThrowStaff(string dmGuid, WlyStaffType staff)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_招募);

            // 无法选中则当做下野已经成功
            if (!WlyUtilityBiz.SelectStaffInList(dmGuid, staff))
            {
                return(true);
            }

            // 点击下野
            DMService.Instance.LeftClick(dmGuid, new WxPoint(270, 476));
            DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 332));

            // 操作确认
            return(!DMService.Instance.FindStr(dmGuid, 总成_武将.武将列表, staff.ToString(), WlyColor.StaffColor));
        }
Exemple #7
0
        /// <summary>
        /// 设置武将兵种类型
        /// </summary>
        /// <param name="staff"></param>
        /// <param name="index"></param>
        /// <param name="dmGuid"></param>
        public static void SetType(WlyStaffType staff, int index, string dmGuid)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_武将);
            if (!WlyUtilityBiz.SelectStaffInList(dmGuid, staff))
            {
                throw new InvalidOperationException($"无法选择到武将{staff}");
            }

            if (index == 1)
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(370, 254));
            }
            else
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(469, 265));
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(459, 340));
        }
Exemple #8
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;
                    }
                }
            }
        }
Exemple #9
0
        /// <summary>
        /// 武将上阵
        /// </summary>
        /// <param name="staff"></param>
        /// <param name="formation"></param>
        /// <param name="index"></param>
        /// <param name="dmGuid"></param>
        public static void SetStaff(WlyStaffType staff, WlyFormationType formation, int index, string dmGuid)
        {
            SetFormation(formation, dmGuid);

            WlyUtilityBiz.SelectStaffInList(dmGuid, staff);
            if (DMService.Instance.FindStr(dmGuid, new WxRect(228, 458, 267, 487), "下阵", WlyColor.Normal))
            {
                DMService.Instance.LeftClick(dmGuid, new WxPoint(251, 471));
                WlyUtilityBiz.SelectStaffInList(dmGuid, staff);
            }

            DMService.Instance.LeftClick(dmGuid, new WxPoint(248, 474));
            DMService.Instance.LeftClick(dmGuid, _locationMap[index]);
            DMService.Instance.LeftClick(dmGuid, new WxPoint(386, 449));

            // 检测
            DMService.Instance.LeftClick(dmGuid, _locationMap[index]);
            var result = DMService.Instance.FindStr(dmGuid, new WxRect(718, 307, 796, 328), staff.ToString(), WlyUtilityBiz.GetStaffQualityStr());

            if (!result)
            {
                throw new InvalidOperationException("武将上阵失败");
            }
        }
Exemple #10
0
        /// <summary>
        /// 为指定英雄卸下装备
        /// </summary>
        /// <param name="dmGuid"></param>
        /// <param name="staff"></param>
        public static bool UnequipStaff(string dmGuid, WlyStaffType staff)
        {
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_装备);
            if (!WlyUtilityBiz.SelectStaffInList(dmGuid, staff))
            {
                return(false);
            }

            // 点击全部卸载
            DMService.Instance.LeftClick(dmGuid, new WxPoint(372, 470));

            // 确认装备已经全部卸载
            foreach (var p in _equipSpaceMap.Values)
            {
                DMService.Instance.LeftClick(dmGuid, p);
                var type = GetEquipInfo(dmGuid);
                if (type.Quality > WlyQualityType.Unknow)
                {
                    return(false);
                }
            }

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

            foreach (var staff in entity.AccountInfo.StaffInfoDict.Values)
            {
                if (staff.CurrentType != staff.TargetType)
                {
                    WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_武将);
                    WlyUtilityBiz.SelectStaffInList(dmGuid, staff.Name);
                    staff.CurrentType = WlyStaffMgr.GetStaffType(dmGuid, new WxRect(322, 283, 414, 307));
                    if (staff.CurrentType == staff.TargetType)
                    {
                        continue;
                    }

                    staff.CurrentType = WlyStaffMgr.GetStaffType(dmGuid, new WxRect(430, 283, 496, 307));
                    if (staff.CurrentType == staff.TargetType)
                    {
                        continue;
                    }

                    if (staff.CurrentType <= WlySoldierType.巫术师 && staff.TargetType > WlySoldierType.巫术师 && staff.CurrentType != WlySoldierType.Unkonwn)
                    {
                        WlyStaffMgr.Evolve(staff.Name, dmGuid);
                        WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_武将);
                        WlyUtilityBiz.SelectStaffInList(dmGuid, staff.Name);
                    }

                    DMService.Instance.LeftClick(dmGuid, new WxPoint(368, 342));

                    // 等待界面打开
                    var wait = FlowLogicHelper.RepeatRun(() =>
                    {
                        if (DMService.Instance.FindStr(dmGuid, new WxRect(498, 139, 529, 162), "兵种", WlyColor.Normal))
                        {
                            return(true);
                        }

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

                    if (!wait)
                    {
                        throw new InvalidOperationException("无法打开重修界面");
                    }

                    while (true)
                    {
                        var nt = WlyStaffMgr.GetStaffType(dmGuid, new WxRect(348, 399, 417, 421));
                        if (nt == staff.TargetType)
                        {
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(385, 471));
                            break;
                        }

                        nt = WlyStaffMgr.GetStaffType(dmGuid, new WxRect(436, 399, 513, 426));
                        if (nt == staff.TargetType)
                        {
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(385, 471));
                            break;
                        }

                        // 点击重修
                        DMService.Instance.LeftClick(dmGuid, new WxPoint(507, 469));

                        // 确认重修花费
                        var cost = 100;

                        wait = FlowLogicHelper.RepeatRun(() =>
                        {
                            if (DMService.Instance.FindStr(dmGuid, new WxRect(495, 249, 530, 281), "免费", "ff6600-000000"))
                            {
                                cost = 0;
                            }
                            else
                            {
                                var w = FlowLogicHelper.RepeatRun(() =>
                                {
                                    var costStr = DMService.Instance.GetWords(dmGuid, new WxRect(510, 253, 574, 283), "ff6600-000000");
                                    if (string.IsNullOrEmpty(costStr) || !costStr.Contains("金币"))
                                    {
                                        Thread.Sleep(500);
                                        return(false);
                                    }

                                    var index = costStr.IndexOf("金币", StringComparison.Ordinal);
                                    cost      = int.Parse(costStr.Substring(0, index));
                                    return(true);
                                }, TimeSpan.FromSeconds(2));

                                if (!w)
                                {
                                    return(false);
                                }
                            }

                            return(true);
                        }, TimeSpan.FromSeconds(10));
                        if (!wait)
                        {
                            throw new InvalidOperationException();
                        }

                        if (cost <= 10)
                        {
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 353));
                        }
                        else
                        {
                            // 今日重修完成
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(546, 353));
                            DMService.Instance.LeftClick(dmGuid, new WxPoint(627, 467));
                            return(new WlyTaskInfo(ID, true));
                        }
                    }

                    // 点击退出
                    DMService.Instance.LeftClick(dmGuid, new WxPoint(627, 467));

                    // 追加确认兵种重修结果
                    WlyUtilityBiz.SelectStaffInList(dmGuid, staff.Name);
                    staff.CurrentType = WlyStaffMgr.GetStaffType(dmGuid, new WxRect(322, 283, 414, 307));
                    if (staff.CurrentType == staff.TargetType)
                    {
                        continue;
                    }

                    staff.CurrentType = WlyStaffMgr.GetStaffType(dmGuid, new WxRect(430, 283, 496, 307));
                }
            }

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