SHARE
TWEET

Sarkoth farm script 1.9.3

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