|
@@ -1265,6 +1265,75 @@ SRAND(80,120);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ void CAction::StartRepeat()
|
|
|
+ {
|
|
|
+ m_hBattleJYEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
|
|
+ if (m_hBattleJYEvent == NULL) {
|
|
|
+ _tprintf_s(_T("创建事件失败\n"));
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ m_hBattleJY = CreateThread(NULL, 0, RepeatThread, this, 0, NULL);
|
|
|
+ if (m_hBattleJY == NULL) {
|
|
|
+ _tprintf_s(_T("创建线程失败\n"));
|
|
|
+
|
|
|
+ if (m_hBattleJYEvent) {
|
|
|
+ SetEvent(m_hBattleJYEvent);
|
|
|
+ CloseHandle(m_hBattleJYEvent);
|
|
|
+ m_hBattleJYEvent = NULL;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void CAction::StopRepeat()
|
|
|
+ {
|
|
|
+ // 设置事件有信号;
|
|
|
+ if (m_hBattleJYEvent)
|
|
|
+ SetEvent(m_hBattleJYEvent);
|
|
|
+
|
|
|
+ // 等待线程结束;
|
|
|
+ if (m_hBattleJY) {
|
|
|
+ WaitForSingleObject(m_hBattleJY, INFINITE);
|
|
|
+ CloseHandle(m_hBattleJY);
|
|
|
+ m_hBattleJY = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭事件句柄;
|
|
|
+ if (m_hBattleJYEvent) {
|
|
|
+ CloseHandle(m_hBattleJYEvent);
|
|
|
+ m_hBattleJYEvent = NULL;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DWORD __stdcall CAction::RepeatThread(LPVOID lpParam)
|
|
|
+ {
|
|
|
+ CAction* pAction = (CAction*)lpParam;
|
|
|
+ do
|
|
|
+ {
|
|
|
+ BOOL bFirst = TRUE;
|
|
|
+ while (pAction->IsFighting())
|
|
|
+ {
|
|
|
+ if (pAction->IsWattingAttack(-1))
|
|
|
+ {
|
|
|
+ SRAND(50, 150);
|
|
|
+ pAction->SendKey(VK_A, FALSE, TRUE);
|
|
|
+ }
|
|
|
+ Sleep(50);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pAction->IsSPBelowSafeValue(TRUE, TRUE, 10))
|
|
|
+ {
|
|
|
+ // 右键;
|
|
|
+ pAction->MouseMove({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 });
|
|
|
+ pAction->MouseRClick({ (GameAssist::g_rcRoleIdleSP.right + GameAssist::g_rcRoleIdleSP.left) / 2, (GameAssist::g_rcRoleIdleSP.bottom + GameAssist::g_rcRoleIdleSP.top) / 2 });
|
|
|
+ }
|
|
|
+ } while (WaitForSingleObject(pAction->m_hBattleJYEvent, 100) == WAIT_TIMEOUT);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
void LoadMetaGraph()
|
|
|
{
|
|
|
// 解析xml;
|