private void btnCompare_Click(object sender, EventArgs e) { TMScreens tmScreens = new TMScreens(); TMPart part = tmScreens.GetPart("RumbleStart"); pBox.Image = part.Bitmap; Bitmap bitmap = wm.GetScreenPart(part.Position.Top, part.Position.Left, part.Position.Width, part.Position.Height); pBox2.Image = bitmap; if (wm.VerifyPart("RumbleStart")) { //wm.LeftMouseClick(part.Position.Left, part.Position.Top); MessageBox.Show("Equal!"); } else { MessageBox.Show("NOT Equal!"); } }
/// <summary> /// Main Run Cycle /// </summary> private void RunCycle() { int CommonDelay = StepDelay; // Set TM window active User32.SetForegroundWindow(wm.GetTMWindow()); Thread.Sleep(CommonDelay); enumResolution resolution = enumResolution.Default_1280x800; if (cb1280x720.Checked) { resolution = enumResolution.Res_1280x720; } TMScreens tmScreens = new TMScreens(resolution); TMPart part = null; int rumbles = 0; Stages stage = Stages.RunRumble; Stages prevStage = Stages.RunRumble; int claimWait = 0; DateTime start = DateTime.Now; AddLog("--- TMClicker started"); while (true) { switch (stage) { case Stages.RunRumble: // Check stage = Stages.RunRumble it means we don't run rumble yet part = tmScreens.GetPart("RumbleStart"); claimWait++; if (wm.VerifyPart(tmScreens, part) || claimWait > 10) { claimWait = 0; AddLog("RumbleStarted - clicked to run it!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); stage = Stages.StartAuto; AddLog(string.Format("*** Finished {0} Rumble(s)", rumbles)); AddLog(string.Format("*** Time from start: {0:hh\\:mm\\:ss}", (DateTime.Now - start))); rumbles++; } break; case Stages.StartAuto: // Check if we already started Rumble part = tmScreens.GetPart("RumbleAuto"); if (wm.VerifyPart(tmScreens, part)) { AddLog("RumbleAuto - clicked to turn Auto ON!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); stage = Stages.CheckAuto; claimWait = 0; } break; case Stages.CheckAuto: // Confirm we started Auto battle part = tmScreens.GetPart("RumbleAutoOn"); if (wm.VerifyPart(tmScreens, part) || claimWait > 5) { AddLog("RumbleAuto - Auto is ON confirmed!"); stage = Stages.CheckWinLose; claimWait = 0; } else { claimWait++; } break; case Stages.CheckWinLose: // Check if we already Won/Defeated part = tmScreens.GetPart("RumbleWon"); if (wm.VerifyPart(tmScreens, part)) { AddLog("Rumble has Won or Defeated!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); stage = Stages.CheckClaims; } break; case Stages.CheckClaims: // Check if need claim part = tmScreens.GetPart("RumbleClaim"); claimWait++; if (wm.VerifyPart(tmScreens, part)) { AddLog("Rumble Cards Prize has Claimed!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); claimWait = 0; } // Check if it's Arena change part = tmScreens.GetPart("RumbleArena"); if (wm.VerifyPart(tmScreens, part)) { AddLog("Rumble Arena has been changed!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); claimWait = 0; } // As after change Arena can be Claim prize, just wait 5 times before move with next Rumble if (claimWait > 3) { AddLog("Claim and Arena checked!"); stage = UseGetGoldSteps ? Stages.CheckGoldChest : Stages.RunRumble; claimWait = 0; } break; case Stages.CheckGoldChest: // Check if it's gold prize part = tmScreens.GetPart("RumbleGold"); claimWait++; if (wm.VerifyPart(tmScreens, part)) { AddLog("Rumble Gold prize - clicked on it!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); stage = Stages.ClaimGoldChest; } if (claimWait > 3) { AddLog("No Gold Prize - checked."); stage = Stages.ClaimGoldChest; claimWait = 0; } break; case Stages.ClaimGoldChest: // Check to claim gold prize part = tmScreens.GetPart("RumbleGoldClaim"); claimWait++; if (wm.VerifyPart(tmScreens, part)) { AddLog("Rumble Gold Prize has Claimed!"); wm.LeftMouseClick(part.Position.Left, part.Position.Top); stage = Stages.RunRumble; } if (claimWait > 3) { stage = Stages.RunRumble; claimWait = 0; } break; } if (prevStage != stage) { AddLog("Wait on stage = " + stage.ToString()); prevStage = stage; } Thread.Sleep(CommonDelay); if (MainTaskExist) { break; } while (MainTaskPause) { Thread.Sleep(1000); } } }