Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;-------------------------------------------------
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;@ Author: @Ler_GG
- ;@ Release Date: 25.04.2015
- ;@ Purpose: Switches between scenes while
- ;@ streaming. Also supports auto
- ;@ accept for Matchmaking.
- ;@ Additionaly, it gets the
- ;@ current MMR from Dotabuff and
- ;@ writes it into a .txt so it
- ;@ can be included on stream.
- ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------------
- ;-------------------------------------------
- ; @@@@@@@ INCLUDES @@@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------
- #include <Array.au3>
- #include <Constants.au3>
- #include <IE.au3>
- #include <WindowsConstants.au3>
- ;-------------------------------------------
- ; @@@@@@@ CHECKSUMS @@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------
- Global $gameCheckSum_HUD_Standard = 520875552
- Global $gameCheckSum_HUD_ManaPool = 451971833
- Global $loginChecksumEU = 4166368323
- Global $GameFoundChecksum = 1781316133
- Global $apCheckSum_HUD_Standard = 3735100832
- Global $cmCheckSum = 3350032685
- ;-------------------------------------------
- ; @@@@@@@ VARIABLES @@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------
- Global $bStateLogin = True
- Global $bStateGame = True
- Global $nresetTimer = 0
- Global $oIE
- ;-------------------------------------------
- ; @@@@@@@ MAIN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------
- ; Initial rating on startup
- _getRating()
- ; Main loop
- While 1
- ; Sleep to lower CPU load.
- Sleep(1000)
- ; Updates MMR every 10 minutes.
- $nresetTimer = $nresetTimer + 1
- If $nresetTimer = 600 Then
- _getRating()
- $nresetTimer = 0
- EndIf
- ; Updates neccesary checksums
- $currentCheckSum = PixelChecksum(1608, 14, 1713, 31)
- $cmCheckS = PixelChecksum(551, 205, 659, 219)
- $apCheckS = PixelChecksum(372, 9, 524, 32)
- $GameFound = PixelChecksum(640, 410, 660, 430)
- ; Automatically clicks accept game button.
- If $GameFound = $GameFoundChecksum Then
- MouseClick("left", 660, 430)
- EndIf
- ; Checks for Main menu
- If $currentCheckSum = $loginChecksumEU Or $apCheckS = $apCheckSum_HUD_Standard Or $cmCheckS = $cmCheckSum And $bStateLogin = True Then
- Send("{F6}", 0)
- Sleep(100)
- Send("{F7}", 0)
- $bStateLogin = False
- $bStateGame = True
- EndIf
- ; Checks if Ingame
- $currentCheckSum = PixelChecksum(1687, 9, 1744, 28)
- If $currentCheckSum = $gameCheckSum_HUD_Standard And $bStateGame = True Or $currentCheckSum = $gameCheckSum_HUD_ManaPool And $bStateGame = True Then
- Send("{F7}", 0)
- Sleep(100)
- Send("{F6}", 0)
- $bStateGame = False
- $bStateLogin = True
- EndIf
- WEnd
- ;-------------------------------------------
- ; @@@@@@@ FUNCTIONS @@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------
- ;-------------------------------------------
- ; Function: _getRating()
- ;
- ; Usage: - Parses html body of Dotabuff
- ; to determine the actual mmr
- ; value.
- ;-------------------------------------------
- Func _getRating()
- ; Opens IE Invisible
- $oIE = _IECreate("about:blank", 0, 0)
- ; Navigates to Dotabuff Profile
- _IENavigate($oIE, "http://www.dotabuff.com/players/115909501")
- ; Returns all digits in the html body with the format 0000 in an array.
- ; Index 0 is the solo MMR when logged in.
- $stringMMR = StringRegExp(_IEBodyReadText($oIE), "\d\d\d\d", 1)
- _writeMMRData($stringMMR)
- ;~ MsgBox(0,"MMR",$stringMMR[0])
- ; Closes IE
- _IEQuit($oIE)
- EndFunc ;==>_getRating
- ;-------------------------------------------
- ; Function: _writeMMRData()
- ; Usage:
- ; - Writes an array into a file.
- ; Variables:
- ; - $aData: Array to write into file.
- ;-------------------------------------------
- Func _writeMMRData($aData)
- FileOpen("mmr.txt", 2)
- FileWrite("mmr.txt", $aData[0])
- FileClose("mmr.txt")
- EndFunc ;==>_writeMMRData
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement