Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Array.au3>
- ; BINDINGS
- HotKeySet("{F7}", "_exit")
- Global Const $iTrue = 1
- Global Const $iFalse = 0
- ; Minimap
- Global Const $arrMiniMap[4] = ["8","808","269","1067"]
- ; Player Colors
- Global Const $arrColorPlayersRadiant[5] = ["2777816","5824422","11206827","13881608","14572544"]
- Global Const $arrColorPlayersDire[5] = ["","","","",""]
- Global Const $iColorPlayer = 15921906
- Global Const $iColorLevelUp = 14269272
- Global Const $iColorHealth = 4502831
- ;Buildings
- Global Const $iColor_Frindly_Building = 8385024
- Global Const $iColor_Enemy_Building_Fog = 16711680
- Global Const $iColor_Enemy_Building = 16711680
- ; Safelane Mid Offlane
- Global Const $arrRadiant_Tower_PosX[9] = ["228","137","68","111","77","55","26","28","20"]
- Global Const $arrRadiant_Tower_PosY[9] = ["1049","1051","1049","964","985","1012","905","955","1000"]
- Global Const $arrDire_Tower_PosX[9] = ["54","139","204","149","184","216","252","252","254"]
- Global Const $arrDire_Tower_PosY[9] = ["830","830","834","925","898","868","969","932","884"]
- ; Units
- Global Const $iColor_Frindly_Creep = 5415168
- Global Const $iColor_Enemy_Unit = 11141120
- ;-------------------------------------------
- ; @@@@@@@ MAIN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ;-------------------------------------------
- While 1
- Sleep(100)
- _main()
- WEnd
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _main
- ; Syntax ........: _main()
- ; Return values .: None
- ; ===============================================================================================================================
- Func _main()
- Sleep(2000)
- $test = _determinePlayerColor($arrColorPlayersRadiant)
- _tt($test)
- EndFunc ;==>_main
- Func _tt($sToolTip)
- ToolTip($sToolTip,0,0)
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _generateBuildingState
- ; Description ...: Iterates building position arrays and checks if up or down
- ; Syntax ........: _generateBuildingState($bIsFrindly, $arrX, $arrY, $iArrLengths)
- ; Parameters ....: $bIsFrindly - 0 = enemy; 1 = Frindly
- ; $arrX - Array with X Coordinates
- ; $arrY - Array with Y Coordinates
- ; Return values .: Array with Building States; 0 or 1
- ; ===============================================================================================================================
- Func _generateBuildingState($bIsFrindly,$arrX,$arrY)
- ; Exception Handling
- If IsArray($arrX) and IsArray($arrY) and UBound($arrX) = UBound($arrY) Then
- Local $iArrLength = UBound($arrX)
- ; Initialize Array Range
- Local $iBuildingStates[$iArrLength]
- ; Check building state for every Index
- For $i = 0 To $iArrLength - 1
- Local $pos_current = _buildPoint($arrX[$i],$arrY[$i])
- $iBuildingStates[$i] = _checkBuildingState($bIsFrindly,$pos_current)
- Next
- Return $iBuildingStates
- Else
- _tt(" _generateBuildingState: Wrong Data Type or Array Length not Matching")
- Return 0
- EndIf
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _checkBuildingState
- ; Description ...: Checks a Coordinate on Minimap for Building status
- ; Syntax ........: _checkBuildingState($bIsFrindly, $Pos)
- ; Parameters ....: $bIsFrindly - 0 = Enemy; 1 = Frindly; Use 0,1
- ; $Pos - Building position on Minimap
- ; Return values .: True if Up / False if down
- ; ===============================================================================================================================
- Func _checkBuildingState($bIsFrindly,$Pos)
- ; Check Exceptions
- If IsArray($Pos) and ($bIsFrindly = 0 or $bIsFrindly = 1) Then
- ; Frindly Building
- If $bIsFrindly = 1 Then
- If PixelGetColor($Pos[0], $Pos[1]) = $iColor_Frindly_Building Then
- _tt("Frindly Building Up")
- Return True
- Else
- _tt("Frindly Building Down")
- Return False
- EndIf
- ; Enemy Building
- ElseIf $bIsFrindly = 0 Then
- If PixelGetColor($Pos[0], $Pos[1]) = $iColor_Enemy_Building or $iColor_Enemy_Building_Fog Then
- _tt("Enemy Building Up")
- Return True
- Else
- _tt("Enemy Building Down")
- Return False
- EndIf
- EndIf
- Else
- ; Exception
- _MsgBox("_checkBuildingState Wrong Parameters")
- Exit
- EndIf
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _findUnitPosition
- ; Description ...: Find Unit position of a given color on minimap
- ; Syntax ........: _findUnitPosition($arrSearchRange, $iColor)
- ; Parameters ....: $arrSearchRange - An array of TOPLEFT XY and BOTTOMRIGHT XY.
- ; $iColor - Color value of Unit
- ; Return values .: Unit Position on Minimap / False
- ; ===============================================================================================================================
- Func _findUnitPosition($arrSearchRange,$iColor)
- ; Exception Handling
- If IsArray($arrSearchRange) Then
- ; Search for Unit
- Local $posUnit
- $posUnit = PixelSearch($arrSearchRange[0],$arrSearchRange[1],$arrSearchRange[2],$arrSearchRange[3],$iColor,3)
- If IsArray($posUnit) Then
- _tt("Unit Found")
- Return $posUnit
- ElseIf Not @error Then
- _tt("Unit Not Found")
- Return False
- EndIf
- Else
- _tt("_findUnitPosition: Wrong Data Type")
- EndIf
- EndFunc
- ;~ Func _findPlayerPosition()
- ;~ EndFunc
- Func _determinePlayerColor($arrColors)
- Local $posCurrentColor
- Local $posTemp
- Local $iColorCurrent = 0
- Local $posX1 = 0
- Local $posY1 = 0
- Local $posX2 = 0
- Local $posY2 = 0
- For $i = 0 To UBound($arrColors) - 1
- $iColorCurrent = $arrColors[$i]
- $posCurrentColor = _findUnitPosition($arrMiniMap,$iColorCurrent)
- If IsArray($posCurrentColor) Then
- $posX1 = $posCurrentColor[0] + 10
- $posY1 = $posCurrentColor[1] + 10
- $posX2 = $posCurrentColor[0] + 10
- $posY2 = $posCurrentColor[1] + 10
- $posTemp = PixelSearch($posX1, $posY1,$posX2,$posY2,$iColorPlayer,7)
- If IsArray($posTemp) Then
- _tt("Player Color Determined")
- Return $iColorCurrent
- EndIF
- EndIf
- Next
- EndFunc
- Func _findSelfPosition()
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _checkLevelUp
- ; Syntax ........: _checkLevelUp()
- ; Return values .: True / False
- ; ===============================================================================================================================
- Func _checkLevelUp()
- Local $Pos = PixelSearch(843,937,1096,942,$iColorLevelUp, 1)
- If IsArray($Pos) Then
- _tt("Level Up")
- Return True
- Else
- _tt("No Level Up")
- Return False
- EndIf
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _checkDead
- ; Syntax ........: _checkDead()
- ; Return values .: True / False
- ; ===============================================================================================================================
- Func _checkDead()
- ; Check entire Health Bar for HealthColor
- Local $Pos = PixelSearch(781,1017, 1095,1043, $iColorHealth, 10)
- If IsArray($Pos) Then
- _tt("Not Dead")
- Return False
- Else
- _tt("Dead")
- Return True
- EndIf
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _buildPoint
- ; Description ...:
- ; Syntax ........: _buildPoint($iX, $iY)
- ; Parameters ....: $iX - An integer value.
- ; $iY - An integer value.
- ; Return values .: Array with X Y
- ; ===============================================================================================================================
- Func _buildPoint($iX,$iY)
- Local $posPoint[2]
- $posPoint[0] = $iX
- $posPoint[1] = $iY
- Return $posPoint
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _calculatePointDistance
- ; Syntax ........: _calculatePointDistance($pos_1, $pos_2)
- ; Parameters ....: $pos_1
- ; $pos_2
- ; Return values .: Distance between points
- ; Author ........: Your Name
- ; ===============================================================================================================================
- Func _calculatePointDistance($pos_1,$pos_2)
- ; Exception Handling
- If IsArray($pos_1) and IsArray($pos_2) Then
- ; Point 1
- Local $pos_x1 = $pos_1[0]
- Local $pos_y1 = $pos_1[1]
- ; Point 2
- Local $pos_x2 = $pos_2[0]
- Local $pos_y2 = $pos_2[1]
- ; Calculate Distance and make it Integer
- Local $iDistance = Sqrt((($pos_x2-$pos_x1)*($pos_x2-$pos_x1)) + (($pos_y2-$pos_y1)*($pos_y2-$pos_y1)))
- $iDistance = Int($iDistance)
- Return $iDistance
- Else
- _MsgBox("_calculatePointDistance: Wrong Parameters")
- Return 0
- EndIf
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _MsgBox
- ; Description ...: Debug Function
- ; Syntax ........: _MsgBox($sMsgbox)
- ; Parameters ....: $sMsgbox - A string value.
- ; Return values .: None
- ; ===============================================================================================================================
- Func _MsgBox($sMsgbox)
- MsgBox(0,"Debug",$sMsgbox)
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _convertTimer
- ; Description ...: Calculate Time in seconds
- ; Syntax ........: _convertTimer($timer)
- ; Parameters ....: $timer - A dll struct value.
- ; Return values .: Timer in Seconds
- ; ===============================================================================================================================
- Func _convertTimer($timer)
- Local $iConvertedTimer = Int(TimerDiff($timer) / 1000)
- Return $iConvertedTimer
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name ..........: _exit
- ; Syntax ........: _exit()
- ; Return values .: None
- ; ===============================================================================================================================
- Func _exit()
- Exit
- EndFunc ;==>_exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement