private static void ClickEvent(GamePicture picture, Rect rect, int ms, Action action) { List <bool> check = new List <bool>() { false, false }; while (true) { var point = FindGamePicture(rect, picture); if (!IsFind(point)) { if (check[0] == true && check[1] == false) { MainWindow.mainWindow.WriteLog(picture + "확인"); action(); return; } MainWindow.mainWindow.WriteLog(picture + "서치 실패"); Thread.Sleep(ms); check.Add(false); check.RemoveAt(0); continue; } check.Add(true); check.RemoveAt(0); MouseHooker.LeftClick(point); Thread.Sleep(ms); } }
public void Excecute() { if (mit == MIT.Click) { MouseHooker.LeftClick(point); } else if (mit == MIT.Delay) { Thread.Sleep(delay); } }
private static void MacroInputCheckingThread(ref int count, Rect rect) { try { while (true) { for (int i = 0; i <= 10; i++) { var point = FindGamePicture(rect, ( GamePicture )i); if (IsFind(point)) { MouseHooker.LeftClick(point); } Thread.Sleep(30); } } } catch { } }
private static void ClickThread(ref int count, GamePicture picture, Rect rect) { try { List <bool> check = new List <bool>() { false, false }; while (true) { var point = FindGamePicture(rect, picture); if (!IsFind(point)) { if (check[0] == true && check[1] == false) { count++; if (picture == GamePicture.Fail) { MainWindow.mainWindow.ModifyGetFail("실패 : " + count.ToString() + "(" + (++StackFailCount) + ")"); } else if (picture == GamePicture.Success) { MainWindow.mainWindow.ModifyGetSuccess("성공 : " + count.ToString() + "(" + (++StackSuccessCount) + ")"); } else if (picture == GamePicture.BigMonster) { MainWindow.mainWindow.ModifyBigMosnter("괴수 등장 : " + count.ToString() + "(" + (++StackBigMonsterCount) + ")"); } } Thread.Sleep(1000); check.Add(false); check.RemoveAt(0); continue; } check.Add(true); check.RemoveAt(0); MouseHooker.LeftClick(point); Thread.Sleep(1000); } } catch { } }
private static void ClickThreadOnce(ref int count, GamePicture picture, Rect rect) { try { List <bool> check = new List <bool>() { false, false }; while (count == 0) { var point = FindGamePicture(rect, picture); if (!IsExist(point)) { MainWindow.mainWindow.WriteLog(picture + "경로에 없음"); throw new Exception(""); } if (!IsFind(point)) { if (check[0] == true && check[1] == false) { count++; MainWindow.mainWindow.WriteLog(picture + "확인"); } MainWindow.mainWindow.WriteLog(picture + "서치 실패"); Thread.Sleep(1000); check.Add(false); check.RemoveAt(0); continue; } check.Add(true); check.RemoveAt(0); MouseHooker.LeftClick(point); Thread.Sleep(1000); } } catch { } }
public static void FullFishCheckingThread(ref int fullFishCount, GamePicture fullFish, Rect rect) { List <bool> check = new List <bool>() { false, false }; List <Thread> FinderThreadList = new List <Thread>(); try { while (true) { AA :; var point = FindGamePicture(rect, fullFish); if (!IsFind(point)) { if (check[0] == true && check[1] == false) { if (MacroThread != null) { MacroThread.Abort(); } MainWindow.mainWindow.WriteLog("어망 진입완료"); MainWindow.mainWindow.ModifySellFullFish("어망 풀 : " + (++fullFishCount).ToString() + "(" + (++StackFullFishCount) + ")"); int a = 0; int b = 0; int NoFish = 0; try { FinderThreadList.Add(new Thread(() => ClickThreadOnce( ref a, GamePicture.FullFish_SellAll, AppSetting.RectList[( int )RectEnum.FullFishContinue] ))); FinderThreadList.Add(new Thread(() => ClickThreadOnce( ref b, GamePicture.FullFish_SellAllOk, AppSetting.RectList[( int )RectEnum.FullFishContinue] ))); StartList(FinderThreadList); } catch (Exception e) { MainWindow.mainWindow.WriteLog("문제1 : " + e); } try { while (true) { var Clear어망 = FindGamePicture(AppSetting.RectList[( int )RectEnum.FullFishContinue], GamePicture.FullFish_SellCheck); if (IsFind(Clear어망)) { NoFish++; MainWindow.mainWindow.WriteLog(GamePicture.FullFish_SellCheck + "확인"); break; } Thread.Sleep(500); } } catch (Exception e) { MainWindow.mainWindow.WriteLog("문제2 : " + e); } try { if (NoFish > 0) { AbortList(FinderThreadList); FinderThreadList.Clear(); ClickEvent(GamePicture.Back, AppSetting.RectList[( int )RectEnum.FullFishContinue], 1000, new Action(() => { MouseHooker.MoveTo(new Point(0, 0)); MainWindow.mainWindow.WriteLog("낚시터로 이동완료"); MacroThread = new Thread(MacroThreadFunction); MacroThread.Start(); })); check[0] = false; check[1] = false; goto AA; } else { MainWindow.mainWindow.WriteLog("어망 비우기 실패"); goto AA; } } catch (Exception e) { MainWindow.mainWindow.WriteLog("문제3 : " + e); } } Thread.Sleep(1000); check.Add(false); check.RemoveAt(0); continue; } check.Add(true); check.RemoveAt(0); MouseHooker.LeftClick(point); Thread.Sleep(1000); } } catch { AbortList(FinderThreadList); } }