Advertisement
Guest User

NotAres_sarkoth_monk_1600x900

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