Guest User

Wizard Sarkoth Script Updated 6/29/12 5:34PM EST

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