-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommands.bas
256 lines (215 loc) · 7.55 KB
/
Commands.bas
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
Attribute VB_Name = "Commands"
Function Do_Quit(Socket As Integer)
nul = Logit("Comm: " & Users.Users(Socket).Username & " has quit.", 3, "comm")
nul = Send("Good bye!", Socket)
frmMain.WS(Socket).Close
End Function
Function Do_Look(Socket As Integer)
On Error GoTo Err
Dim ToSend As String
ToSend = Ansi(14) & World.RoomName(Users.Users(Socket).Vnum) & Ansi(7) & vbCrLf
ToSend = ToSend & World.RoomDesc(Users.Users(Socket).Vnum) & vbCrLf
Exits = Ansi(3) & "[Exits: "
If World.RoomExits(Users.Users(Socket).Vnum, 0) > 0 Then
Exits = Exits & " north "
End If
If World.RoomExits(Users.Users(Socket).Vnum, 1) > 0 Then
Exits = Exits & " east "
End If
If World.RoomExits(Users.Users(Socket).Vnum, 2) > 0 Then
Exits = Exits & " south "
End If
If World.RoomExits(Users.Users(Socket).Vnum, 3) > 0 Then
Exits = Exits & " west "
End If
Exits = Exits & "]" & Ansi(7)
ToSend = ToSend & Exits & vbCrLf
Buf = Ansi(14)
For I = 0 To MaxUsers
If Users.Users(I).Vnum = Users.Users(Socket).Vnum Then
If Not I = Socket Then
Buf = Buf & vbCrLf & Users.Users(I).Username & " " & Users.Users(I).Title
End If
End If
Next
ToSend = ToSend & Buf & Ansi(7)
nul = Send(ToSend, Socket)
Exit Function
Err:
Users.Users(Socket).Vnum = 1
Resume Next
End Function
Function Do_Score(Socket As Integer)
Dim Buf As String
Buf = Ansi(10) & "Score Sheet for " & Ansi(12) & Users.Users(Socket).Username & Ansi(10) & vbCrLf & "------------------------------------------------------------------------" & vbCrLf
nul = Send(Buf, Socket)
End Function
Function Do_Help(Socket As Integer)
Dim Buf As String
For I = 1 To ParseMod.Count
Buf = Buf & " " & Results(I)
Next
If Buf = "" Then
nul = Send("Find a help file on what?", Socket)
ElseIf Buf = " " Then
nul = Send("Find a help file on what?", Socket)
ElseIf Buf = " " Then
nul = Send("Find a help file on what?", Socket)
End If
Buf = Right$(Buf, Len(Buf) - 1)
For I = 0 To Tables.HelpCount
If Left(Tables.Help(I), Len(Buf)) = Buf Then
If Not Tables.HelpLvl(I) > Users.Users(Socket).Level Then
nul = Send(Ansi(15) & Tables.HelpContents(I) & Ansi(7), Socket)
Exit Function
Else
nul = Send("No help file found.", Socket)
End If
End If
Next
nul = Send("No help file found.", Socket)
End Function
Function Do_North(Socket As Integer)
If World.RoomExits(Users.Users(Socket).Vnum, 0) > 0 Then
Users.Users(Socket).Vnum = World.RoomExits(Users.Users(Socket).Vnum, 0)
nul = Send("You leave north.", Socket)
Do_Look (Socket)
Else
nul = EchoAround(PCase(Users.Users(Socket).Username) & " attempts to leave north, but relized only after " & GetHeShe(Socket) & " has walked into the wall, that there is no exit there.", Socket, -1)
nul = Send("You attempt to leave north and relize, only after you've walked into the wall, that there is no exit there.", Socket)
End If
End Function
Function Do_East(Socket As Integer)
If World.RoomExits(Users.Users(Socket).Vnum, 1) > 0 Then
Users.Users(Socket).Vnum = World.RoomExits(Users.Users(Socket).Vnum, 1)
nul = Send("You leave east.", Socket)
Do_Look (Socket)
Else
nul = EchoAround(PCase(Users.Users(Socket).Username) & " attempts to leave east, but relized only after " & GetHeShe(Socket) & " has walked into the wall, that there is no exit there.", Socket, -1)
nul = Send("You attempt to leave east and relize, only after you've walked into the wall, that there is no exit there.", Socket)
End If
End Function
Function Do_South(Socket As Integer)
If World.RoomExits(Users.Users(Socket).Vnum, 2) > 0 Then
Users.Users(Socket).Vnum = World.RoomExits(Users.Users(Socket).Vnum, 2)
nul = Send("You leave south.", Socket)
Do_Look (Socket)
Else
nul = EchoAround(PCase(Users.Users(Socket).Username) & " attempts to leave south, but relized only after " & GetHeShe(Socket) & " has walked into the wall, that there is no exit there.", Socket, -1)
nul = Send("You attempt to leave south and relize, only after you've walked into the wall, that there is no exit there.", Socket)
End If
End Function
Function Do_West(Socket As Integer)
If World.RoomExits(Users.Users(Socket).Vnum, 3) > 0 Then
Users.Users(Socket).Vnum = World.RoomExits(Users.Users(Socket).Vnum, 3)
nul = Send("You leave west.", Socket)
Do_Look (Socket)
Else
nul = EchoAround(PCase(Users.Users(Socket).Username) & " attempts to leave west, but relized only after " & GetHeShe(Socket) & " has walked into the wall, that there is no exit there.", Socket, -1)
nul = Send("You attempt to leave west and relize, only after you've walked into the wall, that there is no exit there.", Socket)
End If
End Function
Function Do_Recall(Socket As Integer, Arguement As String)
Select Case Arguement
Case "reset"
Users.Users(Socket).Recall = Users.Users(Socket).RecallDefault
nul = Send("Recall Reset.", Socket)
Case "set"
Users.Users(Socket).Recall = Users.Users(Socket).Vnum
Case ""
If Not Users.Users(Socket).Recall = Users.Users(Socket).Vnum Then
Users.Users(Socket).Vnum = Users.Users(Socket).Recall
Else
nul = Send("You're already there!", Socket)
End If
End Select
End Function
Function Do_UserState(Socket As Integer)
If Users.Users(Socket).Level >= 800 Then
nul = Send("Your userstate is: " & UserState(Socket), Socket)
Else
nul = Send("Huh?", Socket)
End If
End Function
Function Do_SocketState(Socket As Integer)
If Users.Users(Socket).Level > 800 Then
nul = Send("Your socketstate is: " & SocketState(Socket), Socket)
Else
nul = Send("Huh?", Socket)
End If
End Function
Function Do_Say(Socket As Integer)
For I = 1 To ParseMod.Count
Buf = Buf & " " & Results(I)
Next
nul = EchoAround(Ansi(9) & Users.Users(Socket).Username & " says '" & Ansi(15) & Buf & Ansi(9) & "'" & Ansi(7), Socket, -1)
nul = Send(Ansi(9) & "You say '" & Ansi(15) & Buf & Ansi(9) & "'" & Ansi(7), Socket)
End Function
Function Do_Chat(Socket As Integer)
Dim I As Integer
For I = 1 To ParseMod.Count
Buf = Buf & " " & Results(I)
Next
For I = 0 To MaxUsers
If UserState(I) = 4 Then
nul = Send(Ansi(14) & Users.Users(Socket).Username & " chats '" & Buf & "'" & Ansi(7), I, True)
End If
Next
nul = Send(Ansi(14) & "You chat '" & Buf & "'" & Ansi(7), Socket)
End Function
'Immortal Only, need to add support for the command table
Function Do_Reload(Socket As Integer, Argument As String)
If Users.Users(Socket).Level < 980 Then
nul = Send("Huh?", Socket)
Else
Select Case LCase(Argument)
Case "world"
nul = Send("Reloading World...", Socket)
Mud.WizLocked = True
World.LoadWorld (World.WorldFileName)
frmMain.Wait (3)
Mud.WizLocked = False
nul = Send("Complete!", Socket)
End Select
End If
End Function
Function SEcho(Message As String, Source As Integer)
Dim I As Integer
For I = 0 To MaxUsers
If UserState(I) = 4 Then
If Not Users.Users(Source).Username = Users.Users(I).Username Then
nul = Send(Message, I)
End If
End If
Next
End Function
Function EchoAround(Message As String, TargetSock As Integer, Optional Source As Integer = -1)
If Not Source = -1 Then
If Users.Users(Source).Level > 840 Then
nul = Logit(Users.Users(Source).Username & ": echoaround " & Message & " " & TargetSock, 3, "cmds")
Else
nul = Send("Huh?", Source)
Exit Function
End If
End If
Dim I As Integer
For I = 0 To MaxUsers
If UserState(I) = 4 Then
If Users.Users(I).Vnum = Users.Users(TargetSock).Vnum Then
If Not Users.Users(I).Username = Users.Users(TargetSock).Username Then
nul = Send(Message, I, True)
End If
End If
End If
Next
End Function
Function Do_Mud(Socket As Integer, Arg As String)
Select Case LCase(Arg)
Case "name"
nul = Send(Ansi(15) & "Your are playing on: " & Ansi(12) & Mud.Name & Ansi(7), Socket)
Case "version"
nul = Send(Ansi(15) & "Mud is currently version: " & Ansi(12) & Mud.Version & Ansi(7), Socket)
Case Else
nul = Send(Ansi(15) & "Valid arguments are: name\version" & Ansi(7), Socket)
End Select
End Function