Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.27 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <GUIConstantsEx.au3>
  3. #include <ScrollBarsConstants.au3>
  4. #include <EditConstants.au3>
  5. #include <GuiEdit.au3>
  6. #include <StaticConstants.au3>
  7. #include <WindowsConstants.au3>
  8. #include <MsgBoxConstants.au3>
  9.  
  10.  
  11. $Form1 = GUICreate("RaGeWeaver", 615, 194, 192, 124)
  12. $Group1 = GUICtrlCreateGroup("Statistics", 8, 8, 249, 145)
  13. $Label1 = GUICtrlCreateLabel("Number of Games played:", 16, 128, 155, 17)
  14. GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
  15. $cln_found = GUICtrlCreateLabel("SpellWeaver Client found:", 16, 32, 154, 18)
  16. GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
  17. GUICtrlCreateLabel("blub", 80, 32, 4, 4)
  18. $cln_wpos = GUICtrlCreateLabel("", 16, 52, 154, 18)
  19. GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
  20. $clnfn = GUICtrlCreateLabel("not detected", 176, 32, 75, 17)
  21. GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
  22. $games_played = GUICtrlCreateLabel("0", 184, 128, 67, 17, $SS_RIGHT)
  23. GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
  24. GUICtrlCreateGroup("", -99, -99, 1, 1)
  25. $Group2 = GUICtrlCreateGroup("Settings", 264, 8, 345, 145)
  26.  
  27. $Edit1 = GUICtrlCreateEdit("press Start", 272, 24, 329, 121, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$ES_READONLY))
  28. GUICtrlSetData(-1, "press Start")
  29.  
  30. $Button1 = GUICtrlCreateButton("Start", 528, 160, 75, 25)
  31. $Button2 = GUICtrlCreateButton("TopCorner", 428, 160, 75, 25)
  32. $Button3 = GUICtrlCreateButton("Restore", 328, 160, 75, 25)
  33. GUISetState(@SW_SHOW)
  34. Global $LogFile = ""
  35. Global $games = 0
  36. Global $posx = 0
  37. Global $posy = 0
  38. Global $posw = 0
  39. Global $posh = 0
  40. Global $restw = 0
  41. Global $resth = 0
  42. Global $botRun = false
  43. Global $round = 0
  44. ; 0 = OutOfGame 1 = Starting Game 2 = Accepting Hand 3 = FinishRound
  45. Global $status = 0
  46. Global $hWnd = -1
  47.  
  48. Func StartBotGame()
  49. $LogFile = $LogFile & @CRLF & "choosing botgame"
  50. ControlClick ($hWnd, '','', "left", 1, 660, 805);
  51. $status = 1
  52. $games = $games+1
  53. $round = 0
  54. Sleep(2000)
  55. EndFunc
  56.  
  57. Func CheckGameButton()
  58. $col = PixelSearch($posx + 44, $posy +77, $posx+174, $posy+168, 0xFF0000,100,1,$hWnd)
  59. If Not @error Then
  60. ;MsgBox($MB_SYSTEMMODAL, "", "X and Y are: " & $col[0] & "," & $col[1])
  61. ;Sleep(1000)
  62. $LogFile = $LogFile & @CRLF & "starting a game"
  63. ControlClick ($hWnd, '','', "left", 1, $col[0]-$posx, $col[1]-$posy);
  64. Sleep(1000)
  65. StartBotGame()
  66.  
  67. EndIf
  68. EndFunc
  69.  
  70. Func KeepCards()
  71. $col = PixelSearch($posx + 763, $posy +641, $posx+803, $posy+681, 0x44210D,100,1,$hWnd)
  72. If Not @error Then
  73. ;MsgBox($MB_SYSTEMMODAL, "", "X and Y are: " & $col[0] & "," & $col[1])
  74. ;Sleep(1000)
  75. $LogFile = $LogFile & @CRLF & "keeping cards"
  76. ControlClick ($hWnd, '','', "left", 1, $col[0]-$posx, $col[1]-$posy);
  77. $status = 2
  78. ;Sleep(1000)
  79. ;StartBotGame()
  80.  
  81. EndIf
  82.  
  83. EndFunc
  84.  
  85. Func EndRound()
  86. $col = PixelSearch($posx + 1191, $posy +564, $posx+1191, $posy+564, 0xedd96b,60,1,$hWnd)
  87. If Not @error Then
  88. $round = $round + 1
  89. $LogFile = $LogFile & @CRLF & "ending round "&$round
  90. ;$status = 3
  91. ControlClick ($hWnd, '','', "left", 1, $col[0]-$posx, $col[1]-$posy);
  92. $k = Random(1000, 5000, 1)
  93. Sleep($k)
  94. EndIf
  95. EndFunc
  96.  
  97. Func FindACardToPlay()
  98. $colc = PixelSearch($posx + 336, $posy +748, $posx+982, $posy+989, 0x78D843,30,1,$hWnd)
  99. If Not @error Then
  100. MouseMove($colc[0]-$posx,$colc[1]-$posy)
  101. EndIf
  102. EndFunc
  103.  
  104. Func FinalizeGame()
  105. $colc = PixelSearch($posx + 541, $posy +650, $posx+541, $posy+650, 0x685222,30,1,$hWnd)
  106. If Not @error Then
  107. Sleep(1000)
  108. $colc = PixelSearch($posx + 541, $posy +650, $posx+541, $posy+650, 0x685222,30,1,$hWnd)
  109. If Not @error Then
  110. $LogFile = $LogFile & @CRLF & "ending game "
  111. MouseMove($colc[0]-$posx,$colc[1]-$posy)
  112. ControlClick ($hWnd, '','', "left", 1, $colc[0]-$posx, $colc[1]-$posy);
  113. $k = Random(1000, 5000, 1)
  114. $status = 0
  115. Sleep($k)
  116. EndIf
  117. Else
  118. ;$status = 2
  119. EndIf
  120. EndFunc
  121.  
  122. While 1
  123. GUICtrlSetData ($games_played, $games)
  124. $hWnd = WinGetHandle("[CLASS:ApolloRuntimeContentWindow]")
  125. If @error Then
  126. GUICtrlSetData ($clnfn, "not found")
  127. Else
  128. GUICtrlSetData ($clnfn, "found")
  129. $aPos = WinGetPos("[CLASS:ApolloRuntimeContentWindow]")
  130. ;GUICtrlSetData ($cln_wpos, "Window Position: "&$aPos[0]&","&$aPos[1])
  131. $posx = $aPos[0]
  132. $posy = $aPos[1]
  133. $posw = $aPos[2]
  134. $posh = $aPos[3]
  135. EndIf
  136. $nMsg = GUIGetMsg()
  137. Switch $nMsg
  138. Case $GUI_EVENT_CLOSE
  139. ;WinMove($hWnd, "", 0, 0,$restw,$resth)
  140. Exit
  141. Case $Button3
  142. ;WinMove($hWnd, "", 0, 0,$restw,$resth)
  143. Case $Button2
  144. ;$restw = $posw
  145. ;$resth = $posh
  146. WinMove($hWnd, "", 0, 0)
  147. Case $Button1
  148. if Not $botRun Then
  149. $botRun = true
  150. GUICtrlSetData($Button1, "Stop")
  151. else
  152. $botRun = false
  153. GUICtrlSetData($Button1, "Start")
  154. EndIf
  155. ;GUICtrlSetState($Button1, $GUI_DISABLE)
  156. ;WinMove($hWnd, "", 0, 0)
  157. ;CheckGameButton()
  158. ;ControlClick ($hWnd, '','', "left", 1, 117, 121)
  159.  
  160. GUICtrlSetState($Button1, $GUI_ENABLE)
  161. EndSwitch
  162. GUICtrlSetData ($cln_wpos, "Status: "&$status)
  163. If $botRun Then
  164. GUICtrlSetData($Edit1, $LogFile)
  165. _GUICtrlEdit_Scroll($Edit1, $SB_SCROLLCARET)
  166. ;FindACardToPlay()
  167. Switch $status
  168. Case 0
  169. CheckGameButton()
  170. Case 1
  171. KeepCards()
  172. Case 2
  173. EndRound()
  174. FinalizeGame()
  175.  
  176.  
  177. EndSwitch
  178. EndIf
  179. Sleep(100)
  180. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement