⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod07onhook.bas

📁 这是诛仙外挂的源代码
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Attribute VB_Name = "Mod07OnHook"
Option Explicit

''开始挂机
Sub BeginDG()
On Error Resume Next
    Dim DifX As Integer, DifY As Integer, Distance As Integer
    Dim HeadPos As String, HeadPosXY() As String
    
    '死亡回程
    If Main.CheSafe(6).Value = 1 And PartHp <= 0 Then
       CallDeadBack
       Exit Sub
    End If
    '无红回城
    If Main.CheSafe(4).Value = 1 And Val(Main.LabMedi(0).Caption) < Val(Main.TextSafe(4).Text) And SelObjSel <> PartId Then
        If Main.TimeScript.Enabled = False Then
            Main.TimeScript.Enabled = True
            Main.TimeOnHook.Enabled = False
            Main.TimeBuff.Enabled = False
            ScriptNo = 1
            Exit Sub
        End If
    End If
    '无蓝回城
    If Main.CheSafe(5).Value = 1 And Val(Main.LabMedi(1).Caption) < Val(Main.TextSafe(5).Text) And SelObjSel <> PartId Then
        If Main.TimeScript.Enabled = False Then
            Main.TimeScript.Enabled = True
            Main.TimeOnHook.Enabled = False
            Main.TimeBuff.Enabled = False
            ScriptNo = 1
            Exit Sub
        End If
    End If
    '包满回程
    If PartBagLeave = 0 And Main.CheSafe(7).Value = 1 Then 'And SelObjSel <> PartId Then
        If Main.TimeScript.Enabled = False Then
            Main.TimeScript.Enabled = True
            Main.TimeOnHook.Enabled = False
            Main.TimeBuff.Enabled = False
            ScriptNo = 1
            Exit Sub
        End If
    End If
    Main.TimeScript.Enabled = False
    '刷新信息
    DifX = PartX - Main.TextPath1(1).Text
    DifY = PartY - Main.TextPath1(2).Text
    Distance = Int((DifX ^ 2 + DifY ^ 2) ^ (1 / 2))
    '拾取物品
    If Main.ChePick1(0).Value = 1 Then
        AutoPickUp
    End If
    ReadPartInfo
    ReadSelObjInfo
    '检查保护
    ManSafe
    '自动任务
    If Main.CheAutoTask(0).Value = 1 Then
        If AutoDoTask Then
            Exit Sub
        End If
    End If
    '选怪攻击
    If PartStat <> 11 Then
        '保护队友
        SafeTeam
        If Main.CheTeam(0).Value = 1 And Len(Trim(Main.TextTeam1(0).Text)) > 0 Then
            HeadPos = ReadPlayPos(Trim(Main.TextTeam1(0).Text))
            If HeadPos <> "A|A" Then
                HeadPosXY = Split(HeadPos, "|")
                DifX = PartX - Val(HeadPosXY(0))
                DifY = PartY - Val(HeadPosXY(1))
                Distance = Int((DifX ^ 2 + DifY ^ 2) ^ (1 / 2))
                If Distance > 20 Then
                    CallRunTO Int(Val(HeadPosXY(0))), 0, Int(Val(HeadPosXY(1))), MapID
                ElseIf Distance > 8 Then
                    CallGoTO Int(Val(HeadPosXY(0))), Int(Val(HeadPosXY(1)))
                End If
            End If
        Else
            If SelObjKind = 6 Then
                If Main.CheWar(1) = 1 Then
                    If SelObjSel = 0 Or _
                        SelObjSel = PartId Or _
                        (Main.CheWar(6).Value = 1 And SelObjSel = CDbl(Main.LabTeam2(0).ToolTipText)) Or _
                        (Main.CheWar(6).Value = 1 And SelObjSel = CDbl(Main.LabTeam2(2).ToolTipText)) Or _
                        (Main.CheWar(6).Value = 1 And SelObjSel = CDbl(Main.LabTeam2(4).ToolTipText)) Or _
                        (Main.CheWar(6).Value = 1 And SelObjSel = CDbl(Main.LabTeam2(6).ToolTipText)) Or _
                        (Main.CheWar(6).Value = 1 And SelObjSel = CDbl(Main.LabTeam2(8).ToolTipText)) Then
                        AutoGj
                    Else
                        If Main.OptWar1(0).Value = True Then
                            PressTab
                        ElseIf Main.OptWar1(1).Value = True Then
                            SelectById
                        End If
                    End If
                Else
                    AutoGj
                End If
            Else                        '没有目标,需要Tab选怪
                If Distance > Int(Main.TextPath1(0).Text) And Main.ChePath1(0).Value = 1 Then
                    If NpcWinStat = 1 Then
                        CallNPCClose
                    End If
                    CallRunTO Int(Main.TextPath1(1).Text), 0, Int(Main.TextPath1(2).Text), MapID
                Else
                    If PartStat <> 8 Then
                        If Main.OptWar1(0).Value = True Then
                            PressTab
                        ElseIf Main.OptWar1(1).Value = True Then
                            SelectById
                        End If
                    End If
                End If
            End If
        End If
    Else
        If SelObjId <> PartId Then
            CancelObj
        End If
    End If
End Sub
''天人合一
Sub RunGodMan()
On Error Resume Next
    If TrumpVer = TrumpMaxVer And GodAndMan = 0 And Main.CheWar(9).Value = 1 Then
        GodAndManCall
    End If
End Sub
''攻击
Sub AutoGj()
On Error Resume Next
    Dim DifX As Integer, DifY As Integer, Distance As Integer
    If Main.CheWar(0).Value = 1 Then
        RunGodMan               '只有攻击的时候才判断天人合一
        If Main.CheWar(7).Value = 1 Then
            DifX = PartX - SelObjX
            DifY = PartY - SelObjY
            Distance = Int((DifX ^ 2 + DifY ^ 2) ^ (1 / 2))
            If Distance > PartAttDis Then
                CallGoTO Int((PartX + SelObjX) / 2), Int((PartY + SelObjY) / 2)
            Else
                If Main.CheWar(4).Value = 1 Then
                    UseSkill
                End If
                If PartStat = 0 Then
                    CallNormalAttack
                End If
            End If
        Else
            If PartStat = 0 Then
                CallNormalAttack
            End If
            If Main.CheWar(4).Value = 1 Then
                UseSkill
            End If
        End If
    End If
End Sub
''使用技能
Sub UseSkill()
On Error Resume Next
    Dim UseSkillId As String, SkillIsDo As Boolean
    If Main.CheWar(8).Value = 1 And SkillListCount >= Main.ListWar2.ListCount Then
        SkillListCount = 0
        OldSkillListCount = -1
    End If
    If Main.ListWar2.ListCount > 0 And Main.ListWar2.ListCount > SkillListCount Then
        UseSkillId = Trim(Main.ListWar2.List(SkillListCount))
        UseSkillId = Trim(Left(UseSkillId, InStr(UseSkillId, "|") - 2))
        If Len(UseSkillId) > 0 Then
            If SkillListCount <> OldSkillListCount Then
                If ReadSDoStat(CDbl(UseSkillId)) = False Then
                    CallSkillAttack CDbl(UseSkillId)
                    OldSkillListCount = SkillListCount
                    SkillListCount = SkillListCount + 1
                    If SkillListCount < Main.ListWar2.ListCount Then
                        Wait 500
                    End If
                End If
            End If
        End If
    End If
End Sub
''TAB选怪
Sub PressTab()
On Error Resume Next
    If Main.CheWar(0).Value = 0 Then Exit Sub
    If Main.CheWar(1).Value = 1 Then
        If SelObjKind = 6 And (SelObjSel = 0 Or SelObjSel = PartId) Then Exit Sub
    Else
        If SelObjKind = 6 Then Exit Sub
    End If
    CallTabKey
    SkillListCount = 0
    OldSkillListCount = -1
    If Main.CheWar(2).Value = 1 Then
        AutoGj
    End If
End Sub
''ID选怪
Sub SelectById()
On Error Resume Next
    Dim i As Integer, ii As Integer, IsSele As Boolean
    Dim SeleMonName As String, SelectMonId As Long
    If Main.CheWar(0).Value = 0 Then Exit Sub
    If Main.CheWar(1).Value = 1 Then
        If SelObjKind = 6 And (SelObjSel = 0 Or SelObjSel = PartId) Then Exit Sub
    Else
        If SelObjKind = 6 Then Exit Sub
    End If
    If Main.LVNpc(0).ListItems.Count > 0 Then
        For i = 1 To Main.LVNpc(0).ListItems.Count
            SelectMonId = Main.LVNpc(0).ListItems.Item(i).SubItems(Main.LVNpc(0).ColumnHeaders("ID").SubItemIndex)
            SeleMonName = Main.LVNpc(0).ListItems.Item(i).SubItems(Main.LVNpc(0).ColumnHeaders("Name").SubItemIndex)
            IsSele = True
            If Main.CheWar(3).Value = 1 Then
                IsSele = False
                For ii = 0 To Main.ListWar1.ListCount - 1
                    If SeleMonName = Main.ListWar1.List(ii) Then
                        IsSele = True
                    End If
                Next ii
            End If
            If IsSele = True And SelectMonId <> SelObjId Then
                CallSelectById SelectMonId
                SkillListCount = 0
                OldSkillListCount = -1
                If Main.CheWar(2).Value = 1 Then
                    AutoGj
                End If
                Exit Sub
            End If
        Next i
    End If
End Sub
''拾取物品
Sub AutoPickUp()
On Error Resume Next
    Dim FGoodsName As String, FGoodsSysID As Long, FGoodsID As Long
    Dim FGoodsX As Single, FGoodsY As Single, FNum As Integer, FMNum As Integer
    Dim i As Integer, ii As Integer, nDistance As Integer, IsPickUp As Boolean
    Dim itmX As ListItem
    
    If Main.LVPick(0).ListItems.Count > 0 Then
        For i = 1 To Main.LVPick(0).ListItems.Count
            Set itmX = Main.LVPick(0).ListItems(i)
            FGoodsName = itmX.SubItems(Main.LVPick(0).ColumnHeaders("Name").SubItemIndex)
            FGoodsID = itmX.SubItems(Main.LVPick(0).ColumnHeaders("FGID").SubItemIndex)
            FGoodsSysID = itmX.SubItems(Main.LVPick(0).ColumnHeaders("FGSID").SubItemIndex)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -