|
@@ -82,8 +82,7 @@ BOOL ClickSetup(HWND hWnd, LPCSTR lpszTemplateImage)
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-BOOL IsOnMap(HWND hWnd, LPCSTR lpszTemplateImage)
|
|
|
+CRect FindMatchIcon(HWND hWnd, LPCSTR lpszTemplateImage)
|
|
|
{
|
|
|
CRect rc;
|
|
|
TCHAR szTemplateImage[MAX_PATH] = { 0 };
|
|
@@ -95,12 +94,21 @@ BOOL IsOnMap(HWND hWnd, LPCSTR lpszTemplateImage)
|
|
|
_stprintf_s(szTemplateImage, _T("%s%s"), GAssist::g_strAppdir.c_str(), lpszTemplateImage);
|
|
|
if (GAssist::GetImgMatchtemplate(GAssist::g_strAppdir + _T("Game.bmp"), szTemplateImage, rc)) {
|
|
|
// 找到匹配的模块;
|
|
|
- DebugLog(_T("在目标地图上:%s"), lpszTemplateImage);
|
|
|
- return TRUE;
|
|
|
+ DebugLog(_T("找到匹配目标:%s"), lpszTemplateImage);
|
|
|
+ return rc;
|
|
|
}
|
|
|
|
|
|
- DebugLog(_T("不在目标地图上:%s"), lpszTemplateImage);
|
|
|
- return FALSE;
|
|
|
+ DebugLog(_T("没找到匹配目标:%s"), lpszTemplateImage);
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
+BOOL IsOnMap(HWND hWnd, LPCSTR lpszTemplateImage)
|
|
|
+{
|
|
|
+ CRect rc = FindMatchIcon(hWnd, lpszTemplateImage);
|
|
|
+ if (rc.IsRectEmpty() || rc.IsRectNull())
|
|
|
+ return FALSE;
|
|
|
+
|
|
|
+ return TRUE;
|
|
|
}
|
|
|
|
|
|
BOOL IsBattle(HWND hWnd)
|
|
@@ -117,7 +125,9 @@ BOOL IsBattle(HWND hWnd)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
-BOOL IsWattingAttack(HWND hWnd)
|
|
|
+// nAttackNPCType 0=镜妖; 1=职业挑战
|
|
|
+//
|
|
|
+BOOL IsWattingAttack(HWND hWnd, int nAttackNPCType)
|
|
|
{
|
|
|
#if 0
|
|
|
// 先截图
|
|
@@ -159,7 +169,7 @@ BOOL IsWattingAttack(HWND hWnd)
|
|
|
for (; it != contours.end(); it++)
|
|
|
{
|
|
|
length = arcLength(*it, true); area = contourArea(*it);
|
|
|
- if (length > 130 && area > 550.0)
|
|
|
+ if (length > 130 && area > 550.0)
|
|
|
{
|
|
|
//DebugLog(_T("当前周长和面积:%lf, %lf"), length, area);
|
|
|
bIsAttack = TRUE;
|
|
@@ -180,15 +190,33 @@ BOOL IsWattingAttack(HWND hWnd)
|
|
|
|
|
|
return bIsAttack;
|
|
|
#else
|
|
|
- BOOL bIsAttack = FALSE;
|
|
|
- // 将鼠标移动到指定位置;
|
|
|
- POINT ptDest = { 20, 50 }; // 左上角;
|
|
|
- GAssist::MouseMove(hWnd, ptDest);
|
|
|
-
|
|
|
CRect rc;
|
|
|
- if (GAssist::IsMatchIcon(hWnd, GAssist::g_strAppdir + _T("img\\我方攻击中.bmp"), { 0, 0, 30, 60 }, rc)) {
|
|
|
- DebugLog(_T("IsWattingAttack:我方攻击"));
|
|
|
- return FALSE;
|
|
|
+ BOOL bIsAttack = FALSE;
|
|
|
+ switch (nAttackNPCType)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ { // 将鼠标移动到指定位置;
|
|
|
+ POINT ptDest = { 20, 50 }; // 左上角;
|
|
|
+ GAssist::MouseMove(hWnd, ptDest);
|
|
|
+ if (GAssist::IsMatchIcon(hWnd, GAssist::g_strAppdir + _T("img\\我方攻击中.bmp"), { 0, 0, 30, 60 }, rc)) {
|
|
|
+ DebugLog(_T("IsWattingAttack:我方攻击"));
|
|
|
+ bIsAttack = TRUE;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 1:
|
|
|
+ {
|
|
|
+ // 将鼠标移动到指定位置;
|
|
|
+ POINT ptDest = { 625, 28 }; // 左上角;
|
|
|
+ GAssist::MouseMove(hWnd, ptDest);
|
|
|
+ if (!GAssist::IsMatchIcon(hWnd, GAssist::g_strAppdir + _T("img\\战斗中2.bmp"), { 0, 0, 30, 60 }, rc)) {
|
|
|
+ DebugLog(_T("IsWattingAttack:我方攻击"));
|
|
|
+ bIsAttack = TRUE;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
DebugLog(_T("IsWattingAttack:非技能选择"));
|
|
@@ -204,7 +232,7 @@ void BattleOnece(HWND hWnd, BOOL bHasSummoner)
|
|
|
{
|
|
|
SRAND(300, 500);
|
|
|
// 是否我方攻击;
|
|
|
- if (IsWattingAttack(hWnd)) {
|
|
|
+ if (IsWattingAttack(hWnd, 0)) {
|
|
|
// 人物固定F1
|
|
|
// 根据角色选择技能;
|
|
|
GAssist::SendKey(hWnd, VK_F1);
|
|
@@ -308,7 +336,7 @@ void BattleJY(HWND hWnd, BOOL bHasSummoner, BOOL bZJ)
|
|
|
BOOL bFirstAttack = TRUE;
|
|
|
while (IsBattle(hWnd)) { // 是否在战斗中;
|
|
|
// 是否我方攻击;
|
|
|
- while (IsWattingAttack(hWnd)) { // Bug:如果被镜妖打死了,无法中断;
|
|
|
+ while (IsWattingAttack(hWnd, 0)) { // Bug:如果被镜妖打死了,无法中断;
|
|
|
DebugLog(_T("BattleJY:我方攻击……"));
|
|
|
if (bFirstAttack)
|
|
|
{
|
|
@@ -528,7 +556,7 @@ void BattleJY2(HWND hWnd, BOOL bSummoner)
|
|
|
{
|
|
|
DebugLog(_T("BattleJY:战斗中"));
|
|
|
//while (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\技能选择.bmp"), rc))
|
|
|
- while ( IsWattingAttack(hWnd) )
|
|
|
+ while ( IsWattingAttack(hWnd,0) )
|
|
|
{
|
|
|
DebugLog(_T("BattleJY:我方攻击……"));
|
|
|
if (!bBattle)
|
|
@@ -932,7 +960,7 @@ void CGameAssistDlg::OnBnClickedOpengame()
|
|
|
}
|
|
|
|
|
|
|
|
|
-void CGameAssistDlg::OnBnClickedButton2()
|
|
|
+void CGameAssistDlg::OnBnClickedButton2() // 截图;
|
|
|
{
|
|
|
// TODO: 在此添加控件通知处理程序代码
|
|
|
|
|
@@ -944,7 +972,7 @@ void CGameAssistDlg::OnBnClickedButton2()
|
|
|
// vdx.CaptureImage(pData, len);
|
|
|
// vdx.Deinit();
|
|
|
// }
|
|
|
-#if 0
|
|
|
+#if 1
|
|
|
DWORD dwPid = GAssist::GetProcessId();
|
|
|
HWND hProWnd = GAssist::GetProMainHwnd(dwPid);
|
|
|
// 截图;
|
|
@@ -954,13 +982,12 @@ void CGameAssistDlg::OnBnClickedButton2()
|
|
|
GAssist::SaveHwndToBmpFile(hProWnd, strImg.GetString());
|
|
|
#endif
|
|
|
|
|
|
-#if 1
|
|
|
-
|
|
|
-#endif
|
|
|
+#if 0
|
|
|
CRect rc;
|
|
|
HWND hProWnd = GAssist::GetProcessMainWnd();
|
|
|
// POINT spt= { 20, 555 }; // 左下角;
|
|
|
- POINT spt = { 20, 50 }; // 左上角
|
|
|
+ //POINT spt = { 20, 50 }; // 左上角
|
|
|
+ POINT spt = { 625, 28 }; // 战斗时的右上角
|
|
|
|
|
|
// 选择坐标点;
|
|
|
GAssist::MouseMove(hProWnd, spt);
|
|
@@ -969,7 +996,7 @@ void CGameAssistDlg::OnBnClickedButton2()
|
|
|
//strImg = CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S %W-%A");
|
|
|
strImg = CTime::GetCurrentTime().Format("%H%M%S-Game.bmp");
|
|
|
GAssist::SaveHwndToBmpFile(hProWnd, strImg.GetString());
|
|
|
-
|
|
|
+#endif
|
|
|
|
|
|
#if 0
|
|
|
CRect rc;
|
|
@@ -1135,46 +1162,191 @@ void CGameAssistDlg::OnBnClickedButton5() //
|
|
|
}
|
|
|
|
|
|
|
|
|
+void AttachGDD(HWND hWnd)
|
|
|
+{
|
|
|
+ // 人物技能:Alt+S,双击选中,单击敌人;
|
|
|
+}
|
|
|
+
|
|
|
+// 挑战医师;
|
|
|
+void BattleYS(HWND hWnd, const char* lpszJN)
|
|
|
+{
|
|
|
+ CRect rc;
|
|
|
+ FindNPC(hWnd, "医师独侠");
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ rc = FindMatchIcon(hWnd, "img\\对话框关闭按钮.bmp");
|
|
|
+ Sleep(900);
|
|
|
+ } while (!rc.IsRectEmpty() && !rc.IsRectNull());
|
|
|
+
|
|
|
+ // 离开这里;
|
|
|
+ rc = FindMatchIcon(hWnd, _T("img\\gdd\\废话少说.bmp"));
|
|
|
+ if (!rc.IsRectEmpty() && !rc.IsRectNull())
|
|
|
+ {
|
|
|
+ // 确定
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rc = FindMatchIcon(hWnd, _T("img\\gdd\\离开这里.bmp"));
|
|
|
+ if (!rc.IsRectEmpty() && !rc.IsRectNull())
|
|
|
+ {
|
|
|
+ // 只有离开这里:已经打过,右键并退出 ;
|
|
|
+ GAssist::MouseRClick(hWnd);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TCHAR szJN[MAX_PATH] = { 0 };
|
|
|
+ _stprintf_s(szJN, _T("img\\jn-jk\\gdd\\%s.bmp"), lpszJN);
|
|
|
+ rc = FindMatchIcon(hWnd, szJN);
|
|
|
+ if (rc.IsRectEmpty() || rc.IsRectNull())
|
|
|
+ {
|
|
|
+ // 没有在当前页找到目标,看看是否在下一页;
|
|
|
+ rc = FindMatchIcon(hWnd, _T("img\\jn-jk\\gdd\\xyy.bmp"));
|
|
|
+ if (rc.IsRectEmpty() || rc.IsRectNull())
|
|
|
+ {
|
|
|
+ // 没有下一页,右键退出;
|
|
|
+ GAssist::MouseRClick(hWnd);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下一页中查看;
|
|
|
+ rc = FindMatchIcon(hWnd, szJN);
|
|
|
+ if (!rc.IsRectEmpty() && !rc.IsRectNull())
|
|
|
+ {
|
|
|
+ // 找到目标,单击;
|
|
|
+ GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
|
|
|
+ SRAND(300, 500);
|
|
|
+ // 战斗;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GAssist::MouseRClick(hWnd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 找到目标,单击;
|
|
|
+ GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
|
|
|
+ SRAND(300, 500);
|
|
|
+ // 战斗;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 右键退出;
|
|
|
+ GAssist::MouseRClick(hWnd);
|
|
|
+}
|
|
|
+
|
|
|
void CGameAssistDlg::OnBnClickedButton6() // 职业挑战;
|
|
|
{
|
|
|
CRect rc;
|
|
|
DebugLog(_T("进入孤独洞========="));
|
|
|
HWND hProWnd = GAssist::GetProcessMainWnd();
|
|
|
-#if 0
|
|
|
- //// 打开世界地图;
|
|
|
- GAssist::SendKey(hProWnd, VK_TAB); Sleep(500 + rand() % 200);
|
|
|
- if (!GAssist::GetImgMatchtemplate(hProWnd, GAssist::g_strAppdir + _T("img\\寻路窗口.bmp"), rc))
|
|
|
- return;
|
|
|
-
|
|
|
- //// 单击寻路窗口;
|
|
|
- GAssist::MouseClick(hProWnd, CPoint((rc.right + rc.left) / 2 + rand() % 2, (rc.top + rc.bottom) / 2 + rand() % 2)); Sleep(500 + rand() % 200);
|
|
|
- //// 设置剪切板:职业大挑战;
|
|
|
- GAssist::SetClipboardString("职业训导大师"); Sleep(200 + rand() % 200);
|
|
|
- //// Ctrl+V
|
|
|
- GAssist::SendKey(hProWnd, 0x56, TRUE); Sleep(300 + rand() % 200);
|
|
|
- // 先移动到目标后,才能实现单击;
|
|
|
- GAssist::MouseMove(hProWnd, CPoint((rc.right + rc.left) / 2 + 5 + rand() % 2, (rc.top + rc.bottom) / 2 + 60 + rand() % 2)); Sleep(200 + rand() % 100);
|
|
|
- //// 寻路窗口往下50就是目标;
|
|
|
- GAssist::MouseDbClick(hProWnd, CPoint((rc.right + rc.left) / 2 + 5 + rand() % 2, (rc.top + rc.bottom) / 2 + 60 + rand() % 2)); Sleep(200 + rand() % 100);
|
|
|
- //// 退出世界地址;
|
|
|
- GAssist::SendKey(hProWnd, VK_TAB); Sleep(200 + rand() % 50);
|
|
|
-#else
|
|
|
rc = FindNPC(hProWnd, "职业训导大师");
|
|
|
-#endif
|
|
|
|
|
|
// 选择进入;
|
|
|
BOOL bMatch = FALSE;
|
|
|
int trySize = 20;
|
|
|
+
|
|
|
// 我要挑战他们;
|
|
|
- while (!(bMatch = GAssist::GetImgMatchtemplate(GAssist::g_strAppdir + _T("Game.bmp"), GAssist::g_strAppdir + _T("img\\zyxdds-wytztm.bmp"), rc))) {
|
|
|
- Sleep(RAND(2000, 3000));
|
|
|
- // 截图;
|
|
|
- GAssist::SaveHwndToBmpFile(hProWnd, GAssist::g_strAppdir + _T("Game.bmp"));
|
|
|
- GAssist::MouseMove(hProWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
|
|
|
+ while (!(bMatch = ClickSetup(hProWnd, _T("img\\zyxdds-wytztm.bmp")))) {
|
|
|
+ SRAND(1200, 2200);
|
|
|
if (!trySize--) break;
|
|
|
}
|
|
|
|
|
|
+ // 准备好了
|
|
|
+ if (ClickSetup(hProWnd, _T("img\\zyxdds-zbhl.bmp")))
|
|
|
+ {
|
|
|
+ // 地图切换,等出图;
|
|
|
+ SRAND(2000, 2500);
|
|
|
+ if (IsOnMap(hProWnd, _T("img\\gdd\\name.bmp")))
|
|
|
+ {
|
|
|
+ DebugLog(_T("进入孤独洞"));
|
|
|
+ char szName[11][32] = { "医师独侠","术士独侠","道士独侠","武师独侠","浪子独侠","剑客独侠","弓手独侠","禁卫独侠","墨者独侠","巫煞独侠","魂武独侠" };
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
+ {
|
|
|
+ if (FindNPC(hProWnd, szName[i]))
|
|
|
+ {
|
|
|
+ if (_tcscmp(szName[i], _T("医师独侠")) == 0)
|
|
|
+ {
|
|
|
+ Sleep(RAND(5500, 6300)); // 等你走到她面前(步行、初骑、中骑、高骑,坐骑加速等级有关);
|
|
|
+ if (ClickSetup(hProWnd, "img\\jn-jk\\gdd\\xyy.bmp"))
|
|
|
+ {
|
|
|
+ // 选择技能:缚神诀;
|
|
|
+ if (ClickSetup(hProWnd, "img\\jn-jk\\gdd\\fsj.bmp"))
|
|
|
+ {
|
|
|
+ if (!ClickSetup(hProWnd, "\\img\\jn-jk\\gdd\\qd.bmp"))
|
|
|
+ break;
|
|
|
+ Sleep(RAND(500, 600));
|
|
|
+ if (!ClickSetup(hProWnd, "\\img\\jn-jk\\gdd\\qd.bmp"))
|
|
|
+ break;
|
|
|
+ Sleep(RAND(600, 1300));
|
|
|
+ // 打6下;
|
|
|
+ for (size_t i = 0; i < 5; i++)
|
|
|
+ {
|
|
|
+ // 缚神诀的快捷键是:F6
|
|
|
+ GAssist::SendKey(hProWnd, VK_F6);
|
|
|
+ Sleep(RAND(2000, 3500));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (!ClickSetup(hProWnd, "\\img\\jn-jk\\gdd\\qd.bmp"))
|
|
|
+ {
|
|
|
+ Sleep(RAND(600, 1300));
|
|
|
+ if (!ClickSetup(hProWnd, "\\img\\gdd\\废话少说.bmp"))
|
|
|
+ {
|
|
|
+ // 打6下;
|
|
|
+ for (size_t i = 0; i < 5; i++)
|
|
|
+ {
|
|
|
+ // 缚神诀的快捷键是:F6
|
|
|
+ GAssist::SendKey(hProWnd, VK_F6);
|
|
|
+ Sleep(RAND(2000, 3500));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (!ClickSetup(hProWnd, "\\img\\gdd\\废话少说.bmp"))
|
|
|
+ {
|
|
|
+ Sleep(RAND(600, 1300));
|
|
|
+ // 打6下;
|
|
|
+ for (size_t i = 0; i < 5; i++)
|
|
|
+ {
|
|
|
+ // 缚神诀的快捷键是:F6
|
|
|
+ GAssist::SendKey(hProWnd, VK_F6);
|
|
|
+ Sleep(RAND(2000, 3500));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (GAssist::GetImgMatchtemplate(GAssist::g_strAppdir + _T("Game.bmp"), GAssist::g_strAppdir + _T("img\\gdd\\离开这里.bmp"), rc))
|
|
|
+ {// 右键;
|
|
|
+ GAssist::MouseRClick(hProWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 我要挑战 || 我要离开;
|
|
|
+
|
|
|
+ if (_tcscmp(szName[i], _T("魂武独侠")) == 0)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Sleep(RAND(200, 300));
|
|
|
+ DebugLog(_T("进入孤独洞2:%s"), szName[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
if (bMatch) {
|
|
|
+
|
|
|
+ ClickSetup(hProWnd, _T("img\\zyxdds-zbhl.bmp"));
|
|
|
GAssist::MouseMove(hProWnd, CPoint(rc.left, rc.top));
|
|
|
// 单击:我要挑战他们;
|
|
|
GAssist::MouseClick(hProWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
|