#include <ImageSearch2015.au3>
#include <File.au3>
DllCall("User32.dll", "bool", "SetProcessDPIAware")
Global $isInvite = true ; Приглашать игроков в клан true = да | false = нет / $CmdLine[3]
; Проверка ключа активации
;$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
;$oHTTP.Open("GET", "https://api.wot-stats.ru/api/activation/activate/" & $CmdLine[1] & "/" & $CmdLine[2], False)
;$oHTTP.Send()
;$oStatusCode = $oHTTP.Status
;If $oStatusCode > 200 Or $oStatusCode < 200 then
; MsgBox(4096, 'Сообщение', 'Ошибка активации!')
; Stop()
;EndIf
;$hWnd = WinWait("WoT Client", "", 10)
;If Not $hWnd Then
; MsgBox(4096, 'Сообщение', 'Окно не найдено, завершаем работу скрипта')
; Exit
;EndIf
; Активация окна танков!
WinActivate("WoT Client")
Opt("MouseClickDelay", 1000)
Opt("MouseClickDownDelay", 500)
HotKeySet("{f5}","Stop")
; Отправка сообщения игроку и приглашение в клан.
$x1=0
$y1=0
$Text = FileReadToArray("players.txt")
$Msg = FileReadLine("private-msg.txt", 1)
For $i = 1 To _FileCountLines('players.txt')
do
$res = _ImageSearch("static/contacts.png",1,$x1,$y1, 0)
until $res = 1
if $res=1 Then
MouseMove($x1,$y1,3)
Sleep(1000)
MouseClick("left", $x1,$y1, 1)
EndIf
Sleep(1000)
Send("{tab}")
Sleep(3000)
Send($Text[$i-1])
Sleep(3000)
Send("{ENTER}")
do
$result = _ImageSearch("static/playerIcon.png",1,$x1,$y1, 0)
until $result = 1
if $result=1 Then
MouseMove($x1,$y1,3)
Sleep(1000)
MouseClick("right", $x1,$y1)
EndIf
if $isInvite = true then
$timer=timerInit()
do
$result = _ImageSearch("static/sendMsg.png",1,$x1,$y1, 0)
until $result = 1
if $result=1 Then
MouseMove($x1,$y1,3)
Sleep(1000)
MouseClick("left", $x1,$y1)
EndIf
Sleep(1000)
Send($Msg)
Sleep(1000)
Send("{ENTER}")
EndIf
do
$result = _ImageSearch("static/playerDot.png",1,$x1,$y1, 0)
until $result = 1
if $result=1 Then
MouseMove($x1,$y1,3)
Sleep(1000)
MouseClick("right", $x1,$y1)
EndIf
do
$result = _ImageSearch("static/clanInvite.png",1,$x1,$y1, 0)
until $result = 1 Or TimerDiff($timer)>=5000
if $result=1 Then
MouseMove($x1,$y1,3)
Sleep(1000)
MouseClick("left", $x1,$y1)
EndIf
do
$result = _ImageSearch("static/closeChat.png",1,$x1,$y1, 0)
until $result = 1
if $result=1 Then
MouseMove($x1,$y1,3)
Sleep(1000)
MouseClick("left", $x1,$y1)
EndIf
Next
Stop()
Func Stop()
Exit
EndFunc