Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 23.81 KB | None | 0 0
  1. #include <MsgBoxConstants.au3>
  2. #include <GUIConstantsEx.au3>
  3. #include <Color.au3>
  4. #include <Date.au3>
  5.  
  6. ;~ ; ************ EDITABLE PART ***********************
  7. ;~ ; **************************************************
  8.  
  9. ;~ ; Should definitely put this in GUI
  10. Global Const $DROP_COMMAND_BOUND_KEY = "q"
  11. Global Const $TEAM_CHAT_BOUND_KEY = "u"
  12.  
  13. ;~ ; vote, but also autobuy, so freezetime=15+buytime=20 == 35 sec, any value lower than 35 can make you buy&drop twice
  14. ;~ ; may be let choose this in GUI
  15. Global Const $MAX_SECONDS_BETWEEN_2_F1 = 20
  16.  
  17. Global Const $MAX_SECONDS_BETWEEN_2_LOBBYTEXT = 90
  18.  
  19. ;~ ; **************************************************
  20. ;~ ; ********* END OF EDITABLE PART *******************
  21.  
  22.  
  23. Global Const $MAX_RESOLUTIONS = 18
  24.  
  25. Global Const $aResolutions[$MAX_RESOLUTIONS][2] = [[640, 480], [800, 600], [1024, 768], [1152, 864], [1280, 1024], [1400, 1050], _
  26.         [1024, 600], [1280, 720], [1360, 768], [1366, 768], [1600, 900], [1920, 1080], _
  27.         [720, 480], [800, 480], [1280, 768], [1280, 800], [1440, 900], [1680, 1050]]
  28.  
  29.  
  30. Global Const $1920x1080Index = 11
  31.  
  32. Global Enum $eSilver, $eHighRank, $eUnranked
  33.  
  34. ;~ ; keep the 10 lines below for the record
  35.  
  36. ;~ ;Default values
  37. ;~ Const $_ACCEPT_MATCH_COLOUR = 878614
  38. ;~ Const $YELLOW_FUCKING_COLOR = 14795025
  39. ;~ Const $LOBBY_TEXT_COLOUR = 5797773
  40.  
  41.  
  42. ;THIS IS FOR BANANA 1600*900 settings :
  43. ;~ Const $_ACCEPT_MATCH_COLOUR = 2120745
  44. ;~ Const $YELLOW_FUCKING_COLOR = 14795030
  45. ;~ Const $LOBBY_TEXT_COLOUR = 8164519
  46. ;~ Global $aCheckLobbyPos[$MAX_RESOLUTIONS][2] = [ [222, 78] , [272, 98] , [345, 125] , [400, 140] , [430, 167] , [476, 171] , _
  47. ;~                          [384, 98] , [493, 117] , [523, 125] , [526, 125] , [593, 148] , [730, 176] , _ ; 5th BANANA Value [593, 148] ; DEFAULT : [616, 147]
  48. ;~                          [262, 78] , [308, 78] , [483, 125] , [476, 130] , [536, 147] , [625, 171] ]
  49.  
  50.  
  51.  
  52.  
  53. ;Const $steam_exe_patch = "D:\Steam\Steam.exe" ; don't use this anymore, would have to be edited, search path in regedit instead
  54. Global Const $csgo_exec_patch = "steam://rungameid/730" ; the only way to launch cs:go in safe VAC mode, use path with .exe would end to unsafe mode and unable to re-join match
  55.  
  56. ; 1920x1080 accept button coordinates (316;218) (638;298)
  57.  
  58. ;Const $COORD_ACCEPT_1080_X = 477 ; 1920 / 316 = 6.07 1920 / 638 = 3.009  USE /4
  59. ;Const $COORD_ACCEPT_1080_Y = 258 ; 1080 / 218 = 4.95 1080 / 298 = 3.62   USE /4
  60.  
  61. ; (872;93) (1168;153)
  62. ;Const $COORD_COORD_RECONNECT_1080_X = 960 ; 872-1168 1920/872=2.20 1920/1168=1.64 USE /2 ; need to double check this because ABANDON is close :D
  63. ;Const $COORD_COORD_RECONNECT_1080_Y = 120 ; 1080/93=11.61 1080/153=7.05 USE /9
  64.  
  65.  
  66.  
  67. ; http://www.psyclops.com/tools/rgb/
  68. ; https://www.binaryhexconverter.com/hex-to-decimal-converter
  69. ; 12,119,21 13,115,22 14,99,29 12,119,19 12,116,20 12,121,19
  70. ; 13,115,22 13,111,24 14,99,29 14,99,29 13,104,22 13,112,24
  71. ; 12,119,21 12,119,21 14,99,29 13,114,23 13,104,22 12,121,19
  72.  
  73. ; BANANA :32,92,41 HEX:205C29 DEC:2120745 WTF, DEFAULT  13,104,22
  74.  
  75. Global Const $aAcceptMatchColor[$MAX_RESOLUTIONS] = [816917, 881430, 942877, 816915, 816148, 817427, _
  76.         881430, 880408, 942877, 942877, 878614, 880664, _
  77.         816917, 816917, 942877, 881175, 878614, 817427]
  78.  
  79. Global Const $aAcceptColorCheckPos[$MAX_RESOLUTIONS][2] = [[106, 132], [132, 165], [170, 211], [193, 238], [184, 282], [233, 289], _
  80.         [244, 165], [320, 198], [338, 211], [341, 211], [400, 248], [480, 297], _
  81.         [146, 132], [186, 132], [298, 211], [284, 220], [320, 248], [372, 289]]
  82.  
  83. Global Const $aAcceptClicPos[$MAX_RESOLUTIONS][2] = [[106, 113], [132, 143], [170, 182], [193, 205], [184, 244], [233, 250], _
  84.         [244, 142], [320, 172], [338, 183], [341, 183], [400, 214], [480, 257], _
  85.         [146, 114], [186, 114], [298, 183], [284, 190], [320, 214], [372, 250]]
  86.  
  87. ; 225,193,17 225,193,17
  88. ;
  89. ;
  90. ;~ Global $aReconnectYellowBannerCol[$MAX_RESOLUTIONS] = [ 14795025, 14795025, 14795025, 14795025, 14795025, 14795025, _
  91. ;~                                                      14795025, 14795025, , , , , _
  92. ;~                                                      , , , , , 14795025]
  93.  
  94. Global Const $YELLOW_BANNER_COLOR = 14795025
  95. ;~ ; 225,193,22 WTF BANANA > hex: E1C116 > dec: 14795030
  96. ;~ 224,194,22 MeaCulpa 1600*900 default files win7
  97. Global Const $aReconnectMatchColor[$MAX_RESOLUTIONS][2] = [[596, 33], [749, 43], [965, 53], [1091, 61], [1241, 71], [1325, 74], _
  98.         [870, 43], [1068, 50], [1141, 53], [1137, 55], [1307, 61], [1591, 75], _
  99.         [636, 34], [679, 34], [1098, 53], [1108, 56], [1239, 62], [1438, 73]]
  100.  
  101. Global Const $aReconnectClicPos[$MAX_RESOLUTIONS][2] = [[347, 55], [433, 69], [557, 87], [628, 98], [700, 116], [765, 118], _
  102.         [548, 69], [684, 82], [728, 87], [726, 86], [854, 102], [1027, 124], _
  103.         [389, 55], [429, 56], [686, 88], [688, 90], [773, 103], [904, 119]]
  104.  
  105. Global Const $aLobbyTextCol[$MAX_RESOLUTIONS] = [1713714, 7049128, 5600137, 7839674, 5402501, 6785704, _
  106.         7049128, 6917286, 6785699, 6785699, 5797773, 6193046, _
  107.         6917285, 6917285, 6785699, 6588063, 5797773, 6522270]
  108.  
  109. Global Const $aCheckLobbyPos[$MAX_RESOLUTIONS][2] = [[222, 78], [272, 98], [345, 125], [400, 140], [430, 167], [476, 171], _
  110.         [384, 98], [493, 117], [523, 125], [526, 125], [616, 147], [730, 176], _ ; 5th BANANA Value [593, 148] ; DEFAULT : [616, 147]
  111.         [262, 78], [308, 78], [483, 125], [476, 130], [536, 147], [625, 171]]
  112.  
  113. Global Const $aChatClicPos[$MAX_RESOLUTIONS][2] = [[276, 364], [353, 456], [553, 585], [693, 657], [835, 773], [865, 800], _
  114.         [607, 457], [736, 547], [800, 580], [800, 580], [940, 680], [1050, 820], _
  115.         [442, 364], [475, 363], [700, 580], [700, 600], [850, 680], [990, 790]]
  116.  
  117. ;~ Global $aExample[$MAX_RESOLUTIONS][2] = [ [, ] , [, ] , [, ] , [, ] , [, ] , [, ] , _
  118. ;~                          [, ] , [, ] , [, ] , [, ] , [, ] , [, ] , _
  119. ;~                          [, ] , [, ] , [, ] , [, ] , [, ] , [, ] ]
  120.  
  121.  
  122. ;~    ; Lobby Analyser datas
  123. ;~ Global Const $aOwnAvatarExtraBorderColor[3] =  [227, 241, 250] ; X + 4 ; Doesn't work, it's always the host extraborder, not own player, check GO button instead
  124. Global Const $aAvatarBorderColor[3] = [125, 125, 125]
  125. ;~ Global Const $aaBordersCheckZonesCoord[5][3] = [[850, 227], [1026, 227], [1202, 227], [1378, 227], [1554, 227]] ; x diff = 176
  126.  
  127. Global Const $aGoButtonColor[3] = [44, 119, 87]
  128.  
  129. Global $g_bIsLobbyClosed = True
  130.  
  131. Global Const $aExtraSlotBorderCoords[2] = [820,491]
  132. Global Const $aExtraSlotBorderColor[3] = [43,43,43]
  133. ;~    ; Lobby Analyser datas END
  134.  
  135.  
  136. Global Const $CSGO_WINDOW_NAME = "Counter-Strike: Global Offensive"
  137.  
  138. Global $aClientSize[2]
  139.  
  140. Global $begin
  141. ;~ Global $previousDrop = TimerInit()
  142. Global $previousF1 = TimerInit()
  143. Global $previousLobbyText = TimerInit()
  144. Global $analyseText = TimerInit()
  145. Global $lastbuttonHit = TimerInit()
  146.  
  147. Global $DontExitAutoAcceptLoop = False
  148. Global $InLoop = False
  149.  
  150. Global $AutoF1 = True
  151. Global $AutoReconnect = True
  152. Global $AutoDrop = False
  153. Global $AutoSpamLobby = False
  154. ;~ Global $g_iDropCount = 0
  155.  
  156. Opt("GUIOnEventMode", 1)
  157. $GUI = GUICreate("Cs:Go Auto-Accept", 300, 150)
  158. GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
  159.  
  160. $StartButtonId = GUICtrlCreateButton("GO", 40, 100, 100, 35)
  161. GUICtrlSetOnEvent($StartButtonId, "Start")
  162.  
  163. $StopButtonId = GUICtrlCreateButton("STOP", 160, 100, 100, 35)
  164. GUICtrlSetOnEvent($StopButtonId, "Pause")
  165.  
  166. $AutoF1CtrlId = GUICtrlCreateCheckbox("Auto F1 (votekick, surrender, autobuy)", 10, 10)
  167. GUICtrlSetState($AutoF1CtrlId, $GUI_CHECKED)
  168. GUICtrlSetOnEvent($AutoF1CtrlId, "AutoF1")
  169.  
  170. $AutoDropCtrlId = GUICtrlCreateCheckbox("AutoDrop Weap (Autobuy has to be on F1)", 10, 30)
  171. ;~ guictrlsetstate ( $AutoDropCtrlId, $GUI_CHECKED )
  172. GUICtrlSetOnEvent($AutoDropCtrlId, "AutoDrop")
  173.  
  174. $AutoReconnectCtrlId = GUICtrlCreateCheckbox("Auto Reconnect", 10, 50)
  175. GUICtrlSetState($AutoReconnectCtrlId, $GUI_CHECKED)
  176. GUICtrlSetOnEvent($AutoReconnectCtrlId, "AutoReconnect")
  177.  
  178. $SpamLobbyCtrlId = GUICtrlCreateCheckbox("Spam Lobby Chat", 10, 70)
  179. ;~ guictrlsetstate ( $SpamLobbyCtrlId, $GUI_CHECKED )
  180. GUICtrlSetOnEvent($SpamLobbyCtrlId, "SpamLobby")
  181.  
  182. HotKeySet("{f10}", "Start")
  183. HotKeySet("{f11}", "Pause")
  184. HotKeySet("{f9}", "Analyse_Lobby")
  185.  
  186. ResetTimer()
  187.  
  188.  
  189. GUISetState(@SW_SHOW)
  190.  
  191.  
  192.  
  193. Global $steam_exe_patch = RegRead("HKEY_CLASSES_ROOT\steam\Shell\Open\Command", "")
  194. ;~ MsgBox($MB_SYSTEMMODAL, "", "Program files are located at: " & $steam_exe_patch)
  195.  
  196. While 1
  197.     Sleep(50)
  198.     GUIGetMsg()
  199.  
  200.     Local $FirstTime = True
  201.  
  202.     While $DontExitAutoAcceptLoop
  203.         Sleep(50)
  204.  
  205.         If WinActive($CSGO_WINDOW_NAME) Then
  206.             If GetTimerDiff() > 500 Then
  207.                 ResetTimer()
  208.                 ExecCsGoStuff()
  209.             EndIf
  210.         Else
  211.             If $AutoReconnectCtrlId And ProcessExists("Steam.exe") == 0 Then
  212.                 Local $iPID = Run($steam_exe_patch)
  213.                 WinWait($iPID, "", 20)
  214.             ElseIf $AutoReconnectCtrlId And ProcessExists("csgo.exe") == 0 Then
  215.                 Local $iPID2 = ShellExecute($csgo_exec_patch) ; how to launch in secure mode ???
  216.                 WinWait($iPID2, "", 15)
  217.             ElseIf $FirstTime == False Then
  218.                 If GetTimerDiff() > 30000 Then ;let 30sec before re-activate cs:go window if want to disable script
  219.                     ResetTimer()
  220.                     WinActivate($CSGO_WINDOW_NAME) ; if cs:go minimized, re-activates
  221.                     WinWaitActive($CSGO_WINDOW_NAME, "", 10)
  222.                 EndIf
  223.             Else
  224.                 $FirstTime = False
  225.                 WinActivate($CSGO_WINDOW_NAME)
  226.                 WinWaitActive($CSGO_WINDOW_NAME, "", 10)
  227.             EndIf
  228.         EndIf
  229.     WEnd
  230. WEnd
  231.  
  232. ;~ Func IsSteamRunning()
  233. ;~  Return ProcessExists("Steam.exe")
  234. ;~ EndFunc ;IsSteamRunning
  235.  
  236. ;~ Func IsCsgoRunning()
  237. ;~  Return ProcessExists("csgo.exe")
  238. ;~ EndFunc ;IsCsgoRunning
  239.  
  240. Func Close()
  241.     Exit
  242. EndFunc   ;==>Close
  243.  
  244. Func Pause()
  245.     $DontExitAutoAcceptLoop = False
  246. EndFunc   ;==>Pause
  247.  
  248. Func Start()
  249.     $DontExitAutoAcceptLoop = True
  250. EndFunc   ;==>Start
  251.  
  252. Func GetTimerDiff()
  253.     Return TimerDiff($begin)
  254. EndFunc   ;==>GetTimerDiff
  255.  
  256. Func ResetTimer()
  257.     $begin = TimerInit()
  258. EndFunc   ;==>ResetTimer
  259.  
  260. Func AutoF1()
  261.     If GUICtrlRead($AutoF1CtrlId) == $GUI_CHECKED Then
  262.         $AutoF1 = True
  263.     Else
  264.         $AutoF1 = False
  265.     EndIf
  266. EndFunc   ;==>AutoF1
  267.  
  268. Func SpamLobby()
  269.     If GUICtrlRead($SpamLobbyCtrlId) == $GUI_CHECKED Then
  270.         $AutoSpamLobby = True
  271.     Else
  272.         $AutoSpamLobby = False
  273.     EndIf
  274. EndFunc   ;==>SpamLobby
  275.  
  276. Func AutoReconnect()
  277.     If GUICtrlRead($AutoReconnectCtrlId) == $GUI_CHECKED Then
  278.         $AutoReconnect = True
  279.     Else
  280.         $AutoReconnect = False
  281.     EndIf
  282. EndFunc   ;==>AutoReconnect
  283.  
  284. Func AutoDrop()
  285.     If GUICtrlRead($AutoDropCtrlId) == $GUI_CHECKED Then
  286.         $AutoDrop = True
  287.     Else
  288.         $AutoDrop = False
  289.     EndIf
  290. EndFunc   ;==>AutoDrop
  291.  
  292. Func ExecCsGoStuff()
  293.     Local $iRes = GetCsGoResolution()
  294.     If $iRes == -1 Then
  295. ;~      MsgBox(64, "Auto-Accept", "Your resolution (" & $aClientSize[0] & "x" & $aClientSize[1] & ") is not supported" & @CRLF & "Please contact the author")
  296.         Return
  297.     EndIf
  298.  
  299. ;~  Local $iColor = PixelGetColor($aReconnectMatchColor[$iRes][0], $aReconnectMatchColor[$iRes][1])
  300. ;~  If $iColor == $YELLOW_BANNER_COLOR Then ; todo : check if there is first a popup window in witch we have to click OK
  301.     If IsThereYellowBanner() Then ; todo : check if there is first a popup window in witch we have to click OK
  302. ;~      MouseClick("left", $aReconnectClicPos[$iRes][0], $aReconnectClicPos[$iRes][1]) ; reconnect area
  303.         Reconnect()
  304.     Else
  305.         If IsThereAcceptButton() Then
  306. ;~          LobbyWrite("Accept Button Detected{Enter}")
  307.             Accept()
  308.         Else
  309.             If IsLobby() Then ; IN LOBBY
  310.                 If $AutoSpamLobby == True And TimerDiff($previousLobbyText) > $MAX_SECONDS_BETWEEN_2_LOBBYTEXT * 1000 Then
  311.                     $previousLobbyText = TimerInit()
  312.  
  313. ;~                  MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
  314. ;~                  Send("Only Silvers, please kick unranked{Enter}")
  315. ;~                  Send("Auto-accept script by ConnorMcLeod using AutoIt{Enter}")
  316. ;~                  Send("http://steamcommunity.com/groups/CsGo_AutoAccept (only sourcecode=no virus){Enter}")
  317.                     LobbyWrite("http://steamcommunity.com/groups/CsGo_AutoAccept (only sourcecode=no virus){Enter}")
  318. ;~                  Send("Hello guys, please keep this lobby alive, i will accept all matches, and vote F1 each time{Enter}")
  319.                     LobbyWrite("Auto: Accept / Vote F1 / Reconnect / Re-launch steam and csgo{Enter}")
  320.                     LobbyWrite(StringFormat("If there is someone to kick, try to PM me on steamfriends if i am not sleeping, time here is %s{Enter}", _NowTime()))
  321. ;~                  Send("I will launch when lobby is full{Enter}")
  322.                 EndIf
  323.                 If TimerDiff($lastbuttonHit) > 10000 Then
  324.                     Analyse_Lobby()
  325.                 EndIf
  326.             Else ; Let's assume we are in-game
  327.                 If TimerDiff($previousF1) > $MAX_SECONDS_BETWEEN_2_F1 * 1000 Then
  328.  
  329.                     $previousF1 = TimerInit()
  330.  
  331.                     If $AutoF1 == True Then
  332.                         Send("{f1}") ; max kick before get kicked  ??? ; vote yes to votekick or surrender ; will send autobuy as well
  333.  
  334.                         If $AutoDrop == True Then
  335.                             Send($DROP_COMMAND_BOUND_KEY)
  336.  
  337.  
  338. ;~                          Send( $TEAM_CHAT_BOUND_KEY )
  339. ;~                          Send( "Dropped weapon or voted F1{Enter}" )
  340.                         EndIf
  341.                     EndIf
  342.                 EndIf
  343.             EndIf
  344.         EndIf
  345.     EndIf
  346.  
  347. EndFunc   ;==>ExecCsGoStuff
  348.  
  349. Func GetCsGoResolution()
  350.     Local $hWnd = WinActive($CSGO_WINDOW_NAME)
  351.     If $hWnd == 0 Then Return -1
  352.     $aClientSize = WinGetClientSize($hWnd)
  353.     For $iRes = 0 To $MAX_RESOLUTIONS - 1
  354.  
  355.         If $aClientSize[0] == $aResolutions[$iRes][0] And $aClientSize[1] == $aResolutions[$iRes][1] Then
  356.             Return $iRes
  357.         EndIf
  358.     Next
  359.     Return -1
  360. EndFunc   ;==>GetCsGoResolution
  361. ;~ 812, 364 [144, 147, 150]
  362. ;~ 812, 363 [51, 53, 52][51, 52, 52][51, 52, 52][51, 52, 51][52, 53, 52]
  363.  
  364. ;~ 1436, 1004  44,119,87 ; GO button
  365.  
  366. Func Analyse_Lobby()
  367.     Local $iRes = GetCsGoResolution()
  368.     If $iRes == $1920x1080Index Then
  369.         Local $iPlayersNum = 0
  370.         Local $iCount = 0
  371.         Local $aColor[3]
  372.         Local $bLobbyHost = False
  373.         Local $abIsSilver[5] = [False, False, False, False, False]
  374.         Local $abIsUnranked[5] = [False, False, False, False, False]
  375.  
  376.  
  377.         Local $bAdvertise = False
  378.         If $AutoSpamLobby == True And TimerDiff($analyseText) > 15000 Then ; still something wrong here
  379.             $bAdvertise = True
  380.             $analyseText = TimerInit()
  381.         EndIf
  382.  
  383.         If IsThereGoButton() Then
  384.             $bLobbyHost = True ; will be False if match is being searched already
  385.         EndIf
  386.  
  387.         Local $iTempCount = CountPlayers()
  388.  
  389.         If $bAdvertise == True Then
  390.             LobbyWrite( StringFormat("[Beta] Lobby analyser : Checking %d players...{Enter}", $iTempCount))
  391.         EndIf
  392.  
  393.         For $iCount = 0 To 4
  394.             If $iCount >= $iTempCount Then
  395.                 If $iTempCount == 5 Then
  396.                     If $bAdvertise == True Then
  397.                         LobbyWrite( "[Beta] Lobby analyser : Exiting loop to prevent out of bound{Enter}")
  398.                     EndIf
  399.                 EndIf
  400.                 ExitLoop
  401.             EndIf
  402.             $abIsSilver[$iCount] = False
  403.             $abIsUnranked[$iCount] = False
  404.             If $iCount == 0 And $bLobbyHost == True Then
  405.                 $iCount = 1
  406.                 $iPlayersNum = 1
  407.             EndIf
  408.  
  409.             ; Make sure we are still in lobby
  410. ;~          If IsLobby() Then
  411.  
  412. ;~              $aColor = _ColorGetRGB2( 850 + 176*$iCount, 227 )
  413. ;~              If _ColorIsEqual($aColor, $aAvatarBorderColor) Then
  414.                 If IsSlotTaken($iCount) Then
  415.                     Sleep(800)
  416.                     $iPlayersNum += 1
  417.  
  418.                     Switch GetPlayerRank($iCount) ; Enum $eSilver, $eHighRank, $eUnranked
  419.                         Case $eSilver
  420.                             $abIsSilver[$iCount] = True
  421. ;~                          If $bAdvertise == True Then
  422. ;~                              LobbyWrite( StringFormat("[Beta] Lobby analyser : Player %i is Silver{Enter}", $iCount+1))
  423. ;~                          EndIf
  424.                         Case $eHighRank
  425.                             If $bLobbyHost == True Then
  426.                                 LobbyWrite( StringFormat("[Beta] Lobby analyser : Kicking High Rank Player %i{Enter}", $iCount+1) )
  427.                                 Beep(880, 50)
  428.                                 Beep(880, 50)
  429.                                 KickPlayer($iCount)
  430.                                 $iCount = 0
  431.                                 $iPlayersNum = 0
  432.                             EndIf
  433.                         Case $eUnranked
  434.                             If $bLobbyHost == True Then
  435.                                 LobbyWrite( StringFormat("[Beta] Lobby analyser : Unranked player %i detected, waiting 3 more seconds to ensure it is not a bug{Enter}", $iPlayersNum+1) )
  436.                                 Sleep(3000)
  437.                                 If IsSlotTaken($iCount) Then
  438.                                     Switch GetPlayerRank($iCount)
  439.                                         Case $eSilver
  440.                                             $abIsSilver[$iCount] = True
  441. ;~                                          If $bAdvertise == True Then
  442. ;~                                              LobbyWrite( StringFormat("[Beta] Lobby analyser : Player %i is Silver{Enter}", $iCount+1))
  443. ;~                                          EndIf
  444.                                         Case $eHighRank
  445.                                             LobbyWrite( StringFormat("[Beta] Lobby analyser : Kicking High Rank Player %i{Enter}", $iCount+1) )
  446.                                             Beep(880, 50)
  447.                                             Beep(880, 50)
  448.                                             KickPlayer($iCount)
  449.                                             $iCount = 0
  450.                                             $iPlayersNum = 0
  451.                                         Case $eUnranked
  452.                                             LobbyWrite( StringFormat("[Beta] Lobby analyser : Kicking UnRanked Player %i{Enter}", $iCount+1) )
  453.                                             Beep(220, 150)
  454.                                             KickPlayer($iCount)
  455.                                             $iCount = 0
  456.                                             $iPlayersNum = 0
  457.                                     EndSwitch
  458.                                 Else
  459.                                     ExitLoop
  460.                                 EndIf
  461.                             Else
  462.                                 $abIsUnranked[$iCount] = True
  463.                             EndIf
  464.                     EndSwitch
  465.  
  466. ;~                  $aColor = _ColorGetRGB2(812 + 176 * $iCount, 363) ; check rank border color
  467. ;~                  If $aColor[0] > 50 And $aColor[0] < 60 And $aColor[1] > 50 And $aColor[1] < 60 Then
  468. ;~                      If $aColor[2] > 5 And $aColor[2] < 60 Then
  469. ;~                          $abIsSilver[$iCount] = True
  470. ;~                      ElseIf $aColor[2] >= 60 Then
  471. ;~                          If $bLobbyHost == True Then
  472. ;~                              LobbyWrite("[Beta] Lobby analyser : Unranked player detected, waiting 3 more seconds to ensure it is not a bug{Enter}")
  473. ;~                              KickPlayer($iCount)
  474. ;~                              $iCount = 0
  475. ;~                              $iPlayersNum = 0
  476. ;~                          Else
  477. ;~                              $abIsUnranked[$iCount] = True
  478. ;~                          EndIf
  479. ;~                      EndIf
  480. ;~                  ElseIf $bLobbyHost == True Then
  481. ;~                      KickPlayer($iCount)
  482. ;~                      $iCount = 0
  483. ;~                      $iPlayersNum = 0
  484. ;~                  EndIf
  485.  
  486.                 Else
  487.                     ExitLoop
  488.                 EndIf
  489.  
  490. ;~          EndIf ; If IsLobby
  491.         Next
  492.  
  493.         $iPlayersNum = CountPlayers()
  494.  
  495.         If $bLobbyHost Then
  496.             If $iPlayersNum == 5 Then
  497.                 ChangeLobbyPremissions(True, True)
  498.                 LobbyWrite("Kicking extra players{Enter}")
  499.                 KickExtraPlayers()
  500.                 Sleep(100)
  501.                 If IsThereGoButton() Then
  502.                     Go()
  503.                 EndIf
  504.             Else
  505. ;~              LobbyWrite("Opening Lobby{Enter}")
  506.                 ChangeLobbyPremissions(False)
  507.                 If $bAdvertise == True Then
  508. ;~                  MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
  509.  
  510.                     LobbyWrite(StringFormat("[Beta] Lobby analyser : Waiting for %d DERANKERS... please invite your history or friends{Enter}", 5-$iPlayersNum))
  511.                 EndIf
  512.             EndIf
  513.         ElseIf $bAdvertise == True Then
  514.             For $iCount = 0 To 4
  515.                 If $iCount >= $iPlayersNum Then
  516.                     ExitLoop
  517.                 EndIf
  518.                 If $abIsSilver[$iCount] == False Then
  519.  
  520. ;~                  MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
  521.                     LobbyWrite(StringFormat("[Beta] Lobby analyser : Please kick Player %i High Rank ? %i OR UNRANKED ? %i{Enter}", $iCount + 1, Not($abIsSilver[$iCount]), $abIsUnranked[$iCount]))
  522.                 EndIf
  523.             Next
  524.         EndIf
  525.  
  526.     EndIf
  527.  
  528. EndFunc   ;==>Analyse_Lobby
  529.  
  530. Func CountPlayers()
  531. ;~  Local $aColor[3], $iCount
  532.     Local $iCount, $iPlayersNum
  533.     For $iCount = 0 To 4
  534. ;~      $aColor = _ColorGetRGB2( 850 + 176*$iCount, 227 )
  535. ;~      If _ColorIsEqual($aColor, $aAvatarBorderColor) == False Then
  536.         If IsSlotTaken($iCount) == False Then
  537.             Return $iPlayersNum
  538.         EndIf
  539.         $iPlayersNum += 1
  540.     Next
  541.     Return $iPlayersNum
  542. EndFunc   ;==>CountPlayers
  543.  
  544. ;~ ; 820,260
  545. ;993,245    1036,312 -> delta 43, 67
  546. Func KickPlayer($_PlayerNum)
  547.     MouseClick("right", 820 + 176 * $_PlayerNum, 260)
  548.     MouseClick("left", 43 + 820 + 176 * $_PlayerNum, 327)
  549.     MouseClick("left", 1060, 666)
  550.     Sleep(300)
  551.     ChangeLobbyPremissions( False, True )
  552. EndFunc   ;==>KickPlayer
  553.  
  554. ;~ ; 820,470
  555. Func KickExtraPlayers()
  556.     Local $iRes = GetCsGoResolution()
  557.     If $iRes > -1 Then
  558.         Local $aColor[3], $iCount = 0
  559.         For $iCount = 0 To 4
  560.             $aColor = _ColorGetRGB2($aExtraSlotBorderCoords[0], $aExtraSlotBorderCoords[1])
  561.             If _ColorIsEqual($aColor, $aExtraSlotBorderColor ) Then
  562.                 MouseClick("right", 820, 470)
  563.                 MouseClick("left", 863, 537)
  564.                 MouseClick("left", 1060, 666)
  565.                 Sleep(100)
  566.             Else
  567.                 ExitLoop
  568.             EndIf
  569.         Next
  570.     EndIf
  571. EndFunc   ;==>KickExtraPlayers
  572.  
  573. Func _ColorGetRGB2($XX, $YY)
  574.     Local $aRRGGBB[3], $iColor
  575.     $iColor = PixelGetColor($XX, $YY)
  576.     $aRRGGBB[0] = _ColorGetRed($iColor)
  577.     $aRRGGBB[1] = _ColorGetGreen($iColor)
  578.     $aRRGGBB[2] = _ColorGetBlue($iColor)
  579.     Return $aRRGGBB
  580. EndFunc   ;==>_ColorGetRGB2
  581.  
  582. Func _ColorIsEqual($aColor1, $aColor2)
  583.     Local $iCount
  584.     For $iCount = 0 To 2
  585.         If $aColor1[$iCount] <> $aColor2[$iCount] Then
  586.             Return False
  587.         EndIf
  588.     Next
  589.     Return True
  590. EndFunc   ;==>_ColorIsEqual
  591.  
  592. ;~ ;[882, 1003]
  593. Func ChangeLobbyPremissions($bLock, $bForceUpdate = False)
  594.     If $bLock <> $g_bIsLobbyClosed Or $bForceUpdate == True Then
  595.         $g_bIsLobbyClosed = $bLock
  596.         MouseClick("left", 882, 1003)
  597.         If $bLock == True Then
  598.             MouseClick("left", 1100, 570)
  599.         Else
  600.             MouseClick("left", 1100, 610)
  601.         EndIf
  602.     EndIf
  603. EndFunc   ;==>ChangeLobbyPremissions
  604.  
  605. Func LobbyWrite($sLobbyText)
  606.     If IsLobby() Then
  607.         Local $iRes = GetCsGoResolution()
  608.         If $iRes > -1 Then
  609.             MouseClick("left", $aChatClicPos[$iRes][0], $aChatClicPos[$iRes][1]) ; Lobby Chat Area
  610.             Send($sLobbyText)
  611.         EndIf
  612.     EndIf
  613. EndFunc   ;==>LobbyWrite
  614.  
  615. Func IsLobby()
  616.     Local $iRes = GetCsGoResolution()
  617.     If $iRes > -1 Then
  618.         Local $iColor
  619.         $iColor = PixelGetColor($aCheckLobbyPos[$iRes][0], $aCheckLobbyPos[$iRes][1])
  620.         If $iColor == $aLobbyTextCol[$iRes] Then ; IN LOBBY
  621.             Return True
  622.         EndIf
  623.     EndIf
  624.     Return False
  625. EndFunc   ;==>IsLobby
  626.  
  627. Func Accept()
  628.     Local $iRes = GetCsGoResolution()
  629.     If $iRes > -1 Then
  630.         If CountPlayers() == 5 Then
  631.             $lastbuttonHit = TimerInit()
  632.             MouseClick("left", $aAcceptClicPos[$iRes][0], $aAcceptClicPos[$iRes][1]) ; accept are
  633.             Return 1
  634.         EndIf
  635.     EndIf
  636.     LobbyWrite("Player left{Enter}")
  637.     Cancel()
  638.     Return 0
  639. EndFunc   ;==>Accept
  640.  
  641. Func IsThereAcceptButton()
  642.     Local $iRes = GetCsGoResolution()
  643.     If $iRes > -1 Then
  644.         Local $iColor
  645.         $iColor = PixelGetColor($aAcceptColorCheckPos[$iRes][0], $aAcceptColorCheckPos[$iRes][1])
  646.         If $iColor == $aAcceptMatchColor[$iRes] Then
  647.             Return True
  648.         EndIf
  649.     EndIf
  650.     Return False
  651. EndFunc   ;==>IsThereAcceptButton
  652.  
  653. Func Cancel()
  654.     MouseClick("left", 654, 172)
  655. EndFunc
  656.  
  657. Func IsThereYellowBanner()
  658.     Local $iRes = GetCsGoResolution()
  659.     If $iRes > -1 Then
  660.         If PixelGetColor($aReconnectMatchColor[$iRes][0], $aReconnectMatchColor[$iRes][1]) == $YELLOW_BANNER_COLOR Then
  661.             Return True
  662.         EndIf
  663.     EndIf
  664. EndFunc   ;==>IsThereYellowBanner
  665.  
  666. Func Reconnect()
  667.     Local $iRes = GetCsGoResolution()
  668.     If $iRes > -1 Then
  669.         MouseClick("left", $aReconnectClicPos[$iRes][0], $aReconnectClicPos[$iRes][1]) ; reconnect area
  670.     EndIf
  671. EndFunc   ;==>Reconnect
  672.  
  673. Func IsThereGoButton()
  674.     Local $iRes = GetCsGoResolution()
  675.     If $iRes == $1920x1080Index Then
  676.         $aColor = _ColorGetRGB2(1436, 1004) ; check GO button, netgraph has to not override the 'O' letter
  677.         If _ColorIsEqual($aColor, $aGoButtonColor) Then
  678.             Return True
  679.         EndIf
  680.     EndIf
  681.     Return False
  682. EndFunc   ;==>IsThereGoButton
  683.  
  684. Func Go()
  685.     Local $iRes = GetCsGoResolution()
  686.     If $iRes > -1 Then
  687.         If CountPlayers() == 5 Then
  688.             $lastbuttonHit = TimerInit()
  689.             MouseClick("left", 1436, 1004) ; accept area
  690.         Else
  691.             LobbyWrite("Player left{Enter}")
  692.         EndIf
  693.     EndIf
  694. EndFunc   ;==>Accept
  695.  
  696. Func IsSlotTaken($iSlot)
  697.     Local $aColor[3]
  698.     $aColor = _ColorGetRGB2(850 + 176 * $iSlot, 227)
  699.     If _ColorIsEqual($aColor, $aAvatarBorderColor) Then
  700.         Return True
  701.     EndIf
  702.     Return False
  703. EndFunc   ;==>IsSlotTaken
  704.  
  705.  
  706. ;~ Pépé Bizon: Player 2 color is 50 58 67
  707. ;~ Pépé Bizon: High Rankank
  708. ;~ Pépé Bizon: [Beta] Lobby analyser : Kicking High Rank Player 2
  709.  
  710. Func GetPlayerRank($iPlayer) ; Global Enum $eSilver, $eHighRank, $eUnranked
  711.     Local $aColor[3]
  712.     $aColor = _ColorGetRGB2(812 + 176 * $iPlayer, 363) ; check rank border color
  713. ;~  LobbyWrite( StringFormat("Player %d color is %d %d %d{Enter}", $iPlayer+1, $aColor[0], $aColor[1], $aColor[2]) )
  714.     If $aColor[0] >= 49 And $aColor[0] < 60 And $aColor[1] >= 49 And $aColor[1] < 60 Then ; Pépé Bizon: Player 1 color is 50 59 68
  715. ;~      LobbyWrite( "Silver or Unranked{Enter}" )
  716.         If $aColor[2] >= 49 And $aColor[2] < 60 Then
  717. ;~          LobbyWrite( "Silver !!{Enter}" )
  718.             Return $eSilver
  719.         ElseIf $aColor[2] >= 60 Then
  720. ;~          LobbyWrite( "Unranked !!{Enter}" )
  721.             Return $eUnranked
  722.         EndIf
  723.     EndIf
  724. ;~  LobbyWrite( "High Rankank !!{Enter}" )
  725.     Return $eHighRank
  726. EndFunc   ;==>GetPlayerRank
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement