#Region#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\Pictures\favicon.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_File_Add=image001.bmp, 2, 200
#AutoIt3Wrapper_Res_File_Add=logo.png, PNG, LOGO
#AutoIt3Wrapper_Res_File_Add=Start.png, PNG, START
#EndRegion
#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <GDIPlus.au3>
#Include <Icons.au3>
#Include <WinAPIEx.au3>
Opt("TrayAutoPause",0)
Global $fState
Global $fState2
HotKeySet('{F11}', '_HideShow')
HotKeySet('{F10}', '_HideShow2')
#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("World of the Rest - Click'er", 339, 169, 194, 114)
$Pic1 = GUICtrlCreatePic("", 0, 0, 339, 168)
GUICtrlSetState(-1, $GUI_DISABLE)
$Pic2 = GUICtrlCreatePic("", 215, 95,120, 70)
GUICtrlSetState(-1, $GUI_DISABLE)
$Login = GUICtrlCreateInput("", 120, 9, 130, 21, -1, 1)
$Pass = GUICtrlCreateInput("", 120, 36, 130, 23, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL), 1)
$Host = GUICtrlCreateInput("http://worldofrest.com.ua", 120, 65, 130, 21, -1, 1)
$Udar = GUICtrlCreateInput("1", 120, 91, 55, 21, -1, 1)
$Obnovlenie = GUICtrlCreateInput("5", 120, 117, 55, 21, -1, 1)
$ReLogin = GUICtrlCreateInput("30", 120, 143, 55, 21, -1, 1)
$Send = GUICtrlCreateButton("", 260, 9, 74, 51, $BS_BITMAP)
$Exit = GUICtrlCreateButton("", 260, 65, 74, 22)
$hInstance = _WinAPI_GetModuleHandle(0)
$hBitmap = _WinAPI_LoadBitmap($hInstance, 200)
_SetHImage($Pic1, $hBitmap)
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Startup()
$hImage = _LoadResourceImage($hInstance, "PNG", "LOGO")
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
_SetHImage($Pic2, $hBitmap)
_WinAPI_DeleteObject($hBitmap)
GUISetState()
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Send
Global $oLogin = (GUICtrlRead($Login))
Global $oPass = (GUICtrlRead($Pass))
Global $My_Host = (GUICtrlRead($Host))
Global $Udar_Wait = (GUICtrlRead($Udar))*1000
Global $Obn_Wait = (GUICtrlRead($Obnovlenie))*1000
Global $ReLogin_Wait = (GUICtrlRead($ReLogin))*60000
Global $oURL = $My_Host & '/wap/login.php?user_name=' & $oLogin & '&user_pass=' & $oPass
Win_Wor()
_Start()
GUISetState(@SW_HIDE, $GUI)
Case $Exit
_IEQuit ($oIE)
Exit
EndSwitch
WEnd
Func _Start()
If _CheckIfWordExist('Вы получили травму') = True Then
AdlibUnRegister('_Refresh')
AdlibUnRegister('_ReLogin')
AdlibUnRegister('_Click')
_HealTouch()
;Sleep(1000)
AdlibRegister('_Refresh', $Obn_Wait)
AdlibRegister('_ReLogin', $ReLogin_Wait)
AdlibRegister('_Click', $Udar_Wait)
Else
AdlibRegister('_Refresh', $Obn_Wait)
AdlibRegister('_ReLogin', $ReLogin_Wait)
AdlibRegister('_Click', $Udar_Wait)
EndIf
EndFunc
Func _HideShow2()
$fState2 = Not $fState2
If $fState2 Then
GUISetState(@SW_HIDE, $GUI)
Else
GUISetState(@SW_SHOW, $GUI)
EndIf
EndFunc
;##################################Script Functions#####################################
Func _ClickButton(ByRef $_Obj, $sName)
If Not IsObj($oIE) Then Return
If Not IsObj($_Obj) Then Return ;если $_Obj не $oIE
$oButtons = _IETagNameGetCollection($_Obj, 'input')
If @error Then Return
For $oButton In $oButtons
If $oButton.Name == $sName Then
_IEAction($oButton, "click")
If @error Then Return
_IELoadWait($oIE)
Return
EndIf
Next
EndFunc
Func _Refresh()
$random = Random(1, 6, 1)
If $random = 1 Then
$RandomURL = '/wap/main.php'
ElseIf $random = 2 Then
$RandomURL = '/wap/game.php'
ElseIf $random = 3 Then
$RandomURL = '/wap/inventar.php'
ElseIf $random = 4 Then
$RandomURL = '/wap/teritory.php'
ElseIf $random = 5 Then
$RandomURL = '/wap/face.php'
ElseIf $random = 6 Then
$RandomURL = '/wap/anekdots.php'
EndIf
_IENavigate($oIE, $My_Host & $RandomURL)
EndFunc
Func _ReLogin()
_IENavigate($oIE, $oURL)
EndFunc
Func _Click()
_ClickButton($oIE, 'bitvraga')
EndFunc
Func _HealTouch()
_IENavigate ($oIE, 'http://worldofrest.com.ua/wap/lechit.php?ID=13160656')
_IELoadWait ($oIE)
$FormLechit=_IEFormGetCollection($oIE,0)
$namelechit =_IEFormElementGetObjByName($oForm,"namelechit")
$kolres = _IEFormElementGetObjByName($oForm,"kolres")
_IEFormElementSetValue($namelechit,$oLogin)
_IEFormElementSetValue($kolres,"10")
_IEAction($FormLechit, "click")
EndFunc
Func _CheckIfWordExist($iWORD)
$iHTML = _IEDocReadHTML($oIE)
If StringInStr($iHTML, $iWORD) Then
Return True
Else
Return False
EndIf
EndFunc
;##################################End Script Functions##################################
; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
Func Win_Wor()
Local $GUIActiveX, $GUI_Button_Back, $GUI_Button_Forward
Local $GUI_Button_Home, $GUI_Button_Stop, $msg
Global $oIE
Global $WinIE
$oIE = ObjCreate("Shell.Explorer.2")
; Create a simple GUI for our output
$WinIE = GUICreate("World Of The Rest", 480, 320, 0 , 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
$GUIActiveX = GUICtrlCreateObj ($oIE, 0, 0, 480, 320)
GUISetState(@SW_HIDE, $WinIE) ;Show GUI
$oIE.navigate($oURL)
; Waiting for user to close the window
EndFunc ;==>Example
Func _HideShow()
$fState2 = Not $fState2
If $fState2 Then
GUISetState(@SW_HIDE, $WinIE)
Else
GUISetState(@SW_SHOW, $WinIE)
EndIf
EndFunc
#cs ----------------------------------------------------------------------------
Графические функции
#ce ----------------------------------------------------------------------------
Func _LoadResourceImage($hInstance, $sResType, $sResName, $iResLanguage = 0)
Local $hInfo, $hData, $pData, $iSize, $hMem, $pMem, $hStream, $hImage
If $iResLanguage Then
$hInfo = _WinAPI_FindResourceEx($hInstance, $sResType, $sResName, $iResLanguage)
Else
$hInfo = _WinAPI_FindResource($hInstance, $sResType, $sResName)
EndIf
$hData = _WinAPI_LoadResource($hInstance, $hInfo)
$iSize = _WinAPI_SizeOfResource($hInstance, $hInfo)
$pData = _WinAPI_LockResource($hData)
If @error Then
Return SetError(1, 0, 0)
EndIf
$hMem = DllCall("kernel32.dll", "ptr", "GlobalAlloc", "uint", 2, "ulong_ptr", $iSize)
If @error Then
Return SetError(1, 0, 0)
EndIf
$pMem = DllCall("kernel32.dll", "ptr", "GlobalLock", "ptr", $hMem[0])
If @error Then
Return SetError(1, 0, 0)
EndIf
DllCall("kernel32.dll", "none", "RtlMoveMemory", "ptr", $pMem[0], "ptr", $pData, "ulong_ptr", $iSize)
DllCall("kernel32.dll", "int", "GlobalUnlock", "ptr", $hMem[0])
$hStream = _WinAPI_CreateStreamOnHGlobal($hMem[0])
If @error Then
Return SetError(1, 0, 0)
EndIf
_GDIPlus_Startup()
$hImage = DllCall("gdiplus.dll", "uint", "GdipCreateBitmapFromStream", "ptr", $hStream, "ptr*", 0)
If (@error) Or ($hImage[0]) Or (Not $hImage[2]) Then
$hImage = 0
EndIf
_GDIPlus_Shutdown()
DllCall("kernel32.dll", "ptr", "GlobalFree", "ptr", $hMem[0])
If Not IsArray($hImage) Then
Return SetError(1, 0, 0)
EndIf
Return $hImage[2]
EndFunc ;==>_LoadResourceImage