Attribute VB_Name = "modCommands"
Option Explicit


Public Sub ListAllCommands()
    Dim C As ComboBox
    Set C = frmCommandList.cbo
    C.AddItem "Triggers"
    Dim I As Integer, Section As String
    For I = 0 To UBound(CommandPool)
        With CommandPool(I)
            Select Case .Exposure
            Case 0
                If .Owner <> Section Or Len(Section) = 0 Then
                    Section = .Owner
                    C.AddItem "Internal -- " & Section
                End If
            Case 1
                If .Owner <> Section Or Len(Section) = 0 Then
                    Section = .Owner
                    C.AddItem "Script -- " & Section
                End If
            Case 2
                If .Owner <> Section Or Len(Section) = 0 Then
                    Section = .Owner
                    C.AddItem "Plugin -- " & Section
                End If
            Case 3
                If .Owner <> Section Or Len(Section) = 0 Then
                    Section = .Owner
                    C.AddItem "Custom -- " & Section
                End If
            End Select
        End With
    Next I
    frmCommandList.Show
    C.ListIndex = 0
End Sub
'
'Public Function HandleCommand(CS As COMMANDSTRUCT) As Boolean
'On Error GoTo hErr
'1   Dim Handled As Boolean, DB As Integer, Count As Long, C As Integer, User As String
'2   Dim R As RankingStruct, RName As String, Command As String, Args As String, U As New clsUser
'
'    R = GetAccess(CS)
'    If LenB(R.RankName) = 0 Then Exit Function
'
'19  'Get Command and cs.Message
'20  If InStrB(CS.Message, Space$(1)) <> 0 Then
'21      Command = Split(CS.Message, Space$(1))(0)
'22      Args = Split(CS.Message, Space$(1), 2)(1)
'23      CS.Message = Args
'24  Else
'25      Command = CS.Message
'26      Args = vbNullString
'27      CS.Message = Args
'28  End If
'29
'30  With frmBot.Bot(CS.Index)
'31      CS.Account = .GetAccount(CS.Username)
'32      CS.Whisper = (.Config.WhisperBack Or CS.Whisper) And Not CS.Console
'33
'34      'Find user in database
'35      If Not CS.Console Then
'36          DB = .Database.Find(CS.Username)
'37          If (DB > -1) Then
'38              R = GetRankByID(.Database.GetUser(DB).RankID)
'39              User = .Database.GetUser(DB).Username
'            Else
'                If .clan.Count <> 0 Then
'                    Dim CI As Integer, CR As Long
'                    CI = .clan.Find(CS.Account)
'                    If CI > -1 Then
'                        Select Case .clan.GetByIndex(CI).Rank
'                        Case CLANRANKENUM.CHIEFTAIN
'                            CR = GetIDByRank(.Config.ARChieftain)
'                        Case CLANRANKENUM.GRUNT
'                            CR = GetIDByRank(.Config.ARGrunt)
'                        Case CLANRANKENUM.PEON
'                            CR = GetIDByRank(.Config.ARPeon)
'                        Case CLANRANKENUM.SHAMAN
'                            CR = GetIDByRank(.Config.ARShaman)
'                        Case CLANRANKENUM.INITIATE
'                            CR = GetIDByRank(.Config.ARInitiate)
'                        End Select
'                        If CR > -1 Then R = GetRankByID(CR)
'                    End If
'                End If
'                If Len(R.RankName) = 0 Then
'                    If .Friends.Count <> 0 Then
'                        Dim FI As Integer, FR As Long, FO As clsFriend
'                        For FI = 1 To .Friends.Count
'                            Set FO = .Friends(FI)
'                            If LCase$(FO.Username) = LCase$(CS.Account) Then
'                                FR = GetIDByRank(.Config.ARFriend)
'                                If FR > -1 Then
'                                    R = GetRankByID(FR)
'                                Else
'                                    Exit Function
'                                End If
'                            End If
'                        Next
'                    End If
'                End If
'                If Len(R.RankName) = 0 Then Exit Function
'40          End If
'            RName = R.RankName
'41      Else
'            RName = "<Console>"
'43          DB = -1
'44      End If
'45  End With
'46  'HandleCommand = PluginCommand(CS, pluginLevel(R.RankName), Command, Args)
'    If HandleCommand Then Exit Function
'
'47  'Check for console commands first
'48  With frmBot.Bot(CS.Index)
'49      If CS.Console Then
'50          Handled = True
'51          Select Case UCase$(Command)
'
'            Case "COMMANDS": ListCommands CS.Index
'57          Case "STATS"
'58              If InStrB(Args, Space$(1)) = 0 And .Config.IsDiablo Then
'59                  Dim UD As New clsUser
'60                  Set UD = .Users.GetByName(Args)
'61                  If Not UD Is Nothing Then
'63                      If UD.Client = "D2DV" Or UD.Client = "D2XP" Then
'65                          OutputEvent frmBot.rtbChat(CS.Index), &HB3, , UD.Account & "'s character:"
'                            OutputEvent frmBot.rtbChat(CS.Index), &HB3, , GetClientStats(UD.Statstring)
'74                      Else
'75                          .SendAway "/stats " & Args & Space$(1) & UD.Client
'76                      End If
'77                  Else
'78                      OutputEvent frmBot.rtbChat(CS.Index), &HB2, , "Cannot get Diablo II stats when the user is not in the channel. To get stats for another product type " & ChrW$(34) & "/stats " & Args & " [productID]" & ChrW$(34) & "; valid productIDs are STAR/SEXP/W2BN/WAR3/W3XP!"
'79                  End If
'80              Else
'81                  Handled = False
'82              End If
'83          Case Else
'84              Handled = False
'85          End Select
'86      End If
'87
'Final:
'227     If Handled Then
'228         HandleCommand = True
'229         Exit Function
'230     End If
'231 End With
'232 HandleCommand = False
'    Exit Function
'hErr:
'    ErrorHandler Err.Description, Erl, "ManageCommands", "HandleCommand"
'End Function
