 Rem File: Cmd000.bas
 Rem Sub: Attack.Monster
 Rem $Include: 'dndbbs.inc'
 On Error Goto Main.Error
 If Chained<>-2 Then
    Color 15,0
    Print "DNDBBS Command 000 -- Attack.Monster."
    Color 7,0
    End
 Endif
 If TempX=False Then ' kill
    Call Attack.Monster(VarZ)
 Else
    If TempX=True Then ' !kill
       Call Kill.Monster
    Endif
 Endif
Main.Resume:
 Chain DND.Path+"DNDBBS.EXE"
 End
Main.Error:
 Resume Main.Resume

Sub Kill.Monster
 On Local Error Goto ErrorTrap34
 Gosub Get.Config2

 ' !kill self
 If Lcase$(Parsed.Command1)="self" Then
    If Option1 Then
       Call Kill.Self
    Else
       Strng="You can't kill yourself!"
       Call IO.O
    Endif
    Exit Sub
 Endif

 ' !kill all
 If Lcase$(Parsed.Command1)="all" Then
    If Config2(141)=False Then
       Strng="You can't kill that!"
       Call IO.O
       Exit Sub
    Endif
    Graphics.Off=True
    Strng="Evil Laughter Sounds From Above..."
    Call IO.O
    Strng="   A Bolt of Lightning Strikes..."
    Call IO.O
    VarQ=0
    For Var5!=1! To Lof(MessWorkFile3)/MessWorkRecLen3
       Call Read.Record(MessWorkFile3,Var5!)
       If MessWorkRecord3.Room=Room Then
          VarQ=-1
          Out3=MessWorkRecord3.Monster.MonsterName
          Out3=Rtrim$(Out3)
          Temp5!=Var5!
          Choice=MessWorkRecord3.Index
          Monster.Temp=Temp5!
          Last.Monster=Out3

          Strng3=Rtrim$(MessWorkRecord3.Monster.Prefix1)
          Out3=Lcase$(Out3)

          Strng="The "+Strng3+Out3
          Call Convert.ANSI(True,VarQ,VarR)
          Carriage.Return=True
          Graphics.On=True
          Call IO.O
          Graphics.On=False
          Graphics.Off=True
          Strng=" was just struck dead!"
          Call IO.O

          Call The.Or.An
          Call Monster.Died
       Endif
    Next
    If VarQ=0 Then
       Strng="Nothing happens!"
       Call IO.O
    Endif
    Exit Sub
 Endif

 ' online monster
 Monster.Temp=SFalse
 Call Check.Monster
 If Monster.Temp Then
    Monster.Attacked=Monster.Temp
    Graphics.Off=True
    Strng="Evil Laughter Sounds From Above..."
    Call IO.O
    Strng="   A Bolt of Lightning Strikes..."
    Call IO.O
    Graphics.Off=False

    Strng3=Rtrim$(MessWorkRecord3.Monster.Prefix1)
    Out3=Lcase$(Out3)

    Strng="The "+Strng3+Out3
    Call Convert.ANSI(True,VarQ,VarR)
    Carriage.Return=True
    Graphics.On=True
    Call IO.O
    Graphics.On=False
    Graphics.Off=True
    Strng=" was just struck dead!"
    Call IO.O

    Call The.Or.An
    Call Monster.Died
    Exit Sub
 Endif

 ' offline user
 User.Temp=SFalse
 Call Check.User
 If User.Temp Then
    User.Attacked=User.Temp
    Graphics.Off=True
    Strng="Evil Laughter Sounds From Above..."
    Call IO.O
    Strng="   A Bolt of Lightning Strikes..."
    Call IO.O
    Graphics.Off=False
    Out3=Lcase$(Out3)
    Strng=Out3+" was just struck dead!"
    Mid$(Strng,1,1)=Ucase$(Mid$(Strng,1,1))
    Call IO.O

    Strng3=Rtrim$(UserRecord2.Prefix1)
    Out3=Lcase$(Out3)

    Strng="You just killed "+Strng3+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

    Call User.Died
    Exit Sub
 Endif

 ' online user
 Call Search.Mess(SFalse)
 If Temp!>SFalse Then
    If TempB!=User.Index Then
       If Option1 Then
          Call Kill.Self
       Else
          Strng="You can't kill yourself!"
          Call IO.O
       Endif
       Exit Sub
    Endif

    Graphics.Off=True
    Strng="Evil Laughter Sounds From Above..."
    Call IO.O
    Strng="   A Bolt of Lightning Strikes..."
    Call IO.O
    Graphics.Off=False

    Call Read.Record(UserFile2,TempB!)
    Strng3=Rtrim$(UserRecord2.Prefix1)

    Strng="You just killed "+Strng3+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

    Out2=Out3+" was just struck dead!"
    Call Send.Mess(5,SFalse,SFalse,Out2)
    Call Send.Mess(17,TempB!,Room,"Murdered")
    Exit Sub
 Endif
 Strng="You can't kill that!"
 Call IO.O
 Exit Sub
Get.Config2:
 Option1=-1
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD000]" 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
             Var4$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var5$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var4$)
             Case "kill.self"
                Select Case Lcase$(Var5$)
                Case "0","false","off"
                   Option1=0
                End Select
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
ErrorResume34:
 Exit Sub
ErrorTrap34:
 Resume ErrorResume34
End Sub

Sub Kill.Self
 On Local Error Goto ErrorTrap34a
 Gosub Get.Config3
 If UserRecord.Level=0 Then
    Strng="You are already dead!"
    Call IO.O
    Exit Sub
 Endif
 If Option1>0 Then
    If UserRecord.Level<Option1 Then
       Strng="You can't kill yourself until you are level "+Form$(Cdbl(Option1))+"."
       Call IO.O
       Exit Sub
    Endif
 Endif
 Out2="Evil Laughter Sounds From Above..."
 Call Send.Mess(5,SFalse,SFalse,Out2)
 Strng=Out2
 Call IO.O
 Out2="   A Bolt of Lightning Strikes..."
 Call Send.Mess(5,SFalse,SFalse,Out2)
 Strng=Out2
 Call IO.O
 Out3=Rtrim$(UserRecord.CodeName)
 Out3=Lcase$(Out3)
 Mid$(Out3,1,1)=Ucase$(Mid$(Out3,1,1))
 Out2=Out3+" was just struck dead!"
 Call Send.Mess(5,SFalse,SFalse,Out2)
 Message1="You killed yourself!"
 Call Player.Died
 Exit Sub
Get.Config3:
 Option1=0
 Do
    VarX=VarX+1
    If VarX>Options.Lines Then
       Exit Do
    Endif
    Var$=Ltrim$(Rtrim$(Options.Array(VarX)))
    If Ucase$(Var$)="[CMD000]" 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
             Var4$=Ltrim$(Rtrim$(Left$(Var$,Var-1)))
             Var5$=Ltrim$(Rtrim$(Mid$(Var$,Var+1)))
             Select Case Lcase$(Var4$)
             Case "kill.self.level"
                If Int(Val(Var5$))>=0 And Int(Val(Var5$))<=32767 Then
                   Option1=Int(Val(Var5$))
                Endif
             End Select
          Endif
       Loop
    Endif
 Loop
 Return
ErrorResume34a:
 Exit Sub
ErrorTrap34a:
 Resume ErrorResume34a
End Sub
