top5clan help
This is a discussion on top5clan help within the Stealthbot Plugins forum part of the Stealthbot category; hi can you help for plugins plz
'ladderclan
'0.1
'Improved
'By Lolercakess
Private Const ladderclan_cEventTalk = 1
Private Const ladderclan_cEventEmote ...
-
top5clan help
hi can you help for plugins plz
'ladderclan
'0.1
'Improved
'By Lolercakess
Private Const ladderclan_cEventTalk = 1
Private Const ladderclan_cEventEmote = 2
Private Const ladderclan_cEventWhisper = 3
Private Const ladderclan_cEventInBot = 4
Private ladderclan_cmd_top5clansolo
Private ladderclan_access
Private ladderclan_flag
Private ladderclan_default_gateway
Sub ladderclan_Event_Load()
ladderclan_LoadSettings
End Sub
Sub ladderclan_Event_UserTalk(Username, Flags, Message, Ping)
ladderclan_ProcessInput Username, Message, Flags, Ping, _
laddera_cEventTalk
End Sub
Sub ladderclan_Event_UserEmote(Username, Flags, Message)
ladderclan_ProcessInput Username, Message, Flags, 0, _
laddera_cEventEmote
End Sub
Sub ladderclan_Event_WhisperFromUser(Username, Flags, Message)
ladderclan_ProcessInput Username, Message, Flags, 0, _
ladderclan_cEventWhisper
End Sub
Sub ladderclan_Event_PressedEnter(Text)
If Left(Text, 1) = BotVars.Trigger Then
VetoThisMessage
End If
ladderclan_ProcessInput myUsername, Text, "", 0, _
laddear_cEventInBot
End Sub
Private Function URLEncode(sRawURL)
Dim iLoop, sRtn, sTmp, sValidChars
sValidChars = "1234567890" & _
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" & _
"abcdefghijklmnopqrstuvwxyz:/.=_-$(){}~"
If Len(sRawURL) > 0 Then
For iLoop = 1 To Len(sRawURL)
sTmp = Mid(sRawURL, iLoop, 1)
If InStr(1, sValidChars, sTmp, _
vbBinaryCompare) = 0 Then
sTmp = Hex(Asc(sTmp))
If sTmp = "20" Then
sTmp = "+"
ElseIf Len(sTmp) = 1 Then
sTmp = "%0" & sTmp
Else
sTmp = "%" & sTmp
End If
End If
sRtn = sRtn & sTmp
Next
URLEncode = sRtn
End If
End Function
Private Function RemoveWhiteSpaces(sText)
Dim iLoop, sRtn, sTmp
sRtn = ""
For iLoop = 1 To Len(sText)
sTmp = Mid(sText, iLoop, 1)
Select Case Asc(sTmp)
Case 9 'Tab
Case 10 'lf
Case 32 'space
Case 13 'cr
Case Else
sRtn = sRtn & sTmp
End Select
Next
RemoveWhiteSpaces = sRtn
End Function
Sub ladderclan_LoadSettings()
SetSetting "ladderclan", "cmd_top5clan", "top5clan", _
"Command to retrieve top5-solo-clan", False
SetSetting "ladderclan", "access", "10", _
"Access required to use commands", False
SetSetting "ladderclan", "flag", "", _
"Flag required to use commands", False
SetSetting "ladderclan", "default_gateway", "Northrend", _
"Default Gateway in commands", False
ladderclan_cmd_top5clan = CStr(GetSetting("ladderclan", _
"cmd_top5clan"))
ladderclan_access = CLng(GetSetting("ladderclan", _
"access"))
ladderclan_flag = CStr(GetSetting("ladderclan", "flag"))
ladderclan_default_gateway = CStr(GetSetting("ladderclan", _
"default_gateway"))
End Sub
Sub ladderclan_ProcessInput(User, Msg, Flags, Ping, Origin)
Dim hasA, hasF
Msg = Trim(Msg)
If Len(Msg) = 0 Then
Exit Sub
End If
If Left(Msg, Len(ladderclan_cmd_top5clan) + 1) = _
BotVars.Trigger & ladderclan_cmd_top5clan Then
GetDBEntry User, hasA, hasF
If (hasA < ladderclan_access) And Not _
((ladderclan_flag <> "") And ( _
InStr(hasF, ladderclan_flag) > 0)) Then
Dsp Origin, "Access denied", User, vbRed
Exit Sub
End If
Msg = Trim(Mid(Msg, _
Len(ladderclan_cmd_top5clan) + 2))
ladderclan_docmd_top5clan User, Msg, Origin
End If
End Sub
Sub ladderclan_docmd_top5clan(User, Msg, clan, Origin)
Addq "/emote Extracting Data From WebSite >>> Wait Plz <<< "
If scINet.StillExecuting Then
Exit Sub
End If
Dim mp, s, i, u, g, top5clan_(4), t, a
u = "http://www.battle.net/war3/ladder/" & _
"w3xp-ladder-solo-clan.aspx?Gateway="
If Len(Msg) = 0 Then
g = ladderclan_default_gateway
Else
g = Msg
End If
If Len(Trim(g)) = 0 Then
Dsp Origin, "Usage: " & BotVars.Trigger & _
ladderclan_docmd_top5 & " <gateway>", clan, vbRed
Exit Sub
End If
u = Trim(u & URLEncode(g))
On Error Resume Next
s = scINet.OpenURL( CStr(u) ) ' fucking microsoft-bs
If Err.Number <> 0 Then
Dsp Origin, "Service not available (" & _
Err.Number & ")", clan, vbRed
Err.Clear
Exit Sub
End If
For j = 0 To UBound(top5clan_)
Set top5clan_(j) = New clsLadderclanEntry
Next
For j = 0 To UBound(top5clan_)
i = InStr(s, "<tr class=""rankingRow""")
If i > 0 Then
s = Mid(s, i + Len("<tr class=""rankingRow"""))
Else
Exit For
End If
i = InStr(s, "<td class=""rankingRow"">")
If i > 0 Then
s = Mid(s, i + Len("<td class=""rankingRow"">"))
Else
Exit For
End If
' Rank
i = InStr(s, "<")
If i > 0 Then
top5clan_(j).Rank = _
RemoveWhiteSpaces(Left(s, i - 1))
End If
' Level
i = InStr(s, """levelbarChild"">")
If i > 0 Then
s = Mid(s, i + Len("""levelbarChild"">"))
i = InStr(s, "<")
If i > 0 Then
top5clan_(j).Level = _
RemoveWhiteSpaces(Left(s, i - 1))
End If
End If
' Clan
i = InStr(s, "<td class=""rankingRow"">")
If i > 0 Then
s = Mid(s, i + Len("<td class=""rankingRow"">"))
i = InStr(s, "</td>")
If i > 0 Then
t = RemoveWhiteSpaces(Left(s, i - 1))
If Len(t) > 0 Then
i = InStr(t, ">")
If i > 0 Then
t = Mid(t, i + 1)
i = InStr(t, "</a>")
If i > 0 Then
top5clan_(j).Clan = Left(t, i - 1)
End If
End If
End If
End If
End If
' XP
i = InStr(s, """rankingRow"">")
If i > 0 Then
s = Mid(s, i + Len("""rankingRow"">"))
i = InStr(s, "<")
If i > 0 Then
top5clan_(j).XP = _
RemoveWhiteSpaces(Left(s, i - 1))
End If
End If
' Wins
i = InStr(s, """rankingRow"">")
If i > 0 Then
s = Mid(s, i + Len("""rankingRow"">"))
i = InStr(s, "<")
If i > 0 Then
top5clan_(j).Wins = _
RemoveWhiteSpaces(Left(s, i - 1))
End If
End If
' Losses
i = InStr(s, """rankingRow"">")
If i > 0 Then
s = Mid(s, i + Len("""rankingRow"">"))
i = InStr(s, "<")
If i > 0 Then
top5clan_(j).Losses = _
RemoveWhiteSpaces(Left(s, i - 1))
End If
End If
End Function
Private Sub Class_Initialize
End Sub
Private Sub Class_Terminate
End Sub
End Class
Thx for help
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules