Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Anubis on May 02, 2004, 08:33 PM

Title: WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 08:33 PM
I've been playing around with soe WAR3 connection code and I'm having trouble figuring out how to send text to Battle.net (such as "/away" or "hello"). I've tried "Winsock.SendData Text1.Text & vbCrLf" but its not working - it disconnects me every time. Can anyone help me with this problem, please?

Also, after playing around with the code, it now decides to connect with -1 ping... Is there a packet or something I changed that would cause this? If so, which one would I need to add back in/take out?

If there's any code or anything that I need to post here, please let me know.

Any help is much appreciated. Thanks
Title: Re:WAR3 Bot Questions
Post by: Eli_1 on May 02, 2004, 08:43 PM
Quote from: Anubis on May 02, 2004, 08:33 PM
I've been playing around with soe WAR3 connection code and I'm having trouble figuring out how to send text to Battle.net (such as "/away" or "hello"). I've tried "Winsock.SendData Text1.Text & vbCrLf" but its not working - it disconnects me every time. Can anyone help me with this problem, please?
That is how you send data with the CHAT protocol, WAR3 is much different.

Quote from: Anubis on May 02, 2004, 08:33 PM
Also, after playing around with the code, it now decides to connect with -1 ping... Is there a packet or something I changed that would cause this? If so, which one would I need to add back in/take out?
That is caused when you send packet 0x25 before receiving it, or not sending it at all -- I don't remember which one right now though.
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 08:52 PM
What's the way to send data with WAR3? And, Battle.net sends a packet (0x25) before the bot should send it's 0x25, right? or am I a little off here?...
Title: Re:WAR3 Bot Questions
Post by: effect on May 02, 2004, 09:25 PM
Your ping time is calculated by replying to 0x25 , with 0x25 (The amount of time it takes for you to reply to the server sending of 0x25).
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 09:30 PM
I set it to send 0x25 after it receives 0x25 from the server, but it still connects with -1... Do I need to add some sort of wait time to get an actual ping?
Title: Re:WAR3 Bot Questions
Post by: effect on May 02, 2004, 09:32 PM
I dont believe the UDP Plug has anything to do with 0x25 , i may be out of the loop here but i believe its 0x14.

PS. This could be totally wrong for Warcraft 3
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 09:37 PM
Hmm... I'll play with the code and see what I can find on the ping problem... But can anyone help me with the sending issue please? What would be the code to send the text in the textbox Text1 to bnet through a winsock control named Winsock? Or would I put this through the packet buffer?
Title: Re:WAR3 Bot Questions
Post by: effect on May 02, 2004, 10:08 PM
Winsock.sendData text1.text
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 10:11 PM
Quote from: effect on May 02, 2004, 10:08 PM
Winsock.sendData text1.text

Tried that...it disconnects me
Title: Re:WAR3 Bot Questions
Post by: effect on May 02, 2004, 10:16 PM
I dont believe its the sendData function causing you problems (well directly) something else is causing your disconnect (Possibly trying to send data before your logged on?)
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 10:20 PM
I'm sure it's completely logged on because I'm using other bots that are in the same channel and they see it...I'm also waiting about 5-10 seconds after it connects to send anything (text)...
Title: Re:WAR3 Bot Questions
Post by: effect on May 02, 2004, 10:21 PM
I think its time you show some code? from the point of origin of your problem.
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 10:27 PM
lol...That's the problem...I don't know the code for sending text... All I know is that when i try to send it using the following code, it disconnects me.


Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
   If Winsock.State = sckConnected Then Winsock.SendData Text1.Text
   Text1.Text = ""
   KeyAscii = 0
End If
End Sub
Title: Re:WAR3 Bot Questions
Post by: FuzZ on May 02, 2004, 10:33 PM
Quote from: Anubis on May 02, 2004, 08:33 PM
I've been playing around with soe WAR3 connection code and I'm having trouble figuring out how to send text to Battle.net (such as "/away" or "hello"). I've tried "Winsock.SendData Text1.Text & vbCrLf" but its not working - it disconnects me every time. Can anyone help me with this problem, please?

Also, after playing around with the code, it now decides to connect with -1 ping... Is there a packet or something I changed that would cause this? If so, which one would I need to add back in/take out?

If there's any code or anything that I need to post here, please let me know.

Any help is much appreciated. Thanks

Let me guess.. Flawed source?

I don't understand how someone could write a bot to work with war3, and not know how to send a chat event.
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 02, 2004, 10:36 PM
I just used a packet thingy on a Stealth Bot and the 1 I'm having truoble with and heres what it came up with (by sending the text "testing"):

From the Stealth Bot:
FF 0E 0C 00 74 65 73 74 69 6E 67 00     ....testing

From the other one:
74 65 73 74 69 6E 67                              testing

I can't help but notice the missing bytes: FF 0E 0C 00
What do I need to add to the bot to make it send those?

Yea, you're right...but I'm attempting to learn from it... (I learn better by reverse-engineering things...)
Title: Re:WAR3 Bot Questions
Post by: FuzZ on May 02, 2004, 10:45 PM
Quote from: Anubis on May 02, 2004, 10:36 PM
I just used a packet thingy on a Stealth Bot and the 1 I'm having truoble with and heres what it came up with (by sending the text "testing"):

From the Stealth Bot:
FF 0E 0C 00 74 65 73 74 69 6E 67 00     ....testing

From the other one:
74 65 73 74 69 6E 67                              testing

I can't help but notice the missing bytes: FF 0E 0C 00
What do I need to add to the bot to make it send those?

Yea, you're right...but I'm attempting to learn from it... (I learn better by reverse-engineering things...)

do this

Dim p as new packetbuffer
p.insertntstring "Testing 1 2 3 4"
p.sendpacket &HE


put that in a menu or something, then click the menu when you're connected.
Title: Re:WAR3 Bot Questions
Post by: Stealth on May 02, 2004, 10:45 PM
Quote from: Anubis on May 02, 2004, 10:36 PM
I just used a packet thingy on a Stealth Bot and the 1 I'm having truoble with and heres what it came up with (by sending the text "testing"):

From the Stealth Bot:
FF 0E 0C 00 74 65 73 74 69 6E 67 00     ....testing

From the other one:
74 65 73 74 69 6E 67                              testing

I can't help but notice the missing bytes: FF 0E 0C 00
What do I need to add to the bot to make it send those?

Yea, you're right...but I'm attempting to learn from it... (I learn better by reverse-engineering things...)

You're missing the packet header.

From BNetDocs (http://bnetdocs.valhallalegends.com):
Quote
(BYTE)      StartPacket - always 0xFF
(BYTE)      Packet ID
(WORD)    Packet length, including this header
(VOID)      Packet Data

The BNCS protocol is aggresively enforced by Battle.net - at least, for clients - and violations of the protocol generally result in an IPBan.

People tend to use packet buffers such as DarkMinion's (http://www.valhallalegends.com/documents/vbpacketbc.html) ubiquitous sample to create these headers on demand.
Title: Re:WAR3 Bot Questions
Post by: Zakath on May 03, 2004, 09:13 AM
Your send function doesn't automatically calculate and add the packet header to the packet. That's a pretty serious flaw, and is why you're being disconnected. If you send Battle.net something that doesn't have any packet header whatsoever, it'll just boot you from their servers.

All packets in a binary connection should be assembled using your packetbuffer, if that's the method you've employed for setting up the data to be sent to Bnet.
Title: Re:WAR3 Bot Questions
Post by: Adron on May 03, 2004, 12:45 PM
Quote from: Anubis on May 02, 2004, 10:36 PM
(I learn better by reverse-engineering things...)

Does that mean "trying to read source code I didn't write myself", or "analyzing applications for which there is no source code available"?
Title: Re:WAR3 Bot Questions
Post by: Anubis on May 03, 2004, 06:04 PM
Quote from: Adron on May 03, 2004, 12:45 PM
Quote from: Anubis on May 02, 2004, 10:36 PM
(I learn better by reverse-engineering things...)

Does that mean "trying to read source code I didn't write myself", or "analyzing applications for which there is no source code available"?

Haha, no... I just like to reverse-engineer the source code to learn what line does what...not dismantling applications...
Title: Re:WAR3 Bot Questions
Post by: MyndFyre on May 03, 2004, 06:31 PM
Quote from: Anubis on May 03, 2004, 06:04 PM
Quote from: Adron on May 03, 2004, 12:45 PM
Quote from: Anubis on May 02, 2004, 10:36 PM
(I learn better by reverse-engineering things...)

Does that mean "trying to read source code I didn't write myself", or "analyzing applications for which there is no source code available"?

Haha, no... I just like to reverse-engineer the source code to learn what line does what...not dismantling applications...

But see...  Reverse-engineering is a process by which we learn how something works by breaking down its component functions from the outside (a "black box"), not by analyzing source code.
Title: Re:WAR3 Bot Questions
Post by: Adron on May 03, 2004, 08:16 PM
Quote from: Anubis on May 03, 2004, 06:04 PM
Quote from: Adron on May 03, 2004, 12:45 PM
Does that mean "trying to read source code I didn't write myself", or "analyzing applications for which there is no source code available"?

Haha, no... I just like to reverse-engineer the source code to learn what line does what...not dismantling applications...

Ah, I thought that might be the case. "Reading someone else's source code" isn't the most common definition of reverse-engineering.
Title: Re:WAR3 Bot Questions
Post by: FuzZ on May 03, 2004, 11:40 PM
Quote from: Anubis on May 03, 2004, 06:04 PM
Quote from: Adron on May 03, 2004, 12:45 PM
Quote from: Anubis on May 02, 2004, 10:36 PM
(I learn better by reverse-engineering things...)

Does that mean "trying to read source code I didn't write myself", or "analyzing applications for which there is no source code available"?

Haha, no... I just like to reverse-engineer the source code to learn what line does what...not dismantling applications...

Thanks, now I know why I don't bother posting help for people anymore.

You're welcome.