Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Laff on September 17, 2004, 05:17 PM

Title: opening port to receive/send packets
Post by: Laff on September 17, 2004, 05:17 PM
first a little history.  i'm a c++ programmer, and i know a lot of vb (although i hate it because it seems weak).  i had a class with a term project and i made one of those junky bots that can only go into public channels via a starcraft login/pw.  i've got another class coming up with a term project and i'd like to get a jumpstart and advance into a warcraftiii/tft bot that can go anywhere it wants.

my questions are about differences in connecting.  right now i've got a socket object that opens port 6112 via the socket object as defined in winsock2.h.  apparently (haven't looked at this code in a year) this object generates a windows message that i can catch and handle.  so when i try a connection and it succeeds i send out a 0x03, 0x04, username, carriage return, linefeed, password, carriage return, linefeed and then if it's successful i'm connected.  what do i have to do to connect as a warcraftiii or tft user?  hell, is this socket object even going to do the job i need to receive and parse these packets?

any help would be appreciated.  any source would be greatly appreciated.  once i get a connection down, i'm sure i can just read through the packet docs and parse them accordingly.  correct me if i'm wrong.  thanks.
Title: Re:opening port to receive/send packets
Post by: The-FooL on September 17, 2004, 08:05 PM
http://bnetdocs.valhallalegends.com/
http://www.valhallalegends.com/yoni/BNLSProtocolSpec.txt

Standard socket should accomplish it.
Title: Re:opening port to receive/send packets
Post by: MyndFyre on September 17, 2004, 11:14 PM
Quote from: The-FooL on September 17, 2004, 08:05 PM
http://bnetdocs.valhallalegends.com/
http://www.valhallalegends.com/yoni/BNLSProtocolSpec.txt

Standard socket should accomplish it.

Giving him links without the purpose of those links does not help.

Why don't you try explaining to him some things?

Laff, I did not understand some of the concepts you'll run into when I first started.  Hopefully this will help you out.

There are two different (well, three, but only two enable you to chat) methods of connecting to Battle.net.  The first is the binary protocol, which is enabled by sending 0x01 (as opposed to 0x03) upon first connecting to the Battle.net Chat Server (BNCS).  This protocol is significantly more complicated than the chat gateway protocol which you've been using.

Essentially, putting together binary protocol connections involves sending and processing packets, which are (as opposed to the conventional networking term) a sequence of bytes that represent various values defined within the protocol.

These packet sequences are described in Bnetdocs, which is the link to bnetdocs.valhallalegends.com above.

Meat, I would suggest NOT point people to bot sources.  They'll learn better if they do it themselves.

Hope this helps.  If you have any questions, and are willing to work (you seem like it), I'll help you out.

Good luck!
Title: Re:opening port to receive/send packets
Post by: tA-Kane on September 18, 2004, 01:13 AM
In addition to what they have said (Fool has provided the two best URLs when programming bots "to go into private channels", and MyndFyre has given you some excellent hints), I would like to add my own comments that should help prevent any confusion you might have with the CHAT connection which, from what I've read, is what you are using (sending 0x03).
Quote from: Laff on September 17, 2004, 05:17 PMi'd like to get a jumpstart and advance into a warcraftiii/tft bot that can go anywhere it wants. what do i have to do to connect as a warcraftiii or tft user?
It is currently not possible to use the CHAT protocol and login with a WarCraft III user, and the CHAT protocol cannot "go anywhere it wants", in terms of private channels.

To login with a WarCraft III account (let alone have the account "go anywhere it wants"), you will need to use the binary connection. BnetDocs accurately describes this connection, and BNLS makes this connection easy to use (and fast if you have a really slow computer). Note, however, that all of the information required to login under WarCraft III might not be available to you with BnetDocs. Instead, the BNLS specification has what BnetDocs would lack for you, which is simple documentation on packets 0x52 through 0x58.
Title: Re:opening port to receive/send packets
Post by: UserLoser. on September 18, 2004, 01:53 AM
Quote from: tA-Kane on September 18, 2004, 01:13 AM
Instead, the BNLS specification has what BnetDocs would lack for you, which is simple documentation on packets 0x52 through 0x58.

Note that Warcraft III has no use and will never have use for BNCS packets 0x57 && 0x58
Title: Re:opening port to receive/send packets
Post by: Laff on September 18, 2004, 11:41 AM
ha.  i guess my first post made me seem more of a noob than i am.  i totally understand the packet stuff and yes it is a lot more complex but still not overly difficult.  the hard part is trying to locate code or even help on c++ coding of hashing the cd key so i won't have to go through bnls.

me and the-fool were on aim for like 4 hours yesterday discussing things.
Title: Re:opening port to receive/send packets
Post by: MyndFyre on September 18, 2004, 04:17 PM
Quote from: Laff on September 18, 2004, 11:41 AM
ha.  i guess my first post made me seem more of a noob than i am.  i totally understand the packet stuff and yes it is a lot more complex but still not overly difficult.  the hard part is trying to locate code or even help on c++ coding of hashing the cd key so i won't have to go through bnls.

me and the-fool were on aim for like 4 hours yesterday discussing things.

1.) Don't locate code.
2.) Use BNLS.  It doesn't require local files to hash, and it doesn't require the user to update his/her hashes.

That second "nugget of wisdom" only goes so far; I'm going to be incorporating the use of both BNLS and hashes, defaulting to BNLS at some point.
Title: Re:opening port to receive/send packets
Post by: Laff on September 19, 2004, 02:54 PM
no offense, but why should i do what you say?  i told you i don't want to use bnls.  let me do my own thing.  what gives you the right to tell me how i should be making a program anyway?
Title: Re:opening port to receive/send packets
Post by: Kp on September 19, 2004, 03:31 PM
Quote from: Laff on September 19, 2004, 02:54 PM
no offense, but why should i do what you say?  i told you i don't want to use bnls.  let me do my own thing.  what gives you the right to tell me how i should be making a program anyway?

You wanted help.  You were given advice.  If you don't want to take it, that's fine - but generally you can only refuse good advice so many times before people stop advising you at all.
Title: Re:opening port to receive/send packets
Post by: Laff on September 19, 2004, 05:30 PM
i'm just saying to stop posting redundant posts on "don't do it that way, because that's not how i do it" garbage.  i can easily get the bnls thing to work, but i don't want another server to depend on.  if you don't have APPLICABLE advice, don't post it.
Title: Re:opening port to receive/send packets
Post by: tA-Kane on September 19, 2004, 09:16 PM
Quote from: Laff on September 19, 2004, 05:30 PMi can easily get the bnls thing to work, but i don't want another server to depend on.  if you don't have APPLICABLE advice, don't post it.
APPLICABLE advice: Unless you have knowledge with disassembling programs (if you did, though, then would you be here asking these questions or rather disassembling one of Blizzards games, or even another bot, to answer the questions yourself?), look for CheckRevision on The Disclaimer (Battle.net Bot Development website): http://botdev.valhallalegends.com.

I think somewhere on there might also be CDKeyDecode(). You will be looking for that, too.

Edit: However, now that I think about it, the CDKeyDecode() that would likely be available there would not include code to decode a WarCraft 3 CD key. So, do a search for SRP on these forums, it should have the necessary code you seek (except the checkrevision that is required for version checking, I beleive the one available on the Bot Dev site does work for WarCraft 3).
Title: Re:opening port to receive/send packets
Post by: Laff on September 19, 2004, 11:54 PM
i have no intention of disassembling anything if someone has already done the work and is willing to share information.  btw, where did i mention checkrevision (this is where applicable advice comes in)?  

i've already looked and found examples of cd key decoding in both c# and java, and i'm trying to get in contact with the authors to get some help in what i don't understand.

yet i still fail to see what your post has to do with anything...
Title: Re:opening port to receive/send packets
Post by: MyndFyre on September 20, 2004, 03:07 AM
Quote from: Laff on September 19, 2004, 02:54 PM
no offense, but why should i do what you say?  i told you i don't want to use bnls.  let me do my own thing.  what gives you the right to tell me how i should be making a program anyway?

The right?  I'm not telling you that you *have* to do it a certain way.  However, using BNLS is extremely convenient and simple.  If you look at my post, I also said, "this only goes so far."  Experience and respect gives me the right to suggest what I did.

I'm not saying "don't do it that way because that's not how I do it."

By the way -- LMAO loser.  "I can't figure this Battle.net thing out but I can easily get BNLS working."

Finally, after having given you an EXTREMELY nice and informative post at the top, for you to counter with me, accusing me of doing something that I had no right to do, is pretty much a slap in the face.  *Notes Laff down next to NetNX as people MyndFyre doesn't want to help in the future*

If you want to know *why* I suggest you don't go for code, look at the threads related to NetNX around.
Title: Re:opening port to receive/send packets
Post by: Dyndrilliac on September 20, 2004, 11:14 AM
http://www.gamehackers.net/forum/viewtopic.php?p=4570#4570

This post should point you in a right direction.
Title: Re:opening port to receive/send packets
Post by: UserLoser. on September 20, 2004, 01:42 PM
Quote from: tA-Kane on September 19, 2004, 09:16 PM
APPLICABLE advice: Unless you have knowledge with disassembling programs (if you did, though, then would you be here asking these questions or rather disassembling one of Blizzards games, or even another bot, to answer the questions yourself?), look for CheckRevision on The Disclaimer (Battle.net Bot Development website): http://botdev.valhallalegends.com.

I think somewhere on there might also be CDKeyDecode(). You will be looking for that, too.

Edit: However, now that I think about it, the CDKeyDecode() that would likely be available there would not include code to decode a WarCraft 3 CD key. So, do a search for SRP on these forums, it should have the necessary code you seek (except the checkrevision that is required for version checking, I beleive the one available on the Bot Dev site does work for WarCraft 3).

Since it seems he doesn't want to rely on others, perhaps he should disassemble battle.snp and see how it calls CheckRevision :)

Also, yes, MBB, the CheckRevision function by Yobguls does work for Warcraft III, there are no differences since all products use the same versioning dlls.
Title: Re:opening port to receive/send packets
Post by: Skywing on September 20, 2004, 03:02 PM
Quote from: UserLoser. on September 20, 2004, 01:42 PM
Quote from: tA-Kane on September 19, 2004, 09:16 PM
APPLICABLE advice: Unless you have knowledge with disassembling programs (if you did, though, then would you be here asking these questions or rather disassembling one of Blizzards games, or even another bot, to answer the questions yourself?), look for CheckRevision on The Disclaimer (Battle.net Bot Development website): http://botdev.valhallalegends.com.

I think somewhere on there might also be CDKeyDecode(). You will be looking for that, too.

Edit: However, now that I think about it, the CDKeyDecode() that would likely be available there would not include code to decode a WarCraft 3 CD key. So, do a search for SRP on these forums, it should have the necessary code you seek (except the checkrevision that is required for version checking, I beleive the one available on the Bot Dev site does work for WarCraft 3).

Since it seems he doesn't want to rely on others, perhaps he should disassemble battle.snp and see how it calls CheckRevision :)

Also, yes, MBB, the CheckRevision function by Yobguls does work for Warcraft III, there are no differences since all products use the same versioning dlls.
Unless you have a fast computer you can expect to take it up to 1 second of full cpu usage to run on war3's datafiles.
Title: Re:opening port to receive/send packets
Post by: tA-Kane on September 21, 2004, 03:17 PM
Quote from: Laff on September 19, 2004, 11:54 PMwhere did i mention checkrevision (this is where applicable advice comes in)?

i still fail to see what your post has to do with anything...
You did not mention CheckRevision, but I thought it would be good (read: applicable) to mention it because it is a necessary type of function to be able to get a WarCraft 3 account logged in. You cannot login with WarCraft 3 without passing a version check, and CheckRevision is crucial for that.

If you fail to see what my post has to do with anything, then perhaps either you should look closer or I should stop giving you good ("applicable") advice.

I would like to say more, but I have to leave for work now, so I'll have to wait until I get back... if I even remember what I was going to say.