Guest User

notAres_1.7e_mod

a guest
Jun 15th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.63 KB | None | 0 0
  1. ;notAres' DH DH Gold Script 1.7e - 6/15/2012 - MOVED TO DROPBOX. UPDATES WILL DOWNLOAD THE WHOLE ZIP NOW!
  2. ;NEW BINDS: Right Control starts the bot. Pause key pauses it. 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. ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
  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 <ImageSearch.au3> ;NO LONGER INCLUDED! Function added to script. Duh. :)
  17. #include <GUIConstantsEx.au3>
  18. #include <StaticConstants.au3>
  19. #include <WindowsConstants.au3>
  20. Opt('MouseCoordMode', 2)
  21. Opt('PixelCoordMode', 2)
  22. Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "1.7e", $Paused, $Go = False, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $MagicCount = 0, $GemCount = 0, $TomeCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000
  23. If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
  24. If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16,"ERROR","Why aren't you running the 64-bit AutoIt??? Expect bugs!")
  25. If $size = 0 Then
  26. MsgBox(16,"Error","Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
  27. Exit
  28. EndIf
  29. ;====================================;
  30.  
  31.  
  32. ;============= SETTINGS =============;
  33. HotKeySet("=", "Begin") ;script toggled on/off by pressing =
  34. HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
  35. HotKeySet("x", "Stop") ;script stopped by pressing x
  36.  
  37. ;Change to match your abilities (1-4 by default)z
  38. $skillCaltrops = "1"
  39. $skillSmokeScreen = "2"
  40. $skillPreparation = "3"
  41. $skillCompanion = "4"
  42.  
  43. $movementSpeed = 0 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0%, 50 = 50%
  44.  
  45. ;Custom Loot
  46. $pngLoc = "C:\pics\" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  47. $totalItems = 1 ;Number of items in the pick array
  48. Global $pick[$totalItems] ;DONT CHANGE THIS
  49.  
  50. ;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
  51. $pick[0] = "mythic.png|40" ;png|Tolerance
  52. ;$pick[1] = "item2.png"
  53. ;$pick[2] = "item3.png"
  54.  
  55. ;Looting
  56. $LootSets = True ;True if you want to pick up Sets
  57. $LootLegendaries = True ;True if you want to pick up Legendaries
  58. $LootRares = True ;True if you want to pick up Rares
  59. $LootMagic = True ;True if you want to pick up Magic
  60. $LootGems = True ;True if you want to pick up Gems
  61. $LootTomes = True ;True if you want to pick up Tome of Secrets
  62. $LootCustom = True ;True if you want to pick up Custom Items (The items in the pick array above)
  63.  
  64. ;Manage Loot
  65. $mLoot = 9 ;Nuber of successful runs until Stash and Vendor
  66. $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
  67.  
  68. ;Stashing
  69. $StashLoot = True ;True if you want to store Items in the stash
  70. $StashLegendary = True ;True if you want to store Legendary items in the stash
  71. $StashRare = True ;True if you want to store Rare items in the stash
  72. $StashMagic = False ;True if you want to store Magic items in the stash
  73. $StashTomes = True ;True if you want to store Tomes items in the stash
  74. $StashGems = True ;True if you want to store Gems items in the stash
  75.  
  76. ;Vendoring
  77. $VendorLoot = True ;True if you want to vendor Items
  78. $VendorRare = False ;True if you want to vendor Rares
  79. $VendorMagic = True ;True if you want to vendor Magic
  80.  
  81. ;Variability
  82. $Timer = True ;True and the bot will add random sleep intervals
  83. $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
  84. $loadtime = 3400 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  85. $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
  86. ;====================================;
  87.  
  88. $x_ratio = $size[0] / 1920
  89. $y_ratio = $size[1] / 1080
  90. $mLootIn = $mLoot ;DO NOT CHANGE, how many more runs till next manage
  91. $movementSpeed = 1+($movementSpeed/100)
  92.  
  93. $VersionsInfo = "http://dl.dropbox.com/u/9955791/version.ini"
  94. $oldVersion = IniRead("updater.ini","Version","Version",$ver)
  95. $newVersion = "0.0"
  96.  
  97. #Region ### START Koda GUI section ###
  98. $frmBot = GUICreate("notAres' DH Extension v" & $ver & " - Updating", 280, 121, Round(1540*$x_ratio), Round(920*$y_ratio), -1, BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
  99. GUISetBkColor(0xC0C0C0)
  100. $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs till vendor: 0", 4, 0, 280, 24)
  101. GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
  102. GUICtrlSetColor(-1, 0xFF0000)
  103. $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 12, 20, 240, 17)
  104. $lblStatus = GUICtrlCreateLabel("Status: ", 12, 35, 240, 17)
  105. $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 12, 50, 240, 17)
  106. $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 65, 240, 17)
  107. $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
  108. $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 12, 95, 240, 17)
  109. GUISetState(@SW_SHOW)
  110. #EndRegion ### END Koda GUI section ###
  111.  
  112. Call("DoUpdate")
  113.  
  114. While 1
  115. Call("RestartRun")
  116. WEnd
  117.  
  118. Func RestartRun()
  119. If($Go) Then
  120. $i = 0
  121. ;Checks if the player is in the Main Menu
  122. If Not FileExists($pngLoc & "MainMenu.png") Then
  123. MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
  124. Exit
  125. EndIf
  126. WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Running")
  127. If CheckFor("MainMenu", "", Round(40*$x_ratio), Round(300*$y_ratio), Round(400*$x_ratio), Round(600*$y_ratio), 8, 100) Then
  128. $run += 1
  129. GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs till vendor: " & $mLootIn)
  130. GUICtrlSetData($lblLocation, "Location: Main Menu")
  131. GUICtrlSetData($lblStatus, "Status: Starting Game")
  132. While True
  133. RandClick("left", Round(230*$x_ratio), Round(416*$y_ratio), 120, 20) ;Random Click on the resume button
  134. If CheckFor("LimitError", "", Round(720*$x_ratio), Round(480*$y_ratio), Round(960*$x_ratio), Round(600*$y_ratio), 3, 60) Then
  135. Sleep(Random(1000, 2000))
  136. RandClick("left", Round(960*$y_ratio), Round(635*$x_ratio), 50 ,10)
  137. $rand = Random(40000, 80000)
  138. GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand/1000) & " seconds.")
  139. Sleep($rand)
  140. Else
  141. ExitLoop
  142. EndIf
  143. WEnd
  144. $rt = TimerInit()
  145. ElseIf Call("CheckDead") Then
  146. GUICtrlSetData($lblStatus, "Status: Dead")
  147. Return
  148. ElseIf CheckFor("ExitGame", "", Round(700*$x_ratio), Round(340*$y_ratio), Round(1200*$x_ratio), Round(500*$y_ratio), 3, 60) Then
  149. GUICtrlSetData($lblStatus, "Status: Exit window up")
  150. MouseClick("left", Round(1064*$x_ratio), Round(632*$y_ratio))
  151. Sleep(100)
  152. Send("{SPACE}")
  153. Return
  154. Else
  155. GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
  156. Return
  157. EndIf
  158. If CheckFor("OldRuins", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
  159. GUICtrlSetData($lblLocation, "Location: Old Ruins")
  160. ;Check if player needs to repair
  161. Call("CheckRepair")
  162. ;Start Run
  163. MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  164. Send("{4 DOWN}")
  165. Sleep(2500)
  166. Send("{4 UP}")
  167. Sleep(80)
  168. Send("2")
  169. Sleep(300)
  170. MouseMove(Round(255*$x_ratio),Round(290*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  171. Sleep(300)
  172. If Call("CheckDead") Then
  173. Return
  174. EndIf
  175.  
  176. ;Checks if Dank Cellar is Open
  177. $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3)
  178. If Not @error Then
  179. GUICtrlSetData($lblStatus, "Status: Cellar - Found")
  180. MouseClick("left", Round(255*$x_ratio), Round(290*$y_ratio), 1) ;Entrance to cellar
  181. Moving(550)
  182. Send($skillSmokeScreen)
  183. Moving($walktime)
  184. Else ;ABORT RUN
  185. GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
  186. Sleep(620)
  187. Send("1")
  188. Sleep(620)
  189. Call("TownPortal")
  190. If Not Call("CheckDead") Then
  191. Call("LeaveGame")
  192. EndIf
  193. Return
  194. EndIf
  195. Else
  196. Call("TownPortal")
  197. If Not Call("CheckDead") Then
  198. Call("LeaveGame")
  199. EndIf
  200. Return
  201. EndIf
  202.  
  203. ;Checks that the player is in the Dank Cellar
  204. If CheckFor("DankCellar", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
  205. GUICtrlSetData($lblLocation, "Location: Dank Cellar")
  206. MouseClick("middle",Round(531 *$x_ratio),Round(769 * $y_ratio))
  207. Sleep(1400)
  208. MouseClick("middle",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
  209. Sleep(1500)
  210. MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
  211. Sleep(10)
  212. Send("{SHIFTDOWN}")
  213. MouseClick("left",Round(579 * $x_ratio),Round(209 * $y_ratio),1)
  214. Sleep(550)
  215. Send("3")
  216. Sleep(500)
  217. GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
  218. MouseDown("right") ;attack middle
  219. Sleep(3000)
  220. MouseUP("right")
  221. Sleep(300)
  222. MouseClick("right", Round(630*$x_ratio), Round(18*$y_ratio)) ;break the table & chair
  223. Sleep(Random(50, 150))
  224. Send("{SHIFTUP}")
  225. Sleep(Random(300, 750))
  226. MouseClick("right",694,929) ;cancel archon
  227. RandClick("middle", Round(530*$x_ratio), Round(200*$y_ratio)) ;location of sarkoth after death
  228. Sleep(Random(1700, 2000))
  229. MouseClick("middle",Round(570*$x_ratio),Round(660*$y_ratio)) ;move to left top corner for gold
  230. Sleep(500)
  231. MouseClick("middle",Round(1430*$x_ratio),Round(250*$y_ratio)) ;move to right top corner for gold
  232. Sleep(1400)
  233. MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  234. Sleep(Random(1000, 1300))
  235. GUICtrlSetData($lblStatus, "Status: Looting")
  236. Send("{ALTDOWN}")
  237. Call("Loot")
  238. RandSleep(1, 6, 50)
  239. Send("{ALTUP}")
  240. Call("TownPortal")
  241. Else
  242. Sleep(620)
  243. Call("TownPortal")
  244. If Not Call("CheckDead") Then
  245. Call("LeaveGame")
  246. EndIf
  247. EndIf
  248. ;After successful run
  249. If Not Call("CheckDead") Then
  250. Sleep(600)
  251. If $mLootIn == 1 And CheckFor("NewTristram", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then ;If its time to manage loot and we are in town
  252. Call("Identify")
  253. If $StashLoot Then
  254. Call("StashLoot")
  255. EndIf
  256. If $VendorLoot Then
  257. Call("VendorLoot")
  258. EndIf
  259. $mLootIn = Round(Random($mLoot-$mLootOff, $mLoot+$mLootOff)) ;Reset Counter
  260. ElseIf Not CheckFor("NewTristram", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
  261. GUICtrlSetData($lblStatus, "Status: Skipping vendor")
  262. Sleep(1000)
  263. Else
  264. $mLootIn -= 1
  265. EndIf
  266. If Not Call("CheckDead") Then
  267. Call("LeaveGame")
  268. EndIf
  269. Return
  270. Else
  271. Return
  272. EndIf
  273. EndIf
  274. EndFunc
  275.  
  276. ;Helper Functions
  277. Func CheckDead()
  278. $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
  279. If Not @error Then
  280. GUICtrlSetData($lblStatus, "Status: Logging out")
  281. Sleep(11000)
  282. Sleep($loadtime)
  283. Return 1
  284. EndIf
  285.  
  286. $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"
  287. If Not @error Then
  288. GUICtrlSetData($lblStatus, "Status: Dead")
  289. Call("LeaveGame")
  290. Sleep(11000)
  291. Return 1
  292. Else
  293. Return 0
  294. EndIf
  295. EndFunc
  296.  
  297. Func CheckRepair()
  298. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  299. If Not @error Then
  300. Call("DoRepair")
  301. EndIf
  302. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  303. If Not @error Then
  304. Call("DoRepair")
  305. EndIf
  306. EndFunc
  307.  
  308. Func DoRepair()
  309. Sleep(Random(75, 150))
  310. Call("TownPortal")
  311. If Call("CheckDead") Then
  312. Return
  313. EndIf
  314. If CheckFor("NewTristram", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
  315. RandClick("left", Round(1480*$x_ratio),Round(281*$y_ratio),1,1) ;begin movement towards merchant
  316. Moving(1875)
  317. RandClick("left", Round(1316*$x_ratio),Round(206*$y_ratio),1,1) ;moves to get merchant in screen
  318. Moving(1875)
  319. RandClick("left", Round(845*$x_ratio),Round(225*$y_ratio),1,1) ;NPC Merchant to the right of cain's home
  320. Sleep(1200)
  321. RandClick("left", Round(521*$x_ratio),Round(506*$y_ratio),1,1) ;button to open up repair menu
  322. Sleep(400)
  323. RandClick("left", Round(260*$x_ratio),Round(595*$y_ratio),1,1) ;button to pay for repairs
  324. Sleep(200)
  325. Send("{Escape}")
  326. If Not Call("CheckDead") Then
  327. Call("LeaveGame")
  328. EndIf
  329. EndIf
  330. EndFunc
  331.  
  332. Func CalcTime()
  333. $srt = TimerDiff($rt)
  334. GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt/1000,2) & " seconds.")
  335. $trt = TimerDiff($t)
  336. $total = Round((($trt/1000)/60)/60,4)
  337.  
  338. ;Total runtiume calculation.
  339. $hours = Floor((($trt/1000)/60)/60)
  340. $minutes = (($trt/1000)/60)
  341. ;trim minutes if runtime is more then 1 hour.
  342. If $minutes > 60 Then
  343. While $minutes > 60
  344. $minutes -=60
  345. WEnd
  346. EndIf
  347. GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, "& Ceiling($minutes) &" minutes")
  348. EndFunc
  349.  
  350. Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 5 ,$tolerance = 130)
  351. $c = 0
  352. $string = $pngLoc & $img & ".png"
  353. Do
  354. $c +=1
  355. Sleep(100)
  356. If $c > ($seconds*10) Then ;Make sure we never get stuck here for infinity.
  357. If $type = "Area" Then
  358. GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
  359. EndIf
  360. Return False
  361. EndIf
  362. Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
  363. Return True
  364. EndFunc
  365.  
  366. Func LeaveGame()
  367. Call("RandSleep")
  368. GUICtrlSetData($lblStatus, "Status: Leaving Game")
  369. Sleep(Random(100, 500))
  370. Send("{Escape}")
  371. Sleep(Random(100, 500))
  372. RandClick("left", Round(956*$x_ratio), Round(579*$y_ratio), 120, 20) ;Random Click on the leave button
  373. Call("CalcTime")
  374. EndFunc
  375.  
  376. Func Loot()
  377. Sleep(Random(500,2000))
  378. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  379. If $LootSets Then
  380. $SetCount += LootGear(0x02CE01, 2)
  381. EndIf
  382. If $LootLegendaries Then
  383. $LegendaryCount += LootGear(0xBF642F, 0)
  384. EndIf
  385. If $LootRares Then
  386. $RareCount += LootGear(0xBBBB00, 2)
  387. EndIf
  388. If $LootGems Then
  389. Call("LootGems")
  390. EndIf
  391. If $LootTomes Then
  392. Call("LootTomes")
  393. EndIf
  394. If $LootCustom Then
  395. Call("LootCustom")
  396. EndIf
  397. If $LootMagic Then
  398. $MagicCount += LootGear(0x6969FF, 2)
  399. EndIf
  400. Call("ShowLoot")
  401. EndFunc
  402.  
  403. Func LootGear($color, $tolerance = 2)
  404. $count = 0
  405. $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
  406. If Not @error Then
  407. While Not @error
  408. $count += 1
  409. MouseClick ('left', $Loot[0], $Loot[1])
  410. Sleep(Random(800,1200))
  411. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  412. ;Run at max 10 times per quality
  413. If $count >= 10 Then
  414. ExitLoop
  415. EndIf
  416. $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
  417. WEnd
  418. EndIf
  419. Return $count
  420. EndFunc
  421.  
  422. Func LootCustom()
  423. $count = 0
  424. $gX = 0
  425. $gY = 0
  426. for $i = 0 to ($totalItems - 1)
  427. $array = StringSplit($pick[$i],"|")
  428. $file = $array[1]
  429. $accuracy = $array[2]
  430. $urlString = $pngLoc & $file
  431. While _ImageSearchArea($pngLoc & $file,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$accuracy)
  432. $count += 1
  433. Sleep(Random(75, 150))
  434. MouseClick("left",$gX,$gY,1,1)
  435. Sleep(Random(800, 1200))
  436. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  437. If $count >= 10 Then
  438. ExitLoop
  439. EndIf
  440. WEnd
  441. next
  442. EndFunc
  443.  
  444. Func LootGems()
  445. $count = 0
  446. $gX = 0
  447. $gY = 0
  448. While _ImageSearchArea($pngLoc & "square.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  449. $count += 1
  450. Sleep(Random(75, 150))
  451. MouseClick("left",$gX,$gY)
  452. $GemCount += 1
  453. Sleep(Random(800, 1200))
  454. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  455. If $count >= 10 Then
  456. ExitLoop
  457. EndIf
  458. WEnd
  459. EndFunc
  460.  
  461. Func LootTomes()
  462. $count = 0
  463. $gX = 0
  464. $gY = 0
  465. While _ImageSearchArea($pngLoc & "tome.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  466. $count += 1
  467. Sleep(Random(75, 150))
  468. MouseClick("left",$gX,$gY)
  469. $GemCount += 1
  470. Sleep(Random(800, 1200))
  471. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  472. If $count >= 10 Then
  473. ExitLoop
  474. EndIf
  475. WEnd
  476. EndFunc
  477.  
  478. Func Moving($time)
  479. Sleep($time/$movementSpeed)
  480. EndFunc
  481.  
  482. Func RandClick($clickType, $xPos, $yPos, $xOff = 20, $yOff = 20)
  483. $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
  484. $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
  485. MouseClick($clickType, $randX, $randY)
  486. EndFunc
  487.  
  488. Func RandMove($xPos, $yPos, $xOff = 20, $yOff = 20)
  489. $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
  490. $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
  491. MouseMove($randX, $randY)
  492. EndFunc
  493.  
  494. Func RandSleep($min = 30, $max = 45, $chance = 5)
  495. $randNum = Round(Random(1, 100))
  496. If $Timer And $randNum <= $chance Then
  497. $sleepTime = Random($min*1000, $max*1000)
  498. GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime/1000) & " secs")
  499.  
  500. For $c = 0 To 10
  501. Sleep($sleepTime/10)
  502. Next
  503. EndIf
  504. EndFunc
  505.  
  506. Func TownPortal()
  507. GUICtrlSetData($lblStatus, "Status: Returning to Town")
  508. Send("t")
  509. Sleep(Random($tptime, $tptime+500))
  510. EndFunc
  511.  
  512. Func Identify()
  513. Send("c")
  514. Sleep(1300)
  515. While _ImageSearchArea($pngLoc & "unidentified.png", 1, 1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, $gX, $gY, 180)
  516. GUICtrlSetData($lblStatus, "Status: Identifying")
  517. Sleep(Random(200, 300))
  518. MouseClick("right",$gX,$gY, 1)
  519. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  520. Sleep(Random(3000, 3500))
  521. WEnd
  522. Send("c")
  523. Sleep(600)
  524. EndFunc
  525.  
  526. Func StashLoot()
  527. GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  528. Sleep(Random(1000, 1500))
  529. MouseClick("left", 1064*$x_ratio, 256*$y_ratio)
  530. Sleep(Random(1500, 2000))
  531.  
  532. ;Legendaries
  533. While $StashLegendary
  534. Sleep(Random(200, 300))
  535. $LegendPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4D2C0D, 0)
  536. If Not @error Then
  537. GUICtrlSetData($lblStatus, "Status: Stashing Legendaries")
  538. MouseClick("right", $LegendPixel[0], $LegendPixel[1])
  539. Else
  540. ExitLoop
  541. EndIf
  542. WEnd
  543.  
  544. ;Rares
  545. While $StashRare
  546. Sleep(Random(200, 300))
  547. $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x544A11, 1)
  548. If Not @error Then
  549. GUICtrlSetData($lblStatus, "Status: Stashing Rares")
  550. MouseClick("right", $RarePixel[0], $RarePixel[1])
  551. Else
  552. ExitLoop
  553. EndIf
  554. WEnd
  555.  
  556. ;Tomes
  557. If _ImageSearchArea($pngLoc & "TomeIcon.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  558. GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
  559. MouseClick("left",500*$x_ratio,360*$y_ratio,1,1)
  560. Sleep(Random(500, 750))
  561. MouseClick("right",$gX,$gY,1,1)
  562. Sleep(Random(400, 600))
  563. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  564. Sleep(Random(200, 500))
  565. EndIf
  566.  
  567. ;Magic
  568. While $StashMagic
  569. Sleep(Random(100, 300))
  570. $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
  571. If Not @error Then
  572. GUICtrlSetData($lblStatus, "Status: Stashing Magic")
  573. MouseClick("right", $MagicPixel[0], $MagicPixel[1])
  574. Else
  575. ExitLoop
  576. EndIf
  577. WEnd
  578.  
  579. ;Gems
  580. If $StashGems Then
  581. If _ImageSearchArea($pngLoc & "Ru1.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  582. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  583. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  584. Sleep(Random(200, 500))
  585. MouseClick("right",$gX,$gY,1,1)
  586. Sleep(Random(400, 600))
  587. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  588. Sleep(Random(200, 500))
  589. EndIf
  590. If _ImageSearchArea($pngLoc & "Ru2.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  591. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  592. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  593. Sleep(Random(200, 500))
  594. MouseClick("right",$gX,$gY,1,1)
  595. Sleep(Random(400, 600))
  596. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  597. Sleep(Random(200, 500))
  598. EndIf
  599. If _ImageSearchArea($pngLoc & "Em1.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  600. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  601. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  602. Sleep(Random(200, 500))
  603. MouseClick("right",$gX,$gY,1,1)
  604. Sleep(Random(400, 600))
  605. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  606. Sleep(Random(200, 500))
  607. EndIf
  608. If _ImageSearchArea($pngLoc & "Em2.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  609. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  610. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  611. Sleep(Random(200, 500))
  612. MouseClick("right",$gX,$gY,1,1)
  613. Sleep(Random(400, 600))
  614. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  615. Sleep(Random(200, 500))
  616. EndIf
  617. If _ImageSearchArea($pngLoc & "To1.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  618. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  619. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  620. Sleep(Random(200, 500))
  621. MouseClick("right",$gX,$gY,1,1)
  622. Sleep(Random(400, 600))
  623. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  624. Sleep(Random(200, 500))
  625. EndIf
  626. If _ImageSearchArea($pngLoc & "To2.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  627. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  628. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  629. Sleep(Random(200, 500))
  630. MouseClick("right",$gX,$gY,1,1)
  631. Sleep(Random(400, 600))
  632. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  633. Sleep(Random(200, 500))
  634. EndIf
  635. If _ImageSearchArea($pngLoc & "Am1.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  636. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  637. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  638. Sleep(Random(200, 500))
  639. MouseClick("right",$gX,$gY,1,1)
  640. Sleep(Random(400, 600))
  641. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  642. Sleep(Random(200, 500))
  643. EndIf
  644. If _ImageSearchArea($pngLoc & "Am2.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  645. GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  646. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  647. Sleep(Random(200, 500))
  648. MouseClick("right",$gX,$gY,1,1)
  649. Sleep(Random(400, 600))
  650. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  651. Sleep(Random(200, 500))
  652. EndIf
  653. EndIf
  654. Sleep(Random(1000, 3000))
  655. Send("{SPACE}")
  656. EndFunc
  657.  
  658. Func VendorLoot()
  659. GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  660. If Not $StashLoot Then ;Move from TP towards vendor
  661. Sleep(Random(300, 500))
  662. MouseClick("middle", 1565*$x_ratio, 50*$y_ratio)
  663. Else ;Move from Stash towards vendor
  664. Sleep(Random(300, 500))
  665. MouseClick("middle", 1560*$x_ratio, 120*$y_ratio)
  666. EndIf
  667. Sleep(3000)
  668. MouseClick("left", 1030*$x_ratio, 210*$y_ratio) ;Talk to vendor
  669. Sleep(3000)
  670.  
  671. ;Rares
  672. If $VendorRare Then
  673. $c = 0
  674. While $c <= 10
  675. Sleep(Random(200, 300))
  676. $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x9A8F30, 1)
  677. If Not @error Then
  678. MouseClick("right", $RarePixel[0], $RarePixel[1])
  679. $c += 1
  680. Else
  681. ExitLoop
  682. EndIf
  683. WEnd
  684. EndIf
  685.  
  686. ;Magic
  687. If $VendorMagic Then
  688. $c = 0
  689. While $c <= 25
  690. Sleep(Random(200, 300))
  691. $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
  692. If Not @error Then
  693. MouseClick("right", $MagicPixel[0], $MagicPixel[1])
  694. $c += 1
  695. Else
  696. ExitLoop
  697. EndIf
  698. WEnd
  699. EndIf
  700.  
  701. Sleep(200)
  702. RandClick("left", Round(521*$x_ratio),Round(506*$y_ratio),1,1) ;button to open up repair menu
  703. Sleep(300)
  704. RandClick("left", Round(260*$x_ratio),Round(595*$y_ratio),1,1) ;button to pay for repairs
  705. Sleep(200)
  706. Sleep(Random(1000, 3000))
  707. GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  708. Send("{ESCAPE}")
  709. EndFunc
  710.  
  711.  
  712. Func DoUpdate()
  713. $Ini = InetGet($VersionsInfo,@ScriptDir & "\version.ini") ;download version.ini
  714. If $Ini = 0 Then ;was the download of version.ini successful?
  715. MsgBox(16,"Fatal Error","The server seems to be offline. No update will be done.")
  716. Else
  717. $newVersion = IniRead (@ScriptDir & "\version.ini","Version","Version","") ;reads the new version out of version.ini
  718. If $NewVersion = $oldVersion Then ;compare old and new
  719. ;MsgBox (0,"No update","There is no update available!")
  720. FileDelete(@ScriptDir & "\version.ini")
  721. Else
  722. $msg = MsgBox (68,"Update","A new version is available: " & $newVersion & "! Current version: " & $oldVersion & @CRLF & "Do you want to download the new version?")
  723. If $msg = 7 Then ;No was pressed
  724. FileDelete(@ScriptDir & "\version.ini")
  725. ElseIf $msg = 6 Then ;OK was pressed
  726. $downloadLink = IniRead(@ScriptDir & "\version.ini","Version","download","NotFound")
  727. $dlhandle = InetGet($downloadLink,@ScriptDir & "\Update_" & $newVersion & ".zip",1,1)
  728. ProgressOn("Update", "Downloading Updates", "",-1,-1,16) ;creates a progressbar
  729.  
  730. $Size = InetGetSize($downloadLink,1) ;get the size of the update
  731. While Not InetGetInfo($dlhandle, 2)
  732. $Percent = Round((InetGetInfo($dlhandle,0)/$Size)*100)
  733. ProgressSet( $Percent, $Percent & "%") ;update progressbar
  734. Sleep(1)
  735. WEnd
  736. ProgressSet(100 , "Done", "Complete") ;show complete progressbar
  737. sleep(500)
  738. ProgressOff() ;close progress window
  739. IniWrite("updater.ini","version","version",$NewVersion)
  740. InetClose($dlhandle)
  741. $iniMsg = IniRead(@ScriptDir & "\version.ini","Version","message","Exiting...")
  742. MsgBox(64,"Success","Download Complete!" & @CRLF & "Please restart the bot by extracting the Au3 from Update_" & $newVersion & ".zip" & @CRLF & $iniMsg)
  743. FileDelete(@ScriptDir & "\version.ini")
  744. Exit
  745. EndIf
  746. EndIf
  747. EndIf
  748. WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Waiting")
  749. EndFunc
  750.  
  751. Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
  752. If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
  753. $findImage = "*TRANSBLACK " & $findImage
  754. If @AutoItX64 Then
  755. $result = DllCall("ImageSearchDLL_x64.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
  756. Else
  757. $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
  758. EndIf
  759. If $result = "0" Then
  760. Return 0
  761. EndIf
  762.  
  763. ; Otherwise get the x,y location of the match and the size of the image to
  764. ; compute the centre of search
  765. $array = StringSplit($result[0],"|")
  766. If(UBound($array) >= 4) Then
  767. $x=Int(Number($array[2]))
  768. $y=Int(Number($array[3]))
  769. If $resultPosition = 1 Then
  770. $x=$x + Int(Number($array[4])/2)
  771. $y=$y + Int(Number($array[5])/2)
  772. EndIf
  773. Return 1
  774. EndIf
  775. EndFunc
  776.  
  777. ;Hotkey Functions
  778.  
  779. Func Begin()
  780. $Go = Not $Go
  781. If Not $Go Then WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Halted")
  782. EndFunc
  783.  
  784. Func TogglePause()
  785. $Paused = Not $Paused
  786. While $Paused
  787. Sleep(100)
  788. WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Paused")
  789. ToolTip('Script is "Paused"', 0, 0)
  790. WEnd
  791. WinSetTitle("notAres", "", "notAres' DH Extension v" & $ver & " - Running")
  792. ToolTip("")
  793. EndFunc
  794.  
  795. Func ShowLoot()
  796. GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
  797. GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
  798. EndFunc
  799.  
  800. Func Stop() ;to allow the script to stop
  801. Exit
  802. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment