/// <summary> /// 隐藏或者显示全部UI /// </summary> /// <param name="hwnd"></param> public static void UIShowStatus(int hwnd, bool show) { int UI = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8) + 0x28; //0显示 1隐藏 int s = show == true ? 0 : 1; show = LoadDll.WriteMemoryHwndValue((IntPtr)hwnd, UI, BitConverter.GetBytes(s)); }
/// <summary> /// 隐藏验证窗口 /// </summary> /// <param name="hwnd"></param> public static void HideCheckWin(int hwnd) { int tmpPtr = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x04, 0x68); tmpPtr = LoadDll.ReadHwndMemoryValue((IntPtr)hwnd, tmpPtr) + 0x28; LoadDll.WriteMemoryHwndValue((IntPtr)hwnd, tmpPtr, BitConverter.GetBytes(1)); }
public static void CallDialog(int hwnd, int option, int type) { //获取对话框的x,y起点 int x = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, 0, 0x8); int y = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, 0, 0xC); //点击点位的x,y double nx = x + 86; double ny = y + 48; clickWin(hwnd, (int)nx, (int)ny); }
/// <summary> /// 读取人物面板属性 /// </summary> /// <param name="hwnd"></param> public static bean.AttrsPanel ReadAttrsPanel(int hwnd) { IntPtr wnd = (IntPtr)hwnd; bean.AttrsPanel attr = new bean.AttrsPanel(); int offset = 0; for (int i = 0; i < 100; i++) { int addr = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0x00); int x = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0x8); int y = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xc); //人物气血 if (x == 582 && y == 5 && attr.peopleHP == 0) { attr.peopleHP = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } //人物蓝 if (x == 582 && y == 17 && attr.peopleMP == 0) { attr.peopleMP = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } //人物怒气 if (x == 582 && y == 29 && attr.anger == 0) { attr.anger = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } if (x == 582 && y == 41 && attr.peopleExp == 0) { attr.peopleExp = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } //宠物血 if (x == 462 && y == 5 && attr.bbHP == 0) { attr.bbHP = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } //宠物蓝 if (x == 462 && y == 17 && attr.bbMP == 0) { attr.bbMP = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } //宝宝经验 if (x == 462 && y == 29 && attr.bbExp == 0) { attr.bbExp = LoadDll.ReadHwndMemoryOffsetValue(wnd, Global.addr.win, 0x68, 0x8, 0x68, offset, 0xF4) / 10; } offset += 4; } return(attr); }
/// <summary> /// 关闭对话 /// </summary> /// <param name="hwnd"></param> public static void CloseDia(int hwnd) { for (int i = 0; i < 10; i++) { int show = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, (i * 4), 0x28); int type = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, (i * 4), 0x18); if (show == 0) { if (type == 641 || type == 579 || type == 465 || type == 544 || type == 550 || type == 278 || type == 370 || type == 290 || type == 641 || type == 581 || type == 544 || type == 425 || type == 360 || type == 362 || type == 190 || type == 500 || type == 560 || type == 410) { int addr = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, (i * 4)) + 0x28; LoadDll.WriteMemoryHwndValue((IntPtr)hwnd, addr, BitConverter.GetBytes(1)); } } } }
/// <summary> /// 游戏过出口 /// </summary> /// <param name="hwnd">句柄</param> /// <param name="x">出口X</param> /// <param name="y">出口Y</param> /// <returns></returns> public static int[] MhxyToExit(int hwnd, int x, int y) { int[] ret = new int[2]; int mapY = Global.addr.GetMapY(hwnd); //屏幕宽高 int[] scr = Global.addr.GetMhxyScreen(hwnd); //目的地址坐标 int s_x = x * 20 + 10; int s_y = mapY - ((y * 20) + 10); //////计算两点的距离 //int[] xy = Global.addr.getPeopleXY(hwnd); ////换算为原始坐标 //int p_x = xy[0] * 20 + 10; //int p_y = mapY - ((xy[1] * 20) + 10); //拿到渲染的中心点,计算显示区域 int c_x = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.MapAddr, 0xCC); int c_y = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.MapAddr, 0xD0); int x_min = c_x - scr[0] / 2; int x_max = c_x + scr[0] / 2; int y_min = c_y - scr[1] / 2; int y_max = c_y + scr[1] / 2; // Log.WriteLine("屏幕区间坐标【{0},{1}】,【{2},{3}】", x_min, y_min, x_max, y_max); //鼠标点击该坐标 Log.WriteLine("过出口【{0},{1}】", x, y); // Log.WriteLine("当前【{0},{1}】,目标地址【{2},{3}】", p_x, p_y, s_x, s_y); //关闭对话框 CloseDia(hwnd); UIShowStatus(hwnd, false); System.Threading.Thread.Sleep(300); CallFunc.clickWin(hwnd, s_x - x_min, s_y - y_min); System.Threading.Thread.Sleep(200); UIShowStatus(hwnd, true); return(ret); }
/// <summary> /// 读取对话选项 /// </summary> /// <param name="hwnd">句柄</param> /// <param name="option">第几个选项</param> /// <returns></returns> public static bean.Axis ReadDialogOption(int hwnd, int option) { bean.Axis a = null; int idx = 0; Random r = new Random(); for (int i = 0; i < 20; i++) { //获取对话框的x,y起点 int x = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x08); int y = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x0C); int type = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x18); int show = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x28); if (type != 550 || show == 1) { continue; } for (int n = 0; n < 10; n++) { int tz = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x68, 56 + n * 4, 0x00); int nx = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x68, 56 + n * 4, 0x08); if (nx == 30) { idx++; if (idx == option) { int ny = LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, Global.addr.win, 0x68, 0x8, 0x68, i * 4, 0x68, 56 + n * 4, 0x0C); x = nx + x + r.Next(10, 20); y = ny + y; a = new bean.Axis(x, y); } } } } return(a); }
/// <summary> /// 获取地图ID /// </summary> /// <param name="hwnd"></param> /// <returns></returns> public int GetMapID(int hwnd) { return(LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, MapAddr, 0x50, 0x0C)); }
//获取地图最大Y public int GetMapY(int hwnd) { return(LoadDll.ReadHwndMemoryOffsetValue((IntPtr)hwnd, MapAddr, 0x60, 0x14)); }