Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
shawnbot-1.0

 
Post new topic   Reply to topic Printable version
 View previous topic  Hs_ufo Post :: Post Help tweak and Notify Module  View next topic  
Author Message
Gondola
Newbie


Joined: Jun 15 2006
Posts: 6
Offline

PostPosted: Thu Jun 15, 2006 7:06 pm    Post subject: shawnbot-1.0 Reply to topic Reply with quote

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:
Code: Show/Hide
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:
Code: Show/Hide
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:
Code: Show/Hide
#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
View users profile Send private message Add User to Ignore List
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Thu Jun 15, 2006 7:19 pm    Post subject: Reply to topic Reply with quote

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
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Gondola
Newbie


Joined: Jun 15 2006
Posts: 6
Offline

PostPosted: Thu Jun 15, 2006 7:55 pm    Post subject: Reply to topic Reply with quote

Rock on! Thanks much.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 551 page(s) served in previous 5 minutes.

phpBB Created this page in 0.394768 seconds : 28 queries executed (93.9%): GZIP compression disabled