Advertisement
darkjoy

notAres 1.5d Modified for Wormhole Wizard Archon

Jun 14th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.25 KB | None | 0 0
  1. ;notAres' Sarkoth DH Gold Script 1.5d - 6/13/2012 - Added a GUI. Added autoupdate. Incorporated almost all of Shimizoki's changes
  2. ;YOU MUST START THE BOT AT THE RESUME GAME SCREEN NOW!
  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. #include <ImageSearch.au3> ;comment this if you are not using the new looting system
  15. #include <GUIConstantsEx.au3>
  16. #include <StaticConstants.au3>
  17. #include <WindowsConstants.au3>
  18. Opt('MouseCoordMode', 2)
  19. Opt('PixelCoordMode', 2)
  20. Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $Paused, $go = True, $Leave = False, $Dead = False, $Logout = 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
  21. If $size = 0 Then
  22. MsgBox(16,"Error","Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
  23. Exit
  24. ElseIf ($size[0]/$size[1]) <> 16/9 Then
  25. $size[1]-=30 ;adjusts ratio for titlebar if not 16:9
  26. EndIf
  27.  
  28. ;============= SETTINGS =============;
  29.  
  30. ;Change to match your abilities (1-4 by default)z
  31. $skillCaltrops = "1"
  32. $skillSmokeScreen = "2"
  33. $skillPreparation = "3"
  34. $skillCompanion = "4"
  35.  
  36. $movementSpeed = 0 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0%, 50 = 50%
  37.  
  38. ;Custom Loot
  39. $pngLoc = "C:\pics\" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  40. $totalItems = 1 ;Number of items in the pick array
  41. Global $pick[$totalItems] ;DONT CHANGE THIS
  42.  
  43. ;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
  44. $pick[0] = "mythic.png|40" ;png|Tolerance
  45. ;$pick[1] = "item2.png"
  46. ;$pick[2] = "item3.png"
  47.  
  48. ;Looting
  49. $LootSets = True ;True if you want to pick up Sets
  50. $LootLegendaries = True ;True if you want to pick up Legendaries
  51. $LootRares = True ;True if you want to pick up Rares
  52. $LootMagic = True ;True if you want to pick up Magic
  53. $LootGems = True ;True if you want to pick up Gems
  54. $LootTomes = True ;True if you want to pick up Tome of Secrets
  55. $LootCustom = True ;True if you want to pick up Custom Items (The items in the pick array above)
  56.  
  57. ;Manage Loot
  58. $mLoot = 6 ;Nuber of successful runs until Stash and Vendor
  59. $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
  60.  
  61. ;Stashing
  62. $StashLoot = True ;True if you want to store Items in the stash
  63. $StashLegendary = False ;True if you want to store Legendary items in the stash
  64. $StashRare = False ;True if you want to store Rare items in the stash
  65. $StashMagic = False ;True if you want to store Magic items in the stash
  66. $StashTomes = True ;True if you want to store Tomes items in the stash
  67.  
  68. ;Vendoring
  69. $VendorLoot = True ;True if you want to vendor Items
  70. $VendorRare = False ;True if you want to vendor Rares
  71. $VendorMagic = True ;True if you want to vendor Magic
  72.  
  73. ;Variability
  74. $Timer = True ;True and the bot will add random sleep intervals
  75. $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
  76. $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  77. $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
  78. ;====================================;
  79.  
  80. $x_ratio = $size[0] / 1920
  81. $y_ratio = $size[1] / 1080
  82. $mLootIn = $mLoot ;DO NOT CHANGE, how many more runs till next manage
  83. $movementSpeed = 1+($movementSpeed/100)
  84.  
  85. $VersionsInfo = "http://pastebin.com/raw.php?i=L8hHSZJi"
  86. $oldVersion = IniRead("updater.ini","Version","Version","1.5d")
  87. $newVersion = "0.0"
  88. Call("DoUpdate")
  89. HotKeySet("=","Leave") ;script started by pressing =
  90. HotKeySet("-", "Pause") ;script paused by pressing -
  91. HotKeySet("x", "Stop") ;script stopped by pressing x
  92. HotKeySet("z", "ShowLoot") ;script stopped by pressing z
  93.  
  94. #Region ### START Koda GUI section ###
  95. $frmBot = GUICreate("notAres' Sarkoth Extension", 280, 121, Round(1540*$x_ratio), Round(920*$y_ratio), -1, BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
  96. GUISetBkColor(0xC0C0C0)
  97. $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs till vendor: 0", 4, 0, 280, 24)
  98. GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
  99. GUICtrlSetColor(-1, 0xFF0000)
  100. $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 12, 20, 240, 17)
  101. $lblStatus = GUICtrlCreateLabel("Status: Starting Game", 12, 35, 240, 17)
  102. $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 12, 50, 240, 17)
  103. $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 65, 240, 17)
  104. $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
  105. $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 12, 95, 240, 17)
  106. GUISetState(@SW_SHOW)
  107. #EndRegion ### END Koda GUI section ###
  108.  
  109. While $go
  110. Call("RestartRun")
  111. $nMsg = GUIGetMsg()
  112. Switch $nMsg
  113. Case $GUI_EVENT_CLOSE
  114. Exit
  115. EndSwitch
  116. WEnd
  117.  
  118. Func RestartRun()
  119. If Not FileExists($pngLoc & "MainMenu.png") Then
  120. MsgBox(16, "Fatal Error", "ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
  121. Exit
  122. EndIf
  123. If($Leave) Then
  124. Send("{SPACE}")
  125. Sleep(100)
  126. Send("{SPACE}")
  127. $i = 0
  128. ;Checks if the player is in the Main Menu
  129. If CheckFor("MainMenu","",Round(34*$x_ratio),Round(354*$y_ratio),Round(413*$x_ratio),Round(458*$y_ratio)) Then
  130. $run += 1
  131. GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs till vendor: " & $mLootIn)
  132. GUICtrlSetData($lblLocation, "Location: Main Menu")
  133. GUICtrlSetData($lblStatus, "Status: Starting Game")
  134. While True
  135. RandClick("left", Round(230*$x_ratio), Round(416*$y_ratio), 120, 20) ;Random Click on the resume button
  136. If CheckFor("LimitError", "", Round(720*$x_ratio), Round(480*$y_ratio), Round(960*$x_ratio), Round(600*$y_ratio), 3, 60) Then
  137. Sleep(Random(1000, 2000))
  138. RandClick("left", Round(960*$y_ratio), Round(635*$x_ratio), 50 ,10)
  139. $rand = Random(40000, 80000)
  140. GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand/1000) & " seconds.")
  141. Sleep($rand)
  142. Else
  143. ExitLoop
  144. EndIf
  145. WEnd
  146. $rt = TimerInit()
  147. $Logout = False
  148. Else
  149. GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
  150. Send("{ESC}")
  151. Sleep(100)
  152. Return
  153. EndIf
  154. If CheckFor("OldRuins", "Area", 1560*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 60*$y_ratio) Then
  155. GUICtrlSetData($lblLocation, "Location: Old Ruins")
  156. ;Check if player needs to repair
  157. Call("CheckRepair")
  158. ;Start Run
  159. MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  160. Send("{4 DOWN}")
  161. Sleep(2500)
  162. Send("{4 UP}")
  163. Sleep(80)
  164. ;Send("4")
  165. ;Sleep(140)
  166. ;Send("4")
  167. ;Sleep(80)
  168. ;Send("4")
  169. ;Sleep(80)
  170. ;Send("4")
  171. ;Sleep(80)
  172. ;Send("4")
  173. ;Sleep(80)
  174. ;Send("4")
  175. ;Sleep(80)
  176. Send("2")
  177. Sleep(500)
  178. ;MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  179. MouseMove(Round(255*$x_ratio),Round(290*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  180. Sleep(500)
  181. Call("CheckDead")
  182. If $Dead or $Logout Then
  183. Return
  184. EndIf
  185.  
  186. ;Checks if Dank Cellar is Open
  187. $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3)
  188. If Not @error Then
  189. GUICtrlSetData($lblStatus, "Status: Cellar - Found")
  190. MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
  191. Sleep(400)
  192. Send("2")
  193. Sleep($walktime)
  194. Else ;ABORT RUN
  195. GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
  196. Sleep(10)
  197. ;RandClick("middle", Round(1100*$x_ratio), Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  198. ;Moving(250)
  199. ;Send($skillCaltrops)
  200. ;Sleep(620)
  201. ;Send($skillSmokeScreen)
  202. ;Sleep(40)
  203. Call("TownPortal")
  204. Call("LeaveGame")
  205. Return
  206. EndIf
  207. Else
  208. Call("TownPortal")
  209. Call("LeaveGame")
  210. Return
  211. EndIf
  212.  
  213. ;Checks that the player is in the Dank Cellar
  214. If CheckFor("DankCellar", "Area", 1560*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 60*$y_ratio) Then
  215. GUICtrlSetData($lblLocation, "Location: Dank Cellar")
  216. MouseClick("middle",Round(531 *$x_ratio),Round(769 * $y_ratio))
  217. Sleep(1400)
  218. MouseClick("middle",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
  219. Sleep(1500)
  220. MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
  221. Sleep(550)
  222. Send("1")
  223. Sleep(50)
  224. Send("3")
  225. Sleep(500)
  226. Send("{SHIFTDOWN}")
  227. GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
  228. MouseDown("right") ;attack middle
  229. Sleep(8000)
  230. MouseMove(Round(467 * $x_ratio),Round(269 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
  231. Sleep(2000)
  232. MouseMove(Round(682 * $x_ratio),Round(147 * $y_ratio),1) ;attack right
  233. Sleep(2000)
  234. MouseUP("right")
  235. Sleep(300)
  236. MouseClick("right", Round(630*$x_ratio), Round(18*$y_ratio)) ;break the table & chair
  237. Sleep(Random(50, 150))
  238. Send("{SHIFTUP}")
  239. Sleep(Random(300, 750))
  240. RandClick("middle", Round(530*$x_ratio), Round(190*$y_ratio)) ;location of sarkoth after death
  241. Sleep(Random(1700, 2000))
  242. GUICtrlSetData($lblStatus, "Status: Looting")
  243. Send("{ALTDOWN}")
  244. Call("Loot")
  245. RandSleep(1, 6, 50)
  246. Send("{ALTUP}")
  247. Call("TownPortal")
  248. Else
  249. ;Send($skillCaltrops)
  250. Sleep(620)
  251. ;Send($skillSmokeScreen)
  252. Sleep(40)
  253. Call("TownPortal")
  254. Call("LeaveGame")
  255. EndIf
  256. ;After successful run
  257. If Not $Logout And Not $Dead Then
  258. If $mLootIn == 1 Then ;If its time to manage loot
  259. If $StashLoot Then
  260. Call("StashLoot")
  261. EndIf
  262. If $VendorLoot Then
  263. Call("VendorLoot")
  264. EndIf
  265. $mLootIn = Round(Random($mLoot-$mLootOff, $mLoot+$mLootOff)) ;Reset Counter
  266. Else
  267. $mLootIn -= 1
  268. EndIf
  269. Call("LeaveGame")
  270. Return
  271. Else
  272. Return
  273. EndIf
  274. EndIf
  275. EndFunc
  276.  
  277. ;Helper Functions
  278. Func CheckDead()
  279. $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"
  280. If Not @error Then
  281. GUICtrlSetData($lblStatus, "Status: Dead")
  282. $Dead = True
  283. Call("LeaveGame")
  284. Sleep(11000)
  285. Else
  286. $Dead = False
  287. EndIf
  288.  
  289. $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
  290. If Not @error Then
  291. Sleep(11000)
  292. Sleep($loadtime)
  293. EndIf
  294. EndFunc
  295.  
  296. Func CheckRepair()
  297. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  298. If Not @error Then
  299. Call("DoRepair")
  300. EndIf
  301. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  302. If Not @error Then
  303. Call("DoRepair")
  304. EndIf
  305. EndFunc
  306.  
  307. Func DoRepair()
  308. Sleep(Random(75, 150))
  309. Call("TownPortal")
  310. If $Dead Then
  311. Return
  312. EndIf
  313. If CheckFor("NewTristram", "Area") Then
  314. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  315. Moving(1875)
  316. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  317. Moving(1875)
  318. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  319. Sleep(1200)
  320. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  321. Sleep(400)
  322. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  323. Sleep(200)
  324. Send("{Escape}")
  325. Call("LeaveGame")
  326. EndIf
  327. EndFunc
  328.  
  329. Func CalcTime()
  330. $srt = TimerDiff($rt)
  331. GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt/1000,2) & " seconds.")
  332. $trt = TimerDiff($t)
  333. $total = Round((($trt/1000)/60)/60,4)
  334.  
  335. ;Total runtiume calculation.
  336. $hours = Floor((($trt/1000)/60)/60)
  337. $minutes = (($trt/1000)/60)
  338. ;trim minutes if runtime is more then 1 hour.
  339. If $minutes > 60 Then
  340. While $minutes > 60
  341. $minutes -=60
  342. WEnd
  343. EndIf
  344. GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, "& Ceiling($minutes) &" minutes")
  345. EndFunc
  346.  
  347. Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 5 ,$tolerance = 130)
  348. $c = 0
  349. $string = $pngLoc & $img & ".png"
  350. Do
  351. $c +=1
  352. Sleep(100)
  353. If $c > ($seconds*10) Then ;Make sure we never get stuck here for infinity.
  354. If $type = "Area" Then
  355. GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
  356. EndIf
  357. Return False
  358. EndIf
  359. Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
  360. Return True
  361. EndFunc
  362.  
  363. Func LeaveGame()
  364. $Logout = true
  365. Call("RandSleep")
  366. GUICtrlSetData($lblStatus, "Status: Leaving Game")
  367. Sleep(Random(100, 500))
  368. Send("{Escape}")
  369. Sleep(Random(100, 500))
  370. RandClick("left", Round(956*$x_ratio), Round(579*$y_ratio), 120, 20) ;Random Click on the leave button
  371. Call("CalcTime")
  372. EndFunc
  373.  
  374. Func Loot()
  375. Sleep(Random(500,2000))
  376. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  377. If $LootSets Then
  378. $SetCount += LootGear(0x02CE01, 2)
  379. EndIf
  380. If $LootLegendaries Then
  381. $LegendaryCount += LootGear(0xBF642F, 0)
  382. EndIf
  383. If $LootRares Then
  384. $RareCount += LootGear(0xBBBB00, 2)
  385. EndIf
  386. If $LootTomes Then
  387. Call("LootTomes")
  388. EndIf
  389. If $LootMagic Then
  390. $MagicCount += LootGear(0x6969FF, 2)
  391. EndIf
  392. If $LootGems Then
  393. Call("LootGems")
  394. EndIf
  395. If $LootCustom Then
  396. Call("LootCustom")
  397. EndIf
  398. Call("ShowLoot")
  399. EndFunc
  400.  
  401. Func LootGear($color, $tolerance = 2)
  402. $count = 0
  403. $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
  404. If Not @error Then
  405. While Not @error
  406. $count += 1
  407. MouseClick ('left', $Loot[0], $Loot[1])
  408. Sleep(Random(700,900))
  409. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  410. ;Run at max 10 times per quality
  411. If $count >= 10 Then
  412. ExitLoop
  413. EndIf
  414. $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
  415. WEnd
  416. EndIf
  417. Return $count
  418. EndFunc
  419.  
  420. Func LootCustom()
  421. $gX = 0
  422. $gY = 0
  423. for $i = 0 to ($totalItems - 1)
  424. $array = StringSplit($pick[$i],"|")
  425. $file = $array[1]
  426. $accuracy = $array[2]
  427. $urlString = $pngLoc & $file
  428. While _ImageSearchArea($pngLoc & $file,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$accuracy)
  429. sleep(Random(75, 150))
  430. MouseClick("left",$gX,$gY,1,1)
  431. sleep(Random(800, 1200))
  432. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  433. WEnd
  434. next
  435. EndFunc
  436.  
  437. Func LootGems()
  438. $gX = 0
  439. $gY = 0
  440. While _ImageSearchArea($pngLoc & "square.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  441. sleep(Random(75, 150))
  442. MouseClick("left",$gX,$gY)
  443. $GemCount += 1
  444. sleep(Random(800, 1200))
  445. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  446. WEnd
  447. EndFunc
  448.  
  449. Func LootTomes()
  450. $gX = 0
  451. $gY = 0
  452. While _ImageSearchArea($pngLoc & "tome.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  453. sleep(Random(75, 150))
  454. MouseClick("left",$gX,$gY)
  455. $TomeCount += 1
  456. sleep(Random(800, 1200))
  457. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  458. WEnd
  459. EndFunc
  460.  
  461. Func Moving($time)
  462. Sleep($time/$movementSpeed)
  463. EndFunc
  464.  
  465. Func RandClick($clickType, $xPos, $yPos, $xOff = 20, $yOff = 20)
  466. $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
  467. $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
  468. MouseClick($clickType, $randX, $randY)
  469. EndFunc
  470.  
  471. Func RandMove($xPos, $yPos, $xOff = 20, $yOff = 20)
  472. $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
  473. $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
  474. MouseMove($randX, $randY)
  475. EndFunc
  476.  
  477. Func RandSleep($min = 30, $max = 45, $chance = 5)
  478. $randNum = Round(Random(1, 100))
  479. If $Timer And $randNum <= $chance Then
  480. $sleepTime = Random($min*1000, $max*1000)
  481. GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime/1000) & " secs")
  482.  
  483. For $c = 0 To 10
  484. Sleep($sleepTime/10)
  485. Next
  486. EndIf
  487. EndFunc
  488.  
  489. Func TownPortal()
  490. GUICtrlSetData($lblStatus, "Status: Returning to Town")
  491. Send("t")
  492. Sleep(Random($tptime, $tptime+500))
  493. Call("CheckDead")
  494. If $Dead or $Logout Then
  495. Return
  496. EndIf
  497. EndFunc
  498.  
  499. Func StashLoot()
  500. GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  501. Sleep(Random(1000, 1500))
  502. MouseClick("left", 1064*$x_ratio, 256*$y_ratio)
  503. Sleep(Random(1500, 2000))
  504.  
  505. ;Legendaries
  506. While $StashLegendary
  507. Sleep(Random(200, 300))
  508. $LegendPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4D2C0D, 0)
  509. If Not @error Then
  510. GUICtrlSetData($lblStatus, "Status: Stashing Legendaries")
  511. MouseClick("right", $LegendPixel[0], $LegendPixel[1])
  512. Else
  513. ExitLoop
  514. EndIf
  515. WEnd
  516.  
  517. ;Rares
  518. While $StashRare
  519. Sleep(Random(200, 300))
  520. $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4A3C0B, 1)
  521. If Not @error Then
  522. GUICtrlSetData($lblStatus, "Status: Stashing Rares")
  523. MouseClick("right", $RarePixel[0], $RarePixel[1])
  524. Else
  525. ExitLoop
  526. EndIf
  527. WEnd
  528.  
  529. ;Tomes
  530. If _ImageSearchArea($pngLoc & "tomeIcon.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  531. GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
  532. MouseClick("left",500*$x_ratio,360*$y_ratio,1,1)
  533. Sleep(Random(500, 750))
  534. MouseClick("right",$gX,$gY,1,1)
  535. Sleep(Random(400, 600))
  536. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  537. Sleep(Random(200, 500))
  538. EndIf
  539.  
  540. ;Magic
  541. While $StashMagic
  542. Sleep(Random(100, 300))
  543. $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
  544. If Not @error Then
  545. GUICtrlSetData($lblStatus, "Status: Stashing Magic")
  546. MouseClick("right", $MagicPixel[0], $MagicPixel[1])
  547. Else
  548. ExitLoop
  549. EndIf
  550. WEnd
  551.  
  552. Sleep(Random(1000, 3000))
  553. Send("{ESCAPE}")
  554. EndFunc
  555.  
  556. Func VendorLoot()
  557. GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  558.  
  559. If Not $StashLoot Then ;Move from TP towards vendor
  560. Sleep(Random(300, 500))
  561. MouseClick("left", 1565*$x_ratio, 50*$y_ratio)
  562. Else ;Move from Stash towards vendor
  563. Sleep(Random(300, 500))
  564. MouseClick("left", 1560*$x_ratio, 120*$y_ratio)
  565. EndIf
  566. Sleep(3000)
  567. MouseClick("left", 1030*$x_ratio, 210*$y_ratio) ;Talk to vendor
  568. Sleep(3000)
  569.  
  570. ;Rares
  571. If $VendorRare Then
  572. ConsoleWrite("Selling Rare - ")
  573. $c = 0
  574. While $VendorRare
  575. Sleep(Random(200, 300))
  576. $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4A3C0B, 1)
  577. If Not @error Then
  578. MouseClick("right", $RarePixel[0], $RarePixel[1])
  579. $c += 1
  580. Else
  581. ConsoleWrite($c & @CRLF)
  582. ExitLoop
  583. EndIf
  584. WEnd
  585. EndIf
  586.  
  587. ;Magic
  588. If $VendorMagic Then
  589. ConsoleWrite("Selling Magic - ")
  590. $c = 0
  591. While True
  592. Sleep(Random(100, 300))
  593. $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
  594. If Not @error Then
  595. MouseClick("right", $MagicPixel[0], $MagicPixel[1])
  596. $c += 1
  597. Else
  598. ConsoleWrite($c & @CRLF)
  599. ExitLoop
  600. EndIf
  601. WEnd
  602. EndIf
  603.  
  604. Sleep(Random(1000, 3000))
  605. GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  606. Send("{ESCAPE}")
  607. EndFunc
  608.  
  609.  
  610. Func DoUpdate()
  611. $Ini = InetGet($VersionsInfo,@ScriptDir & "\version.ini") ;download version.ini
  612. If $Ini = 0 Then ;was the download of version.ini successful?
  613. MsgBox(0,"ERROR","The server seems to be offline. No update will be done.")
  614. Else
  615. $newVersion = IniRead (@ScriptDir & "\version.ini","Version","Version","") ;reads the new version out of version.ini
  616. If $NewVersion = $oldVersion Then ;compare old and new
  617. ;MsgBox (0,"No update","There is no update available!")
  618. FileDelete(@ScriptDir & "\version.ini")
  619. Else
  620. $msg = MsgBox (4,"Update","There is a new version existing: " & $newVersion & " ! You are using: " & $oldVersion & ". Do you want to download the new version?")
  621. If $msg = 7 Then ;No was pressed
  622. FileDelete(@ScriptDir & "\version.ini")
  623. ElseIf $msg = 6 Then ;OK was pressed
  624. $downloadLink = IniRead(@ScriptDir & "\version.ini","Version","download","NotFound")
  625. $dlhandle = InetGet($downloadLink,@ScriptDir & "\Update.au3",1,1)
  626. ProgressOn("Update", "Downloading Updates", "",-1,-1,16) ;creates an progressbar
  627.  
  628. $Size = InetGetSize($downloadLink,1) ;get the size of the update
  629. While Not InetGetInfo($dlhandle, 2)
  630. $Percent = (InetGetInfo($dlhandle,0)/$Size)*100
  631. ProgressSet( $Percent, $Percent & " percent") ;update progressbar
  632. Sleep(1)
  633. WEnd
  634. ProgressSet(100 , "Done", "Complete") ;show complete progressbar
  635. sleep(500)
  636. ProgressOff() ;close progress window
  637. IniWrite("updater.ini","version","version",$NewVersion)
  638. InetClose($dlhandle)
  639. MsgBox(-1,"Success","Download Complete! Please restart the bot by running Update.au3" & @CRLF & "Exiting...")
  640. FileDelete(@ScriptDir & "\version.ini")
  641. Exit
  642. EndIf
  643. EndIf
  644. EndIf
  645. EndFunc
  646.  
  647. ;Hotkey Functions
  648. Func Leave()
  649. $Leave = True
  650. EndFunc
  651.  
  652. Func Pause()
  653. $Leave = False
  654. EndFunc
  655.  
  656. Func ShowLoot()
  657. GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
  658. GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
  659. EndFunc
  660.  
  661. Func Stop() ;to allow the script to stop
  662. Exit
  663. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement