Guest User

barbarian 1920x1080

a guest
Jun 14th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.45 KB | None | 0 0
  1. ;IF YOU PLAN TO USE IMAGESEARCH FUNCTIONS:
  2. ;Download: http://www.mediafire.com/?vtx9l1woj61h8r6 (1.4a new link)
  3. ;If your Windows installation is x64, use the 64-bit native AutoIt and the x64 directory in the archive
  4. ;Extract and copy AutoIt3 folder to Program Files directory
  5. ;Extract and copy all dlls to C:\Windows\ directory (optionally copy the MSVCR dlls to System32 as well)
  6. ;Extract pics directory anywhere and update the $directory var - INCLUDE TRAILING BACKSLASH: C:\pics\
  7. ;If you are running anything but fullscreen mode, the size of letters will mismatch and not loot anything. Resize or make your own pngs.
  8. ;IF YOU COMPILE THE SCRIPT TO EXE AND YOU USE X64:
  9. ;Run "Compile script to .exe (x64)"
  10. ;Check "Lowest" under the Compression menu option
  11. ;Leave x64 checkbox checked
  12. ;;;;;
  13. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  14. ;Required build: http://us.battle.net/d3/en/calculator/barbarian#WTXYQg!ZVg!abcZaY
  15. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  16. ;Official supported resolution: 1920x1080
  17. ;;;;;
  18. ;Original: [Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
  19. ;ImageSearch contributions by rvbfreak, goofinator, and asuRob
  20.  
  21. #include <ImageSearch.au3> ;comment this if you are not using the new looting system
  22. Global $Paused
  23. Opt('MouseCoordMode', 2)
  24. Opt('PixelCoordMode', 2)
  25. HotKeySet("=","Leave") ;script started by pressing =
  26. HotKeySet("-", "Pause") ;script paused by pressing -
  27. HotKeySet("x", "Stop") ;script stopped by pressing x
  28.  
  29. ;ImageSearch Looting Variables
  30. $ImgLoot = True ; set this to true if you want to use ImageSearch looting system. False will revert to old PixelSearch method
  31. $directory = "C:\Documents and Settings\Administrator\Mijn documenten\ImageSearchFiles\pics\" ; CHANGE THIS! Point it to the directory with the imagesearch pngs
  32. $totalItems = 17; This needs to match the number of pngs you are loading
  33. Global $pick[$totalItems], $size = WinGetClientSize("[TITLE:Diablo III; CLASS:D3 Main Window Class]"), $go = True, $Leave = False, $Dead = False, $Logout = False, $Window = False, $i = 0, $currentArrayItem = 0, $gX = 0, $gY = 0
  34. If ($size[0]/$size[1]) <> 16/9 Then $size[1]-=30 ; adjusts ratio for titlebar if not 16:9
  35. $pick[0] = "legendaryA.png|50"
  36. $pick[1] = "legendaryE.png|50"
  37. $pick[2] = "legendaryI.png|10"
  38. $pick[3] = "legendaryO.png|50"
  39. $pick[4] = "legendaryU.png|50"
  40. $pick[5] = "setA.png|50"
  41. $pick[6] = "setE.png|50"
  42. $pick[7] = "setU.png|50"
  43. $pick[8] = "setO.png|50"
  44. $pick[9] = "setI.png|50"
  45. $pick[10] = "rareA.png|30"
  46. $pick[11] = "rareE.png|30"
  47. $pick[12] = "rareI.png|30"
  48. $pick[13] = "rareO.png|30"
  49. $pick[14] = "rareU.png|30"
  50. $pick[15] = "uare.png|50"
  51. $pick[16] = "tome.png|50"
  52.  
  53. $LootRares = True ; set this to false if you don't want the bot to pick up rares (old looting method only)
  54. $Timer = False ; set this to true and the bot will randomly wait (5% chance) in town for 30-60 seconds before starting over
  55. $walktime = 2600 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  56. $loadtime = 3600 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives (original 3600)
  57. $loadtime2 = 13000 ; NEW LOADTIME WHEN LEAVING GAME AND HIT BY MOBS
  58. $tptime = 6900 ; time in ms the script waits for teleport before exiting the game (original 6900)
  59. $x_ratio = $size[0] / 1920
  60. $y_ratio = $size[1] / 1080
  61. $yellow = 0xFFF000 ; yellow color code (repair icon)
  62. $red = 0xD90000 ; red color code (repair icon)
  63.  
  64. Call("RestartRun")
  65. Func RestartRun()
  66. While $go
  67. if($Leave) Then
  68. $i = 0
  69. ;Call("CheckExit")
  70. Sleep(850) ;had to add this since the icon doesn't show up RIGHT away in game
  71. ;Call("CheckDead")
  72. Call("CheckRepair")
  73. If $Window Then
  74. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  75. Sleep($loadtime)
  76. $Window = False
  77. ExitLoop
  78. ElseIf $Dead or $Logout Then
  79. ExitLoop
  80. EndIf
  81. MouseClick("middle", Round(587 * $x_ratio),Round(333 * $y_ratio)) ;starts the main run
  82. Sleep(1390)
  83. MouseMove(Round(96*$x_ratio),Round(383*$y_ratio),1)
  84. Sleep(10)
  85. Send("1")
  86. Sleep(800)
  87. MouseClick("middle", Round(56 * $x_ratio),Round(290 * $y_ratio))
  88. Sleep(2900)
  89. MouseMove(Round(335*$x_ratio),Round(260*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted (ORIGINAL 360 xratio, 205 yratio)
  90. Sleep(600)
  91. ;Call("CheckDead")
  92. If $Window Then
  93. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  94. Sleep($loadtime)
  95. $Window = False
  96. ExitLoop
  97. ElseIf $Dead or $Logout Then
  98. ExitLoop
  99. EndIf
  100. $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
  101. If Not @error Then
  102. MouseClick("left",Round(335*$x_ratio),Round(260*$y_ratio)) ;Entrance to cellar (ORIGINAL 360 xratio, 205 yratio)
  103. Sleep(1400)
  104. Sleep($walktime)
  105. MouseClick("middle",Round(80*$x_ratio),Round(830*$y_ratio)) ;moves to doorway leading to rare inside cellar
  106. Sleep(2500)
  107. MouseMove(Round(350*$x_ratio),Round(60*$y_ratio),1) ;hovers over the rare Sarkoth
  108. Sleep(5)
  109. Send("1")
  110. Sleep(10)
  111. MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
  112. Sleep(140)
  113. MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
  114. Sleep(140)
  115. MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
  116. Sleep(1000)
  117. Send("2")
  118. Sleep(120)
  119. Send("2")
  120. Sleep(120)
  121. Send("2")
  122. Sleep(120)
  123. Send("2")
  124. Sleep(120)
  125. Send("3")
  126. Sleep(120)
  127. Send("3")
  128. Sleep(120)
  129. Send("3")
  130. Sleep(120)
  131. Send("3")
  132. Sleep(140)
  133. Send("4")
  134. Sleep(140)
  135. Send("4")
  136. Sleep(140)
  137. Send("4")
  138. Sleep(1400)
  139. MouseClick("middle",Round(750*$x_ratio),Round(555*$y_ratio)) ;move to left top corner for gold
  140. Sleep(900)
  141. MouseClick("middle",Round(1175*$x_ratio),Round(350*$y_ratio)) ;move to right top corner for gold
  142. Sleep(900)
  143. MouseClick("middle",Round(1020*$x_ratio),Round(773*$y_ratio)) ;move to middle before looting
  144. Sleep(900)
  145. MouseClick("middle",Round(900*$x_ratio),Round(400*$y_ratio)) ;move to chest middle
  146. Call("CheckLoot")
  147. ; Send("t")
  148. ; Sleep($tptime)
  149. ; Call("RandomSleep") XXXXXXXXXXXXX
  150. ; Call("CheckDead") XXXXXXXXXXXXX
  151. If Not $Logout And Not $Dead And Not $Window Then
  152. Sleep(300)
  153. Send("{ESCAPE}") ;menu
  154. Sleep(200)
  155. MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  156. Sleep($loadtime2) ; ORIGINAL $loadtime
  157. ; Call("CheckDead") XXXXXXXXXXXXXX
  158. If Not $Logout Then
  159. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  160. Sleep($loadtime)
  161. EndIf
  162. Else
  163. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  164. Sleep($loadtime)
  165. $Window = False ; reset the flag so it doesn't think a window is always up
  166. EndIf
  167. Else
  168. MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
  169. Sleep(400)
  170. Send("3")
  171. Sleep(120)
  172. Send("3")
  173. Sleep(120)
  174. Send("3")
  175. ; Sleep(620) XXXXXXXXXXXXXXX
  176. ; Send("t") XXXXXXXXXXXXXXX
  177. ; Sleep($tptime) XXXXXXXXXXXXXXX
  178. ; Call("CheckDead") XXXXXXXXXXXXX
  179. ; Call("RandomSleep") XXXXXXXXXXX
  180. ; Call("CheckDead") XXXXXXXXXXXXX
  181. If Not $Logout And Not $Dead And Not $Window Then
  182. Sleep(300)
  183. Send("{ESCAPE}") ;menu
  184. Sleep(200)
  185. MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  186. Sleep($loadtime2) ; ....... ORIGINAL $loadtime ............
  187. ; Call("CheckDead") XXXXXXXXXXXXXXXXXX
  188. If Not $Logout Then
  189. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  190. Sleep($loadtime)
  191. EndIf
  192. Else
  193. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  194. Sleep($loadtime)
  195. $Window = False ; reset the flag so it doesn't think a window is always up
  196. EndIf
  197. EndIf
  198. EndIf
  199. WEnd
  200. Call("RestartRun")
  201. EndFunc
  202.  
  203. Func CheckDead()
  204. Call("CheckWindow")
  205. $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
  206. If Not @error Then
  207. If Not $Window Then
  208. $Dead = True
  209. Sleep(100)
  210. Send("{Escape}")
  211. Sleep(10)
  212. MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  213. Sleep(11000)
  214. Sleep($loadtime)
  215. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  216. Sleep($loadtime)
  217. Else
  218. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  219. Sleep($loadtime)
  220. $Dead = False
  221. EndIf
  222. Else
  223. $Dead = False
  224. EndIf
  225. $LogoutTimerCancel = PixelSearch(Round(900*$x_ratio), Round(240*$y_ratio), Round(1010*$x_ratio), Round(290*$y_ratio), 0x993827) ; checks for cancel button on logout timer
  226. If Not @error Then
  227. Sleep(11000)
  228. Sleep($loadtime)
  229. If Not $Window Then
  230. $Dead = True
  231. $Logout = True
  232. Sleep($loadtime)
  233. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  234. Sleep($loadtime)
  235. Else
  236. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  237. Sleep($loadtime)
  238. $Logout = False
  239. EndIf
  240. Else
  241. $Logout = False
  242. EndIf
  243. EndFunc
  244.  
  245. Func CheckWindow()
  246. $CloseButton = PixelSearch(Round(1570*$x_ratio), Round(110*$y_ratio), Round(1590*$x_ratio), Round(120*$y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window
  247. If Not @error Then
  248. Sleep(200)
  249. Send("{SPACE}") ;close any open windows
  250. $Window = True
  251. Else
  252. $Window = False
  253. EndIf
  254. EndFunc
  255.  
  256. Func CheckExit()
  257. $ExitButton = PixelSearch(Round(1190*$x_ratio), Round(400*$y_ratio), Round(1200*$x_ratio), Round(440*$y_ratio), 0x14100E) ; checks for the grey border of the exit prompt
  258. If Not @error Then
  259. Send("{ESCAPE}")
  260. Sleep(100)
  261. Send("{SPACE}") ;close any open windows
  262. Sleep(200)
  263. MouseMove(1,1) ; reset cursor position before checking for button
  264. $Resume = Hex(PixelGetColor(Round(140*$x_ratio), Round(420*$y_ratio)), 6) ; checks if resume button can be pressed
  265. If $Resume == "400900" Or $Resume == "380900" Then
  266. Sleep(200)
  267. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  268. Sleep($loadtime)
  269. EndIf
  270. EndIf
  271. EndFunc
  272.  
  273. Func CheckRepair()
  274. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  275. If Not @error Then
  276. Call("DoRepair")
  277. EndIf
  278. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  279. If Not @error Then
  280. Call("DoRepair")
  281. EndIf
  282. EndFunc
  283.  
  284. Func DoRepair()
  285. Sleep(100)
  286. Send("t")
  287. Sleep($tptime)
  288. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  289. Sleep(1500)
  290. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  291. Sleep(1500)
  292. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  293. Sleep(1200)
  294. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  295. Sleep(400)
  296. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  297. Sleep(200)
  298. Call("CheckDead")
  299. If Not $Dead and Not $Logout Then
  300. Send("{ESCAPE}") ;closes repair tab
  301. Sleep(100)
  302. Send("{ESCAPE}") ;menu
  303. Sleep(10)
  304. MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  305. Sleep($loadtime)
  306. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  307. Sleep($loadtime)
  308. EndIf
  309. EndFunc
  310.  
  311. Func CheckLoot()
  312. MouseMove(14,14,0)
  313. Sleep(Random(500,2000))
  314. If Not $ImgLoot Then
  315. $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1900*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  316. If Not @error Then
  317. MouseClick ('left', $SetLoot[0], $SetLoot[1], 1, 0)
  318. Sleep(Random(1000,1200))
  319. MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
  320. $i+= 1
  321. If $i <= 6 Then
  322. Call("CheckLoot")
  323. EndIf
  324. EndIf
  325. $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1900*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  326. If Not @error Then
  327. MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1], 1, 0)
  328. Sleep(Random(1000,1200))
  329. MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
  330. $i+= 1
  331. If $i <= 6 Then
  332. Call("CheckLoot")
  333. EndIf
  334. EndIf
  335. If $LootRares Then
  336. $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1900*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  337. If Not @error Then
  338. MouseClick ('left', $RareLoot[0], $RareLoot[1], 1, 0)
  339. Sleep(Random(1000,1200))
  340. MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
  341. $i+= 1
  342. If $i <= 6 Then
  343. Call("CheckLoot")
  344. EndIf
  345. EndIf
  346. EndIf
  347. Else
  348. Call("pickItems")
  349. EndIf
  350. EndFunc
  351.  
  352. Func pickItems()
  353. $currentArrayItem = 0
  354. For $gI = 0 to ($totalItems - 1)
  355. $array = StringSplit($pick[$gI],"|")
  356. $file = $array[1]
  357. $accuracy = $array[2]
  358. $urlString = $directory & $file
  359. $Target = _ImageSearchArea($urlString,1,0,0,Round(1920*$x_ratio),Round(1080*$y_ratio),$gX,$gY,$accuracy)
  360. While $i <= 12 ; max: 13 gems and pieces of gear to loot
  361. If $Target And ($gX > 15) And ($gY > 15) Then
  362. ;MsgBox(4096,"Debug",$urlString & " " & $gX & "-" & $gY)
  363. MouseClick("left", $gX, $gY, 1, 0)
  364. Sleep(Random(1200,1400))
  365. MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
  366. Sleep(5)
  367. $Target = _ImageSearchArea($urlString,1,0,0,Round(1920*$x_ratio),Round(1080*$y_ratio),$gX,$gY,$accuracy)
  368. $i+= 1
  369. Else
  370. ExitLoop
  371. EndIf
  372. WEnd
  373. Next
  374. EndFunc
  375.  
  376. Func RandomSleep()
  377. If $Timer And Random(1,20) <= 2 Then
  378. Sleep(Random(15000,30000))
  379. EndIf
  380. EndFunc
  381.  
  382. Func Pause()
  383. $Leave = False
  384. EndFunc
  385.  
  386. Func Stop() ;to allow the script to stop
  387. Exit
  388. EndFunc
  389.  
  390. Func Leave()
  391. $Leave = True
  392. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment