|
@@ -15,13 +15,21 @@
|
|
#define RAND(a,b) (rand()%(b-a)+a)
|
|
#define RAND(a,b) (rand()%(b-a)+a)
|
|
#define SRAND(a,b) (Sleep(rand()%(b-a)+a))
|
|
#define SRAND(a,b) (Sleep(rand()%(b-a)+a))
|
|
|
|
|
|
|
|
+typedef struct POINT_NPC
|
|
|
|
+{
|
|
|
|
+ POINT ptMap;
|
|
|
|
+ POINT ptNpc;
|
|
|
|
+}PNPC, * pPNPC;
|
|
|
|
+
|
|
std::map<std::string, POINT> g_mapZYNPC;
|
|
std::map<std::string, POINT> g_mapZYNPC;
|
|
|
|
+std::map<std::string, PNPC> g_mapZYNPC2;
|
|
|
|
|
|
void InitZYNPC();
|
|
void InitZYNPC();
|
|
BOOL IsWalkStop(HWND hWnd);
|
|
BOOL IsWalkStop(HWND hWnd);
|
|
CRect FindMatchIcon(HWND hWnd, LPCSTR lpszTemplateImage);
|
|
CRect FindMatchIcon(HWND hWnd, LPCSTR lpszTemplateImage);
|
|
void WorldMapPositioning(HWND hWnd, POINT ptMap);
|
|
void WorldMapPositioning(HWND hWnd, POINT ptMap);
|
|
BOOL FindNPC(HWND hWnd, POINT ptMap, LPCTSTR lpszNPCName);
|
|
BOOL FindNPC(HWND hWnd, POINT ptMap, LPCTSTR lpszNPCName);
|
|
|
|
+BOOL FindNPC(HWND hWnd, LPCTSTR lpNPCName, POINT ptMap, POINT ptNpc);
|
|
|
|
|
|
VOID DebugLog(CHAR* pszStr, ...)
|
|
VOID DebugLog(CHAR* pszStr, ...)
|
|
{
|
|
{
|
|
@@ -55,6 +63,18 @@ void InitZYNPC()
|
|
// 应天府NPC
|
|
// 应天府NPC
|
|
g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("职业训导大师"), { 315, 415 }));
|
|
g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("职业训导大师"), { 315, 415 }));
|
|
|
|
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("医师独侠"), { { 305, 325 }, { 590, 380 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("术士独侠"), { { 305, 325 }, { 610, 160 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("道士独侠"), { { 305, 325 }, { 140, 160 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("武师独侠"), { { 305, 325 }, { 140, 380 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("浪子独侠"), { { 160, 435 }, { 190, 370 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("剑客独侠"), { { 420, 215 }, { 540, 170 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("弓手独侠"), { { 265, 230 }, { 460, 150 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("禁卫独侠"), { { 155, 205 }, { 605, 235 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("墨者独侠"), { { 155, 205 }, { 315, 380 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("巫煞独侠"), { { 155, 205 }, { 270, 175 } }));
|
|
|
|
+ g_mapZYNPC2.insert(std::pair<std::string, PNPC>(_T("魂武独侠"), { { 165, 335 }, { 270, 305 } }));
|
|
|
|
+
|
|
bInit = true;
|
|
bInit = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -133,12 +153,61 @@ BOOL FindNPC(HWND hWnd, POINT ptMap, LPCTSTR lpszNPCName)
|
|
return TRUE;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+BOOL FindNPC(HWND hWnd, LPCTSTR lpszNPCName, POINT ptMap, POINT ptNpc)
|
|
|
|
+{
|
|
|
|
+ TCHAR szNPC[MAX_PATH] = { 0 };
|
|
|
|
+ _stprintf_s(szNPC, _T("img\\npc\\%s.bmp"), lpszNPCName);
|
|
|
|
+ CRect rc = FindMatchIcon(hWnd, szNPC);
|
|
|
|
+ if (rc.IsRectEmpty() || rc.IsRectNull())
|
|
|
|
+ {
|
|
|
|
+ WorldMapPositioning(hWnd, ptMap);
|
|
|
|
+ Sleep(600); // 有时走到目标点,NPC还未刷新出来;
|
|
|
|
+ rc = FindMatchIcon(hWnd, szNPC);
|
|
|
|
+ if (rc.IsRectEmpty() || rc.IsRectNull())
|
|
|
|
+ {
|
|
|
|
+ // 可能还是未刷新出来,再次等待;
|
|
|
|
+ Sleep(300);
|
|
|
|
+ rc = FindMatchIcon(hWnd, szNPC);
|
|
|
|
+ if (rc.IsRectEmpty() || rc.IsRectNull())
|
|
|
|
+ {
|
|
|
|
+ return FALSE;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 找到目标,单击;
|
|
|
|
+ GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
|
|
|
|
+ // 单击:我要挑战他们;
|
|
|
|
+ GAssist::MouseClick(hWnd, ptNpc, TRUE);
|
|
|
|
+
|
|
|
|
+ // 遍历3次;
|
|
|
|
+ BOOL bFind = FALSE;
|
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
|
+ {
|
|
|
|
+ Sleep(800 - i * 150);
|
|
|
|
+ CRect rc = FindMatchIcon(hWnd, "img\\对话框关闭按钮.bmp");
|
|
|
|
+ if (!rc.IsRectEmpty() && !rc.IsRectNull())
|
|
|
|
+ {
|
|
|
|
+ bFind = TRUE;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 移动鼠标:不要停留在人物身上;
|
|
|
|
+ GAssist::MouseMove(hWnd, { ptNpc.x - rand() % 10, ptNpc.y - rand() % 10 });
|
|
|
|
+
|
|
|
|
+ return bFind;
|
|
|
|
+}
|
|
|
|
+
|
|
BOOL FindZYPNC(HWND hWnd, LPCTSTR lpNPCName)
|
|
BOOL FindZYPNC(HWND hWnd, LPCTSTR lpNPCName)
|
|
{
|
|
{
|
|
- auto it = g_mapZYNPC.find(lpNPCName);
|
|
|
|
- if (it != g_mapZYNPC.end())
|
|
|
|
|
|
+ auto it = g_mapZYNPC2.find(lpNPCName);
|
|
|
|
+ if (it != g_mapZYNPC2.end())
|
|
{
|
|
{
|
|
- return FindNPC(hWnd, it->second, it->first.c_str());
|
|
|
|
|
|
+ if (FindNPC(hWnd, it->first.c_str(), it->second.ptMap, it->second.ptNpc))
|
|
|
|
+ {
|
|
|
|
+ return TRUE;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return FALSE;
|
|
return FALSE;
|
|
@@ -807,6 +876,7 @@ void BattleYS(HWND hWnd, const char* lpszJN)
|
|
if (nRet == 1)
|
|
if (nRet == 1)
|
|
{
|
|
{
|
|
// 没有找到技能;
|
|
// 没有找到技能;
|
|
|
|
+ SRAND(300, 500);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -896,6 +966,7 @@ void BattleOthers(HWND hWnd, const char* lpszName, const char* lpszSkillName)
|
|
GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
|
|
GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
|
|
SRAND(330, 550);
|
|
SRAND(330, 550);
|
|
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(50, 100);
|
|
// 确定
|
|
// 确定
|
|
bBattle = TRUE;
|
|
bBattle = TRUE;
|
|
ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
|
|
ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
|
|
@@ -994,6 +1065,7 @@ void CGameAssistDlg::DoDataExchange(CDataExchange* pDX)
|
|
DDX_Control(pDX, IDC_CHECK3, m_cbZJ2);
|
|
DDX_Control(pDX, IDC_CHECK3, m_cbZJ2);
|
|
DDX_Control(pDX, IDC_CHECK6, m_cbAggressiveSkill);
|
|
DDX_Control(pDX, IDC_CHECK6, m_cbAggressiveSkill);
|
|
DDX_Control(pDX, IDC_COMBO1, m_cbGameRole);
|
|
DDX_Control(pDX, IDC_COMBO1, m_cbGameRole);
|
|
|
|
+ DDX_Control(pDX, IDC_COMBO2, m_cbZYNPC);
|
|
}
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CGameAssistDlg, CDialog)
|
|
BEGIN_MESSAGE_MAP(CGameAssistDlg, CDialog)
|
|
@@ -1013,6 +1085,7 @@ BEGIN_MESSAGE_MAP(CGameAssistDlg, CDialog)
|
|
ON_BN_CLICKED(IDC_BUTTON10, &CGameAssistDlg::OnBnClickedButton10)
|
|
ON_BN_CLICKED(IDC_BUTTON10, &CGameAssistDlg::OnBnClickedButton10)
|
|
ON_BN_CLICKED(IDC_BUTTON11, &CGameAssistDlg::OnBnClickedButton11)
|
|
ON_BN_CLICKED(IDC_BUTTON11, &CGameAssistDlg::OnBnClickedButton11)
|
|
ON_BN_CLICKED(IDC_BUTTON12, &CGameAssistDlg::OnBnClickedButton12)
|
|
ON_BN_CLICKED(IDC_BUTTON12, &CGameAssistDlg::OnBnClickedButton12)
|
|
|
|
+ ON_BN_CLICKED(IDC_BUTTON13, &CGameAssistDlg::OnBnClickedButton13)
|
|
END_MESSAGE_MAP()
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
@@ -1021,7 +1094,7 @@ END_MESSAGE_MAP()
|
|
BOOL CGameAssistDlg::OnInitDialog()
|
|
BOOL CGameAssistDlg::OnInitDialog()
|
|
{
|
|
{
|
|
CDialog::OnInitDialog();
|
|
CDialog::OnInitDialog();
|
|
- InitZYNPC();
|
|
|
|
|
|
+
|
|
// 将“关于...”菜单项添加到系统菜单中。
|
|
// 将“关于...”菜单项添加到系统菜单中。
|
|
|
|
|
|
// IDM_ABOUTBOX 必须在系统命令范围内。
|
|
// IDM_ABOUTBOX 必须在系统命令范围内。
|
|
@@ -1049,6 +1122,14 @@ BOOL CGameAssistDlg::OnInitDialog()
|
|
|
|
|
|
// TODO: 在此添加额外的初始化代码
|
|
// TODO: 在此添加额外的初始化代码
|
|
GAssist::Init();
|
|
GAssist::Init();
|
|
|
|
+ InitZYNPC();
|
|
|
|
+
|
|
|
|
+ int nIndex = 0;
|
|
|
|
+ for each (auto it in g_mapZYNPC)
|
|
|
|
+ {
|
|
|
|
+ m_cbZYNPC.InsertString(nIndex++, it.first.c_str());
|
|
|
|
+ }
|
|
|
|
+ m_cbZYNPC.SetCurSel(0);
|
|
|
|
|
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
|
}
|
|
}
|
|
@@ -1816,10 +1897,14 @@ void CGameAssistDlg::OnBnClickedButton12()
|
|
{
|
|
{
|
|
// TODO: 在此添加控件通知处理程序代码
|
|
// TODO: 在此添加控件通知处理程序代码
|
|
HWND hWnd = GAssist::GetProcessMainWnd();
|
|
HWND hWnd = GAssist::GetProcessMainWnd();
|
|
|
|
+ // 将鼠标移动到指定位置;
|
|
|
|
+ POINT ptDest = { 625, 28 }; // 左上角;
|
|
|
|
+
|
|
while ( true )
|
|
while ( true )
|
|
{
|
|
{
|
|
while (IsBattle(hWnd))
|
|
while (IsBattle(hWnd))
|
|
{
|
|
{
|
|
|
|
+ GAssist::MouseMove(hWnd, ptDest);
|
|
if ( IsWattingAttack(hWnd,1) )
|
|
if ( IsWattingAttack(hWnd,1) )
|
|
{
|
|
{
|
|
GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
|
|
GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
|
|
@@ -1830,3 +1915,22 @@ void CGameAssistDlg::OnBnClickedButton12()
|
|
Sleep(600);
|
|
Sleep(600);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void CGameAssistDlg::OnBnClickedButton13() // 地图找挑战NPC;
|
|
|
|
+{
|
|
|
|
+ HWND hWnd = GAssist::GetProcessMainWnd();
|
|
|
|
+ int nCurSel = m_cbZYNPC.GetCurSel();
|
|
|
|
+ if (nCurSel == CB_ERR)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ CString strNPC;
|
|
|
|
+ m_cbZYNPC.GetLBText(nCurSel, strNPC);
|
|
|
|
+ auto it = g_mapZYNPC.find(strNPC.GetString());
|
|
|
|
+ if (it != g_mapZYNPC.end())
|
|
|
|
+ {
|
|
|
|
+ //FindNPC(hWnd, { it->second.x, it->second.y }, it->first.c_str());
|
|
|
|
+ WorldMapPositioning(hWnd, { it->second.x, it->second.y });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|