Advertisement
Guest User

archontele with gems and magics

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