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

Sub Light.Object
 On Local Error Goto ErrTrap14
 Gosub Get.Config
 If Normal.User Then
    If Option1 Then
       If UserRecord.Level<Option1 Then
          Strng="You can't! Level is too low!"
          Call IO.O
          Exit Sub
       Endif
    Endif
 Endif
 Call Check.User.Items
 If Temp7!<=SFalse Then
    Strng="You can't light that!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.LightType=False Then
    If (TreasureRecord.Edible And 4)=4 Then
       Strng="You can't light that!"
    Else
       Strng="That's not a light!"
    Endif
    Call IO.O
    Exit Sub
 Endif
 If MessWorkRecord6.Charges=False Then
    If (TreasureRecord.Edible And 4)=4 Then
       Strng="You can't, it's been smoked!"
    Else
       Strng="You can't, it's not fueled!"
    Endif
    Call IO.O
    Exit Sub
 Endif
 If MessWorkRecord6.Charges<False Then
    Strng="It's already lit!"
    Call IO.O
    Exit Sub
 Endif
 MessWorkRecord6.Charges=-MessWorkRecord6.Charges
 Call Write.Record(MessWorkFile6,Temp5!)

 Out2=Rtrim$(TreasureRecord.Prefix1)
 Out3=Lcase$(Rtrim$(TreasureRecord.ShortName))
 Strng="You light the "+Out2+Out3
 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

 Var=Abs(MessWorkRecord6.Charges)
 Select Case Var
 Case 1
    Strng="It now has one charge."
 Case 2 To 10
    Strng="It now has "+Rtrim$(Numeral(Var))+" charges."
 Case Else
    Strng="It now has "+Form$(Cdbl(Var))+" charges."
 End Select
 Call IO.O
 If Node>False Then
    Out2=UserRecord.CodeName
    Out2=Rtrim$(Out2)
    Out2=Lcase$(Out2)
    Out2=Out2+" lights a "+Out3+"."
    Call Send.Mess(8,SFalse,Room,Out2)
 Endif
 Exit Sub
Get.Config:
 VarX=0
 Option1=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD075]" Then
       Do
          VarX=VarX+1
          If VarX>Options.Lines Then
             Return
          Endif
          Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
          If Ucase$(Var$)="[END]" Then
             Return
          Endif
          Var=Instr(Var$,"=")
          If Var Then
             Var2$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var3$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var2$)
             Case "level.restrict"
                If Int(Val(Var3$))>0 And Int(Val(Var3$))<=32767 Then
                   Option1=Int(Val(Var3$))
                Endif
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
ErrResume14:
 Exit Sub
ErrTrap14:
 Resume ErrResume14
End Sub
