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

' reduce psionic points
Sub Zap.Object
 ON LOCAL ERROR GOTO Error.Trap72z
 Gosub Get.Config
 ' online user
 If Lcase$(Parsed.Command1)="self" Then
    Parsed.Command1=Lcase$(Rtrim$(UserRecord.Codename))
 Endif
 Call Search.Mess(SFalse)
 Var1=TempC
 If Temp!=Room Then
    If TempB!=User.Index Then ' self
       If Len(option0$) Then
          Out2=option0$
          Call Equate(Temp#)
       Else
          Temp#=Rnd>.75
       Endif
       If Temp# Then
          If UserRecord.Psionic=0 Then
             Strng="Nothing happens!"
             Call IO.O
             Exit Sub
          Else
             Temp#=Cdbl(UserRecord.Level)
             Temp#=Temp#*Config2(82)
             If Temp#<False Or Temp#>MaxInt Then
                Temp#=MaxInt
             Endif
             If UserRecord.Psionic-Temp#<0# Then
                UserRecord.Psionic=0#
             Else
                UserRecord.Psionic=UserRecord.Psionic-Temp#
             Endif
             Call New.Stats
             Strng="You now have "+Form$(Cdbl(UserRecord.Psionic))+" psionic points!"
             Call IO.O
             Exit Sub
          Endif
       Else
          Strng="Didn't work!"
          Call IO.O
          Exit Sub
       Endif
    Endif
    User.Temp=TempB!
    Call Read.Record(UserFile2,User.Temp)
    Out3=Lcase$(Rtrim$(MessWorkRecord1.UserName))
    Strng="You zap "+Out3+"!"
    Call IO.O
    If Len(option1$) Then
       Out2=option1$
       Call Equate(Temp#)
    Else
       Temp#=Rnd>.75
    Endif
    If Temp# Then
       If UserRecord2.Psionic>0 Then
          Out2="zaps you!"
          Call Send.Mess(38,TempB!,Room,Out2)
          Exit Sub
       Else
          Strng="Nothing happens!"
          Call IO.O
          Exit Sub
       Endif
    Endif
    Strng="Didn't work!"
    Call IO.O
    Exit Sub
 Endif
 ' offline user
 Call Num
 Call Check.User
 If User.Temp Then
    User.Temp=MessWorkRecord4.Index
    Strng="You zap "+Lcase$(Out3)+"!"
    Call IO.O
    If Len(option2$) Then
       Out2=option2$
       Call Equate(Temp#)
    Else
       Temp#=Rnd>.75
    Endif
    If Temp# Then
       If UserRecord2.Psionic>0 Then
          UserRecord2.Psionic=UserRecord2.Psionic-1
          Call Write.Record(UserFile2,User.Temp)
          Exit Sub
       Else
          Strng="Nothing happens!"
          Call IO.O
          Exit Sub
       Endif
    Endif
    Strng="Didn't work!"
    Call IO.O
    Exit Sub
 Endif
 Strng="Nothing happens!"
 Call IO.O
 Exit Sub
Get.Config:
 VarX=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD188]" 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 "zap.self"
                If Left$(Var3$,1)=Chr$(34) Then
                   If Right$(Var3$,1)=Chr$(34) Then
                      option0$=Mid$(Var3$,2)
                      option0$=Left$(option0$,Len(option0$)-1)
                   Endif
                Endif
             Case "zap.online.user"
                If Left$(Var3$,1)=Chr$(34) Then
                   If Right$(Var3$,1)=Chr$(34) Then
                      option1$=Mid$(Var3$,2)
                      option1$=Left$(option1$,Len(option1$)-1)
                   Endif
                Endif
             Case "zap.offline.user"
                If Left$(Var3$,1)=Chr$(34) Then
                   If Right$(Var3$,1)=Chr$(34) Then
                      option2$=Mid$(Var3$,2)
                      option2$=Left$(option2$,Len(option2$)-1)
                   Endif
                Endif
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
Error.Resume72z:
 EXIT SUB
Error.Trap72z:
 RESUME Error.Resume72z
End Sub
