Advertisement
thantos

dhautoroute

Jul 4th, 2012
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.44 KB | None | 0 0
  1. ;notAres' DH Gold Script 1.9.3 - 6/18/2012 - New INI option: Identify. Added VendItems() and StashItems() to simplify code and added 2 colors of legendaries to stash (highlighted/not highlighted). Trimmed down all "Area" CheckFor() calls. Fixed CheckFor("ExitGame"). Moves mouse out of the way while looting. Added deaths/cellars to PAUSED tooltip.
  2. ;YOU MUST START THE BOT AT THE RESUME GAME SCREEN!
  3. ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkoth-dh-gold-script-autoit-script-1920x1080.html
  4. ;;;;;
  5. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  6. ;Suggested build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aYW!YaaabY
  7. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  8. ;Official supported resolution: 1920x1080
  9. ;;;;;
  10. ;Original by mackus101 @ ownedcore
  11. ;ImageSearch contributions by rvbfreak, goofinator, and asuRob
  12. ;Refactoring and additional functions by Shimizoki
  13.  
  14. ;=========== DO NOT TOUCH ===========;
  15. #RequireAdmin
  16. #include <GUIConstantsEx.au3>
  17. #include <StaticConstants.au3>
  18. #include <WindowsConstants.au3>
  19. Opt('MouseCoordMode', 2)
  20. Opt('PixelCoordMode', 2)
  21. Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "1.9.3", $ini = "DH.ini", $hFont = 0, $title, $Paused, $Go = False, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $MagicCount = 0, $GemCount = 0, $TomeCount = 0, $deathCount = 0, $cellarCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000, $lblRun, $lblLocation, $lblStatus, $lblLast, $lblRuntime, $lblGear, $lblItems
  22. For $i = 0 To Random(0, 7, 1)
  23. $title &= Chr(Random(97, 122, 1))
  24. Next
  25. For $i = 0 To Random(5, 10, 1)
  26. $title &= Chr(Random(65, 90, 1))
  27. Next
  28. $title &= " "
  29. Global $gems[8] = ["Ru1.png", "Ru2.png", "Em1.png", "Em2.png", "To1.png", "To2.png", "Am1.png", "Am2.png"]
  30. If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
  31. If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16, "ERROR", "Why aren't you running the 64-bit AutoIt??? Expect bugs!")
  32. If $size = 0 Then
  33. MsgBox(16, "Error", "Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
  34. Exit
  35. EndIf
  36. ;====================================;
  37.  
  38. ;============= SETTINGS: DONT CHANGE HERE, CHANGE DH.INI =============;
  39. HotKeySet("=", "Begin") ;script toggled on/off by pressing =
  40. HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
  41. HotKeySet("x", "Stop") ;script stopped by pressing x
  42.  
  43. ;Change to match your abilities (1-4 by default)z
  44. $skillCaltrops = "1"
  45. $skillSmokeScreen = "2"
  46. $skillPreparation = "3"
  47. $skillCompanion = "4"
  48.  
  49. $movementSpeed = 25 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0% (25% is the movement cap but SS + Displacement avg = 32%)
  50.  
  51. ;Custom Loot
  52. $pngLoc = "@ScriptDir" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  53. $totalItems = 1 ;Number of items in the pick array
  54. Global $pick[$totalItems] ;DONT CHANGE THIS
  55.  
  56. ;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
  57. $pick[0] = "mythic.png|40" ;png|Tolerance
  58. ;$pick[1] = "item2.png|0"
  59. ;$pick[2] = "item3.png|0"
  60. Global $Route[2] = ["1", "2"]
  61.  
  62. ;Looting
  63. $LootSets = "True" ;True if you want to pick up Sets
  64. $LootLegendaries = "True";True if you want to pick up Legendaries
  65. $LootRares = "True" ;True if you want to pick up Rares
  66. $LootMagic = "True" ;True if you want to pick up Magic
  67. $LootGems = "True" ;True if you want to pick up Gems
  68. $LootTomes = "True" ;True if you want to pick up Tome of Secrets
  69. $LootCustom = "False" ;True if you want to pick up Custom Items (The items in the $pick array above)
  70.  
  71. ;Manage Loot
  72. $Identify = "True" ;True to enable identifying items before stashing/vendoring
  73. $mLoot = 5 ;Nuber of successful runs until Stash and Vendor
  74. $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
  75.  
  76. ;Stashing
  77. $StashLoot = "True" ;True if you want to store Items in the stash
  78. ;---
  79. $StashLegendary = "True";True if you want to store Legendary items in the stash
  80. $StashRare = "True" ;True if you want to store Rare items in the stash
  81. $StashMagic = "False" ;True if you want to store Magic items in the stash
  82. $StashTomes = "True" ;True if you want to store Tomes items in the stash
  83. $StashGems = "True" ;True if you want to store Gems items in the stash
  84.  
  85. ;Vendoring ==NEW SETTINGS==
  86. $VendorLoot = "True" ;True if you want to vendor anything
  87. ;---
  88. $VendorRare = "True" ;True if you want to vendor Rares
  89. $VendorMagic = "True" ;True if you want to vendor Magic
  90. $vendorAll = "False" ;True if you want to right click all items when talking to vendor
  91. $vendorRows = 5 ;# of rows to vendor, starting from the top (default = 5: bottom row is safe)
  92. $vendorCols = 10 ;# of columns to vendor, starting from left
  93.  
  94. ;Variability ==NEW SETTINGS==
  95. $Timer = "True" ;True and the bot will add random sleep intervals
  96. ;---
  97. $attackTime = 3900 ;Time (in ms) the script will shoot sarkoth with the right button
  98. $attackMulti = "True" ;True if you want to shoot both left and right in addition to the middle (False for Lightning Ball)
  99. $walktime = 2800 ;Time (in ms) the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  100. $loadtime = 3400 ;Time (in ms) the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  101. $tptime = 6900 ;Time (in ms) the script waits for teleport before exiting the game
  102. ;====================================;
  103.  
  104. $x_ratio = $size[0] / 1920
  105. $y_ratio = $size[1] / 1080
  106. If FileExists($ini) Then
  107. Call("ReadINI")
  108. Call("CreateINI")
  109. Else
  110. Call("CreateINI")
  111. EndIf
  112.  
  113. If $pngLoc == "@ScriptDir" Then $pngLoc = @ScriptDir & "\pics\"
  114. If $totalItems < 1 Then $LootCustom = "False"
  115. $mLootIn = $mLoot
  116. $movementSpeed = 1 + ($movementSpeed / 100)
  117. $VersionsInfo = "http://dl.dropbox.com/u/9955791/version.ini"
  118. $oldVersion = IniRead("updater.ini", "Version", "Version", $ver)
  119. $newVersion = "0.0"
  120.  
  121. If Not FileExists($pngLoc & "MainMenu.png") Then
  122. MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
  123. Exit
  124. EndIf
  125.  
  126. Call("SetupGUI")
  127. Call("DoUpdate")
  128.  
  129. While 1
  130. Call("RestartRun")
  131. WEnd
  132.  
  133. Func RestartRun()
  134. If ($Go) Then
  135. $i = 0
  136. WinSetTitle($title, "", $title & $ver & " - Running")
  137. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  138. ;Checks if the player is Dead/Logout/Window, then if in Main Menu, etc.
  139. If CheckDead() Then
  140. Return
  141. ElseIf CheckFor("ExitGame", "", Round(860 * $x_ratio), Round(400 * $y_ratio), Round(1040 * $x_ratio), Round(450 * $y_ratio), 0.5, 140) Then
  142. GUICtrlSetData($lblStatus, "Status: Exit window up")
  143. MouseClick("left", Round(1064 * $x_ratio), Round(632 * $y_ratio))
  144. Sleep(100)
  145. Send("{SPACE}")
  146. Return
  147. ElseIf CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio)) Then
  148. GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs till vendor: " & $mLootIn)
  149. GUICtrlSetData($lblLocation, "Location: Main Menu")
  150. GUICtrlSetData($lblStatus, "Status: Starting Game")
  151. RandClick("left", Round(230 * $x_ratio), Round(416 * $y_ratio), 120, 20, 1, 6) ;Random Click on the resume button
  152. Sleep($loadtime)
  153. $rt = TimerInit()
  154. $run += 1
  155. ElseIf CheckFor("OldRuins", "Area") Or CheckFor("NewTristram", "Area") Or CheckFor("DankCellar", "Area") Then
  156. Call("TownPortal")
  157. Call("LeaveGame")
  158. Return
  159. ElseIf CheckFor("LimitError", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
  160. MouseClick("left", Round(960 * $y_ratio), Round(635 * $x_ratio))
  161. $rand = Random(40000, 80000)
  162. GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand / 1000) & " seconds.")
  163. Sleep($rand)
  164. Send("{SPACE}")
  165. Return
  166. ElseIf CheckFor("Disconnect", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
  167. GUICtrlSetData($lblStatus, "Status: Network Disconnect window up")
  168. MouseClick("left", Round(960 * $x_ratio), Round(632 * $y_ratio))
  169. Sleep(100)
  170. Send("{SPACE}")
  171. Return
  172. Else
  173. GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
  174. Return
  175. EndIf
  176. ;Make sure we are in the right area before beginning run
  177. If CheckFor("OldRuins", "Area") Then
  178. Sleep(200)
  179. GUICtrlSetData($lblLocation, "Location: Old Ruins")
  180. Call("CheckRepair")
  181. ;Start Run
  182. Call ("Check")
  183. If CheckDead() Then
  184. Return
  185. EndIf
  186.  
  187. ;Checks if Dank Cellar is Open
  188. $Pixel2 = PixelSearch(0, 0, Round(600 * $x_ratio), Round(600 * $y_ratio), 0x334FB7, 3)
  189. If Not @error Then
  190. GUICtrlSetData($lblStatus, "Status: Cellar - Found")
  191. $cellarCount += 1
  192. MouseClick("left", Round($xx * $x_ratio), Round($yy * $y_ratio), 1) ;Entrance to cellar
  193. Sleep(800 * $movementSpeed)
  194. Send($skillSmokeScreen)
  195. Moving($walktime)
  196. Else ;ABORT RUN
  197. GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
  198. Sleep(10)
  199. RandClick("middle", Round(1100 * $x_ratio), Round(600 * $y_ratio)) ;moves between caltrops for safety before teleporting back to town
  200. Moving(250)
  201. Send($skillCaltrops)
  202. Sleep(620)
  203. Send($skillSmokeScreen)
  204. Sleep(40)
  205. Call("TownPortal")
  206. If Not CheckDead() Then
  207. Call("LeaveGame")
  208. EndIf
  209. Return
  210. EndIf
  211. Else
  212. Call("TownPortal")
  213. If Not CheckDead() Then
  214. Call("LeaveGame")
  215. EndIf
  216. Return
  217. EndIf
  218.  
  219. ;Checks that the player is in the Dank Cellar
  220. If CheckFor("DankCellar", "Area") Then
  221. GUICtrlSetData($lblLocation, "Location: Dank Cellar")
  222. RandClick("middle", Round(110 * $x_ratio), Round(1000 * $y_ratio), 1, 1) ;moves to doorway leading to rare inside cellar
  223. Sleep(Random(2200, 2800))
  224. RandMove(Round(460 * $x_ratio), Round(80 * $y_ratio), 1, 1) ;hovers over the rare Sarkoth
  225. Sleep(10)
  226. Send("{SHIFTDOWN}")
  227. GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
  228. MouseDown("right") ;ATTACK
  229. Sleep(1100)
  230. Send($skillCompanion)
  231. Sleep($attackTime)
  232. MouseUp("right")
  233. RandClick("left", Round(460 * $x_ratio), Round(80 * $y_ratio), 1, 1)
  234. RandMove(Round(240 * $x_ratio), Round(75 * $y_ratio), 1, 1) ;attack left
  235. Sleep(40)
  236. MouseDown("right")
  237. If $attackMulti == True Then Sleep($attackTime / 2)
  238. MouseUp("right")
  239. MouseMove(Round(590 * $x_ratio), Round(50 * $y_ratio), 1) ;attack right
  240. MouseDown("right")
  241. If $attackMulti == True Then Sleep($attackTime / 2)
  242. MouseUp("right")
  243. MouseDown("left")
  244. MouseMove(Round(Random(240, 260) * $x_ratio), Round(75 * $y_ratio), 1) ;attack left
  245. If $attackMulti == True Then Sleep($attackTime / 2.5)
  246. MouseMove(Round(Random(560, 600) * $x_ratio), Round(50 * $y_ratio), 1) ;attack right
  247. If $attackMulti == True Then Sleep($attackTime / 2.5)
  248. MouseUp("left")
  249. Sleep(400)
  250. MouseClick("right", Round(630 * $x_ratio), Round(18 * $y_ratio), 1, 8) ;break the table & chair
  251. Sleep(200)
  252. Send("{SHIFTUP}")
  253. Moving(200)
  254. RandClick("middle", Round(530 * $x_ratio), Round(190 * $y_ratio)) ;location of sarkoth after death
  255. Moving(2700)
  256. GUICtrlSetData($lblStatus, "Status: Looting")
  257. Send($skillCompanion)
  258. Call("Loot")
  259. RandSleep(0, 6, 30)
  260. Send($skillCompanion)
  261. Call("TownPortal")
  262. Else
  263. Send($skillCaltrops)
  264. Sleep(400)
  265. Send($skillSmokeScreen)
  266. Sleep(40)
  267. Call("TownPortal")
  268. If Not CheckDead() Then
  269. Call("LeaveGame")
  270. EndIf
  271. Return
  272. EndIf
  273. ;After successful run
  274. If Not CheckDead() Then
  275. Sleep(600)
  276. If $mLootIn = 1 And CheckFor("NewTristram", "Area") Then ;If its time to manage loot and we are in town
  277. If $Identify == True Then Call("Identify")
  278. If $StashLoot == True Then
  279. Call("StashLoot")
  280. EndIf
  281. If $VendorLoot == True Then
  282. Call("VendorLoot")
  283. EndIf
  284. $mLootIn = Round(Random($mLoot - $mLootOff, $mLoot + $mLootOff)) ;Reset Counter
  285. ElseIf Not CheckFor("NewTristram", "Area") Then
  286. GUICtrlSetData($lblStatus, "Status: Skipping vendor, not in New Tristram")
  287. Sleep(3000)
  288. ElseIf $mLootIn <= 0 Then
  289. $mLootIn = 1
  290. Else
  291. $mLootIn -= 1
  292. EndIf
  293. If Not CheckDead() Then
  294. Call("LeaveGame")
  295. EndIf
  296. Return
  297. Else
  298. Return
  299. EndIf
  300. EndIf
  301. EndFunc ;==>RestartRun
  302.  
  303. ;Helper Functions
  304.  
  305. Func SetupGUI()
  306. $frmBot = GUICreate($title & $ver & " - Updating", 280, 121, Round(1540 * $x_ratio), Round(920 * $y_ratio), -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
  307. GUISetBkColor(0xC0C0C0)
  308. $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs till vendor: 0", 4, 0, 280, 24)
  309. GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
  310. GUICtrlSetColor(-1, 0xFF0000)
  311. $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 12, 20, 240, 17)
  312. $lblStatus = GUICtrlCreateLabel("Status: ", 12, 35, 240, 17)
  313. $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 12, 50, 240, 17)
  314. $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 65, 240, 17)
  315. $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
  316. $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 12, 95, 240, 17)
  317. GUISetState(@SW_SHOW)
  318. EndFunc ;==>SetupGUI
  319.  
  320. Func Check()
  321. dim $Route = ("Route1")
  322. dim $Route = ("Route2")
  323. dim $Route = ("Route3")
  324.  
  325. dim $Routing
  326. $Routing = Random( 1, 3, 1)
  327. GUICtrlSetData($lblStatus, "Status: Generating Route")
  328. Switch $Routing
  329. Case 1 ; Route1
  330. GUICtrlSetData($lblStatus, "Status: Generating Route1")
  331. Call ("Route1")
  332.  
  333. Case 2 ; Route2
  334. GUICtrlSetData($lblStatus, "Status: Generating Route2")
  335. Call ("Route2")
  336.  
  337. Case 3 ; Route3
  338. GUICtrlSetData($lblStatus, "Status: Generating Route3")
  339. Call ("Route3")
  340.  
  341. EndSwitch
  342. EndFunc ;==>Random
  343.  
  344. Func Route1()
  345. RandClick("middle", Round(500 * $x_ratio), Round(250 * $y_ratio), 2, 2) ;starts the run [waypoint 1]
  346. Moving(1125)
  347. Send($skillSmokeScreen)
  348. Moving(750)
  349. RandClick("middle", Round(3 * $y_ratio), Round(370 * $y_ratio), 2, 2) ;waits ~1 second then [waypoint 2]
  350. Moving(2312)
  351. RandClick("middle", Round(400 * $x_ratio), Round(600 * $y_ratio), 2, 2) ;middle of courtyard [waypoint 3]
  352. Moving(425)
  353. Send($skillSmokeScreen)
  354. Moving(125)
  355. Send($skillPreparation)
  356. Moving(973)
  357. Send($skillCaltrops)
  358. Moving(125)
  359. RandMove(Round(300 * $x_ratio), Round(70 * $y_ratio), 1, 1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  360. Global $xx = 300
  361. Global $yy = 70
  362. EndFunc ;
  363.  
  364. Func Route2()
  365. RandClick("middle", Round(600 * $x_ratio), Round(250 * $y_ratio), 2, 2) ;starts the run [waypoint 1]
  366. Moving(1125)
  367. Send($skillSmokeScreen)
  368. Moving(750)
  369. RandClick("middle", Round(3 * $y_ratio), Round(370 * $y_ratio), 2, 2) ;waits ~1 second then [waypoint 2]
  370. Moving(2312)
  371. RandClick("middle", Round(300 * $x_ratio), Round(600 * $y_ratio), 2, 2) ;middle of courtyard [waypoint 3]
  372. Moving(425)
  373. Send($skillSmokeScreen)
  374. Moving(125)
  375. Send($skillPreparation)
  376. Moving(973)
  377. Send($skillCaltrops)
  378. Moving(125)
  379. RandMove(Round(300 * $x_ratio), Round(70* $y_ratio), 1, 1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  380. Global $xx = 300
  381. Global $yy = 70
  382. EndFunc ;
  383.  
  384. Func Route3()
  385. RandClick("middle", Round(500 * $x_ratio), Round(200 * $y_ratio), 2, 2) ;starts the run [waypoint 1]
  386. Moving(1125)
  387. Send($skillSmokeScreen)
  388. Moving(750)
  389. RandClick("middle", Round(3 * $y_ratio), Round(370 * $y_ratio), 2, 2) ;waits ~1 second then [waypoint 2]
  390. Moving(2212)
  391. RandClick("middle", Round(300 * $x_ratio), Round(650 * $y_ratio), 2, 2) ;middle of courtyard [waypoint 3]
  392. Moving(425)
  393. Send($skillSmokeScreen)
  394. Moving(125)
  395. Send($skillPreparation)
  396. Moving(973)
  397. Send($skillCaltrops)
  398. Moving(125)
  399. RandMove(Round(350 * $x_ratio), Round(75 * $y_ratio), 1, 1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  400. Global $xx = 350
  401. Global $yy = 75
  402.  
  403. EndFunc ;
  404.  
  405. Func CheckDead()
  406. $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
  407. If Not @error Then
  408. GUICtrlSetData($lblStatus, "Status: Logging out")
  409. Sleep(11000)
  410. Sleep($loadtime)
  411. Return 1
  412. EndIf
  413.  
  414. $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
  415. If Not @error Then
  416. GUICtrlSetData($lblStatus, "Status: Open Window")
  417. Sleep(200)
  418. Send("{SPACE}") ;close any open windows
  419. Return 1
  420. EndIf
  421.  
  422. $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"
  423. If Not @error Then
  424. GUICtrlSetData($lblStatus, "Status: Dead")
  425. $deathCount += 1
  426. Call("LeaveGame")
  427. Sleep(11000)
  428. Sleep($loadtime)
  429. Return 1
  430. Else
  431. Return 0
  432. EndIf
  433. EndFunc ;==>CheckDead
  434.  
  435. Func CheckRepair()
  436. $RepairArea = PixelSearch(Round(1480 * $x_ratio), 0, Round(1570 * $x_ratio), Round(100 * $y_ratio), $yellow)
  437. If Not @error Then
  438. Call("DoRepair")
  439. EndIf
  440. $RepairAreaRed = PixelSearch(Round(1480 * $x_ratio), 0, Round(1570 * $x_ratio), Round(100 * $y_ratio), $red)
  441. If Not @error Then
  442. Call("DoRepair")
  443. EndIf
  444. EndFunc ;==>CheckRepair
  445.  
  446. Func DoRepair()
  447. Sleep(Random(75, 150))
  448. Call("TownPortal")
  449. If CheckDead() Then
  450. Return
  451. EndIf
  452. If CheckFor("NewTristram", "Area") Then
  453. RandClick("left", Round(1480 * $x_ratio), Round(281 * $y_ratio), 1, 1) ;begin movement towards merchant
  454. Moving(1875)
  455. RandClick("left", Round(1316 * $x_ratio), Round(206 * $y_ratio), 1, 1) ;moves to get merchant in screen
  456. Moving(1875)
  457. RandClick("left", Round(845 * $x_ratio), Round(225 * $y_ratio), 1, 1) ;NPC Merchant to the right of cain's home
  458. Sleep(1200)
  459. RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  460. Sleep(400)
  461. RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  462. Sleep(200)
  463. Send("{Escape}")
  464. If Not CheckDead() Then
  465. Call("LeaveGame")
  466. EndIf
  467. EndIf
  468. EndFunc ;==>DoRepair
  469.  
  470. Func CalcTime()
  471. $srt = TimerDiff($rt)
  472. GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt / 1000, 2) & " seconds.")
  473. $trt = TimerDiff($t)
  474. $total = Round((($trt / 1000) / 60) / 60, 4)
  475.  
  476. ;Total runtime calculation.
  477. $hours = Floor((($trt / 1000) / 60) / 60)
  478. $minutes = (($trt / 1000) / 60)
  479. ;trim minutes if runtime is more then 1 hour.
  480. If $minutes > 60 Then
  481. While $minutes > 60
  482. $minutes -= 60
  483. WEnd
  484. EndIf
  485. GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, " & Ceiling($minutes) & " minutes")
  486. EndFunc ;==>CalcTime
  487.  
  488. Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 6, $tolerance = 140)
  489. If $type = "Area" Then
  490. $startX = 1500 * $x_ratio
  491. $startY = 0 * $y_ratio
  492. $endX = 1920 * $x_ratio
  493. $endY = 90 * $y_ratio
  494. $seconds = 2.5
  495. EndIf
  496. $c = 0
  497. $string = $pngLoc & $img & ".png"
  498. Do
  499. $c += 1
  500. Sleep(100)
  501. If $c > ($seconds * 10) Then ;Make sure we never get stuck here for infinity.
  502. If $type = "Area" Then
  503. GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
  504. EndIf
  505. Return False
  506. EndIf
  507. Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
  508. Return True
  509. EndFunc ;==>CheckFor
  510.  
  511. Func Loot()
  512. Sleep(Random(500, 1200))
  513. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  514. If $LootSets == True Then
  515. $SetCount += LootGear(0x02CE01)
  516. EndIf
  517. If $LootLegendaries == True Then
  518. $LegendaryCount += LootGear(0xBF642F, 0)
  519. EndIf
  520. If $LootRares == True Then
  521. $RareCount += LootGear(0xBBBB00)
  522. EndIf
  523. If $LootGems == True Then
  524. Call("LootGems")
  525. EndIf
  526. If $LootTomes == True Then
  527. Call("LootTomes")
  528. EndIf
  529. If $LootCustom == True Then
  530. Call("LootCustom")
  531. EndIf
  532. If $LootMagic == True Then
  533. $MagicCount += LootGear(0x6969FF)
  534. EndIf
  535. Call("ShowLoot")
  536. EndFunc ;==>Loot
  537.  
  538. Func LootGear($color, $tolerance = 2)
  539. $count = 0
  540. $Loot = PixelSearch(Round(400 * $x_ratio), 0, Round(1690 * $x_ratio), Round(900 * $y_ratio), $color, $tolerance)
  541. If Not @error Then
  542. While Not @error
  543. $count += 1
  544. MouseClick('left', $Loot[0], $Loot[1], 1, 3)
  545. Sleep(50)
  546. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  547. Sleep(300)
  548. ;Run at max 10 times per quality
  549. If $count >= 10 Then
  550. ExitLoop
  551. EndIf
  552. $Loot = PixelSearch(Round(400 * $x_ratio), 0, Round(1690 * $x_ratio), Round(900 * $y_ratio), $color, $tolerance)
  553. WEnd
  554. EndIf
  555. Return $count
  556. EndFunc ;==>LootGear
  557.  
  558. Func LootCustom()
  559. $count = 0
  560. $gX = 0
  561. $gY = 0
  562. For $i = 0 To ($totalItems - 1)
  563. $array = StringSplit($pick[$i], "|")
  564. $file = $array[1]
  565. $accuracy = $array[2]
  566. $urlString = $pngLoc & $file
  567. While _ImageSearchArea($pngLoc & $file, 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, $accuracy)
  568. $count += 1
  569. MouseClick("left", $gX, $gY, 1, 3)
  570. Sleep(50)
  571. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  572. Sleep(600)
  573. If $count >= 10 Then
  574. ExitLoop
  575. EndIf
  576. WEnd
  577. Next
  578. EndFunc ;==>LootCustom
  579.  
  580. Func LootGems()
  581. $count = 0
  582. $gX = 0
  583. $gY = 0
  584. While _ImageSearchArea($pngLoc & "square.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  585. $count += 1
  586. MouseClick("left", $gX, $gY - 3, 1, 3)
  587. Sleep(50)
  588. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  589. $GemCount += 1
  590. Sleep(473)
  591. If $count >= 10 Then
  592. ExitLoop
  593. EndIf
  594. WEnd
  595. EndFunc ;==>LootGems
  596.  
  597. Func LootTomes()
  598. $count = 0
  599. $gX = 0
  600. $gY = 0
  601. While _ImageSearchArea($pngLoc & "tome.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  602. $count += 1
  603. MouseClick("left", $gX, $gY - 3, 1, 3)
  604. Sleep(50)
  605. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  606. $TomeCount += 1
  607. Sleep(721)
  608. If $count >= 10 Then
  609. ExitLoop
  610. EndIf
  611. WEnd
  612. EndFunc ;==>LootTomes
  613.  
  614. Func Identify()
  615. Send("c")
  616. Sleep(1300)
  617. While _ImageSearchArea($pngLoc & "unidentified.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 120)
  618. GUICtrlSetData($lblStatus, "Status: Identifying")
  619. MouseClick("right", $gX, $gY, 1, 4)
  620. ;MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  621. Sleep(Random(3000, 3500))
  622. WEnd
  623. Send("c")
  624. Sleep(200)
  625. EndFunc ;==>Identify
  626.  
  627. Func StashLoot()
  628. GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  629. MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
  630. Moving(1600)
  631.  
  632. ;Tomes
  633. While $StashTomes == True
  634. Sleep(Random(100, 300))
  635. If _ImageSearchArea($pngLoc & "TomeIcon.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 140) Then
  636. GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
  637. MouseClick("left", 500 * $x_ratio, 360 * $y_ratio, 1, 4)
  638. MouseClick("right", $gX, $gY, 1, 4)
  639. Sleep(80)
  640. MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 4)
  641. Else
  642. ExitLoop
  643. EndIf
  644. WEnd
  645.  
  646. If $StashLegendary == True Then
  647. StashItems(0xFF7F00, 0)
  648. StashItems(0x8F5C25, 1)
  649. EndIf
  650.  
  651. If $StashRare == True Then
  652. StashItems(0x4A3C0B, 1)
  653. EndIf
  654.  
  655. If $StashMagic == True Then
  656. StashItems(0x182037, 1)
  657. EndIf
  658.  
  659.  
  660. ;Gems (DOESN'T STASH BOTTOM ROW!)
  661. If $StashGems == True Then
  662. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  663. MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 4)
  664. Sleep(Random(20, 100))
  665. For $i = 0 To 7
  666. If _ImageSearchArea($pngLoc & $gems[$i], 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 820 * $y_ratio, $gX, $gY, 140) Then
  667. MouseClick("right", $gX, $gY, 1, 3)
  668. EndIf
  669. Next
  670. EndIf
  671. Sleep(Random(1000, 1500))
  672. Send("{SPACE}")
  673. EndFunc ;==>StashLoot
  674.  
  675. Func VendorLoot()
  676. GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  677. If Not $StashLoot == True Then ;Move from TP towards vendor
  678. Sleep(Random(300, 500))
  679. MouseClick("middle", 1565 * $x_ratio, 50 * $y_ratio)
  680. Else ;Move from Stash towards vendor
  681. Sleep(Random(300, 500))
  682. MouseClick("middle", 1560 * $x_ratio, 120 * $y_ratio)
  683. EndIf
  684. Moving(2600)
  685. MouseClick("left", 1030 * $x_ratio, 210 * $y_ratio) ;Talk to vendor
  686. Moving(2600)
  687.  
  688. ;All
  689. If $vendorAll == True Then
  690. For $c = 1 To $vendorCols
  691. For $r = 1 To $vendorRows
  692. RandClick("right", (((($c - 1) * 50) + 32 + 1400) * $x_ratio), (((($r - 1) * 51) + 32 + 580) * $y_ratio), 2, 2, 1, 2.5)
  693. Next
  694. Next
  695. EndIf
  696.  
  697. ;Rares
  698. If $VendorRare == True Then
  699. VendItems(0x4A3C0B, 1)
  700. EndIf
  701.  
  702. ;Magic
  703. If $VendorMagic == True Then
  704. VendItems(0x182037, 1)
  705. EndIf
  706.  
  707. Sleep(200)
  708. RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  709. Sleep(300)
  710. RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  711. Sleep(200)
  712. GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  713. Send("{ESCAPE}")
  714. EndFunc ;==>VendorLoot
  715.  
  716. Func StashItems($color, $tolerance)
  717. $c = 0
  718. While $c <= 20
  719. Sleep(Random(20, 100))
  720. $StashPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
  721. If Not @error Then
  722. MouseClick("right", $StashPixel[0] + 4, $StashPixel[1], 1, 4)
  723. $c += 1
  724. Else
  725. ExitLoop
  726. EndIf
  727. WEnd
  728. EndFunc ;==>StashItems
  729.  
  730. Func VendItems($color, $tolerance)
  731. $c = 0
  732. While $c <= 20
  733. Sleep(Random(20, 100))
  734. $VendPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
  735. If Not @error Then
  736. MouseClick("right", $VendPixel[0], $VendPixel[1], 1, 4)
  737. $c += 1
  738. Else
  739. ExitLoop
  740. EndIf
  741. WEnd
  742. EndFunc ;==>VendItems
  743.  
  744. Func DoUpdate()
  745. $ini = InetGet($VersionsInfo, @ScriptDir & "\version.ini") ;download version.ini
  746. If $ini = 0 Then ;was the download of version.ini successful?
  747. MsgBox(16, "Fatal Error", "The server seems to be offline. No update will be done.")
  748. Else
  749. $newVersion = IniRead(@ScriptDir & "\version.ini", "Version", "Version", "") ;reads the new version out of version.ini
  750. If $newVersion = $oldVersion Then ;compare old and new
  751. ;MsgBox (0,"No update","There is no update available!")
  752. FileDelete(@ScriptDir & "\version.ini")
  753. Else
  754. $msg = MsgBox(68, "Update", "A new version is available: " & $newVersion & "! Current version: " & $oldVersion & @CRLF & "Do you want to download the new version?")
  755. If $msg = 7 Then ;No was pressed
  756. FileDelete(@ScriptDir & "\version.ini")
  757. ElseIf $msg = 6 Then ;OK was pressed
  758. $downloadLink = IniRead(@ScriptDir & "\version.ini", "Version", "download", "NotFound")
  759. $dlhandle = InetGet($downloadLink, @ScriptDir & "\Update_" & $newVersion & ".zip", 1, 1)
  760. ProgressOn("Update", "Downloading Updates", "", -1, -1, 16) ;creates a progressbar
  761.  
  762. $size = InetGetSize($downloadLink, 1) ;get the size of the update
  763. While Not InetGetInfo($dlhandle, 2)
  764. $Percent = Round((InetGetInfo($dlhandle, 0) / $size) * 100)
  765. ProgressSet($Percent, $Percent & "%") ;update progressbar
  766. Sleep(1)
  767. WEnd
  768. ProgressSet(100, "Done", "Complete") ;show complete progressbar
  769. Sleep(500)
  770. ProgressOff() ;close progress window
  771. IniWrite("updater.ini", "version", "version", $newVersion)
  772. InetClose($dlhandle)
  773. $iniMsg = IniRead(@ScriptDir & "\version.ini", "Version", "message", "Exiting...")
  774. MsgBox(64, "Success", "Download Complete!" & @CRLF & "Please restart the bot by extracting the Au3 from Update_" & $newVersion & ".zip" & @CRLF & $iniMsg)
  775. FileDelete(@ScriptDir & "\version.ini")
  776. Exit
  777. EndIf
  778. EndIf
  779. EndIf
  780. WinSetTitle($title, "", $title & $ver & " - Waiting")
  781. EndFunc ;==>DoUpdate
  782. Func ReadINI()
  783. $pngLoc = IniRead($ini, "Custom Loot", "PNG Location", $pngLoc)
  784. $totalItems = IniRead($ini, "Custom Loot", "Total Items", $totalItems)
  785. $skillCaltrops = IniRead($ini, "Skills", "Caltrops", $skillCaltrops)
  786. $skillSmokeScreen = IniRead($ini, "Skills", "SmokeScreen", $skillSmokeScreen)
  787. $skillPreparation = IniRead($ini, "Skills", "Preparation", $skillPreparation)
  788. $skillCompanion = IniRead($ini, "Skills", "Companion", $skillCompanion)
  789. $movementSpeed = IniRead($ini, "Additional", "Movement Speed", $movementSpeed)
  790. $walktime = IniRead($ini, "Additional", "Walk Time", $walktime)
  791. $loadtime = IniRead($ini, "Additional", "Load Time", $loadtime)
  792. $tptime = IniRead($ini, "Additional", "Teleport Time", $tptime)
  793. $LootSets = IniRead($ini, "Looting", "Sets", $LootSets)
  794. $LootLegendaries = IniRead($ini, "Looting", "Legendaries", $LootLegendaries)
  795. $LootRares = IniRead($ini, "Looting", "Rares", $LootRares)
  796. $LootMagic = IniRead($ini, "Looting", "Magic", $LootMagic)
  797. $LootGems = IniRead($ini, "Looting", "Gems", $LootGems)
  798. $LootTomes = IniRead($ini, "Looting", "Tomes", $LootTomes)
  799. $LootCustom = IniRead($ini, "Looting", "Custom", $LootCustom)
  800. $mLoot = IniRead($ini, "ManageLoot", "Every", $mLoot)
  801. $Identify = IniRead($ini, "ManageLoot", "Identify", $Identify)
  802. $StashLoot = IniRead($ini, "Stashing", "Loot", $StashLoot)
  803. $StashLegendary = IniRead($ini, "Stashing", "Legendaries", $StashLegendary)
  804. $StashRare = IniRead($ini, "Stashing", "Rares", $StashRare)
  805. $StashMagic = IniRead($ini, "Stashing", "Magic", $StashMagic)
  806. $StashTomes = IniRead($ini, "Stashing", "Tomes", $StashTomes)
  807. $StashGems = IniRead($ini, "Stashing", "Gems", $StashGems)
  808. $VendorLoot = IniRead($ini, "Vendoring", "Loot", $VendorLoot)
  809. $VendorRare = IniRead($ini, "Vendoring", "Rares", $VendorRare)
  810. $VendorMagic = IniRead($ini, "Vendoring", "Magic", $VendorMagic)
  811. $vendorAll = IniRead($ini, "Vendoring", "All", $vendorAll)
  812. $vendorRows = IniRead($ini, "Vendoring", "All-Rows", $vendorRows)
  813. $vendorCols = IniRead($ini, "Vendoring", "All-Cols", $vendorCols)
  814. $Timer = IniRead($ini, "Variability", "Timer", $Timer)
  815. $mLootOff = IniRead($ini, "Variability", "Manage Off By", $mLootOff)
  816. $attackTime = IniRead($ini, "Variability", "Attack Time", $attackTime)
  817. $attackMulti = IniRead($ini, "Variability", "Attack Multiple", $attackMulti)
  818. EndFunc ;==>ReadINI
  819. Func CreateINI()
  820. IniWrite($ini, "Custom Loot", "PNG Location", $pngLoc)
  821. IniWrite($ini, "Custom Loot", "Total Items", $totalItems)
  822. IniWrite($ini, "Skills", "Caltrops", $skillCaltrops)
  823. IniWrite($ini, "Skills", "SmokeScreen", $skillSmokeScreen)
  824. IniWrite($ini, "Skills", "Preparation", $skillPreparation)
  825. IniWrite($ini, "Skills", "Companion", $skillCompanion)
  826. IniWrite($ini, "Additional", "Movement Speed", $movementSpeed)
  827. IniWrite($ini, "Additional", "Walk Time", $walktime)
  828. IniWrite($ini, "Additional", "Load Time", $loadtime)
  829. IniWrite($ini, "Additional", "Teleport Time", $tptime)
  830. IniWrite($ini, "Looting", "Sets", $LootSets)
  831. IniWrite($ini, "Looting", "Legendaries", $LootLegendaries)
  832. IniWrite($ini, "Looting", "Rares", $LootRares)
  833. IniWrite($ini, "Looting", "Magic", $LootMagic)
  834. IniWrite($ini, "Looting", "Gems", $LootGems)
  835. IniWrite($ini, "Looting", "Tomes", $LootTomes)
  836. IniWrite($ini, "Looting", "Custom", $LootCustom)
  837. IniWrite($ini, "ManageLoot", "Every", $mLoot)
  838. IniWrite($ini, "ManageLoot", "Identify", $Identify)
  839. IniWrite($ini, "Stashing", "Loot", $StashLoot)
  840. IniWrite($ini, "Stashing", "Legendaries", $StashLegendary)
  841. IniWrite($ini, "Stashing", "Rares", $StashRare)
  842. IniWrite($ini, "Stashing", "Magic", $StashMagic)
  843. IniWrite($ini, "Stashing", "Tomes", $StashTomes)
  844. IniWrite($ini, "Stashing", "Gems", $StashGems)
  845. IniWrite($ini, "Vendoring", "Loot", $VendorLoot)
  846. IniWrite($ini, "Vendoring", "Rares", $VendorRare)
  847. IniWrite($ini, "Vendoring", "Magic", $VendorMagic)
  848. IniWrite($ini, "Vendoring", "All", $vendorAll)
  849. IniWrite($ini, "Vendoring", "All-Rows", $vendorRows)
  850. IniWrite($ini, "Vendoring", "All-Cols", $vendorCols)
  851. IniWrite($ini, "Variability", "Timer", $Timer)
  852. IniWrite($ini, "Variability", "Manage Off By", $mLootOff)
  853. IniWrite($ini, "Variability", "Attack Time", $attackTime)
  854. IniWrite($ini, "Variability", "Attack Multiple", $attackMulti)
  855. EndFunc ;==>CreateINI
  856.  
  857. Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
  858. If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
  859. $findImage = "*TRANSBLACK " & $findImage
  860. If @AutoItX64 Then
  861. $result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  862. Else
  863. $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  864. EndIf
  865. If $result = "0" Then
  866. Return 0
  867. EndIf
  868.  
  869. ; Otherwise get the x,y location of the match and the size of the image to
  870. ; compute the centre of search
  871. $array = StringSplit($result[0], "|")
  872. If (UBound($array) >= 4) Then
  873. $x = Int(Number($array[2]))
  874. $y = Int(Number($array[3]))
  875. If $resultPosition = 1 Then
  876. $x = $x + Int(Number($array[4]) / 2)
  877. $y = $y + Int(Number($array[5]) / 2)
  878. EndIf
  879. Return 1
  880. EndIf
  881. EndFunc ;==>_ImageSearchArea
  882.  
  883. Func LeaveGame()
  884. Call("RandSleep")
  885. GUICtrlSetData($lblStatus, "Status: Leaving Game")
  886. Send("{Escape}")
  887. Sleep(200)
  888. RandClick("left", Round(956 * $x_ratio), Round(579 * $y_ratio), 120, 20) ;Random Click on the leave button
  889. Call("CalcTime")
  890. Sleep($loadtime)
  891. EndFunc ;==>LeaveGame
  892.  
  893. Func TownPortal()
  894. GUICtrlSetData($lblStatus, "Status: Returning to Town")
  895. Send("t")
  896. Sleep(Random($tptime, $tptime + 500))
  897. EndFunc ;==>TownPortal
  898.  
  899. Func Moving($time)
  900. Sleep($time / $movementSpeed)
  901. EndFunc ;==>Moving
  902.  
  903. Func RandClick($clickType, $xPos, $yPos, $xOff = 10, $yOff = 10, $clicks = 1, $speed = 4)
  904. If $xOff < 1 Then $xOff = 1
  905. If $yOff < 1 Then $yOff = 1
  906. $randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
  907. $randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
  908. MouseClick($clickType, $randX, $randY, $clicks, $speed)
  909. EndFunc ;==>RandClick
  910.  
  911. Func RandMove($xPos, $yPos, $xOff = 10, $yOff = 10, $speed = 1)
  912. $randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
  913. $randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
  914. MouseMove($randX, $randY, $speed)
  915. EndFunc ;==>RandMove
  916.  
  917. Func RandSleep($min = 5, $max = 45, $chance = 3)
  918. $randNum = Round(Random(1, 100))
  919. If $Timer == True And $randNum <= $chance Then
  920. $sleepTime = Random($min * 1000, $max * 1000)
  921. GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime / 1000) & " secs")
  922.  
  923. For $c = 0 To 10
  924. Sleep($sleepTime / 10)
  925. Next
  926. EndIf
  927. EndFunc ;==>RandSleep
  928.  
  929. ;Hotkey Functions
  930.  
  931. Func Begin()
  932. $Go = Not $Go
  933. If Not $Go Then WinSetTitle($title, "", $title & $ver & " - Halted")
  934. EndFunc ;==>Begin
  935.  
  936. Func TogglePause()
  937. $Paused = Not $Paused
  938. While $Paused
  939. Sleep(100)
  940. WinSetTitle($title, "", $title & $ver & " - Paused")
  941. ToolTip('[PAUSED] - Deaths: ' & $deathCount & ' | Cellars: ' & $cellarCount, 0, 0)
  942. WEnd
  943. WinSetTitle($title, "", $title & $ver & " - Running")
  944. ToolTip("")
  945. EndFunc ;==>TogglePause
  946.  
  947. Func ShowLoot()
  948. GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
  949. GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
  950. EndFunc ;==>ShowLoot
  951.  
  952. Func Stop() ;to allow the script to stop
  953. Exit
  954. EndFunc ;==>Stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement