#include <IsPressedEx.au3>
WinWaitActive("Легенда: Наследие Драконов")
$StartCoordX = 250
$StartCoordY = 182
$EndCoordX = 998
$EndCoordY = 930
$SearchColor = 0xFF6BFF;0x4C7F3D
$Find = 0 ; переменная Нашел-Нет
$Hunt = 0 ; переменная локации
HotKeySet("!x", "_Quit")
$hU32_DllOpen = DllOpen("User32.dll")
CheckArea ()
Search()
While 1
$iRet = _IsPressedEx("[:ALLKEYS:]", $hU32_DllOpen)
Sleep(10)
WEnd
;Search()
Func Search()
$YSector = 0
$Find = 0
ToolTip("Начинаю поиск", 100, 300)
While $YSector <= 19 AND $Find <> 1
$XSector = 0
While $XSector <= 19 AND $Find <> 1
ToolTip("Сканирование", 100, 300)
$AlfaX = ($EndCoordX - $StartCoordX) / 20
$AlfaY = ($EndCoordY - $StartCoordY) / 20
$coord = PixelSearch( $StartCoordX+$AlfaX * $XSector, $StartCoordY+$AlfaY * $YSector, $StartCoordX+$AlfaX * ($XSector+1), $StartCoordY+$AlfaY * ($YSector+1), $SearchColor, 10 );
If Not @error Then
BusyTest ($coord[0], $coord[1])
EndIf
$XSector = $XSector + 1
WEnd
$YSector = $YSector + 1
WEnd
If $Find = 0 Then
HuntArea ()
EndIf
EndFunc
Func BusyTest ($Cord_X, $Cord_Y) ; проверка на занятость кустика
$busy = PixelSearch($Cord_X-30, $Cord_Y-30, $Cord_X+20, $Cord_Y+20, 0xFFEB00, 15)
If NOT @error Then
$Find = 0
Else
ToolTip("Найден!!!", 100, 300)
MouseMove($Cord_X , $Cord_Y)
Sleep(Random(100, 200))
MouseClick("left")
Sleep(Random(100, 200))
MouseClick("left")
$Find = 1
Sleep(Random(18000, 19000))
If PixelGetColor ( 656, 592 ) = 16777168 Then
MouseMove(623, 596)
Sleep(150)
MouseClick("left")
Sleep(800)
EndIf
Search()
EndIf
EndFunc
Func CheckArea ()
ToolTip("ПРоверка локации", 100, 300)
If PixelGetColor ( 596, 135 ) = 10354688 Then
$Hunt = 0
EndIf
If PixelGetColor ( 597, 149 ) = 10682368 Then
$Hunt = 1
EndIf
If PixelGetColor ( 622, 148 ) = 11927552 Then
$Hunt = 2
EndIf
If PixelGetColor ( 623, 137 ) = 11927552 Then
$Hunt = 3
EndIf
EndFunc
Func HuntArea ()
ToolTip("Переход...", 100, 300)
Select
Case $Hunt = 0
MouseMove(569, 155)
Sleep(Random(150, 200))
MouseClick("left")
Case $Hunt = 1
MouseMove(644, 158)
Sleep(Random(150, 200))
MouseClick("left")
Case $Hunt = 2
MouseMove(644, 135)
Sleep(Random(150, 200))
MouseClick("left")
Case $Hunt = 3
MouseMove(571, 137)
Sleep(Random(150, 200))
MouseClick("left")
EndSelect
$Hunt += 1
If $Hunt > 3 Then
$Hunt = 0
EndIf
Sleep( Random(500, 2000))
Search()
EndFunc
Func _Quit()
DllClose($hU32_DllOpen)
Exit
EndFunc