 Rem File: Cmd138.bas
 Rem Sub: User.List
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 138 -- User.List."
    Color 7,0
    End
 Endif
 Call User.List
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub User.List
 On Local Error Goto ErrorTrp50
 Graphics.Off=False
 Strng="User List:"
 Call IO.O
 Allow.Break=True
 Break=False
 If Parse.Temp>3 Then
    Graphics.Off=False
    Strng="Unknown userlist parameter."
    Call IO.O
    Graphics.Off=True
    Strng="Values are:"
    Call IO.O
    Strng="  Users#1  display DMs"
    Call IO.O
    Strng="  Users#2  display room"
    Call IO.O
    Strng="  Users#3  display both"
    Call IO.O
    Call More.Prompt
    Exit Sub
 Endif
 Continuous=False
 Do While Lost.Carrier=False
    Allow.Break=True
    Graphics.Off=True
    Strng="DNDBBS v"+Version$+" User List For "+Left$(Fclock$,15)+"."
    Call IO.O
    If Break Then
       Exit Do
    Endif
    Strng=Nul
    Call IO.O
    If Break Then
       Exit Do
    Endif
    If Parse.Temp=2 Or Parse.Temp=3 Then
       Strng="Number   User Name                      Class Name           Race     Room"
       Call IO.O
    Else
       Strng="Number   User Name                      Class Name           Race     Level DM"
       Call IO.O
    Endif
    If Break Then
       Exit Do
    Endif
    Call Display.Line(78)
    If Break Then
       Exit Do
    Endif
    Temp5=3
    For Temp.User.Index=1! To Lof(UserFile2)/UserRecLen
       Call Read.Record(UserFile2,Temp.User.Index)
       Strng=UserRecord2.CodeName
       If Left$(Strng,9)<>Deleted$ Then
          Temp9=False
          If UserRecord2.Flags And Locked.User Then
             If Normal.User Then
                Temp9=True
             Endif
          Endif
          If Parse.Temp=1 Or Parse.Temp=3 Then
             If UserRecord2.ClassType>=AsstDM Then
                Eat$=Nul
             Else
                Temp9=True
             Endif
          Endif
          If Temp9=False Then
             Strng=Mid$(Str$(Temp.User.Index),2)
             Strng=Strng+Space$(9-Len(Strng))
             Carriage.Return=True
             Call IO.O
             Strng=UserRecord2.CodeName
             Strng=Lcase$(Strng)
             Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
             Strng=Rtrim$(Strng)
             VarQ=31-Len(Strng)
             Strng=Rtrim$(UserRecord2.Prefix1)+Strng
             Call Convert.ANSI(True,VarQ,VarR)
             Carriage.Return=True
             Graphics.On=True
             Call IO.O
             Graphics.On=False
             Carriage.Return=True
             Strng=Space$(VarQ)
             Call IO.O
             Carriage.Return=True
             Strng=UserRecord2.ClassName
             Strng=Rtrim$(Strng)
             VarQ=20-Len(Strng)
             Strng=Rtrim$(UserRecord2.Prefix2)+Strng
             Call Convert.ANSI(True,VarQ,VarR)
             Carriage.Return=True
             Graphics.On=True
             Call IO.O
             Graphics.On=False
             Carriage.Return=True
             Strng=Space$(VarQ)
             Call IO.O
             Strng=" "
             If UserRecord2.Race<1 Then
                UserRecord2.Race=1
             Endif
             Out2=Race(UserRecord2.Race)
             Out2=Rtrim$(Out2)
             Out2=Out2+Space$(8-Len(Out2))
             Strng=Strng+Out2
             If Parse.Temp=2 Or Parse.Temp=3 Then
                Out2=Str$(UserRecord2.Room)
                Out3=Strng+Out2
             Else
                If UserRecord2.Level<=False Then
                   Out2=" "+Dead$
                Else
                   If UserRecord2.Level>32000 Then
                      Out2=" Ghod"
                   Else
                      Out2=Str$(UserRecord2.Level)
                   Endif
                Endif
                Out2=Out2+Space$(7-Len(Out2))
                If UserRecord2.ClassType>=AsstDM Then
                   Out2=Out2+"*"
                Endif
                If UserRecord2.Flags And Locked.User Then
                   Out2=Out2+Mask$
                Endif
                Out3=Strng+Out2
                Call Search.Mess(Temp.User.Index)
                If Temp! Then
                   Out3=Out3+"!"
                Endif
             Endif
             Strng=Out3
             Call IO.O
             If Break Then
                Exit Do
             Endif
             Temp5=Temp5+1
             If Temp5>=User.Pagelength-2 Then
                Temp5=False
                If Continuous=False Then
                   Call More.Prompt
                   If No Or Quit Then
                      Exit Do
                   Endif
                Endif
             Endif
          Endif
       Endif
    Next
    Exit Do
 Loop
 Allow.Break=False
 Break=False
 If Temp5 Then
    Call More.Prompt
 Endif
ErrorRsm50:
 Exit Sub
ErrorTrp50:
 Resume ErrorRsm50
End Sub
