 Rem File: Cmd098.bas ' patched 03/22/2020
 Rem Sub: Pour.Potion
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 098 -- Pour.Potion."
    Color 7,0
    End
 Endif
 Call Pour.Potion
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Pour.Potion
 On Local Error Goto Error.Trap36
 Call Parse
 Call Numeric
 Call Check.User.Items
 If Temp7!<=SFalse Then
    Strng="You can't pour that!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.Potion=False Then
    Strng="You can't pour that!"
    Call IO.O
    Exit Sub
 Endif
 If MessWorkRecord6.Charges<=False Then
    Strng="You can't! It's empty!"
    Call IO.O
    Exit Sub
 Endif
 VarA!=TreasureRecord.PotionType
 If VarA!=SFalse Then
    Strng="You can't pour that!"
    Call IO.O
    Exit Sub
 Endif
 VarX!=Temp5!
 Out2=TreasureRecord.TreasureName
 Out2=Rtrim$(Out2)
 Out2=Lcase$(Out2)
 Var2$=Rtrim$(TreasureRecord.Prefix1)
 Parsed.Command1=Parsed.Command2
 Call Numeric
 Temp4=False
 Call Check.Room.Items
 If Temp7!<SFalse Then
    Strng="You can't pour it there!"
    Call IO.O
    Exit Sub
 Endif
 If Temp7!=SFalse Then
    Call Num
    Temp4=1
    Call Check.User.Items
 Endif
 If Temp7!<=SFalse Then
    Strng="You can't pour it there!"
    Call IO.O
    Exit Sub
 Endif
 If TreasureRecord.Potion=False Then
    Strng="You can't pour it there!"
    Call IO.O
    Exit Sub
 Endif
 If VarA!<>Temp7! Then
    Strng="You can't pour it there!"
    Call IO.O
    Exit Sub
 Endif
 Out3=TreasureRecord.TreasureName
 Out3=Rtrim$(Out3)
 Out3=Lcase$(Out3)
 Var3$=Rtrim$(TreasureRecord.Prefix1)
 ' display poured potion
 Graphics.Off=False
 Strng="You pour "+Var2$+Out2
 Call Convert.ANSI(True,VarQ,VarR)
 Carriage.Return=True
 Graphics.On=True
 Call IO.O
 Graphics.On=False
 Graphics.Off=True
 Strng=" into "
 Carriage.Return=True
 Call IO.O
 Graphics.Off=False
 Strng=Var3$+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
 Graphics.Off=False
 ' find target potion
 VarA!=Temp5!
 TempA!=TreasureRecord.NewPotion
 If TempA!>SFalse And TempA!<=Lof(TreasureFile)/TreasureRecLen Then
    Call Read.Record(TreasureFile,TempA!)
    If TreasureRecord.Potion=False Then
       Strng="Nothing happens!"
       Call IO.O
       Exit Sub
    Endif
    Call Read.Record(MessWorkFile6,VarX!)
    VarQ=MessWorkRecord6.Charges
    VarQ=VarQ-1
    MessWorkRecord6.Charges=VarQ
    Call Write.Record(MessWorkFile6,VarX!)
    Select Case Temp4
    Case 1 ' in user
       Call Read.Record(MessWorkFile6,VarA!)
       MessWorkRecord6.Index=TempA!
       MessWorkRecord6.Charges=Temp6
       Call Write.Record(MessWorkFile6,VarA!)
    Case 0 ' in room
       Call Read.Record(RoomInvFile,VarA!)
       MessWorkRecord6.Room=Room
       MessWorkRecord6.Index=TempA!
       MessWorkRecord6.Charges=Temp6
       Call Write.Record(RoomInvFile,VarA!)
    End Select
    Graphics.Off=True
    Var$=Lcase$(Rtrim$(TreasureRecord.TreasureName))
    Var2$=Rtrim$(TreasureRecord.Prefix1)
    Strng="You create "+Var2$+Var$
    Call Convert.ANSI(True,VarQ,VarR)
    Carriage.Return=-1
    Graphics.On=True
    Call IO.O
    Graphics.On=False
    Graphics.Off=True
    Strng="!"
    Call IO.O
    Graphics.Off=False
 Else
    Strng="Nothing happens!"
    Call IO.O
 Endif
Error.Resume36:
 Exit Sub
Error.Trap36:
 Resume Error.Resume36
End Sub
