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.