more small changes

This commit is contained in:
GameHerobrine 2023-01-04 22:45:31 +03:00
parent ac552afedc
commit 3f40c4f9be
3 changed files with 9 additions and 4 deletions

View file

@ -1,6 +1,6 @@
<?php <?php
class PlayerInputPacket extends RakNetDataPacket{ class PlayerInputPacket extends RakNetDataPacket{
public $unk1, $unk2, $unk3, $unk4; public $unk1, $unk2, $sneaking, $unk4;
public function encode() public function encode()
{ {
@ -15,8 +15,8 @@ class PlayerInputPacket extends RakNetDataPacket{
{ {
$this->unk1 = $this->getFloat(); $this->unk1 = $this->getFloat();
$this->unk2 = $this->getFloat(); $this->unk2 = $this->getFloat();
$this->unk3 = $this->getByte(); $this->sneaking = bin2hex($this->buffer)[$this->getOffset()] === 4;
$this->unk4 = $this->getByte(); $this->unk4 = bin2hex($this->buffer)[$this->getOffset()+1] === 4;
} }
} }

View file

@ -21,6 +21,10 @@ abstract class RakNetDataPacket extends stdClass{
return $this->buffer; return $this->buffer;
} }
public function getOffset(){
return $this->offset;
}
public function setBuffer($buffer = ""){ public function setBuffer($buffer = ""){
$this->buffer = $buffer; $this->buffer = $buffer;
$this->offset = 0; $this->offset = 0;

View file

@ -638,6 +638,7 @@ class Utils{
} }
public static function readInt($str){ public static function readInt($str){
if(strlen($str) <= 0) return;
if(PHP_INT_SIZE === 8){ if(PHP_INT_SIZE === 8){
return @unpack("N", $str)[1] << 32 >> 32; return @unpack("N", $str)[1] << 32 >> 32;
}else{ }else{