Advertisement
tofuartist

tofuartist's Barbarian Sarkoth Script

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