Advertisement
darkjoy

notAres 1.5d Modified for Wormhole Wizard Archon

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