|
@@ -131,9 +131,9 @@ BOOL IsWattingAttack(HWND hWnd)
|
|
|
|
|
|
// 指定区域进行二值化;
|
|
|
cv::Mat imgThreshold;
|
|
|
- cv::Mat imgROI = srcImg(cv::Rect(300, 50, 100, 70));
|
|
|
+ cv::Mat imgROI = srcImg(cv::Rect(350, 55, 50, 60));
|
|
|
cv::imwrite("IsWattingAttack-match.bmp", imgROI);
|
|
|
- if (GAssist::SetImgThreshold(imgROI, imgThreshold, 80, 255))
|
|
|
+ if (GAssist::SetImgThreshold(imgROI, imgThreshold, 150, 255))
|
|
|
{
|
|
|
if (imgThreshold.data) {
|
|
|
// 轮廓;
|
|
@@ -151,13 +151,19 @@ BOOL IsWattingAttack(HWND hWnd)
|
|
|
// RETR_EXTERNAL=只检索最外面的轮廓;
|
|
|
findContours(imgThreshold, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE);
|
|
|
|
|
|
-#if 0
|
|
|
+#if 1
|
|
|
+ double length, area;
|
|
|
// 找出白色区域的面积或周长;
|
|
|
std::vector<std::vector<cv::Point>>::iterator it = contours.begin();
|
|
|
for (; it != contours.end(); it++)
|
|
|
{
|
|
|
- // arcLength(*it, true) 面积;
|
|
|
- // contourArea(*it);
|
|
|
+ length = arcLength(*it, true); area = contourArea(*it);
|
|
|
+ if (length > 80.0 && area > 180.0)
|
|
|
+ {
|
|
|
+ DebugLog(_T("当前周长和面积:%lf, %lf"), length, area);
|
|
|
+ bIsAttack = TRUE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
#else
|
|
|
// 只要白色区域个数>=2
|
|
@@ -374,7 +380,7 @@ void BattleJY(HWND hWnd, BOOL bSummoner)
|
|
|
// 打镜妖喽罗;
|
|
|
GAssist::MouseClick(hWnd, CPoint(290 - 3, 140 - 20));
|
|
|
//GAssist::MouseMove(hWnd, CPoint(220 - 5, 180 - 10));// 打主镜妖;
|
|
|
- SRAND(100,200);
|
|
|
+ SRAND(200,300);
|
|
|
|
|
|
if (bSummoner) {
|
|
|
// 召唤兽技能;
|
|
@@ -399,8 +405,9 @@ void BattleJY(HWND hWnd, BOOL bSummoner)
|
|
|
else
|
|
|
{
|
|
|
GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
|
|
|
- SRAND(60, 100);
|
|
|
+ SRAND(200, 300);
|
|
|
}
|
|
|
+
|
|
|
bBattle = TRUE;
|
|
|
}
|
|
|
else
|
|
@@ -409,7 +416,9 @@ void BattleJY(HWND hWnd, BOOL bSummoner)
|
|
|
SRAND(50, 100);
|
|
|
GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
|
|
|
SRAND(60, 100);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ //SRAND(300, 550);
|
|
|
}
|
|
|
|
|
|
// 战斗中等待;
|
|
@@ -777,7 +786,10 @@ void CGameAssistDlg::OnBnClickedButton2()
|
|
|
DWORD dwPid = GAssist::GetProcessId();
|
|
|
HWND hProWnd = GAssist::GetProMainHwnd(dwPid);
|
|
|
// 截图;
|
|
|
- GAssist::SaveHwndToBmpFile(hProWnd, "Game.bmp");
|
|
|
+ CString strImg;
|
|
|
+ //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());
|
|
|
|
|
|
// GAssist::MouseMove(hProWnd, CPoint(290 - 5, 140 - 20));
|
|
|
//
|