|
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
Gondola Newbie
Joined: Jun 15 2006 Posts: 6 Offline
|
Posted: Thu Jun 15, 2006 7:06 pm Post subject: shawnbot-1.0 |
|
|
|
|
Hey guys. I found shawnbot-1.0 floating around, and I'm trying to use it with the latest version of ASSS, but it's not working.
I get the following error:
M <game> [pid=0] bad position packet len=21
M <game> [pid=0] bad position packet len=21
M <game> [pid=0] bad position packet len=21
|
Until I stop it or it gets booted from the game.
Here's the player position packet sending code from the bot:
sub send_position {
# Offset Length Description
# 0 1 Type Byte 0x03
# 1 1 Direction (0 ... 360)
# 2 4 Timestamp
# 6 2 X Velocity
# 8 2 Y Pixels (0 ... 16384)
# 10 1 Checksum
# 11 1 Togglables *1
# 12 2 X Pixels (0 ... 16384)
# 14 2 Y Velocity
# 16 2 Bounty
# 18 2 Energy
# 20 2 Weapon Info *2
#
# 22 2 Energy *4 (Optional)
# 24 2 S2C Latency *4 (Optional)
# 26 2 Timer *4 (Optional)
# 28 4 Item info *3 *4 (Optional)
my (@spacket, $rpacket, $ticks, $csum, $i);
$ticks = int(bc_handleproto::getTicks() / 10);
$spacket[0] = bc_enc::enc_byte(0x03);
$spacket[1] = bc_enc::enc_byte(0x00);
@spacket[2 .. 5] = bc_enc::ence_int($ticks);
@spacket[6 .. 7] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[8 .. 9] = bc_enc::ence_short(bc_enc::short($bc_global::posY));
$spacket[10] = bc_enc::enc_byte(0x00);
$spacket[11] = bc_enc::enc_byte(0x00);
@spacket[12 .. 13] = bc_enc::ence_short(bc_enc::short($bc_global::posX));
@spacket[14 .. 15] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[15 .. 16] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[17 .. 18] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[19 .. 20] = bc_enc::ence_short(bc_enc::short(0x00));
for ($i = 0; $i < scalar(@spacket); $i++) {
$csum = $csum ^ $spacket[$i];
}
$spacket[10] = bc_enc::enc_byte($csum);
$rpacket = bc_enc::encrypt(@spacket);
bc_handleproto::C2S_send($rpacket);
} |
Here's the relevant code from ASSS core.c:
#ifdef CFG_RELAX_LENGTH_CHECKS
if (len < 22)
#else
if (len != 22 && len != 32)
#endif
{
lm->LogP(L_MALICIOUS, "game", p, "bad position packet len=%i", len);
return;
} |
I'm not experienced with packet handling, so this stuff goes over my head. Is there an easy fix to this?
I tried to recompile ASSS so I could skip the length check, but I had a lot of errors. But that's another topic. I think it would be much easier to just "fix" Shawnbot, but I'm not sure how to do it. I changed the "19 .. 20" to "19 .. 21" and it said bad client version and refused to let it log in.
Thanks! |
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Jun 15, 2006 7:19 pm Post subject: |
|
|
|
|
Quote: | $spacket[0] = bc_enc::enc_byte(0x03);
$spacket[1] = bc_enc::enc_byte(0x00);
@spacket[2 .. 5] = bc_enc::ence_int($ticks);
@spacket[6 .. 7] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[8 .. 9] = bc_enc::ence_short(bc_enc::short($bc_global::posY));
$spacket[10] = bc_enc::enc_byte(0x00);
$spacket[11] = bc_enc::enc_byte(0x00);
@spacket[12 .. 13] = bc_enc::ence_short(bc_enc::short($bc_global::posX));
@spacket[14 .. 15] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[15 .. 16] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[17 .. 18] = bc_enc::ence_short(bc_enc::short(0x00));
@spacket[19 .. 20] = bc_enc::ence_short(bc_enc::short(0x00)); | That line should be 16 .. 17, and all the following indexes incremented by 1; 18 .. 19, 20 .. 21. |
|
Back to top |
|
|
Gondola Newbie
Joined: Jun 15 2006 Posts: 6 Offline
|
Posted: Thu Jun 15, 2006 7:55 pm Post subject: |
|
|
|
|
Rock on! Thanks much. |
|
Back to top |
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Software by php BB © php BB Group Server Load: 704 page(s) served in previous 5 minutes.
|