Advertisement
darkjoy

notAres 1.5d Modified for Wormhole Wizard Archon

Jun 14th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.28 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. Call ("CheckDead")
  275. EndIf
  276. EndFunc
  277.  
  278. ;Helper Functions
  279. Func CheckDead()
  280. $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"
  281. If Not @error Then
  282. GUICtrlSetData($lblStatus, "Status: Dead")
  283. $Dead = True
  284. Call("LeaveGame")
  285. Sleep(11000)
  286. Else
  287. $Dead = False
  288. EndIf
  289.  
  290. $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
  291. If Not @error Then
  292. Sleep(11000)
  293. Sleep($loadtime)
  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 $Dead Then
  312. Return
  313. EndIf
  314. If CheckFor("NewTristram", "Area") Then
  315. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  316. Moving(1875)
  317. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  318. Moving(1875)
  319. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  320. Sleep(1200)
  321. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  322. Sleep(400)
  323. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  324. Sleep(200)
  325. Send("{Escape}")
  326. Call("LeaveGame")
  327. EndIf
  328. EndFunc
  329.  
  330. Func CalcTime()
  331. $srt = TimerDiff($rt)
  332. GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt/1000,2) & " seconds.")
  333. $trt = TimerDiff($t)
  334. $total = Round((($trt/1000)/60)/60,4)
  335.  
  336. ;Total runtiume calculation.
  337. $hours = Floor((($trt/1000)/60)/60)
  338. $minutes = (($trt/1000)/60)
  339. ;trim minutes if runtime is more then 1 hour.
  340. If $minutes > 60 Then
  341. While $minutes > 60
  342. $minutes -=60
  343. WEnd
  344. EndIf
  345. GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, "& Ceiling($minutes) &" minutes")
  346. EndFunc
  347.  
  348. Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 5 ,$tolerance = 130)
  349. $c = 0
  350. $string = $pngLoc & $img & ".png"
  351. Do
  352. $c +=1
  353. Sleep(100)
  354. If $c > ($seconds*10) Then ;Make sure we never get stuck here for infinity.
  355. If $type = "Area" Then
  356. GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
  357. EndIf
  358. Return False
  359. EndIf
  360. Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
  361. Return True
  362. EndFunc
  363.  
  364. Func LeaveGame()
  365. $Logout = true
  366. Call("RandSleep")
  367. GUICtrlSetData($lblStatus, "Status: Leaving Game")
  368. Sleep(Random(100, 500))
  369. Send("{Escape}")
  370. Sleep(Random(100, 500))
  371. RandClick("left", Round(956*$x_ratio), Round(579*$y_ratio), 120, 20) ;Random Click on the leave button
  372. Call("CalcTime")
  373. EndFunc
  374.  
  375. Func Loot()
  376. Sleep(Random(500,2000))
  377. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  378. If $LootSets Then
  379. $SetCount += LootGear(0x02CE01, 2)
  380. EndIf
  381. If $LootLegendaries Then
  382. $LegendaryCount += LootGear(0xBF642F, 0)
  383. EndIf
  384. If $LootRares Then
  385. $RareCount += LootGear(0xBBBB00, 2)
  386. EndIf
  387. If $LootTomes Then
  388. Call("LootTomes")
  389. EndIf
  390. If $LootMagic Then
  391. $MagicCount += LootGear(0x6969FF, 2)
  392. EndIf
  393. If $LootGems Then
  394. Call("LootGems")
  395. EndIf
  396. If $LootCustom Then
  397. Call("LootCustom")
  398. EndIf
  399. Call("ShowLoot")
  400. EndFunc
  401.  
  402. Func LootGear($color, $tolerance = 2)
  403. $count = 0
  404. $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
  405. If Not @error Then
  406. While Not @error
  407. $count += 1
  408. MouseClick ('left', $Loot[0], $Loot[1])
  409. Sleep(Random(700,900))
  410. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  411. ;Run at max 10 times per quality
  412. If $count >= 10 Then
  413. ExitLoop
  414. EndIf
  415. $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance)
  416. WEnd
  417. EndIf
  418. Return $count
  419. EndFunc
  420.  
  421. Func LootCustom()
  422. $gX = 0
  423. $gY = 0
  424. for $i = 0 to ($totalItems - 1)
  425. $array = StringSplit($pick[$i],"|")
  426. $file = $array[1]
  427. $accuracy = $array[2]
  428. $urlString = $pngLoc & $file
  429. While _ImageSearchArea($pngLoc & $file,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$accuracy)
  430. sleep(Random(75, 150))
  431. MouseClick("left",$gX,$gY,1,1)
  432. sleep(Random(800, 1200))
  433. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  434. WEnd
  435. next
  436. EndFunc
  437.  
  438. Func LootGems()
  439. $gX = 0
  440. $gY = 0
  441. While _ImageSearchArea($pngLoc & "square.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  442. sleep(Random(75, 150))
  443. MouseClick("left",$gX,$gY)
  444. $GemCount += 1
  445. sleep(Random(800, 1200))
  446. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  447. WEnd
  448. EndFunc
  449.  
  450. Func LootTomes()
  451. $gX = 0
  452. $gY = 0
  453. While _ImageSearchArea($pngLoc & "tome.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  454. sleep(Random(75, 150))
  455. MouseClick("left",$gX,$gY)
  456. $TomeCount += 1
  457. sleep(Random(800, 1200))
  458. MouseMove(Round(Random(0,400)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  459. WEnd
  460. EndFunc
  461.  
  462. Func Moving($time)
  463. Sleep($time/$movementSpeed)
  464. EndFunc
  465.  
  466. Func RandClick($clickType, $xPos, $yPos, $xOff = 20, $yOff = 20)
  467. $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
  468. $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
  469. MouseClick($clickType, $randX, $randY)
  470. EndFunc
  471.  
  472. Func RandMove($xPos, $yPos, $xOff = 20, $yOff = 20)
  473. $randX = Round(Random($xPos-($xOff*$x_ratio), $xPos+($xOff*$x_ratio)))
  474. $randY = Round(Random($yPos-($yOff*$y_ratio), $yPos+($yOff*$y_ratio)))
  475. MouseMove($randX, $randY)
  476. EndFunc
  477.  
  478. Func RandSleep($min = 30, $max = 45, $chance = 5)
  479. $randNum = Round(Random(1, 100))
  480. If $Timer And $randNum <= $chance Then
  481. $sleepTime = Random($min*1000, $max*1000)
  482. GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime/1000) & " secs")
  483.  
  484. For $c = 0 To 10
  485. Sleep($sleepTime/10)
  486. Next
  487. EndIf
  488. EndFunc
  489.  
  490. Func TownPortal()
  491. GUICtrlSetData($lblStatus, "Status: Returning to Town")
  492. Send("t")
  493. Sleep(Random($tptime, $tptime+500))
  494. Call("CheckDead")
  495. If $Dead or $Logout Then
  496. Return
  497. EndIf
  498. EndFunc
  499.  
  500. Func StashLoot()
  501. GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  502. Sleep(Random(1000, 1500))
  503. MouseClick("left", 1064*$x_ratio, 256*$y_ratio)
  504. Sleep(Random(1500, 2000))
  505.  
  506. ;Legendaries
  507. While $StashLegendary
  508. Sleep(Random(200, 300))
  509. $LegendPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4D2C0D, 0)
  510. If Not @error Then
  511. GUICtrlSetData($lblStatus, "Status: Stashing Legendaries")
  512. MouseClick("right", $LegendPixel[0], $LegendPixel[1])
  513. Else
  514. ExitLoop
  515. EndIf
  516. WEnd
  517.  
  518. ;Rares
  519. While $StashRare
  520. Sleep(Random(200, 300))
  521. $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4A3C0B, 1)
  522. If Not @error Then
  523. GUICtrlSetData($lblStatus, "Status: Stashing Rares")
  524. MouseClick("right", $RarePixel[0], $RarePixel[1])
  525. Else
  526. ExitLoop
  527. EndIf
  528. WEnd
  529.  
  530. ;Tomes
  531. If _ImageSearchArea($pngLoc & "tomeIcon.png",1,1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio,$gX,$gY,140) Then
  532. GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
  533. MouseClick("left",500*$x_ratio,360*$y_ratio,1,1)
  534. Sleep(Random(500, 750))
  535. MouseClick("right",$gX,$gY,1,1)
  536. Sleep(Random(400, 600))
  537. MouseClick("left",500*$x_ratio,200*$y_ratio,1,1)
  538. Sleep(Random(200, 500))
  539. EndIf
  540.  
  541. ;Magic
  542. While $StashMagic
  543. Sleep(Random(100, 300))
  544. $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
  545. If Not @error Then
  546. GUICtrlSetData($lblStatus, "Status: Stashing Magic")
  547. MouseClick("right", $MagicPixel[0], $MagicPixel[1])
  548. Else
  549. ExitLoop
  550. EndIf
  551. WEnd
  552.  
  553. Sleep(Random(1000, 3000))
  554. Send("{ESCAPE}")
  555. EndFunc
  556.  
  557. Func VendorLoot()
  558. GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  559.  
  560. If Not $StashLoot Then ;Move from TP towards vendor
  561. Sleep(Random(300, 500))
  562. MouseClick("left", 1565*$x_ratio, 50*$y_ratio)
  563. Else ;Move from Stash towards vendor
  564. Sleep(Random(300, 500))
  565. MouseClick("left", 1560*$x_ratio, 120*$y_ratio)
  566. EndIf
  567. Sleep(3000)
  568. MouseClick("left", 1030*$x_ratio, 210*$y_ratio) ;Talk to vendor
  569. Sleep(3000)
  570.  
  571. ;Rares
  572. If $VendorRare Then
  573. ConsoleWrite("Selling Rare - ")
  574. $c = 0
  575. While $VendorRare
  576. Sleep(Random(200, 300))
  577. $RarePixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x4A3C0B, 1)
  578. If Not @error Then
  579. MouseClick("right", $RarePixel[0], $RarePixel[1])
  580. $c += 1
  581. Else
  582. ConsoleWrite($c & @CRLF)
  583. ExitLoop
  584. EndIf
  585. WEnd
  586. EndIf
  587.  
  588. ;Magic
  589. If $VendorMagic Then
  590. ConsoleWrite("Selling Magic - ")
  591. $c = 0
  592. While True
  593. Sleep(Random(100, 300))
  594. $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
  595. If Not @error Then
  596. MouseClick("right", $MagicPixel[0], $MagicPixel[1])
  597. $c += 1
  598. Else
  599. ConsoleWrite($c & @CRLF)
  600. ExitLoop
  601. EndIf
  602. WEnd
  603. EndIf
  604.  
  605. Sleep(Random(1000, 3000))
  606. GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  607. Send("{ESCAPE}")
  608. EndFunc
  609.  
  610.  
  611. Func DoUpdate()
  612. $Ini = InetGet($VersionsInfo,@ScriptDir & "\version.ini") ;download version.ini
  613. If $Ini = 0 Then ;was the download of version.ini successful?
  614. MsgBox(0,"ERROR","The server seems to be offline. No update will be done.")
  615. Else
  616. $newVersion = IniRead (@ScriptDir & "\version.ini","Version","Version","") ;reads the new version out of version.ini
  617. If $NewVersion = $oldVersion Then ;compare old and new
  618. ;MsgBox (0,"No update","There is no update available!")
  619. FileDelete(@ScriptDir & "\version.ini")
  620. Else
  621. $msg = MsgBox (4,"Update","There is a new version existing: " & $newVersion & " ! You are using: " & $oldVersion & ". Do you want to download the new version?")
  622. If $msg = 7 Then ;No was pressed
  623. FileDelete(@ScriptDir & "\version.ini")
  624. ElseIf $msg = 6 Then ;OK was pressed
  625. $downloadLink = IniRead(@ScriptDir & "\version.ini","Version","download","NotFound")
  626. $dlhandle = InetGet($downloadLink,@ScriptDir & "\Update.au3",1,1)
  627. ProgressOn("Update", "Downloading Updates", "",-1,-1,16) ;creates an progressbar
  628.  
  629. $Size = InetGetSize($downloadLink,1) ;get the size of the update
  630. While Not InetGetInfo($dlhandle, 2)
  631. $Percent = (InetGetInfo($dlhandle,0)/$Size)*100
  632. ProgressSet( $Percent, $Percent & " percent") ;update progressbar
  633. Sleep(1)
  634. WEnd
  635. ProgressSet(100 , "Done", "Complete") ;show complete progressbar
  636. sleep(500)
  637. ProgressOff() ;close progress window
  638. IniWrite("updater.ini","version","version",$NewVersion)
  639. InetClose($dlhandle)
  640. MsgBox(-1,"Success","Download Complete! Please restart the bot by running Update.au3" & @CRLF & "Exiting...")
  641. FileDelete(@ScriptDir & "\version.ini")
  642. Exit
  643. EndIf
  644. EndIf
  645. EndIf
  646. EndFunc
  647.  
  648. ;Hotkey Functions
  649. Func Leave()
  650. $Leave = True
  651. EndFunc
  652.  
  653. Func Pause()
  654. $Leave = False
  655. EndFunc
  656.  
  657. Func ShowLoot()
  658. GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
  659. GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
  660. EndFunc
  661.  
  662. Func Stop() ;to allow the script to stop
  663. Exit
  664. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement