/// <summary> /// 清理指定页背包 /// </summary> /// <param name="role"></param> /// <param name="page">背包页(1-5)</param> /// <param name="begin">开始格数(1-30)</param> /// <param name="stop">结束格数(1-30)</param> public static void BagCleanup(this IRole role, int page, int begin, int stop) { DmPlugin dm = role.Window.Dm; int hwnd = role.Window.Hwnd; dm.MoveToClick(796 + 65 * (page - 1), 217); //点击背包页 dm.Delay(100); dm.MoveToClick(796 + 65 * (page - 1), 217); //点击背包页 dm.Delay(300); //5-28格 for (int i = begin; i <= stop; i++) { dm.MoveTo(800 + 65 * ((i - 1) % 5), 274 + 65 * ((i - 1) / 5)); dm.Delay(200); int num = dm.ReadInt(hwnd, "[16cbc90]+314", 0); Debug.WriteLine("格子数量为:" + num); if (num == 0) { continue; } Debug.WriteLine(800 + 65 * ((i - 1) % 5) + " " + (274 + 65 * ((i - 1) / 5))); Delegater.WaitTrue(() => { dm.MoveTo(573, 493); dm.Delay(100); string content = dm.ReadString(hwnd, "[16cbc90]+30", 1, 10); // Debug.WriteLine(content); if (content.Contains("是")) { return(true); } else { return(false); } }, () => { dm.MoveToClick(800 + 65 * ((i - 1) % 5), 274 + 65 * ((i - 1) / 5)); //点击格子 dm.MoveToClick(748, 687); //点击丢弃 dm.Delay(300); }); dm.MoveToClick(574, 496); //点击确认 dm.Delay(500); } }
private void UpdateGameRoleList() { if (SoftContext.Role == null) { return; } DmPlugin dm = SoftContext.Role.Window.Dm; var tempList = new ObservableCollection <RoleInfo>(); foreach (var item in this._gameRoleList) { tempList.Add(item); } this._gameRoleList.Clear(); string hwnds = dm.EnumWindowByProcess("DragonNest.exe", "", "DRAGONNEST", 2); List <int> hList = dm.GetHwnds(hwnds); foreach (var h in hList) { if (SoftContext.Role.Window.Hwnd == h) { continue; } RoleInfo roleInfo = new RoleInfo(); roleInfo.ID = this._gameRoleList.Count + 1; roleInfo.PID = dm.GetWindowProcessId(h); roleInfo.Occupation = dm.ReadString(h, "[1221740]+e50", 1, 10); roleInfo.Hwnd = h; var info = tempList.FirstOrDefault(x => x.Hwnd == h); if (info == null) { roleInfo.IsTogether = false; roleInfo.IsMove = false; roleInfo.Delay = 0; } else { roleInfo.IsTogether = info.IsTogether; roleInfo.IsMove = info.IsMove; roleInfo.Delay = info.Delay; } this._gameRoleList.Add(roleInfo); } }
/// <summary> /// 鼠标位置是否有指定控件文本 /// </summary> /// <param name="role"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="text"></param> /// <param name="isClick"></param> /// <returns></returns> public static bool FindControlTextAndClick(this IRole role, int x, int y, string text, bool isClick = false) { DmPlugin dm = role.Window.Dm; int hwnd = role.Window.Hwnd; dm.MoveTo(x, y); dm.Delay(200); string content = dm.ReadString(hwnd, "[16cbc90]+30", 1, 10); // Debug.WriteLine(content); if (content.Contains(text)) { if (isClick) { dm.LeftClick(); } return(true); } return(false); }
/// <summary> /// 获取鼠标所指向控件的文本 /// </summary> /// <param name="role"></param> /// <returns></returns> public static string GetMousePointContent(this IRole role) { DmPlugin dm = role.Window.Dm; return(dm.ReadString(role.Window.Hwnd, "[]+30", 1, 20)); }