Skip to content
Permalink
Browse files

Add ChannelName to product info and use it for first joins

This more closely emulates the actual clients and should put the bot in
the correct default channels, since the server doesn't do that for us
anymore. Only WarCraft 3, Diablo II, and StarCraft were tested. The
others are set to what I assume is the correct value since I don't have
access to their clients to find out.
  • Loading branch information...
Davnit committed Feb 15, 2017
1 parent 7d75f9e commit 29af098b7c82222c6bd7fdcfed2639d1afe2038b
Showing with 27 additions and 19 deletions.
  1. +11 −5 trunk/modBNCS.bas
  2. +1 −0 trunk/modEnum.bas
  3. +15 −14 trunk/modOtherCode.bas
@@ -1999,14 +1999,20 @@ End Sub
Public Sub DoChannelJoinProductHome()
On Error GoTo ERROR_HANDLER:

' empty homechannel or
' config override to force joinhome
If BotVars.Product = "PX2D" Or BotVars.Product = "VD2D" Then
Call FullJoin(BotVars.Product, 5)
Dim iJoinType As Integer
Dim pi As udtProductInfo

pi = GetProductInfo(BotVars.Product)

' D2 uses a different join type
If pi.ShortCode = PRODUCT_D2DV Or pi.ShortCode = PRODUCT_D2XP Then
iJoinType = 5
Else
Call FullJoin(BotVars.Product, 1)
iJoinType = 1
End If

Call FullJoin(pi.ChannelName, iJoinType)

Exit Sub
ERROR_HANDLER:
Call frmChat.AddChat(RTBColors.ErrorMessageText, _
@@ -34,6 +34,7 @@ Public Type udtProductInfo
ShortCode As String
KeyCount As Integer
FullName As String
ChannelName As String
BNLS_ID As Long
LogonSystem As Long
VersionByte As Long
@@ -3193,26 +3193,27 @@ End Sub

Public Sub BuildProductInfo()
' 4-digit code, short code, short name, long name, number of keys, BNLS ID, logon system
ProductList(0) = CreateProductInfo("UNKW", vbNullString, "Unknown Product", 0, &H0, &H0, &H0)
ProductList(1) = CreateProductInfo(PRODUCT_STAR, "SC", "StarCraft", 1, &H1, BNCS_NLS, &HD3)
ProductList(2) = CreateProductInfo(PRODUCT_SEXP, "SC", "StarCraft Broodwar", 1, &H2, BNCS_NLS, &HD3)
ProductList(3) = CreateProductInfo(PRODUCT_W2BN, "W2", "WarCraft II: Battle.net Edition", 1, &H3, BNCS_OLS, &H4F)
ProductList(4) = CreateProductInfo(PRODUCT_D2DV, "D2", "Diablo II", 1, &H4, BNCS_NLS, &HE)
ProductList(5) = CreateProductInfo(PRODUCT_D2XP, "D2X", "Diablo II: Lord of Destruction", 2, &H5, BNCS_NLS, &HE)
ProductList(6) = CreateProductInfo(PRODUCT_WAR3, "W3", "WarCraft III: Reign of Chaos", 1, &H7, BNCS_NLS, &H1B)
ProductList(7) = CreateProductInfo(PRODUCT_W3XP, "W3", "WarCraft III: The Frozen Throne", 2, &H8, BNCS_NLS, &H1B)
ProductList(8) = CreateProductInfo(PRODUCT_DSHR, "DS", "Diablo Shareware", 0, &HA, BNCS_OLS, &H2A)
ProductList(9) = CreateProductInfo(PRODUCT_DRTL, "D1", "Diablo", 0, &H9, BNCS_OLS, &H2A)
ProductList(10) = CreateProductInfo(PRODUCT_SSHR, "SS", "StarCraft Shareware", 0, &HB, BNCS_LLS, &HA9)
ProductList(11) = CreateProductInfo(PRODUCT_JSTR, "JS", "Japanese StarCraft", 1, &H6, BNCS_LLS, &HA9)
ProductList(12) = CreateProductInfo(PRODUCT_CHAT, "CHAT", "Telnet Chat", 0, &H0, &H0, &H0)
ProductList(0) = CreateProductInfo("UNKW", vbNullString, "Unknown Product", "Unknown", 0, &H0, &H0, &H0)
ProductList(1) = CreateProductInfo(PRODUCT_STAR, "SC", "StarCraft", "StarCraft", 1, &H1, BNCS_NLS, &HD3)
ProductList(2) = CreateProductInfo(PRODUCT_SEXP, "SC", "StarCraft Broodwar", "Brood War", 1, &H2, BNCS_NLS, &HD3)
ProductList(3) = CreateProductInfo(PRODUCT_W2BN, "W2", "WarCraft II: Battle.net Edition", "WarCraft II", 1, &H3, BNCS_OLS, &H4F)
ProductList(4) = CreateProductInfo(PRODUCT_D2DV, "D2", "Diablo II", "Diablo II", 1, &H4, BNCS_NLS, &HE)
ProductList(5) = CreateProductInfo(PRODUCT_D2XP, "D2X", "Diablo II: Lord of Destruction", "Diablo II", 2, &H5, BNCS_NLS, &HE)
ProductList(6) = CreateProductInfo(PRODUCT_WAR3, "W3", "WarCraft III: Reign of Chaos", "W3", 1, &H7, BNCS_NLS, &H1B)
ProductList(7) = CreateProductInfo(PRODUCT_W3XP, "W3", "WarCraft III: The Frozen Throne", "W3", 2, &H8, BNCS_NLS, &H1B)
ProductList(8) = CreateProductInfo(PRODUCT_DSHR, "DS", "Diablo Shareware", "Diablo Shareware", 0, &HA, BNCS_OLS, &H2A)
ProductList(9) = CreateProductInfo(PRODUCT_DRTL, "D1", "Diablo", "Diablo Retail", 0, &H9, BNCS_OLS, &H2A)
ProductList(10) = CreateProductInfo(PRODUCT_SSHR, "SS", "StarCraft Shareware", "StarCraft", 0, &HB, BNCS_LLS, &HA9)
ProductList(11) = CreateProductInfo(PRODUCT_JSTR, "JS", "Japanese StarCraft", "StarCraft", 1, &H6, BNCS_LLS, &HA9)
ProductList(12) = CreateProductInfo(PRODUCT_CHAT, "CHAT", "Telnet Chat", "Telnet", 0, &H0, &H0, &H0)
End Sub

Private Function CreateProductInfo(ByVal sCode As String, ByVal sShort As String, ByVal sLongName As String, ByVal iKeys As Integer, ByVal iBnlsId As Long, ByVal iLogonSystem As Long, ByVal iVerByte As Long) As udtProductInfo
Private Function CreateProductInfo(ByVal sCode As String, ByVal sShort As String, ByVal sLongName As String, ByVal sChannelName As String, ByVal iKeys As Integer, ByVal iBnlsId As Long, ByVal iLogonSystem As Long, ByVal iVerByte As Long) As udtProductInfo
Dim pi As udtProductInfo
pi.Code = UCase$(sCode)
pi.ShortCode = UCase$(sShort)
pi.FullName = sLongName
pi.ChannelName = sChannelName
pi.KeyCount = iKeys
pi.BNLS_ID = iBnlsId
pi.LogonSystem = iLogonSystem

0 comments on commit 29af098

Please sign in to comment.
You can’t perform that action at this time.