Option Explicit
Const C_GameWith = 1024
Const C_GameHeight = 768
Const C_GameSmallWith = 320
Const C_GameSmallHeight = 240
'黑带   16  20
Dim GamehWnd, dm, AppName, config, bgkms, KMData
config = ".\Angel.ini"
AppName = "Angel_BP"
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
Class ListView_Class
    Sub SetText(ByVal hWnd, ByVal x, ByVal y, ByVal m)
        Dim pszText, LVITEM
        pszText = Api.StrConv(m, 128)
        Set LVITEM = Api.Malloc(39)
        LVITEM.SetVal(0, 4) = &H1
        LVITEM.SetVal(4, 4) = x
        LVITEM.SetVal(8, 4) = y
        LVITEM.SetVal(20, 4) = Api.StrPtr(pszText)
        Call Api.ECall("user32.dll", "SendMessageA", hWnd, &H1000 + 6, 0, LVITEM.GetPtr(0))
    End Sub
    Function GetText(ByVal hWnd, ByVal x, ByVal y)
        Dim pszText, LVITEM
        pszText = Space(100)
        Set LVITEM = Api.Malloc(39)
        LVITEM.SetVal(8, 4) = y
        LVITEM.SetVal(24, 4) = Len(pszText)
        LVITEM.SetVal(20, 4) = Api.StrPtr(pszText)
        GetText = LeftB(pszText, Api.ECall("user32.dll", "SendMessageA", hWnd, &H1000 + 45, x, LVITEM.GetPtr(0)))
        GetText = Api.StrConv(GetText, &H40)
    End Function
End Class
Const C_WorkProgress = 4
Class QQSpeed_Class
    Public [局数], [位置], [方向键]
    Private [防止休眠], [游戏大区], [开启截图], DownCpu, StartMode
    Private HIndex, WorkList, WorkIndex, ListView, ListhWnd(1), HNext
    Private Game, itime(3), StartTime, MarkTime, LoginTime, Angel, Vip, mFSO, picPath
    Private leave
    Public Function [准备游戏]()  '准备游戏'
        If dm.CmpColor(25, 5, "7C1601-111111", 0.9) = 0 Then
            Window.LeftClick GamehWnd, 30, 3  '开始游戏
            Api.Delay 500
        End If
    End Function
    Public Sub Start(Arys)
        Dim Stmp, i
        HIndex = Arys
        Set ListView = New ListView_Class
        ThreadEnter 1
        With Globals("Form")
            [方向键] = Array(38,87,104)(.Controls("方向按键").ListIndex)
            ListhWnd(0) = .Controls("ListView1").object.ListView.hWnd
            ListhWnd(1) = .Controls("ListView2").object.ListView.hWnd
            StartMode = .Controls("启动方式").ListIndex
            DownCpu = Int(.Controls("游戏降耗").text)
        End With
        WorkList = Globals("QQSpeed").Item(HIndex)
        JScript.AddCode Globals("CString_Class")
        ThreadLeave 1
        i = UBound(WorkList)
        If i = 0 Then
            Exit Sub
        End If
        WorkIndex = WorkList(0)(C_WorkProgress) + 1
        if WorkIndex > i Then
            HNext = 2
            Exit Sub
        End If
        [局数] = WorkList(0)(C_WorkProgress + 2)
        Set CString = JScript.Eval("new CString_Class")
        Set dm = [创建大漠]()
        Set bgkms = CreateObject("QMPlugin.bgkms6_10")
        [游戏大区] = WorkList(0)(3)
        If Len([游戏大区]) = 0 Then [游戏大区] = "*"
        GamehWnd = WorkList(0)(C_WorkProgress + 1)
        If StartMode = 1 Then
            Set Angel = CreateObject("QQSpeed.Angel")
            Call Angel.Init(Api)
            Set Vip = Angel.Vip
            If Api.ECall("user32", "IsWindow", GamehWnd) = False Then
                GamehWnd = Vip.GethWnd(WorkList(0)(1))
                If GamehWnd = 0 Then
                    GamehWnd = [自动上号](WorkList(0)(1), WorkList(0)(2), "自动上号")
                End If
            End If
        Else
            GamehWnd = Window.FindEx(0, "GAMEAPP", "QQ飞车*【" & [游戏大区] & "区】*【" & WorkList(0)(2) & "】*", 2)
        End If
        If GamehWnd = 0 Then Exit Sub
        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)
        Dim ws
        Set ws = CreateObject("WScript.Shell")
        picPath = ws.specialfolders("MyDocuments") & "\QQ飞车\" & WorkList(0)(1) & "\截图\"
        [开启截图] = InStr(File.ReadINI(AppName, "其他设置", config), "1自动截图")
        For i = WorkIndex To UBound(WorkList)
            WorkIndex = i
            Call SetTime(0, True)
            StartTime = Now()
            MarkTime = 0
            ListView.SetText ListhWnd(0), HIndex, 4, WorkList(i)(1)
            ListView.SetText ListhWnd(0), HIndex, 5, "换模式:" & [局数]
            If InStr("|边境模式|顺子大作战|跳跳派对|绝命车王|秘境闯关|互助接力赛|酷币大作战|双人冲锋战|超能竞速赛|狂野追逐|变身派对|极速对决|浪漫邂逅|双人冲顶赛|换车拉力赛|全城通缉令|超时空巨人赛|", "|" & WorkList(i)(1) & "|") Then
                Set Game = Eval("New [QQSpeed_" & WorkList(i)(1) & "]")
                Set Game.Father = Me
                Call Game.GuaJi
            Else
                Set Game = Eval("New [QQSpeed_" & "多功能" & "]")
                Set Game.Father = Me
                ExeCute "Game.[" & WorkList(i)(1) & "]"
            End If
            [局数] = 0
        Next
        HNext = 1
    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
        Api.Delay 100
        i = dm.BindWindowEx(hWnd, "dx2", "windows", "windows", "", 0)
        ' msgbox i
        Api.Delay 200
        ' If DownCpu Then dm.DownCpu DownCpu
        If DownCpu then bgkms.SaveCPU GamehWnd, DownCpu
    End Sub
    Public Function [自动开箱](Count, IntX, IntY, Margin, Args)
        Dim i
        For i = Count To 0 Step -1  '开宝箱'
            Window.LeftClick GamehWnd, IntX - i * Margin, IntY
            Api.Delay 300
            If Eval(Args(0)) Then
                Call [自动截图]("FFFFFF-555555", 100, 88, 220, 158)
                If UBound(Args) Then ExeCute Args(1)
            End If
            If UBound(Args) > 1 Then ExeCute Args(2)
        Next
    End Function
    Public Function [自动截图](Color, x1, y1, x2, y2)
        Dim Save, img, pic, IntX, IntY
        If [开启截图] Then
            Save = ".\截图\"
            pic = [获取文件]()
            If pic = "" Then Exit Function
            Set img = mFSO.GetFile(pic & ".jpg")
            With [创建大漠]()
                IntX = C_GameWith / C_GameSmallWith
                IntY = C_GameHeight / C_GameSmallHeight
                .SetDisplayInput "pic:" & pic & ".bmp"
                .AddDict 0, "084110A4171A037FD080280882080100000208421184E10440B0198008008008$永久$0.0.58$11"
                If .FindStrFast(x1 * IntX, y1 * IntY, x2 * IntX, y2 * IntY, "永久", Color, 0.9, IntX, IntY) >= 0 Then
                    If Not mFSO.FolderExists(Save) Then mFSO.CreateFolder Save
                    img.Copy Save & WorkList(0)(1) & "_" & CString.GetMid(Window.GetText(GamehWnd), "【", "】") & "_" & Api.Format(Now, "yyyy-mm-dd h.mm.ss") & "_" & WorkList(WorkIndex)(1) & ".jpg"
                End If
                .FreePic (pic & ".bmp")
            End With
            mFSO.DeleteFile pic & ".bmp"
            img.Delete
            'Call dm.Capture(0, 0, C_GameSmallWith, C_GameSmallHeight, pic & "screen.bmp")
        End If
    End Function
    Private Function [获取文件]()
        Dim i, j, t, path
        Window.KeyPress GamehWnd, 115
        t = Now()
        Api.Delay 200
        For i = 0 To 10
            j = i Mod 2
            If j = 0 Then Api.Delay 200
            path = picPath & Api.Format(DateAdd("s", -j, t), "yyyymmdd_hhmmss")
            If mFSO.FileExists(path & ".jpg") Then
                [获取文件] = path
                Exit For
            End If
        Next
        If [获取文件] = "" Then Exit Function
        For i = 0 To 10
            If dm.ImageToBmp(path & ".jpg", path & ".bmp") Then
            ' If Not File.IsLock(Path) Then
                Exit For
            End If
            Api.Delay 200
        Next
        If i = 11 Then [获取文件] = ""
    End Function

    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(0)(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(0)(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
            i = InStr("电信联通电信2", [游戏大区]) - 1
            ID = Window.GetInfo(Vip.QQSpeedLogin(QQ, Pwd, Int(i / 2), , , 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 StartMode Then
            '[自动上号] = Vip.GethWnd(QQ)
            If [自动上号] = 0 Then  '不支持热启动
                [自动上号] = Vip.GethWndByID(ID)
            End If
            WorkList(0)(C_WorkProgress + 1) = [自动上号]
        Else
            [自动上号] = Window.FindEx(0, "GAMEAPP", "QQ飞车*【" & [游戏大区] & "区】*【" & WorkList(0)(2) & "】*", 2)
        End If
        ThreadEnter 2
        File.WriteText ".\上号日志.txt", "上号时间:" & Now & String(3, vbTab) & "模式:" & WorkList(WorkIndex)(1) & String(3, vbTab) & "第" & HIndex + 1 & "个号:" & IIf(StartMode, WorkList(0)(1), WorkList(0)(2)) & _
        String(3, vbTab) & "局数:" & [局数] & String(3, vbTab) & IIf([自动上号], "【成功】", "【失败】" & Message) & vbCrLf & vbCrLf, True
        ThreadLeave 2
        Api.Delay 1000
        If [自动上号] = 0 Then
            WorkList(0)(C_WorkProgress + 3) = WorkList(0)(C_WorkProgress + 3) Or 2
            Api.StopThread -1
        End If
        LoginTime = dm.GetTime()
    End Function
    Private Function [掉线重连]()
        Dim Wait
        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
        GamehWnd = [自动上号](WorkList(0)(1), WorkList(0)(2), "掉线重连")
        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.Delay Sleep
        ListView.SetText ListhWnd(0), HIndex, 5, "已完成:" & [局数]
    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(281, 36, 292, 47, "FFFFFF", 0.9, 0, IntX, IntY) = 0 Then
                Window.KeyPress GamehWnd, 27
                Api.Delay 200
            End If
            If dm.FindMultiColor(185, 33, 300, 100, "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(309, 4, "FAE162-080808", 0.9), Array(311, 74, "FCE56F-341A03", 0.9)), 2) Then '返回键
                If dm.CmpColor(16, 235, "FCDC4E-08112B", 0.9) = 1 Then
                    ' Call dm.Capture(0, 0, C_GameSmallWith, C_GameSmallHeight, "C:\screen.bmp")
                    ' msgbox 111
                    If mode And 1 Then
                        [清理弹窗] = [清理弹窗] Or 2
                    Else
                        Api.Delay 2000
                        If Game.IsIn() = False Then
                            Window.LeftClick GamehWnd, 311, 4  '退出房间'
                            Api.Delay 300
                        End If
                    End If
                End If
            End If
        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.KeyPress GamehWnd, 13  '点回车
            Api.Delay 200
            dm.SetWindowState GamehWnd,1  '使窗口获得焦点
            Api.Delay 200
            ' Window.LeftClick GamehWnd, 42, 25 '经典飞车
            For i = 0 To 2
                dm.MoveTo 32, 7
                Window.LeftClick GamehWnd, 37, 7
                Api.Delay 500
            Next
            Window.LeftClick GamehWnd, 146, 197 '关消息窗口
        Case "多人游戏_快速进入"
            ClickTo = Split(Flag, "-")
            Window.LeftClick GamehWnd, 37, 7
            Api.Delay 300
            dm.MoveTo 20, 25
            Api.Delay 300
            IntX = 20
            For i = 0 To UBound(ClickTo)
                IntY = ClickTo(i)
                dm.MoveTo IntX, IntY
                Api.Delay 300
                Window.LeftClick GamehWnd, IntX, IntY
                Api.Delay 300
                IntX = IntX + 38
            Next
        Case "菜单"
            Window.KeyPress GamehWnd, 13  '点回车
            Api.Delay 200
            dm.SetWindowState GamehWnd,1  '使窗口获得焦点
            Api.Delay 200
            Window.LeftClick GamehWnd, 2, 235
            Api.Delay 300
        Case "菜单_多人游戏"
            'Flag = Flag - 2
            Const BOTTOM = 235
            dm.MoveTo 40, 162
            Api.Delay 600
            Window.LeftClick GamehWnd, 100, BOTTOM - Flag * 12
        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))
            Call [清理弹窗](0)
            If i = 0 Then
                i = dm.GetTime() - LoginTime > 15000
                If i = 0 Then
                    i = Where(0) = 1
                    dm.MoveTo Int((30 - 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 [位置被改变](ByVal Num, IniTime)
        Dim i
        If Num = 0 Or Num = 2 Then
            i = [可以下个模式]()
            If i < 0 Then
                [位置被改变] = i
                Exit Function
            End If
        End If
        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, "游戏中:" & [局数]
            Case 2
                ListView.SetText ListhWnd(0), HIndex, 5, "房间中:" & [局数]
            End Select
            Call SetTime(1, IniTime)
        End If
    End Function
    Public Function [可以下个模式]()
        Dim i
        i = Api.Val(WorkList(WorkIndex)(3))
        If i > 0 Then
            If DateDiff("s", itime(0), Now()) > i * 60 Then
                [可以下个模式] = -2
            End If
        End If
        i = Api.Val(WorkList(WorkIndex)(2))
        If i > 0 And [局数] >= i Then
            [可以下个模式] = -1
        End If
        If [可以下个模式] < 0 Then
            Window.LeftClick GamehWnd, 311, 4  '退出房间'
        End If
    End Function
    Public Function Where(ByVal Flag)
        Select Case Flag
        Case 0 '游戏大厅
            If CmpMutlColor(Array(Array(0, 8, "FFC50E-081108", 0.9), Array(49, 3, "0DBDE2-0C140E", 0.9), Array(92, 3, "0DBDE2-0C140E", 0.9)), 2) Then
               Where = 1 + dm.CmpColor(309, 5, "F8D95B-0D0F07", 0.9)
            End If
        Case 1 '游戏中'
            Where = CmpMutlColor(Array(Array(52, 30, "E8E8E8-080808", 0.9), Array(29, 31, "C5C5C5-080808", 0.9), Array(52, 11, "949492-080808", 0.9)), 20)
        Case 2 '游戏房间'
            Where = CmpMutlColor(Array(Array(309, 4, "FAE162-080808", 0.9), Array(35, 2, "FFE76B-080808", 0.9)), 20) And dm.CmpColor(0, 8, "FFC50E-081108", 0.9) = 1
        Case 3 '颁奖中'
        Case 4 '匹配中'
            Where = CmpMutlColor(Array(Array(147, 225, "0CD9DF-071111", 0.9), Array(172, 225, "0BD9DF-081111", 0.9), Array(147, 230, "0DB2C1-091918", 0.9), Array(172, 230, "0CB3C1-091818", 0.9)), 2) And dm.CmpColor(1161, 219, "0BD9DF-081111", 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(309, 4, "322D14-080808", 0.9) = 0 Then
                State = 1
            ElseIf CmpMutlColor(Array(Array(34, 2, "332E15-080808", 0.9), Array(309, 4, "0F242B-080808", 0.9)), 2) Then
                State = 2   '游戏大厅'
            ElseIf CmpMutlColor(Array(Array(4,12,"002333-161616",0.9),Array(34,2,"152E33-161616",0.9),Array(68,2,"2E2703-161616",0.9)), 2) Then '黑屏
                State = 3   '黑屏'
            End If
        ElseIf WZ = 1 Then
            If CmpMutlColor(Array(Array(52, 30, "2E2E2E-080808", 0.9), Array(29, 31, "272727-080808", 0.9), Array(52, 11, "1C1D1C-080808", 0.9)), 2) Then
                State = 1
            End If
        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
            ListView.SetText ListhWnd(0), HIndex, 4, WorkList(WorkIndex)(1) & ":" & (i \ 10) * 10
            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 StartMode = 1 Then
                ListView.SetText ListhWnd(0), HIndex, 5, "重连" & Detect & ":" & [局数]
                If [掉线重连] Then
                    ' Call SetTime(0, True)
                    ' StartTime = Now()
                    ' MarkTime = 0
                    KMData = 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()
        Dim x1, y1, x2, y2
        If leave Then Api.LeaveCriticalSection leave  '防止手动中止
        Call Api.ECall("Kernel32.dll", "CloseHandle", WorkList(0)(0))
        If HNext Then
            ListView.SetText ListhWnd(0), HIndex, 5, "完成"
            If HNext = 1 Then
                ListView.SetText ListhWnd(0), HIndex, 4, WorkList(WorkIndex)(1)
                dm.SetWindowState GamehWnd, 13
            End If
            WorkList(0)(C_WorkProgress + 3) = 1
            Api.EnterCriticalSection 1
            Globals("QQSpeed").Item(HIndex) = WorkList
            Call Api.ECall("user32.dll", "SendMessageA", Globals("Form").hWnd, &H8004&, HIndex + 1, StartMode)
            Api.LeaveCriticalSection 1
            Exit Sub
        End If
        ListView.SetText ListhWnd(0), HIndex, 4, WorkList(WorkIndex)(1)
        ListView.SetText ListhWnd(0), HIndex, 5, IIf(WorkList(0)(C_WorkProgress + 3) And 2, "上号失败", "手动中止")
        WorkList(0)(C_WorkProgress) = WorkIndex - 1 '保存进度
        WorkList(0)(C_WorkProgress + 2) = [局数]
        Api.EnterCriticalSection 1
        Globals("QQSpeed").Item(HIndex) = WorkList
        If WorkList(0)(C_WorkProgress + 3) And 2 Then
            Call Api.ECall("user32.dll", "SendMessageW", Globals("Form").hWnd, &H8004&, HIndex + 1, StartMode)
        End If
        Api.LeaveCriticalSection 1
        If GamehWnd = 0 Then Exit Sub
        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
            If KMData then 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-100"
        Set mFSO = CreateObject("Scripting.FileSystemObject")
    End Sub
    Private Sub Class_Terminate()
        GameOver
        Api.EnterCriticalSection 1
        Globals("Form").Controls("ListView1").object.ListView.ListItems(HIndex + 1).Checked = 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
                Api.Delay 200
                If dm.CmpColor(108, 75, "FFFFFF", 0.9) = 0 Then '选择频道'
                    Window.LeftClick GamehWnd, 100, 132 + 20 * i
                Else
                    Window.LeftClick GamehWnd, 100, 90 '再来一次'
                End If
            ElseIf Where(1) Then
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf CmpMutlColor(Array(Array(24, 74, "303030-080808", 0.9), Array(22, 105, "0B0706-080808", 0.9)), 20) Then '正在进入游戏'
                Api.Delay 1000
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 80, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 180, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(285, 44, "FFFFFF", 1) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Function IsIn() '是否在边境'
        IsIn = CmpMutlColor(Array(Array(105, 60, "F68608-0B1F0A", 0.9), Array(70, 59, "F78609-0A1D0B", 0.9), Array(114, 69, "05C7CF-071411", 0.9), Array(92, 69, "05C8CF-081412", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub Go()
        Dim i
        For i = 0 To 3
            Window.LeftClick GamehWnd, 38, 7
            Api.Delay 200
        Next
        Window.LeftClick GamehWnd, 220, 3
        Api.Delay 500
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
End Class
Class [QQSpeed_跳跳派对]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 50, 88  '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                dm.KeyDown QQSpeed.[方向键]
                For i = 0 To 1
                    Window.KeyPress GamehWnd, 32
                    Api.Delay 500
                Next
                Window.KeyPress GamehWnd, 17
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                If CmpMutlColor(Array(Array(283, 223, "40D6F8-090C08", 0.9), Array(292, 223, "3DD6F8-0B0C07", 0.9), Array(258, 212, "2279F3-090B10", 0.9)), 2) Then '返回键
                    Window.LeftClick GamehWnd, 275, 217
                    Api.Delay 500
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                    Class_Initialize
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                    Class_Initialize
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 2000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 11
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(17, 65, "FCC57D-070706", 0.9), Array(126, 44, "A3DABD-090709", 0.9), Array(132, 44, "C4E4B9-090709", 0.9), Array(15, 130, "80C5B2-080707", 0.9)), 2)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](2, 91, 145, 30, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
    Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_顺子大作战]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 50,80   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
             dm.KeyDown QQSpeed.[方向键]
             Api.Delay 4000
                Window.KeyDown GamehWnd, 68
                Api.Delay 1300
                Window.KeyUp GamehWnd, 68
                Window.KeyPress GamehWnd, 17
                Window.KeyPress GamehWnd, 32
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 13
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(175,38,"56B5BF-060606",0.9),Array(101,166,"8AC0B3-070606",0.9),Array(20,110,"64EEB6-080707",0.9),Array(51,168,"D4E2E2-070607",0.9)), 2)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](2, 120, 140, 40, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_绝命车王]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 42, 105   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
             dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                Window.KeyPress GamehWnd, 17    '点击contrl'
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 10
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(17, 208, "45090C-060606", 0.9), Array(38, 184, "C68D4A-070807", 0.9), Array(10, 144, "2C1113-070707", 0.9), Array(7, 45, "291010-060707", 0.9)), 2)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](2, 115, 155, 39, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_秘境闯关]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i, itime
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                If dm.GetTime Mod 2 Then
                    Window.LeftClick GamehWnd, 160, 50
                Else
                    Window.LeftClick GamehWnd, 85, 100   '单人匹配'
                End If
                Api.Delay 200
            ElseIf Where(1) Then
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                LuckyBox()
                i = QQSpeed.[位置被改变](2, IniTime)
                If i < 0 Then Exit Do
                If dm.CmpColor(26, 235, "0D4959-070909", 0.9) = 1 Then  'BUG 进了普通房间
                    Window.LeftClick GamehWnd, 311, 4  '退出房间
                    Api.Delay 500
                ElseIf i Then
                    itime = Now()
                ElseIf DateDiff("s", itime, Now()) > 10 Then
                    Window.LeftClick GamehWnd, 311, 4  '退出房间
                    Api.Delay 500
                Else
                    QQSpeed.[准备游戏]
                End If
            ElseIf Where(0) Then
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 200, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(9, 236, "0083C5-06130E", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 5000
                ElseIf dm.CmpColor(149, 12, "A0FFFF-110808", 0.9) = 0 Then  '放技能'
                    dm.KeyPress 32
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 15
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(10, 155, "472B95-080808", 0.9), Array(3, 95, "1D1F5B-070607", 0.9), Array(3, 89, "3A306B-070707", 0.9), Array(8, 237, "9B6FFB-0C0A08", 0.9)), 2)
    End Function
    Public Function Where(Flag)
        If Flag = 1 Then
            Where = CmpMutlColor(Array(Array(9, 236, "0083C5-06130E", 0.9), Array(259, 17, "FAFBFF-0A0906", 0.9), Array(9, 42, "FFFFFF-080808", 0.9)), 2)
        Else
            Where = QQSpeed.Where(Flag)
        End If
    End Function
    Public Sub LuckyBox()
        If Where(2) Then
            Call QQSpeed.[自动开箱](1, 286, 25, 28, Array("dm.CmpColor(213, 73,""313642-080808"", 0.9) = 0", "Window.LeftClick GamehWnd, 217, 76"))
        Else
            Call QQSpeed.[自动开箱](4, 115, 123, 24, Array("dm.CmpColor(213, 73,""313642-080808"", 0.9) = 0", "Window.LeftClick GamehWnd, 217, 76"))
        End If
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
    Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_互助接力赛]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 40, 80   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Call LuckyBox
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                Api.Delay 300
                Window.LeftClick GamehWnd, 140, 152 '确定
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                If QQSpeed.State(0) Then
                    If CmpMutlColor(Array(Array(213, 84, "291B64-080808", 0.9), Array(216, 88, "372976-080808", 0.9)), 20) Then '弹窗'
                        Window.LeftClick GamehWnd, 208, 82
                    End If
                ElseIf CmpMutlColor(Array(Array(3, 6, "4749BA-080808", 0.9), Array(315, 5, "4BECF4-080808", 0.9)), 20) Then '等待开局'
                    If dm.CmpColor(311, 100, "FBE699-080811", 0.9) = 0 Then '点赞'
                        Window.LeftClick GamehWnd, 310, 100
                    End If
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If QQSpeed.State(1) Then
                    If CmpMutlColor(Array(Array(195, 83, "392974-070607", 0.9), Array(213, 84, "291B63-060606", 0.9), Array(215, 156, "352772-070707", 0.9)), 2) Then '队友离开
                        Window.LeftClick GamehWnd, 140, 152
                    End If
                ElseIf dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 9
    End Sub
    Public Function IsIn() '是否在边境'
        IsIn = CmpMutlColor(Array(Array(23, 33, "FEFCFF-080808", 0.9), Array(135, 38, "1AFCF3-080808", 0.9), Array(132, 38, "1AFCF3-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        If QQSpeed.[位置] = 2 Then
            Call QQSpeed.[自动开箱](1, 173, 90, 23, Array(True))
        Else
            Call QQSpeed.[自动开箱](2, 30, 145, 45, Array(True))
        End If
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_酷币大作战]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 40, 110   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then    '游戏中'
                    dm.KeyDown QQSpeed.[方向键] 
                    Api.Delay 3000           
                    Window.KeyDown GamehWnd, 68  '按下右键
                    Api.Delay 1000
                Window.KeyPress GamehWnd, 17
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                Call LuckyBox
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 360, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(264, 7, "FFF4DF-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 8
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(139, 70, "5266DD-080808", 0.9), Array(147, 85, "7388D9-080808", 0.9), Array(12, 75, "30A8FF-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        If Flag = 1 Then
            Where = CmpMutlColor(Array(Array(264, 7, "FFF4DF-080808", 0.9), Array(289, 11, "FFF4DF-080808", 0.9), Array(203, 10, "E0F4FF-080808", 0.9)), 20)
        Else
            Where = QQSpeed.Where(Flag)
        End If
    End Function
    Public Sub LuckyBox()
        Dim i, IntX, IntY
        If CmpMutlColor(Array(Array(84, 65, "56342C-071111", 0.9), Array(34, 106, "F6D1BF-081111", 0.9), Array(71, 162, "F78796-091918", 0.9)), 20) Then
            Api.Delay 3000
            For i = 0 To 7
                IntX = 117 + 50 * (i Mod 4)
                IntY = 120 + 61 * (i \ 4)
                If dm.CmpColor(IntX, IntY, "7462D3-111111", 0.9) = 0 Then
                    IntX = IntX - 20
                    IntY = IntY - 11
                    Exit For
                End If
                Api.Delay 20
            Next
            If i = 8 Then
                IntX = 40
                IntY = 143
            End If
            Call QQSpeed.[自动截图]("00FFFF-222222", 40, IntY + 35, 72, IntY + 7)
            Api.Delay 5000
        End If
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_双人冲锋战]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 40, 95   '单人匹配'
                Api.Delay 200
                Window.LeftClick GamehWnd, 134, 115  '选枪王'
                Api.Delay 200
                Window.LeftClick GamehWnd, 160, 150  '确定'
            ElseIf Where(1) Then
            
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                If QQSpeed.State(0) Then
                    If CmpMutlColor(Array(Array(214,84,"0C2D6B-070707",0.9),Array(189,88,"FFFEE3-060609",0.9),Array(221,95,"4070D0-090706",0.9)), 2) Then '队友离开'
                        Window.LeftClick GamehWnd, 160,153
                    End If
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 200, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 7
    End Sub
    Public Function IsIn() '是否在边境'
        IsIn = CmpMutlColor(Array(Array(78, 54, "293B96-080808", 0.9), Array(136, 56, "233374-080808", 0.9), Array(71, 40, "E8ECFF-080808", 0.9), Array(40, 12, "201C35-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](3, 112, 153, 29, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
End Class
Class [QQSpeed_超能竞速赛]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 42, 105   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                    Api.Delay 3000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 6
        Api.Delay 1000
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(13, 41, "FFFFFF-080808", 0.9), Array(9, 66, "6086E6-080808", 0.9), Array(116, 63, "4D62DE-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](3, 123, 165, 31, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_狂野追逐]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 42, 140   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                            dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(6, 230, "0DB4C5-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 5
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(135, 55, "02809F-080808", 0.9), Array(135, 218, "0CB3D2-080808", 0.9), Array(10, 218, "F8FCFD-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        If Flag = 1 Then
            Where = CmpMutlColor(Array(Array(6, 230, "0DB4C5-080808", 0.9), Array(14, 230, "0A94AD-080808", 0.9), Array(52, 30, "E8E8E8-080808", 0.9)), 20)
        Else
            Where = QQSpeed.Where(Flag)
        End If
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](3, 122, 200, 35, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_变身派对]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置] = 1 Then QQSpeed.[完成一局] 0
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 42, 115   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                Api.Delay 1000
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If CmpMutlColor(Array(Array(111,76,"E5C5A2-070708",0.9),Array(125,46,"E07A5A-070707",0.9),Array(242,108,"568BD4-060606",0.9),Array(94,86,"FF9F7F-060707",0.9)), 2) Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 1
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(192, 212, "F3E5D4-080808", 0.9), Array(20, 133, "2C64AE-080808", 0.9), Array(28, 126, "EDCBB5-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        If Flag = 1 Then
            Where = CmpMutlColor(Array(Array(178, 25, "FBCF8D-080808", 0.9), Array(150, 27, "FFF9EE-080808", 0.9), Array(162, 6, "FFEDDB-080808", 0.9)), 20)
        Else
            Where = QQSpeed.Where(Flag)
        End If
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](3, 105, 158, 20, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
End Class

Class [QQSpeed_极速对决]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 33, 90   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                           dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 5000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 0
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(127, 60, "13377E-080808", 0.9), Array(24, 40, "FFFFFF-080808", 0.9), Array(84, 46, "FFFFFF-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](3, 92, 138, 25, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class

Class [QQSpeed_浪漫邂逅]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i, itime
        Do
            If IsIn() Then
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 38, 95   '单人匹配'
                Api.Delay 200
                Window.LeftClick GamehWnd, 197, 120   '时空之恋'
            ElseIf Where(1) Then
            dm.KeyDown QQSpeed.[方向键]
                                dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                LuckyBox()
                i = QQSpeed.[位置被改变](2, IniTime)
                If i < 0 Then Exit Do
                If i Then
                    itime = Now()
                ElseIf DateDiff("s", itime, Now()) > 10 Then
                    Window.LeftClick GamehWnd, 311, 4  '退出房间
                    Api.Delay 500
                Else
                    Window.LeftClick GamehWnd, 222, 32 '点赞
                    Api.Delay 200
                    QQSpeed.[准备游戏]
                End If
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                If CmpMutlColor(Array(Array(59, 145, "3D78BE-080808", 0.9), Array(256, 144, "3E78BF-080808", 0.9), Array(61, 81, "81C5F9-080808", 0.9)), 2) Then '匹配失败
                    Window.LeftClick GamehWnd, 148, 145
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 200, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "多人游戏_快速进入", "127-127"
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(134, 49, "FEA5F1-080808", 0.9), Array(36, 38, "FFFFFF-080808", 0.9), Array(208, 51, "7C4ADA-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Dim v, i
        v = Array(118, 41, 145, 48, 153, 72, 150, 97, 149, 132)
        For i = 0 To UBound(v) Step 2
            Window.LeftClick GamehWnd, v(i), v(i + 1)
            Api.Delay 300
            Call QQSpeed.[自动截图]("FFFFFF-222222", 100, 88, 220, 158)
        Next
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class

Class [QQSpeed_双人冲顶赛]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i, itime
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 42, 105   '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                    dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                LuckyBox()
                i = QQSpeed.[位置被改变](2, IniTime)
                If i < 0 Then Exit Do
                If i Then
                    itime = Now()
                ElseIf DateDiff("s", itime, Now()) > 10 Then
                    Window.LeftClick GamehWnd, 311, 4  '退出房间
                    Api.Delay 500
                Else
                    Window.LeftClick GamehWnd, 272, 96 '点赞
                    Api.Delay 200
                    QQSpeed.[准备游戏]
                End If
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                If CmpMutlColor(Array(Array(59, 145, "3D78BE-080808", 0.9), Array(256, 144, "3E78BF-080808", 0.9), Array(61, 81, "81C5F9-080808", 0.9)), 2) Then '匹配失败
                    Window.LeftClick GamehWnd, 148, 145
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 200, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "多人游戏_快速进入", "127-139"
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(195, 59, "DB88FB-080808", 0.9), Array(196, 223, "8658D3-080808", 0.9), Array(7, 75, "6C29B8-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](2, 115, 163, 45, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class

Class [QQSpeed_换车拉力赛]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 192, 182   '匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                           dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "菜单_多人游戏", 0
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(9, 27, "5187E8-080808", 0.9), Array(28, 27, "23448C-080808", 0.9), Array(37, 37, "5089E8-080808", 0.9)), 20)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](2, 115, 88, 40, Array(True, "", "Window.KeyPress GamehWnd, 27" & vbCrLf & "Api.Delay 300"))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class

Class [QQSpeed_全城通缉令]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                Call LuckyBox
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 71, 123  '匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                            dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
                If CmpMutlColor(Array(Array(185, 21, "FFEF9B-060813", 0.9), Array(136, 38, "FFFFFF-060F0F", 0.9), Array(174, 21, "FFEF9B-060813", 0.9), Array(168, 26, "FFE44D-140906", 0.9)), 2) Then '被逮捕
                    Window.KeyPress GamehWnd, 27
                    Api.Delay 400
                    Window.LeftClick GamehWnd, 140, 152
                    Api.Delay 2000
                    Window.LeftClick GamehWnd, 183, 170
                End If
            ElseIf Where(2) Then
                ' Window.LeftClick GamehWnd, 311, 4  '退出房间'
                If QQSpeed.[位置被改变](2, IniTime) < 0 Then Exit Do
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 150, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "多人游戏_快速进入", "95-133"
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(190, 55, "0445A2-070808", 0.9), Array(92, 54, "00BEEE-060807", 0.9), Array(150, 55, "07B2E5-060807", 0.9), Array(7, 60, "0051C0-060807", 0.9)), 2)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](4, 125, 205, 26, Array(True, "", "Window.KeyPress GamehWnd, 27" & vbCrLf & "Api.Delay 300"))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
        Private Sub Class_Initialize()
        If KMData = 0 Then KMData = bgkms.KMTransform(GamehWnd, 1)
    End Sub
End Class
Class [QQSpeed_超时空巨人赛]
    Private QQSpeed
    Public Sub GuaJi()
        Dim IniTime, i, itime
        QQSpeed.[强制到位置] IniTime
        Do
            If IsIn() Then
                If QQSpeed.[位置被改变](0, IniTime) < 0 Then Exit Do
                Window.LeftClick GamehWnd, 45, 102  '单人匹配'
                Api.Delay 200
            ElseIf Where(1) Then
                            dm.KeyDown QQSpeed.[方向键]
                    Api.Delay 8000
                    Window.KeyPress GamehWnd, 82    '十秒复位'
                   Api.Delay 5000
                    Window.KeyDown GamehWnd, 68    '按下右键'
                    Api.Delay 1300
                    Window.KeyUp GamehWnd, 68     '弹起右键'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 17    '点击contrl'
                    Api.Delay 500
                    Window.KeyPress GamehWnd, 32    '点击空格'
                    Api.Delay 500
                Call QQSpeed.[位置被改变](1, IniTime)
            ElseIf Where(2) Then
                LuckyBox()
                i = QQSpeed.[位置被改变](2, IniTime)
                If i < 0 Then Exit Do
                If i Then
                    itime = Now()
                ElseIf DateDiff("s", itime, Now()) > 10 Then
                    Window.LeftClick GamehWnd, 311, 4  '退出房间
                    Api.Delay 500
                Else
                    Window.LeftClick GamehWnd, 272, 96 '点赞
                    Api.Delay 200
                    QQSpeed.[准备游戏]
                End If
            ElseIf Where(0) Then
                QQSpeed.[强制到位置] IniTime
            Else
                If CmpMutlColor(Array(Array(59, 145, "3D78BE-080808", 0.9), Array(256, 144, "3E78BF-080808", 0.9), Array(61, 81, "81C5F9-080808", 0.9)), 2) Then '匹配失败
                    Window.LeftClick GamehWnd, 148, 145
                End If
                QQSpeed.[清理弹窗] (0)
            End If
            Select Case QQSpeed.[位置]
            Case 0, 2
                Select Case QQSpeed.Handling(1, 200, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
            Case 1
                Select Case QQSpeed.Handling(1, 300, IniTime)
                Case -1
                    QQSpeed.[强制到位置] IniTime
                End Select
                If dm.CmpColor(52, 30, "E8E8E8-080808", 0.9) = 1 Then
                    QQSpeed.[位置] = 3  '颁奖中'
                    QQSpeed.[完成一局] 8000
                End If
            End Select
            Api.Delay 100
        Loop
    End Sub
    Public Sub Go()
        QQSpeed.[点击位置] "多人游戏_快速进入", "95-146"
    End Sub
    Public Function IsIn()
        IsIn = CmpMutlColor(Array(Array(131, 50, "58B4C9-080807", 0.9), Array(7, 58, "28D5EA-090808", 0.9), Array(12, 72, "006680-070909", 0.9), Array(97, 65, "008EAC-070707", 0.9)), 2)
    End Function
    Public Function Where(Flag)
        Where = QQSpeed.Where(Flag)
    End Function
    Public Sub LuckyBox()
        Call QQSpeed.[自动开箱](4, 293, 26, 26, Array(True))
    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
End Class

Class [QQSpeed_多功能]
    Public Sub [领签到]()

    End Sub
    Public Sub [领更新]()

    End Sub
    Public Sub [大乐透]()

    End Sub
    Public Sub [宝宝游乐园]()

    End Sub
    Public Sub [宝宝爬行]()

    End Sub
    Public Sub [精灵]()

    End Sub
    Public Sub [宠物对战]()

    End Sub
    Public Sub [宠物天梯]()

    End Sub
    Public Property Set Father(Obj) '继承?'
        Set QQSpeed = Obj
    End Property
End Class