/// <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(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(550, 418, 634, 446), "领取|接受", $"{WlyColor.Normal}|{WlyColor.White}")) { DMService.Instance.LeftClick(dmGuid, new WxPoint(592, 436)); } if (DMService.Instance.FindStr(dmGuid, new WxRect(550, 418, 634, 446), "取消", $"{WlyColor.Normal}|{WlyColor.White}")) { return(true); } return(false); }, TimeSpan.FromSeconds(120)); if (!wait) { return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); } return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> public override WlyTaskInfo Run(WlyEntity entity) { if (DateTime.Now > DateTime.Today.Add(EndTime) || WlyUtilityBiz.GetRefreshTime() < DateTime.Today.Add(EndTime)) { return(new WlyTaskInfo(ID, true)); } return(base.Run(entity)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { // 升级军团科技 var dmGuid = entity.DMGuid; if (WlyGroupMgr.Upgrade(dmGuid)) { return(new WlyTaskInfo(ID, true)); } return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); }
/// <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(100, 212, 145, 234), "可投资", "20ef4c-000000")) { WlyMapMgr.OpenCity(dmGuid, m_city); var s1 = DMService.Instance.GetWords(dmGuid, new WxRect(470, 352, 565, 370), "e9e7cf-000000"); var v1 = int.Parse(s1.Split('/')[0]); WlyUtilityBiz.SystemInfo.Develop1 = v1; var s2 = DMService.Instance.GetWords(dmGuid, new WxRect(470, 374, 565, 939), "e9e7cf-000000"); var v2 = int.Parse(s2.Split('/')[0]); WlyUtilityBiz.SystemInfo.Develop2 = v2; WlyUtilityBiz.SystemInfo.Save(); var wait = FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(470, 214, 494, 236), "城", WlyColor.Normal)) { return(true); } DMService.Instance.LeftClick(dmGuid, new WxPoint(660, 277)); return(false); }, TimeSpan.FromSeconds(5)); if (!wait) { throw new InvalidOperationException("无法打开城池进行开发"); } if (v1 > v2) { DMService.Instance.LeftClick(dmGuid, new WxPoint(583, 267)); DMService.Instance.LeftClick(dmGuid, new WxPoint(536, 301)); } DMService.Instance.LeftClick(dmGuid, new WxPoint(440, 367), TimeSpan.FromSeconds(2)); } if (!DMService.Instance.FindColor(dmGuid, "33ffff-000000", new WxRect(100, 212, 160, 234))) { return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); } var coolTime = WlyUtilityBiz.GetTime(dmGuid, new WxRect(100, 212, 160, 234), "33ffff-000000"); return(new WlyTaskInfo(ID, DateTime.Now.Add(coolTime))); }
/// <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)))); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; // 武将除名 entity.AccountInfo.RemoveStaffInfo(m_staff); // 首先卸载武将全部的装备 WlyEquipMgr.UnequipStaff(dmGuid, m_staff); // 武将下野 if (WlyStaffMgr.ThrowStaff(dmGuid, m_staff)) { return(new WlyTaskInfo(ID, true)); } return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); }
/// <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); if (staff.Quality >= m_quality) { return(new WlyTaskInfo(ID, true)); } WlyStaffMgr.EnvolveStaff(dmGuid, m_staff, m_quality); staff.Quality = WlyStaffMgr.GetStaffQuality(dmGuid, m_staff); if (staff.Quality >= m_quality) { return(new WlyTaskInfo(ID, true)); } return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); }
/// <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)); }
protected override void InternalBackupWorkThread() { // 小号无其他任务则直接停止 WxLog.Debug($"SubEntity.InternalBackupWorkThread No More Tasks <{Account}>"); var time = WlyUtilityBiz.GetRefreshTime(); foreach (var runner in TaskList.ToList()) { var info = AccountInfo.GetTaskInfo(runner.Task.ID); if (info.NextRunTime < time) { time = info.NextRunTime; } } m_subAccountInfo.NextLoginTime = time; WxLog.Debug($"SubEntity.InternalBackupWorkThread Name<{m_subAccountInfo.Name}> " + $"NextLoginTime<{m_subAccountInfo.NextLoginTime:yyyy-MM-dd HH:mm:ss}>"); m_subAccountInfo.Save(); Stop(); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; entity.AccountInfo.Credit = WlyUtilityBiz.GetCreditAmount(dmGuid); if (entity.AccountInfo.Credit >= m_amount) { if (m_amount < 2000000) { return(new WlyTaskInfo(ID, true)); } return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); } // 尝试从竞技场获取 if (entity.AccountInfo.FightPoint >= 300) { WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_竞技场); DMService.Instance.LeftClick(dmGuid, new WxPoint(621, 560)); DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 327)); var wait = FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(576, 437, 607, 457), "兑换", "e9e7cf-000000")) { return(true); } DMService.Instance.LeftClick(dmGuid, new WxPoint(686, 559)); return(false); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException("无法打开兑换界面"); } // 开始兑换 wait = FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(745, 336, 780, 358), "威望", "f3f3da-000000")) { return(true); } DMService.Instance.LeftClick(dmGuid, new WxPoint(389, 229)); return(false); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException("无法兑换威望"); } DMService.Instance.LeftClick(dmGuid, new WxPoint(602, 471)); DMService.Instance.LeftClick(dmGuid, new WxPoint(602, 471)); DMService.Instance.LeftClick(dmGuid, new WxPoint(602, 471)); } return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); }
/// <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)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { // 等待周一更新后再推图 var dmGuid = entity.DMGuid; try { WlyEntityBiz.UpgradeAllEquipmenets(entity); } catch (Exception ex) { WxLog.Error($"任务_推图.InternalRun Error <{ex}>"); throw new InvalidOperationException("内部异常"); } // 勾上战斗结果 if (entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level >= 20) { WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主城); var wait = FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(458, 166, 497, 195), "消费", WlyColor.Normal)) { return(true); } DMService.Instance.LeftClick(dmGuid, new WxPoint(762, 14)); return(false); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException(); } DMService.Instance.LeftDown(dmGuid, new WxPoint(646, 421)); wait = FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(506, 414, 540, 436), "20级", "ffffb0-000000")) { DMService.Instance.LeftUp(dmGuid, new WxPoint(646, 421)); return(true); } if (DMService.Instance.FindStr(dmGuid, new WxRect(376, 414, 409, 433), "20级", "ffffb0-000000")) { DMService.Instance.LeftUp(dmGuid, new WxPoint(646, 421)); return(true); } if (DMService.Instance.FindStr(dmGuid, new WxRect(376, 414, 409, 433), "20级", "f3f3da-000000", out var x, out var y)) { DMService.Instance.LeftUp(dmGuid, new WxPoint(646, 421)); DMService.Instance.LeftClick(dmGuid, new WxPoint(x + 10, y + 5)); return(false); } if (DMService.Instance.FindStr(dmGuid, new WxRect(506, 414, 540, 436), "20级", "f3f3da-000000", out var xx, out var yy)) { DMService.Instance.LeftUp(dmGuid, new WxPoint(646, 421)); DMService.Instance.LeftClick(dmGuid, new WxPoint(xx + 10, yy + 5)); return(false); } Thread.Sleep(500); return(false); }, TimeSpan.FromSeconds(10)); if (!wait) { DMService.Instance.LeftUp(dmGuid, new WxPoint(646, 421)); throw new InvalidOperationException(); } } var result = WlyProgressMgr.Attack(entity, m_progress); if (result && DMService.Instance.FindStr(dmGuid, new WxRect(530, 323, 565, 340), "取消", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(455, 330)); } if (!result) { return(new WlyTaskInfo(ID, WlyUtilityBiz.GetRefreshTime())); } entity.AccountInfo.Progress = m_progress; return(new WlyTaskInfo(ID, true)); }
/// <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)); }
/// <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)); }