Guest User

sarkoth autoit gems picking

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