-
Notifications
You must be signed in to change notification settings - Fork 1
/
bnetbot.cls
195 lines (182 loc) · 6.36 KB
/
bnetbot.cls
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
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "BnetBot"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private Const ID_EMOTE = &H17
Private Const ID_WHISPTO = &HA
Private Const ID_WHISPFROM = &H4
Private Const ID_TALK = &H5
Private Const ID_USER = &H1
Private Const ID_JOIN = &H2
Private Const ID_LEAVE = &H3
Private Const ID_FLAGS = &H9
Private Const ID_CHAN = &H7
Private Const ID_ERROR = &H13
Private Const ID_INFO = &H12
Private Const ID_BROADCAST = &H6
Private Const BNFLAGS_BLIZZ = &H1
Private Const BNFLAGS_OP = &H2
Private Const BNFLAGS_SPKR = &H4
Private Const BNFLAGS_SYSOP = &H8
Private Const BNFLAGS_PLUG = &H10
Private Const BNFLAGS_SQUELCH = &H20
Private Const BNFLAGS_GLASSES = &H40
Private Const BNFLAGS_GFPLAYER = &H200000
Private Const INVIG = &H80000
Private Const bnu = &H800000
Private Const HACK = &H8000000
Private Const WARCRAFT3 = &H80000000
Private Const pidSEXP = 9
Private Const pidSTAR = 6
Private Const pidD2DV = 5
Private Const pidD2XP = 13
Private Const pidW2BN = 10
Private Const pidJSTR = 11
Private Const pidSSHR = 7
Private Const pidWAR3 = 61
Private Const pidDSHR = 64
Private Const pidCHAT = 1
Private Const pidELSE = 59
Private Const pidDRTL = 3
Private Const pidBLIZZ = 63
Private Const pidOP = 2
Private Const pidSQU = 14
Private Const pidW3XP = 62
'' Invigoration Icons
'' id: 66 - BNET.cc Icon
'' id: 67 - BNU`Bot Icon
'' id: 68 - HACKER
Public Event OnUser(ByVal username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long)
Public Event OnJoin(ByVal username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long)
Public Event OnLeave(ByVal username As String, ByVal Flags As Long)
Public Event OnWhisperFrom(ByVal username As String, ByVal Flags As Long, ByVal Message As String)
Public Event OnTalk(ByVal username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long)
Public Event OnChannel(ByVal ChannelName As String, ByVal Flags As Long)
Public Event OnFlags(ByVal username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long)
Public Event OnWhisperTo(ByVal username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long)
Public Event OnInfo(ByVal Message As String)
Public Event OnError(ByVal Message As String)
Public Event OnEmote(ByVal username As String, ByVal Flags As Long, ByVal Message As String)
Public Event OnUnknown(ByVal UnknownString As String)
Public Sub DispatchMessage(ByVal databuf As String)
Dim EID As Long, Ping As Long, username As String, Message As String
EID = MakeLong(Mid$(databuf, 5, 4))
Flags = MakeLong(Mid$(databuf, 9, 4))
Ping = MakeLong(Mid$(databuf, 13, 4))
username = KillNull(Mid$(databuf, 29))
Message = KillNull(Mid$(databuf, Len(username) + 30))
Select Case EID
Case ID_TALK
RaiseEvent OnTalk(username, Flags, Message, Ping)
Exit Sub
Case ID_EMOTE
RaiseEvent OnEmote(username, Flags, Message)
Exit Sub
Case ID_CHAN
RaiseEvent OnChannel(Message, Flags)
Exit Sub
Case ID_USER
RaiseEvent OnUser(username, Flags, Message, Ping)
Exit Sub
Case ID_JOIN
RaiseEvent OnJoin(username, Flags, Message, Ping)
Exit Sub
Case ID_LEAVE
RaiseEvent OnLeave(username, Flags)
Exit Sub
Case ID_WHISPTO
RaiseEvent OnWhisperTo(username, Flags, Message, Ping)
Exit Sub
Case ID_WHISPFROM
RaiseEvent OnWhisperFrom(username, Flags, Message)
Exit Sub
Case ID_INFO
RaiseEvent OnInfo(Message)
Exit Sub
Case ID_FLAGS
RaiseEvent OnFlags(username, Flags, Message, Ping)
Exit Sub
Case ID_BROADCAST
RaiseEvent OnInfo(Message)
Exit Sub
Case ID_ERROR
RaiseEvent OnError(Message)
Exit Sub
Case Else
RaiseEvent OnUnknown(Message)
Exit Sub
End Select
End Sub
Function MakeLong(X As String) As Long
If Len(X) < 4 Then
Exit Function
End If
CopyMemory MakeLong, ByVal X, 4
End Function
Public Function GetIconCode(ByVal statstring As String, ByVal Flags As Long) As Integer
Dim Product As String
Product = Mid(statstring, 1, 4)
If (BNFLAGS_BLIZZ And Flags) = BNFLAGS_BLIZZ Then
GetIconCode = 64
Exit Function
ElseIf (BNFLAGS_OP And Flags) = BNFLAGS_OP Then
GetIconCode = 2
Exit Function
ElseIf (BNFLAGS_SYSOP And Flags) = BNFLAGS_SYSOP Then
GetIconCode = 64
Exit Function
ElseIf (BNFLAGS_SQUELCH And Flags) = BNFLAGS_SQUELCH Then
GetIconCode = 14
Exit Function
ElseIf (BNFLAGS_GLASSES And Flags) = BNFLAGS_GLASSES Then
GetIconCode = 65
Exit Function
ElseIf (INVIG And Flags) = INVIG Then
GetIconCode = 66
Exit Function
ElseIf (bnu And Flags) = bnu Then
GetIconCode = 69
Exit Function
ElseIf (HACK And Flags) = HACK Then
GetIconCode = 70
'GetIconCode = 64
Exit Function
ElseIf (WARCRAFT3 And Flags) = WARCRAFT3 Then
GetIconCode = 61
Exit Function
ElseIf Not Flags Then: GoTo Products
End If
Products:
Select Case Product
Case "PXES": GetIconCode = pidSEXP
Case "RATS": GetIconCode = pidSTAR
Case "RTSJ": GetIconCode = pidJSTR
Case "RHSS": GetIconCode = pidSSHR
Case "NB2W": GetIconCode = pidW2BN
Case "VD2D": GetIconCode = pidD2DV
Case "PX2D": GetIconCode = pidD2XP
Case "LTRD": GetIconCode = pidDRTL
Case "RHSD": GetIconCode = pidDRTL
Case "TAHC": GetIconCode = pidCHAT
Case "3RAW": GetIconCode = pidWAR3
Case "PX3W": GetIconCode = pidW3XP
Case Else: GetIconCode = pidELSE
End Select
End Function
Public Property Get DataSource() As DataSource
End Property
Public Property Set DataSource(ByVal objDataSource As DataSource)
End Property
Public Property Get DataMember() As DataMember
End Property
Public Property Let DataMember(ByVal DataMember As DataMember)
End Property