notares

Sarkoth DH Gold Script 1.3a archived version

Jun 10th, 2012
804
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 12.79 KB | None | 0 0
  1. ;notAres' Sarkoth DH Gold Script 1.3a - 6/9/2012 - Holy shit look how beautiful this code is. Utilized ExitLoop to perfect the efficiency when dead/logging out/in need of repair
  2. ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkarth-dh-gold-script-autoit-script-1920x1080.html
  3. ;Please notice I changed some variable names around and added a variable for teleport time. $waittime is now appropriately named $loadtime.
  4. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  5. ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
  6. ;Required movement speed: 25% (10% boots + 15% passive 'Hot Pursuit')
  7. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  8. ;Official supported resolution: 1920x1080
  9. ;;;;;
  10. ;Features:
  11. ;Loot scanning. Will only pick up rare/legendary/set pieces [IMPROVED]
  12. ;Randomized aiming coordinates (but still static path)
  13. ;Randomized pickup timers for variation in runs
  14. ;Automatic repair on yellow status icon
  15. ;Automatic resolution adjustment (16:9 only) [BUGGY - need someone to tweak coords]
  16. ;Death check
  17. ;Open window check (in rare case it gets stuck in menu)
  18. ;;;;;
  19. ;Original:
  20. ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
  21.  
  22. Global $Paused
  23. HotKeySet("=","Leave")  ;script started by pressing =
  24. HotKeySet("-", "Pause") ;script paused by pressing -
  25. HotKeySet("x", "Stop") ;script stopped by pressing x
  26.  
  27. $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  28. $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  29. $tptime =   6900 ; time in ms the script waits for teleport before exiting the game
  30. $yellow =   0xFFF000 ; yellow color code (repair icon)
  31. $red =      0xD90000 ; red color code (repair icon)
  32.  
  33. $LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False)
  34. $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
  35. $Amethyst = 0xAC7FFF
  36. $Ruby = 0xB01D2D
  37. $Emerald = 0x58EE33
  38. $Topaz = 0xFFFF59
  39.  
  40. $go = True
  41. $Leave = False
  42. $Dead = False
  43. $Logout = False
  44. $Window = False
  45. $default_resolutionX = 1920
  46. $default_resolutionY = 1080
  47. $x_ratio = @Desktopwidth / $default_resolutionX
  48. $y_ratio = @Desktopheight / $default_resolutionY
  49. $i = 0
  50.  
  51. Call("RestartRun")
  52.  
  53. Func RestartRun()
  54.    While $go
  55.       if($Leave) Then
  56.          $i = 0
  57.          Sleep(800) ;had to add this since the icon doesn't show up RIGHT away in game
  58.          Call("CheckDead")
  59.          Call("CheckRepair")
  60.          If $Window Then
  61.             MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  62.             Sleep($loadtime)
  63.             $Window = False
  64.             ExitLoop
  65.          ElseIf $Dead or $Logout Then
  66.             ExitLoop
  67.          EndIf
  68.          MouseClick("middle", Round(500*$x_ratio), Round(250*$y_ratio)) ;starts the run [waypoint 1]
  69.          Sleep(900)
  70.          Send("2")
  71.          Sleep(250)
  72.          MouseClick("middle", 1, Round(370*$y_ratio)) ;waits ~1 second then [waypoint 2]
  73.          Sleep(1500)
  74.          MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  75.          Sleep(40)
  76.          Send("2")
  77.          Sleep(20)
  78.          Send("3")
  79.          Sleep(600)
  80.          Send("1")
  81.          Sleep(300)
  82.          MouseMove(Round(300*$x_ratio),Round(100*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  83.          Sleep(790)
  84.          Call("CheckDead")
  85.          If $Window Then
  86.             MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  87.             Sleep($loadtime)
  88.             $Window = False
  89.             ExitLoop
  90.          ElseIf $Dead or $Logout Then
  91.             ExitLoop
  92.          EndIf
  93.          $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)
  94.                If Not @error Then
  95.                   MouseClick("left",Round(300*$x_ratio),Round(100*$y_ratio)) ;Entrance to cellar
  96.                   Sleep(300)
  97.                   Send("2")
  98.                   Sleep($walktime)
  99.                   MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  100.                   Sleep(2500)
  101.                   MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  102.                   Sleep(10)
  103.                   Send("{SHIFTDOWN}")
  104.                   MouseDown("right") ;attack middle
  105.                   Sleep(1200)
  106.                   Send("4")
  107.                   Sleep(3000)
  108.                   MouseUp("right")
  109.                   MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  110.                   MouseMove(Round(240*$x_ratio),Round(75*$y_ratio),1) ;attack left
  111.                   Sleep(40)
  112.                   MouseDown("right")
  113.                   Sleep(2800)
  114.                   MouseUp("right")
  115.                   MouseMove(Round(590*$x_ratio),Round(50*$y_ratio),1) ;attack right
  116.                   MouseDown("right")
  117.                   Sleep(1800)
  118.                   MouseUp("right")
  119.                   MouseDown("left")
  120.                   MouseMove(Round(Random(240,260)*$x_ratio),Round(75*$y_ratio),1) ;attack left
  121.                   Sleep(1200)
  122.                   MouseMove(Round(Random(560,600)*$x_ratio),Round(50*$y_ratio),1) ;attack right
  123.                   Sleep(1200)
  124.                   MouseUP("left")
  125.                   Sleep(10)
  126.                   MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  127.                   Sleep(10)
  128.                   Send("{SHIFTUP}")
  129.                   Sleep(400)
  130.                   MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  131.                   Sleep(2100)
  132.                   MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
  133.                   Sleep(1100)
  134.                   MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  135.                   Sleep(1100)
  136.                   Send("4")
  137.                   MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  138.                   Call("CheckLoot")
  139.                   Send("t")
  140.                   Sleep($tptime)
  141.                   Call("CheckDead")
  142.                   If Not $Logout And Not $Dead And Not $Window Then
  143.                      Sleep(300)
  144.                      Send("{ESCAPE}") ;menu
  145.                      Sleep(200)
  146.                      MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  147.                      Sleep($loadtime)
  148.                      Call("CheckDead")
  149.                      If Not $Logout Then
  150.                         MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  151.                         Sleep($loadtime)
  152.                      EndIf
  153.                   Else
  154.                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  155.                      Sleep($loadtime)
  156.                      $Window = False ; reset the flag so it doesn't think a window is always up
  157.                   EndIf
  158.                Else
  159.                   Sleep(10)
  160.                   MouseClick("middle",Round(1100*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  161.                   Sleep(200)
  162.                   Send("1")
  163.                   Sleep(620)
  164.                   Send("2")
  165.                   Sleep(40)
  166.                   Send("t")
  167.                   Sleep($tptime)
  168.                   Call("CheckDead")
  169.                   If Not $Logout And Not $Dead And Not $Window Then
  170.                      Sleep(300)
  171.                      Send("{ESCAPE}") ;menu
  172.                      Sleep(200)
  173.                      MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  174.                      Sleep($loadtime)
  175.                      Call("CheckDead")
  176.                      If Not $Logout Then
  177.                         MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  178.                         Sleep($loadtime)
  179.                      EndIf
  180.                   Else
  181.                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  182.                      Sleep($loadtime)
  183.                      $Window = False ; reset the flag so it doesn't think a window is always up
  184.                   EndIf
  185.             EndIf
  186.       EndIf
  187.    WEnd
  188.    Call("RestartRun")
  189. EndFunc
  190.  
  191. Func CheckDead()
  192. Call("CheckWindow")
  193. $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"
  194. If Not @error Then
  195.    If Not $Window Then
  196.       $Dead = True
  197.       Sleep(100)
  198.       Send("{Escape}")
  199.       Sleep(10)
  200.       MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  201.       Sleep(11000)
  202.       Sleep($loadtime)
  203.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  204.       Sleep($loadtime)
  205.    Else
  206.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  207.       Sleep($loadtime)
  208.       $Dead = False
  209.    EndIf
  210. Else
  211.    $Dead = False
  212. EndIf
  213. $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
  214. If Not @error Then
  215.    Sleep(11000)
  216.    Sleep($loadtime)
  217.    If Not $Window Then
  218.       $Dead = True
  219.       $Logout = True
  220.       Sleep($loadtime)
  221.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  222.       Sleep($loadtime)
  223.    Else
  224.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  225.       Sleep($loadtime)
  226.       $Logout = False
  227.    EndIf
  228. Else
  229.    $Logout = False
  230. EndIf
  231. EndFunc
  232.  
  233. Func CheckWindow()
  234. $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
  235. If Not @error Then
  236.    Sleep(200)
  237.    Send("{SPACE}") ;close any open windows
  238.    $Window = True
  239. Else
  240.    $Window = False
  241. EndIf
  242. EndFunc
  243.  
  244. Func CheckRepair()
  245. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  246.    If Not @error Then
  247.       Call("DoRepair")
  248.    EndIf
  249. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  250.    If Not @error Then
  251.       Call("DoRepair")
  252.    EndIf
  253. EndFunc
  254.  
  255. Func DoRepair()
  256. Sleep(100)
  257. Send("t")
  258. Sleep($tptime)
  259. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  260. Sleep(1500)
  261. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  262. Sleep(1500)
  263. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  264. Sleep(1200)
  265. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  266. Sleep(400)
  267. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  268. Sleep(200)
  269. Call("CheckDead")
  270. If Not $Dead and Not $Logout Then
  271.    Send("{ESCAPE}") ;closes repair tab
  272.    Sleep(100)
  273.    Send("{ESCAPE}") ;menu
  274.    Sleep(10)
  275.    MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  276.    Sleep($loadtime)
  277.    MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  278.    Sleep($loadtime)
  279. EndIf
  280. EndFunc
  281.  
  282. Func CheckLoot()
  283. Sleep(Random(500,2000))
  284. $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  285. If Not @error Then
  286.    MouseClick ('left', $SetLoot[0], $SetLoot[1])
  287.    Sleep(Random(800,1200))
  288.    $i+= 1
  289.    If $i <= 6 Then
  290.       Call("CheckLoot")
  291.    EndIf
  292. EndIf
  293. $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  294. If Not @error Then
  295.    MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  296.    Sleep(Random(800,1200))
  297.    $i+= 1
  298.    If $i <= 6 Then
  299.       Call("CheckLoot")
  300.    EndIf
  301. EndIf
  302. If $LootRares Then
  303.    $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  304.    If Not @error Then
  305.       MouseClick ('left', $RareLoot[0], $RareLoot[1])
  306.       Sleep(Random(700,900))
  307.       $i+= 1
  308.       If $i <= 6 Then
  309.          Call("CheckLoot")
  310.       EndIf
  311.    EndIf
  312. EndIf
  313. If $LootGems Then
  314.    $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  315.    If Not @error Then
  316.       MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  317.       Sleep(Random(900,1400))
  318.       $i+= 1
  319.       If $i <= 10 Then
  320.          Call("CheckLoot")
  321.       EndIf
  322.    EndIf
  323.    $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  324.    If Not @error Then
  325.       MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  326.       Sleep(Random(900,1400))
  327.       $i+= 1
  328.       If $i <= 10 Then
  329.          Call("CheckLoot")
  330.       EndIf
  331.    EndIf
  332.    $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  333.    If Not @error Then
  334.       MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  335.       Sleep(Random(900,1400))
  336.       $i+= 1
  337.       If $i <= 10 Then
  338.          Call("CheckLoot")
  339.       EndIf
  340.    EndIf
  341.    $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  342.    If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
  343.       MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  344.       Sleep(Random(900,1400))
  345.       $i+= 1
  346.       If $i <= 10 Then
  347.          Call("CheckLoot")
  348.       EndIf
  349.    EndIf
  350. EndIf
  351. EndFunc
  352.  
  353. Func Pause()
  354.    $Leave = False
  355. EndFunc
  356.  
  357. Func Stop() ;to allow the script to stop
  358.     Exit
  359. EndFunc
  360.  
  361. Func Leave()
  362.    $Leave = True
  363. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment