Advertisement
darkjoy

1.9.1 notAres' Gold Script - Wizard Mod

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