#RequireAdmin
#include <ScreenCapture.au3>
Global $iPause[3]
HotKeySet('{ESC}', '_Exit')
WinActivate("Stronghold Kingdoms - Europe 1")
$hWnd = WinGetHandle("Stronghold Kingdoms - Europe 1")
$sFileName_1 = @DesktopDir&'\Monahi.bmp'
$sFileName_2 = @DesktopDir&'\Ataka.bmp'
Sleep (1000)
Opt ( "MouseClickDelay", 1000)
AdlibRegister("_Check", 1000)
While 1
_Monahi()
_Razvedka()
_Ataka()
Sleep(250)
WEnd
Func _Monahi()
Local $hBmp
MouseClick('Left', 1244,90, 1)
MouseClick('Left', 1089, 136, 1)
$coord = PixelSearch(1047, 465, 1107, 475, 0x312836)
If Not @error Then
$hBmp = _ScreenCapture_CaptureWnd('', $hWnd)
_ScreenCapture_SaveImage($sFileName_1, $hBmp)
If Not $iPause[0] Then _Send_Email_Monahi ('На деревню идет монах', 'Монах')
EndIf
EndFunc
Func _Razvedka()
$coord = PixelSearch(1250, 80, 1262, 92, 0xFFFFF0)
If Not @error Then
MouseClick('Left', 1244,90, 1)
MouseClick('Left', 895, 134, 1)
$coord = PixelSearch(1047, 465, 1107, 475, 0x312836)
If Not @error Then
If Not $iPause[1] Then
_Send_Email_Razvedka ('Разведка вашей деревни', 'Разведка')
_Ataka()
EndIf
EndIf
EndIf
EndFunc
Func _Ataka()
Local $hBmp1
MouseClick('Left', 1244,90, 1)
MouseClick('Left', 830, 137, 1)
$coord = PixelSearch(1047, 465, 1107, 475, 0x312836)
If Not @error Then
$hBmp1 = _ScreenCapture_CaptureWnd('', $hWnd)
_ScreenCapture_SaveImage($sFileName_2, $hBmp1)
If Not $iPause[2] Then _Send_Email_Ataka('Ваша деревня атакована', 'Атака')
EndIf
EndFunc
Func _Send_Email_Monahi($Body, $Subject)
$FromAddress = 'name1@gmail.com'
$ToAddress = 'name2@gmail.com'
$Username = 'name1@gmail.com'
$Password = "1234"
$SMTPServer = 'smtp.gmail.com'
$Port = 465
$SSL = 1
$AddAttachment = ('C:\Users\Администратор\Desktop\Monahi.bmp')
$conf = "http://schemas.microsoft.com/cdo/configuration/"
$hMAIL = ObjCreate ("CDO.Message")
With $hMAIL
.From = $FromAddress
.To = $ToAddress
.Subject = $Subject
.TextBody = $Body
.AddAttachment ('C:\Users\Администратор\Desktop\Monahi.bmp')
EndWith
With $hMAIL.Configuration.Fields
.Item ($conf & "sendusing") = 2
.Item ($conf & "smtpauthenticate") = 1
.Item ($conf & "sendusername") = $Username
.Item ($conf & "sendpassword") = $Password
.Item ($conf & "smtpserver") = $SMTPServer
.Item ($conf & "smtpserverport") = $Port
.Item ($conf & "smtpusessl") = $SSL
.Update
EndWith
$hMAIL.Send
$iPause[0] = 30
EndFunc
Func _Send_Email_Razvedka($Body, $Subject)
$FromAddress = 'name1@gmail.com'
$ToAddress = 'name2@gmail.com'
$Username = 'name1@gmail.com'
$Password = "1234"
$SMTPServer = 'smtp.gmail.com'
$Port = 465
$SSL = 1
$conf = "http://schemas.microsoft.com/cdo/configuration/"
$hMAIL = ObjCreate ("CDO.Message")
With $hMAIL
.From = $FromAddress
.To = $ToAddress
.Subject = $Subject
.TextBody = $Body
EndWith
With $hMAIL.Configuration.Fields
.Item ($conf & "sendusing") = 2
.Item ($conf & "smtpauthenticate") = 1
.Item ($conf & "sendusername") = $Username
.Item ($conf & "sendpassword") = $Password
.Item ($conf & "smtpserver") = $SMTPServer
.Item ($conf & "smtpserverport") = $Port
.Item ($conf & "smtpusessl") = $SSL
.Update
EndWith
$hMAIL.Send
$iPause[1] = 30
EndFunc
Func _Send_Email_Ataka($Body, $Subject)
$FromAddress = 'name1@gmail.com'
$ToAddress = 'name2@gmail.com'
$Username = 'name1@gmail.com'
$Password = "1234"
$SMTPServer = 'smtp.gmail.com'
$Port = 465
$SSL = 1
$AddAttachment = ('C:\Users\Администратор\Desktop\Ataka.bmp')
$conf = "http://schemas.microsoft.com/cdo/configuration/"
$hMAIL = ObjCreate ("CDO.Message")
With $hMAIL
.From = $FromAddress
.To = $ToAddress
.Subject = $Subject
.TextBody = $Body
.AddAttachment ('C:\Users\Администратор\Desktop\Ataka.bmp')
EndWith
With $hMAIL.Configuration.Fields
.Item ($conf & "sendusing") = 2
.Item ($conf & "smtpauthenticate") = 1
.Item ($conf & "sendusername") = $Username
.Item ($conf & "sendpassword") = $Password
.Item ($conf & "smtpserver") = $SMTPServer
.Item ($conf & "smtpserverport") = $Port
.Item ($conf & "smtpusessl") = $SSL
.Update
EndWith
$hMAIL.Send
$iPause[2] = 30
EndFunc
Func _Check()
If $iPause[0] Then $iPause[0] -= 1
If $iPause[1] Then $iPause[1] -= 1
If $iPause[2] Then $iPause[2] -= 1
EndFunc
Func _Exit()
AdlibUnRegister("_Check")
Exit
EndFunc