#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
Opt("MouseClickDelay", 5)
Opt("MouseClickDownDelay", 200)
Global $clientsz = WinGetClientSize("League of Legends")
Global $matchlength, $TimeInMs, $Clock
Func autobot($TimeInMs)
WinActivate("League of Legends")
While Not WinExists("League of Legends (TM) Client")
Sleep(1500)
ControlClick("League of Legends", "", "[Classnn:Chrome_RenderWidgetHostHWND1]", "left", 1, Round(0.5 * $clientsz[0]), Round(0.943 * $clientsz[1]))
Sleep(1000)
ControlClick("League of Legends", "", "[Classnn:Chrome_RenderWidgetHostHWND1]", "left", 1, Round(0.419 * $clientsz[0]), Round(0.9541 * $clientsz[1]))
Sleep(Round(Random(2, 4) * 1000))
ControlClick("League of Legends", "", "[Classnn:Chrome_RenderWidgetHostHWND1]", "left", 1, Round(0.5 * $clientsz[0]), Round(0.775 * $clientsz[1]))
WEnd
WinWait("League of Legends (TM) Client")
Sleep(15000)
WinActivate("League of Legends (TM) Client")
Sleep(3000)
Local $gamesz = WinGetClientSize("League of Legends (TM) Client")
Local $pxdifference[2] = [Round((@DesktopWidth - $gamesz[0]) / 2), Round((@DesktopHeight - $gamesz[1]) / 2)]
Local $topmiddle[2] = [@DesktopWidth / 2, ($pxdifference[1] + 3)]
Local $pxchecksum = PixelChecksum($topmiddle[0] - 5, $topmiddle[1] + 5, $topmiddle[0] + 5, $topmiddle[1] + 10)
While $pxchecksum = PixelChecksum($topmiddle[0] - 5, $topmiddle[1] + 5, $topmiddle[0] + 5, $topmiddle[1] + 10)
Sleep(7000)
WEnd
Local $timer = TimerInit()
If $TimeInMs = 0 Then
$Clock = 900000
Else
$Clock = $TimeInMs
EndIf
Sleep(59000)
While TimerDiff($timer) <= $Clock
For $i = 1 To Random(1, 2, 1)
MouseClick("left", ($pxdifference[0] + $gamesz[0] * (0.3 + (0.105 * Random(0, 4, 1)))), Round(($gamesz[1] * 0.92) + $pxdifference[1]), 1, 10)
Sleep(Round(Random(1, 2, 0) * 1000))
Next
If TimerDiff($timer) >= 300000 Then
MouseClick("left", ($pxdifference[0] + Round($gamesz[0] * 0.1914)), ($pxdifference[1] + Round($gamesz[1] * 0.893)), 2, 10)
EndIf
Sleep(45000)
WEnd
If $TimeInMs <> 0 Then
Send("{ENTER}")
Sleep(500)
Send("/")
Sleep(300)
Send("f")
Sleep(200)
Send("f")
Sleep(500)
Send("{ENTER}")
Sleep(500)
MouseClick("left", ($pxdifference[0] + Round($gamesz[0] * (1 - 0.54297))), ($pxdifference[1] + Round($gamesz[1] * 0.45139)), 1, 10)
Else
While WinExists("League of Legends (TM) Client")
MouseClick("left", ($pxdifference[0] + Round($gamesz[0] * 0.432)), ($pxdifference[1] + Round($gamesz[1] * 0.493)), 1, 10)
Sleep(Random(5, 15, 1) * 1000)
WEnd
EndIf
WinWaitClose("League of Legends (TM) Client")
Sleep(10000)
EndFunc
#Region
$TermsOfUse = GUICreate("TFT", 390, 203, -1, -1)
$Type = GUICtrlCreateLabel("OK?", 20, 81, 203, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$InputBox = GUICtrlCreateInput("OK", 20, 113, 329, 21)
GUISetState(@SW_SHOW)
#EndRegion
$Accept = False
While Not $Accept
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case Else
If StringLower(GUICtrlRead($InputBox)) = "ok" Then
GUICtrlSetData($Type, "Đang chạy script...")
Sleep(1000)
$Accept = True
EndIf
EndSwitch
WEnd
GUIDelete()
#Region
$Menu = GUICreate("TFT", 298, 154, -1, -1)
$Time_Input_Area = GUICtrlCreateGroup("Đầu hàng lúc: ", 32, 16, 233, 97)
$TimeInputBox = GUICtrlCreateInput("00:00", 56, 40, 89, 21)
$StartNStop = GUICtrlCreateButton("Bắt đầu", 168, 40, 73, 25)
$note2 = GUICtrlCreateLabel("Đặt là 00:00 thì sẽ không đầu hàng", 48, 88, 186, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$text1 = GUICtrlCreateLabel(" ", 32, 120, 210, 17)
GUISetState(@SW_SHOW)
#EndRegion
Global $Start = False
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $StartNStop
If Not $Start Then
$matchlength = StringSplit(GUICtrlRead($TimeInputBox), ":")
Global $MatchLengthInMilisecond = Int($matchlength[1]) * 60000 + Int($matchlength[2]) * 1000
If $MatchLengthInMilisecond < 600000 And $MatchLengthInMilisecond <> 0 Then
GUICtrlSetData($text1, "Tối thiểu là 10 phút")
ElseIf $MatchLengthInMilisecond = 0 Then
GUICtrlSetData($text1, "Không đầu hàng")
$Start = True
GUICtrlSetState($TimeInputBox, $GUI_DISABLE)
While 1
autobot($MatchLengthInMilisecond)
WEnd
Else
GUICtrlSetData($text1, "Đang chơi TFT...")
$Start = True
GUICtrlSetState($TimeInputBox, $GUI_DISABLE)
While 1
autobot($MatchLengthInMilisecond)
WEnd
EndIf
Else
ExitLoop
$Start = False
GUICtrlSetData($StartNStop, "Bắt đầu")
GUICtrlSetState($TimeInputBox, $GUI_ENABLE)
EndIf
EndSwitch
WEnd