-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommand.bas
More file actions
3134 lines (3018 loc) · 107 KB
/
Copy pathCommand.bas
File metadata and controls
3134 lines (3018 loc) · 107 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Attribute VB_Name = "Commands"
Option Explicit
Option Compare Binary
Option Base 0
Sub samesite(usernum As Integer, inpstr As String)
Dim usr As String, usrComp As String, msg As String, count As Integer
Dim site As String
If wordCount(inpstr) < 2 Or Not (LCase$(word(1)) = "user" Or LCase$(word(1)) = "site") Then
send "Usage: samesite user/site <user>/<site> [all]" & CRLF, usernum
Exit Sub
End If
If Not userExists(word(2)) And LCase$(word(1)) = "user" Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
msg = FANCY_BAR
If LCase$(word(1)) = "user" Then
msg = msg & "Users with the same site as " & userCap(word(2)) & " ~FT["
If userIsOnline(word(2)) Then
site = user(getUser(word(2))).site
Else
user(0).name = word(2)
loadUserData 0, False
site = user(0).site
End If
msg = msg & site & "]" & CRLF
Else
site = word(2)
msg = msg & "Users with the site of "
msg = msg & Replace$(Replace$(site, "*", "~FY*~RS"), "?", "~FR?~RS") & CRLF
End If
usr = Dir$(App.Path & "\Users\*.D")
If LCase$(word(3)) = "all" Then
Do While Not usr = vbNullString
usr = Left$(usr, Len(usr) - 2)
user(0).name = usr
loadUserData 0, False
usrComp = user(0).site
If (LCase$(usrComp) Like LCase$(site)) And Not userIsOnline(user(0).name) Then
msg = msg & Space$(5) & userCap(user(0).name) & " " & user(0).desc & CRLF
End If
usr = Dir$
Loop
End If
For count = 1 To UBound(user)
usrComp = user(count).site
If user(count).operational And (LCase$(usrComp) Like LCase$(site)) Then
msg = msg & Space(5) & userCap(user(count).name) & " " & user(count).desc & CRLF
End If
Next count
msg = msg & FANCY_BAR
send msg, usernum
End Sub
Sub age(usernum As Integer, inpstr As String)
If Not wordCount(inpstr) = 1 Then
send "Usage: age <age>" & CRLF, usernum
Exit Sub
End If
If containsCorruptNumsOnly(word(1)) Then
send "Your age must be a number" & CRLF, usernum
Exit Sub
End If
If Val(word(1)) > 120 Then
send "Now be reasonable" & CRLF, usernum
Exit Sub
End If
user(usernum).age = word(1)
send "Age set to " & word(1) & CRLF, usernum
End Sub
Sub bcast(usernum As Integer, inpstr As String, beeper As Boolean)
If user(usernum).muzzled Then
send MSG_USER_MUZZLED & CRLF, usernum
Exit Sub
End If
If wordCount(inpstr) < 1 Then
If beeper Then
send "Usage: bbcast <message>" & CRLF, usernum
Exit Sub
Else
send "Usage: bcast <message>" & CRLF, usernum
Exit Sub
End If
End If
Dim msg As String, count As Integer
msg = "~OL~FR--< ~RS~OL" & inpstr & "~OL~FR >--" & CRLF
If beeper Then
msg = BELL & msg
End If
For count = 1 To UBound(user)
If user(count).state > STATE_LOGIN3 Then
send msg, count
End If
Next count
End Sub
Sub cbuff(usernum As Integer)
Dim count As Integer, roomnum As Integer
roomnum = getRoom(user(usernum).room)
For count = 1 To REVBUFF_SIZE
rooms(roomnum).buffer(count) = ""
Next count
send "Review buffer cleared" & CRLF, usernum
End Sub
Sub clearScreen(usernum As Integer)
Dim count As Integer, msg As String
For count = 1 To user(usernum).pager + 5
msg = msg & CRLF
Next count
send msg, usernum
End Sub
Sub clearline(usernum As Integer, inpstr As String)
'This will clear a login by line number
Dim line As Integer
If wordCount(inpstr) <> 1 Then
send "Ussage: clearline <line>" & CRLF, usernum
Exit Sub
End If
If containsCorruptNumsOnly(inpstr) Then
send "Enter a line ~FYnumber~RS only" & CRLF, usernum
Exit Sub
End If
line = Val(inpstr)
If line < 1 Or line > UBound(user) Then
send "Invalid line" & CRLF, usernum
Exit Sub
End If
If user(line).operational And user(line).state < STATE_NORMAL Then
send "Clearing line " & Trim$(line) & CRLF, usernum
send "Your line is being cleared" & CRLF, line
killUser line
Else
send "You cannot clear the line of a logged in user" & CRLF, usernum
End If
End Sub
Sub cmdlist(usernum As Integer)
Dim count As Integer, count2 As Integer, count3 As Integer
Dim msg As String, totalcommands As Integer, thispass As Boolean
Const BUFF = 12
msg = CRLF & FANCY_BAR
For count = 0 To user(usernum).rank
msg = RTrim$(msg) & "~FR" & ranks(count) & Space(BUFF - Len(ranks(count))) & "~RS"
msg = msg & "~FT"
For count2 = 1 To UBound(cmds)
If cmds(count2).rank = count Then
msg = msg & Space(BUFF - Len(cmds(count2).name)) & cmds(count2).name
thispass = True
count3 = count3 + 1
totalcommands = totalcommands + 1
If count3 = 5 Then
msg = msg & CRLF
If Len(msg) > SEND_CHOP Then
send msg, usernum
msg = ""
End If
msg = msg & Space(BUFF)
count3 = 0
thispass = False
End If
End If
Next count2
If thispass Then
msg = msg & CRLF
End If
count3 = 0
Next count
msg = RTrim$(msg) & FANCY_BAR & "Total of ~FM~OL" & LTrim$(Str$(totalcommands)) & "~RS commands." & CRLF & CRLF
send msg, usernum
End Sub
Sub colorDisplay(usernum As Integer)
Dim msg As String
msg = "~OLOL: SOUTHWEST VIDEO TEST~RS Bold" & CRLF
msg = msg & "~ULUL: SOUTHWEST VIDEO TEST~RS Underline" & CRLF
msg = msg & "~LILI: SOUTHWEST VIDEO TEST~RS Blinking" & CRLF
msg = msg & "~RVRV: SOUTHWEST VIDEO TEST~RS Reverse" & CRLF
msg = msg & "~FKFK: SOUTHWEST VIDEO TEST~RS Foreground Black" & CRLF
msg = msg & "~FRFR: SOUTHWEST VIDEO TEST~RS Foreground Red" & CRLF
msg = msg & "~FGFG: SOUTHWEST VIDEO TEST~RS Foreground Green" & CRLF
msg = msg & "~FYFY: SOUTHWEST VIDEO TEST~RS Foreground Yellow" & CRLF
msg = msg & "~FBFB: SOUTHWEST VIDEO TEST~RS Foreground Blue" & CRLF
msg = msg & "~FMFM: SOUTHWEST VIDEO TEST~RS Foreground Magenta" & CRLF
msg = msg & "~FTFT: SOUTHWEST VIDEO TEST~RS Foreground Turquiose" & CRLF
msg = msg & "~FWFW: SOUTHWEST VIDEO TEST~RS Foreground White" & CRLF
send msg, usernum
msg = vbNullString
msg = msg & "~BKBK: SOUTHWEST VIDEO TEST~RS Background Black" & CRLF
msg = msg & "~BRBR: SOUTHWEST VIDEO TEST~RS Background Red" & CRLF
msg = msg & "~BGBG: SOUTHWEST VIDEO TEST~RS Background Green" & CRLF
msg = msg & "~BYBY: SOUTHWEST VIDEO TEST~RS Background Yellow" & CRLF
msg = msg & "~BBBB: SOUTHWEST VIDEO TEST~RS Background Blue" & CRLF
msg = msg & "~BMBM: SOUTHWEST VIDEO TEST~RS Background Magenta" & CRLF
msg = msg & "~BTBT: SOUTHWEST VIDEO TEST~RS Background Turquiose" & CRLF
msg = msg & "~BWBW: SOUTHWEST VIDEO TEST~RS Background White" & CRLF
send msg, usernum
End Sub
Sub demote(usernum As Integer, inpstr As String)
Dim count As Integer
Dim UserName As String
If Not Len(word(1)) > 0 Then
send "Usage: demote <user>" & CRLF, usernum
Exit Sub
End If
If Not wordCount(inpstr) = 1 Then
send "Usage: demote <user>" & CRLF, usernum
Exit Sub
End If
UserName = word(1)
If Not userExists(UserName) Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
For count = 1 To UBound(user)
If UCase$(user(count).name) = UCase$(word(1)) And user(count).state > STATE_LOGIN3 Then
If user(count).name = user(usernum).name Then
send "You cannot demote yourself" & CRLF, usernum
Exit Sub
End If
If user(count).rank <= LBound(ranks) Then
user(count).rank = LBound(ranks)
Exit Sub
End If
If user(count).rank >= user(usernum).rank Then
send "You cannot demote a user of equal or greater rank" & CRLF, usernum
send "~BR~FK" & user(usernum).name & " has tried to demote you!" & CRLF, count
Exit Sub
End If
If user(count).rank = 0 Then
send "They are about as low as they're going" & CRLF, usernum
Exit Sub
End If
user(count).rank = user(count).rank - 1
writeHistory user(count).name, "~FR~OLDEMOTED~RS by " & user(usernum).name & " to " & ranks(user(count).rank)
writeSyslog "~FB" & user(usernum).name & "~RS demoted " & user(count).name & " to " & ranks(user(count).rank)
writeRoom "", "~BR~FK" & user(usernum).name & " demoted " & user(count).name & " to " & ranks(user(count).rank) & CRLF
Exit Sub
End If
Next count
user(0).name = word(1)
loadUserData 0
If user(0).rank >= user(usernum).rank Then
send "You cannot demote a user of equal or greater rank" & CRLF, usernum
Exit Sub
End If
If user(0).rank = 0 Then
send "They are about as low as they're going" & CRLF, usernum
Exit Sub
End If
user(0).rank = user(0).rank - 1
writeHistory user(0).name, "~FRDEMOTED~RS by " & user(usernum).name & " to " & ranks(user(count).rank)
saveUserData user(0)
writeSyslog "~FB" & user(usernum).name & "~RS demoted " & user(0).name & " to ~FM" & ranks(user(0).rank) & CRLF
End Sub
Sub desc(usernum As Integer, inpstr As String)
If Len(inpstr) > 0 Then
If cLen(inpstr) > 30 Then
send "Description too long" & CRLF, usernum
Exit Sub
End If
user(usernum).desc = inpstr
send "Description set" & CRLF, usernum
Else
send "Your description is: " & user(usernum).desc & CRLF, usernum
End If
End Sub
Sub emote(usernum As Integer, inpstr As String)
Dim emotion As String
If Left(inpstr, 1) = ";" Then
If Len(inpstr) > 1 Then
emotion = Right$(inpstr, Len(inpstr) - 1)
Else
send "Emote what?" & CRLF, usernum
Exit Sub
End If
Else
emotion = inpstr
End If
If Len(emotion) = 0 Then
send "Emote what?" & CRLF, usernum
Exit Sub
End If
If Not InStr(Space(10), Left$(emotion, 8)) = 0 Then
send "So, erm... Whats with all the spaces?" & CRLF, usernum
Exit Sub
End If
If Not Left$(emotion, 2) = "'s" Then
emotion = " " & emotion
End If
If user(usernum).visible Then
writeRoom user(usernum).room, user(usernum).name & emotion & CRLF
Else
writeRoom user(usernum).room, "A shadow" & emotion & CRLF
End If
writeRoomBuff user(usernum).name & emotion, getRoom(user(usernum).room)
End Sub
Sub entpro(usernum As Integer)
'Remote users cannot use this command
If user(usernum).netlinkType Then
send MSG_NO_NETLINK & CRLF, usernum
Exit Sub
End If
user(usernum).editorType = EDITSTATE_ENTPRO
writeRoomExcept user(usernum).room, "~FT" & user(usernum).name & " starts to write a profile" & CRLF, user(usernum).name
lineEditor usernum, user(usernum).inpstr
End Sub
Sub gender(usernum As Integer, inpstr As String)
Select Case LCase$(word(1))
Case "m", "male"
user(usernum).gender = "Male"
Case "f", "female"
user(usernum).gender = "Female"
Case "n", "neither"
user(usernum).gender = "Neither"
Case Else
send "Usage: gender male/female/neither" & CRLF, usernum
Exit Sub
End Select
send "Gender set to " & user(usernum).gender & CRLF, usernum
End Sub
Sub examine(usernum As Integer, inpstr As String)
Dim msg As String, un As Integer, ticks As DHMS_OBJECT
Dim count As Integer, found As Boolean, datehold As Date
If Not wordCount(inpstr) = 1 Then
send "Usage: examine <username>" & CRLF, usernum
Exit Sub
End If
If Not userExists(inpstr) Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
If userIsOnline(inpstr) Then
datehold = num2date(user(un).lastLogin)
un = getUser(inpstr)
msg = "~FYName~FB:~RS " & user(un).name & " " & user(un).desc & "~RS"
msg = mold(msg, (CLIENT_WIDTH - 1) - (6 + Len(ranks(user(un).rank))))
msg = msg & "~FYRank~FB:~RS " & ranks(user(un).rank) & CRLF
msg = msg & "~FYOn Since~FB:~RS " & Format$(datehold, "dddd d") & getOrdinal(Int(Format$(datehold, "d"))) & Format$(datehold, " mmmm yyyy" & " at " & Format$(datehold, "hh:nn")) & CRLF
msg = msg & "~FYOn For~FB:~RS " & deriveTimeString(spliceTime(user(un).timeon), False) & CRLF
msg = msg & "~FYIdle For~FB~RS " & deriveTimeString(spliceTime(CDbl(user(un).idle * 60)), False) & CRLF
msg = msg & "~FYTotal Login~FB:~RS " & deriveTimeString(spliceTime(user(un).totalTime), False) & CRLF
msg = msg & "~FYSite~FB:~RS " & user(un).site & CRLF
Else
un = 0
user(0).name = inpstr
loadUserData 0
datehold = num2date(user(0).lastLogin)
msg = "~FYName~FB:~RS " & user(0).name & " " & user(0).desc & "~RS"
msg = mold(msg, (CLIENT_WIDTH - 1) - (6 + Len(ranks(user(0).rank))))
msg = msg & "~FYRank~FB:~RS " & ranks(user(0).rank) & CRLF
msg = msg & "~FYLast Login~FB:~RS " & Format$(datehold, "dddd d") & getOrdinal(Int(Format$(datehold, "d"))) & Format$(datehold, " mmmm yyyy" & " at " & Format$(datehold, "hh:nn")) & CRLF
msg = msg & "~FYWhich was~FB:~RS " & deriveTimeString(spliceTime(date2num(Now) - user(0).lastLogin)) & CRLF
msg = msg & "~FYWas On For~FB:~RS " & deriveTimeString(spliceTime(user(0).timeon), False) & CRLF
msg = msg & "~FYTotal Login~FB:~RS " & deriveTimeString(spliceTime(user(0).totalTime), False) & CRLF
msg = msg & "~FYLast Site~FB:~RS " & user(0).site & CRLF
End If
msg = FANCY_BAR & msg & embedBar("Profile")
For count = LBound(user(un).profile) To UBound(user(un).profile)
If Not user(un).profile(count) = "" Then
msg = msg & user(un).profile(count) & CRLF
found = True
End If
Next count
If Not found Then
msg = msg & "This user has not written a profile" & CRLF
End If
msg = msg & FANCY_BAR
send msg, usernum
End Sub
Sub go_user(ByVal usernum As Integer, ByVal inpstr As String)
Dim temp As String, pass As String, count As Integer, usrCount As Integer
Dim goNetlink As Boolean, old_room As String, transString As String, count2 As Integer
If inpstr = vbNullString Then
If user(usernum).room = rooms(1).name Then
send "You are already in the main room" & CRLF, usernum
Exit Sub
End If
old_room = user(usernum).room
user(usernum).room = rooms(1).name
look usernum
writeRoom old_room, user(usernum).name & " " & user(usernum).exitMsg & " " & user(usernum).room & CRLF
writeRoomExcept user(usernum).room, user(usernum).name & " " & user(usernum).enterMsg & " " & old_room & CRLF, user(usernum).name
Exit Sub
End If
'Get last word as password
For count = LBound(word) To UBound(word)
If word(count) = "" Then
Exit For
End If
pass = word(count)
Next count
'Netlink names are allowed to have spaces in them. This causes a
'few headaches but we should do just fine. For the .go command,
'the spaces in Netlink names are replaced with underscores.
'See if there is a Netlink in that user's room
For count = LBound(net) To UBound(net)
If UCase$(inpstr) = UCase$(net(count).name) Then
goNetlink = True
transString = "TRANS " & user(usernum).name & " " & user(usernum).password
Exit For
ElseIf UCase$(stripLast(inpstr)) = UCase$(net(count).name) And Not stripLast(inpstr) = "" Then
goNetlink = True
transString = "TRANS " & user(usernum).name & " " & crypt(pass)
Exit For
End If
Next count
If goNetlink Then
If Not net(count).state = NETSTATES.NETLINK_UP Then
send "This netlink is not connected" & CRLF, usernum
Exit Sub
End If
If user(usernum).netlinkPending Then
send "Already processing a Netlink login for you" & CRLF, usernum
End If
user(usernum).netlinkPending = True
netout transString & " " & Trim$(user(usernum).rank) & " " & user(usernum).desc & LF, net(count).line
Exit Sub
End If
If wordCount(inpstr) > 2 Then
send "Usage: go <room/netlink> [netlink password]" & CRLF, usernum
Exit Sub
End If
For count = LBound(rooms) To UBound(rooms)
If InStr(LCase$(rooms(count).name), LCase$(word(1))) = 1 Then
If user(usernum).room = rooms(count).name Then
send "You are already in the " & user(usernum).room & CRLF, usernum
Exit Sub
End If
If user(usernum).rank < staffLevel And InStr(UCase$(rooms(getRoom(user(usernum).room)).allExits), UCase$(word(1))) = 0 Then
send "The " & userCap(rooms(getRoom(word(1))).name) & " is not an exit to this room." & CRLF, usernum
Exit Sub
End If
If rooms(count).access = ROOM_STAFF And user(usernum).rank < staffLevel Then
send "This room is for staff members only" & CRLF, usernum
Exit Sub
End If
If rooms(count).access = ROOM_PRIVATE And Not isUserInvited(usernum, rooms(count).name) And (system.gatecrash = False Or user(usernum).rank < system.gatecrashLevel) Then
send "The " & rooms(count).name & " is currently private" & CRLF, usernum
Exit Sub
End If
old_room = user(usernum).room
user(usernum).room = rooms(count).name
look usernum
writeRoom old_room, user(usernum).name & " " & user(usernum).exitMsg & " " & user(usernum).room & CRLF
writeRoomExcept user(usernum).room, user(usernum).name & " " & user(usernum).enterMsg & " " & old_room & CRLF, user(usernum).name
'Count users, if private and usrnum now =< 1 then return to public
For count2 = 1 To UBound(user)
If user(count2).room = old_room Then
usrCount = usrCount + 1
End If
Next count2
If usrCount < 2 And rooms(getRoom(old_room)).access = ROOM_PRIVATE Then
user(0).room = old_room
set_public 0
End If
Exit Sub
End If
Next count
send MSG_ROOM_NOT_EXIST & CRLF, usernum
End Sub
Sub help(usernum As Integer, inpstr As String)
If inpstr = "" Then
cmdlist usernum
Exit Sub
End If
Dim BadString As String, FromFile As String
If InStr(inpstr, ".") Or InStr(inpstr, "\") Or InStr(inpstr, ":") Then
send "Im afraid I cant do that" & CRLF, usernum
Exit Sub
End If
If Dir$(App.Path & "\Help\" & word(1) & ".HF") = "" Then
send "There is no help available on that topic" & CRLF, usernum
Exit Sub
End If
Open App.Path & "\Help\" & word(1) & ".HF" For Input As #1
Do While Not EOF(1)
Line Input #1, FromFile
send FromFile & CRLF, usernum
Loop
Close #1
End Sub
Sub look(usernum As Integer)
Dim count, count2, found As Boolean, msg As String, rn As Integer
'First we tell them the name of the room
msg = CRLF & "~FTRoom: ~FG" & userCap(user(usernum).room) & CRLF & CRLF
'Now we get the room description, if there is one
If Not Dir$(App.Path & "\Rooms\" & user(usernum).room & ".R") = "" Then
Open App.Path & "\Rooms\" & user(usernum).room & ".R" For Input As #1
Dim RoomDesc As String
Do While Not EOF(1)
Line Input #1, RoomDesc
msg = msg & RoomDesc & CRLF
Loop
Close #1
End If
msg = msg & CRLF
found = False
'Show the room's exits
For count = LBound(rooms) To UBound(rooms)
If LCase$(rooms(count).name) = LCase$(user(usernum).room) Then
For count2 = LBound(rooms(LBound(rooms)).exits) To UBound(rooms(LBound(rooms)).exits)
If Not rooms(count).exits(count2) = "" Then
If found = False Then
msg = msg & "~FTExits are: ~RS"
found = True
End If
msg = msg & "~FG" & rooms(count).exits(count2) & " ~RS"
End If
Next count2
End If
Next count
If found = False Then
msg = msg & "~FGThere are no exits~RS"
End If
msg = msg & CRLF
'Display Netlinked rooms
found = False
For count = LBound(net) To UBound(net)
If UCase$(net(count).room) = UCase$(user(usernum).room) Then
If Not found Then
msg = msg & "~FTNetlinks are: "
Else
msg = msg & " "
End If
Select Case net(count).state
Case NETSTATES.NETLINK_DOWN
msg = msg & "~FR" & net(count).name
Case NETSTATES.NETLINK_UP
msg = msg & "~FG" & net(count).name
Case Else
msg = msg & "~FY" & net(count).name
End Select
found = True
End If
Next count
msg = msg & CRLF
If found Then
msg = msg & CRLF
End If
'Lets see who is online
found = False
For count = 1 To UBound(user)
If UCase$(user(count).room) = UCase$(user(usernum).room) And user(count).state > STATE_LOGIN3 And Not count = usernum Then
If user(count).visible Or user(usernum).rank >= user(count).rank Then
If found = False Then
msg = msg & "~FG~OLYou can see:~RS" & CRLF
found = True
End If
If user(count).visible Then
msg = msg & " " & user(count).name & " " & user(count).desc & CRLF
Else
msg = msg & " ~FR*~RS" & user(count).name & " " & user(count).desc & CRLF
End If
End If
End If
Next count
For count = LBound(clones) To UBound(clones)
If rooms(clones(count).room).name = user(usernum).room Then
If found = False Then
msg = msg & "~FG~OLYou can see:~RS" & CRLF
found = True
End If
msg = msg & " " & user(clones(count).owner).name & " ~BR~FW(CLONE)" & CRLF
End If
Next count
If Not found Then
msg = msg & "~FGYou are all alone here" & CRLF
End If
msg = msg & CRLF
'Show accesses
rn = getRoom(user(usernum).room)
If rooms(rn).access = ROOM_STAFF Then
msg = msg & "This room is for staff access only"
Else
If rooms(rn).locked Then
msg = msg & "Access is ~FRfixed~RS to "
Else
msg = msg & "Access is set to "
End If
If rooms(rn).access = ROOM_PRIVATE Then
msg = msg & "~FRPRIVATE~RS"
Else
msg = msg & "~FGPUBLIC~RS"
End If
End If
msg = msg & " and there are ~OL~FM" & getMessageCount(App.Path & "\Rooms\" & user(usernum).room & ".B") & "~RS messages on the board." & CRLF
'Bring on the topics
If rooms(getRoom(user(usernum).room)).topic = "" Then
msg = msg & "~OL~FGCurrent topic: ~RS" & MSG_TOPIC_NOT_SET & CRLF
Else
msg = msg & "~OL~FGCurrent topic: ~RS" & rooms(getRoom(user(usernum).room)).topic & CRLF
End If
send msg, usernum
End Sub
Sub map(usernum As Integer)
If Dir$(App.Path & "\Rooms\Map.S") = "" Then
send "There is no map" & CRLF, usernum
Else
Open App.Path & "\Rooms\Map.S" For Input As #1
Dim MapLine As String
Do While Not EOF(1)
Line Input #1, MapLine
send MapLine & CRLF, usernum
Loop
Close #1
End If
End Sub
Sub moveUser(usernum As Integer, inpstr As String)
word(1) = completeUsername(word(1))
If wordCount(inpstr) < 1 Or wordCount(inpstr) > 2 Then
send "Usage: move <user> [room]" & CRLF, usernum
Exit Sub
End If
Dim count As Integer, un As Integer, rn As Integer
If Not userExists(word(1)) Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
If Not userIsOnline(word(1)) Then
send MSG_USER_NOT_ONLINE & CRLF, usernum
Exit Sub
End If
un = getUser(word(1))
If usernum = un Then
send "You cannot move yourself" & CRLF, usernum
Exit Sub
End If
If user(un).rank >= user(usernum).rank Then
send "You cannot move a user of equal or greater rank than yourself" & CRLF, usernum
Exit Sub
End If
If wordCount(inpstr) > 1 Then
rn = getRoom(word(2))
Else
rn = getRoom(user(usernum).room)
End If
If rn = 0 Then
send MSG_ROOM_NOT_EXIST & CRLF, usernum
Exit Sub
End If
If user(un).room = rooms(rn).name Then
If wordCount(inpstr) = 1 Then
send user(un).name & " is already here" & CRLF, usernum
Else
send user(un).name & " is already there" & CRLF, usernum
End If
Exit Sub
End If
send user(usernum).name & " has pulled you into the " & rooms(rn).name & CRLF, un
writeRoomExcept user(un).room, "~FT" & user(un).name & " is pulled into the cold black night" & CRLF, user(un).name
user(un).room = rooms(rn).name
send "You move " & user(un).name & " to the " & user(un).room & CRLF, usernum
writeRoomExcept user(un).room, "~FT" & user(un).name & " is thrown into the room" & CRLF, user(un).name
look (un)
End Sub
Sub murder(usernum As Integer, inpstr As String)
Dim UserName As String
Dim count As Integer
inpstr = completeUsername(inpstr)
word(1) = completeUsername(word(1))
If Not Len(word(1)) > 0 Then
send "Usage: kill <user>" & CRLF, usernum
Exit Sub
End If
If Not wordCount(inpstr) = 1 Then
send "Usage: kill <user>" & CRLF, usernum
Exit Sub
End If
UserName = word(1)
If Not userExists(UserName) Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
For count = 1 To UBound(user)
If UCase$(user(count).name) = UCase$(word(1)) And user(count).state > STATE_LOGIN3 Then
If user(count).name = user(usernum).name Then
send "Suicide is not the awnser, man." & CRLF, usernum
Exit Sub
End If
If user(count).rank >= user(usernum).rank Then
send "You cannot kill a user of equal or greater rank" & CRLF, usernum
send "~BR~FK" & user(usernum).name & " has tried to kill you!" & CRLF, count
Exit Sub
End If
writeRoom "", "~FGA beam of green light shoots from " & userCap(user(usernum).name) & "'s finger and strikes " & userCap(UserName) & ".~RS" & CRLF
writeSyslog "~FG" & user(usernum).name & "~RS killed ~FB" & user(count).name
writeHistory user(count).name, "~FR~OLKILLED~RS by " & user(usernum).name
killUser (count)
writeRoom "", "~FG" & userCap(UserName) & " vaporizes!" & CRLF
Exit Sub
End If
Next count
send "That user is not logged in." & CRLF, usernum
End Sub
Sub muzzle(usernum As Integer, inpstr As String)
inpstr = completeUsername(inpstr)
word(1) = completeUsername(word(1))
If Not wordCount(inpstr) = 1 Then
send "Usage: muzzle <user>" & CRLF, usernum
Exit Sub
End If
Dim user_to_muzzle As Integer
user_to_muzzle = getUser(word(1))
If user_to_muzzle <= 0 Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
If usernum = user_to_muzzle Then
send "Self-discipline is good but don't you think this is going a little too far?" & CRLF, usernum
Exit Sub
End If
If user(user_to_muzzle).muzzled Then
send user(user_to_muzzle).name & " is already muzzled" & CRLF, usernum
Exit Sub
End If
If user(user_to_muzzle).rank >= user(usernum).rank Then
send "You cannot muzzle a user of equal or greater rank" & CRLF, usernum
Exit Sub
End If
user(user_to_muzzle).muzzled = True
writeHistory user(user_to_muzzle).name, "~FR~OLMUZZLED~RS by " & user(usernum).name
send "~OL~BB~FWYou have been muzzled!" & CRLF, user_to_muzzle
send "~OL~BB~FWYou have placed a muzzle on " & user(user_to_muzzle).name & CRLF, usernum
End Sub
Sub nuke(usernum As Integer, inpstr As String)
Dim count As Integer
Dim filename, UserName As String
If Not Len(word(1)) > 0 Then
send "Usage: nuke <user>" & CRLF, usernum
Exit Sub
End If
If Not wordCount(inpstr) = 1 Then
send "Usage: nuke <user>" & CRLF, usernum
Exit Sub
End If
UserName = word(1)
If Not userExists(UserName) Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
If userIsOnline(UserName) Then
send "You cannot nuke a user that is online" & CRLF, usernum
Exit Sub
End If
user(0).name = UserName
loadUserData 0
If user(0).rank >= user(usernum).rank Then
send "You cannot erase the account of a user of equal or greater rank" & CRLF, usernum
Exit Sub
End If
deleteAccount user(count).name
writeSyslog "~FR" & user(usernum).name & " nuked " & UserName
send "~BR~FKUser " & userCap(UserName) & " nuked~RS" & CRLF, usernum
End Sub
Sub passwd(inpstr As String, usernum As Integer)
If Not wordCount(inpstr) = 2 Then
send "Usage: passwd <old password> <new password>" & CRLF, usernum
Exit Sub
End If
If Not crypt(word(1)) = user(usernum).password Then
send "Passwords do not match" & CRLF, usernum
Exit Sub
End If
If Not Len(word(2)) > 3 Then
send "New password too short" & CRLF, usernum
Exit Sub
End If
user(usernum).password = crypt(word(2))
clearScreen (usernum)
send "Password changed" & CRLF, usernum
End Sub
Sub promote(usernum As Integer, inpstr As String)
'My name is Ozymandias, King of kings.
'Look on my works, ye mighty, and despair.
' -Percy Byshe Shelley:
' Ozymandias
Dim count As Integer
Dim UserName As String
If Not Len(word(1)) > 0 Then
send "Usage: promote <user>" & CRLF, usernum
Exit Sub
End If
If Not wordCount(inpstr) = 1 Then
send "Usage: promote <user>" & CRLF, usernum
Exit Sub
End If
UserName = word(1)
If Not userExists(UserName) Then
send MSG_USER_NOT_EXIST & CRLF, usernum
Exit Sub
End If
For count = 1 To UBound(user)
If UCase$(user(count).name) = UCase$(word(1)) And user(count).state > STATE_LOGIN3 Then
If user(count).name = user(usernum).name Then
send "You cannot promote yourself" & CRLF, usernum
Exit Sub
End If
If user(count).rank >= user(usernum).rank Then
send "You cannot promote a user of equal or greater rank" & CRLF, usernum
Exit Sub
End If
If user(count).rank >= UBound(ranks) Then
user(count).rank = UBound(ranks)
Exit Sub
End If
user(count).rank = user(count).rank + 1
writeSyslog "~FB" & user(usernum).name & "~RS promoted ~FB" & user(count).name & "~RS to ~FM" & ranks(user(count).rank)
writeRoom "", "~BG~FK" & user(usernum).name & " promoted " & user(count).name & " to " & ranks(user(count).rank) & CRLF
If user(usernum).name = "A server administrator" Then
user(usernum).name = LCase$(user(usernum).name)
End If
writeHistory user(count).name, "~FG~OLPROMOTED~RS by " & user(usernum).name & " to " & ranks(user(count).rank)
Exit Sub
End If
Next count
user(0).name = word(1)
loadUserData 0
If user(0).rank >= user(usernum).rank Then
send "You cannot promote a user of equal or greater rank" & CRLF, usernum
Exit Sub
End If
user(0).rank = user(0).rank + 1
saveUserData user(0)
writeHistory user(0).name, "~FG~OLPROMOTED~RS by " & user(usernum).name & " to " & ranks(user(0).rank)
writeSyslog "~FB" & user(usernum).name & "~RS promoted ~FB" & user(0).name & "~RS to ~FM" & ranks(user(0).rank)
End Sub
Sub quit(usernum As Integer)
killUser usernum
End Sub
Sub read_board(usernum As Integer)
Dim file As String
file = App.Path & "\Rooms\" & user(usernum).room & ".B"
If getMessageCount(file) = 0 Then
send "There are no messages on the message board" & CRLF, usernum
Exit Sub
End If
Dim FromFile As String, BoardFull As String
Open file For Input As #1
Do While Not EOF(1)
Line Input #1, FromFile
BoardFull = BoardFull & FromFile & CRLF
Loop
send BoardFull & CRLF, usernum
Close #1
writeRoomExcept user(usernum).room, user(usernum).name & " reads the message board", user(usernum).name
End Sub
Sub reboot(usernum As Integer, inpstr As String)
'Shut 'er down, sir!
'Remote users cannot use this command
If user(usernum).netlinkType Then
send MSG_NO_NETLINK & CRLF, usernum
Exit Sub
End If
If Not system.shutdownType = SHUTDOWN_NONE Then
If system.shutdownType = SHUTDOWN_SHUTDOWN Then
send "A shutdown is already in affect" & CRLF, usernum
Else
If word(1) = "cancel" Then
mainForm.Shutdown_Timer.Enabled = False
system.shutdownCount = 0
system.shutdownType = SHUTDOWN_NONE
writeSyslog "~FB" & user(usernum).name & "~RS has canceled the reboot"
writeRoom "", "~FGReboot has been canceled" & CRLF
Else
send "A reboot is already in affect" & CRLF, usernum
End If
End If
Exit Sub
End If
If word(1) = "cancel" Then
send "A reboot is not in affect" & CRLF, usernum
Exit Sub
End If
If containsCorruptNumsOnly(word(1)) Then
send "Usage: reboot [countdown]|cancel" & CRLF, usernum
Exit Sub
End If
If Len(word(1)) > 4 Then
send "Countdown too big" & CRLF, usernum
Exit Sub
End If
system.shutdownCount = Val(word(1))
If system.shutdownCount = 0 Then
writeSyslog "~FB" & user(usernum).name & "~RS has initiated a reboot"
Else
system.shutdownCount = system.shutdownCount + 1
End If
user(usernum).state = STATE_OPTION
user(usernum).options = OPTION_REBOOT
send "~BR~FWAre you sure you want to reboot the talker?~RS", usernum
End Sub
Sub rmail(usernum As Integer)
If getMessageCount(App.Path & "\Users\" & user(usernum).name & ".M") = 0 Then
send "You have no mail" & CRLF, usernum
Exit Sub
End If
Dim MailFromFile, AllMail As String
Dim count As Integer
Open App.Path & "\Users\" & user(usernum).name & ".M" For Input As #1
Do While Not EOF(1)
For count = 1 To user(usernum).pager
If Not EOF(1) Then
Line Input #1, MailFromFile
AllMail = AllMail & MailFromFile & CRLF
Else
Exit For
End If
Next count
send AllMail, usernum
AllMail = ""
Loop
Close #1
user(usernum).unread = False
send CRLF, usernum
End Sub
Sub say(usernum As Integer)
Dim act_type, text As String
If user(usernum).muzzled Then
send MSG_USER_MUZZLED & CRLF, usernum
Exit Sub
End If
If Len(user(usernum).inpstr) < 1 Then
send "Usage: say <text>" & CRLF, usernum
Exit Sub
End If
Select Case Right$(user(usernum).inpstr, 1)
Case "?"
act_type = "asks"
Case "!"
act_type = "exclaims"
Case Else
act_type = "says"
End Select
Select Case Right$(user(usernum).inpstr, 2)
Case ":)", "=)"
act_type = "smiles"
Case ";)"
act_type = "winks"
Case ":("
act_type = "frowns"
End Select
If user(usernum).visible Then
text = "~FG" & user(usernum).name & " " & act_type & ": " & "~RS" & user(usernum).inpstr & CRLF
Else
text = "~FGA shadow " & act_type & ": " & "~RS" & user(usernum).inpstr & CRLF
End If
writeRoomExcept user(usernum).room, text, user(usernum).name
send "~FGYou " & Left$(act_type, Len(act_type) - 1) & ":~RS " & user(usernum).inpstr & CRLF, usernum
writeRoomBuff "~FG" & user(usernum).name & " " & act_type & ": " & "~RS" & user(usernum).inpstr, getRoom(user(usernum).room)
End Sub
Sub set_outmsg(usernum As Integer, inpstr As String)
If Len(inpstr) > 40 Then
send "Exit message is too big" & CRLF, usernum
Exit Sub
End If
If Len(inpstr) = 0 Then
send "Usage: outmsg <enter message>" & CRLF, usernum
Exit Sub
End If
user(usernum).exitMsg = inpstr
send "Exit message sent" & CRLF, usernum
End Sub
Sub suicide(usernum As Integer, inpstr As String)
If user(usernum).netlinkType Then
send MSG_NO_NETLINK & CRLF, usernum
Exit Sub
End If