mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
Merge branch 'master' into pr
This commit is contained in:
commit
c3a8ecaeb0
359 changed files with 3109 additions and 3222 deletions
|
|
@ -14,7 +14,7 @@ abstract class RakNetDataPacket extends stdClass{
|
|||
|
||||
private $offset = 0;
|
||||
|
||||
public $PROTOCOL = ProtocolInfo::CURRENT_PROTOCOL;
|
||||
public $PROTOCOL = ProtocolInfo::CURRENT_PROTOCOL;
|
||||
|
||||
abstract public function encode();
|
||||
|
||||
|
|
@ -23,11 +23,11 @@ abstract class RakNetDataPacket extends stdClass{
|
|||
public function getBuffer(){
|
||||
return $this->buffer;
|
||||
}
|
||||
|
||||
|
||||
public function getOffset(){
|
||||
return $this->offset;
|
||||
}
|
||||
|
||||
|
||||
public function setBuffer($buffer = ""){
|
||||
$this->buffer = $buffer;
|
||||
$this->offset = 0;
|
||||
|
|
@ -140,12 +140,12 @@ abstract class RakNetDataPacket extends stdClass{
|
|||
protected function getShort($unsigned = false){
|
||||
return Utils::readShort($this->get(2), $unsigned);
|
||||
}
|
||||
|
||||
|
||||
public function getSignedByte(){
|
||||
$b = ord($this->get(1));
|
||||
return $b >= 0x80 ? ($b-256) : $b;
|
||||
return $b >= 0x80 ? ($b - 256) : $b;
|
||||
}
|
||||
|
||||
|
||||
protected function getByte(){
|
||||
return ord($this->get(1));
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ abstract class RakNetDataPacket extends stdClass{
|
|||
}
|
||||
|
||||
protected function putByte($v){
|
||||
$this->buffer .= chr((int)$v);
|
||||
$this->buffer .= chr((int) $v);
|
||||
}
|
||||
|
||||
protected function getString(){
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ abstract class RakNetInfo{
|
|||
const ACK = 0xc0;
|
||||
|
||||
public static function isValid($pid){
|
||||
return match ((int)$pid) {
|
||||
return match ((int) $pid) {
|
||||
RakNetInfo::UNCONNECTED_PING, RakNetInfo::UNCONNECTED_PING_OPEN_CONNECTIONS, RakNetInfo::OPEN_CONNECTION_REQUEST_1, RakNetInfo::OPEN_CONNECTION_REPLY_1, RakNetInfo::OPEN_CONNECTION_REQUEST_2, RakNetInfo::OPEN_CONNECTION_REPLY_2, RakNetInfo::INCOMPATIBLE_PROTOCOL_VERSION, RakNetInfo::UNCONNECTED_PONG, RakNetInfo::ADVERTISE_SYSTEM, RakNetInfo::DATA_PACKET_0, RakNetInfo::DATA_PACKET_1, RakNetInfo::DATA_PACKET_2, RakNetInfo::DATA_PACKET_3, RakNetInfo::DATA_PACKET_4, RakNetInfo::DATA_PACKET_5, RakNetInfo::DATA_PACKET_6, RakNetInfo::DATA_PACKET_7, RakNetInfo::DATA_PACKET_8, RakNetInfo::DATA_PACKET_9, RakNetInfo::DATA_PACKET_A, RakNetInfo::DATA_PACKET_B, RakNetInfo::DATA_PACKET_C, RakNetInfo::DATA_PACKET_D, RakNetInfo::DATA_PACKET_E, RakNetInfo::DATA_PACKET_F, RakNetInfo::NACK, RakNetInfo::ACK => true,
|
||||
default => false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class RakNetParser{
|
|||
|
||||
private function parse(){
|
||||
$this->packet = new RakNetPacket(ord($this->get(1)));
|
||||
$this->packet->buffer =& $this->buffer;
|
||||
$this->packet->buffer = &$this->buffer;
|
||||
$this->packet->length = strlen($this->buffer);
|
||||
switch($this->packet->pid()){
|
||||
case RakNetInfo::UNCONNECTED_PING:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue