Advertisement
Guest User

Wizard Sarkoth Script Updated 6/27/12 5:53PM EST

a guest
Jun 27th, 2012
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 9.45 KB | None | 0 0
  1. Opt('MouseCoordMode', 0)
  2. Opt('PixelCoordMode', 0)
  3. Opt('SendKeyDelay', 50) ; Default speed
  4.  
  5. HotKeySet('{END}', 'Quit')
  6. HotKeySet('{F10}', 'Pause')
  7. Global $Paused
  8. Global $DebugOn = True
  9.  
  10.  
  11. $Amethyst = 0xA56DF1
  12. $Ruby = 0xFA8078
  13. $Emerald = 0x51965B
  14. $Topaz = 0xFFFF59
  15. $Left = 64
  16. $Top = 42
  17. $Right = 720
  18. $Bottom = 519
  19. $Rare = 0xFFFF00 ; rare color
  20. $Magic = 0x6969FF ; blue color
  21. $Legendary = 0xBF642F ; legendary color
  22. $Set = 0x00FF00 ; set color
  23.  
  24.  
  25. ; bot starts paused. press F10 to start.
  26. Pause()
  27.  
  28.  
  29. WinActivate('Diablo III')
  30. While 1
  31.    If WinActive('Diablo III') Then
  32.    
  33.      checkResume()
  34.       Sleep(400)
  35.       Click(134, 255) ; click resume
  36.       Sleep(3800) ; load
  37.      $repair = PixelSearch(579,48,587,54,0xFFF000) ; searches top right screen for broken armor
  38.       If (Not @error) Or (CheckInv() == 1) Then
  39.          InvRepair()
  40.       Else
  41.        Send('3')
  42.        Sleep(20)
  43.        Teleport()
  44.        Sleep(20)
  45.        Send('1')
  46.        Sleep(30)
  47.        $yellow = PixelSearch(643, 109, 698, 163, 0xF5CD37, 10) ; checks minimap for cellar
  48.        If Not @error Then ; found cellar
  49.          DEBUG("Cellar found")
  50.          Move(66,435)
  51.          Move(134, 249)
  52.          Sleep(150)
  53.          $blue = PixelSearch(430, 132, 602, 267, 0x5D80DB, 10) ; gets position of cellar
  54.          If Not @error Then
  55.             MouseClick("left", $blue[0], $blue[1])
  56.             Sleep(1100)
  57.          EndIf
  58.          Sleep(350)
  59.          Move(126, 494)
  60.          Move(219, 282)
  61.          Click(349, 595) ; choose hydra
  62.          Click(220, 174) ; cast hydra
  63.          MouseClickDrag ( "right", 82, 171 , 260, 106,12)
  64.          MouseClickDrag ( "right", 82, 171 , 260, 106,12)
  65.          Shoot(161, 128)
  66.          Sleep(390)
  67.          Move(98, 146)
  68.          Sleep(300)
  69.          Move(453, 281)
  70.          MouseClick("right", 259, 549)
  71.          FindItem()
  72.          TownPortal()
  73.          Send("{ESCAPE}") ; opens menu
  74.          Sleep(Random(300,350))
  75.          Click(407,345) ; leaves
  76.          Sleep(Random(1990,2010))
  77.        Else ; cellar not found
  78.          DEBUG("Cellar not found")
  79.          SafetyFirst() ; will go into archon and use skill '1' to blow things up
  80.          TownPortal()
  81.          Send("{ESCAPE}") ; opens menu
  82.          Sleep(400)
  83.          Click(407, 345) ; leaves
  84.          Sleep(2000)
  85.        EndIf
  86.      EndIf
  87.    EndIf
  88. WEnd
  89.  
  90. Func TownPortal()
  91.    Send('t')
  92.    Sleep(6600)
  93. EndFunc
  94.  
  95.  
  96. Func SafetyFirst()
  97.    MouseClick("right", 500, 500, 1, Random(0, 1)) ; archon activation
  98.    Sleep(400)
  99.    Send('1') ; AoE skill 1
  100. EndFunc
  101.  
  102.  
  103. Func Move($x, $y)
  104.    MouseClick('middle', $x, $y, 1, Random(0, 1))
  105.    Sleep(1500)
  106. EndFunc   ;==>Move
  107.  
  108.  
  109. Func checkResume()
  110.    Local $check = 0
  111.    While $check == 0
  112.    $resume = PixelSearch(63, 255, 83, 269, 0x2C0100,10)
  113.      If Not @error Then ; at menu, hits resume
  114.        $check = 1
  115.        DEBUG("RESUME")
  116.     Else
  117.        Sleep(100)  
  118.      EndIf
  119.    WEnd
  120. EndFunc
  121.  
  122.  
  123. Func Shoot($x, $y)
  124.    MouseClick('right', $x, $y, 50)
  125.    Sleep(Random(100, 200))
  126. EndFunc   ;==>Shoot
  127.  
  128.  
  129. Func Teleport()
  130.    MouseMove(5, 199)
  131.    SendUntil('2', 2000)
  132.    Sleep(Random(100, 200))
  133. EndFunc   ;==>Teleport
  134.  
  135. Func CheckRare()
  136.    Send("{i}")
  137.    $unidRare = PixelSearch(772,463,790,490,0xFFFFFF,5) ; looks at the question mark which is white
  138.    If @error Then ; not a rare in last slot
  139.       Send("{i}")
  140.       Return 1
  141.    EndIf
  142.    ; rare in last slot
  143.    Send("{i}")
  144.    Return 0
  145. EndFunc
  146.  
  147.  
  148. Func Click($x, $y)
  149.    MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  150.    Sleep(Random(100, 170))
  151. EndFunc   ;==>Click
  152.  
  153.  
  154. Func FindItem()
  155.    Sleep(50)
  156.    $work = 1
  157.    $checkCount = 0
  158.    $checkFull = 0
  159.    While $work == 1 And $checkCount <15
  160.      If CheckInv() == 1 Then ; full and cannot pickup remaining items
  161.         DEBUG("Inventory full, ending item finding")
  162.         ExitLoop
  163.      EndIf
  164.      DEBUG("Search Item")
  165.      $work = 0
  166.       $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Rare) ; searches for rares
  167.       If Not @error Then
  168.         MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  169.         Sleep(750)
  170.         $work = 1
  171.         $checkCount = $checkCount +1
  172.      EndIf
  173.      
  174.      $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Magic ) ; searches for magics
  175.      If Not @error Then
  176.        MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  177.        Sleep(750)
  178.        $work = 1
  179.        $checkCount = $checkCount +1
  180.      EndIf
  181.  
  182.       $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Legendary ) ; searches for legendaries
  183.       If Not @error Then
  184.         MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  185.         Sleep(750)
  186.         $work = 1
  187.         $checkCount = $checkCount +1
  188.       EndIf
  189.       $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Set) ; searches for set
  190.       If Not @error Then
  191.         MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  192.         Sleep(750)
  193.         $work = 1
  194.         $checkCount = $checkCount +1
  195.       EndIf
  196.      
  197.      ; search for gems
  198.      
  199. ;     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Amethyst,9) ; searches for amethyst
  200. ;     If Not @error Then
  201. ;      MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  202. ;       Sleep(750)
  203. ;       $work = 1
  204. ;       $checkCount = $checkCount +1
  205. ;     EndIf
  206. ;     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Ruby,6) ; searches for ruby
  207. ;     If Not @error Then
  208. ;       MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  209. ;       Sleep(750)
  210. ;       $work = 1
  211. ;       $checkCount = $checkCount +1
  212. ;     EndIf
  213. ;     $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Topaz,4) ;searches for topaz
  214. ;     If Not @error Then
  215. ;       MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
  216. ;       Sleep(750)
  217. ;       $work = 1
  218. ;       $checkCount = $checkCount +1
  219. ;     EndIf
  220. ;     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Emerald,9) ;searches for emerald
  221. ;     If Not @error Then
  222. ;       MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
  223. ;       Sleep(750)
  224. ;       $work = 1
  225. ;       $checkCount = $checkCount +1
  226. ;     EndIf
  227.    WEnd
  228.    If $checkFull == 1 Then
  229.       TownPortal()
  230.    EndIf
  231.      
  232.    DEBUG("Finished Item Searching")
  233. EndFunc
  234.  
  235.  
  236. Func CheckDeath() ; returns 1 if dead
  237.    $death = PixelSearch(285, 491, 308, 508, 0x2C0100,2)
  238.    If @error Then ; not dead
  239.       Return 0
  240.    Else ; you died
  241.       DEBUG("DEAD")
  242.       Sleep(200)
  243.       Send("{ESCAPE}") ;opens menu
  244.       Sleep(400)
  245.       Click(407, 345) ;leaves
  246.       Sleep(12000)
  247.       Return 1
  248.    EndIf
  249. EndFunc
  250.      
  251.  
  252. Func CheckInv() ; returns 1 if full
  253.    Send("{i}") ; opens inventory
  254.    Sleep(250)
  255.    $full = PixelSearch(780, 474, 782, 476, 0x130C08,5)
  256.    If @error Then
  257.      DEBUG("FULL")
  258.      Send("{i}")
  259.      Return 1
  260.    EndIf
  261.    Send("{i}") ; closes inventory
  262.    Return 0
  263. EndFunc
  264.  
  265.  
  266. Func InvRepair()
  267.      DEBUG("Going to repair")
  268.        $slot1x = 538 ; first slot x coordinate
  269.        $slot1y = 367 ; first slot y coordinate
  270.        $offset = 27 ; offset for each slot
  271.        
  272.          TownPortal()
  273.          If InTown() == 1 Then ; TP interrupted, leave game before trying to repair because you are not in Town
  274.             Return
  275.          Else
  276.             Debug("In town, beginning repair trip")
  277.             If CheckRare() == 0 Then ; rare is last slot, need to store
  278.                MouseClick("left",465,172) ; clicks stash after town portal
  279.                Sleep(700)
  280.                MouseClick("left",292,296) ; clicks third tab in stash
  281.                Sleep(300)
  282.                MouseClick("right",786,477) ; stashes that rare
  283.                Send("{ESCAPE}") ; close stash
  284.                MouseClick("left", 686, 94) ; begins movement towards merchant
  285.                Sleep(2400)
  286.                MouseClick("left", 505, 153) ; clicks merchant
  287.                Sleep(1000)
  288.             Else ; no need to storage, move normally to merchant
  289.                MouseClick("left", 700, 147) ; begins movement towards merchant
  290.                Sleep(2400)
  291.                MouseClick("left", 531, 51) ; clicks merchant
  292.                Sleep(2800)
  293.             EndIf
  294.             For $i = 0 To 9
  295.                For $j = 0 To 5
  296.                   MouseClick("right", $slot1x + ($i * $offset), $slot1y + ($j * $offset),1,3)
  297.                   Sleep(Random(35,40))
  298.                Next
  299.             Next
  300.             Click(294, 296) ; open up repair menu
  301.             Sleep(200)
  302.             Click(186, 326) ; pay for repairs
  303.             Sleep(500)
  304.             $inBag = PixelSearch(780, 474, 782, 476, 0x130C08,5)
  305.             If @error Then
  306.                DEBUG("Not at shop")
  307.                Send("{ESCAPE}") ; opens menu
  308.                Sleep(400)
  309.                Click(407, 345) ; leaves
  310.                Sleep(12000)  
  311.             Else
  312.                Send("{ESCAPE}") ; closes shop
  313.                Sleep(50)
  314.                Send("{ESCAPE}") ; opens menu
  315.                Sleep(400)
  316.                Click(407, 345) ; leaves
  317.                Sleep(2000)
  318.             EndIf
  319.          EndIf
  320. EndFunc
  321.  
  322.  
  323. Func InTown()
  324.    Debug("Checking if in town")
  325.    Sleep(180)
  326.    $check = PixelSearch(261,551,263,553,0xB17C2D,5)
  327.    If @error Then ; not in town
  328.       Debug("Not in town")
  329.       Send("{ESCAPE}") ; opens menu
  330.       Sleep(400)
  331.       Click(407, 345) ; leaves
  332.       Sleep(12000)
  333.       Return 1
  334.    EndIf
  335.    Return 0 ; in town
  336. EndFunc
  337.  
  338.  
  339. Func Pause()
  340.    $Paused = Not $Paused
  341.    While $Paused
  342.       Sleep(100)
  343.       ToolTip('Paused...', 0, 0)
  344.    WEnd
  345.    ToolTip("")
  346. EndFunc   ;==>Pause
  347.  
  348.  
  349. Func SendUntil($text, $milliseconds)
  350.     $time = TimerInit()
  351.     Do
  352.         Send($text)
  353.     Until TimerDiff($time) > $milliseconds
  354. EndFunc
  355.  
  356.  
  357. Func Quit()
  358.    Exit
  359. EndFunc   ;==>Quit
  360.  
  361.  
  362. Func DEBUG($MESSAGE)
  363.    If $DebugOn Then
  364.       ToolTip($MESSAGE, 0, 0)
  365.    EndIf
  366. EndFunc   ;==>Debug Info
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement