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

Sub Display.Health
 On Local Error Goto ErrorTrp33
 Graphics.Off=True
 If UserRecord.Level<=False Then
    Strng="You are dead!"
    Call IO.O
    Exit Sub
 Endif
 Strng="You are a level "
 If UserRecord.Level>10 Then
    Strng=Strng+Form$(Cdbl(UserRecord.Level))
 Else
    Strng=Strng+Rtrim$(Numeral(UserRecord.Level))
 Endif
 If UserRecord.Race<=False Then
    UserRecord.Race=Human
 Endif

 Strng=Strng+" "+Rtrim$(Race(UserRecord.Race))+" "
 Out2=Rtrim$(UserRecord.Prefix2)
 Out2=Out2+UserRecord.ClassName
 Strng=Strng+Rtrim$(Out2)

 Call Convert.ANSI(True,VarQ,VarR)
 Carriage.Return=True
 Graphics.On=True
 Call IO.O
 Graphics.On=False

 Graphics.Off=True
 Strng="."
 Call IO.O
 Graphics.Off=False

 Graphics.Off=True
 Strng="Vitals:"
 Var1#=Cdbl(UserRecord.FatigueMax)+Cdbl(UserRecord.VitalityMax)
 Var2#=Cdbl(UserRecord.Fatigue)+Cdbl(UserRecord.Vitality)
 If Var1#=DFalse Then
    Temp#=DFalse
 Else
    Temp#=((Var2#/Var1#)*.40#)*100#
    Temp#=Int(Temp#)
    If Temp#<1.0# Then
       Temp#=1.0#
    Endif
 Endif
 IF Temp#<DFalse Then
    Temp#=DFalse
 Endif
 Strng=Strng+" Body"+Str$(Temp#)+"/40%"
 If Var1#=DFalse Then
    Temp#=DFalse
 Else
    Temp#=((Var2#/Var1#)*.25#)*100#
    Temp#=Int(Temp#)
    If Temp#<1.0# Then
       Temp#=1.0#
    Endif
 Endif
 IF Temp#<DFalse Then
    Temp#=DFalse
 Endif
 Strng=Strng+" Arms"+Str$(Temp#)+"/25%"
 If Var1#=DFalse Then
    Temp#=DFalse
 Else
    Temp#=((Var2#/Var1#)*.25#)*100#
    Temp#=Int(Temp#)
    If Temp#<1.0# Then
       Temp#=1.0#
    Endif
 Endif
 IF Temp#<DFalse Then
    Temp#=DFalse
 Endif
 Strng=Strng+" Legs"+Str$(Temp#)+"/25%"
 If Var1#=DFalse Then
    Temp#=DFalse
 Else
    Temp#=((Var2#/Var1#)*.10#)*100#
    Temp#=Int(Temp#)
    If Temp#<1.0# Then
       Temp#=1.0#
    Endif
 Endif
 IF Temp#<DFalse Then
    Temp#=DFalse
 Endif
 Strng=Strng+" Head"+Str$(Temp#)+"/10%"
 Call IO.O
 Strng="Vital hits: "
 Strng=Strng+"Fat "+Form$(Cdbl(UserRecord.Fatigue))+"/"+ _
 Form$(Cdbl(UserRecord.FatigueMax))
 Temp#=DFalse
 If UserRecord.Weapon(1).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(1).Plus)
 Endif
 If UserRecord.Weapon(2).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(2).Plus)
 Endif
 If UserRecord.Weapon(3).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(3).Plus)
 Endif
 If UserRecord.Weapon(5).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(5).Plus)
 Endif
 If UserRecord.Weapon(6).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(6).Plus)
 Endif
 If UserRecord.Weapon(10).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(10).Plus)
 Endif
 Gosub Append.Plus
 Strng=Strng+" Vit "+Form$(Cdbl(UserRecord.Vitality))+"/"
 Strng=Strng+Form$(Cdbl(UserRecord.VitalityMax))
 Strng=Strng+" Mag "+Form$(Cdbl(UserRecord.Magic))+"/"
 Strng=Strng+Form$(Cdbl(UserRecord.MagicMax))
 Temp#=DFalse
 If UserRecord.Weapon(4).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(4).Plus)
 Endif
 If UserRecord.Weapon(9).Index Then
    Temp#=Temp#+Cdbl(UserRecord.Weapon(4).Plus)
 Endif
 Gosub Append.Plus
 Strng=Strng+" Psi "+Form$(Cdbl(UserRecord.Psionic))+"/"
 Strng=Strng+Form$(Cdbl(UserRecord.PsionicMax))
 Call IO.O
 Strng="Stats: "
 For Temp5=1 To MaxStats
    Strng=Strng+Left$(Stat(Temp5),3)+" "
    Strng=Strng+Form$(Cdbl(UserRecord.Stats(Temp5)))
    If Temp5=1 Then
       If UserRecord.Weapon(7).Index Then
          Temp#=Cdbl(UserRecord.Weapon(7).Plus)
          Gosub Append.Plus
       Endif
    Endif
    Strng=Strng+" "
 Next
 If UserRecord.ClassType=Lady Then
    Strng=Strng+" Beu "+Form$(Cdbl(UserRecord.Beauty))
    Strng=Strng+" Gla "+Form$(Cdbl(UserRecord.Glamour))
 Endif
 Call IO.O
 Strng="Weapons: "
 For Temp2=1 To MaxWeapons
    Out2=Rtrim$(Weapon.Type.Name(Temp2))
    Mid$(Out2,1,1)=Ucase$(Mid$(Out2,1,1))
    Strng=Strng+Out2+Str$(Cdbl(UserRecord.Weapons(Temp2)))+"% "
 Next
 Strng=Rtrim$(Strng)
 Call IO.O
 Strng="You are aligned "
 Strng=Strng+Rtrim$(Alignment.Name1(UserRecord.Align1+2))+" "
 Strng=Strng+Rtrim$(Alignment.Name2(UserRecord.Align2+2))+"."
 Call IO.O
 Exit Sub
Append.Plus:
 If Temp# Then
    If Temp#>32767# Then
       Temp1=MaxInt
    Else
       Temp1=Cint(Temp#)
    Endif
    Call Item.PlusX(2,Temp1,Out2)
    If Out2<>Nul Then
       Strng=Strng+Out2
    Endif
 Endif
 Return
ErrorRsm33:
 Exit Sub
ErrorTrp33:
 Resume ErrorRsm33
End Sub

Sub Item.PlusX(Var1,Var2,Var$)
 On Local Error Goto ErrorTrp25
 Select Case Var1
 Case 1
    If Config2(96) Then
       VarX=Config2(97)+Var2
    Else
       VarX=Config2(97)-Var2
    Endif
 Case 2
    If Config2(98) Then
       VarX=Config2(99)+Var2
    Else
       VarX=Config2(99)-Var2
    Endif
 Case 3
    If Config2(100) Then
       VarX=Config2(101)+Var2
    Else
       VarX=Config2(101)-Var2
    Endif
 Case 4
    If Config2(102) Then
       VarX=Config2(103)+Var2
    Else
       VarX=Config2(103)-Var2
    Endif
 Case Else
    Var$=Nul
    Exit Sub
 End Select
 Select Case VarX
 Case Is<False
    Var$="("+Str$(VarX)+")"
 Case Is>False
    Var$="(+"+Mid$(Str$(VarX),2)+")"
 Case Else
    Var$="(+0)"
 End Select
ErrorRsm25:
 Exit Sub
ErrorTrp25:
 Resume ErrorRsm25
End Sub
