Mã:
#include <windows.h>#include "resource.h"#include <process.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; #pragma comment( linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' \version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"" ) /////////////////////////////////////////////////////////////#define ROW 11#define COLUMN 18 int countMonster; //---------------------------------------------typedef struct { int *pointAddress; int *timeAddress; int *turnAddress; HWND hwndGame; }Pointer; //---------------------------------------------typedef struct { int Address; int ValueAddress; int StatusAddress; int CountMonster; HWND hPikachu; }Resource; //---------------------------------------------typedef struct { int iValue; int iStatus; }MONSTER; //---------------------------------------------typedef struct { int x; int y; }Point; //---------------------------------------------typedef struct{ BOOL bPoint; BOOL bTime; BOOL bTurn; BOOL bAuto; } StatusButton ; //---------------------------------------------typedef struct{ float point; int turn; int time; } ValueGame; ////////////////////////////////////////////////////////////////////////// Pointer Node;Resource Obj;MONSTER monster[ROW][COLUMN];StatusButton sButton;ValueGame vGame;HANDLE hProcess;HWND hWin; //////////////////////////////////////////////////////////////////////////int CheckPath(int ,int ,int ,int);void Auto();void ReadMap(); //////////////////////////////////////////////////////////////////////////int Initialize(){ Node.pointAddress = (int*)0x004B6088; Node.timeAddress = (int*)0x004B6084; Node.turnAddress = (int*)0x004B60AA; //--------------------------------------------- Obj.Address = 0x04B6044; Obj.CountMonster = 0x04B6078; sButton.bPoint = sButton.bTime = sButton.bTurn = FALSE; vGame.point = vGame.time = vGame.turn = 0; Node.hwndGame = FindWindow(TEXT("ThunderRT6FormDC"),TEXT("³s³s¬Ý2")); if ( !Node.hwndGame ) { MessageBox(NULL,TEXT("Open Game Please !!..."), TEXT("Test"), MB_OK ); return FALSE; } while ( true ) { if ( !FindWindowEx(Node.hwndGame,Obj.hPikachu,NULL,NULL) ) break; Obj.hPikachu = FindWindowEx(Node.hwndGame,Obj.hPikachu,NULL,NULL); } // ------------------- Close While Loop ------------------- DWORD dwProcessID; GetWindowThreadProcessId(Node.hwndGame,&dwProcessID); hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,dwProcessID); if ( !hProcess ) return FALSE; ReadProcessMemory(hProcess,(int*)Obj.Address,&Obj.ValueAddress,sizeof(int),NULL); Obj.ValueAddress += 0x76; ReadProcessMemory(hProcess,(int*)Obj.Address,&Obj.StatusAddress,sizeof(int),NULL); Obj.StatusAddress += 0x72; return TRUE;} int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ static TCHAR szAppName[] = TEXT ("TuMeoBox") ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; // Khoi tao bien if ( !Initialize() ) return 0; TCHAR szBuffer[MAX_PATH]; if ( !Node.hwndGame ){ wsprintf(szBuffer, TEXT("Don't Found Window Game !...") ); MessageBox(NULL,szBuffer, TEXT("Test"), MB_OK ); return 0; } wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = DLGWINDOWEXTRA ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (hInstance, TEXT("TuMeoIcon")) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1); wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBeep(0); return 0 ; } hwnd = CreateDialog(hInstance,TEXT("TuMeoDlg"),NULL,NULL); ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ;} //////////////////////////////////////////////////////////////////////////void ThreadPoint(PVOID pVoid){ WriteProcessMemory(hProcess,Node.pointAddress,&vGame.point,sizeof(float),NULL); while ( sButton.bPoint ){ //GetWindowThreadProcessId(Node.hwndGame,&pId); //hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pId); WriteProcessMemory(hProcess,Node.pointAddress,&vGame.point,sizeof(float),NULL); Sleep(500); } _endthread(); } //////////////////////////////////////////////////////////////////////////void ThreadTime(PVOID pVoid){ while ( sButton.bTime ) { WriteProcessMemory(hProcess,Node.timeAddress,&vGame.time,sizeof(int),NULL); Sleep(999); } // ------------------- Close While Loop ------------------- _endthread(); } //////////////////////////////////////////////////////////////////////////void ThreadTurn(PVOID pVoid){ WriteProcessMemory(hProcess,Node.turnAddress,&vGame.turn,sizeof(int),NULL); while ( sButton.bTurn ) { WriteProcessMemory(hProcess,Node.turnAddress,&vGame.turn,sizeof(int),NULL); Sleep(999); } // ------------------- Close While Loop ------------------- _endthread(); } //////////////////////////////////////////////////////////////////////////void ThreadAuto(PVOID pVoid){ while ( sButton.bAuto ) { Auto(); } // ------------------- Close While Loop ------------------- _endthread();} //---------------------------------------------LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ HDC hdc ; PAINTSTRUCT ps ; static RECT rect ; TEXTMETRIC tm; static int cxClient, cyClient , cxChar , cyChar ; static TCHAR szBuffer[1024]; static HINSTANCE hInst; DWORD pId; HANDLE hProcess; float point = 100; static HWND hButton; switch ( message ){ case WM_CREATE: hInst = ( (LPCREATESTRUCT) lParam)->hInstance; break; case WM_SIZE: cxClient = LOWORD(lParam); cyClient = HIWORD(lParam); break; case WM_COMMAND: switch ( LOWORD(wParam) ){ case IDC_POINT: sButton.bPoint ^= 1; if ( sButton.bPoint ) _beginthread(ThreadPoint,0,0); break; case IDC_SETPOINT: vGame.point = GetDlgItemInt(hwnd,IDC_VALUEPOINT,NULL,FALSE); _beginthread(ThreadPoint,0,0); break; case IDC_TIME: sButton.bTime ^= 1;//( sButton.bTime) ? FALSE : TRUE; vGame.time = 0; if ( sButton.bTime ) _beginthread(ThreadTime,0,0); break; case IDC_TURN: sButton.bTurn ^= 1; if ( sButton.bTurn ) _beginthread(ThreadTurn,0,0); break; case IDC_SETTURN: vGame.turn = GetDlgItemInt(hwnd,IDC_TURNVALUE,NULL,FALSE); _beginthread(ThreadTurn,0,0); break; case IDC_AUTO: sButton.bAuto = TRUE; hButton = GetDlgItem(hwnd,IDC_AUTO); SetWindowLong(hButton,GWL_ID,IDC_CANCEL); SetWindowText(hButton,TEXT("Cancel")); _beginthread(ThreadAuto,0,0); break; case IDC_CANCEL: sButton.bAuto = FALSE; hButton = GetDlgItem(hwnd,IDC_CANCEL); SetWindowLong(hButton,GWL_ID,IDC_AUTO); SetWindowText(hButton,TEXT("Auto Play")); break; case IDOK: DestroyWindow(hwnd); break; } // -------------------End Switch ------------------- break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc (hwnd, message, wParam, lParam) ; } // ------------- End Switch ----------- return 0; } //////////////////////////////////////////////////////////////////////////void ReadMap(){ for ( int i = 0;i<ROW;i++ ) for ( int j = 0;j<COLUMN;j++ ) { ReadProcessMemory(hProcess,(int*)( Obj.ValueAddress - 19*6 + ( i*18 + j )*6 ),&monster[i][j].iValue,1,NULL); ReadProcessMemory(hProcess,(int*)( Obj.StatusAddress - 19*6 + ( i*18 + j )*6 ),&monster[i][j].iStatus,2,NULL); } // ------------------- Close For Loop ------------------- ReadProcessMemory(hProcess,(int*)Obj.CountMonster,&countMonster,1,NULL);} //////////////////////////////////////////////////////////////////////////int Inside(int x1,int y1){ if ( x1 >= 0 && x1 < ROW && y1 >= 0 && y1 < COLUMN ) return TRUE; return FALSE;} //////////////////////////////////////////////////////////////////////////int CheckPath(int x1,int y1,int x2,int y2){ int i,j; BOOL CanGo[4] , Check[ROW][COLUMN] ; int cx[4] = {0,0,1,-1}; int cy[4] = {1,-1,0,0}; int first , last; int Path[ROW][COLUMN]; Point Queue[198]; int varX[4] , varY[4]; // 2 o trung nhau if ( x1 == x2 && y1 == y2 ) return FALSE; // 2 o khac gia tri nhau if ( monster[x1][y1].iValue != monster[x2][y2].iValue ) return FALSE; // 1 trong 2 o khong ton tai if ( !monster[x1][y1].iStatus || !monster[x2][y2].iStatus ) return FALSE; first = last = 0; Queue[last].x = x1; Queue[last++].y = y1; for ( int i1 = 0 ; i1<ROW; i1++ ) for ( int j1 = 0 ;j1<COLUMN;j1++ ) { Check[i1][j1] = FALSE; Path[i1][j1] = FALSE; } // ------------------- Close For Loop ------------------- Check[x1][y1] = TRUE; while ( first < last ) { i = Queue[first].x; j = Queue[first++].y; for ( int t = 0 ;t<4;t++ ) { CanGo[t] = TRUE; varX[t] = i; varY[t] = j; } do { for ( int t = 0 ; t<4; t++ ) { if ( CanGo[t] ){ varX[t] += cx[t]; varY[t] += cy[t]; if ( !Inside(varX[t],varY[t]) ){ CanGo[t] = FALSE ; continue; } if ( varX[t] == x2 && varY[t] == y2 ) return TRUE; if ( monster[varX[t]][varY[t]].iStatus ) { CanGo[t] = FALSE ; continue; } if ( Check[varX[t]][varY[t]] ) continue; if ( Path[i][j] == 2 ) continue; Queue[last].x = varX[t]; Queue[last++].y = varY[t]; Check[varX[t]][varY[t]] = TRUE; Path[varX[t]][varY[t]] = Path[i][j] + 1; } } // ------------------- Close For Loop ------------------- } while ( CanGo[0] || CanGo[1] || CanGo[2] || CanGo[3] ); // ------------------- Close Do Loop ------------------- } // ------------------- Close While Loop ------------------- return FALSE;} //////////////////////////////////////////////////////////////////////////void Auto(){ int x1,x2,y1,y2; ReadMap(); HWND hwndOk; if ( !countMonster ){ hWin = FindWindow(TEXT("#32770"),TEXT("??")); if ( hWin ){ hWin = GetWindow(hWin,GW_CHILD); SendMessage(hWin,WM_LBUTTONDOWN,1,MAKELONG(3,3)); SendMessage(hWin,WM_LBUTTONUP,1,MAKELONG(3,3)); SendMessage(hWin,WM_LBUTTONDOWN,1,MAKELONG(3,3)); SendMessage(hWin,WM_LBUTTONUP,1,MAKELONG(3,3)); } } for ( int i = 0 ; i< 16*9 - 1;i++ ) { x1 = i/16 + 1; y1 = i%16 + 1; for ( int j = i+1; j<16*9 ;j++ ) { x2 = j/16 + 1; y2 = j%16 + 1; if ( CheckPath(x1,y1,x2,y2) ){ SendMessage(Obj.hPikachu,WM_LBUTTONDOWN,1,MAKELONG( (y1-1)*40 + 80 , (x1-1)*50 + 80) ); SendMessage(Obj.hPikachu,WM_LBUTTONDOWN,1,MAKELONG( (y2-1)*40 + 80 , (x2-1)*50 + 80) ); return; } } // ------------------- Close For Loop ------------------- } // ------------------- Close For Loop -------------------}
Dụng cụ cầm tay (hand tools) là một trong những dụng cụ được sử dụng phổ thông trong cuộc sống hàng ngày của mọi người. Đặc biệt đối với cánh mày râu thì những dụng cụ này đã trở thành quá thân...
Một số bổ ích của bộ bộ đồ cầm tay...