Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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(400)
- Click(134, 255) ; click resume
- Sleep(3800) ; 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")
- Move(66,435)
- Move(134, 249)
- Sleep(150)
- $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(1100)
- EndIf
- Sleep(350)
- 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, 47)
- Sleep(400)
- Move(98, 146)
- Sleep(300)
- MouseClick('middle', 453, 281, 1, Random(0, 1))
- Sleep(150)
- MouseClick("right", 259, 549, 1, 2)
- FindItem()
- TownPortal()
- Sleep(300)
- Send("{ESCAPE}") ; opens menu
- Sleep(Random(300,350))
- Click(407,345) ; leaves
- Sleep(Random(1990,2010))
- Else ; cellar not found
- DEBUG("Cellar not found")
- SafetyFirst() ; will go into archon and use skill '1' to blow things up
- TownPortal()
- Sleep(300)
- Send("{ESCAPE}") ; opens menu
- Sleep(400)
- Click(407, 345) ; leaves
- Sleep(2000)
- EndIf
- EndIf
- EndIf
- WEnd
- Func TownPortal()
- Send('t')
- Sleep(6600)
- EndFunc
- Func SafetyFirst()
- MouseClick("right", 500, 500, 1, Random(0, 1)) ; archon activation
- Sleep(380)
- Send('1') ; AoE skill 1
- Sleep(100)
- 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(100)
- 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")
- Sleep(200)
- Send("{ESCAPE}") ;opens menu
- Sleep(400)
- Click(407, 345) ;leaves
- Sleep(12000)
- 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(700)
- MouseClick("left",292,296) ; clicks third tab in stash
- Sleep(300)
- 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(12000)
- Else
- Send("{ESCAPE}") ; closes shop
- Sleep(50)
- Send("{ESCAPE}") ; opens menu
- Sleep(400)
- Click(407, 345) ; leaves
- Sleep(2000)
- EndIf
- EndIf
- EndFunc
- Func InTown()
- 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(12000)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement