123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776 |
- // GameAssistDlg.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "GameAssist.h"
- #include "GameAssistDlg.h"
- //#include "VideoDXGICaptor.h"
- #include "MouseAssist.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- #define RAND(a,b) (rand()%(b-a)+a)
- #define SRAND(a,b) (Sleep(rand()%(b-a)+a))
- std::map<std::string, POINT> g_mapZYNPC;
- BOOL IsWalkStop(HWND hWnd);
- CRect FindMatchIcon(HWND hWnd, LPCSTR lpszTemplateImage);
- void WorldMapPositioning(HWND hWnd, POINT ptMap);
- VOID DebugLog(CHAR* pszStr, ...)
- {
- char szData[MAX_PATH] = { 0 };
- _stprintf_s(szData, _T("%s %s "), _T("[GameAssist] "), CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S")).GetString());
- int len = strlen(szData);
- va_list args;
- va_start(args, pszStr);
- _vsnprintf_s(szData + len, MAX_PATH - len, MAX_PATH - len, pszStr, args);
- va_end(args);
- strcat_s(szData, "\n");
- OutputDebugStringA(szData);
- }
- void InitZYNPC()
- {
- // "医师独侠","术士独侠","道士独侠","武师独侠","浪子独侠","剑客独侠", "弓手独侠", "禁卫独侠", "墨者独侠", "巫煞独侠", "魂武独侠"
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("医师独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("术士独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("道士独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("武师独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("浪子独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("剑客独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("弓手独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("禁卫独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("墨者独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("巫煞独侠"), { 0, 0 }));
- g_mapZYNPC.insert(std::pair<std::string, POINT>(_T("魂武独侠"), { 0, 0 }));
- }
- BOOL FindNPC(HWND hWnd, LPCSTR lpszNPC)
- {
- CRect rc;
- //// 打开世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(500, 600);
- if (!GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\寻路窗口.bmp"), rc))
- return FALSE;
- //// 单击寻路窗口;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 2, (rc.top + rc.bottom) / 2 + rand() % 2)); SRAND(500, 800);
- //// 设置剪切板:职业大挑战;
- GAssist::SetClipboardString(lpszNPC); SRAND(200, 500);
- //// Ctrl+V
- GAssist::SendKey(hWnd, 0x56, TRUE); SRAND(300, 500);
- // 先移动到目标后,才能实现单击;
- GAssist::MouseMove(hWnd, CPoint((rc.right + rc.left) / 2 + 5 + rand() % 2, (rc.top + rc.bottom) / 2 + 60 + rand() % 2)); SRAND(200, 300);
- //// 寻路窗口往下50就是目标;
- GAssist::MouseDbClick(hWnd, CPoint((rc.right + rc.left) / 2 + 5 + rand() % 2, (rc.top + rc.bottom) / 2 + 60 + rand() % 2)); SRAND(200, 300);
- //// 退出世界地址;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(200, 300);
- // 直到停止走动为止;
- IsWalkStop(hWnd);
- // 遍历3次;
- BOOL bFind = FALSE;
- for (int i = 0; i < 3; i++)
- {
- Sleep(600);
- rc = FindMatchIcon(hWnd, "img\\对话框关闭按钮.bmp");
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- bFind = TRUE;
- break;
- }
- }
- return bFind;
- }
- BOOL FindNPC(HWND hWnd, POINT ptMap, LPCTSTR lpszTemplate)
- {
- WorldMapPositioning(hWnd, ptMap);
- CRect rc = FindMatchIcon(hWnd, lpszTemplate);
- if (rc.IsRectEmpty() || rc.IsRectNull())
- return FALSE;
- // 找到目标,单击;
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- // 单击:我要挑战他们;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(900, 1500);// 等对话框出现;
- return TRUE;
- }
- // 单击对话框里的步骤;
- BOOL ClickDlgSetup(HWND hWnd, LPCSTR lpszTemplateImage)
- {
- CRect rc = FindMatchIcon(hWnd, lpszTemplateImage);
- if (rc.IsRectEmpty() || rc.IsRectNull())
- return FALSE;
-
- // 单击目标;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(200, 300);
- // 单击目标后,要往移走鼠标,防止下面匹配的时候被鼠标挡住;
- GAssist::MouseMove(hWnd, CPoint(rc.top - RAND(5, 12), rc.left - RAND(5, 10))); // 移动到左上角;
- SRAND(300, 500);
- return TRUE;
- }
- CRect FindMatchIcon(HWND hWnd, LPCSTR lpszTemplateImage)
- {
- CRect rc;
- TCHAR szTemplateImage[MAX_PATH] = { 0 };
- ::ShowWindow(hWnd, SW_SHOWNORMAL);
- ::SetForegroundWindow(hWnd);
- // 先截图;
- DebugLog(_T("FindMatchIcon=%s"), lpszTemplateImage);
- GAssist::SaveHwndToBmpFile(hWnd, GAssist::g_strAppdir + _T("Game.bmp")); SRAND(200, 500);
- _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 rc;
- }
- rc.SetRectEmpty();
- 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)
- {
- CRect rc;
- BOOL bBattle = FALSE;
- SRAND(100, 200);
- if (GAssist::IsMatchIcon(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\非战斗中.bmp"), { 630, 25, 805, 45 }, rc)) {
- DebugLog(_T("Battle:非战斗中"));
- return FALSE;
- }
- DebugLog(_T("Battle:战斗中"));
- return TRUE;
- }
- // nAttackNPCType 0=镜妖; 1=职业挑战
- //
- BOOL IsWattingAttack(HWND hWnd, int nAttackNPCType)
- {
- CRect rc;
- BOOL bIsAttack = FALSE;
- switch (nAttackNPCType)
- {
- case 0:
- { // 将鼠标移动到指定位置;
- DebugLog(_T("IsWattingAttack:镜妖中……"));
- POINT ptDest = { 20, 50 }; // 左上角;
- GAssist::MouseMove(hWnd, ptDest);
- if (GAssist::IsMatchIcon(hWnd, GAssist::g_strAppdir + _T("img\\我方攻击.bmp"), { 0, 50, 60, 115 }, rc)) {
- DebugLog(_T("IsWattingAttack:我方攻击"));
- bIsAttack = TRUE;
- }
- break;
- }
- case 1:
- {
- // 将鼠标移动到指定位置;
- DebugLog(_T("IsWattingAttack:职业挑战中……"));// 要求角色:自定全黑头像;
- //POINT ptDest = { 625, 28 }; // 左上角;
- //GAssist::MouseMove(hWnd, ptDest);
- if (!GAssist::IsMatchIcon(hWnd, GAssist::g_strAppdir + _T("img\\战斗中.bmp"), { 600, 25, 655, 80 }, rc)) {
- DebugLog(_T("IsWattingAttack:我方攻击"));
- bIsAttack = TRUE;
- }
- break;
- }
- default:
- break;
- }
- return bIsAttack;
- }
- void BattleOnece(HWND hWnd, BOOL bHasSummoner)
- {
- BOOL bBattle = FALSE;
- if (IsBattle(hWnd))
- {
- SRAND(300, 500);
- // 是否我方攻击;
- if (IsWattingAttack(hWnd, 0)) {
- // 人物固定F1
- // 根据角色选择技能;
- GAssist::SendKey(hWnd, VK_F1);
- SRAND(200, 300);
- // 打镜妖喽罗;
- GAssist::MouseClick(hWnd, CPoint(290 - 3, 140 - 20));
- //GAssist::MouseMove(hWnd, CPoint(220 - 5, 180 - 10));// 打主镜妖;
- SRAND(100, 200);
- }
- }
- else
- {
- // 非战斗中,是否在贫民房中;
- if (!IsOnMap(hWnd, _T("img\\地图\\贫民房.bmp")))
- {
- // 找小米;
- CRect rc;
- if (!FindNPC(hWnd, "臭美的小米"))
- return;
- // 选择进入;
- BOOL bMatch = FALSE;
- int trySize = 20;
- // 我要挑战他们;
- while (!(bMatch = ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\1-我帮您抓.bmp")))) {
- SRAND(800, 1200);
- if (!trySize--) break;
- }
- if (bMatch) {
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- // 单击:我要挑战他们;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(1000, 1500);// 等出图;
- // 移动一下;
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- ::SetCursorPos(rc.left + rand() % 6, rc.top + rand() % 8);
- // 是否第一次进入地图;
- if (ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\2-我这就去.bmp")))
- {
- SRAND(600, 1200);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\3-战意镜妖.bmp")))
- {
- SRAND(600, 1800);
- if ((bMatch = ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\4-我就选择它.bmp"))))
- {
- SRAND(800, 1800);
- }
- }
- }
- }
- }
- else
- {
- // 找到镜妖;
- CRect rc;
- POINT spt[4] = { { 260, 360 }, { 300,390}, { 390, 350}, { 280,300 } };
- for (int i = 0; !GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\镜妖3.bmp"), rc); i++)
- {
- // 打开世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(200, 300);
- // 选择坐标点;
- GAssist::MouseClick(hWnd, spt[i % 4]);
- // 退出世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(500, 900);
- if (i > 10) {
- DebugLog(_T("未找到镜妖+10"));
- break;
- }
- }
- // 找到镜妖;
- GAssist::MouseMove(hWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
- DebugLog(_T("移动鼠标"));
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(300, 600);
- // 单击目标后,要往移走鼠标,防止下面匹配的时候被鼠标挡住;
- GAssist::MouseMove(hWnd, CPoint(rc.right + RAND(5, 12), rc.bottom + RAND(5, 10)));
- SRAND(200, 500);
- DebugLog(_T("找到目标并单击成功:%s"));
- // 我来抓你;
- if (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\我来抓您的.bmp"), rc)) {
- // 找到匹配的模块;
- GAssist::MouseMove(hWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
- DebugLog(_T("我来抓你:移动鼠标"));
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(800, 1500);
- DebugLog(_T("我来抓你:找到目标并单击成功:%s"));
- }
- }
- }
- }
- // 与镜妖战斗;
- void BattleJY(HWND hWnd, BOOL bHasSummoner, int nZJType, BOOL bAggressiveSkill)
- {
- BOOL bFirstAttack = TRUE;
- while (IsBattle(hWnd)) { // 是否在战斗中;
- // 是否我方攻击;
- while (IsWattingAttack(hWnd, 0)) { // Bug:如果被镜妖打死了,无法中断;
- DebugLog(_T("BattleJY:我方攻击……"));
- if (bFirstAttack)
- {
- SRAND(250, 300);
- DebugLog(_T("BattleJY:第一次攻击……"));
- // 根据角色选择技能;
- GAssist::SendKey(hWnd, VK_F1);
- SRAND(300, 350);
- if (bAggressiveSkill) // 打镜妖喽罗;
- {
- GAssist::MouseClick(hWnd, CPoint(290 - 3, 140 - 20));
- //GAssist::MouseMove(hWnd, CPoint(220 - 5, 180 - 10));// 打主镜妖;
- SRAND(350, 500);
- }
- if (bHasSummoner) {
- CRect rc;
- // 召唤兽技能;
- DebugLog(_T("BattleJY:召唤兽技能选择"));
- // 选择重击;
- if (nZJType) {
- SRAND(150, 350);
- GAssist::SendKey(hWnd, VK_S, FALSE, TRUE);
- DebugLog(_T("BattleJY:召唤兽技能选择:%d"), nZJType);
- if (GAssist::GetImgMatchtemplate(hWnd, nZJType == 1 ? GAssist::g_strAppdir + _T("img\\活动\\镜妖\\重击.bmp") : GAssist::g_strAppdir + _T("img\\活动\\镜妖\\重击2.bmp"), rc))
- {
- SRAND(150, 300);
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- }
- }
- SRAND(300, 500);
- GAssist::MouseMove(hWnd, CPoint(290 - 3, 140 - 15));
- GAssist::MouseClick(hWnd, CPoint(290 - 3, 140 - 20));
- }
- bFirstAttack = FALSE;
- }
- else
- {
- DebugLog(_T("BattleJY:不是第一次攻击……"));
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- SRAND(80, 100);
- if (bFirstAttack) {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- SRAND(80, 120);
- }
- }
- }
- SRAND(500, 850);
- }
- // 非战斗中,是否在贫民房中;
- if (!IsOnMap(hWnd, _T("img\\地图\\贫民房.bmp"))) {
- // 找小米;
- CRect rc;
- if (!FindNPC(hWnd, "臭美的小米"))
- return;
- // 选择进入;
- BOOL bMatch = FALSE;
- int trySize = 15;
- // 我要挑战他们;
- while (!(bMatch = ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\1-我帮您抓.bmp")))) {
- SRAND(800, 1200);
- if (!trySize--) break;
- }
- if (bMatch) {
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- // 单击:我要挑战他们;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(1000, 1500);// 等出图;
- // 移动一下;
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- ::SetCursorPos(rc.left + rand() % 6, rc.top + rand() % 8);
- // 是否第一次进入地图;
- if (ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\2-我这就去.bmp")))
- {
- SRAND(600, 1200);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\3-战意镜妖.bmp")))
- {
- SRAND(600, 1800);
- if ((bMatch = ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\4-我就选择它.bmp"))))
- {
- SRAND(800, 1800);
- }
- }
- }
- }
- }
- else
- {
- // 找到镜妖;
- CRect rc;
- POINT spt[4] = { { 250, 335 }, { 310,360}, { 385, 315}, { 280,295 } };
- for (int i = 0; !GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\镜妖1.bmp"), rc); i++)
- {
- // 打开世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(200, 300);
- // 选择坐标点;
- GAssist::MouseClick(hWnd, spt[i % 4]);
- // 退出世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(500, 900);
- // 等待跑完成;
- //SRAND(600, 800);
- IsWalkStop(hWnd);
- if (i > 10) {
- DebugLog(_T("未找到镜妖+10"));
- break;
- }
- }
- // 找到镜妖;
- GAssist::MouseMove(hWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
- DebugLog(_T("移动鼠标"));
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(390, 600);
- // 单击目标后,要往移走鼠标,防止下面匹配的时候被鼠标挡住;
- GAssist::MouseMove(hWnd, CPoint(rc.right + RAND(10, 20), rc.bottom + RAND(10, 20)));
- SRAND(300, 500);
- DebugLog(_T("找到目标并单击成功:%s"));
- // 我来抓你;
- if (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\我来抓您的.bmp"), rc)) {
- // 找到匹配的模块;
- SRAND(200, 300);
- //GAssist::MouseMove(hWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
- DebugLog(_T("我来抓你:移动鼠标"));
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(1000, 1500);
- DebugLog(_T("我来抓你:找到目标并单击成功:%s"));
- }
- }
- }
- void BattleJY2(HWND hWnd, BOOL bSummoner)
- {
- if (!IsOnMap(hWnd, _T("img\\地图\\贫民房.bmp"))) {
- // 找小米;
- CRect rc;
- if (!FindNPC(hWnd, "臭美的小米"))
- return;
- // 选择进入;
- BOOL bMatch = FALSE;
- int trySize = 20;
- // 我要挑战他们;
- while (!(bMatch = ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\1-我帮您抓.bmp")))) {
- SRAND(800, 1200);
- if (!trySize--) break;
- }
- if (bMatch) {
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- // 单击:我要挑战他们;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(1000, 1500);// 等出图;
- // 移动一下;
- GAssist::MouseMove(hWnd, CPoint(rc.left, rc.top));
- ::SetCursorPos(rc.left + rand() % 6, rc.top + rand() % 8);
- // 是否第一次进入地图;
- if (ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\2-我这就去.bmp")))
- {
- SRAND(600, 1200);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\3-战意镜妖.bmp")))
- {
- SRAND(600, 1800);
- if ((bMatch = ClickDlgSetup(hWnd, _T("img\\活动\\镜妖\\4-我就选择它.bmp"))))
- {
- SRAND(800, 1800);
- }
- }
- }
- }
- return;
- }
- CRect rc;
- //POINT spt[4] = { { 175, 280 }, { 225,305 }, { 300, 266 }, { 225,305 } };
- POINT spt[4] = { { 260, 360 }, { 300,390}, { 390, 350}, { 280,300 } };
- for (int i = 0; !GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\镜妖3.bmp"), rc); i++)
- {
- // 打开世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(200, 300);
- // 选择坐标点;
- GAssist::MouseClick(hWnd, spt[i % 4]);
- // 退出世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(500, 900);
- if (i > 10) {
- DebugLog(_T("未找到镜妖+10"));
- break;
- }
- }
- // 找到镜妖;
- GAssist::MouseMove(hWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
- DebugLog(_T("移动鼠标"));
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(300, 600);
- // 单击目标后,要往移走鼠标,防止下面匹配的时候被鼠标挡住;
- GAssist::MouseMove(hWnd, CPoint(rc.right + RAND(5, 12), rc.bottom + RAND(5, 10)));
- SRAND(300, 500);
- DebugLog(_T("找到目标并单击成功:%s"));
- // 我来抓你;
- if (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\我来抓您的.bmp"), rc)) {
- // 找到匹配的模块;
- GAssist::MouseMove(hWnd, CPoint(rc.left + rand() % 10, rc.top + rand() % 10));
- DebugLog(_T("我来抓你:移动鼠标"));
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- SRAND(800, 1500);
- DebugLog(_T("我来抓你:找到目标并单击成功:%s"));
- BOOL bBattle = FALSE;
- //while (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\战斗中.bmp"), rc))
- while (IsBattle(hWnd))
- {
- DebugLog(_T("BattleJY:战斗中"));
- //while (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\技能选择.bmp"), rc))
- while (IsWattingAttack(hWnd, 0))
- {
- DebugLog(_T("BattleJY:我方攻击……"));
- if (!bBattle)
- {
- // 根据角色选择技能;
- GAssist::SendKey(hWnd, VK_F1);
- SRAND(200, 300);
- // 打镜妖喽罗;
- GAssist::MouseClick(hWnd, CPoint(290 - 3, 140 - 20));
- //GAssist::MouseMove(hWnd, CPoint(220 - 5, 180 - 10));// 打主镜妖;
- SRAND(200, 300);
- if (bSummoner) {
- // 召唤兽技能;
- if (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\召唤兽技能选择.bmp"), rc))
- {
- SRAND(200, 500);
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- DebugLog(_T("BattleJY:召唤兽技能选择"));
- // 选择重击;
- SRAND(300, 800);
- if (GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\活动\\镜妖\\重击.bmp"), rc))
- {
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 3), TRUE);
- }
- SRAND(200, 500);
- GAssist::MouseMove(hWnd, CPoint(290 - 3, 140 - 15));
- GAssist::MouseClick(hWnd, CPoint(290 - 3, 140 - 20));
- }
- }
- else
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- SRAND(600, 900);
- }
- bBattle = TRUE;
- }
- else
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- SRAND(50, 100);
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- SRAND(600, 900);
- }
- SRAND(300, 550);
- }
- // 战斗中等待;
- SRAND(800, 1200);
- }
- }
- }
- // 是否停止走路;
- BOOL IsWalkStop(HWND hWnd)
- {
- // 将鼠标移走,不要在抠图区域;
- // 截图,抠指定区域;
- // 再截图,抠指定区域与上次抠图结果比较;
- // 比较结果相同,表示停止走路;
- //POINT pt1 = { 635, 20 };
- //POINT pt2 = { 780, 38 };
- CRect rc = { 630, 40, 800, 65 };
- CRect rc2 = { 640, 45, 770, 63 };
- for (int i = 0; i < 100; i++)
- {
- GAssist::CropPicture(hWnd, rc, _T("walk1.bmp"));
- Sleep(600);
- GAssist::CropPicture(hWnd, rc2, _T("walk2.bmp"));
- // 判断2张图片是否一样;
- if (GAssist::IsSimilarPicture(_T("walk1.bmp"), _T("walk2.bmp")))
- {
- DebugLog(_T("停止走路"));
- return TRUE;
- }
- }
- return FALSE;
- }
- // 世界地图定位;
- void WorldMapPositioning(HWND hWnd, POINT ptMap)
- {
- CRect rc;
- //// 打开世界地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(300, 500);
- // 判断是否打开了地图;
- if (!GAssist::GetImgMatchtemplate(hWnd, GAssist::g_strAppdir + _T("img\\世界地图.bmp"), rc))
- return;
- //// 单击寻路窗口;
- GAssist::MouseClick(hWnd, ptMap); SRAND(300, 600);
- //// 退出世界地址;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(200, 300);
- IsWalkStop(hWnd);
- }
- // 使用快捷键来处理:读取配置文件
- auto FindJNShortCut = [](LPCTSTR lpSkillName, int& nKeyValue, int& nSkilltime)->BOOL {
- // 读取文件:jnmap.bin
- // 格式:技能=快捷键的键值;
- std::string line;
- std::ifstream ifJN("img\\jnmap.bin");
- if (ifJN)
- {
- TCHAR szKeyValue[MAX_PATH] = { 0 };
- TCHAR szSkillName[MAX_PATH] = { 0 };
- TCHAR szSkillTime[MAX_PATH] = { 0 };
- while (std::getline(ifJN, line))
- {
- int nRet = _stscanf_s(line.c_str(), _T("%[^;];%[^;];%s"), szSkillName, MAX_PATH, szKeyValue, MAX_PATH, szSkillTime, MAX_PATH);
- if (nRet == 3 && _tcsicmp(lpSkillName, szSkillName) == 0) {
- // 将快捷键值
- nKeyValue = atol(szKeyValue);
- nSkilltime = atol(szSkillTime);
- return TRUE;
- }
- }
- }
- // 没有找到jnmap.bin文件;
- return FALSE;
- };
- // 挑战医师;
- void BattleYS(HWND hWnd, const char* lpszJN)
- {
- CRect rc;
- BOOL bBattle = FALSE;
- if (!FindNPC(hWnd, "医师独侠"))
- return;
- // 废话少说:表示这个没打过;
- rc = FindMatchIcon(hWnd, _T("img\\gdd\\废话少说.bmp"));
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- // 确定
- bBattle = TRUE;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(230, 350);
- GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.right + rand() % 10, rc.bottom + rand() % 10 });
- SRAND(20, 60);
- ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
- }
- else
- {
- rc = FindMatchIcon(hWnd, _T("img\\gdd\\离开这里.bmp"));
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- SRAND(150, 250);
- // 只有离开这里:已经打过,右键并退出 ;
- DebugLog("只有离开这里:已经打过,右键并退出");
- GAssist::MouseRClick(hWnd);
- }
- else
- {
- // 找下一页的技能:没有下一页返回-1,找到返回0,没找到返回1;
- auto FindNextPageJZ = [&](TCHAR* pJN)->int {
- // 没有在当前页找到目标,看看是否在下一页;
- rc = FindMatchIcon(hWnd, _T("img\\jn-jk\\gdd\\xyy.bmp"));
- if (rc.IsRectEmpty() || rc.IsRectNull())
- {
- // 没有下一页,右键退出;
- GAssist::MouseRClick(hWnd);
- return -1;
- }
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(300, 350);
- // 下一页中查看;
- rc = FindMatchIcon(hWnd, pJN);
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- // 找到目标,单击;
- 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 });
- SRAND(250, 300);
- ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
- SRAND(250, 300);
- rc = FindMatchIcon(hWnd, _T("img\\gdd\\接受挑战.bmp"));
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {// 第二次开始都会多这个;
- // 找到目标,单击;
- 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);
- }
- ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
- SRAND(250, 300);
- // 战斗;
- return 0;
- }
- return 1;
- };
- 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())
- {
- // 最多只有三页;
- for (int i = 0; i < 3; i++)
- {
- // 没有在当前页找到目标,看看是否在下一页;
- int nRet = FindNextPageJZ(szJN);
- if (nRet == 1)
- {
- // 没有找到技能;
- continue;
- }
- if (nRet == 0)
- {
- // 找到了;
- bBattle = TRUE;
- }
- break; // 没有下一页也直接break;
- }
- }
- else
- {
- bBattle = TRUE;
- // 找到目标,单击;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(300, 500);
- // 战斗;
- ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
- SRAND(200, 300);
- }
- }
- }
- int KeyValue, SkillTime;
- // 进入战斗;
- if (bBattle)
- {
- // 人物:Alt+S显示技能,双击选择技能,单击怪物发动技能;
- // 注:有的人物技能太多,导致会有滚动条:这是有难点;
- BOOL bRet = FindJNShortCut(lpszJN, KeyValue, SkillTime);
- DebugLog("快捷键值=%ld", KeyValue);
- // 快捷键;
- GAssist::SendKey(hWnd, KeyValue);
- SRAND(350, 650);
- // 单击指定位置;
- GAssist::MouseClick(hWnd, 230, 170);
- SRAND(260, 380);
- // 将鼠标移动到指定位置;
- POINT ptDest = { 625, 28 }; // 左上角;
- GAssist::MouseMove(hWnd, ptDest);
- while (IsBattle(hWnd))
- {
- // 判断是否我方攻击;
- if (IsWattingAttack(hWnd, 1))
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- }
- SRAND(500, 900);
- }
- }
- // 右键退出;
- SRAND(300, 500); //必要的等待时间;
- do
- {
- rc = FindMatchIcon(hWnd, "img\\对话框关闭按钮.bmp");
- Sleep(900);
- } while (rc.IsRectEmpty() || rc.IsRectNull());
- GAssist::MouseRClick(hWnd);
- }
- void BattleOthers(HWND hWnd, const char* lpszName, const char* lpszSkillName)
- {
- CRect rc;
- BOOL bBattle = FALSE;
- if (!_tcsicmp("浪子独侠", lpszName))
- {
- // 有时会寻路失败;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(300, 600);
- // 单击指定坐标;
- GAssist::MouseClick(hWnd, { 140,430 });
- // 关闭地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(100, 300);
- }
-
- if (!FindNPC(hWnd, lpszName))
- return;
- // 废话少说:表示这个没打过;
- rc = FindMatchIcon(hWnd, _T("img\\gdd\\废话少说.bmp"));
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2, (rc.top + rc.bottom) / 2), TRUE);
- SRAND(330, 550);
- GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.right + rand() % 10, rc.bottom + rand() % 10 });
- // 确定
- bBattle = TRUE;
- ClickDlgSetup(hWnd, _T("img\\确定.bmp"));
- SRAND(250, 350);
- }
- else
- {
- rc = FindMatchIcon(hWnd, _T("img\\gdd\\离开这里.bmp"));
- }
- int KeyValue, SkillTime;
- if (bBattle) {
- BOOL bRet = FindJNShortCut(lpszSkillName, KeyValue, SkillTime);
- // 将鼠标移动到指定位置;
- POINT ptDest = { 625, 28 }; // 左上角;
- GAssist::MouseMove(hWnd, ptDest);
- while (IsBattle(hWnd))
- {
- // 判断是否我方攻击;
- if (IsWattingAttack(hWnd, 1))
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- }
- SRAND(500, 750);
- }
- }
- // 右键退出;
- if (_tcsicmp(lpszName, _T("魂武独侠")))
- {
- SRAND(300, 500);
- do
- {
- rc = FindMatchIcon(hWnd, "img\\对话框关闭按钮.bmp");
- Sleep(900);
- } while (rc.IsRectEmpty() || rc.IsRectNull());
- GAssist::MouseRClick(hWnd);
- }
- else
- {
- // 回到应天府;
- GAssist::MouseMoveEx(hWnd, { rc.left, rc.top }, { rc.right + rand() % 10, rc.bottom + rand() % 10 });
- ClickDlgSetup(hWnd, _T("\\img\\gdd\\送我回应天府.bmp"));
- }
- }
- // 用于应用程序“关于”菜单项的 CAboutDlg 对话框
- class CAboutDlg : public CDialog
- {
- public:
- CAboutDlg();
- // 对话框数据
- enum { IDD = IDD_ABOUTBOX };
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
- // 实现
- protected:
- DECLARE_MESSAGE_MAP()
- };
- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
- {
- }
- void CAboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- END_MESSAGE_MAP()
- // CGameAssistDlg 对话框
- CGameAssistDlg::CGameAssistDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CGameAssistDlg::IDD, pParent)
- {
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- void CGameAssistDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_CHECK1, m_cbSummoner);
- DDX_Control(pDX, IDC_CHECK2, m_cbZJ);
- DDX_Control(pDX, IDC_CHECK3, m_cbZJ2);
- DDX_Control(pDX, IDC_CHECK6, m_cbAggressiveSkill);
- DDX_Control(pDX, IDC_COMBO1, m_cbGameRole);
- }
- BEGIN_MESSAGE_MAP(CGameAssistDlg, CDialog)
- ON_WM_SYSCOMMAND()
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- //}}AFX_MSG_MAP
- ON_BN_CLICKED(BTN_OPENGAME, &CGameAssistDlg::OnBnClickedOpengame)
- ON_BN_CLICKED(IDC_BUTTON2, &CGameAssistDlg::OnBnClickedButton2)
- ON_BN_CLICKED(IDC_BUTTON3, &CGameAssistDlg::OnBnClickedButton3)
- ON_BN_CLICKED(IDC_BUTTON4, &CGameAssistDlg::OnBnClickedButton4)
- ON_BN_CLICKED(IDC_BUTTON5, &CGameAssistDlg::OnBnClickedButton5)
- ON_BN_CLICKED(IDC_BUTTON6, &CGameAssistDlg::OnBnClickedButton6)
- ON_BN_CLICKED(IDC_BUTTON7, &CGameAssistDlg::OnBnClickedButton7)
- ON_BN_CLICKED(IDC_BUTTON8, &CGameAssistDlg::OnBnClickedButton8)
- ON_BN_CLICKED(IDC_BUTTON9, &CGameAssistDlg::OnBnClickedButton9)
- ON_BN_CLICKED(IDC_BUTTON10, &CGameAssistDlg::OnBnClickedButton10)
- ON_BN_CLICKED(IDC_BUTTON11, &CGameAssistDlg::OnBnClickedButton11)
- ON_BN_CLICKED(IDC_BUTTON12, &CGameAssistDlg::OnBnClickedButton12)
- END_MESSAGE_MAP()
- // CGameAssistDlg 消息处理程序
- BOOL CGameAssistDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // 将“关于...”菜单项添加到系统菜单中。
- // IDM_ABOUTBOX 必须在系统命令范围内。
- ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
- ASSERT(IDM_ABOUTBOX < 0xF000);
- CMenu* pSysMenu = GetSystemMenu(FALSE);
- if (pSysMenu != NULL)
- {
- BOOL bNameValid;
- CString strAboutMenu;
- bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
- ASSERT(bNameValid);
- if (!strAboutMenu.IsEmpty())
- {
- pSysMenu->AppendMenu(MF_SEPARATOR);
- pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
- }
- }
- // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
- // 执行此操作
- SetIcon(m_hIcon, TRUE); // 设置大图标
- SetIcon(m_hIcon, FALSE); // 设置小图标
- // TODO: 在此添加额外的初始化代码
- GAssist::Init();
- return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
- }
- void CGameAssistDlg::OnSysCommand(UINT nID, LPARAM lParam)
- {
- if ((nID & 0xFFF0) == IDM_ABOUTBOX)
- {
- CAboutDlg dlgAbout;
- dlgAbout.DoModal();
- }
- else
- {
- CDialog::OnSysCommand(nID, lParam);
- }
- }
- // 如果向对话框添加最小化按钮,则需要下面的代码
- // 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
- // 这将由框架自动完成。
- void CGameAssistDlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // 用于绘制的设备上下文
- SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
- // 使图标在工作区矩形中居中
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
- // 绘制图标
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
- //当用户拖动最小化窗口时系统调用此函数取得光标
- //显示。
- HCURSOR CGameAssistDlg::OnQueryDragIcon()
- {
- return static_cast<HCURSOR>(m_hIcon);
- }
- void CGameAssistDlg::OnBnClickedOpengame()
- {
- #if 1 // 获取游戏标题;
- DWORD dwPid = GAssist::GetProcessId();
- HWND hProWnd = GAssist::GetProMainHwnd(dwPid);
- //HWND hProWnd = GAssist::GetProMainHwnd(5824);
- TCHAR szWinText[MAX_PATH] = { 0 };
- ::GetWindowText(hProWnd, szWinText, MAX_PATH);
- #if 1
- Sleep(1000);
- m_mouseAssist.BindWnd(hProWnd, PT_TYPE::WINDOW_POINT);
- m_mouseAssist.MoveTo(205, 150);
- Sleep(1000);
- m_mouseAssist.MoveTo(250, 250);
- Sleep(1000);
- m_mouseAssist.MoveTo(350, 350);
- Sleep(1000);
- m_mouseAssist.MoveTo(10, 470);
- m_mouseAssist.LeftClick();
- /*GAssist::MouseMove(hProWnd, CPoint(205,150));
- Sleep(2000);
- GAssist::MouseMove(hProWnd, CPoint(100,100), CPoint(250,250));
- Sleep(2000);
- GAssist::MouseMove(hProWnd, CPoint(100,100), CPoint(350,350));*/
- return;
- #endif
- if (0)
- {
- Sleep(1000);
- GAssist::MouseClick(hProWnd, CPoint(205, 150));
- Sleep(1000);
- GAssist::MouseClick(hProWnd, CPoint(235, 150));
- Sleep(1000);
- GAssist::MouseClick(hProWnd, CPoint(275, 150));
- }
- if (0)
- {
- Sleep(1000);
- ::SetForegroundWindow(hProWnd);
- GAssist::DragMouse(hProWnd, CPoint(173, 192), CPoint(295, 190));
- }
- if (0) {
- GAssist::MouseDbClick(hProWnd, CPoint(476, 158));
- }
- if (0)
- {
- GAssist::SendKey(hProWnd, VK_TAB);
- }
- //RECT rc = {0,0,500,500};
- //HBITMAP hb = GAssist::CopyDC2Bitmap(hProWnd, &rc);
- //GAssist::SaveBitmap(hb, "1.bmp");
- //GAssist::SaveHwndToBmpFile(hProWnd, "2.bmp");
- return;
- #endif
- // TODO: 在此添加控件通知处理程序代码
- if (!PathFileExists(GAssist::g_szGameApp))
- {
- MessageBox("游戏程序不存在", "温馨提示");
- return;
- }
- // 设置辅助程序工作目录为游戏目录;
- //SetCurrentDirectory(_T("E:\\dhsh\\shdata\\"));
- SetCurrentDirectory(_T("D:\\tools\\dhsh\\shdata\\"));
- #if 1
- ShellExecute(NULL, "open", GAssist::g_szGameApp, NULL, NULL, SW_SHOWNORMAL);//SW_HIDE无用,因为会自动结;
- Sleep(500); // Main.exe设置了陷阱(自己再开启了一个进程,结束上一个进程),需要等5秒;
- #else
- SHELLEXECUTEINFO stuExecInfo = { 0 };
- DWORD dwExitCode = STILL_ACTIVE;
- //CString strCommandLine = _T("open");
- stuExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
- stuExecInfo.lpFile = GAssist::g_szGamePath;
- stuExecInfo.lpParameters = "open";
- stuExecInfo.nShow = SW_SHOWNORMAL;
- stuExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
- if (!ShellExecuteEx(&stuExecInfo))
- {
- DWORD dwError = GetLastError();
- CString strError = _T("");
- strError.Format(_T("执行ShellExecuteEx失败,错误码:%d"), dwError);
- AfxMessageBox(strError);
- return;
- }
- HANDLE hProcess = stuExecInfo.hProcess;
- if (hProcess != NULL)
- {
- WaitForSingleObject(hProcess, INFINITE);
- CloseHandle(hProcess);
- }
- #endif
- DWORD dwPID = GAssist::FindProcess(_T("Main.exe"));
- #if 1
- EnumWindows(GAssist::EnumChildWindowCallBack, dwPID);
- if (GAssist::g_vtGameHwnd.size())
- {
- GAssist::GameHwnd* gp = NULL;
- GAssist::GameHwnd* gbmin = NULL;
- GAssist::GameHwnd* gbentry = NULL;
- for (std::vector<GAssist::GameHwnd>::iterator it = GAssist::g_vtGameHwnd.begin(); it != GAssist::g_vtGameHwnd.end(); it++)
- {
- if (_tcsicmp(it->strWinText.c_str(), _T("最小化")) == 0)
- {
- gbmin = &*it;
- }
- if (_tcsicmp(it->strWinText.c_str(), _T("大话水浒")) == 0)
- {
- gp = &*it;
- }
- if (_tcsicmp(it->strWinText.c_str(), _T("进入游戏")) == 0)
- {
- gbentry = &*it;
- }
- }
- if (gp && gbentry && gbmin)
- {
- //::SendMessage(gp->hwnd, WM_LBUTTONDOWN, (WPARAM)gb->dwId, 0);
- //::SendMessage(gp->hwnd, WM_LBUTTONUP, (WPARAM)gb->dwId, 0);
- // 发送点击事件;
- // 先最小化;
- ::SendMessage(gp->hwnd, WM_COMMAND, gbmin->dwId, NULL);
- // 再进入;
- ::SendMessage(gp->hwnd, WM_COMMAND, gbentry->dwId, NULL);
- Sleep(1500);
- dwPID = GAssist::GetProcessId();
- if (dwPID)
- {
- GAssist::g_vtGameHwnd.clear();
- EnumWindows(GAssist::EnumChildWindowCallBack, dwPID);
- HWND hwnd = GAssist::GetProMainHwnd(dwPID);
- if (hwnd)
- {
- TCHAR szName[MAX_PATH] = { 0 };
- ::GetWindowText(hwnd, szName, MAX_PATH);
- CRect rc;
- ::GetWindowRect(hwnd, &rc);
- TCHAR szLogMsg[MAX_PATH] = { 0 };
- _stprintf_s(szLogMsg, _T("窗口标题:%s, [%d,%d, %d,%d], width=%d, height=%d\n"), szName, rc.top, rc.left, rc.right, rc.bottom, rc.Width(), rc.Height());
- OutputDebugString(szLogMsg);
- if (1)
- { // 800x600
- // 发送按钮消息;进入游戏;
- GAssist::MouseClick(hwnd, 585, 116);
- // 发送按钮消息;下一步;
- GAssist::MouseClick(hwnd, 536, 481);
- // 发送按钮消息;电信一区;
- GAssist::MouseClick(hwnd, 229, 342);
- // 发送按钮消息;忘忧谷;
- GAssist::MouseClick(hwnd, 335, 244);
- // 发送按钮消息;下一步;
- GAssist::MouseClick(hwnd, 559, 516);
- }
- else
- {
- // 640x480
- // 发送按钮消息;进入游戏;
- GAssist::MouseClick(hwnd, 440, 75);
- // 发送按钮消息;下一步;
- GAssist::MouseClick(hwnd, 468, 454);
- // 发送按钮消息;电信一区;
- GAssist::MouseClick(hwnd, 165, 241);
- // 发送按钮消息;忘忧谷;
- GAssist::MouseClick(hwnd, 289, 195);
- // 发送按钮消息;下一步;
- GAssist::MouseClick(hwnd, 494, 469);
- }
- }
- }
- }
- }
- #endif
- }
- void CGameAssistDlg::OnBnClickedButton2() // 截图;
- {
- // TODO: 在此添加控件通知处理程序代码
- HWND hWnd = GAssist::GetProcessMainWnd();
- UpdateData();
- INT nX = GetDlgItemInt(IDC_EDIT3);
- INT nY = GetDlgItemInt(IDC_EDIT4);
- INT nX2 = GetDlgItemInt(IDC_EDIT5);
- INT nY2 = GetDlgItemInt(IDC_EDIT6);
- BOOL bCropPicture = ((CButton*)GetDlgItem(IDC_CHECK5))->GetCheck();
- if (bCropPicture)
- {
- GAssist::CropPicture(hWnd, { nX, nY, nX2, nY2 }, _T("裁剪结果.bmp"));
- }
- else
- {
- CString strImg;
- strImg = CTime::GetCurrentTime().Format("%H%M%S-Game.bmp");
- GAssist::SaveHwndToBmpFile(hWnd, strImg.GetString());
- }
- #if 0
- HWND hWnd = GAssist::GetProcessMainWnd();
- #if 1
- // 快捷键;
- //GAssist::SendKey(hProWnd, VK_F3);
- //SRAND(350, 650);
- //// 单击指定位置;
- //GAssist::MouseClick(hProWnd, 230, 170);
- //SRAND(260, 380);
- //// 将鼠标移动到指定位置;
- //POINT ptDest = { 625, 28 }; // 左上角;
- //GAssist::MouseMove(hProWnd, ptDest);
- // 有时会寻路失败;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(300, 600);
- // 单击指定坐标;
- //GAssist::MouseClick(hWnd, { 80,500 });
- GAssist::MouseMove(hWnd, { 80, 580 });
- // 关闭地图;
- GAssist::SendKey(hWnd, VK_TAB); SRAND(100, 300);
- #else
- //IsWattingAttack(hProWnd, 1);
- //BattleYS(hProWnd, "缚神诀");
- char szName[10][32] = { "术士独侠","道士独侠","武师独侠","浪子独侠",
- "剑客独侠","弓手独侠","禁卫独侠","墨者独侠","巫煞独侠","魂武独侠" };
- BattleOthers(hProWnd, szName[9], _T("缚神诀"));
- #endif
- // auto FindJNShortCut = [](LPCTSTR lpSkillName)->int {
- // // 读取文件:jnmap.bin
- // // 格式:技能=快捷键的键值;
- // std::string line;
- // std::ifstream ifJN("..\\img\\jnmap.bin");
- // if (ifJN)
- // {
- // TCHAR szKeyValue[MAX_PATH] = { 0 };
- // TCHAR szSkillName[MAX_PATH] = { 0 };
- // while (std::getline(ifJN, line))
- // {
- // int nRet = _stscanf_s(line.c_str(), _T("%[^=]%s"), szSkillName, MAX_PATH, szKeyValue, MAX_PATH);
- // if (nRet == 2 && _tcsicmp(lpSkillName, szSkillName) == 0) {
- // // 将快捷键值
- // return atol(szKeyValue);
- // }
- // }
- //}
- //
- // // 没有找到jnmap.bin文件;
- // return -1;
- // };
- //
- //int KeyValue, SkillTime;
- //FindJNShortCut("缚神诀", KeyValue, SkillTime);
- #endif
- #if 0
- CRect rc;
- HWND hProWnd = GAssist::GetProcessMainWnd();
- // POINT spt= { 20, 555 }; // 左下角;
- //POINT spt = { 20, 50 }; // 左上角
- POINT spt = { 625, 28 }; // 战斗时的右上角
- // 选择坐标点;
- GAssist::MouseMove(hProWnd, spt);
- 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());
- #endif
- #if 0
- CRect rc;
- HWND hProWnd = GAssist::GetProcessMainWnd();
- POINT spt[4] = { { 250, 335 }, { 310,360}, { 385, 315}, { 280,295 } };
- static int i = 2;
- if (i < 4)
- {
- // 打开世界地图;
- GAssist::SendKey(hProWnd, VK_TAB); SRAND(200, 300);
- // 选择坐标点;
- GAssist::MouseClick(hProWnd, spt[i % 4]);
- // 退出世界地图;
- GAssist::SendKey(hProWnd, VK_TAB); SRAND(500, 900);
- DebugLog(_T("%d = [x,y] = (%d, %d)"), i, spt[i].x, spt[i].y);
- i++;
- }
- else
- {
- i = 0;
- }
- #endif
- // GAssist::MouseMove(hProWnd, CPoint(290 - 5, 140 - 20));
- //
- // Sleep(5000);
- // GAssist::MouseMove(hProWnd, CPoint(220 - 5, 180 - 10));
- }
- void CGameAssistDlg::OnBnClickedButton3() // 镜妖;
- {
- UpdateData();
- /*
- -- 是否在星秀村
- -- 是否在贫民房
- |-- 否:我帮您抓
- |-- -- 是否进入过贫民房
- | |-- 否:我这就去
- | | |-- 选择:幸运镜妖
- | | |-- 我就选择它
- | |-- 是:直接进入贫民房
- |-- 是:找到镜妖NPC
- | |-- 我来抓您的
- | |
- | |
- |
- |
- */
- CRect rc;
- HWND hProWnd = GAssist::GetProcessMainWnd();
- int nZJType = 0;
- if (m_cbZJ.GetCheck() || m_cbZJ2.GetCheck())
- {
- if (m_cbZJ.GetCheck())
- nZJType = 1;
- if (m_cbZJ2.GetCheck())
- nZJType = 2;
- }
- for (int i = 0; i < 100; i++)
- {
- UpdateData(FALSE);
- DebugLog(_T("start.打镜妖 %d----------------------------"), i);
- BattleJY(hProWnd, m_cbSummoner.GetCheck(), nZJType, m_cbAggressiveSkill.GetCheck());
- DebugLog(_T("end.打镜妖 %d----------------------------\n"), i);
- }
- }
- void CGameAssistDlg::OnBnClickedButton4() // 周六领礼物
- {
- // TODO: 在此添加控件通知处理程序代码
- // 星秀村:送礼协会会长丙
- // 【星】铜钱怪
- HWND hWnd = GAssist::GetProcessMainWnd();
- FindNPC(hWnd, _T("送礼协会会长丙"));
- IsWalkStop(hWnd);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\我来领取礼物.bmp")))
- {
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\好的.bmp")))
- {
- FindNPC(hWnd, _T("【星】铜钱怪"));
- IsWalkStop(hWnd);
- CRect rc;
- //铜钱怪:好的,要问些什么问题呢?
- struct MyStruct
- {
- BOOL bDone = FALSE;
- TCHAR szQuestion[MAX_PATH] = { 0 };
- };
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\铜钱怪:好的,要问些什么问题呢?.bmp")))
- {
- // 第一次回答;
- std::vector<MyStruct> vtMyst1 = { {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:帮派就象个大家庭.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:交流的场所.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:能够认识很多.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:我希望能够.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:由系统定时发布.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:好的,快点问吧.bmp")}
- };
- for (; vtMyst1.size();)
- {
- for (std::vector<MyStruct>::iterator it = vtMyst1.begin(); it != vtMyst1.end(); it++)
- {
- rc = FindMatchIcon(hWnd, it->szQuestion);
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- // 单击目标回答;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 5));
- // 再移动下鼠标,防止高亮影响下次的判断;
- GAssist::MouseMove(hWnd, CPoint(rc.right + RAND(6, 20), rc.bottom + RAND(6, 20)));
- // 等待下一个问题出现;
- SRAND(200, 300);
- it = vtMyst1.erase(it);
- break;
- }
- }
- }
- // 第二次回答;
- std::vector<MyStruct> vtMyst2 = { {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:帮派就象个大家庭.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:交流的场所.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:能够认识很多.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:我希望能够.bmp")},
- {FALSE, _T("img\\活动\\周六礼物\\铜钱怪:由系统定时发布.bmp")}
- };
- for (; vtMyst2.size();)
- {
- for (std::vector<MyStruct>::iterator it = vtMyst2.begin(); it != vtMyst2.end(); it++)
- {
- rc = FindMatchIcon(hWnd, it->szQuestion);
- if (!rc.IsRectEmpty() && !rc.IsRectNull())
- {
- // 单击目标回答;
- GAssist::MouseClick(hWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 5));
- // 再移动下鼠标,防止高亮影响下次的判断;
- GAssist::MouseMove(hWnd, CPoint(rc.right + RAND(6, 20), rc.bottom + RAND(6, 20)));
- // 等待下一个问题出现;
- SRAND(200, 300);
- it = vtMyst2.erase(it);
- break;
- }
- }
- }
- // 回答完所有问题,右键退出;
- SRAND(200, 300);
- GAssist::MouseRClick(hWnd);
- }
- // 再次回到送礼协会会长;
- FindNPC(hWnd, _T("送礼协会会长丙"));
- IsWalkStop(hWnd);
- // 再右键一次;
- SRAND(200, 300);
- GAssist::MouseRClick(hWnd);
- FindNPC(hWnd, _T("送礼协会会长丙"));
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\好,现在就去.bmp")))
- {
- // 等待切换地图;
- SRAND(800, 900);
- }
- }
- }
- if (IsOnMap(hWnd, _T("img\\地图\\汴京城.bmp")))
- {
- // 找送礼协会会长丁
- FindNPC(hWnd, _T("送礼协会会长丁"));
- IsWalkStop(hWnd);
- SRAND(300, 500); // 等对话框出现;
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\我来领取礼物.bmp")))
- {
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\好的.bmp")))
- {
- // 找铜钱怪;
- FindNPC(hWnd, _T("【汴】铜钱怪"));
- IsWalkStop(hWnd);
- SRAND(300, 500);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\铜钱怪:进入战斗.bmp")))
- {
- // 将鼠标移动到指定位置;
- POINT ptDest = { 625, 28 }; // 左上角;
- GAssist::MouseMove(hWnd, ptDest);
- while (IsBattle(hWnd))
- {
- // 判断是否我方攻击;
- if (IsWattingAttack(hWnd, 1))
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- }
- SRAND(500, 750);
- }
- // 送礼协会会长乙;
- FindNPC(hWnd, _T("送礼协会会长乙"));
- IsWalkStop(hWnd);
- // 再右键一次;
- SRAND(200, 300);
- GAssist::MouseRClick(hWnd);
- FindNPC(hWnd, _T("送礼协会会长丙")); SRAND(200, 300);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\好,现在就去.bmp")))
- {
- // 等待切换地图;
- SRAND(800, 900);
- }
- }
- }
- }
- }
- if (IsOnMap(hWnd, _T("img\\地图\\应天府.bmp")))
- {
- // 找送礼协会会长丁
- FindNPC(hWnd, _T("送礼协会会长甲"));
- IsWalkStop(hWnd);
- SRAND(300, 500); // 等对话框出现;
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\我来领取礼物.bmp")))
- {
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\好的.bmp")))
- {
- // 找铜钱怪;
- FindNPC(hWnd, _T("【应】铜钱怪"));
- IsWalkStop(hWnd);
- SRAND(300, 500);
- if (ClickDlgSetup(hWnd, _T("img\\活动\\周六礼物\\铜钱怪:进入战斗.bmp")))
- {
- // 将鼠标移动到指定位置;
- POINT ptDest = { 625, 28 }; // 左上角;
- GAssist::MouseMove(hWnd, ptDest);
- while (IsBattle(hWnd))
- {
- // 判断是否我方攻击;
- if (IsWattingAttack(hWnd, 1))
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- }
- SRAND(500, 750);
- }
- // 送礼协会会长乙;
- FindNPC(hWnd, _T("送礼协会会长甲"));
- IsWalkStop(hWnd);
- SRAND(1000, 2000);
- GAssist::MouseRClick(hWnd);
- }
- }
- }
- }
- }
- void CGameAssistDlg::OnBnClickedButton5() // 开宝箱;
- {
- HWND hProcessMainWnd = GAssist::GetProcessMainWnd();
- if (GAssist::nGameWndType == GAssist::GW_SMALL)
- {
- CRect rc;
- MouseAssist mouseAssist;
- mouseAssist.BindWnd(hProcessMainWnd, PT_TYPE::SCREEN_POINT);
- for (int i = 0; i < 50; i++)
- {
- if (!GAssist::GetImgMatchtemplate(hProcessMainWnd, GAssist::g_strAppdir + _T("img\\开宝箱\\应天府铁匠.bmp"), rc))
- {
- // 没找到,要将鼠标从目标中移走;并且要右击一次将目标的高亮状态取消;
- mouseAssist.SetCursorPos(rc.top + rand() % 5, rc.left + rand() % 5);
- mouseAssist.MoveTo(rc.top - rand() % 5, rc.left - rand() % 5);
- mouseAssist.RightClick();
- }
- else
- {
- GAssist::MouseClick(hProcessMainWnd, CPoint((rc.right + rc.left) / 2 + rand() % 3, (rc.top + rc.bottom) / 2 + rand() % 5));
- Sleep(600 + rand() % 30);
- // 再移动下,会更高精度;
- mouseAssist.MoveTo(rc.top - rand() % 15, rc.left - rand() % 15);
- // 判断是否还有对话,如果没有的话表明不是第一次进入;
- if (GAssist::GetImgMatchtemplate(hProcessMainWnd, GAssist::g_strAppdir + _T("img\\开宝箱\\开宝箱.bmp"), rc)) {
- GAssist::MouseClick(hProcessMainWnd, CPoint((rc.right + rc.left) / 2 + rand() % 2, (rc.top + rc.bottom) / 2 + rand() % 2));
- Sleep(rand() % 200 + 190);
- // 然后移动出去;
- //GAssist::MouseMove(hProcessMainWnd, CPoint(rc.top - 50 - rand()%20, rc.left - 50 - rand() % 20));
- mouseAssist.SetCursorPos(rc.top + rand() % 5, rc.left + rand() % 5);
- mouseAssist.MoveToEx(rc.top, rc.left, rc.Width(), rc.Height());
- }
- }
- Sleep(600 + rand() % 300);
- }
- }
- }
- void CGameAssistDlg::OnBnClickedButton6() // 职业挑战;
- {
- CRect rc;
- DebugLog(_T("进入孤独洞========="));
- HWND hProWnd = GAssist::GetProcessMainWnd();
- if (!FindNPC(hProWnd, "职业训导大师"))
- return;
- // 选择进入;
- BOOL bMatch = FALSE;
- int trySize = 20;
- // 我要挑战他们;
- while (!(bMatch = ClickDlgSetup(hProWnd, _T("img\\zyxdds-wytztm.bmp")))) {
- SRAND(1200, 2200);
- if (!trySize--) break;
- }
- // 准备好了
- if (ClickDlgSetup(hProWnd, _T("img\\zyxdds-zbhl.bmp")))
- {
- // 地图切换,等出图;
- SRAND(2000, 2500);
- if (IsOnMap(hProWnd, _T("img\\gdd\\name.bmp")))
- {
- DebugLog(_T("进入孤独洞"));
- char szName[10][32] = { "术士独侠","道士独侠","武师独侠","浪子独侠","剑客独侠","弓手独侠","禁卫独侠","墨者独侠","巫煞独侠","魂武独侠" };
- BattleYS(hProWnd, "缚神诀");
- for (int i = 0; i < 10; i++)
- {
- BattleOthers(hProWnd, szName[i], "缚神诀");
- }
- }
- }
- }
- void CGameAssistDlg::OnBnClickedButton7() // 家园任务;
- {
- // TODO: 在此添加控件通知处理程序代码
- }
- void CGameAssistDlg::OnBnClickedButton8() // 职业挑战2;
- {
- // TODO: 在此添加控件通知处理程序代码
- CRect rc;
- DebugLog(_T("进入孤独洞========="));
- HWND hProWnd = GAssist::GetProcessMainWnd();
- DebugLog(_T("进入孤独洞"));
- char szName[10][32] = { "术士独侠","道士独侠","武师独侠","浪子独侠","剑客独侠","弓手独侠","禁卫独侠","墨者独侠","巫煞独侠","魂武独侠" };
- for (int i = 0; i < 10; i++)
- {
- BattleOthers(hProWnd, szName[i], "缚神诀");
- }
- }
- void CGameAssistDlg::OnBnClickedButton9() // 移动到目标点
- {
- // TODO: 在此添加控件通知处理程序代码
- HWND hWnd = GAssist::GetProcessMainWnd();
- UpdateData();
- INT nX = GetDlgItemInt(IDC_EDIT1);
- INT nY = GetDlgItemInt(IDC_EDIT2);
- BOOL bOpenMap = ((CButton*)GetDlgItem(IDC_CHECK4))->GetCheck();
- if (bOpenMap)
- WorldMapPositioning(hWnd, { nX, nY });
- else
- GAssist::MouseMove(hWnd, { nX, nY });
- }
- void CGameAssistDlg::OnBnClickedButton10()
- {
- // TODO: 在此添加控件通知处理程序代码
- CRect rc;
- HWND hProWnd = GAssist::GetProcessMainWnd();
- int nZJType = 0;
- if (m_cbZJ.GetCheck() || m_cbZJ2.GetCheck())
- {
- if (m_cbZJ.GetCheck())
- nZJType = 1;
- if (m_cbZJ2.GetCheck())
- nZJType = 2;
- }
- UpdateData(FALSE);
- DebugLog(_T("start.打镜妖 %d----------------------------"));
- BattleJY(hProWnd, m_cbSummoner.GetCheck(), nZJType, m_cbAggressiveSkill.GetCheck());
- DebugLog(_T("end.打镜妖 %d----------------------------\n"));
- }
- void CGameAssistDlg::OnBnClickedButton11()
- {
- // TODO: 在此添加控件通知处理程序代码
- }
- void CGameAssistDlg::OnBnClickedButton12()
- {
- // TODO: 在此添加控件通知处理程序代码
- HWND hWnd = GAssist::GetProcessMainWnd();
- while ( true )
- {
- while (IsBattle(hWnd))
- {
- if ( IsWattingAttack(hWnd,1) )
- {
- GAssist::SendKey(hWnd, VK_A, FALSE, TRUE);
- }
- Sleep(900);
- }
- Sleep(600);
- }
- }
|