click hộ phát

Thứ Bảy, 12 tháng 8, 2017

Liên minh huyền thoại hà tuấn đạt

 
 đây là source code của hiển thị tầm LOL
 
https://autoitvn.com/threads/lien-minh-huyen-thoai-tool-hien-tam-ban-xa-thu-co-source.1033/
 
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <Math.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Lien minh huyen thoai - Tam ban", 350, 42, 192, 124)
GUISetFont(10, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Hien thi", 232, 0, 97, 33)
$Input1 = GUICtrlCreateInput("", 112, 8, 113, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_NOHIDESEL,$ES_NUMBER,$WS_CLIPSIBLINGS), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Label1 = GUICtrlCreateLabel("Tam ban xa thu: ", 8, 8, 101, 20)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetState($Button1,$GUI_DISABLE)
            $AttackRange = GUICtrlRead($Input1)
            GUICtrlSetState($Button1,$GUI_ENABLE)
            ExitLoop(1)

    EndSwitch
WEnd

Global $Cat = 1
Global Const $pi = 3.14
Global $last_x,$last_y,$x,$y
Global $MRadius = _Max(@DesktopWidth,@DesktopHeight) *(40/1024)
Global $O1[3] = [@DesktopWidth*(456/1024),@DesktopHeight*399/1024,$AttackRange] ; Có 3 phần tử:
; 2 phần tử đầu là tọa độ ở giữa màn hình (tâm của hình elip)
; phần tử cuối là tầm đánh của xạ thủ
Global $O2[3] = [@DesktopWidth*(456/1024),@DesktopHeight*399/1024,$AttackRange-(5*$MRadius)]
Global $hGui = GUICreate("My Draw",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))

GUISetBkColor(345)

$hChild=GUICtrlCreateGraphic(0,0,@DesktopWidth,@DesktopHeight)

$x = MouseGetPos(0)
$y = MouseGetPos(1)
GUICtrlSetGraphic($hChild,$GUI_GR_COLOR,345,345)
ElipByRadius($hChild,$x,$y,$MRadius)
$last_x = $x
$last_y = $y
GUICtrlSetGraphic($hChild, $GUI_GR_COLOR, 0x00ff00, 345)
GUICtrlSetGraphic($hChild, $GUI_GR_PENSIZE,3)
ElipByRadius($hChild,$O1[0],$O1[1],$O1[2])
GUICtrlSetBkColor($hChild, 345)

_WinAPI_SetLayeredWindowAttributes($hChild, 345, 255) ; making the GUI transparent
_WinAPI_SetParent($hChild, 0)
_WinAPI_SetLayeredWindowAttributes($hGui, 345, 255) ; making the GUI transparent
_WinAPI_SetParent($hGui, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUICtrlSetState($Button1,$GUI_DISABLE)
            $AttackRange = GUICtrlRead($Input1)
            GUICtrlSetState($Button1,$GUI_ENABLE)
            $Cat = 1
            $O1[2] = $AttackRange; Chỉnh sửa lại tầm bắn của xạ thủ
    EndSwitch
    $x = MouseGetPos(0)
    $y = MouseGetPos(1)
    If (Abs($last_x-$x) <= 10 And Abs($last_y-$y) <= 10) Then
        ContinueLoop(1)
    EndIf

    If $Cat = 1 Then
        $Cat = 0
        GUICtrlDelete($hChild)
        $hChild=GUICtrlCreateGraphic(0,0,@DesktopWidth,@DesktopHeight)
        GUICtrlSetGraphic($hChild, $GUI_GR_COLOR, 0x00ff00, 345)
        GUICtrlSetGraphic($hChild, $GUI_GR_PENSIZE,3)
        ElipByRadius($hChild,$O1[0],$O1[1],$O1[2])
        GUICtrlSetBkColor($hChild, 345)
        _WinAPI_SetLayeredWindowAttributes($hChild, 345, 255) ; making the GUI transparent
        _WinAPI_SetParent($hChild, 0)
    EndIf

    If (Cat($O1,$x,$y)=1 And Cat($O2,$x,$y)=0) Then
        $Cat = 1
        GUICtrlSetGraphic($hChild,$GUI_GR_COLOR,345,345)
        ElipByRadius($hChild,MouseGetPos(0),MouseGetPos(1),$MRadius)
        GUICtrlSetBkColor($hChild, 345)
    EndIf
    GUISetState(@SW_SHOW)
    $last_x = MouseGetPos(0)
    $last_y = MouseGetPos(1)
Wend

Func Cat($O,$x1,$y1) ; Kiểm tra xem nếu chuột có tọa độ ($x1,$y1) thì có cắt elip O hay không?
    $rx = ($O[2] * (@DesktopWidth/960)/2)
    $ry = ($O[2] * (@DesktopHeight/960)/2)
    $MinX = _Max(0,$O[0]-$rx)
    $MaxX = _Min($O[0]+$rx,@DesktopWidth)
    $MinY = _Max(0,$O[1]-$ry)
    $MaxY = _Min($O[1]+$ry,@DesktopHeight)
    For $i = _Max(0,$x1-$MRadius) To _Min($x1+$MRadius,@DesktopWidth) Step 1
        For $j = _Max(0,$y1-$MRadius) To _Min($y1+$MRadius,@DesktopHeight) Step 1
;~             If ($MinX<=$i And $i <=$MaxX And $MinY<=$j And $j<=$MaxY) Then
            If (Sqr($i-$O[0])/Sqr($rx)+Sqr($j-$O[1])/Sqr($ry)-1<=0) Then
;~                 MsgBox(0,0,$MinX&' '&$MaxX&' '&$MinY&' '&$MaxY&' '&$x1&' '&$y1)
                return 1
            EndIf
        Next
    Next
    return 0
EndFunc

Func ElipByRadius($hGui,$x,$y,$r) ; x, y là tâm của đường tròn
    $rx = $r * (@DesktopWidth/960)
    $ry = $r * (@DesktopHeight/960)
    $x -= ($rx/2)
    $y -= ($ry/2)
    GUICtrlSetGraphic($hGui, $GUI_GR_ELLIPSE, $x,$y,$rx,$ry)
EndFunc

Func Sqr($a)
    return $a*$a
EndFunc

Func Bang ($a,$b)
    return Abs($a-$b)>=0.00001
EndFunc

Không có nhận xét nào: