Advertisement
Guest User

Wizard Sarkoth Script Updated 6/29/12 8:18PM EST

a guest
Jun 29th, 2012
2,355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 10.57 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.    Sleep(100)
  149.    $unidRare1 = PixelSearch(772,463,790,500,0xFFFFFF,5) ; looks at the question mark which is white
  150.    $unidRare2 = PixelSearch(745,463,763,500,0xFFFFFF,5)
  151.    If (Not IsArray($unidRare1)) And (Not IsArray($unidRare2)) Then ; not a rare in last slot
  152.       Send("{i}")
  153.       Return 1
  154.    EndIf
  155.    ; rare in last slot
  156.    Send("{i}")
  157.    Return 0
  158. EndFunc
  159.  
  160.  
  161. Func Click($x, $y)
  162.    MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
  163.    Sleep(Random(100, 140))
  164. EndFunc   ;==>Click
  165.  
  166.  
  167. Func FindItem()
  168.    Sleep(50)
  169.    $work = 1
  170.    $checkCount = 0
  171.    $checkFull = 0
  172.    While $work == 1 And $checkCount <15
  173.      If CheckInv() == 1 Then ; full and cannot pickup remaining items
  174.         DEBUG("Inventory full, ending item finding")
  175.         ExitLoop
  176.      EndIf
  177.      DEBUG("Search Item")
  178.      $work = 0
  179.       $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Rare) ; searches for rares
  180.       If Not @error Then
  181.         MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  182.         Sleep(350)
  183.         $work = 1
  184.         $checkCount = $checkCount +1
  185.      EndIf
  186.      
  187.      $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Magic ) ; searches for magics
  188.      If Not @error Then
  189.        MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  190.        Sleep(350)
  191.        $work = 1
  192.        $checkCount = $checkCount +1
  193.      EndIf
  194.  
  195.       $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Legendary ) ; searches for legendaries
  196.       If Not @error Then
  197.         MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  198.         Sleep(350)
  199.         $work = 1
  200.         $checkCount = $checkCount +1
  201.       EndIf
  202.       $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Set) ; searches for set
  203.       If Not @error Then
  204.         MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  205.         Sleep(350)
  206.         $work = 1
  207.         $checkCount = $checkCount +1
  208.       EndIf
  209.      
  210.      ; search for gems
  211.      
  212. ;     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Amethyst,9) ; searches for amethyst
  213. ;     If Not @error Then
  214. ;      MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  215. ;       Sleep(350)
  216. ;       $work = 1
  217. ;       $checkCount = $checkCount +1
  218. ;     EndIf
  219. ;     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Ruby,6) ; searches for ruby
  220. ;     If Not @error Then
  221. ;       MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
  222. ;       Sleep(350)
  223. ;       $work = 1
  224. ;       $checkCount = $checkCount +1
  225. ;     EndIf
  226. ;     $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Topaz,4) ;searches for topaz
  227. ;     If Not @error Then
  228. ;       MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
  229. ;       Sleep(350)
  230. ;       $work = 1
  231. ;       $checkCount = $checkCount +1
  232. ;     EndIf
  233. ;     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Emerald,9) ;searches for emerald
  234. ;     If Not @error Then
  235. ;       MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
  236. ;       Sleep(350)
  237. ;       $work = 1
  238. ;       $checkCount = $checkCount +1
  239. ;     EndIf
  240.    WEnd
  241.    If $checkFull == 1 Then
  242.       TownPortal()
  243.    EndIf
  244.      
  245.    DEBUG("Finished Item Searching")
  246. EndFunc
  247.  
  248.  
  249. Func CheckDeath() ; returns 1 if dead
  250.    $death = PixelSearch(285, 491, 308, 508, 0x2C0100,2)
  251.    If @error Then ; not dead
  252.       Return 0
  253.    Else ; you died
  254.       DEBUG("DEAD")
  255.       Sleep(200)
  256.       Send("{ESCAPE}") ;opens menu
  257.       Sleep(400)
  258.       Click(407, 345) ;leaves
  259.       Sleep(12000)
  260.       Return 1
  261.    EndIf
  262. EndFunc
  263.      
  264.      
  265. Func CheckDisconnect()
  266.    $status = PixelSearch(400, 375, 416, 385, 0xA76933, 2)
  267.    If @error Then
  268.       Return False
  269.    Else
  270.       Debug("Disconnected..")
  271.       Return True
  272.    EndIf
  273. EndFunc
  274.    
  275. Func CheckInv() ; returns 1 if full
  276.    Send("{i}") ; opens inventory
  277.    Sleep(250)
  278.    ; will check if any bottom 4 right-most boxes are occupied Rows 5 and 6, Columns 9 and 10.
  279.    $row5col9 = PixelSearch(763, 481, 765, 483, 0x100907,5)
  280.    $row5col10 = PixelSearch(789, 481, 791, 483, 0x100808,5)
  281.    $row6col9 = PixelSearch(763, 507, 765, 510, 0x100907,5)
  282.    $row6col10 = PixelSearch(789, 507, 791, 510, 0x100808,5)
  283.    If (Not IsArray($row5col10)) Or (Not IsArray($row6col10)) Or (Not IsArray($row5col9)) Or (Not IsArray($row6col9)) Then
  284.      DEBUG("FULL")
  285.      ;Beep(1000, 1000)
  286.      Send("{i}")
  287.      Return 1
  288.   EndIf
  289.    Send("{i}") ; closes inventory
  290.    Return 0
  291. EndFunc
  292.  
  293.  
  294. Func InvRepair()
  295.      DEBUG("Going to repair")
  296.        $slot1x = 538 ; first slot x coordinate
  297.        $slot1y = 367 ; first slot y coordinate
  298.        $offset = 27 ; offset for each slot
  299.        
  300.          TownPortal()
  301.          If InTown() == 1 Then ; TP interrupted, leave game before trying to repair because you are not in Town
  302.             Return
  303.          Else
  304.             Debug("In town, beginning repair trip")
  305.             If CheckRare() == 0 Then ; rare is in last of the 4 slots, need to store
  306.                MouseClick("left",465,172) ; clicks stash after town portal
  307.                Sleep(700)
  308.                MouseClick("left",292,296) ; clicks third tab in stash
  309.                Sleep(300)
  310.                For $i = 756 To 782 Step 26
  311.                   For $j = 474 To 497 Step 23
  312.                      MouseClick("right",$i,$j, 1, Random(0,1)) ; stashes those possible rares in the bottom right corner
  313.                   Next
  314.                Next
  315.                Send("{ESCAPE}") ; close stash
  316.                MouseClick("left", 686, 94) ; begins movement towards merchant
  317.                Sleep(2400)
  318.                MouseClick("left", 505, 153) ; clicks merchant
  319.                Sleep(1300)
  320.             Else ; no need to storage, move normally to merchant
  321.                MouseClick("left", 700, 147) ; begins movement towards merchant
  322.                Sleep(2400)
  323.                MouseClick("left", 531, 51) ; clicks merchant
  324.                Sleep(2800)
  325.             EndIf
  326.             For $i = 0 To 9
  327.                For $j = 0 To 5
  328.                   MouseClick("right", $slot1x + ($i * $offset), $slot1y + ($j * $offset), 1, Random(0,1))
  329.                   Sleep(Random(35,40))
  330.                Next
  331.             Next
  332.             Click(294, 296) ; open up repair menu
  333.             Sleep(200)
  334.             Click(186, 326) ; pay for repairs
  335.             Sleep(500)
  336.             $inBag = PixelSearch(780, 474, 782, 476, 0x130C08,5)
  337.             If @error Then
  338.                DEBUG("Not at shop")
  339.                Send("{ESCAPE}") ; opens menu
  340.                Sleep(400)
  341.                Click(407, 345) ; leaves
  342.                Sleep(12000)  
  343.             Else
  344.                Send("{ESCAPE}") ; closes shop
  345.                Sleep(50)
  346.                Send("{ESCAPE}") ; opens menu
  347.                Sleep(400)
  348.                Click(407, 345) ; leaves
  349.                Sleep(2000)
  350.             EndIf
  351.          EndIf
  352. EndFunc
  353.  
  354.  
  355. Func InTown()
  356.    Debug("Checking if in town")
  357.    Sleep(180)
  358.    $check = PixelSearch(261,551,263,553,0xB17C2D,5)
  359.    If @error Then ; not in town
  360.       Debug("Not in town")
  361.       Send("{ESCAPE}") ; opens menu
  362.       Sleep(400)
  363.       Click(407, 345) ; leaves
  364.       Sleep(12000)
  365.       Return 1
  366.    EndIf
  367.    Return 0 ; in town
  368. EndFunc
  369.  
  370.  
  371. Func Pause()
  372.    $Paused = Not $Paused
  373.    While $Paused
  374.       Sleep(100)
  375.       ToolTip('Paused...', 0, 0)
  376.    WEnd
  377.    ToolTip("")
  378. EndFunc   ;==>Pause
  379.  
  380.  
  381. Func SendUntil($text, $milliseconds)
  382.     $time = TimerInit()
  383.     Do
  384.         Send($text)
  385.     Until TimerDiff($time) > $milliseconds
  386. EndFunc
  387.  
  388.  
  389. Func Quit()
  390.    Exit
  391. EndFunc   ;==>Quit
  392.  
  393.  
  394. Func DEBUG($MESSAGE)
  395.    If $DebugOn Then
  396.       ToolTip($MESSAGE, 0, 0)
  397.    EndIf
  398. EndFunc   ;==>Debug Info
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement