Advertisement
Guest User

Wizard Sarkoth Script Updated 6/28/12 3:39AM EST

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