Advertisement
Shimizoki

Custom Looting

Jun 14th, 2012
3,822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 5.06 KB | None | 0 0
  1. ;Darkling Lord's CustomLooting v1.0.1 - 6/14/2012
  2. ;Installation Instructions: http://www.ownedcore.com/forums/diablo-3/diablo-3-bots-programs/356234-gold-item-farming-shimizokis-sarkoth-dh-script-autoit.html
  3. ;;;;;
  4. #include <ImageSearch.au3>
  5.  
  6. ;================SETTINGS================;
  7.  
  8. ;Looting
  9. $LootSets = True        ;True if you want to pick up Sets
  10. $LootLegendaries = True ;True if you want to pick up Legendaries
  11. $LootRares = True       ;True if you want to pick up Rares
  12. $LootMagic = True       ;True if you want to pick up Magic
  13. $LootGems = True        ;True if you want to pick up Gems
  14. $LootTomes = True       ;True if you want to pick up Tome of Secrets
  15. $LootCustom = True      ;True if you want to pick up Custom Items (The items in the pick array above)
  16.  
  17. ;Custom Loot
  18. $pngLoc = "D:\Users\Shimizoki\Desktop\D3 Stuff\AutoIt\Images\"  ;Location of the .PNGs
  19. $totalItems = 1             ;Number of items in the pick array
  20. Global $pick[$totalItems]   ;DONT CHANGE THIS
  21.  
  22. ;Array of items to loot
  23. $pick[0] = "mythic.png|40"  ;png|Tolerance
  24. ;$pick[1] = "item2.png"
  25. ;$pick[2] = "item3.png"i
  26.  
  27. ;===DO NOT CHANGE ANYTHING BELOW HERE===;
  28.  
  29. HotKeySet("x", "Stop") ;script stopped by pressing x
  30.  
  31. $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  32. $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  33. $tptime =   6900 ; time in ms the script waits for teleport before exiting the game
  34. $yellow =   0xFFF000 ; yellow color code (repair icon)
  35. $red =      0xD90000 ; red color code (repair icon)
  36.  
  37. ;Counts
  38. $LegendaryCount = 0
  39. $SetCount = 0
  40. $RareCount = 0
  41. $MagicCount = 0
  42. $GemCount = 0
  43. $TomeCount = 0
  44.  
  45. $go = True
  46. $Leave = False
  47. $Dead = False
  48. $Logout = False
  49. $Window = False
  50. $default_resolutionX = 1920
  51. $default_resolutionY = 1080
  52. $x_ratio = @Desktopwidth / $default_resolutionX
  53. $y_ratio = @Desktopheight / $default_resolutionY
  54. $i = 0
  55.  
  56. Call("Loot")
  57. Call("ShowLoot")
  58.  
  59. Func Loot()
  60.     Sleep(Random(500,2000))
  61.     ConsoleWrite("Looting" & @CRLF)
  62.     MouseMove(Round(Random(1400,1920)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  63.     If $LootSets == True Then
  64.         $SetCount += LootGear(0x02CE01, 2)
  65.     EndIf
  66.     If $LootLegendaries == True Then
  67.         $LegendaryCount += LootGear(0xBF642F, 0)
  68.     EndIf
  69.     If $LootRares == True Then
  70.         $RareCount += LootGear(0xBBBB00, 2)
  71.     EndIf
  72.     If $LootTomes == True Then
  73.         Call("LootTomes")
  74.     EndIf
  75.     If $LootMagic == True Then
  76.         $MagicCount += LootGear(0x6969FF, 2)
  77.     EndIf
  78.     If $LootGems == True Then
  79.         Call("LootGems")
  80.     EndIf
  81.     If $LootCustom == True Then
  82.         Call("LootCustom")
  83.     EndIf
  84. EndFunc
  85.  
  86. Func LootCustom()
  87.     $currentArrayItem = 0
  88.     $gX = 0
  89.     $gY = 0
  90.     for $i = 0 to ($totalItems - 1)
  91.         $array = StringSplit($pick[$i],"|")
  92.         $file = $array[1]
  93.         $accuracy = $array[2]
  94.         $urlString = $pngLoc & $file
  95.         ;ConsoleWrite("Looting " & $file & @CRLF)
  96.         While _ImageSearchArea($pngLoc & $file,1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,$accuracy)
  97.             MouseMove($gX, $gY, 3)
  98.             sleep(Random(75, 150))
  99.             MouseClick("left",$gX,$gY,1,1)
  100.             sleep(Random(800, 1200))
  101.             MouseMove(Round(Random(1400,1920)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  102.         WEnd
  103.     next
  104. EndFunc
  105.  
  106. Func LootGear($color, $tolerance = 2)
  107.     $count = 0
  108.     $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance) ; Magic loot (darker for compatibility)
  109.     If Not @error Then
  110.         While Not @error
  111.             $count += 1
  112.             MouseClick ('left', $Loot[0], $Loot[1])
  113.             Sleep(Random(700,900))
  114.             MouseMove(Round(Random(1400,1920)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  115.  
  116.             ;Run at max 10 times per quality
  117.             If $count >= 10 Then
  118.                 ExitLoop
  119.             EndIf
  120.  
  121.             $Loot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $color, $tolerance) ; Magic loot (darker for compatibility)
  122.         WEnd
  123.     EndIf
  124.     Return $count
  125. EndFunc
  126.  
  127. Func LootGems()
  128.     $gX = 0
  129.     $gY = 0
  130.  
  131.     While _ImageSearchArea($pngLoc & "square.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,115)
  132.         ;MouseMove($gX,$gY,3)
  133.         sleep(Random(75, 150))
  134.         MouseClick("left",$gX,$gY)
  135.         $GemCount += 1
  136.         sleep(Random(800, 1200))
  137.         MouseMove(Round(Random(1400,1920)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  138.     WEnd
  139. EndFunc
  140.  
  141. Func LootTomes()
  142.     $gX = 0
  143.     $gY = 0
  144.     $Start = 0
  145.     ;variables are all set, now onto the scan.
  146.  
  147.     While _ImageSearchArea($pngLoc & "tome.png",1,0,0,@DesktopWidth,@DesktopHeight,$gX,$gY,90)
  148.         ;MouseMove($gX,$gY,3)
  149.         sleep(Random(75, 150))
  150.         MouseClick("left",$gX,$gY)
  151.         $TomeCount += 1
  152.         sleep(Random(800, 1200))
  153.         MouseMove(Round(Random(1400,1920)*$x_ratio),Round(Random(700,1080)*$y_ratio),3) ;Moves mouse out of the way
  154.     WEnd
  155. EndFunc
  156.  
  157. Func ShowLoot()
  158.     ConsoleWrite(@CRLF & "Legendary:" & $LegendaryCount & " Set:" & $SetCount & " Rare:" & $RareCount & " Magic:" & $MagicCount & " Gem:" & $GemCount & " Tome:" & $TomeCount & @CRLF)
  159. EndFunc
  160.  
  161. Func Stop() ;to allow the script to stop
  162.     ShowLoot()
  163.     Exit
  164. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement