Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;IF YOU PLAN TO USE IMAGESEARCH FUNCTIONS:
- ;Download: http://www.mediafire.com/?vtx9l1woj61h8r6
- ;If your Windows installation is x64, use the 64-bit native AutoIt and the x64 directory in the archive
- ;Extract and copy AutoIt3 folder to Program Files directory
- ;Extract and copy all dlls to C:\Windows\ directory (optionally copy the MSVCR dlls to System32 as well)
- ;Extract pics directory anywhere and update the $directory var - INCLUDE TRAILING BACKSLASH: C:\pics\
- ;If you are running anything but fullscreen mode, the size of letters will mismatch and not loot anything. Resize or make your own pngs.
- ;IF YOU COMPILE THE SCRIPT TO EXE AND YOU USE X64:
- ;Run "Compile script to .exe (x64)"
- ;Check "Lowest" under the Compression menu option
- ;Leave x64 checkbox checked
- ;;;;;
- ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
- ;Required build: http://us.battle.net/d3/en/calculator/barbarian#WTXYQg!ZVg!abcZaY
- ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
- ;Official supported resolution: 1920x1080
- ;;;;;
- ;Original: [Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
- ;ImageSearch contributions by rvbfreak, goofinator, and asuRob
- #include <ImageSearch.au3> ;comment this if you are not using the new looting system
- Global $Paused
- Opt('MouseCoordMode', 2)
- Opt('PixelCoordMode', 2)
- HotKeySet("=","Leave") ;script started by pressing =
- HotKeySet("-", "Pause") ;script paused by pressing -
- HotKeySet("x", "Stop") ;script stopped by pressing x
- ;ImageSearch Looting Variables
- $ImgLoot = True ; set this to true if you want to use ImageSearch looting system. False will revert to old PixelSearch method
- $directory = "C:\Program Files (x86)\AutoIt3\pics\" ; CHANGE THIS! Point it to the directory with the imagesearch pngs
- $totalItems = 17; This needs to match the number of pngs you are loading
- Global $pick[$totalItems], $size = WinGetClientSize("[TITLE:Diablo III; CLASS:D3 Main Window Class]"), $go = True, $Leave = False, $Dead = False, $Logout = False, $Window = False, $i = 0, $currentArrayItem = 0, $gX = 0, $gY = 0
- If ($size[0]/$size[1]) <> 16/9 Then $size[1]-=30 ; adjusts ratio for titlebar if not 16:9
- $pick[0] = "legendaryA.png|30"
- $pick[1] = "legendaryE.png|30"
- $pick[2] = "legendaryI.png|10"
- $pick[3] = "legendaryO.png|30"
- $pick[4] = "legendaryU.png|30"
- $pick[5] = "setA.png|30"
- $pick[6] = "setE.png|30"
- $pick[7] = "setU.png|30"
- $pick[8] = "setO.png|30"
- $pick[9] = "setI.png|30"
- $pick[10] = "rareA.png|30"
- $pick[11] = "rareE.png|30"
- $pick[12] = "rareI.png|30"
- $pick[13] = "rareO.png|30"
- $pick[14] = "rareU.png|30"
- $pick[15] = "uare.png|40"
- $pick[16] = "tome.png|30"
- $LootRares = True ; set this to false if you don't want the bot to pick up rares (old looting method only)
- $Timer = False ; set this to true and the bot will randomly wait (5% chance) in town for 30-60 seconds before starting over
- $walktime = 2600 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
- $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
- $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
- $x_ratio = $size[0] / 1920
- $y_ratio = $size[1] / 1080
- $yellow = 0xFFF000 ; yellow color code (repair icon)
- $red = 0xD90000 ; red color code (repair icon)
- Call("RestartRun")
- Func RestartRun()
- While $go
- if($Leave) Then
- $i = 0
- Call("CheckExit")
- Sleep(850) ;had to add this since the icon doesn't show up RIGHT away in game
- Call("CheckDead")
- Call("CheckRepair")
- If $Window Then
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False
- ExitLoop
- ElseIf $Dead or $Logout Then
- ExitLoop
- EndIf
- MouseClick("middle", Round(587 * $x_ratio),Round(333 * $y_ratio)) ;starts the main run
- Sleep(1090)
- MouseMove(Round(96*$x_ratio),Round(383*$y_ratio),1)
- Sleep(10)
- Send("1")
- Sleep(800)
- MouseClick("middle", Round(56 * $x_ratio),Round(290 * $y_ratio))
- Sleep(2900)
- MouseMove(Round(320*$x_ratio),Round(205*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(600)
- Call("CheckDead")
- If $Window Then
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False
- ExitLoop
- ElseIf $Dead or $Logout Then
- ExitLoop
- EndIf
- $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
- If Not @error Then
- MouseClick("left",Round(320*$x_ratio),Round(205*$y_ratio)) ;Entrance to cellar
- Sleep(1400)
- Sleep($walktime)
- MouseClick("middle",Round(80*$x_ratio),Round(830*$y_ratio)) ;moves to doorway leading to rare inside cellar
- Sleep(2500)
- MouseMove(Round(350*$x_ratio),Round(60*$y_ratio),1) ;hovers over the rare Sarkoth
- Sleep(5)
- Send("1")
- Sleep(10)
- MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
- Sleep(140)
- MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
- Sleep(140)
- MouseClick("right",Round(0*$x_ratio),Round(0*$y_ratio))
- Sleep(1000)
- Send("2")
- Sleep(120)
- Send("2")
- Sleep(120)
- Send("2")
- Sleep(120)
- Send("2")
- Sleep(120)
- Send("3")
- Sleep(120)
- Send("3")
- Sleep(120)
- Send("3")
- Sleep(120)
- Send("3")
- Sleep(140)
- Send("4")
- Sleep(140)
- Send("4")
- Sleep(140)
- Send("4")
- Sleep(1550)
- MouseClick("middle",Round(750*$x_ratio),Round(555*$y_ratio)) ;move to left top corner for gold
- Sleep(1000)
- MouseClick("middle",Round(1175*$x_ratio),Round(350*$y_ratio)) ;move to right top corner for gold
- Sleep(1000)
- MouseClick("middle",Round(1020*$x_ratio),Round(773*$y_ratio)) ;move to middle before looting
- Sleep(1000)
- MouseClick("middle",Round(900*$x_ratio),Round(400*$y_ratio)) ;move to chest middle
- Call("CheckLoot")
- Send("t")
- Sleep($tptime)
- Call("RandomSleep")
- Call("CheckDead")
- If Not $Logout And Not $Dead And Not $Window Then
- Sleep(300)
- Send("{ESCAPE}") ;menu
- Sleep(200)
- MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
- Sleep($loadtime)
- Call("CheckDead")
- If Not $Logout Then
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndIf
- Else
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False ; reset the flag so it doesn't think a window is always up
- EndIf
- Else
- Sleep(40)
- Send("t")
- Sleep($tptime)
- Call("RandomSleep")
- Call("CheckDead")
- If Not $Logout And Not $Dead And Not $Window Then
- Sleep(300)
- Send("{ESCAPE}") ;menu
- Sleep(200)
- MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
- Sleep($loadtime)
- Call("CheckDead")
- If Not $Logout Then
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndIf
- Else
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False ; reset the flag so it doesn't think a window is always up
- EndIf
- EndIf
- EndIf
- WEnd
- Call("RestartRun")
- EndFunc
- Func CheckDead()
- Call("CheckWindow")
- $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
- If Not @error Then
- If Not $Window Then
- $Dead = True
- Sleep(100)
- Send("{Escape}")
- Sleep(10)
- MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
- Sleep(11000)
- Sleep($loadtime)
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- Else
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Dead = False
- EndIf
- Else
- $Dead = False
- EndIf
- $LogoutTimerCancel = PixelSearch(Round(900*$x_ratio), Round(240*$y_ratio), Round(1010*$x_ratio), Round(290*$y_ratio), 0x993827) ; checks for cancel button on logout timer
- If Not @error Then
- Sleep(11000)
- Sleep($loadtime)
- If Not $Window Then
- $Dead = True
- $Logout = True
- Sleep($loadtime)
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- Else
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Logout = False
- EndIf
- Else
- $Logout = False
- EndIf
- EndFunc
- Func CheckWindow()
- $CloseButton = PixelSearch(Round(1570*$x_ratio), Round(110*$y_ratio), Round(1590*$x_ratio), Round(120*$y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window
- If Not @error Then
- Sleep(200)
- Send("{SPACE}") ;close any open windows
- $Window = True
- Else
- $Window = False
- EndIf
- EndFunc
- Func CheckExit()
- $ExitButton = PixelSearch(Round(1190*$x_ratio), Round(400*$y_ratio), Round(1200*$x_ratio), Round(440*$y_ratio), 0x14100E) ; checks for the grey border of the exit prompt
- If Not @error Then
- Send("{ESCAPE}")
- Sleep(100)
- Send("{SPACE}") ;close any open windows
- Sleep(200)
- MouseMove(1,1) ; reset cursor position before checking for button
- $Resume = Hex(PixelGetColor(Round(140*$x_ratio), Round(420*$y_ratio)), 6) ; checks if resume button can be pressed
- If $Resume == "400900" Or $Resume == "380900" Then
- Sleep(200)
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndIf
- EndIf
- EndFunc
- Func CheckRepair()
- $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
- If Not @error Then
- Call("DoRepair")
- EndIf
- $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
- If Not @error Then
- Call("DoRepair")
- EndIf
- EndFunc
- Func DoRepair()
- Sleep(100)
- Send("t")
- Sleep($tptime)
- MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
- Sleep(1500)
- MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
- Sleep(1500)
- MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
- Sleep(1200)
- MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
- Sleep(400)
- MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
- Sleep(200)
- Call("CheckDead")
- If Not $Dead and Not $Logout Then
- Send("{ESCAPE}") ;closes repair tab
- Sleep(100)
- Send("{ESCAPE}") ;menu
- Sleep(10)
- MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
- Sleep($loadtime)
- MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndIf
- EndFunc
- Func CheckLoot()
- MouseMove(14,14,0)
- Sleep(Random(500,2000))
- If Not $ImgLoot Then
- $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1900*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
- If Not @error Then
- MouseClick ('left', $SetLoot[0], $SetLoot[1], 1, 0)
- Sleep(Random(1000,1200))
- MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1900*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
- If Not @error Then
- MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1], 1, 0)
- Sleep(Random(1000,1200))
- MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- If $LootRares Then
- $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1900*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
- If Not @error Then
- MouseClick ('left', $RareLoot[0], $RareLoot[1], 1, 0)
- Sleep(Random(1000,1200))
- MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- EndIf
- Else
- Call("pickItems")
- EndIf
- EndFunc
- Func pickItems()
- $currentArrayItem = 0
- For $gI = 0 to ($totalItems - 1)
- $array = StringSplit($pick[$gI],"|")
- $file = $array[1]
- $accuracy = $array[2]
- $urlString = $directory & $file
- $Target = _ImageSearchArea($urlString,1,0,0,Round(1920*$x_ratio),Round(1080*$y_ratio),$gX,$gY,$accuracy)
- While $i <= 12 ; max: 13 gems and pieces of gear to loot
- If $Target And ($gX > 15) And ($gY > 15) Then
- ;MsgBox(4096,"Debug",$urlString & " " & $gX & "-" & $gY)
- MouseClick("left", $gX, $gY, 1, 0)
- Sleep(Random(1200,1400))
- MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
- Sleep(5)
- $Target = _ImageSearchArea($urlString,1,0,0,Round(1920*$x_ratio),Round(1080*$y_ratio),$gX,$gY,$accuracy)
- $i+= 1
- Else
- ExitLoop
- EndIf
- WEnd
- Next
- EndFunc
- Func RandomSleep()
- If $Timer And Random(1,20) = 20 Then
- Sleep(Random(30000,60000)
- EndIf
- EndFunc
- Func Pause()
- $Leave = False
- EndFunc
- Func Stop() ;to allow the script to stop
- Exit
- EndFunc
- Func Leave()
- $Leave = True
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement