-
Notifications
You must be signed in to change notification settings - Fork 1
/
modCommands.bas
309 lines (301 loc) · 12.8 KB
/
modCommands.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
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
Attribute VB_Name = "modCommands"
Global info As String
Global Canada As Integer
Global debugmode As Integer
Global idleMessage As String
Global idletimeset As Integer
Global fudd As Integer
Global uptimesec As Integer
Global uptimemin As Integer
Global uptimehour As Integer
Global uptimedays As Integer
Global uptimeweek As Integer
Global uptimemonth As Integer
Global moo As Integer
Global leetspeak As Integer
Global LastW As String
Global LastCW As String
Global LastM As String
Global LastSW As String
Global LastSM As String
Global BanCount As Integer
Global acceptinvites As Boolean
Global KickCount As Integer
Global JoinCount As Integer
Global beforetext As String
Global postpend As String
Global targetuser As String
Global targetusername As String
Public Sub ParseCommand(ByVal Message As String, username As String, Optional Inbot As Boolean = False)
If LCase$(Message) = "?trigger" Then Message = BNET.Trigger & "trigger"
'if the command doesn't have a trigger, its not a command, so exit
If Left$(Message, 1) <> BNET.Trigger And Left$(Message, 1) <> "/" Then Exit Sub
Message = Mid$(Message, 2) 'strip the trigger
Dim Command As String, Rest As String
If Len(Message) > 0 Then
Command = Split(Message, Space(1))(0) 'get the first word to be the command
'if there is more to the command, place it in the "rest" variable
If Len(Message) > Len(Command) + 1 Then Rest = Trim(Mid$(Message, Len(Command) + 1))
'until access system is setup, only parse commands from bot master
If (LCase(username) <> LCase(BNET.BotMaster)) And Not Inbot Then Exit Sub
End If
''''''''''''''''''''''''''''''''''''''' Commands ''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim i As Integer
Dim b As Boolean
Dim SayMessage As String
Dim Extra As String
Select Case LCase$(Command)
Case "idle"
Select Case Rest
Case "off"
frmMain.IdleTimer.Enabled = False
IdleTime = 0
Send LastCW & "Idle message turned off.", frmMain.wsBnet
LastCW = vbNullString
Case Else
tmp = Split(Rest, Space(1), 2)
idletimeset = tmp(0)
If tmp(1) = "uptime" Then
Send LastCW & "Idle message set.[Uptime]", frmMain.wsBnet
LastCW = vbNullString
idleMessage = "/me has been online for: " & uptimemonth & " months, " & uptimeweek & " weeks, " & uptimedays & " days, " & uptimehour & " hours, " & uptimemin & " minutes, and " & uptimesec & " seconds."
ElseIf tmp(1) = "ver" Then
Send LastCW & "Idle message set.[Version]", frmMain.wsBnet
LastCW = vbNullString
idleMessage = "/me is an Invigoration v" & botver & " by Tagban - http://www.BNET.cc"
Else
idleMessage = tmp(1)
Send LastCW & "Idle message set.", frmMain.wsBnet
LastCW = vbNullString
End If
frmMain.IdleTimer.Enabled = True
End Select
Case "disconnect", "disc"
AddChat D2White, "Disconnecting..."
frmMain.wsBnet.Close
frmMain.wsBnls.Close
Case "colors", "color"
AddChat D2Orange, "Chat Colors Help:"
AddChat D2White, "First use Alt+0160 infront and select a color from the list below:"
AddChat D2White, " r= rred w, w= wwhite, q= qgray w, g= ggreen w, y= yyellow w"
AddChat D2White, " b= bblue w, o= oorange w, c= ccyan(light blue) w, p= ppurple w"
AddChat D2White, " l= llight yellow w, e= ebeige w, k= kpink w"
Case "reconnect"
AddChat D2White, "Reconnecting, hold on tight!"
With frmMain.lstChannel
.ListItems.Clear
End With
frmMain.wsBnet.Close
frmMain.wsBnls.Close
frmMain.wsBnls.Close
frmMain.wsBnls.Connect BNET.BNLSServer, 9367
Case "hex", "h"
Send Chr(163) & StrToHex(Rest), frmMain.wsBnet
LastCW = vbNullString
Case "invigencrypt", "encrypt", "ie", "i"
Send Chr(149) & InvigEncrypt(Rest & "-"), frmMain.wsBnet
LastCW = vbNullString
Case "sysinfo"
Send "Invigoration running on: " & OSVersion & ". -- Runtime: " & WindowsRunTime & " hours.", frmMain.wsBnet
LastCW = vbNullString
Case "ver"
Send LastCW & "/me is an Invigoration v" & botver & " by Tagban - http://www.BNET.cc/", frmMain.wsBnet
LastCW = vbNullString
Case "uptime"
Send LastCW & "/me has been online for: " & uptimemonth & " months, " & uptimeweek & " weeks, " & uptimedays & " days, " & uptimehour & " hours, " & uptimemin & " minutes, and " & uptimesec & " seconds.", frmMain.wsBnet
LastCW = vbNullString
Case "about"
Send LastCW & "Invigoration was written in Visual Basic by Tagban Since 2004 -- http://www.bnet.cc", frmMain.wsBnet
LastCW = vbNullString
Case "say"
Send Rest, frmMain.wsBnet
LastCW = vbNullString
Case "bancount"
If BanCount = 0 Then
Send LastCW & "Noone has been banned since I entered this channel..", frmMain.wsBnet
LastCW = vbNullString
ElseIf BanCount = 1 Then
Send BanCount & " user has been banned since I joined this channel.", frmMain.wsBnet
LastCW = vbNullString
Else
Send BanCount & " users have been banned since I joined this channel.", frmMain.wsBnet
LastCW = vbNullString
End If
Case "kickcount"
If KickCount = 0 Then
Send LastCW & "Noone has been kicked since I entered this channel..", frmMain.wsBnet
LastCW = vbNullString
ElseIf KickCount = 1 Then
Send KickCount & " user has been kicked since I joined this channel.", frmMain.wsBnet
LastCW = vbNullString
Else
Send KickCount & " users have been kicked since I joined this channel.", frmMain.wsBnet
LastCW = vbNullString
End If
Case "joincount"
If JoinCount = 0 Then
Send LastCW & "Noone has entered since I got here..", frmMain.wsBnet
LastCW = vbNullString
ElseIf JoinCount = 1 Then
Send JoinCount & " user has joined the channel since I've been here.", frmMain.wsBnet
LastCW = vbNullString
Else
Send JoinCount & " users have joined the channel since I've been here.", frmMain.wsBnet
LastCW = vbNullString
End If
Case "ban"
Send "/ban " & Rest, frmMain.wsBnet
Case "join"
With PBuffer
.SendPacket &H10
.InsertDWORD 2
.InsertNTString Rest
.SendPacket &HC
'AddChat D2Orange, Rest
End With
Case "user"
rtbsendbnet.SelColor = D2White
targetuser = Rest & " : "
targetusername = Rest
' AddChat D2White, "User focus set on: " & Rest & vbNullString, vbNewLine, D2Orange
Case "useroff"
targetuser = vbNullString
'AddChat D2White, "User focus removed."
Case "prepend", "pre"
beforetext = Rest & vbNullString
AddChat D2MedBlue, beforetext & " will be displayed before each send."
AddChat D2MedBlue, "To deactivate, type: '/prepend' with nothig after it."
Case "postpend", "post"
AddChat D2MedBlue, Rest & " will be displayed after each send."
AddChat D2MedBlue, "To deactivate, type: '/postpend' with nothig after it."
postpend = Rest & vbNullString
Case "join"
Send "/join " & Rest, frmMain.wsBnet
Case "setmaster"
BNET.BotMaster = Rest
Send LastCW & " Bot master changed!", frmMain.wsBnet
SaveConfig
Case "sethome"
BNET.HomeChannel = Rest
Send LastCW & " Home channel changed!", frmMain.wsBnet
SaveConfig
Case "setusername"
BNET.username = Rest
Send LastCW & " Login username changed!", frmMain.wsBnet
SaveConfig
Case "setpass"
BNET.Password = Rest
Send LastCW & " Password login changed!", frmMain.wsBnet
SaveConfig
Case "setserver"
BNET.BattlenetServer = Rest
Send LastCW & " Server changed!", frmMain.wsBnet
SaveConfig
Case "settrigger"
BNET.Trigger = Rest
Send LastCW & " Bot trigger changed!", frmMain.wsBnet
SaveConfig
Case "kick"
Send "/kick " & Rest & " [InvigOp Alpha]", frmMain.wsBnet
Case "trigger"
Send LastCW & "The bot's trigger is: " & BNET.Trigger, frmMain.wsBnet
LastCW = vbNullString
Case "lastm", "lastMessage", "lastw", "last", "lrm", "lrw"
Send LastCW & "Last recieved whisper From: " & LastW & " :: " & LastM, frmMain.wsBnet
LastCW = vbNullString
Case "lastsm", "lastsentMessage", "lastsw", "lastsend", "lsm", "lsw"
Send LastCW & "Last sent whisper To: " & LastSW & " :: " & LastSM, frmMain.wsBnet
LastCW = vbNullString
'''''''''''''''''
Case "quit", "unload"
'Exits the Program, uses less ram to do so ^^
Unload frmMain
End
Case "canada"
If Canada = 0 Then
Canada = 1
Send LastCW & "Canada Mode enabled.", frmMain.wsBnet
LastCW = vbNullString
Else
Canada = 0
Send LastCW & "Canada Mode disabled.", frmMain.wsBnet
End If
'CanadaMode
Case "accept"
If acceptinvites Then
acceptinvites = False
Send LastCW & "Invite Auto-Accept Disabled.", frmMain.wsBnet
LastCW = vbNullString
Else
acceptinvites = True
Send LastCW & "Clan invitations will be accepted automatically.", frmMain.wsBnet
End If
'Accept Invites
Case "debug"
If debugmode = 0 Then
debugmode = 1
AddChat D2MedBlue, "Debug Mode enabled."
LastCW = vbNullString
Else
debugmode = 0
AddChat D2MedBlue, "Debug Mode disabled."
End If
'CanadaMode
Case "say"
Select Case Rest
Case Message
Send Message, frmMain.wsBnet
End Select
'CanadaMode
Case "leetspeak"
If leetspeak = 0 Then
leetspeak = 1
Send LastCW & "Leet Speak enabled.", frmMain.wsBnet
LastCW = vbNullString
Else
leetspeak = 0
Send LastCW & "Leet Speak off.", frmMain.wsBnet
LastCW = vbNullString
End If
'Leet Speak Mode
Case "fudd"
If fudd = 0 Then
fudd = 1
Send LastCW & "Elmer Fudd mode enabled.", frmMain.wsBnet
LastCW = vbNullString
Else
fudd = 0
Send LastCW & "Elmer Fudd mode Off", frmMain.wsBnet
LastCW = vbNullString
End If
'Elmer Fudd Mode
Case "moo"
If moo = 0 Then
moo = 1
Send LastCW & "Moooooooooooooooo mode engaged!", frmMain.wsBnet
LastCW = vbNullString
Else
moo = 0
Send LastCW & "Cows are off...", frmMain.wsBnet
LastCW = vbNullString
End If
'Elmer Fudd Mode
Case "home", "gohome", "homechan", "homechannel"
PBuffer.SendPacket &H10
PBuffer.InsertDWORD 2
PBuffer.InsertNTString BNET.HomeChannel
PBuffer.SendPacket &HC
Case "rejoin"
PBuffer.SendPacket &H10
PBuffer.InsertDWORD 2
PBuffer.InsertNTString BNET.CurrentChan
PBuffer.SendPacket &HC
Case "w", "m", "whisper", "unignore", "unsquelch", "Message", "help", "clan", "where", "c", "Message", "squelch", "ign,e", "f", "friend", "friends", "?", "help", "dnd", "options", "o", "emote", "me", "channel", "who", "whoami", "whois", "whereis", "beep", "designate", "mail", "time", "unban", "users", "stats", "set-email", "nobeep"
If Inbot Then Send LastCW & "/" & Message, frmMain.wsBnet
'Empty Command NOTHING NULL'
Case Else
'AddChat D2Red, "This is not a valid command, or is not currently functioning properly. If you feel this message is in error, please report it as a bug on Invigoration's website. http://invigoration.bnet.cc"
'' The above only happens if the command is BLANK ''
End Select
End Sub