Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: the_lord_mephy on August 17, 2005, 10:10 PM

Title: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: the_lord_mephy on August 17, 2005, 10:10 PM
Topic.. It will give him ops icon if I join a channel where he is already ops, but not if he joins after me. This is my code:


Public Function GetIconCode(Optional ByVal Client As String, Optional ByVal Flags As Long, Optional ByVal SS As String) As Integer
Dim Code As Integer
Dim pA() As String
Dim Spawn As Integer
Dim stats As Boolean
On Error GoTo GetIconCode_Error
If Len(Client) > 4 Then stats = True
If Len(Client) <> 0 Then
Statstring = Client

    If (BNFLAGS_BLIZZ And Flags) = BNFLAGS_BLIZZ Then
        GetIconCode = ICON_BLIZZ
        Exit Function
    ElseIf (BNFLAGS_OP And Flags) = BNFLAGS_OP Then
        GetIconCode = ICON_GAVEL
        Exit Function
    ElseIf (BNFLAGS_SYSOP And Flags) = BNFLAGS_SYSOP Then
        GetIconCode = ICON_SYSOP
        Exit Function
    ElseIf (BNFLAGS_SQUELCH And Flags) = BNFLAGS_SQUELCH Then
        GetIconCode = ICON_SQUELCH
        Exit Function
    ElseIf (BNFLAGS_GLASSES And Flags) = BNFLAGS_GLASSES Then
        GetIconCode = ICON_GLASSES
        Exit Function
   ElseIf Flags = 48 Or Flags = 32 Then
        GetIconCode = ICON_SQUELCH
        Exit Function
    ElseIf Flags = 0 Then: GoTo Product
    End If
   
Product:
Select Case Mid(Client, 1, 4)
  Case "CHAT"
      Code = ICON_CHAT
  Case "STAR"
     Code = ICON_STAR
  Case "JSTR"
      Code = ICON_JSTR
  Case "SSHR"
      Code = ICON_SSHR
  Case "WAR3"
      Code = ICON_3RAW
  Case "D2DV"
      Code = ICON_D2DV
  Case "DSHR"
      Code = ICON_DSHR
  Case "D2XP"
      Code = ICON_D2XP
  Case "W2BN"
      Code = ICON_W2BN
  Case "SEXP"
      Code = ICON_SEXP
  Case "W3XP"
      Code = ICON_WAR3XP
  Case "DRTL"
      Code = ICON_DRTL
End Select
End If
GetIconCode = Code
Exit Function
GetIconCode_Error:

End Function



and this is in _UserJoins sub

Dim Icon As Integer
Icon = GetIconCode(Product, Flags)
Dim lagicoN As Integer
lagicoN = GetLagIcon(Ping, Flags)

If Icon = ICON_GAVEL Then
    AddChat vbBlue, "[" & Time & "]: A mod has joined the channel."
  With Form1.Listview1.ListItems.Add(1, , Username, , Icon)

    .ListSubItems.Add , , , lagicoN
    End With
End If

If Icon <> ICON_GAVEL Then
    With Form1.Listview1.ListItems.Add(, , Username, , Icon)
    .ListSubItems.Add , , , lagicoN
    End With
End If


The code above is also in the UserInChannel sub. But for _UserInChannel, Ops has Flags: 2 .  and when an Op joins he has Flags: 0
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: R.a.B.B.i.T on August 17, 2005, 10:58 PM
Is that icon in your imagelist?
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: the_lord_mephy on August 18, 2005, 10:00 AM
yes because when I join a channel where there is already an Op, he gets the Op flag. It has to do with Flags because in the user inchannel sub i put:
AddChat vbWhite, Username & " " & Flags
and in the userjoins sub i put:
AddChat vbWhite, Username & " " & Flags

for UserInChannel, Ops has Flags 2 and everyone else has flags 0
for UserJoins, Everyone has flags 0
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: l2k-Shadow on August 18, 2005, 10:35 AM
There should be something like UserFlags sub which you need to use, Battle.net sends UserFlags whenever you join a channel or whenever someone joins the channel you're currently in. You should receive the correct flags for users in this sub. Why would Battle.net choose to send another packet instead of just using UserJoins for correct flags? Who knows, Battle.net just sucks...  :-\
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: the_lord_mephy on August 18, 2005, 10:46 AM
I agree, I think it's kinda weird. Do you think it could be CSB is reading them wrong or something? It doesn't make sense for Bnet to send the wrong packet
[Edit]
There's no UserFlags Sub it's just:
Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean)
and

Private Sub CleanSlateBot1_UserInChannel(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, StatUpdate As Boolean, SimulatedEvent As Boolean)
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: Blaze on August 18, 2005, 11:40 AM
Yes, there is a flag update.  You will get a user join message, and then you will get the flag update after.  You're just not handling it because you can't find it.
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: the_lord_mephy on August 18, 2005, 01:42 PM
How would I go about finding it :-\ Edit  ooh i think i got it, nevermind. I'll post again if i need anymore help. Thanks
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: l2k-Shadow on August 18, 2005, 02:47 PM
I think it's safe to say that this post marked one of the few non-retarded CSB user who actually worked with his code and didn't ask retard questions aka "code it for me." Good job. :)
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: Sorc.Polgara on August 18, 2005, 03:40 PM
Quote from: l2k-Shadow on August 18, 2005, 02:47 PM
I think it's safe to say that this post marked one of the few non-retarded CSB user who actually worked with his code and didn't ask retard questions aka "code it for me." Good job. :)

Quote For Truth!
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: Lead on August 21, 2005, 12:23 AM
On Flags update have it check the channel list for people with the flags 2 or 18 and then readd them to the userlist with the gavel icon.
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: Warrior on August 21, 2005, 12:38 AM
Battle.net does this incase a user gets designated in the channel or someone gets squelched or promoted in permissions, you wouldn't want to send a join packet for that.

Sorry if I misread sorta skimmed over it.
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: the_lord_mephy on August 24, 2005, 06:44 PM
Quote from: Sorc.Polgara on August 18, 2005, 03:40 PM
Quote from: l2k-Shadow on August 18, 2005, 02:47 PM
I think it's safe to say that this post marked one of the few non-retarded CSB user who actually worked with his code and didn't ask retard questions aka "code it for me." Good job. :)

Quote For Truth!
Hehe, Best and brightest of the bottom of the barrel  :P
Quote from: Lead on August 21, 2005, 12:23 AM
On Flags update have it check the channel list for people with the flags 2 or 18 and then readd them to the userlist with the gavel icon.
Yep, thanks that's what I did.

PS: Sorry for bumping old topic, I haven't checked on this thread in a few days
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: MyndFyre on August 24, 2005, 08:12 PM
You shouldn't store data like a user's flags within the ListView.
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: the_lord_mephy on August 26, 2005, 08:03 PM
Why not? How else would I have a channel list?
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: Newby on August 26, 2005, 08:11 PM
Quote from: l2k-Shadow on August 18, 2005, 02:47 PM
I think it's safe to say that this post marked one of the few non-retarded CSB user who actually worked with his code and didn't ask retard questions aka "code it for me." Good job. :)

Uh, I'm nearly 100% positive that code is leeched.

Please tell me you are being sarcastic...
Title: Re: When Ops joins, it doesn't give him Ops icon. (Using CSB)
Post by: R.a.B.B.i.T on August 26, 2005, 09:46 PM
Quote from: the_lord_mephy on August 26, 2005, 08:03 PM
Why not? How else would I have a channel list?
A ListView should only be used for displaying data, not storing.  I'd suggest you create a type and then an array of that type to store all the data for users in a given channel.