Code:
#include <Array.au3>
#include <ImageSearch.au3>
#include "image_get_info.au3"
HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "End")
Global $playername = "ath"
While 1
Sleep(100)
WEnd
Func Start()
; List D3 windows + handles
$dClients = WinList("[CLASS:D3 Main Window Class]")
; Resume with the first client in the array, this being the (last) active client
;Resume($dClients[1][1])
;Resume($dClients[2][1])
While 1
$timer = TimerInit()
;Sleep until logged in
Do
Sleep(100)
Until LoginCheck($dClients[1][1]) = 1
; Invite the leecher
InviteParty($dClients[1][1])
ErrorCheck($dclients[2][1])
AcceptInvite($dClients[2][1])
; Sleep until the "leader" gets the 2nd party frame
Do
Sleep(100)
Until PartyCheck($dClients[1][1]) = 1
LeaveGame($dClients[2][1])
Sleep(4000)
LeaveGame($dClients[1][1])
; Resume with "Leecher"
Resume($dClients[2][1])
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
AdriaCheck($dClients[2][1])
; Check for quest popup & spam SPACE 4 times
Local $counter = 0
Do
Sleep(100)
$counter += 1
Until PopupCheck($dclients[2][1]) = 1 ;Or $counter == 50
;ConsoleWrite(TimerDiff($timer) / 1000 & @CRLF)
;If $counter == 50 Then
;SLeep(100)
;Else
For $i = 0 to 3
ErrorCheck($dclients[2][1])
Send("{SPACE DOWN}")
ErrorCheck($dclients[2][1])
Sleep(100)
Send("{SPACE UP}")
ErrorCheck($dclients[2][1])
Sleep(100)
Next
;EndIf
WEnd
EndFunc ;==>Start
Func Resume($handle)
Local $dClient
$dClient = WinGetPos($handle)
If not (WinActive($handle)) Then
WinActivate($handle)
WinWaitActive($handle)
EndIf
While 1
If Hex(PixelGetColor($dClient[0] + 170, $dClient[1] + 255)) = "00190400" Then
Sleep(500)
MouseClick("primary", $dClient[0] + 130 + Random(1, 40), $dClient[1] + 255 + Random(1, 3), 1, 2)
ExitLoop
EndIf
WEnd
;~ ConsoleWrite("Resumed. Run #" & $r & @CRLF)
EndFunc ;==>Resume
Func PartyCheck($handle)
Local $dClient
$dClient = WinGetPos($handle)
If not (WinActive($handle)) Then
WinActivate($handle)
WinWaitActive($handle)
EndIf
;MouseMove($dClient[0] + 13, $dClient[1] + 407)
;sleep(100)
;MsgBox(0, "", Hex(PixelGetColor($dClient[0] + 13, $dClient[1] + 407)))
If Hex(PixelGetColor($dClient[0] + 13, $dClient[1] + 407)) = "001D1A17" 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
Send("{ESC DOWN}")
Sleep(100)
Send("{ESC UP}")
Sleep(700)
MouseClick("primary", $dClient[0] + 330 + Random(1, 5, 1), $dClient[1] + 340 + Random(1, 5, 1), 1, 1)
Sleep(700)
MouseClick("primary", $dClient[0] + 310 + Random(1, 5, 1), $dClient[1] + 370 + Random(1, 5, 1), 1, 1)
Sleep(700)
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(500)
FindandClick()
Send("{O DOWN}")
Sleep(100)
Send("{O UP}")
Sleep(500)
EndFunc ;==>InviteParty
Func AcceptInvite($handle)
Local $dClient
$dClient = WinGetPos($handle)
If not (WinActive($handle)) Then
WinActivate($handle)
WinWaitActive($handle)
EndIf
sleep(500)
ErrorCheck($handle)
MouseClick("primary", $dClient[0] + 701, $dClient[1] + 546)
Sleep(300)
ErrorCheck($handle)
MouseClick("primary", $dClient[0] + 360, $dClient[1] + 382)
EndFunc ;==>AcceptInvite
Func FindandClick()
Global $playername
$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
$slots = 5
$x = $dClient[0] + 537
$y = $dClient[1] + 211
$x2 = $dClient[0] + 761
$y2 = $dClient[1] + 239
$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
$b = $player[2]-4
$c = $player[1]+7+$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
$b = $test[2]-4
$c = $test[1]+7+$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
EndIf
MouseClick("secondary", $player[1], $player[2])
Sleep(500)
MouseClick("primary", $player[1] + 77, $player[2] + 60)
EndFunc
Func LoginCheck($handle)
Local $dClient
$dClient = WinGetPos($handle)
If not (WinActive($handle)) Then
WinActivate($handle)
WinWaitActive($handle)
EndIf
If Hex(PixelGetColor($dClient[0] + 30, $dClient[1] + 522)) = "00FFCB8C" Then
;~ ConsoleWrite("Logged in." & @CRLF)
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
Local $coord = PixelSearch(30, 30, 160, 110, 0x3B2621, 3)
If Not @error Then
MouseMove($coord[0], $coord[1])
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
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
;MouseMove($dClient[0] + 400, $dClient[1] + 267)
;MsgBox(0, "", Hex(PixelGetColor($dClient[0] + 400, $dClient[1] + 267)))
If Hex(PixelGetColor($dClient[0] + 400, $dClient[1] + 267)) = "00B97203" Then
MouseClick("primary", $dClient[0] + 390, $dClient[1] + 382)
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
;~ ConsoleWrite("Popup." & @CRLF)
Return 1
Else
Return 0
EndIf
EndFunc ;==>PopupCheck
Func End()
Exit 0
EndFunc ;==>End