예제 #1
0
        /// <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))));
        }
예제 #2
0
        /// <summary>
        /// 执行任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        protected override WlyTaskInfo InternalRun(WlyEntity entity)
        {
            var dmGuid = entity.DMGuid;
            var staff  = entity.AccountInfo.GetStaffInfo(m_staff);

            staff.Level = WlyStaffMgr.GetStaffLevel(dmGuid, m_staff);
            if (staff.Level < m_level)
            {
                WlyStaffMgr.Upgrade(m_staff, m_level, dmGuid);
                staff.Level = WlyStaffMgr.GetStaffLevel(dmGuid, m_staff);
            }

            if (staff.Level < m_level)
            {
                return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime()));
            }

            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;
            var cityLevel = entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level;

            foreach (var staff in entity.AccountInfo.StaffInfoDict.Values)
            {
                if ((staff.Level == cityLevel) && (staff.GrowLevel > cityLevel))
                {
                    continue;
                }

                staff.Level = WlyStaffMgr.GetStaffLevel(dmGuid, staff.Name);
                if (cityLevel >= 100 && staff.Level < 80)
                {
                    WlyStaffMgr.Upgrade(staff.Name, 80, dmGuid);
                    staff.Level = WlyStaffMgr.GetStaffLevel(dmGuid, staff.Name);
                }
            }

            WlyEntityBiz.ClearEquipments(entity);
            //WlyEntityBiz.UpgradeAllEquipmenets(entity);
            return(new WlyTaskInfo(ID, true));
        }
예제 #4
0
        /// <summary>
        /// 强化所有的装备
        /// </summary>
        /// <param name="entity"></param>
        public static void UpgradeAllEquipmenets(WlyEntity entity)
        {
            // 清理装备
            var dmGuid    = entity.DMGuid;
            var cityLevel = entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level;

            foreach (var staff in entity.AccountInfo.StaffInfoDict.Values)
            {
                if ((staff.Level == cityLevel) && (staff.GrowLevel > cityLevel))
                {
                    continue;
                }

                staff.Level = WlyStaffMgr.GetStaffLevel(dmGuid, staff.Name);
                if ((cityLevel >= 100) && (staff.Level < 80))
                {
                    WlyStaffMgr.Upgrade(staff.Name, 80, dmGuid);
                    staff.Level = WlyStaffMgr.GetStaffLevel(dmGuid, staff.Name);
                }
            }

            ClearEquipments(entity);

            var r = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(274, 47, 321, 72), "f3f3da-000000", out var aa);

            if (r && (aa >= 500000))
            {
                // 遍历进行装备交换
                var staffs = entity.AccountInfo.StaffInfoDict.Values;
                foreach (var a in staffs.ToList())
                {
                    foreach (var b in staffs.ToList())
                    {
                        if (a.Name == b.Name)
                        {
                            continue;
                        }

                        // 遍历装备
                        foreach (var e1 in a.EquipInfoDict.Values)
                        {
                            var e2 = b.GetEquipInfo(e1.Type);
                            if (a.EquipmentRequestDict[e1.Type] && !b.EquipmentRequestDict[e2.Type] &&
                                ((e1.Quality < e2.Quality) ||
                                 ((e1.Quality == e2.Quality) && (e1.EquipLevel < e2.EquipLevel))))
                            {
                                WlyStaffMgr.SwitchEquipment(dmGuid, a, b, e1.Type);
                            }
                        }
                    }
                }

                entity.AccountInfo.Save();
            }

            if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(133, 26, 217, 47), "f3f3da-000000", out var amount))
            {
                if ((amount < 10000000) && (entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level >= 100))
                {
                    return;
                }
            }

            var shopLevel = entity.AccountInfo.GetBuildingInfo(WlyBuildingType.商铺).Level;
            var ss        = new List <WlyStaffType>();

            foreach (var s in entity.AccountInfo.StaffInfoDict.Values)
            {
                foreach (var e in s.EquipInfoDict.Values)
                {
                    if (s.EquipmentRequestDict[e.Type] && (e.Level < shopLevel) && (e.Quality != WlyQualityType.Unknow))
                    {
                        ss.Add(s.Name);
                        break;
                    }
                }
            }

            if (!ss.Any())
            {
                return;
            }

            var staffstr = string.Join("|", ss.Select(o => o.ToString()));

            // 切换到功能
            WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_强化装备);

            for (int i = 0; i < 3; i++)
            {
                var result = DMService.Instance.FindStrEx(dmGuid, new WxRect(188, 201, 417, 439), staffstr, WlyColor.White);
                var list   = result.Split('|');
                foreach (var pos in list)
                {
                    var ps    = pos.Split(',');
                    var index = int.Parse(ps[0]);
                    var point = new WxPoint(int.Parse(ps[1]), int.Parse(ps[2]));
                    var info  = entity.AccountInfo.GetStaffInfo(ss[index]);

                    // 点击辨别装备
                    DMService.Instance.LeftClick(dmGuid, point);
                    var equipInfo = WlyEquipMgr.GetEquipInfo(dmGuid);
                    if (info.EquipmentRequestDict[equipInfo.Type] && (equipInfo.Level < shopLevel))
                    {
                        // 开始强化
                        DMService.Instance.LeftDown(dmGuid, new WxPoint(563, 354));
                        var res = FlowLogicHelper.RunToTarget(() => GetEquipLevelCore(dmGuid), current => current >= shopLevel, () => Thread.Sleep(500));
                        DMService.Instance.LeftUp(dmGuid, new WxPoint(563, 354));
                        info.SaveEquipInfo(WlyEquipMgr.GetEquipInfo(dmGuid));
                        if (!res)
                        {
                            // 银币耗尽,直接返回
                            entity.AccountInfo.Save();
                            return;
                        }
                    }
                }

                // 往下翻一页
                DMService.Instance.RepeatLeftClick(dmGuid, new WxPoint(426, 427), 14, 100);
            }

            entity.AccountInfo.Save();
        }