Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Array.au3>
- #include "image_get_info.au3"
- HotKeySet("{F1}", "Start")
- HotKeySet("{F2}", "End")
- ; Toon name, check bmps for supported letter, lowercase only
- Global $playername = ""
- ; number of friend slost to search for the leecher
- Global $slots = 5
- ; Set this to true just to use slot 1, the above are not used if this is true.
- Global $useSlot1 = True
- Global $noquest = False
- Global $error = True
- While 1
- Sleep(100)
- WEnd
- Func Start()
- ; List D3 windows + handles
- $dClients = WinList("[CLASS:D3 Main Window Class]")
- While 1
- ;Sleep until logged in
- Do
- Sleep(100)
- Until LoginCheck($dClients[1][1]) = 1
- ; Invite the leecher
- InviteParty($dClients[1][1])
- If Not $error And Not $noquest Then
- Do
- ErrorCheck($dClients[2][1])
- sleep(100)
- Until $error
- EndIf
- $noquest = False
- $error = False
- AcceptInvite($dClients[2][1])
- ; Sleep until the pop appears saying someone has joined.
- Do
- Sleep(100)
- Until PartyCheck($dClients[1][1]) = 1
- LeaveGame($dClients[2][1])
- LeaveParty($dClients[2][1])
- WaitforCrown($dClients[2][1])
- Resume($dClients[2][1])
- LeaveGame($dClients[1][1])
- ; Resume with "Leecher"
- Resume($dClients[1][1])
- ; Sleep until logged in
- Do
- Sleep(100)
- Until LoginCheck($dClients[2][1]) = 1
- ; Check where Adria is at & click on her when found
- ErrorCheck($dclients[2][1])
- AdriaCheck($dClients[2][1])
- Local $counter = 0
- Do
- Sleep(100)
- ErrorCheck($dclients[2][1])
- $counter += 1
- Until PopupCheck($dclients[2][1]) = 1 Or $counter == 50
- If $counter == 50 Then
- Send("{SPACE DOWN}")
- Sleep(100)
- Send("{SPACE UP}")
- $noquest = True
- Else
- For $i = 0 to 4
- ErrorCheck($dClients[2][1])
- Send("{SPACE DOWN}")
- ErrorCheck($dClients[2][1])
- Sleep(200)
- Send("{SPACE UP}")
- ErrorCheck($dClients[2][1])
- Sleep(200)
- Next
- EndIf
- WEnd
- EndFunc ;==>Start
- Func WaitforCrown($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- Do
- $search = _ImageSearch(@ScriptDir & "\loggedout", $dClient[0] + 32, $dClient[1] + 593, $dClient[0] + 43, $dClient[1] + 607, "TRANSBLACK", 70, 1, 0)
- Sleep(100)
- Until IsArray($search)
- Do
- $crown = PixelSearch($dClient[0] + 582, $dClient[1] + 433, $dClient[0] + 604, $dClient[1] + 545, 0xFFC021, 10)
- sleep(100)
- Until Not IsArray($crown)
- Sleep(1000)
- EndFunc
- Func Resume($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- While 1
- $resume = PixelSearch($dClient[0] + 95, $dClient[1] + 257, $dClient[0] + 182, $dClient[1] + 270, 0xDA954A, 3)
- $resume2 = PixelSearch($dClient[0] + 95, $dClient[1] + 257, $dClient[0] + 182, $dClient[1] + 270, 0xCFBDBA, 3)
- If IsArray($resume) or IsArray($resume2) Then
- Sleep(500)
- MouseMove($dClient[0] + 130, $dClient[1] + 255,0)
- MouseClick("primary", $dClient[0] + 130, $dClient[1] + 255)
- ExitLoop
- EndIf
- WEnd
- EndFunc ;==>Resume
- Func LeaveParty($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- While 1
- $search = _ImageSearch(@ScriptDir & "\loggedout", $dClient[0] + 32, $dClient[1] + 593, $dClient[0] + 43, $dClient[1] + 607, "TRANSBLACK", 70, 1, 0)
- If IsArray($search) Then
- ;MouseMove($dClient[0] + 410, $dClient[1] + 332,1)
- ;Sleep(300)
- MouseClick("secondary", $dClient[0] + 410, $dClient[1] + 332)
- sleep(300)
- MouseMove($dClient[0] + 410 + 36, $dClient[1] + 332 + 96,0)
- MouseClick("primary", $dClient[0] + 410 + 36, $dClient[1] + 332 + 96)
- sleep(300)
- MouseMove($dClient[0] + 346, $dClient[1] + 381,0)
- MouseClick("primary", $dClient[0] + 346, $dClient[1] + 381)
- ExitLoop
- Else
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func PartyCheck($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- $search = _ImageSearch(@ScriptDir & "\entered", $dClient[0] + 13, $dClient[1] + 407, $dClient[0] + 237, $dClient[1] + 444, "TRANSBLACK", 70, 1, 0)
- If IsArray($search) Then
- Return 1
- Else
- Return 0
- EndIf
- EndFunc ;==>PartyCheck
- Func LeaveGame($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- sleep(100)
- Send("{ESC DOWN}")
- Sleep(100)
- Send("{ESC UP}")
- Sleep(100)
- $menu = _ImageSearch(@ScriptDir & "\menu", $dClient[0] + 380, $dClient[1] + 172, $dClient[0] + 433, $dClient[1] + 196, "TRANSWHITE", 70, 1, 0)
- If IsArray($menu) Then
- MouseMove($dClient[0] + 409, $dClient[1] + 352,0)
- MouseClick("primary", $dClient[0] + 409, $dClient[1] + 352)
- Sleep(200)
- $party = _ImageSearch(@ScriptDir & "\party", $dClient[0] + 425, $dClient[1] + 257, $dClient[0] + 486, $dClient[1] + 277, "TRANSWHITE", 70, 1, 0)
- If IsArray($party) Then
- MouseMove($dClient[0] + 299, $dClient[1] + 381,0)
- MouseClick("primary", $dClient[0] + 299, $dClient[1] + 381)
- EndIf
- EndIf
- EndFunc
- Func InviteParty($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- Send("{O DOWN}")
- Sleep(100)
- Send("{O UP}")
- Sleep(100)
- FindandClick()
- Send("{O DOWN}")
- Sleep(100)
- Send("{O UP}")
- EndFunc ;==>InviteParty
- Func AcceptInvite($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- Do
- ErrorCheck($handle)
- $accept = PixelSearch($dClient[0] + 693, $dClient[1] + 537, $dClient[0] + 709, $dClient[1] + 553, 0x2CAC00, 3)
- If IsArray($accept) Then
- ErrorCheck($handle)
- MouseMove($dClient[0] + 701, $dClient[1] + 546,0)
- MouseClick("primary", $dClient[0] + 701, $dClient[1] + 546)
- Sleep(500)
- MouseMove($dClient[0] + 360, $dClient[1] + 382,0)
- MouseClick("primary", $dClient[0] + 360, $dClient[1] + 382)
- EndIf
- Until IsArray($accept)
- EndFunc ;==>AcceptInvite
- Func FindandClick()
- $string = StringSplit($playername, "")
- $dClients = WinList("[CLASS:D3 Main Window Class]")
- $handle = $dClients[1][1]
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- $x = $dClient[0] + 537
- $y = $dClient[1] + 211
- $x2 = $dClient[0] + 761
- $y2 = $dClient[1] + 239
- If $useSlot1 Then
- MouseMove($dClient[0] + 598, $dClient[1] + 227,0)
- MouseClick("secondary", $dClient[0] + 598, $dClient[1] + 227)
- sleep(300)
- MouseMove($dClient[0]+ 598 + 77, $dClient[1] + 227 + 60,0)
- MouseClick("primary", $dClient[0]+ 598 + 77, $dClient[1] + 227 + 60)
- Else
- $counter = 1
- $scounter = 1
- Do
- Do
- $text = StringReplace(StringStripCR("\"), @LF, "") & $string[$counter]
- $player = _ImageSearch(@ScriptDir & $text, $x, $y, $x2, $y2, "TRANSWHITE", 70, 1, 0)
- $text2 = StringReplace(StringStripCR("\"), @LF, "") & $string[$counter] & ".bmp"
- $aInfo = _ImageGetInfo($text2)
- If IsArray($player) And $counter < $string[0] Then
- $p = _ImageGetParam($aInfo, "Width")
- $a = $player[1]+$p-1
- $b = $player[2]-6
- $c = $player[1]+10+$p
- $d = $player[2]+8
- $x = $player[1]+1
- Do
- $counter = $counter+1
- $text = StringReplace(StringStripCR("\"), @LF, "") & $string[$counter]
- $test = _ImageSearch(@ScriptDir & $text, $a, $b, $c, $d, "TRANSWHITE", 70, 1, 0)
- $text2 = @ScriptDir & StringReplace(StringStripCR("\"), @LF, "") & $string[$counter] & ".bmp"
- $aInfo = _ImageGetInfo($text2)
- If IsArray($test) Then
- $p = _ImageGetParam($aInfo, "Width")
- $a = $test[1]+$p-1
- $b = $test[2]-6
- $c = $test[1]+10+$p
- $d = $test[2]+8
- $x = $test[1]+1
- Else
- $counter = 1
- EndIf
- Until $counter == $string[0] Or $counter == 1
- EndIf
- Until $counter = $string[0] Or Not IsArray($player)
- $scounter = $scounter+1
- $x = $dClient[0] + 537
- $x2 = $dClient[0] + 761
- $y = $y+30
- $y2 = $y2+30
- Until $scounter > $slots Or $counter = $string[0]
- If IsArray($player) Then
- $x = $player[1]-150
- $y = $player[2]-10
- $x2 = $player[1]+150
- $y2 = $player[2]+20
- MouseMove($player[1], $player[2],0)
- MouseClick("secondary", $player[1], $player[2])
- Sleep(300)
- MouseMove($player[1] + 77, $player[2] + 60,0)
- MouseClick("primary", $player[1] + 77, $player[2] + 60)
- Else
- MsgBox(0, "Error", "Cannot find name specified")
- Exit
- EndIf
- EndIf
- EndFunc
- Func LoginCheck($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- if (UnableCheck($handle) = 1) Then
- Resume($handle)
- EndIf
- ErrorCheck($handle)
- $loggedin = _ImageSearch(@ScriptDir & "\loggedin", $dClient[0] + 22, $dClient[1] + 514, $dClient[0] + 38, $dClient[1] + 530, "TRANSBLACK", 70, 1, 0)
- ;~ ConsoleWrite("Logged in." & @CRLF)
- If IsArray($loggedin) Then
- Return 1
- Else
- Return 0
- EndIf
- EndFunc ;==>LoginCheck
- Func AdriaCheck($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- For $a = 0 To 6
- For $b = 0 To 1
- ErrorCheck($handle)
- Local $coord = PixelSearch($dClient[0] + 5, $dClient[1] + 25, $dClient[0] + 260, $dClient[1] + 160, 0x3B2621, 3)
- If Not @error Then
- ErrorCheck($handle)
- MouseMove($coord[0], $coord[1],0)
- Sleep(100)
- $adria = _ImageSearch(@ScriptDir & "\adria", $dClient[0] + 5, $dClient[1] + 25, $dClient[0] + 260, $dClient[1] + 160, "TRANSFF00FF", 85, 1, 0)
- If Not @error Then
- ErrorCheck($handle)
- MouseClick("primary", $coord[0], $coord[1])
- Return 1
- EndIf
- EndIf
- Next
- Next
- EndFunc ;==>AdriaCheck
- Func ErrorCheck($handle2)
- Local $dClient
- $dClient = WinGetPos($handle2)
- If not (WinActive($handle2)) Then
- WinActivate($handle2)
- WinWaitActive($handle2)
- EndIf
- $result = _ImageSearch(@ScriptDir & "\error", $dClient[0] + 385, $dClient[1] + 258, $dClient[0] + 430, $dClient[1] + 274, "TRANSFF00FF", 85, 1, 0)
- If IsArray($result) Then
- $error = True
- MouseMove($dClient[0] + 390, $dClient[1] + 382,0)
- MouseClick("primary", $dClient[0] + 390, $dClient[1] + 382)
- EndIf
- EndFunc ;==>PopupCheck
- Func UnableCheck($handle2)
- Local $dClient
- $dClient = WinGetPos($handle2)
- If not (WinActive($handle2)) Then
- WinActivate($handle2)
- WinWaitActive($handle2)
- EndIf
- $unable = _ImageSearch(@ScriptDir & "\unable", $dClient[0] + 357, $dClient[1] + 254, $dClient[0] + 473, $dClient[1] + 276, "TRANSFF00FF", 85, 1, 0)
- if IsArray($unable) Then
- MouseMove($dClient[0] + 390, $dClient[1] + 382,0)
- MouseClick("primary", $dClient[0] + 390, $dClient[1] + 382)
- return 1
- Else
- return 0
- EndIf
- EndFunc ;==>PopupCheck
- Func PopupCheck($handle)
- Local $dClient
- $dClient = WinGetPos($handle)
- If not (WinActive($handle)) Then
- WinActivate($handle)
- WinWaitActive($handle)
- EndIf
- ErrorCheck($handle)
- If Hex(PixelGetColor($dClient[0] + 283, $dClient[1] + 463)) = "00000000" Then
- Return 1
- Else
- Return 0
- EndIf
- EndFunc ;==>PopupCheck
- Func End()
- Exit 0
- EndFunc ;==>End
- Func _Imagesearch($file, $x1 = 0, $y1 = 0, $x2 = @DesktopWidth, $y2 = @DesktopHeight, $trans = "transblack", $variation = 60, $runs = 1, $behavior = 1)
- If $behavior > 3 Or $behavior < 0 Then $behavior = 1
- If $runs < 1 Or $behavior = 0 Then $runs = 1
- Dim $aCoords[$runs] = [99999]; just some number to make the _ArrayMax <-> _ArrayMin comparison work on it's first run
- $findImage = '*' & $trans & ' ' & '*' & $variation & ' ' & $file & ".bmp"
- if @AutoItX64 Then
- $dll = DllOpen("ImageSearchDLL_x64.dll")
- Else
- $dll = DllOpen("ImageSearchDLL.dll")
- EndIf
- While 1
- $result = DllCall($dll, "str", "ImageSearch", "int", $x1, "int", $y1, "int", $x2, "int", $y2, "str", $findImage)
- If $result[0] = "0" Then
- _ArrayPush($aCoords, 0, 1)
- Else
- _ArrayPush($aCoords, 1, 1)
- If $behavior = 1 Then ExitLoop
- EndIf
- If _ArrayMax($aCoords) == _ArrayMin($aCoords) Then ExitLoop
- Sleep(40)
- WEnd
- DllClose($dll)
- If $aCoords[0] = 1 Then
- $array = StringSplit($result[0], "|")
- Dim $aCoords[5] = [4, Int(Number($array[2])), Int(Number($array[3])), Int(Number($array[2])) + Int(Number($array[4]) / 2), Int(Number($array[3])) + Int(Number($array[5]) / 2)]
- Return ($aCoords)
- Else
- Return (0)
- EndIf
- EndFunc ;==>_Imagesearch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement