sub movexor {
my $data = shift;
my $AL; my $BL;
my $CL; my $DL;
$DL=substr($data,6,1); #MOV DL,BYTE PTR DS:[ESI+6]
$CL=substr($data,7,1); #MOV CL,BYTE PTR DS:[ESI+7]
$BL=substr($data,5,1); #MOV BL,BYTE PTR DS:[ESI+5]
$AL=$BL; #MOV AL,BL
$AL=$AL^$DL; #XOR AL,DL
$AL=$AL^$CL; #XOR AL,CL
substr($data,2,1)=$AL; #MOV BYTE PTR DS:[ESI+2],AL
$AL=$AL^$BL; #XOR AL,BL
substr($data,5,1)=$AL; #MOV BYTE PTR DS:[ESI+5],AL
$AL=substr($data,2,1); #MOV AL,BYTE PTR DS:[ESI+2]
$AL=$AL^$DL; #XOR AL,DL
$DL=substr($data,2,1); #MOV DL,BYTE PTR DS:[ESI+2]
$DL=$DL^$CL; #XOR DL,CL
substr($data,6,1)=$AL; #MOV BYTE PTR DS:[ESI+6],AL
substr($data,7,1)=$DL; #MOV BYTE PTR DS:[ESI+7],DL
return $data;
}
sub sendMove {
my $self = shift;
my $x = int scalar shift;
my $y = int scalar shift;
my $msg = pack("C*", 0xA7, 0x00, 0x00, 0x00,0x00) . getCoordString($x, $y);
$msg=movexor($msg);
$self->sendToServer($msg);
debug "Sent move to: $x, $y\n", "sendPacket", 2;
}