Code:
Opt('MouseCoordMode', 0)
Opt('PixelCoordMode', 0)
Opt('SendKeyDelay', 50) ; Default speed
HotKeySet('{END}', 'Quit')
HotKeySet('{F10}', 'Pause')
Global $Paused
Global $DebugOn = True
$Amethyst = 0xA56DF1
$Ruby = 0xFA8078
$Emerald = 0x51965B
$Topaz = 0xFFFF59
$Left = 64
$Top = 42
$Right = 720
$Bottom = 519
$Rare = 0xFFFF00 ; rare color
$Magic = 0x6969FF ; blue color
$Legendary = 0xBF642F ; legendary color
$Set = 0x00FF00 ; set color
; bot starts paused. press F10 to start.
Pause()
WinActivate('Diablo III')
While 1
If WinActive('Diablo III') Then
checkResume()
Sleep(Random(1500,1800))
Click(134, 255) ; click resume
Sleep(Random(6200,6600)) ; load
$repair = PixelSearch(579,49,584,53,0xFFF000,2) ; searches top right screen for broken armor
If (Not @error) Or (CheckInv() == 1) Then
InvRepair()
Else
Send('3')
Sleep(20)
Teleport()
Sleep(20)
Send('1')
Sleep(30)
$yellow = PixelSearch(643, 109, 698, 163, 0xF5CD37, 10) ; checks minimap for cellar
If Not @error Then ; found cellar
DEBUG("Cellar found")
Sleep(Random(100,150))
Move(66,435)
Move(134, 249)
Sleep(75)
$blue = PixelSearch(430, 132, 602, 267, 0x5D80DB, 5) ; gets position of cellar
If Not @error Then
MouseClick("left", $blue[0], $blue[1], 1, Random(6,7))
Sleep(Random(2000,2300))
EndIf
Sleep(200)
Move(126, 494)
Move(176, 252)
Click(349, 595) ; choose Hydra
Click(217, 171) ; cast Hydra
Shoot(131, 161, 2)
MouseClickDrag ( "right", 131, 171 , 260, 106, 11)
;MouseClickDrag ( "right", 131, 171 , 260, 106, 11)
Shoot(223, 170, 100)
Sleep(400)
Move(98, 146)
Sleep(300)
MouseClick('middle', 453, 281, 1, Random(0, 1))
Sleep(150)
MouseClick("right", 259, 549, 1, 2)
FindItem()
Send("{ESCAPE}") ; opens menu
Click(407,345) ; leaves
Sleep(100)
Click(134, 255)
Sleep(Random(12500,13000))
Else ; cellar not found
DEBUG("Cellar not found")
SafetyFirst() ; will go into archon and use skilll '2' to blow things up
Sleep(450)
Send("{ESCAPE}") ; opens menu
Click(407, 345) ; leaves
Sleep(100)
Click(134, 255)
Sleep(12500)
EndIf
EndIf
EndIf
WEnd
Func TownPortal()
Send('t')
Sleep(Random(7500,8200))
EndFunc
Func SafetyFirst()
Click(407, 345)
Send("4") ; Hydra
Sleep(100)
Send('1') ; Diamond Armor
Sleep(100)
Send("{SHIFTDOWN}")
MouseClick ( "left")
Send("{SHIFTUP}")
EndFunc
Func Move($x, $y)
MouseClick('middle', $x, $y, 1, Random(0, 1))
Sleep(1500)
EndFunc ;==>Move
Func checkResume()
Local $check = 0
While $check == 0
$resume = PixelSearch(63, 255, 83, 269, 0x2C0100,10)
If Not @error Then ; at menu, hits resume
$check = 1
DEBUG("RESUME")
Else
Sleep(200)
If CheckDisconnect() Then
Send("{ENTER}")
Sleep(800)
EndIf
EndIf
WEnd
EndFunc
Func Shoot($x, $y, $clicks)
MouseClick('right', $x, $y, $clicks, 2)
Sleep(Random(100, 150))
EndFunc ;==>Shoot
Func Teleport()
MouseMove(5, 199)
SendUntil('2', 2000)
Sleep(Random(50, 150))
EndFunc ;==>Teleport
Func CheckRare()
Send("{i}")
Sleep(100)
$unidRare1 = PixelSearch(772,463,790,500,0xFFFFFF,5) ; looks at the question mark which is white
$unidRare2 = PixelSearch(745,463,763,500,0xFFFFFF,5)
If (Not IsArray($unidRare1)) And (Not IsArray($unidRare2)) Then ; not a rare in last slot
Send("{i}")
Return 1
EndIf
; rare in last slot
Send("{i}")
Return 0
EndFunc
Func Click($x, $y)
MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1))
Sleep(Random(100, 140))
EndFunc ;==>Click
Func FindItem()
Sleep(50)
$work = 1
$checkCount = 0
$checkFull = 0
While $work == 1 And $checkCount <15
If CheckInv() == 1 Then ; full and cannot pickup remaining items
DEBUG("Inventory full, ending item finding")
ExitLoop
EndIf
DEBUG("Search Item")
$work = 0
$SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Rare) ; searches for rares
If Not @error Then
MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
Sleep(350)
$work = 1
$checkCount = $checkCount +1
EndIf
$SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Magic ) ; searches for magics
If Not @error Then
MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
Sleep(350)
$work = 1
$checkCount = $checkCount +1
EndIf
$SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Legendary ) ; searches for legendaries
If Not @error Then
MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
Sleep(350)
$work = 1
$checkCount = $checkCount +1
EndIf
$SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Set) ; searches for set
If Not @error Then
MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
Sleep(350)
$work = 1
$checkCount = $checkCount +1
EndIf
; search for gems
; $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Amethyst,9) ; searches for amethyst
; If Not @error Then
; MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
; Sleep(350)
; $work = 1
; $checkCount = $checkCount +1
; EndIf
; $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Ruby,6) ; searches for ruby
; If Not @error Then
; MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; clicks if found
; Sleep(350)
; $work = 1
; $checkCount = $checkCount +1
; EndIf
; $SearchResult = PixelSearch(382, 131, $Right, $Bottom, $Topaz,4) ;searches for topaz
; If Not @error Then
; MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
; Sleep(350)
; $work = 1
; $checkCount = $checkCount +1
; EndIf
; $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Emerald,9) ;searches for emerald
; If Not @error Then
; MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
; Sleep(350)
; $work = 1
; $checkCount = $checkCount +1
; EndIf
WEnd
If $checkFull == 1 Then
TownPortal()
EndIf
DEBUG("Finished Item Searching")
EndFunc
Func CheckDeath() ; returns 1 if dead
$death = PixelSearch(285, 491, 308, 508, 0x2C0100,2)
If @error Then ; not dead
Return 0
Else ; you died
DEBUG("DEAD")
Send("{ESCAPE}") ;opens menu
Sleep(400)
Click(407, 345) ;leaves
Sleep(100)
Click(134, 255)
Sleep(Random(12500,13420))
Return 1
EndIf
EndFunc
Func CheckDisconnect()
$status = PixelSearch(400, 375, 416, 385, 0xA76933, 2)
If @error Then
Return False
Else
Debug("Disconnected..")
Return True
EndIf
EndFunc
Func CheckInv() ; returns 1 if full
Send("{i}") ; opens inventory
Sleep(250)
; will check if any bottom 4 right-most boxes are occupied Rows 5 and 6, Columns 9 and 10.
$row5col9 = PixelSearch(763, 481, 765, 483, 0x100907,5)
$row5col10 = PixelSearch(789, 481, 791, 483, 0x100808,5)
$row6col9 = PixelSearch(763, 507, 765, 510, 0x100907,5)
$row6col10 = PixelSearch(789, 507, 791, 510, 0x100808,5)
If (Not IsArray($row5col10)) Or (Not IsArray($row6col10)) Or (Not IsArray($row5col9)) Or (Not IsArray($row6col9)) Then
DEBUG("FULL")
;Beep(1000, 1000)
Send("{i}")
Return 1
EndIf
Send("{i}") ; closes inventory
Return 0
EndFunc
Func InvRepair()
DEBUG("Going to repair")
$slot1x = 538 ; first slot x coordinate
$slot1y = 367 ; first slot y coordinate
$offset = 27 ; offset for each slot
TownPortal()
If InTown() == 1 Then ; TP interrupted, leave game before trying to repair because you are not in Town
Return
Else
Debug("In town, beginning repair trip")
If CheckRare() == 0 Then ; rare is in last of the 4 slots, need to store
MouseClick("left",465,172) ; clicks stash after town portal
Sleep(1000)
MouseClick("left",292,296) ; clicks third tab in stash
Sleep(600)
For $i = 756 To 782 Step 26
For $j = 474 To 497 Step 23
MouseClick("right",$i,$j, 1, Random(0,1)) ; stashes those possible rares in the bottom right corner
Next
Next
Send("{ESCAPE}") ; close stash
MouseClick("left", 686, 94) ; begins movement towards merchant
Sleep(2400)
MouseClick("left", 505, 153) ; clicks merchant
Sleep(1300)
Else ; no need to storage, move normally to merchant
MouseClick("left", 700, 147) ; begins movement towards merchant
Sleep(2400)
MouseClick("left", 531, 51) ; clicks merchant
Sleep(2800)
EndIf
For $i = 0 To 9
For $j = 0 To 5
MouseClick("right", $slot1x + ($i * $offset), $slot1y + ($j * $offset), 1, Random(0,1))
Sleep(Random(35,40))
Next
Next
Click(294, 296) ; open up repair menu
Sleep(200)
Click(186, 326) ; pay for repairs
Sleep(500)
$inBag = PixelSearch(780, 474, 782, 476, 0x130C08,5)
If @error Then
DEBUG("Not at shop")
Send("{ESCAPE}") ; opens menu
Sleep(400)
Click(407, 345) ; leaves
Sleep(100)
Click(134, 255)
Sleep(Random(7800,8200))
Else
Send("{ESCAPE}") ; closes shop
Sleep(50)
Send("{ESCAPE}") ; opens menu
Sleep(400)
Click(407, 345) ; leaves
Sleep(100)
Click(134, 255)
Sleep(Random(8000,8500))
EndIf
EndIf
EndFunc
Func InTown()
Sleep(100)
Debug("Checking if in town")
Sleep(180)
$check = PixelSearch(261,551,263,553,0xB17C2D,5)
If @error Then ; not in town
Debug("Not in town")
Send("{ESCAPE}") ; opens menu
Sleep(400)
Click(407, 345) ; leaves
Sleep(100)
Click(134, 255)
Sleep(Random(13000,13500))
Return 1
EndIf
Return 0 ; in town
EndFunc
Func Pause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip('Paused...', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>Pause
Func SendUntil($text, $milliseconds)
$time = TimerInit()
Do
Send($text)
Until TimerDiff($time) > $milliseconds
EndFunc
Func Quit()
Exit
EndFunc ;==>Quit
Func DEBUG($MESSAGE)
If $DebugOn Then
ToolTip($MESSAGE, 0, 0)
EndIf
EndFunc ;==>Debug Info