Эх сурвалжийг харах

优化图片模块及部分函数。

Jeff 4 жил өмнө
parent
commit
c3d36543b3

+ 27 - 9
GameAssist/GameAssist/GameAssistDlg.cpp

@@ -17,9 +17,11 @@
 
 std::map<std::string, POINT> g_mapZYNPC;
 
+void InitZYNPC();
 BOOL IsWalkStop(HWND hWnd);
 CRect FindMatchIcon(HWND hWnd, LPCSTR lpszTemplateImage);
 void WorldMapPositioning(HWND hWnd, POINT ptMap);
+BOOL FindNPC(HWND hWnd, POINT ptMap, LPCTSTR lpszNPCName);
 
 VOID DebugLog(CHAR* pszStr, ...)
 {
@@ -44,7 +46,7 @@ void InitZYNPC()
 		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("道士独侠"), { 305, 325 }));
 		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("武师独侠"), { 305, 325 }));
 		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("浪子独侠"), { 160, 435 }));
-		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("剑客独侠"), { 420, 230 }));
+		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("剑客独侠"), { 420, 215 }));
 		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("弓手独侠"), { 265, 230 }));
 		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("禁卫独侠"), { 155, 205 }));
 		g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("墨者独侠"), { 155, 205 }));
@@ -123,11 +125,25 @@ BOOL FindNPC(HWND hWnd, POINT ptMap, LPCTSTR lpszNPCName)
 	GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
 	// 单击:我要挑战他们;
 	GAssist::MouseClick(hWnd, { (rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2 }, TRUE);
+	
 	SRAND(900, 1300);// 等对话框出现;
+	// 移动鼠标:不要停留在人物身上;
+	GAssist::MouseMove(hWnd, { rc.left - rand() % 10, rc.top - rand() % 10 });
 
 	return TRUE;
 }
 
+BOOL FindZYPNC(HWND hWnd, LPCTSTR lpNPCName)
+{
+	auto it = g_mapZYNPC.find(lpNPCName);
+	if (it != g_mapZYNPC.end())
+	{
+		return FindNPC(hWnd, it->second, it->first.c_str());
+	}
+
+	return FALSE;
+}
+
 // 单击对话框里的步骤;
 BOOL ClickDlgSetup(HWND hWnd, LPCSTR lpszTemplateImage)
 {
@@ -704,7 +720,7 @@ void BattleYS(HWND hWnd, const char* lpszJN)
 {
 	CRect rc;
 	BOOL bBattle = FALSE;
-	if (!FindNPC(hWnd, "医师独侠"))
+	if (!FindZYPNC(hWnd, "医师独侠"))
 		return;
 
 	// 废话少说:表示这个没打过;
@@ -752,10 +768,10 @@ void BattleYS(HWND hWnd, const char* lpszJN)
 					GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
 					SRAND(300, 500);
 					// 移动下,防止高亮识别失败;
-					GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.right + rand() % 10, rc.bottom + rand() % 10 });
+					GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.right - rand() % 10, rc.bottom - rand() % 10 });
 					SRAND(250, 300);
 					ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
-					SRAND(250, 300);
+					SRAND(350, 500);
 
 					rc = FindMatchIcon(hWnd, _T("img\\gdd\\接受挑战.bmp"));
 					if (!rc.IsRectEmpty() && !rc.IsRectNull())
@@ -764,8 +780,8 @@ void BattleYS(HWND hWnd, const char* lpszJN)
 						GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
 						SRAND(300, 500);
 						// 移动下,防止高亮识别失败;
-						GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.right + rand() % 20, rc.bottom + rand() % 20 });
-						SRAND(50,150);
+						GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.left - rand() % 20, rc.top - rand() % 20 });
+						SRAND(250,350);
 					}
 
 					ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
@@ -870,7 +886,7 @@ void BattleOthers(HWND hWnd, const char* lpszName, const char* lpszSkillName)
 		GAssist::SendKey(hWnd, VK_TAB); SRAND(100, 300);
 	}
 	
-	if (!FindNPC(hWnd, lpszName))
+	if (!FindZYPNC(hWnd, lpszName))
 		return;
 
 	// 废话少说:表示这个没打过;
@@ -1005,7 +1021,7 @@ END_MESSAGE_MAP()
 BOOL CGameAssistDlg::OnInitDialog()
 {
 	CDialog::OnInitDialog();
-
+	InitZYNPC();
 	// 将“关于...”菜单项添加到系统菜单中。
 
 	// IDM_ABOUTBOX 必须在系统命令范围内。
@@ -1777,7 +1793,7 @@ void CGameAssistDlg::OnBnClickedButton11() // 刷
 	// TODO: 在此添加控件通知处理程序代码
 	InitZYNPC();
 	HWND hWnd = GAssist::GetProcessMainWnd();
-
+	// "职业训导大师", 
 	char szName[11][32] = {"医师独侠", "术士独侠","道士独侠","武师独侠","浪子独侠",
 		"剑客独侠","弓手独侠","禁卫独侠","墨者独侠","巫煞独侠","魂武独侠" };
 
@@ -1787,6 +1803,8 @@ void CGameAssistDlg::OnBnClickedButton11() // 刷
 		if (it != g_mapZYNPC.end())
 		{
 			FindNPC(hWnd, it->second, it->first.c_str());
+			if (_tcsicmp("职业训导大师", it->first.c_str()))
+				Sleep(6000);
 			Sleep(500);
 			GAssist::MouseRClick(hWnd);
 		}

BIN
GameAssist/GameAssist/walk1.bmp


BIN
GameAssist/GameAssist/walk2.bmp


BIN
GameAssist/img/npc/墨者独侠.bmp


BIN
GameAssist/img/npc/禁卫独侠.bmp


BIN
GameAssist/img/npc/职业训导大师.bmp


BIN
GameAssist/img/npc/魂武独侠.bmp