Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 KB | None | 0 0
  1. #include <Array.au3>
  2.  
  3. ; BINDINGS
  4. HotKeySet("{F7}", "_exit")
  5.  
  6. Global Const $iTrue = 1
  7. Global Const $iFalse = 0
  8.  
  9. ; Minimap
  10. Global Const $arrMiniMap[4] = ["8","808","269","1067"]
  11.  
  12. ; Player Colors
  13. Global Const $arrColorPlayersRadiant[5] = ["2777816","5824422","11206827","13881608","14572544"]
  14. Global Const $arrColorPlayersDire[5] = ["","","","",""]
  15. Global Const $iColorPlayer = 15921906
  16. Global Const $iColorLevelUp = 14269272
  17. Global Const $iColorHealth = 4502831
  18.  
  19. ;Buildings
  20. Global Const $iColor_Frindly_Building = 8385024
  21. Global Const $iColor_Enemy_Building_Fog = 16711680
  22. Global Const $iColor_Enemy_Building = 16711680
  23.  
  24. ; Safelane Mid Offlane
  25. Global Const $arrRadiant_Tower_PosX[9] = ["228","137","68","111","77","55","26","28","20"]
  26. Global Const $arrRadiant_Tower_PosY[9] = ["1049","1051","1049","964","985","1012","905","955","1000"]
  27.  
  28. Global Const $arrDire_Tower_PosX[9] = ["54","139","204","149","184","216","252","252","254"]
  29. Global Const $arrDire_Tower_PosY[9] = ["830","830","834","925","898","868","969","932","884"]
  30.  
  31. ; Units
  32. Global Const $iColor_Frindly_Creep = 5415168
  33. Global Const $iColor_Enemy_Unit = 11141120
  34.  
  35.  
  36.  
  37.  
  38. ;-------------------------------------------
  39. ; @@@@@@@ MAIN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  40. ;-------------------------------------------
  41. While 1
  42. Sleep(100)
  43. _main()
  44. WEnd
  45.  
  46.  
  47.  
  48. ; #FUNCTION# ====================================================================================================================
  49. ; Name ..........: _main
  50. ; Syntax ........: _main()
  51. ; Return values .: None
  52. ; ===============================================================================================================================
  53. Func _main()
  54. Sleep(2000)
  55. $test = _determinePlayerColor($arrColorPlayersRadiant)
  56. _tt($test)
  57.  
  58. EndFunc ;==>_main
  59.  
  60.  
  61. Func _tt($sToolTip)
  62. ToolTip($sToolTip,0,0)
  63. EndFunc
  64.  
  65. ; #FUNCTION# ====================================================================================================================
  66. ; Name ..........: _generateBuildingState
  67. ; Description ...: Iterates building position arrays and checks if up or down
  68. ; Syntax ........: _generateBuildingState($bIsFrindly, $arrX, $arrY, $iArrLengths)
  69. ; Parameters ....: $bIsFrindly - 0 = enemy; 1 = Frindly
  70. ; $arrX - Array with X Coordinates
  71. ; $arrY - Array with Y Coordinates
  72. ; Return values .: Array with Building States; 0 or 1
  73. ; ===============================================================================================================================
  74. Func _generateBuildingState($bIsFrindly,$arrX,$arrY)
  75.  
  76. ; Exception Handling
  77. If IsArray($arrX) and IsArray($arrY) and UBound($arrX) = UBound($arrY) Then
  78. Local $iArrLength = UBound($arrX)
  79. ; Initialize Array Range
  80. Local $iBuildingStates[$iArrLength]
  81. ; Check building state for every Index
  82. For $i = 0 To $iArrLength - 1
  83. Local $pos_current = _buildPoint($arrX[$i],$arrY[$i])
  84. $iBuildingStates[$i] = _checkBuildingState($bIsFrindly,$pos_current)
  85. Next
  86. Return $iBuildingStates
  87. Else
  88. _tt(" _generateBuildingState: Wrong Data Type or Array Length not Matching")
  89. Return 0
  90. EndIf
  91. EndFunc
  92.  
  93. ; #FUNCTION# ====================================================================================================================
  94. ; Name ..........: _checkBuildingState
  95. ; Description ...: Checks a Coordinate on Minimap for Building status
  96. ; Syntax ........: _checkBuildingState($bIsFrindly, $Pos)
  97. ; Parameters ....: $bIsFrindly - 0 = Enemy; 1 = Frindly; Use 0,1
  98. ; $Pos - Building position on Minimap
  99. ; Return values .: True if Up / False if down
  100. ; ===============================================================================================================================
  101. Func _checkBuildingState($bIsFrindly,$Pos)
  102. ; Check Exceptions
  103. If IsArray($Pos) and ($bIsFrindly = 0 or $bIsFrindly = 1) Then
  104. ; Frindly Building
  105. If $bIsFrindly = 1 Then
  106. If PixelGetColor($Pos[0], $Pos[1]) = $iColor_Frindly_Building Then
  107. _tt("Frindly Building Up")
  108. Return True
  109. Else
  110. _tt("Frindly Building Down")
  111. Return False
  112. EndIf
  113. ; Enemy Building
  114. ElseIf $bIsFrindly = 0 Then
  115. If PixelGetColor($Pos[0], $Pos[1]) = $iColor_Enemy_Building or $iColor_Enemy_Building_Fog Then
  116. _tt("Enemy Building Up")
  117. Return True
  118. Else
  119. _tt("Enemy Building Down")
  120. Return False
  121. EndIf
  122. EndIf
  123. Else
  124. ; Exception
  125. _MsgBox("_checkBuildingState Wrong Parameters")
  126. Exit
  127. EndIf
  128. EndFunc
  129.  
  130. ; #FUNCTION# ====================================================================================================================
  131. ; Name ..........: _findUnitPosition
  132. ; Description ...: Find Unit position of a given color on minimap
  133. ; Syntax ........: _findUnitPosition($arrSearchRange, $iColor)
  134. ; Parameters ....: $arrSearchRange - An array of TOPLEFT XY and BOTTOMRIGHT XY.
  135. ; $iColor - Color value of Unit
  136. ; Return values .: Unit Position on Minimap / False
  137. ; ===============================================================================================================================
  138. Func _findUnitPosition($arrSearchRange,$iColor)
  139. ; Exception Handling
  140. If IsArray($arrSearchRange) Then
  141. ; Search for Unit
  142. Local $posUnit
  143. $posUnit = PixelSearch($arrSearchRange[0],$arrSearchRange[1],$arrSearchRange[2],$arrSearchRange[3],$iColor,3)
  144. If IsArray($posUnit) Then
  145. _tt("Unit Found")
  146. Return $posUnit
  147. ElseIf Not @error Then
  148. _tt("Unit Not Found")
  149. Return False
  150. EndIf
  151. Else
  152. _tt("_findUnitPosition: Wrong Data Type")
  153. EndIf
  154. EndFunc
  155.  
  156. ;~ Func _findPlayerPosition()
  157.  
  158. ;~ EndFunc
  159.  
  160.  
  161. Func _determinePlayerColor($arrColors)
  162.  
  163. Local $posCurrentColor
  164. Local $posTemp
  165. Local $iColorCurrent = 0
  166. Local $posX1 = 0
  167. Local $posY1 = 0
  168. Local $posX2 = 0
  169. Local $posY2 = 0
  170.  
  171. For $i = 0 To UBound($arrColors) - 1
  172.  
  173. $iColorCurrent = $arrColors[$i]
  174. $posCurrentColor = _findUnitPosition($arrMiniMap,$iColorCurrent)
  175.  
  176. If IsArray($posCurrentColor) Then
  177.  
  178. $posX1 = $posCurrentColor[0] + 10
  179. $posY1 = $posCurrentColor[1] + 10
  180. $posX2 = $posCurrentColor[0] + 10
  181. $posY2 = $posCurrentColor[1] + 10
  182. $posTemp = PixelSearch($posX1, $posY1,$posX2,$posY2,$iColorPlayer,7)
  183. If IsArray($posTemp) Then
  184. _tt("Player Color Determined")
  185. Return $iColorCurrent
  186. EndIF
  187. EndIf
  188. Next
  189. EndFunc
  190.  
  191. Func _findSelfPosition()
  192.  
  193. EndFunc
  194.  
  195. ; #FUNCTION# ====================================================================================================================
  196. ; Name ..........: _checkLevelUp
  197. ; Syntax ........: _checkLevelUp()
  198. ; Return values .: True / False
  199. ; ===============================================================================================================================
  200. Func _checkLevelUp()
  201. Local $Pos = PixelSearch(843,937,1096,942,$iColorLevelUp, 1)
  202. If IsArray($Pos) Then
  203. _tt("Level Up")
  204. Return True
  205. Else
  206. _tt("No Level Up")
  207. Return False
  208. EndIf
  209. EndFunc
  210.  
  211. ; #FUNCTION# ====================================================================================================================
  212. ; Name ..........: _checkDead
  213. ; Syntax ........: _checkDead()
  214. ; Return values .: True / False
  215. ; ===============================================================================================================================
  216. Func _checkDead()
  217. ; Check entire Health Bar for HealthColor
  218. Local $Pos = PixelSearch(781,1017, 1095,1043, $iColorHealth, 10)
  219. If IsArray($Pos) Then
  220. _tt("Not Dead")
  221. Return False
  222. Else
  223. _tt("Dead")
  224. Return True
  225. EndIf
  226. EndFunc
  227.  
  228. ; #FUNCTION# ====================================================================================================================
  229. ; Name ..........: _buildPoint
  230. ; Description ...:
  231. ; Syntax ........: _buildPoint($iX, $iY)
  232. ; Parameters ....: $iX - An integer value.
  233. ; $iY - An integer value.
  234. ; Return values .: Array with X Y
  235. ; ===============================================================================================================================
  236. Func _buildPoint($iX,$iY)
  237. Local $posPoint[2]
  238. $posPoint[0] = $iX
  239. $posPoint[1] = $iY
  240. Return $posPoint
  241. EndFunc
  242.  
  243. ; #FUNCTION# ====================================================================================================================
  244. ; Name ..........: _calculatePointDistance
  245. ; Syntax ........: _calculatePointDistance($pos_1, $pos_2)
  246. ; Parameters ....: $pos_1
  247. ; $pos_2
  248. ; Return values .: Distance between points
  249. ; Author ........: Your Name
  250. ; ===============================================================================================================================
  251. Func _calculatePointDistance($pos_1,$pos_2)
  252. ; Exception Handling
  253. If IsArray($pos_1) and IsArray($pos_2) Then
  254. ; Point 1
  255. Local $pos_x1 = $pos_1[0]
  256. Local $pos_y1 = $pos_1[1]
  257. ; Point 2
  258. Local $pos_x2 = $pos_2[0]
  259. Local $pos_y2 = $pos_2[1]
  260. ; Calculate Distance and make it Integer
  261. Local $iDistance = Sqrt((($pos_x2-$pos_x1)*($pos_x2-$pos_x1)) + (($pos_y2-$pos_y1)*($pos_y2-$pos_y1)))
  262. $iDistance = Int($iDistance)
  263. Return $iDistance
  264. Else
  265. _MsgBox("_calculatePointDistance: Wrong Parameters")
  266. Return 0
  267. EndIf
  268. EndFunc
  269.  
  270. ; #FUNCTION# ====================================================================================================================
  271. ; Name ..........: _MsgBox
  272. ; Description ...: Debug Function
  273. ; Syntax ........: _MsgBox($sMsgbox)
  274. ; Parameters ....: $sMsgbox - A string value.
  275. ; Return values .: None
  276. ; ===============================================================================================================================
  277. Func _MsgBox($sMsgbox)
  278. MsgBox(0,"Debug",$sMsgbox)
  279. EndFunc
  280.  
  281. ; #FUNCTION# ====================================================================================================================
  282. ; Name ..........: _convertTimer
  283. ; Description ...: Calculate Time in seconds
  284. ; Syntax ........: _convertTimer($timer)
  285. ; Parameters ....: $timer - A dll struct value.
  286. ; Return values .: Timer in Seconds
  287. ; ===============================================================================================================================
  288. Func _convertTimer($timer)
  289. Local $iConvertedTimer = Int(TimerDiff($timer) / 1000)
  290. Return $iConvertedTimer
  291. EndFunc
  292.  
  293. ; #FUNCTION# ====================================================================================================================
  294. ; Name ..........: _exit
  295. ; Syntax ........: _exit()
  296. ; Return values .: None
  297. ; ===============================================================================================================================
  298. Func _exit()
  299. Exit
  300. EndFunc ;==>_exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement