Valhalla Legends Forums Archive | Battle.net Bot Development | [VB] ParseBNCS Stub Class

AuthorMessageTime
JoeTheOdd
Poke Me Please
December 10, 2005, 9:00 PM
shout
*pokes Joe in the eye*

Why would you do something like this?
December 10, 2005, 10:19 PM
JoeTheOdd
[quote author=Topaz link=topic=13475.msg137116#msg137116 date=1134252572]
So... ugly...
[/quote]

Go die in agony. ..!..

[quote author=Shout link=topic=13475.msg137120#msg137120 date=1134253153]
*pokes Joe in the eye*

Why would you do something like this?
[/quote]Because my old one was ugly! =p
December 10, 2005, 10:19 PM
kamakazie
You should be using a Buffer class, not strings to pass contents of packets around. Talk about eww:

[code]
Select Case Asc(Mid(sPacket, 2, 1))
[/code]
December 10, 2005, 10:24 PM
shout
Which is uglier, Joe's weird stubby thing or this from my bot I will never finish:

[code]
#pragma warning(disable:4996) //strcat is depreciated... works fine for me!
LPCSTR CheckRevision::GetNextFile()
{
PSTR ret = (PSTR)malloc(4000);
memset(ret, 0, 4000);
strcpy(ret, this->path);
switch (this->client)
{
case SEXP:
case STAR:
switch (this->currentfile)
{
case 0:
strcat(ret, "starcraft.exe");
break;
case 1:
strcat(ret, "storm.dll");
break;
case 2:
strcat(ret, "battle.snp");
break;
}
return ret;



case D2DS:
case D2XP:
switch (this->currentfile)
{
case 0:
strcat(ret, "game.exe");
break;
case 1:
strcat(ret, "bnclient.dll");
break;
case 2:
strcat(ret, "d2client.dll");
break;
}
return ret;



case W2BN:
switch (this->currentfile)
{
case 0:
strcat(ret, "Warcraft II BNE.exe");
break;
case 1:
strcat(ret, "storm.dll");
break;
case 2:
strcat(ret, "battle.snp");
break;
}
return ret;



case W3XP:
case WAR3:
switch (currentfile)
{
case 0:
strcat(ret, "war3.exe");
break;
case 1:
strcat(ret, "storm.dll");
break;
case 2:
strcat(ret, "game.dll");
break;
}
return ret;
}
}
#pragma warning(default:4669)
[/code]
December 10, 2005, 10:27 PM
Networks
[quote author=dxoigmn link=topic=13475.msg137123#msg137123 date=1134253449]
You should be using a Buffer class, not strings to pass contents of packets around. Talk about eww:

[code]
Select Case Asc(Mid(sPacket, 2, 1))
[/code]
[/quote]

I agree, it's fine to create functions for each packet for handling them and sending them. I did this in 'Vanquish Chat' and it worked out very well as far as organization.
December 10, 2005, 11:06 PM
JoeTheOdd
Yeah, I should be using a packet UDT. The point of creating this was so that they don't have to go through the agonizing pain of writing it themselves. If they want to use a packet UDT, find and replace String with udtPacket.
December 11, 2005, 12:02 AM
shadypalm88
[quote author=Joe link=topic=13475.msg137143#msg137143 date=1134259345]
Yeah, I should be using a packet UDT. The point of creating this was so that they don't have to go through the agonizing pain of writing it themselves. If they want to use a packet UDT, find and replace String with udtPacket.
[/quote]This is why you use a real text editor and learn to use regular expressions.  Suddenly, armed with the packet ID macros or constants from BnetDocs, creating your stubs is painless.

Also using a buffer, after processing the header, you can just pass the buffer object directly to your specific packet handlers.
December 11, 2005, 4:05 PM
UserLoser.
Just to remove some ungliness, you should use names like "OnPing" instead of "Handle_SID_PING"
December 11, 2005, 5:42 PM
rabbit
Just to make it better, you should add in specific chat event throwers (Events in VB).
December 11, 2005, 6:35 PM
QwertyMonster
I like it Joe. Nice job. :)
December 12, 2005, 3:57 PM

Search