• Welcome to Valhalla Legends Archive.
 

A little help needed...

Started by RedPhoenix, April 15, 2004, 02:00 AM

Previous topic - Next topic

RedPhoenix

I working on making a bot using Visual Basic .Net. So far I'm able to connect to Battle Net and get on the Public chats. Now if I want to expand my region my bot can go. Lets say for example StarCraft, and enter Broad War USA-01. How should the string to first initialize the chat logon be structured? Right now I'm using this string to logon:

Chr(3) & Chr(4) & AccountName & Chr(13) & Chr(10) & AccountPassword & Chr(13) & Chr(10)

Tuberload

BNetDocs is a good place to start. It might not be enough, but it would be worth looking at.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

Maddox

Chr(13) & Chr(10) is VbCrLf.
asdf.

RedPhoenix

Lol I know, I got some of the basis for it from a vb 6 source I found. Just left it like it was, either way works.

Eric


RedPhoenix

The links are not much help, I'll just use the method of trial and error. I'll eventually end up getting the strings needed to connect to the *restricted* servers eventually.

Eli_1

#6
QuoteI'll just use the method of trial and error. I'll eventually end up getting the strings needed.

I'm under the impression that you still think you only need to modify the login packet from the CHAT connection. If that's the case then no you wont. I suggest you read this post, http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=6023;start=msg52131. This person seems to have the same problem as you, and there's a lot of good links that you should read if you want to learn.

iago

#7
I am interested in seeing this "Broad War"

But anyway, there are TONS of posts here just like yours.  Try reading through them.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

Quote from: LoRd[nK] on April 15, 2004, 02:18 AM
Resources to help you (in order from simplest to hardest):

1. http://www.valhallalegends.com/CupHead/ => CleanSlateBot
2. http://www.valhallalegends.com/yoni/BNLSProtocolSpec.txt
3. http://bnetdocs.valhallalegends.com/

Eww @ using a COM OCX in Visual Basic .NET.  :P

I'm developing a .NET component (assembly) that takes care of all of the underlying connection mechanism (similarly to how CSB does it).  The Alpha 4 version, which has support for Warcraft III clans, should be ready to go by the end of April or early May.

I'd be willing to share it as long as you're not a lamer.  You have to put forth *some* effort to understand how it works.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

RedPhoenix

#9
Here's what I got so far, It still needs more features etc... I just started this last night, this will connect you to the Public Chat 1 server in Battle Net.

Imports System.Net.Sockets
Imports System.Text
Imports System.Threading

Dim client As New TcpClient()

Private strServer As String = "useast.battle.net"
Private msgStart As [String] = Chr(3) & Chr(4) & AccountName & Chr(13) & Chr(10) & AccountPassword & Chr(13) & Chr(10)

Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
       Try
           ' Create a TcpClient.
           ' Note, for this client to work you need to have a TcpServer
           ' connected to the same address as specified by the server, port
           ' combination.
           client.Connect(strServer, 6112)

           ' Translate the passed message into ASCII and store it as a Byte array.
           Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(msgStart)

           ' Get a client stream for reading and writing.
           '  Stream stream = client.GetStream();
           Dim stream As NetworkStream = client.GetStream()
           stream.Write(data, 0, data.Length)
           txtRecieve.Text &= "Initializing....." & vbCrLf

           ' Receive the TcpServer.response.
           ' Buffer to store the response bytes.
           data = New [Byte](256) {}

           ' String to store the response ASCII representation.
           Dim responseData As [String] = [String].Empty

           ' Read the first batch of the TcpServer response bytes.
           Dim bytes As Int32 = stream.Read(data, 0, data.Length)
           responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes)
           txtRecieve.Text &= "Connected to Battle net: " & Format(Now, "mm/dd/yyy hh:mm:ss tt") & vbCrLf

           Dim t As New Thread(New ThreadStart(AddressOf GetData))
           t.Start()

       Catch ex As ArgumentNullException
           txtRecieve.Text &= "ArgumentNullException: " & ex.ToString

       Catch exc As SocketException
           txtRecieve.Text &= "SocketException: " & exc.ToString

       End Try
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
       End
End Sub

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
       Dim msgSend As String = txtSend.Text & Chr(13) & Chr(10)
       Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(msgSend)
       Dim stream As NetworkStream = client.GetStream()

       ' Send the message to the connected TcpServer.
       stream.Write(data, 0, data.Length)

       txtRecieve.Text &= AccountName & msgSend
       txtRecieve.SelectionStart = txtRecieve.TextLength - 1
       txtSend.Text = ""
End Sub

Private Sub GetData()
       'This retrieves the messages from users every 2 secs.
       Dim msgSend As String = "0x00" & Chr(13) & Chr(10)
       Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(msgSend)
       Dim stream As NetworkStream = client.GetStream()

       data = New [Byte](256) {}

       Dim responseData As [String] = [String].Empty
       Dim bytes As Int32 = stream.Read(data, 0, data.Length)

       responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes)
       txtRecieve.Text &= responseData
       txtRecieve.SelectionStart = txtRecieve.TextLength - 1

       Thread.CurrentThread.Sleep(500)
       If txtRecieve.TextLength > 1100 Then
           txtRecieve.Text = ""
       End If
       GetData()
End Sub

RedPhoenix

Where AccountName and AccountPassword = just place in quotes your games account name & password you made. Or at the top make something like this:

Dim AccountName As String = "YourName"
Dim AccountPassword As String = "YourPassword"


Lol I keep wanting to end my lines with a dang semicolon!

P.S. The code above is written in Visual Basic .Net 2002

iago

You're nowhere near what you will need to make a binary connection.  There's A LOT more to it.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


LordNevar

Dang, that's all I had to do to make a binary connection, and all this time wasted working with BNLS, and Hash Files. aw..... :(

Note the sarcasm.

A good fortune may forbode a bad luck, which may in turn disguise a good fortune.
The greatest trick the Devil ever pulled, was convincing the world he didn't exsist.

iago

lmao, I just noticed the subject is "A little help needed..."

ha'
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

Quote from: RedPhoenix on April 15, 2004, 11:55 AM
Where AccountName and AccountPassword = just place in quotes your games account name & password you made. Or at the top make something like this:

Dim AccountName As String = "YourName"
Dim AccountPassword As String = "YourPassword"


Lol I keep wanting to end my lines with a dang semicolon!

P.S. The code above is written in Visual Basic .Net 2002

Well congrats, I must say that if you've gotten past the connection part, that was the biggest hurdle for me to get over :)

What everyone else here means by saying that you need to have a "binary" connection is that you need to be able to deal with data that you don't use with just strings, both sending and receiving.  It's a lot more involved than this.

Heh -- I feel your pain; I'm guessing that you found some VB bot source code online, and rather than porting it to C#, you just ran the conversion wizard to VB .NET, didn't you? :P  Whenever I work in VB, invariably I have a couple compile-time errors from ending my lines in semicolons;

Anyway, like I said, if you're an experienced programmer, I'm willing to work with you on the bot.  Give me a holler on e-mail or MSN; if you want to catch me on AIM, I need to add you first.  PM me your name, or have it in your profile.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.