/// <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(179, 111)); // 识别花费 var payStr = string.Empty; var wait = FlowLogicHelper.RepeatRun(() => { payStr = DMService.Instance.GetWords(dmGuid, new WxRect(528, 249, 579, 284), "ff6600-101010"); if (DMService.Instance.FindStr(dmGuid, new WxRect(485, 317, 518, 342), "确定", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(495, 330)); return(true); } return(payStr.Contains("金币")); }, TimeSpan.FromSeconds(30)); if (!wait) { throw new InvalidOperationException("无法识别购买花费"); } // 点击购买或取消 DMService.Instance.LeftClick(dmGuid, payStr == "0金币" ? new WxPoint(454, 355) : new WxPoint(548, 352)); return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 获取军令数量 /// </summary> /// <param name="dmGuid"></param> /// <returns></returns> public static int GetPoint(string dmGuid) { // 首先跳转到主界面 WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主界面); var pointRect = new WxRect(119, 106, 163, 123); var words = string.Empty; var wait = FlowLogicHelper.RepeatRun(() => { words = DMService.Instance.GetWords(dmGuid, pointRect, "f3f3da-202020"); return(!string.IsNullOrEmpty(words)); }, TimeSpan.FromSeconds(20)); if (!wait) { throw new InvalidOperationException("无法获取军令信息"); } var result = int.TryParse(words.Split('/')[0], out var point); if (!result) { WxLog.Debug($"WlyUtilityBiz.GetPoint <{words}>"); return(0); } return(point); }
/// <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(355, 214), TimeSpan.FromSeconds(2)); DMService.Instance.LeftClick(dmGuid, new WxPoint(506, 157), TimeSpan.FromSeconds(2)); DMService.Instance.LeftClick(dmGuid, new WxPoint(793, 391), TimeSpan.FromSeconds(2)); DMService.Instance.LeftClick(dmGuid, new WxPoint(457, 353), TimeSpan.FromSeconds(2)); DMService.Instance.LeftClick(dmGuid, new WxPoint(863, 118), TimeSpan.FromSeconds(2)); WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_仓库); DMService.Instance.LeftClick(dmGuid, new WxPoint(220, 230)); if (DMService.Instance.FindStr(dmGuid, new WxRect(475, 403, 529, 433), "使用", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 417)); return(new WlyTaskInfo(ID, true)); } DMService.Instance.LeftClick(dmGuid, new WxPoint(278, 231)); if (DMService.Instance.FindStr(dmGuid, new WxRect(475, 403, 529, 433), "使用", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 417)); return(new WlyTaskInfo(ID, true)); } WlyEntityBiz.ClearEquipments(entity); if (entity.AccountInfo.GetStaffInfo(WlyStaffType.文凤卿).GetEquipInfo(WlyEquipType.物理防御).Quality >= WlyQualityType.Purple) { return(new WlyTaskInfo(ID, true)); } return(new WlyTaskInfo(ID)); }
/// <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(329, 112, 953, 496), "擂", "feff99-000000", out var x, out var y)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y)); return(true); } Thread.Sleep(1000); return(false); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException(); } // 点击报名 var signupPoint = new WxPoint(393, 551); DMService.Instance.LeftClick(dmGuid, signupPoint); return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主城); WlyUtilityBiz.GetPercent(dmGuid, new WxRect(137, 47, 238, 68), "e9e7cf-000000", out var persent); if (persent > 0.8) { return(new WlyTaskInfo(ID, true)); WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_卖粮); DMService.Instance.LeftClick(dmGuid, new WxPoint(760, 343)); DMService.Instance.LeftClick(dmGuid, new WxPoint(762, 377)); } WlyViewMgr.GoTo(dmGuid, WlyViewType.建筑_农田); FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindColor(dmGuid, "aaaaaa-000000", new WxRect(341, 402, 367, 413))) { return(true); } FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(350, 407), TimeSpan.FromMilliseconds(100)), 5); return(false); }, TimeSpan.FromSeconds(10)); return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; // 进入城池争夺战界面 WlyViewMgr.GoTo(dmGuid, WlyViewType.日常_城池争夺战); // 等待所有UI加载完成 Thread.Sleep(2000); if (!DMService.Instance.FindStr(dmGuid, new WxRect(625, 558, 690, 590), "一键挂机", "cccccc-000000")) { // 点击一键 var oneClickPoint = new WxPoint(659, 574); DMService.Instance.LeftClick(dmGuid, oneClickPoint); // 点击确定 var okPoint = new WxPoint(451, 330); DMService.Instance.LeftClick(dmGuid, okPoint); // 点击领取 var getPoint = new WxPoint(544, 440); DMService.Instance.LeftClick(dmGuid, getPoint); // 点击退出 var exitPoint = new WxPoint(949, 571); DMService.Instance.LeftClick(dmGuid, exitPoint); } return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_商城); // 购买所有可以使用粮食和银币购买的东西 var itemRects = new List <WxRect> { new WxRect(262, 301, 332, 327), new WxRect(411, 304, 472, 325), new WxRect(551, 304, 619, 326), new WxRect(266, 418, 329, 439), new WxRect(408, 417, 474, 440), new WxRect(556, 417, 617, 442) }; foreach (var rect in itemRects) { if (WlyUtilityBiz.GetAmount(dmGuid, rect, "ffffff-000000", out var _)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(rect.Left, rect.Top)); DMService.Instance.LeftClick(dmGuid, new WxPoint(415, 470)); if (DMService.Instance.FindStr(dmGuid, new WxRect(434, 338, 473, 366), "确定", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(459, 311)); DMService.Instance.LeftClick(dmGuid, new WxPoint(457, 351)); } } } return(new WlyTaskInfo(ID, true)); }
/// <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)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var sub = (SubEntity)entity; if (sub.Info.Check) { return(new WlyTaskInfo(ID, true)); } // 开始检测 var dmGuid = sub.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_军团); var result = DMService.Instance.FindPic(dmGuid, WlyPicType.吴国军团, new WxRect(189, 287, 794, 443), out var x, out var y); if (result) { DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y)); if (DMService.Instance.FindStr(dmGuid, new WxRect(390, 182, 443, 211), "吴之团", "e9e7cf-000000")) { sub.Info.Check = true; return(new WlyTaskInfo(ID, true)); } } throw new InvalidOperationException("认证失败"); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var sub = (SubEntity)entity; var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主界面); // 获取名称 var name = DMService.Instance.GetWords(dmGuid, new WxRect(54, 0, 134, 24), "eae7d0-000000"); if (!name.Contains("海潮")) { WxLog.Error($"任务_名称检测.InternalRun Invalid Name <{name}> Account <{entity.Account}> Psw <{entity.Password}> UID<{entity.AccountInfo.UID}>"); return(new WlyTaskInfo(ID) { NextRunTime = DateTime.Now.AddDays(7) }); } try { sub.Info.Name = name; sub.Info.Index = int.Parse(name.Substring(2)); entity.Stop(); return(new WlyTaskInfo(ID, true)); } catch (Exception ex) { WxLog.Error($"任务_名称检测.InternalRun Name<{name}> Error <{ex}>"); return(new WlyTaskInfo(ID, DateTime.Now.AddDays(7))); } }
/// <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)); }
public void SpecialTask() { try { WlyUtilityBiz.Login(this); BindGameWnd(); var dmGuid = DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_红包); // 点击红包 DMService.Instance.LeftClick(dmGuid, new WxPoint(498, 452), TimeSpan.FromSeconds(2)); FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(434, 203)), 6); FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(525, 280)), 6); FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(485, 349)), 6); } catch { } finally { CloseProcess(); } }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var sub = entity as SubEntity; var index = sub.Index; if (((index > 100) && (index < 200)) || ((index > 300) && (index < 400))) { var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_军团); DMService.Instance.LeftClick(dmGuid, new WxPoint(770, 478), TimeSpan.FromSeconds(1)); DMService.Instance.LeftClick(dmGuid, new WxPoint(452, 333), TimeSpan.FromSeconds(1)); if (DMService.Instance.FindStr(dmGuid, new WxRect(481, 320, 516, 343), "确定", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(500, 330)); WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主城); return(new WlyTaskInfo(ID, true)); } } else { return(new WlyTaskInfo(ID, true)); } throw new InvalidOperationException(); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; // 首先跳转到擂台赛界面 WlyViewMgr.GoTo(dmGuid, WlyViewType.日常_擂台赛); Thread.Sleep(5000); // 计算助威人数 WlyUtilityBiz.GetAmount(dmGuid, new WxRect(330, 369, 365, 383), "ebe9cf-101010", out var count1); WlyUtilityBiz.GetAmount(dmGuid, new WxRect(340, 421, 364, 434), "ebe9cf-101010", out var count2); // 上面数字大就助威上面,下面大助威下面 var target = count1 >= count2 ? new WxPoint(404, 371) : new WxPoint(405, 423); DMService.Instance.LeftClick(dmGuid, target); DMService.Instance.LeftClick(dmGuid, target); DMService.Instance.LeftClick(dmGuid, target); DMService.Instance.LeftClick(dmGuid, target); // 助威 DMService.Instance.LeftClick(dmGuid, new WxPoint(515, 553)); // 确定 DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 332)); // 退出 DMService.Instance.LeftClick(dmGuid, new WxPoint(911, 549)); return(new WlyTaskInfo(ID, true)); }
/// <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(592, 469)); return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var endTime = new DateTime(2018, 7, 16, 4, 0, 0); if (DateTime.Now > endTime) { return(new WlyTaskInfo(ID, true)); } var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_厉兵秣马); // 领取两个大包厢 DMService.Instance.LeftClick(dmGuid, new WxPoint(228, 227)); DMService.Instance.LeftClick(dmGuid, new WxPoint(227, 328)); // 循环领取七天的奖励 var start = new WxPoint(375, 177); for (var i = 0; i < 7; i++) { DMService.Instance.LeftClick(dmGuid, start.Shift(70 * i, 0), TimeSpan.FromSeconds(1)); FlowLogicHelper.RepeatRun(() => { var rect = new WxRect(733, 290, 790, 312); var point = new WxPoint(761, 299); Thread.Sleep(1000); if (DMService.Instance.FindStr(dmGuid, new WxRect(357, 300, 436, 320), "打猎", "fffdd4-000000")) { rect = new WxRect(732, 378, 792, 400); point = new WxPoint(759, 388); } if (DMService.Instance.FindStr(dmGuid, rect, "领取奖励", WlyColor.Normal, WlyColor.White)) { DMService.Instance.LeftClick(dmGuid, point); return(false); } if (DMService.Instance.FindStr(dmGuid, rect, "前往", WlyColor.Normal)) { return(true); } if (DMService.Instance.FindStr(dmGuid, new WxRect(485, 317, 518, 342), "确定", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(495, 330)); } return(false); }, TimeSpan.FromSeconds(10)); } return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 获取威望数量 /// </summary> /// <param name="dmGuid"></param> /// <returns></returns> public static int GetCreditAmount(string dmGuid) { // 首先跳转到主界面 WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_主界面); var rect = new WxRect(276, 73, 323, 90); var result = GetAmount(dmGuid, rect, "e9e7cf-000000", out var amount); return(amount); }
/// <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(559, 468)); var costStr = string.Empty; var wait = FlowLogicHelper.RepeatRun(() => { costStr = DMService.Instance.GetWords(dmGuid, new WxRect(473, 265, 518, 285), "ffff00-101010"); return(costStr.Contains("金币")); }, TimeSpan.FromSeconds(5)); if (!wait) { throw new InvalidOperationException("无法确认商城刷新的花费"); } if (costStr == "10金币") { DMService.Instance.LeftClick(dmGuid, new WxPoint(460, 357), TimeSpan.FromSeconds(2)); // 购买所有可以使用粮食和银币购买的东西 var itemRects = new List <WxRect> { new WxRect(262, 301, 332, 327), new WxRect(411, 304, 472, 325), new WxRect(551, 304, 619, 326), new WxRect(266, 418, 329, 439), new WxRect(408, 417, 474, 440), new WxRect(556, 417, 617, 442) }; foreach (var rect in itemRects) { if (WlyUtilityBiz.GetAmount(dmGuid, rect, "ffffff-000000", out var _)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(rect.Left, rect.Top)); DMService.Instance.LeftClick(dmGuid, new WxPoint(415, 470)); if (DMService.Instance.FindStr(dmGuid, new WxRect(434, 338, 473, 366), "确定", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(459, 311)); DMService.Instance.LeftClick(dmGuid, new WxPoint(457, 351)); } } } } else { DMService.Instance.LeftClick(dmGuid, new WxPoint(547, 353)); } return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; // 进入古城探险界面 WlyViewMgr.GoTo(dmGuid, WlyViewType.日常_古城探秘); Thread.Sleep(400); // 获取剩余次数 var countRect = new WxRect(614, 424, 634, 442); if (WlyUtilityBiz.GetAmount(dmGuid, countRect, WlyColor.Normal, out var count) && (count == 0)) { WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(30)); return(new WlyTaskInfo(ID, true)); } // 开始一键探险 DMService.Instance.LeftClick(dmGuid, new WxPoint(567, 392)); var wait = SpinWait.SpinUntil(() => { Thread.Sleep(1000); return(DMService.Instance.FindStr(dmGuid, new WxRect(549, 487, 587, 513), "扫荡", WlyColor.Normal)); }, TimeSpan.FromSeconds(10)); if (!wait) { return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(1))); } // 勾上选项 DMService.Instance.LeftClick(dmGuid, new WxPoint(422, 214)); DMService.Instance.LeftClick(dmGuid, new WxPoint(439, 237)); DMService.Instance.LeftClick(dmGuid, new WxPoint(423, 420)); //DMService.Instance.LeftClick(dmGuid, new WxPoint(421, 444)); // 开始扫荡 DMService.Instance.LeftClick(dmGuid, new WxPoint(557, 501)); // 等待扫荡结束 wait = SpinWait.SpinUntil(() => { Thread.Sleep(1000); return(DMService.Instance.FindStr(dmGuid, new WxRect(447, 477, 515, 501), "已完成全部", "ff3300-000000")); }, TimeSpan.FromSeconds(60)); if (!wait) { return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(1))); } // 完成古城探秘 DMService.Instance.LeftClick(dmGuid, new WxPoint(763, 126)); Thread.Sleep(400); WlyViewMgr.ExitCurrentView(dmGuid, TimeSpan.FromSeconds(30)); return(new WlyTaskInfo(ID, DateTime.Now)); }
/// <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(496, 483), TimeSpan.FromSeconds(10)); WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_虎牢关战役); DMService.Instance.LeftClick(dmGuid, new WxPoint(50, 230)); return(new WlyTaskInfo(ID, true)); }
/// <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(423, 474)); DMService.Instance.LeftClick(dmGuid, new WxPoint(589, 285)); DMService.Instance.LeftClick(dmGuid, new WxPoint(436, 364)); return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.场景_竞技场); Thread.Sleep(1000); if (DMService.Instance.FindColor(dmGuid, "ff0000-000000", new WxRect(436, 470, 486, 484))) { return(new WlyTaskInfo(ID, true)); } FlowLogicHelper.RepeatRun(() => { if (!DMService.Instance.FindStr(dmGuid, new WxRect(108, 207, 174, 229), "查看奖励", "ffcc00-000000")) { DMService.Instance.LeftClick(dmGuid, new WxPoint(141, 214)); DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 330)); return(false); } return(true); }, TimeSpan.FromSeconds(10)); if (WlyUtilityBiz.GetAmount(dmGuid, new WxRect(167, 156, 219, 175), "ff9900-000000", out var amount)) { entity.AccountInfo.FightPoint = amount; } var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(366, 268, 401, 289), WlyColor.White, out var targetLevel); if (result && targetLevel > entity.AccountInfo.GetBuildingInfo(WlyBuildingType.主城).Level) { return(new WlyTaskInfo(ID, true)); } DMService.Instance.LeftClick(dmGuid, new WxPoint(621, 558)); DMService.Instance.LeftClick(dmGuid, new WxPoint(455, 330)); DMService.Instance.LeftClick(dmGuid, new WxPoint(499, 386)); var enemy = DMService.Instance.GetWords(dmGuid, new WxRect(323, 247, 383, 269), "ffffff-000000"); if (enemy.Contains("海潮")) { return(new WlyTaskInfo(ID, true)); } DMService.Instance.LeftClick(dmGuid, new WxPoint(354, 325)); DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 328)); // 直接结束,不再等待 throw new InvalidOperationException(); }
/// <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="dmGuid"></param> /// <returns></returns> public int GetTotalSpace(string dmGuid) { WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_训练); var countStr = DMService.Instance.GetWords(dmGuid, new WxRect(209, 467, 236, 483), "f3f3da-000000"); if (!m_regex.IsMatch(countStr)) { throw new InvalidOperationException($"Invalid Str <{countStr}>"); } return(int.Parse(m_regex.Match(countStr).Groups[1].ToString())); }
/// <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; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_商旅); DMService.Instance.RepeatLeftClick(dmGuid, new WxPoint(604, 278), 12); if (DMService.Instance.FindStr(dmGuid, new WxRect(529, 346, 563, 363), "取消", WlyColor.Normal)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(547, 355)); } return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 执行任务 /// </summary> /// <param name="entity"></param> /// <returns></returns> protected override WlyTaskInfo InternalRun(WlyEntity entity) { var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_卖粮); // 读取粮价 var priceRect = new WxRect(386, 211, 479, 232); var priceStr = string.Empty; var wait = FlowLogicHelper.RepeatRun(() => { priceStr = DMService.Instance.GetWords(dmGuid, priceRect, "e9e7cf-000000"); return(!string.IsNullOrEmpty(priceStr)); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException("无法读取当前粮价"); } var info = WlyUtilityBiz.SystemInfo; info.FoodPriceDescription = $"{priceStr} [{DateTime.Now:yyyy-MM-dd HH:mm:ss}]"; if (double.TryParse(priceStr.Split('(')[0], out var price)) { info.FoodPrice = price; } // 如果达到最高价则卖粮 if (price >= 1.8) { DMService.Instance.LeftClick(dmGuid, new WxPoint(760, 343)); DMService.Instance.LeftClick(dmGuid, new WxPoint(762, 377)); } if (price <= 0.65) { DMService.Instance.LeftClick(dmGuid, new WxPoint(759, 421)); DMService.Instance.LeftClick(dmGuid, new WxPoint(761, 454)); return(new WlyTaskInfo(ID, DateTime.Now.AddMinutes(9))); } var now = DateTime.Now; var flag = DateTime.Today.AddHours(now.Hour).AddMinutes(30); var nextTime = now < flag?flag.AddMinutes(1) : flag.AddMinutes(31); info.NextFoodTime = nextTime; return(new WlyTaskInfo(ID, nextTime)); }
/// <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(() => { DMService.Instance.LeftClick(dmGuid, new WxPoint(375, 160)); return(DMService.Instance.FindStr(dmGuid, new WxRect(485, 188, 518, 206), "经济", "ffcc00-000000")); }, TimeSpan.FromSeconds(5)); if (!wait) { throw new InvalidOperationException("无法打开主公属性经济"); } var key = false; var result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(659, 304, 710, 329), WlyColor.White, out var amount); if (result && (amount > 0)) { key = true; } //result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(663, 355, 705, 379), WlyColor.White, out amount); //if (result && (amount > 0)) //{ // key = true; //} //result = WlyUtilityBiz.GetAmount(dmGuid, new WxRect(662, 409, 706, 432), WlyColor.White, out amount); //if (result && (amount > 0)) //{ // key = true; //} if (key) { DMService.Instance.LeftClick(dmGuid, new WxPoint(507, 474)); DMService.Instance.LeftClick(dmGuid, new WxPoint(454, 331)); entity.AccountInfo.ResetMainLevel(); entity.AccountInfo.Save(); throw new InvalidOperationException(); } return(new WlyTaskInfo(ID, true)); }
/// <summary> /// 领取红包的任务 /// </summary> /// <param name="entity"></param> public static void SpecialTask(WlyEntity entity) { Login(entity); var dmGuid = entity.DMGuid; WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_红包); // 点击红包 DMService.Instance.LeftClick(dmGuid, new WxPoint(498, 452), TimeSpan.FromSeconds(2)); FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(434, 203)), 6); FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(525, 280)), 6); FlowLogicHelper.RepeatRun(() => DMService.Instance.LeftClick(dmGuid, new WxPoint(485, 349)), 6); }
/// <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(494, 470)); do { DMService.Instance.LeftClick(dmGuid, new WxPoint(494, 470)); }while (DMService.Instance.FindColor(dmGuid, WlyColor.Normal, new WxRect(467, 463, 521, 483))); return(new WlyTaskInfo(ID, true)); }