/// <summary> /// 武将下野 /// </summary> /// <param name="staff"></param> public void RemoveStaffInfo(WlyStaffType staff) { if (StaffInfoDict.ContainsKey(staff)) { StaffInfoDict.Remove(staff); } }
/// <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)); }
/// <summary> /// 获取当前武将等级 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> /// <returns></returns> public static int GetStaffLevel(string dmGuid, WlyStaffType staff) { SelectStaff(dmGuid, staff, WlyViewType.功能_训练); var levelStr = string.Empty; var wait = FlowLogicHelper.RepeatRun(() => { levelStr = DMService.Instance.GetWords(dmGuid, new WxRect(716, 306, 799, 328), "e9e7cf-000000"); return(!string.IsNullOrEmpty(levelStr)); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException("无法解析武将等级"); } var result = int.TryParse(levelStr.Substring(0, levelStr.Length - 1), out var currentLevel); if (!result) { throw new InvalidOperationException("无法解析武将等级"); } return(currentLevel); }
/// <summary> /// 突飞指定武将到指定的等级 /// </summary> /// <param name="staff"></param> /// <param name="level"></param> /// <param name="dmGuid"></param> public static bool Upgrade(WlyStaffType staff, int level, string dmGuid) { // 确认武将正在训练中 PractiseStaff(staff, dmGuid); // 突飞猛进 return(FlowLogicHelper.RunToTarget(() => { var levelStr = string.Empty; while (string.IsNullOrEmpty(levelStr)) { SelectStaff(dmGuid, staff, WlyViewType.功能_训练); levelStr = DMService.Instance.GetWords(dmGuid, new WxRect(716, 306, 799, 328), "e9e7cf-000000"); } var result = int.TryParse(levelStr.Substring(0, levelStr.Length - 1), out var currentLevel); if (!result) { throw new InvalidOperationException("无法解析武将等级"); } return currentLevel; }, current => current >= level, () => { DMService.Instance.LeftClick(dmGuid, new WxPoint(490, 460), TimeSpan.FromMilliseconds(50)); if (DMService.Instance.FindStr(dmGuid, new WxRect(713, 278, 745, 299), "转生", "e9e7cf-000000")) { DMService.Instance.LeftClick(dmGuid, new WxPoint(545, 329)); } })); }
/// <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); }
/// <summary> /// 获取武将信息 /// </summary> /// <param name="staff"></param> /// <returns></returns> public WlyStaffInfo GetStaffInfo(WlyStaffType staff) { if (StaffInfoDict.ContainsKey(staff)) { return(StaffInfoDict[staff]); } return(null); }
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="dmGuid"></param> /// <param name="staff"></param> /// <returns></returns> public static int GetStaffGrowLevel(string dmGuid, WlyStaffType staff) { SelectStaff(dmGuid, staff, WlyViewType.功能_训练); var word = DMService.Instance.GetWords(dmGuid, new WxRect(411, 338, 451, 357), "ff6600-000000"); if (!word.Contains("级")) { throw new InvalidOperationException("无法解析转生等级"); } return(int.Parse(word.Substring(0, word.Length - 1))); }
/// <summary> /// 武将转生 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> /// <returns></returns> public static bool Grow(string dmGuid, WlyStaffType staff) { var currentLevel = GetStaffLevel(dmGuid, staff); var growLevel = GetStaffGrowLevel(dmGuid, staff); if (currentLevel >= growLevel) { SelectStaff(dmGuid, staff, WlyViewType.功能_武将); DMService.Instance.LeftClick(dmGuid, new WxPoint(491, 472)); DMService.Instance.LeftClick(dmGuid, new WxPoint(455, 329)); } return(true); }
/// <summary> /// 招募武将 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> public static bool GetStaff(string dmGuid, WlyStaffType staff) { WlyViewMgr.GoTo(dmGuid, WlyViewType.功能_招募); // 先在左边的列表中确认是否已经存在 if (DMService.Instance.FindStr(dmGuid, 总成_武将.武将列表, staff.ToString(), WlyColor.StaffColor)) { return(true); } // 开始进行招募 FlowLogicHelper.RepeatRun(() => { // 在当前页寻找武将 var find = DMService.Instance.FindStr(dmGuid, new WxRect(321, 331, 653, 450), staff.ToString(), WlyColor.StaffColor, out var x, out var y); if (find) { DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y), TimeSpan.FromSeconds(1)); if (DMService.Instance.FindStr(dmGuid, new WxRect(714, 305, 801, 329), staff.ToString(), WlyColor.StaffColor)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(612, 462)); Thread.Sleep(1000); } return(true); } // 进行翻页 var pageStr = DMService.Instance.GetWords(dmGuid, new WxRect(468, 453, 514, 476), "ffffff-000000"); var index = pageStr.IndexOf("/", StringComparison.Ordinal); var current = int.Parse(pageStr.Substring(0, index)); var total = int.Parse(pageStr.Substring(index + 1)); if (current == total) { return(true); } DMService.Instance.LeftClick(dmGuid, new WxPoint(524, 464)); return(false); }, TimeSpan.FromSeconds(10)); // 确认招募成功情况 if (DMService.Instance.FindStr(dmGuid, 总成_武将.武将列表, staff.ToString(), WlyColor.StaffColor)) { return(true); } return(false); }
/// <summary> /// 新招募了武将 /// </summary> /// <param name="staff"></param> public void AddStaffInfo(WlyStaffType staff) { if (StaffInfoDict.ContainsKey(staff)) { return; } WlyStaffInfo info = new WlyStaffInfo { Name = staff }; StaffInfoDict.Add(staff, info); }
/// <summary> /// 训练武将 /// </summary> /// <param name="staff"></param> /// <param name="dmGuid"></param> public static void PractiseStaff(WlyStaffType staff, string dmGuid) { SelectStaff(dmGuid, staff, WlyViewType.功能_训练); // 确认是否需要开启武将训练位 while (true) { var word = DMService.Instance.GetWords(dmGuid, new WxRect(198, 457, 236, 489), "f3f3da-000000"); if (word.Contains("/") && (word.Split('/')[1] != "5")) { DMService.Instance.LeftClick(dmGuid, new WxPoint(271, 478)); DMService.Instance.LeftClick(dmGuid, new WxPoint(455, 355), TimeSpan.FromSeconds(2)); continue; } break; } // 确认武将是否正在训练 var lastTime = WlyUtilityBiz.GetTime(dmGuid, new WxRect(566, 287, 636, 308), "33ffff-000000"); if ((lastTime < TimeSpan.FromHours(6)) && (lastTime != TimeSpan.Zero)) { // 结束训练 DMService.Instance.LeftClick(dmGuid, new WxPoint(580, 331), TimeSpan.FromSeconds(1)); DMService.Instance.LeftClick(dmGuid, new WxPoint(453, 331), TimeSpan.FromSeconds(1)); lastTime = WlyUtilityBiz.GetTime(dmGuid, new WxRect(566, 287, 636, 308), "33ffff-000000"); } if (lastTime == TimeSpan.Zero) { // 选择24小时训练 if (!DMService.Instance.FindStr(dmGuid, new WxRect(410, 236, 447, 257), "24", "e9e7cf-000000")) { DMService.Instance.LeftClick(dmGuid, new WxPoint(475, 246)); DMService.Instance.LeftClick(dmGuid, new WxPoint(437, 280)); } // 选择地狱训练 if (!DMService.Instance.FindStr(dmGuid, new WxRect(408, 261, 448, 285), "地狱", "e9e7cf-000000")) { DMService.Instance.LeftClick(dmGuid, new WxPoint(477, 272)); DMService.Instance.LeftClick(dmGuid, new WxPoint(438, 338)); } // 点击训练 DMService.Instance.LeftClick(dmGuid, new WxPoint(580, 331)); } }
/// <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)); } }
/// <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)); } }
/// <summary> /// 在强化界面选择武将指定部位的装备 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> /// <param name="equip"></param> private static bool SelectUpgradeEquipCore(string dmGuid, WlyStaffType staff, WlyEquipType equip) { var result = DMService.Instance.FindStrEx(dmGuid, new WxRect(188, 201, 417, 439), staff.ToString(), WlyColor.White); if (!string.IsNullOrWhiteSpace(result)) { var points = result.Split('|') .Select(o => { var ps = o.Split(','); return(new WxPoint(int.Parse(ps[1]), int.Parse(ps[2]))); }); foreach (var p in points) { DMService.Instance.LeftClick(dmGuid, p); if (DMService.Instance.FindStr(dmGuid, new WxRect(712, 339, 808, 358), equip.ToString(), "f3f3da-000000")) { return(true); } } } DMService.Instance.RepeatLeftClick(dmGuid, new WxPoint(426, 427), 14, 100); result = DMService.Instance.FindStrEx(dmGuid, new WxRect(188, 201, 417, 439), staff.ToString(), WlyColor.White); if (!string.IsNullOrWhiteSpace(result)) { var points = result.Split('|') .Select(o => { var ps = o.Split(','); return(new WxPoint(int.Parse(ps[1]), int.Parse(ps[2]))); }); foreach (var p in points) { DMService.Instance.LeftClick(dmGuid, p); if (DMService.Instance.FindStr(dmGuid, new WxRect(712, 339, 808, 358), equip.ToString(), "f3f3da-000000")) { return(true); } } } throw new InvalidOperationException($"无法找到{staff.ToString()}的装备{equip.ToString()}"); }
/// <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)); }
/// <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)); }
/// <summary> /// 在武将列表中选择指定的武将 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> public static bool SelectStaffInList(string dmGuid, WlyStaffType staff) { var name = staff.ToString(); return(FlowLogicHelper.RepeatRun(() => { if (DMService.Instance.FindStr(dmGuid, new WxRect(193, 205, 304, 462), name, WlyColor.Selected)) { return true; } if (DMService.Instance.FindStr(dmGuid, new WxRect(193, 205, 304, 462), name, GetStaffQualityStr(), out var x, out var y)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y)); } Thread.Sleep(500); return false; }, TimeSpan.FromSeconds(10))); }
/// <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; } } } }
/// <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("武将上阵失败"); } }
/// <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); }
public 任务_武将顿悟(string id, WlyStaffType staff, WlyQualityType quality, params string[] depends) : base(id, depends) { m_staff = staff; m_quality = quality; }
/// <summary> /// 获取武将的品质 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> /// <returns></returns> public static WlyQualityType GetStaffQuality(string dmGuid, WlyStaffType staff) { SelectStaff(dmGuid, staff, WlyViewType.功能_武将); return(WlyUtilityBiz.GetQuality(dmGuid, new WxRect(715, 308, 796, 326))); }
/// <summary> /// 顿悟武将到指定的品级 /// </summary> /// <param name="dmGuid"></param> /// <param name="staff"></param> /// <param name="quality"></param> /// <returns></returns> public static bool EnvolveStaff(string dmGuid, WlyStaffType staff, WlyQualityType quality) { SelectStaff(dmGuid, staff, WlyViewType.功能_武将); var currentQuality = WlyUtilityBiz.GetQuality(dmGuid, new WxRect(715, 308, 796, 326)); if (currentQuality >= quality) { return(true); } // 点击进入顿悟 var wait = FlowLogicHelper.RepeatRun(() => { DMService.Instance.LeftClick(dmGuid, new WxPoint(764, 275), TimeSpan.FromSeconds(2)); if (DMService.Instance.FindStr(dmGuid, new WxRect(477, 96, 523, 120), "顿悟", WlyColor.Normal)) { return(true); } return(false); }, TimeSpan.FromSeconds(10)); if (!wait) { throw new InvalidOperationException("无法点开顿悟界面"); } while (DMService.Instance.FindColor(WlyColor.Normal, new WxRect(244, 414, 699, 454), dmGuid, out var x, out var y)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(x, y)); if (DMService.Instance.FindStr(dmGuid, new WxRect(521, 266, 600, 313), staff.ToString(), WlyColor.StaffColor)) { DMService.Instance.LeftClick(dmGuid, new WxPoint(456, 329)); } else { DMService.Instance.LeftClick(dmGuid, new WxPoint(543, 329)); DMService.Instance.LeftClick(dmGuid, new WxPoint(801, 120)); return(false); } } DMService.Instance.LeftClick(dmGuid, new WxPoint(769, 415)); DMService.Instance.LeftClick(dmGuid, new WxPoint(452, 334)); wait = FlowLogicHelper.RepeatRun(() => { var result = DMService.Instance.FindStr(dmGuid, new WxRect(444, 371, 546, 443), "顿悟", WlyColor.Normal); if (result) { return(true); } Thread.Sleep(1000); return(false); }, TimeSpan.FromSeconds(20)); if (wait) { DMService.Instance.LeftClick(dmGuid, new WxPoint(496, 403)); return(true); } DMService.Instance.LeftClick(dmGuid, new WxPoint(804, 117)); return(false); }
public 任务_武将上阵(string id, WlyStaffType staff, WlyFormationType formation, int index, params string[] depends) : base(id, depends) { m_staff = staff; m_formation = formation; m_index = index; }
public 任务_重修设定(string id, WlyStaffType staff, WlySoldierType soldierType, params string[] depends) : base(id, depends) { m_staff = staff; m_soldierType = soldierType; }
public 任务_需求装备(string id, WlyStaffType staff, IEnumerable <WlyEquipType> requestList, params string[] depends) : base(id, depends) { m_requestList = requestList; m_staff = staff; }
public 任务_武将突飞(string id, WlyStaffType staff, int level, params string[] depends) : base(id, depends) { m_level = level; m_staff = staff; }
public 任务_武将下野(string id, WlyStaffType staff, params string[] depends) : base(id, depends) { m_staff = staff; }
public 任务_设置兵种(string id, WlyStaffType staff, int index, params string[] depends) : base(id, depends) { m_staff = staff; m_index = index; }