#NoTrayIcon
#cs ----------------------------------------------------------------------------
Версия AutoIt: v3.3.6.1
Автор: SECTOR (aka TroubleBeat)
#ce ----------------------------------------------------------------------------
Global $app_Name = "Botva Bot (BoBo)", $app_Version = "0.1"
#include <GUIListBox.au3>
#include <GuiStatusBar.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <IE.au3>
#include <Date.au3>
Global $sEmail, $sPass, $sServer, $iStartGUI_Show = 1
Opt("GUIOnEventMode",1)
#Region === Start GUI ===
Global $hStartGUI = GUICreate("Вход в ботву", 293, 167, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUICtrlCreateLabel("Вход в Ботву:", 10, 10, 270, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlSetColor(-1, 0x800000)
GUICtrlCreateLabel("", 5, 30, 279, 2, -1, $WS_EX_STATICEDGE)
GUICtrlCreateLabel("E-Mail:", 10, 40, 36, 17)
Global $hEmail = GUICtrlCreateInput("", 10, 55, 271, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL))
GUICtrlCreateLabel("Пароль:", 10, 90, 45, 17)
Global $hPassword = GUICtrlCreateInput("", 10, 105, 271, 21, BitOR($ES_CENTER,$ES_PASSWORD,$ES_AUTOHSCROLL))
GUICtrlCreateLabel("Сервер:", 10, 135, 44, 17)
Global $hServer = GUICtrlCreateCombo("", 60, 135, 80, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
Global $hStart = GUICtrlCreateButton("Старт", 220, 135, 60, 22, $WS_GROUP)
Global $hCancel = GUICtrlCreateButton("Отмена", 150, 135, 60, 22, $WS_GROUP)
GUISetOnEvent($GUI_EVENT_CLOSE,"GUIEvents",$hStartGUI)
GUICtrlSetOnEvent($hStart,"GUIEvents")
GUICtrlSetOnEvent($hCancel,"GUIEvents")
_LoadLoginInfo()
GUISetState(@SW_SHOW,$hStartGUI)
WinSetOnTop($hStartGUI,"",1)
_WaitStartMenu()
Global $sEmail = GUICtrlRead($hEmail)
Global $sPass = GUICtrlRead($hPassword)
Global $sServer = GUICtrlRead($hServer)
#EndRegion === Start GUI ===
#Region === Main GUI ===
Global $hMainGUI = GUICreate($app_Name&" v"&$app_Version, 993, 772, 195, 161)
GUISetOnEvent($GUI_EVENT_CLOSE,"GUIEvents",$hMainGUI)
Global $hStatusBar = _GUICtrlStatusBar_Create($hMainGUI, -1, "", -1, $WS_EX_STATICEDGE)
Global $hStatusBar_PartsWidth[2] = [120, -1]
_GUICtrlStatusBar_SetParts($hStatusBar, $hStatusBar_PartsWidth)
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & "Текущее действие:", 0)
_GUICtrlStatusBar_SetText($hStatusBar, "...", 1)
_GUICtrlStatusBar_SetMinHeight($hStatusBar, 21)
GUICtrlCreateGroup("Нападения", 5, 5, 200, 100)
GUICtrlCreateLabel("Мин", 15, 25, 25, 17)
Global $hMin = GUICtrlCreateInput("", 50, 25, 36, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlCreateLabel("Макс", 115, 25, 31, 17)
Global $hMax = GUICtrlCreateInput("", 160, 25, 36, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $hIf_Power = GUICtrlCreateCheckbox("Если сила", 15, 50, 97, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hIf_Protect = GUICtrlCreateCheckbox("Если защита", 15, 75, 97, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hIf_Power_C = GUICtrlCreateCombo("", 115, 50, 35, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
Global $hIf_Protect_C = GUICtrlCreateCombo("", 115, 75, 35, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
Global $hIf_Power_I = GUICtrlCreateInput("", 160, 50, 36, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $hIf_Protect_I = GUICtrlCreateInput("", 160, 75, 36, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Дозорный обход", 5, 110, 200, 70)
Global $hWatch_On = GUICtrlCreateRadio("Разрешить", 15, 130, 178, 17)
Global $hWatch_Off = GUICtrlCreateRadio("Запретить", 15, 155, 178, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Работа на ферме", 5, 185, 200, 100)
Global $hFarm_On = GUICtrlCreateCheckbox("Ходить на ферму на", 15, 205, 122, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hFarm_Time = GUICtrlCreateCombo("", 150, 205, 50, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
Global $hFarm_Timer = GUICtrlCreateCheckbox("Только после (час.)", 15, 230, 122, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hFarm_Timer_I = GUICtrlCreateInput("", 150, 230, 51, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $hFarm_Gold = GUICtrlCreateCheckbox("Если золота", 15, 255, 87, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hFarm_Gold_C = GUICtrlCreateCombo("", 105, 255, 35, 25)
Global $hFarm_Gold_I = GUICtrlCreateInput("", 150, 255, 51, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $hLog = GUICtrlCreateList("", 5, 400, 200, 266, BitAND($GUI_SS_DEFAULT_LIST,BitNOT($LBS_SORT)))
GUICtrlCreateGroup("Авто пауза", 5, 290, 200, 100)
Global $hAutoPause_On = GUICtrlCreateCheckbox("Делать паузу в", 15, 310, 97, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hAutoPause_In_H = GUICtrlCreateInput("", 115, 310, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlCreateLabel("ч.", 145, 325, 12, 17)
Global $hAutoPause_In_M = GUICtrlCreateInput("", 155, 310, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlCreateLabel("м.", 185, 325, 15, 17)
Global $hAutoPause_Bef = GUICtrlCreateRadio("До", 30, 335, 77, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hAutoPause_Bef_H = GUICtrlCreateInput("", 115, 335, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $hAutoPause_Bef_M = GUICtrlCreateInput("", 155, 335, 25, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
Global $hAutoPause_To = GUICtrlCreateRadio("На", 30, 360, 77, 17)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hAutoPause_To_M = GUICtrlCreateInput("", 115, 360, 66, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlCreateLabel("м.", 185, 365, 15, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $hStartPause = GUICtrlCreateButton("Старт", 5, 670, 200, 55)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hCopyHTML = GUICtrlCreateButton("HTML", 5, 725, 100, 20)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $hCopyTXT = GUICtrlCreateButton("TXT", 105, 725, 100, 20)
GUICtrlSetOnEvent(-1,"GUIEvents")
Global $aMainVars = StringSplit("hMin|hMax|hIf_Power|hIf_Power_C|hIf_Power_I|hIf_Protect|hIf_Protect_C|hIf_Protect_I|hWatch_On|hWatch_Off|hFarm_On|hFarm_Time|hFarm_Timer_H|hFarm_Timer_M|hFarm_Timer|hFarm_Gold|hFarm_Gold_C|hFarm_Gold_I|hAutoPause_On|hAutoPause_In_H|hAutoPause_In_M|hAutoPause_Bef|hAutoPause_Bef_H|hAutoPause_Bef_M|hAutoPause_To_M|hAutoPause_To","|")
Global $aMainVars_Data = StringSplit("hMin|hMax|hIf_Power_I|hIf_Power_C|hIf_Protect_C|hIf_Protect_I|hFarm_Time|hFarm_Timer_H|hFarm_Timer_M|hFarm_Gold_C|hFarm_Gold_I|hAutoPause_In_H|hAutoPause_In_M|hAutoPause_Bef_H|hAutoPause_Bef_M|hAutoPause_To_M","|")
Global $aMainVars_State = StringSplit("hIf_Power|hIf_Protect|hWatch_On|hWatch_Off|hFarm_On|hFarm_Gold|hAutoPause_On|hAutoPause_Bef|hAutoPause_To","|")
Global $aLocations = StringSplit("Персонаж|Почта|Смешилка","|")
_LoadMainStates()
_MainCheckBoxs()
Global $oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE,210,5,775,740)
GUICtrlSetState($hStartPause,$GUI_DISABLE)
GUISetState(@SW_SHOW,$hMainGUI)
_S("Заходим на сервер")
_IENavigate($oIE,$sServer)
Global $iPause = True
GUICtrlSetState($hStartPause,$GUI_ENABLE)
_S("Жду старта!")
While $iPause
Sleep(200)
WEnd
_Login()
While 1
$sleep = 0
While $iPause
Sleep(200)
WEnd
$sText = _IEBodyReadText($oIE)
If StringInStr($sText,"Текущая работа Я свободен!") And (StringInStr($sText,"До нападения: Пора в бой!") Or StringInStr($sText,"До нападения: 00:00:00")) Then
_S("Надумал идти в атаку")
_IELinkClickByText ($oIE,"Бодалка")
$oForm = _IEFormGetCollection($oIE, 1)
$oMin = _IEFormElementGetObjByName ($oForm, 'min')
$oMax = _IEFormElementGetObjByName ($oForm, 'max')
_IEFormElementSetValue ($oMin, GUICtrlRead($hMin))
_IEFormElementSetValue ($oMax, GUICtrlRead($hMax))
$oInputs = _IETagNameGetCollection ($oForm, 'input')
For $oInput In $oInputs
$sT = _IEPropertyGet ($oInput, 'outerHTML')
If StringInStr ($sT, 'ИСКАТЬ ПРОТИВНИКА') Then
_IEAction ($oInput, 'click')
_IELoadWait ($oInput)
_IELoadWait ($oIE)
If GUICtrlRead($hIf_Power) = $GUI_UNCHECKED And GUICtrlRead($hIf_Protect) = $GUI_UNCHECKED Then
$oInputs = _IETagNameGetCollection($oIE, 'input')
For $oInput In $oInputs
If $oInput.type == 'submit' And $oInput.value == 'НАПАСТЬ' Then
_IEAction($oInput, 'click')
ExitLoop
EndIf
Next
EndIf
EndIf
Next
$sleep = Random(45,100,1)
_S("Смотрим результат "&$sleep&" сек")
Sleep($sleep*1000)
_IELinkClickByText ($oIE,"Персонаж")
ElseIf GUICtrlRead($hWatch_On) = $GUI_CHECKED And StringInStr($sText,"Я свободен!") And Not StringInStr($sText,"Пора в бой!") Then
_S("Надумал идти на обход")
_IELinkClickByText ($oIE,"Бодалка")
$oForm = _IEFormGetCollection($oIE, 0)
$oInputs = _IETagNameGetCollection ($oForm, 'input')
For $oInput In $oInputs
If $oInput.type == 'submit' And $oInput.value = 'НАЧАТЬ' Then
_IEAction($oInput, 'click')
ExitLoop
EndIf
Next
$sleep = Random(45,100,1)
_S("Спим "&$sleep&" сек")
Sleep($sleep*1000)
_IELinkClickByText ($oIE,"Персонаж")
Else
Sleep(Random(30000,40000,1))
_IEAction($oIE, "refresh")
EndIf
WEnd
Func _WaitStartMenu()
While $iStartGUI_Show
Sleep(20)
WEnd
EndFunc
Func _Login()
Local $sHTML = _IEBodyReadHTML($oIE)
If StringInStr($sHTML,"Вход") And StringInStr($sHTML,"Регистрация") Then
_S("Заходим в игру")
$oForm = _IEFormGetObjByName($oIE,"loginForm")
$oEmail = _IEFormElementGetObjByName($oForm,"email")
$oPass = _IEFormElementGetObjByName($oForm,"password")
_IEFormElementSetValue($oEmail,$sEmail)
_IEFormElementSetValue($oPass,$sPass)
_IEFormSubmit($oForm)
EndIf
EndFunc
Func _S($sString)
$sString = _NowTime()&": "&$sString
_GUICtrlStatusBar_SetText($hStatusBar,$sString,1)
GUICtrlSetData($hLog,$sString,$sString)
FileWriteLine("Log.txt",_NowCalc()&": "&$sString)
EndFunc
Func GUIEvents()
Switch @GUI_WinHandle
Case $hStartGUI ;===================================
Switch @GUI_CtrlId
Case $hStart
_SaveLoginInfo()
GUISetState(@SW_HIDE,$hStartGUI)
Global $iStartGUI_Show = 0
Case $hCancel, $GUI_EVENT_CLOSE
_SaveLoginInfo()
GUIDelete($hStartGUI)
Exit
EndSwitch
Case $hMainGUI ;===================================
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
If MsgBox(36,$app_Name,"Вы действительно хотите остановить бота и выйти?") = 6 Then
_SaveMainStates()
Exit
EndIf
Case $hStartPause
$iPause = Not $iPause
If $iPause Then
GUICtrlSetData($hStartPause,"Старт")
_S("Встаем на паузу")
Else
GUICtrlSetData($hStartPause,"Пауза")
_S("Продолжаем игру")
EndIf
Case $hIf_Power, $hIf_Protect, $hFarm_On, $hFarm_Timer, $hFarm_Gold, $hAutoPause_On, $hAutoPause_Bef, $hAutoPause_To
_MainCheckBoxs()
Case $hCopyHTML
ClipPut(_IEBodyReadHTML($oIE))
MsgBox(64,$app_Name,"HTML помещен в буфер обмена!")
Case $hCopyTXT
ClipPut(_IEBodyReadText($oIE))
MsgBox(64,$app_Name,"Текст помещен в буфер обмена!")
EndSwitch
EndSwitch ;===================================
EndFunc
Func _MainCheckBoxs()
If GUICtrlRead($hIf_Power) = $GUI_CHECKED Then
GUICtrlSetState($hIf_Power_C,$GUI_ENABLE)
GUICtrlSetState($hIf_Power_I,$GUI_ENABLE)
Else
GUICtrlSetState($hIf_Power_C,$GUI_DISABLE)
GUICtrlSetState($hIf_Power_I,$GUI_DISABLE)
EndIf
If GUICtrlRead($hIf_Protect) = $GUI_CHECKED Then
GUICtrlSetState($hIf_Protect_C,$GUI_ENABLE)
GUICtrlSetState($hIf_Protect_I,$GUI_ENABLE)
Else
GUICtrlSetState($hIf_Protect_C,$GUI_DISABLE)
GUICtrlSetState($hIf_Protect_I,$GUI_DISABLE)
EndIf
If GUICtrlRead($hFarm_On) = $GUI_CHECKED Then
GUICtrlSetState($hFarm_Time,$GUI_ENABLE)
GUICtrlSetState($hFarm_Timer,$GUI_ENABLE)
GUICtrlSetState($hFarm_Timer_I,$GUI_ENABLE)
GUICtrlSetState($hFarm_Gold_C,$GUI_ENABLE)
GUICtrlSetState($hFarm_Gold_I,$GUI_ENABLE)
GUICtrlSetState($hFarm_Gold,$GUI_ENABLE)
Else
GUICtrlSetState($hFarm_Time,$GUI_DISABLE)
GUICtrlSetState($hFarm_Timer,$GUI_DISABLE)
GUICtrlSetState($hFarm_Timer_I,$GUI_DISABLE)
GUICtrlSetState($hFarm_Gold_C,$GUI_DISABLE)
GUICtrlSetState($hFarm_Gold_I,$GUI_DISABLE)
GUICtrlSetState($hFarm_Gold,$GUI_DISABLE)
EndIf
If GUICtrlRead($hFarm_Timer) = $GUI_CHECKED Then
GUICtrlSetState($hFarm_Timer_I,$GUI_ENABLE)
Else
GUICtrlSetState($hFarm_Timer_I,$GUI_DISABLE)
EndIf
If GUICtrlRead($hFarm_Gold) = $GUI_CHECKED Then
GUICtrlSetState($hFarm_Gold_C,$GUI_ENABLE)
GUICtrlSetState($hFarm_Gold_I,$GUI_ENABLE)
Else
GUICtrlSetState($hFarm_Gold_C,$GUI_DISABLE)
GUICtrlSetState($hFarm_Gold_I,$GUI_DISABLE)
EndIf
If GUICtrlRead($hAutoPause_On) = $GUI_CHECKED Then
GUICtrlSetState($hAutoPause_In_H,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_In_M,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_To,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_To_M,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_Bef_H,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_Bef_M,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_Bef,$GUI_ENABLE)
Else
GUICtrlSetState($hAutoPause_In_H,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_In_M,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_To,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_To_M,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_Bef_H,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_Bef_M,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_Bef,$GUI_DISABLE)
EndIf
If GUICtrlRead($hAutoPause_Bef) = $GUI_CHECKED Then
GUICtrlSetState($hAutoPause_Bef_H,$GUI_ENABLE)
GUICtrlSetState($hAutoPause_Bef_M,$GUI_ENABLE)
Else
GUICtrlSetState($hAutoPause_Bef_H,$GUI_DISABLE)
GUICtrlSetState($hAutoPause_Bef_M,$GUI_DISABLE)
EndIf
If GUICtrlRead($hAutoPause_To) = $GUI_CHECKED Then
GUICtrlSetState($hAutoPause_To_M,$GUI_ENABLE)
Else
GUICtrlSetState($hAutoPause_To_M,$GUI_DISABLE)
EndIf
EndFunc
Func _SaveMainStates()
For $i = 1 To $aMainVars[0]
IniWrite("BoBo.ini","MainGUI",$aMainVars[$i],GUICtrlRead(Eval($aMainVars[$i])))
Next
EndFunc
Func _LoadMainStates()
For $i = 1 To $aMainVars_Data[0]
Switch $aMainVars_Data[$i]
Case "hIf_Power_C", "hIf_Protect_C", "hFarm_Gold_C"
GUICtrlSetData(Eval($aMainVars_Data[$i]),"<|<=|=|>=|>",IniRead("BoBo.ini","MainGUI",$aMainVars_Data[$i],""))
Case "hFarm_Time"
GUICtrlSetData(Eval($aMainVars_Data[$i]),"1ч|2ч|3ч|4ч|5ч|6ч|7ч|8ч",IniRead("BoBo.ini","MainGUI",$aMainVars_Data[$i],"8ч"))
Case Else
GUICtrlSetData(Eval($aMainVars_Data[$i]),IniRead("BoBo.ini","MainGUI",$aMainVars_Data[$i],""))
EndSwitch
Next
For $i = 1 To $aMainVars_State[0]
GUICtrlSetState(Eval($aMainVars_State[$i]),IniRead("BoBo.ini","MainGUI",$aMainVars_State[$i],""))
Next
EndFunc
Func _SaveLoginInfo()
IniWrite("BoBo.ini","Login","Email",GUICtrlRead($hEmail))
IniWrite("BoBo.ini","Login","Password",_StringEncrypt(1,GUICtrlRead($hPassword),"BoBo",1))
IniWrite("BoBo.ini","Login","Server",GUICtrlRead($hServer))
EndFunc
Func _LoadLoginInfo()
GUICtrlSetData($hEmail,IniRead("BoBo.ini","Login","Email",""))
GUICtrlSetData($hPassword,_StringEncrypt(0,IniRead("BoBo.ini","Login","Password",""),"BoBo",1))
GUICtrlSetData($hServer,"g1.botva.ru|g2.botva.ru|g3.botva.ru",IniRead("BoBo.ini","Login","Server","g1.botva.ru"))
EndFunc