Advertisement
Guest User

1680x1050

a guest
Apr 3rd, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 6.04 KB | None | 0 0
  1. #cs ----------------------------------------------------------------------------
  2.  
  3.  AutoIt Version: 3.3.8.1
  4.  Author:         myName
  5.  
  6.  Script Function:
  7.     Template AutoIt script.
  8.  
  9. #ce ----------------------------------------------------------------------------
  10.  
  11. ; Script Start - Add your code below here
  12.  
  13. ; We need to require admin to interact with D3
  14. #RequireAdmin
  15.  
  16. ; Colors of loot types
  17. $blue = 0x6969FF;
  18. $yellow = 0xFFFF00
  19. $green = 0x00FF00
  20. $legend = 0xFF8000
  21. $gem = 0x99bbff
  22.  
  23. ; Config variables
  24. $pickupGem = IniRead("config.ini", "LootType", "Gems", True)
  25. $pickupYellow = IniRead("config.ini", "LootType", "Yellow", True)
  26. $pickupLegend = IniRead("config.ini", "LootType", "Legendary", True)
  27.  
  28. $bossTimer = IniRead("config.ini", "Settings", "bossTimer", 8000) ;Time to wait before checking loots. May help if your character leaves before the end
  29. $instantLeave = IniRead("config.ini", "Settings", "instantLeave", True) ; Uses town portal to leave or not
  30.  
  31. ; Window to scan for loots
  32. $lootX = 550
  33. $lootY = 150
  34. $endLootX = 1300
  35. $endLootY = 800
  36.  
  37.  
  38. WinActivate("Diablo III")
  39. Global $paused;
  40. Global $start = TimerInit()
  41.  
  42. HotKeySet("{PAUSE}", "TogglePause")
  43.  
  44. Global $state = "Init";
  45.  
  46. Init();
  47.  
  48. While 1
  49.    StartGame()
  50. WEnd
  51.  
  52. Func TogglePause ()
  53.    $paused = NOT $paused
  54.    while $paused
  55.       sleep(10)
  56.    WEnd
  57. EndFunc
  58.  
  59. Func Init()
  60.  
  61. EndFunc
  62.  
  63. ; From the menu, creates a game
  64. Func StartGame ()
  65.    $found = False
  66.    while NOT $found
  67.       ; Looks  for the "play" button
  68.       $coord = PixelSearch(340, 513, 341, 514, 0x290400, 20)
  69.       If Not @error Then
  70.          $found = true;
  71.          Sleep(1500)
  72.          MouseClick("left", 340, 513, 1, 50)
  73.       Else
  74.          Sleep(10);
  75.       EndIf;
  76.    WEnd
  77.    $start = TimerInit()
  78.    usePortal()
  79. EndFunc
  80.  
  81. ; Use the portal to go to the boss
  82. Func usePortal()
  83.    $found = false;
  84.    while not $found
  85.       ; Looks for the blue portal in town
  86.       $coord = PixelSearch(25, 25, 25, 24, 0x22295C, 10)
  87.       If Not @error Then
  88.          $found = True
  89.          Sleep(1500)
  90.          MouseClick("left", 25, 25, 1, 10)
  91.       Else
  92.          Sleep(10)
  93.       EndIf
  94.    WEnd
  95.    GoToBoss()
  96. EndFunc
  97.  
  98. ; Goes to the boss room
  99. Func GoToBoss()
  100.    Sleep(3000)
  101.    $found = False
  102.    while not $found
  103.       ; Looks for the blue door
  104.       $coord = PixelSearch(545, 178, 545, 178, 0x56A7F6, 30)
  105.       If Not @error Then
  106.          $found = True
  107.          Sleep(1000)
  108.  
  109.       Else
  110.          Sleep(10)
  111.       EndIf
  112.    WEnd
  113.    LookForReflection()
  114. EndFunc
  115.  
  116. ; Checks if there is a yellow xp bonus thing
  117. Func LookForReflection()
  118.    ; Looks for the yellow liquid
  119.    $coords = PixelSearch(1650, 700, 1850, 900, 0xE0AD1D, 20)
  120.    If Not @error Then
  121.       ; Go to it
  122.       Sleep(1000)
  123.       MouseClick("left", $coords[0], $coords[1], 1, 10)
  124.       Sleep(3000) ; Wait a bit
  125.       ;Searches back for the blue door
  126.       $coordDoor = PixelSearch(70, 0, 551, 253, 0x4070D9, 50)
  127.       If Not @error Then
  128.          sleep(1000)
  129.          MouseClick("left", $coordDoor[0], $coordDoor[1], 1, 10)
  130.       EndIf
  131.    Else
  132.       MouseClick("left", 545, 178, 1, 10)
  133.    EndIf
  134.    StartBoss()
  135. EndFunc
  136. ; Go into position for the boss
  137. Func StartBoss()
  138.    Sleep(1500)
  139.    $found = False
  140.    while not $found
  141.       ; Looks for candles in the top left corner
  142.       $coord = PixelSearch(50, 532, 50, 532, 0x504D2F, 30)
  143.       If Not @error Then
  144.          $found = True
  145.          Sleep(500)
  146.          ; Go at the bottom of the room
  147.          MouseClick("left", 840, 915, 2, 20)
  148.       Else
  149.          sleep(10)
  150.       EndIf
  151.    WEnd
  152.    BeatBoss()
  153. EndFunc
  154.  
  155. ; Fights the boss
  156. Func BeatBoss()
  157.    Sleep(2500) ; Waits for the player to arrive at the battle spot. Dont put this too low
  158.    $dead = False
  159.  
  160.    ; Use some spells
  161.    Send("1")
  162.    Sleep(200)
  163.    Send("2")
  164.    Sleep(200)
  165.    Send("3")
  166.    Sleep(200)
  167.    Send("4")
  168.  
  169.    MouseMove(940, 71)
  170.    MouseDown("right")
  171.    Sleep(200)
  172.    sleep($bossTimer)
  173.    while not $dead
  174.       ; Looks for loots
  175.       $coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $legend, 1)
  176.       If Not @error Then
  177.          $dead = True
  178.           MouseUp("right")
  179.          MouseClick("left", $coords[0], $coords[1], 1, 10)
  180.          Sleep(100)
  181.       Else
  182.          $coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $blue, 0)
  183.          If Not @error Then
  184.             $dead = True
  185.             MouseUp("right")
  186.             Sleep(100)
  187.          EndIf
  188.       EndIf
  189.       ; If nothing found (bug/dead/whatever), leaves the game after 60 seconds
  190.       if TimerDiff($start) > 60000 Then
  191.          $dead = True
  192.          MouseUp("right")
  193.       EndIf
  194.    WEnd
  195.    Loot()
  196. EndFunc
  197.  
  198. ; Get every loot
  199. Func Loot()
  200.    Sleep(2000)
  201.    $nothingToFind = false
  202.    while not $nothingToFind
  203.       $nothingToFind = True
  204.       if $pickupYellow Then
  205.          if LootItem($yellow) Then
  206.             $nothingToFind = false;
  207.          EndIf;
  208.       EndIf
  209.       Sleep(200)
  210.       If $pickupGem Then
  211.          If LootItem($gem) Then
  212.             $nothingToFind = false;
  213.          EndIf
  214.       EndIf
  215.       Sleep(200)
  216.       if $pickupLegend Then
  217.          If LootItem($legend) Then
  218.             $nothingToFind = False
  219.          EndIf
  220.          Sleep(200)
  221.          If LootItem($green) Then
  222.             $nothingToFind = False
  223.          EndIf
  224.       EndIf
  225.    WEnd
  226.    Sleep(500)
  227.    LootGold()
  228. EndFunc
  229.  
  230. Func  LootGold ()
  231.    Sleep(100)
  232.    MouseClick("left", 811, 0, 1, 10)
  233.    Sleep(1500)
  234.    MouseClick("left", 1274, 745, 1, 10)
  235.    Sleep(500)
  236.    if $instantLeave Then
  237.       tpTown()
  238.    Else
  239.       menuLeave()
  240.    EndIf
  241. EndFunc
  242. ; Loot function
  243. Func LootItem ($color)
  244.    $coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $color, 0)
  245.    If Not @error Then
  246.       MouseClick("left", $coords[0], $coords[1], 1, 10)
  247.       Sleep(1000)
  248.       return True;
  249.    Else
  250.       return False;
  251.    EndIf
  252. EndFunc
  253.  
  254. ; Teleport back to town
  255. Func tpTown ()
  256.    MouseClick("right", 675, 906, 1, 10)
  257.    Send("T")
  258.    Sleep(3000)
  259.    LeaveGame()
  260. EndFunc
  261.  
  262. ; Leaves the game with escape
  263. Func menuLeave()
  264.    send ("{ESCAPE}")
  265.    sleep(100)
  266.    MouseClick("left", 340, 473, 1, 10)
  267.    Sleep(3000)
  268. EndFunc
  269. ; Leaves the game with town portal
  270. Func LeaveGame ()
  271.    $inTown = False
  272.    while not $inTown
  273.       ; Deects Lea's room in town
  274.       $coords = PixelSearch(556, 267, 556, 267, 0xFCEE63, 30)
  275.       If Not @error Then
  276.          $inTown = True
  277.       Else
  278.          Sleep(10)
  279.       EndIf
  280.    WEnd
  281.    send ("{ESCAPE}")
  282.    sleep(100)
  283.    MouseClick("left", 340, 473, 1, 10)
  284.    Sleep(3000)
  285. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement