Option Explicit
' By音符,QQ:337855632 Time:2020-03-17 功能定制:20元起
Const C_GameWith = 800
Const C_GameHeight = 600
Const C_GameSmallWith = 240
Const C_GameSmallHeight = 180
'黑带   22  28  (50  65)
Dim GamehWnd, dm, AppName, config, bgkms, KMData
config = ".\Angel.ini"
AppName = "Angel_HX"
Function CmpMutlColor(Args, Sleep)
    Dim i
    For i = 0 To UBound(Args)
        CmpMutlColor = (dm.CmpColor(Args(i)(0), Args(i)(1), Args(i)(2), Args(i)(3)) = 0)
        If CmpMutlColor = False Then Exit For
        Api.Delay Sleep
    Next
End Function

Const C_WorkProgress = 4
Class QQSpeed_Class
    Public [局数], [位置], [方向键]
    Private [游戏大区], DownCpu, StartMode
    Private HIndex, WorkList, HNext, hStatic
    Private Game, iTime(3), StartTime, MarkTime, LoginTime, Angel, Vip
    Private leave
    Public Function [准备游戏]()  '准备游戏'
        Do
            Api.Delay 10
        Loop
    End Function
    Public Sub Start(Arys)
        Dim Stmp, Zh
        HIndex = Arys
        ThreadEnter 1
        With Globals("Form")
            [方向键] = Array(38, 87, 104)(.Controls("方向按键").ListIndex)
            If .Controls("游戏降耗").Value Then
                DownCpu = Int(.Controls("游戏降耗T").Text)
            End If
        End With

        WorkList = Globals("QQSpeed").Item(HIndex)
        JScript.AddCode Globals("CString_Class")
        ThreadLeave 1
        If UBound(WorkList) = 0 Then
            Exit Sub
        End If
        [局数] = WorkList(C_WorkProgress + 2)
        Set CString = JScript.Eval("new CString_Class")
        Set Angel = CreateObject("QQSpeed.Angel")
        Call Angel.Init(Api)
        Set Vip = Angel.Vip
        Zh = Split(WorkList(3), "----")
        [游戏大区] = Array("*", "电信", "联通", "电信2")(File.ReadINI(AppName, "游戏大区.ListIndex", config, 0))
        GamehWnd = WorkList(C_WorkProgress + 1)
        If Api.ECall("user32", "IsWindow", GamehWnd) = False Then
            If WorkList(2) = "" Then
                If UBound(Zh) > 0 Then
                    GamehWnd = Vip.GethWnd(Zh(0), [游戏大区])
                End If
            Else
                GamehWnd = Window.FindEx(0, "GAMEAPP", "QQ飞车*【" & [游戏大区] & "区】*【" & WorkList(2) & "】*", 2)
            End If
        End If
        Set dm = [创建大漠]()
        Set bgkms = CreateObject("QMPlugin.bgkms6_10")
        If UBound(Zh) > 0 And GamehWnd = 0 Then
            GamehWnd = [自动上号](Zh(0), Zh(1), "自动上号")
        End If
        If GamehWnd = 0 Then Exit Sub
        If WorkList(2) = "" Then
            Zh = Split(Window.GetText(GamehWnd), "【")
            ThreadEnter 1
            Globals("Form").Controls("ListBox").object.ListBox.List(HIndex) = Left(Zh(3), InStr(Zh(3), "】") - 1)
            ThreadLeave 1
        End If
        If [调整窗口](GamehWnd) = False Then
            ' ListView.SetText ListhWnd(0), HIndex, 5, "分辨率错误"
            MsgBox "游戏窗口分辨率错误,请设置为:" & C_GameWith & " x " & C_GameHeight & "!" & vbCrLf & "如果飞车分辨率无误, 请设置系统桌面分辨率为100%后注销系统", 4096 + 16, "错误"
            Exit Sub
        End If
        Call [绑定窗口](GamehWnd)
        Call SetTime(0, True)
        StartTime = Now()
        Set Game = Eval("New [QQSpeed_" & "火线追击" & "]")
        Set Game.Father = Me
        Call Game.GuaJi
        HNext = True
    End Sub
    Public Function [调整窗口](hWnd)  '调整窗口'
        Dim x1, y1, x2, y2
        Dim i
        Window.Restore hWnd
        Window.Active hWnd
        Api.Delay 500
        For i = 0 To 15
            Call Window.GetClientRect(hWnd, x1, y1, x2, y2)
            If x2 = C_GameSmallWith And y2 = C_GameSmallHeight Then
                [调整窗口] = True
                Exit Function
            ElseIf x2 <> C_GameWith Or y2 <> C_GameHeight Then
                Window.KeyPress hWnd, 119
                Api.Delay 800
            Else
                [调整窗口] = True
                Exit Function
            End If
        Next
    End Function
    Private Function [创建大漠]()
        Set [创建大漠] = CreateObject("dm.dmsoft")
        [创建大漠].SetShowErrorMsg 0
    End Function
    Private Sub [绑定窗口](hWnd)
        Dim i, iLeft, iTop, ScreenWidth, ScreenHeight, HeightCount, WidthCount
        i = File.ReadINI(AppName, "窗口排列.ListIndex", config, 0)
        If i = 6 Then
            iLeft = -C_GameSmallWith + 1
            iTop = -C_GameSmallHeight + 1
        Else
            ScreenWidth = Api.ECall("user32", "GetSystemMetrics", 0)
            ScreenHeight = Api.ECall("user32", "GetSystemMetrics", 1)
            If i = 0 Or i = 3 Then
                iTop = 50
                HeightCount = (ScreenHeight - C_GameSmallHeight + iTop) \ iTop
            Else
                iTop = C_GameSmallHeight
                HeightCount = ScreenHeight \ iTop
            End If
            If i = 2 Or i = 5 Then
                WidthCount = ScreenWidth \ C_GameSmallWith
                iLeft = (HIndex Mod WidthCount) * C_GameSmallWith
                iTop = (HIndex \ WidthCount) * C_GameSmallHeight
            Else
                iLeft = (HIndex \ HeightCount) * C_GameSmallWith
                iTop = (HIndex Mod HeightCount) * iTop
            End If
            iLeft = IIf(i >= 3, ScreenWidth - C_GameSmallWith + 5 - iLeft, -5 + iLeft)
            If iLeft > ScreenWidth Then
                iLeft = -5
            ElseIf iLeft < -C_GameSmallWith Then
                iLeft = ScreenWidth - C_GameSmallWith + 5
            End If
            If iTop > ScreenHeight Then iTop = 0
        End If
        Window.SetStyle hWnd, 128
        Window.Size hWnd, C_GameWith, C_GameHeight
        Window.ClientMove hWnd, iLeft, iTop, C_GameSmallWith, C_GameSmallHeight
        KMData = bgkms.KMTransform(hWnd, 1)
        If KMData = 0 Then
            MsgBox "获得窗口数据失败!请检测杀毒设置!"
            Api.StopThread -1
        End If

        ' Const WS_CHILD = &H40000000
        ' Const WS_CLIPSIBLINGS = &H4000000
        ' Const WS_VISIBLE = &H10000000
        ' hStatic = Api.ECall("user32.dll", "CreateWindowExW", 0, "Static", "局数:" & [局数], WS_CHILD Or WS_VISIBLE, C_GameSmallWith * 0.5, C_GameSmallHeight * 0.3, 100, 20, _
        ' hWnd, 0, Api.ECall("kernel32.dll", "GetModuleHandleW", 0), 0)
        hStatic = dm.CreateFoobarRect(hWnd, C_GameSmallWith * 0.5, C_GameSmallHeight * 0.3, 100, 20)
        Call dm.FoobarDrawText(hStatic, 0, 0, 200, 30, "局数:" & [局数], "111111", 1)
        Call dm.FoobarUpdate(hStatic)
        
        Api.Delay 100
        i = dm.BindWindowEx(hWnd, "dx2", "windows", "windows", "", 0)
        Api.Delay 200
        ' If DownCpu then dm.DownCpu DownCpu
        If DownCpu Then bgkms.SaveCPU hWnd, DownCpu
    End Sub
    Private Function [上号判断](hWnd, Message)
        Dim i, hWnds, hWndE
        hWnds = Window.EnumWindows(0, "#32770", "QQ安全中心", 32)
        For i = 0 To UBound(hWnds)
            If Vip.IsSameWindow(hWnds(i), hWnd) Then
                If UBound(Window.EnumWindowsEx(hWnds(i), "Static", "密码验证错误", 32)) >= 0 Then
                    Message = "密码错误"
                    WorkList(C_WorkProgress + 3) = &H10000 * 3
                    [上号判断] = True
                    Exit Function
                ElseIf UBound(Window.EnumWindowsEx(hWnds(i), "Static", "*验证码*", 2 + 32)) >= 0 Then
                    Message = "验证码"
                    If InStr(File.ReadINI(AppName, "其他设置", config), "1自动滑块") Then
                        Call Angel.Slider(hWnds(i))
                    End If
                End If
            End If
        Next
        hWnds = Window.EnumWindows(0, "#32770", "提示", 32)
        For i = 0 To UBound(hWnds)
            If Vip.IsSameWindow(hWnds(i), hWnd) Then
                hWndE = Window.FindEx(hWnds(i), "maqHyperTextCtrl", 0, 32)
                If hWndE Then
                    Message = Angel.GetWindowText(hWndE)
                    If InStr(Message, "网络环境") = 0 Then
                        WorkList(C_WorkProgress + 3) = &H10000 * 2
                    End If
                Else
                    Message = "网络环境异常"
                End If
                [上号判断] = True
            End If
        Next
    End Function
    Private Function [自动上号](QQ, Pwd, Message)
        Dim i, Count, TryMax, hWnds, hWnd, Wait, path, ID
        Wait = File.ReadINI(AppName, "上号间隔.text", config, 50)
        If File.ReadINI(AppName, "登录重试.Value", config, 1) Then
            TryMax = File.ReadINI(AppName, "登录重试T.text", config, 3)
        End If
        If InStr(File.ReadINI(AppName, "其他设置", config), "1飞车路径") Then
            path = File.ReadINI(AppName, "飞车路径", config)
        End If
        Do
            Count = Count + 1
            ' ListView.SetText ListhWnd(0), HIndex, 4, Message & " " & Count
            ThreadEnter 3 '线程锁
            Api.Delay 100
            hWnds = Window.EnumWindows(0, "#32770", "QQ飞车", 32)
            For i = 0 To UBound(hWnds)
                dm.SetWindowState hWnds(i), 0
            Next
            ID = Window.GetInfo(Vip.QQSpeedLogin(QQ, Pwd, File.ReadINI(AppName, "游戏大区.ListIndex", config, 0) - 1, , , path), 3)
            Api.Delay 500   '授权确定
            hWnds = Window.EnumWindows(0, "#32770", "QQ飞车", 32)
            For i = 0 To UBound(hWnds)
                hWnd = Api.ECall("user32", "FindWindowExW", hWnds(i), 0, "#32770", "QQ飞车")
                if hWnd then
                    Window.LeftClick hWnd, 40, 10
                end if 
            Next
            Api.Delay 1000
            hWnds = Vip.EnumWindows("#32770", "QQ飞车", "330-100", "220-100")
            If UBound(hWnds) >= 0 Then dm.SetWindowText hWnds(0), "QQ飞车" & QQ
            ThreadLeave 3
            For i = 0 To Wait
                hWnd = Window.Find("#32770", "QQ飞车" & QQ)
                If hWnd Then
                    Api.Delay 1000
                    If [上号判断](hWnd, Message) Then
                        i = 999
                        dm.SetWindowState hWnd, 13
                        Exit For
                    End If
                Else
                    Exit Do
                End If
            Next
            If i > Wait Then
                dm.SetWindowState hWnd, 0
                Api.Delay 200
                dm.SetWindowState hWnd, 13
            End If
        Loop While Count <= TryMax
        If i > Wait Then
            ' ListView.SetText ListhWnd(0), HIndex, 4, Message
        ElseIf WorkList(2) = "" Then
            [自动上号] = Vip.GethWnd(QQ)
            If [自动上号] = 0 Then  '不支持热启动
                [自动上号] = Vip.GethWndByID(ID)
            End If
            WorkList(C_WorkProgress + 1) = [自动上号]
        Else
            [自动上号] = Window.FindEx(0, "GAMEAPP", "QQ飞车*【" & [游戏大区] & "区】*【" & WorkList(2) & "】*", 2)
        End If
        ThreadEnter 2
        File.WriteText ".\上号日志.txt", "上号时间:" & Now & String(3, vbTab) & "模式:火线追击" & String(3, vbTab) & "第" & HIndex + 1 & "个号:" & QQ & _
        String(3, vbTab) & "局数:" & [局数] & String(3, vbTab) & IIf([自动上号], "【成功】", "【失败】" & Message) & vbCrLf & vbCrLf, True
        ThreadLeave 2
        Api.Delay 1000
        If [自动上号] = 0 Then
            WorkList(C_WorkProgress + 3) = WorkList(C_WorkProgress + 3) Or 2
            Api.StopThread -1
        End If
        LoginTime = dm.GetTime()
    End Function
    Private Function [掉线重连]()
        Dim Wait, Zh
        dm.SetWindowState GamehWnd, 13
        If File.ReadINI(AppName, "上号延时.Value", config, 1) Then
            Wait = File.ReadINI(AppName, "上号延时T.text", config, 5)
        End If
        Api.Delay Wait * 1000
        Zh = Split(WorkList(3), "----")
        GamehWnd = [自动上号](Zh(0), Zh(1), "掉线重连")
        If GamehWnd = 0 Then Exit Function
        If [调整窗口](GamehWnd) = False Then
            ' ListView.SetText ListhWnd(0), HIndex, 5, "分辨率错误"
            Exit Function
        End If
        Call [绑定窗口](GamehWnd)
        [掉线重连] = True
    End Function
    Public Sub [完成一局](Sleep)
        [局数] = [局数] + 1
        ' Api.ECall "user32", "SetWindowTextW", hStatic, "局数:" & [局数]
        Call dm.FoobarFillRect(hStatic, 0, 0, 200, 200, "D4D0C8")
        Call dm.FoobarDrawText(hStatic, 0, 0, 200, 30, "局数:" & [局数], "111111", 1)
        Call dm.FoobarUpdate(hStatic)
        Api.Delay Sleep
    End Sub
    Public Function [清理弹窗](Mode)
        Dim IntX, IntY
        If CBool(State([位置])) And CBool(Mode And 4) = False Then  '清理 黑屏
            Window.KeyUp GamehWnd, 18
            If dm.FindColor(203, 28, 215, 42, "FFFFFF", 0.9, 6, IntX, IntY) = 0 Then
                Window.KeyPress GamehWnd, 27
                Api.Delay 200
            End If
            If dm.FindMultiColor(130, 10, 210, 65, "F4892A-080808", "2|0|181818-181818,2|1|181818-181818", 0.9, 6, IntX, IntY) Then
                Window.LeftClick GamehWnd, IntX, IntY
                Api.Delay 300
            End If
        ElseIf CBool(Mode And 2) = False Then
            If CmpMutlColor(Array(Array(233, 4, "804A1B-784315", 0.9), Array(236, 3, "131313-0A0A0A", 0.9), Array(2, 7, "151D2F-060606", 0.9)), 2) Then '活动推荐
                Window.LeftClick GamehWnd, 233, 4
                Api.Delay 300
            End If
        End If
        If CmpMutlColor(Array(Array(157, 88, "FFFFFF-070707", 0.9), Array(166, 80, "36727D-060606", 0.9), Array(65, 75, "272727-060606", 0.9), Array(207, 37, "333333-060606", 0.9)), 2) Then '游戏内 退出
            Window.LeftClick GamehWnd, 179, 66
            Api.Delay 300
        End If
    End Function
    Public Sub [点击位置]([位置], Flag)
        Dim i, ClickTo, j, IntX, IntY
        i = InStr([位置], "_")
        If i Then
            Call [点击位置](Left([位置], i - 1), 0)
        End If
        Select Case [位置]
        Case "多人游戏"
            ' Window.LeftClick GamehWnd, 40,25 '经典飞车
            For i = 0 To 2
                dm.MoveTo 37, 7
                Window.LeftClick GamehWnd, 37, 7
                Api.Delay 500
            Next
            Window.LeftClick GamehWnd, 140, 141 '关消息窗口
        Case "多人游戏_快速进入"
            ClickTo = Split(Flag, "-")
            Window.LeftClick GamehWnd, 37, 7
            Api.Delay 500
            IntX = 20
            For i = 0 To UBound(ClickTo)
                IntY = ClickTo(i)
                bgkms.MoveTo KMData, IntX, IntY
                ' dm.MoveTo IntX, IntY
                Api.Delay 300
                Window.LeftClick GamehWnd, IntX, IntY
                Api.Delay 300
                IntX = IntX + 37
            Next
        Case "菜单"
            dm.MoveTo 2, 177
            Window.LeftClick GamehWnd, 2, 177
            Api.Delay 500
        Case "菜单_多人游戏"
            Const TOP = 21
            dm.MoveTo 40, 110
            Api.Delay 600
            Window.LeftClick GamehWnd, 100, TOP + Flag * 12  '双人冲锋=3'
        End Select
    End Sub
    Public Sub [强制到位置](IniTime)
        Dim i
        IniTime = True
        Call SetTime(1, IniTime)
        [位置] = 0
        Do Until Game.IsIn() Or CBool(Game.Where(1))
            If i = 0 Then
                i = dm.GetTime() - LoginTime > 15000
                If i = 0 Then
                    i = Where(0) = 1
                    dm.MoveTo Int((25 - 10 + 1) * Rnd(1) + 10), 10
                    dm.LeftClick
                    Api.Delay 50
                    dm.KeyPress 27
                End If
            Else
                Call Game.Go
                Api.Delay 1000
                Call [清理弹窗](2)
                Api.Delay 500
            End If
            If Handling(1, 60, IniTime) = -1 Then
                Call [强制到位置](IniTime)
                Exit Do
            End If
        Loop
        IniTime = True
    End Sub
    Public Function [位置被改变](Num, IniTime)
        Dim i
        If [位置] <> Num Then
            [位置] = Num
            IniTime = True
            [位置被改变] = 1
            Select Case [位置]
            Case 0
                ' ListView.SetText ListhWnd(0), HIndex, 5, "准备中:" & [局数]
            Case 1
                ' ListView.SetText ListhWnd(0), HIndex, 5, "游戏中:" & [局数]
            End Select
            Call SetTime(1, IniTime)
        End If
    End Function

    Public Function Where(ByVal Flag)
        Select Case Flag
        Case 0 '游戏大厅'
            If CmpMutlColor(Array(Array(38, 2, "FFE76B-08090C", 0.9), Array(47, 3, "0DBDE2-0C140E", 0.9), Array(90, 3, "0DBDE2-0C140E", 0.9)), 2) Then
               Where = 1 + dm.CmpColor(229, 5, "F8D95B-0D0F07", 0.9)
            End If
        Case 1 '游戏中'
            Where = CmpMutlColor(Array(Array(47, 30, "B7B7B8-111111", 0.9), Array(30, 30, "B5B5B6-111111", 0.9), Array(207, 37, "FFFFFF-111111", 0.9)), 20)
        Case 2 '游戏房间'
            Where = CmpMutlColor(Array(Array(30, 2, "FFE66D-06080B", 0.9), Array(229, 5, "F8D85B-08100D", 0.9)), 2) And dm.CmpColor(47, 3, "0DBDE2-0C140E", 0.9) = 1 'dm.CmpColor(0, 2, "FFF472-111111", 0.9) = 1
        End Select
    End Function
    Public Function State(ByVal WZ) '弹窗
        If WZ = 2 Or WZ = 3 Then
            WZ = 0
        End If
        If WZ = 0 Then
            If dm.CmpColor(229, 5, "312B12-080808", 0.9) = 0 Then
                State = 1
            ElseIf CmpMutlColor(Array(Array(34, 2, "332F15-08090C", 0.9), Array(76, 3, "03252D-0C140E", 0.9)), 2) Then
                State = 2   '游戏大厅'
            ElseIf CmpMutlColor(Array(Array(4,11,"161616-161616",0.9),Array(53,2,"161616-161616",0.9),Array(29,2,"161616-161616",0.9)), 2) Then '黑屏
                State = 3   '黑屏'
            End If
        ElseIf WZ = 1 Then

        End If
    End Function
    Public Function SetTime(Index, IniTime)
        If IniTime Then
            iTime(Index) = Now()
            IniTime = False
            SetTime = True
        End If
    End Function
    Public Function Handling(Index, S, IniTime)
        Dim i
        Handling = 0
        If DateDiff("s", iTime(Index), Now()) > S Then '超时处理
            IniTime = True
            Handling = Detect(1)
        End If
        i = DateDiff("s", StartTime, Now())
        If i - MarkTime >= 10 Then
            MarkTime = i
            If Handling = 0 Then Handling = Detect(0)
        End If
    End Function
    Public Function Detect(Default)
        Dim x1, y1, x2, y2
        Select Case True
        Case Default <> 0
            Detect = Default
        Case Api.ECall("user32", "IsWindow", GamehWnd) = 0
            Detect = 11
        Case Else
            For x1 = 0 To 15
                If Api.ECall("user32", "IsHungAppWindow", GamehWnd) = 0 Then
                    Exit For
                End If
                Api.Delay 1000
            Next
            If x1 = 16 Then
                Detect = 12
            Else
                Call Window.GetClientRect(GamehWnd, x1, y1, x2, y2)
                If x2 <> C_GameSmallWith Or y2 <> C_GameSmallHeight Then
                    Call [调整窗口](GamehWnd)
                End If
            End If
        End Select
        If Detect Then
            If InStr(WorkList(3), "----") Then
                If [掉线重连] Then
                    ' Call SetTime(0, True)
                    ' StartTime = Now()
                    ' MarkTime = 0
                    Detect = -1
                End If
            End If
        End If
    End Function
    Public Sub ThreadEnter(Nun)
        Api.EnterCriticalSection Nun
        leave = Nun
    End Sub
    Public Sub ThreadLeave(Nun)
        Api.LeaveCriticalSection Nun
        leave = 0
    End Sub
    Public Function IIf(p, a, b)
        If p Then
            IIf = a
        Else
            IIf = b
        End If
    End Function
    Private Sub GameOver()
        If leave Then Api.LeaveCriticalSection leave  '防止手动中止
        dm.FoobarClose hStatic
        Call Api.ECall("Kernel32.dll", "CloseHandle", WorkList(0))
        If HNext Then
            dm.SetWindowState GamehWnd, 13
            WorkList(C_WorkProgress + 3) = 1
            Api.EnterCriticalSection 1
            Globals("QQSpeed").Item(HIndex) = WorkList
            Call Api.ECall("user32.dll", "SendMessageW", Globals("Form").hWnd, &H8004&, HIndex, StartMode)
            Api.LeaveCriticalSection 1
            Exit Sub
        End If

        WorkList(C_WorkProgress + 2) = [局数]
        Api.EnterCriticalSection 1
        Globals("QQSpeed").Item(HIndex) = WorkList
        If WorkList(C_WorkProgress + 3) And 2 Then
            Call Api.ECall("user32.dll", "SendMessageW", Globals("Form").hWnd, &H8004&, HIndex, StartMode)
        End If
        Api.LeaveCriticalSection 1
        If GamehWnd = 0 Then Exit Sub
        Dim x1, y1, x2, y2
        Window.GetClientRect GamehWnd, x1, y1, x2, y2
        If x2 = C_GameSmallWith Then
            ' If DownCpu then dm.DownCpu 0
            If DownCpu Then bgkms.SaveCPU GamehWnd, 0
            bgkms.KMUntransform KMData
            dm.UnBindWindow
            Api.Delay 50
            Window.SetStyle GamehWnd, 1 + 16 + 128
            Window.Size GamehWnd, C_GameWith, C_GameHeight
            Api.Delay 100
            Window.ClientMove GamehWnd, 0, 0, C_GameWith, C_GameHeight
        End If
    End Sub
    Private Sub Class_Initialize()
        Window.Delay = "40-80"
    End Sub
    Private Sub Class_Terminate()
        GameOver
        ' Api.EnterCriticalSection 1
        ' Globals("Form").Controls("ListBox").object.ListBox.Selected(HIndex) = False
        ' Api.LeaveCriticalSection 1
    End Sub
End Class
Class [QQSpeed_火线追击]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime
        Dim i
         QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 80, 5   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                Api.Delay 1000
                If dm.CmpColor(227, 144, "FB2C2D-0A0A0A", 0.9) = 0 Then
                    dm.KeyDown QQSpeed.[方向键]
                    If dm.CmpColor(152, 137, "C6F2F8-160A08", 0.9) = 0 Then
                        For i = 0 To 50
                            Window.KeyPress GamehWnd, QQSpeed.[方向键]
                            Api.Delay 50
                        Next
                    End If
                End If
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 230, 4 '退出房间'
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                 QQSpeed.[强制到位置] IniTime
            Else
                If CmpMutlColor(Array(Array(162, 89, "FCFEFE-0A0808", 0.9), Array(182, 77, "F6FBFE-0C0A08", 0.9), Array(235, 169, "440909-080808", 0.9), Array(157, 111, "D02624-090808", 0.9)), 2) Then '匹配中
                    If dm.CmpColor(229, 5, "F8D85B-08100D", 0.9) = 0 And dm.FindColor(110, 166, 124, 171, "FFFF2A-0A3127", 0.9, 0, i, i) = 1 Then '超时
                        Window.LeftClick GamehWnd, 230, 4 '退出房间'
                        IniTime = True
                        Call QQSpeed.SetTime(1, IniTime)
                    End If
                    Api.Delay 500
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            If QQSpeed.[位置] = 0 Then
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                     QQSpeed.[强制到位置] IniTime
                End Select
            ElseIf QQSpeed.[位置] = 1 Then
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                     QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(47, 30, "B7B7B8-111111", 0.9) = 1 Then
                    QQSpeed.[位置] = 2  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End If
            Api.Delay 100
        Loop
    End Sub
    Public Function IsIn() '是否在边境'
        If Where(2) Then Window.LeftClick GamehWnd, 230, 4 '退出房间'
        IsIn = CmpMutlColor(Array(Array(211, 32, "0971FF-070906", 0.9), Array(130, 33, "0863F6-060707", 0.9), Array(102, 32, "D6D6D6-090909", 0.9), Array(52, 32, "086FFF-060806", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub Go()
        QQSpeed.[点击位置] "多人游戏_快速进入", "163-163"
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
End Class