Jump to content
  • 0

How to send packet to Vanganth C6 cacheD


Question

Posted (edited)

Hi All!

Hoping someone with more experience than me can help out 🙂

 

Using vanganth's C6 pack I am trying to change a characters location using the "SetCharacterLocationPacket" packet and sending it to the cacheD server with PHP script. I'm stuck trying to figure out how to properly build the packet/checksum. I did find some helpful posts with samples and I verified that the packet format matches my servers but I'm stuck with this checksum error and having a hard time figuring it out.

 

Error:
 

error. Packet checksum is different. protocol[2], len[31], check[-2]

 

Using the following code to send the packet:


 

# #2 SetCharacterLocationPacket("dddddS")

$cached_op = pack ( "cVVVVV", 2, $char_id, 1, $x, $y, $z );
$cached_op .= ansi2unicode($account);
$ret_string = l2_cached_push(pack("s", strlen($cached_op) + 2) . $cached_op);

function l2_cached_push ( $cached_packet ) {
  $cached_fptr = l2_cached_open();
  if ( !is_resource($cached_fptr) ) {
    return ( "Error connecting to cached: " . $cached_fptr . " [server down??]" );
  }
  fwrite($cached_fptr, $cached_packet);
  $response = fread ($cached_fptr, 2);
  $array_ret_length = unpack("v", $response);
  $ret_id = unpack("c", fread ( $cached_fptr, 1 ) );
  $ret_string = "";
  for ( $i = 0; $i < ( ( $array_ret_length [ 1 ] - 4 ) / 4 ); $i++ ) {
    $array_read = unpack ( "i", fread ( $cached_fptr, 4 ) );
    $ret_string .= $array_read [ 1 ];
  }
  return ( $ret_string );
}

function ansi2unicode($ansi_str) {
  return (iconv('CP1252', 'UCS-2LE', $ansi_str).chr(0).chr(0));
}

 

Thanks for taking a look! Hopefully someone has the answer and this post can help others too.

 

Edited by Zugzug
grammar

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...