From 3af5d704bac7160ffc811a896cb47a93963542a4 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 30 Jun 2014 02:04:44 +0200 Subject: [PATCH] Added non-existing files --- resources/server-icon.png | Bin 0 -> 1000 bytes .../network/protocol/BlockChangePacket.php | 45 ++++++++++++ .../network/protocol/EntityHeadLookPacket.php | 39 ++++++++++ .../protocol/PlayerBlockPlacementPacket.php | 52 ++++++++++++++ .../network/protocol/PlayerDiggingPacket.php | 45 ++++++++++++ src/shoghicp/BigBrother/utils/AES.php | 67 ++++++++++++++++++ 6 files changed, 248 insertions(+) create mode 100644 resources/server-icon.png create mode 100644 src/shoghicp/BigBrother/network/protocol/BlockChangePacket.php create mode 100644 src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php create mode 100644 src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php create mode 100644 src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php create mode 100644 src/shoghicp/BigBrother/utils/AES.php diff --git a/resources/server-icon.png b/resources/server-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1a5bef5b4f2fa8721ad135edbb5a3c767de6c0b4 GIT binary patch literal 1000 zcmV>P)000McNliru-U0~?FBzSO$m;+A19eG6 zK~#9!?OV%E6hRcNc4ipZO^gBK69IvsxS)Gb1`}ro_yZb|5ED&|iGG2sh+kl$1~qCl z8b3e@i7^;p;ObJHa6fv zKA#s~*i0tzfsYur9c~BPTb%^kLW&wIVu4-yTLjy#O<{j)8T^7(5wK6peF>ytN&y8R z>>5yx^NH>o$Z-ofH?xEsH%Ct+hhs$g;trVZ_bITQ#`EHM?Ai{}gwHtMuIs32BTqz) zQwk^mVb=imi@!S0qF-J`j@pfBu#>H6@dsuW#;|=0a@^WRKs&dJoc;I|5svxTzO;)PG5QiUBHf3a zkKs46k9E=~j8OlWOBl*Ec)m&j1t9Dizz^Em`hxX9oO2o}R$m^YTws?p0{yy|LBH=8 z$j?Vmquj-D+Hb%qSru_z0SbTu5I_UGi5KX1>pCcZ&xrZGa}xdZUFW7afS&#G0Eho9 z;)6p?Xs=;xZ>M_2{?cZ>7y5MtC;$pT01e>#_kIaAz)oJl z{Q!fpxI6v^d!#Kwrvu-2C*KAdAjk4f`&Akbon`+1hMKX0_Xv;Be3b$UK-e{a|6^0< z&0vc%_XV8ecsJPlF)Oz}cM0=*a~T`ZzJ9W)J=l!s{z3g$59?{ZN&y8R>>7}u!#ciC zpMQL(jHBkW!=jiAa9qJ<_9x!?@#$}hc2VBv&ksKm>v_IP0R + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class BlockChangePacket extends Packet{ + + public $x; + public $y; + public $z; + public $blockId; + public $blockMeta; + + public function pid(){ + return 0x23; + } + + public function encode(){ + $this->putInt($this->x); + $this->putByte($this->y); + $this->putInt($this->z); + $this->putVarInt($this->blockId); + $this->putByte($this->blockMeta); + } + + public function decode(){ + + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php b/src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php new file mode 100644 index 00000000..8cd24150 --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/EntityHeadLookPacket.php @@ -0,0 +1,39 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class EntityHeadLookPacket extends Packet{ + + public $eid; + public $yaw; + + public function pid(){ + return 0x19; + } + + public function encode(){ + $this->putInt($this->eid); + $this->putByte((int) ($this->yaw * (256 / 360))); + } + + public function decode(){ + + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php b/src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php new file mode 100644 index 00000000..47b4033c --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/PlayerBlockPlacementPacket.php @@ -0,0 +1,52 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class PlayerBlockPlacementPacket extends Packet{ + + public $x; + public $y; + public $z; + public $direction; + /** @var \pocketmine\item\Item */ + public $heldItem; + public $cursorX; + public $cursorY; + public $cursorZ; + + public function pid(){ + return 0x08; + } + + public function encode(){ + + } + + public function decode(){ + $this->x = $this->getInt(); + $this->y = $this->getByte(); + $this->z = $this->getInt(); + $this->direction = $this->getByte(); + $this->heldItem = $this->getSlot(); + $this->cursorX = $this->getByte(); + $this->cursorY = $this->getByte(); + $this->cursorZ = $this->getByte(); + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php b/src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php new file mode 100644 index 00000000..63fd28ad --- /dev/null +++ b/src/shoghicp/BigBrother/network/protocol/PlayerDiggingPacket.php @@ -0,0 +1,45 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\network\protocol; + +use shoghicp\BigBrother\network\Packet; + +class PlayerDiggingPacket extends Packet{ + + public $status; + public $x; + public $y; + public $z; + public $face; + + public function pid(){ + return 0x07; + } + + public function encode(){ + + } + + public function decode(){ + $this->status = $this->getByte(); + $this->x = $this->getInt(); + $this->y = $this->getByte(); + $this->z = $this->getInt(); + $this->face = $this->getByte(); + } +} \ No newline at end of file diff --git a/src/shoghicp/BigBrother/utils/AES.php b/src/shoghicp/BigBrother/utils/AES.php new file mode 100644 index 00000000..c09fba11 --- /dev/null +++ b/src/shoghicp/BigBrother/utils/AES.php @@ -0,0 +1,67 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +*/ + +namespace shoghicp\BigBrother\utils; + +class AES{ + private $key, $keyLenght, $IV, $IVLenght, $enc, $dec, $mode, $algorithm; + + function __construct($bits, $mode, $blockSize){ + $this->algorithm = "rijndael-".intval($bits); + $this->mode = strtolower($mode); + $mcrypt = mcrypt_module_open($this->algorithm, "", $this->mode, ""); + $this->IVLenght = mcrypt_enc_get_iv_size($mcrypt); + mcrypt_module_close($mcrypt); + $this->keyLenght = $bits >> 3; + $this->setKey(); + $this->setIV(); + $this->init(); + } + + public function init(){ + if(is_resource($this->enc)){ + mcrypt_generic_deinit($this->enc); + mcrypt_module_close($this->enc); + } + $this->enc = mcrypt_module_open($this->algorithm, "", $this->mode, ""); + mcrypt_generic_init($this->enc, $this->key, $this->IV); + + if(is_resource($this->dec)){ + mcrypt_generic_deinit($this->dec); + mcrypt_module_close($this->dec); + } + $this->dec = mcrypt_module_open($this->algorithm, "", $this->mode, ""); + mcrypt_generic_init($this->dec, $this->key, $this->IV); + } + + public function setKey($key = ""){ + $this->key = str_pad($key, $this->keyLenght, "\x00", STR_PAD_RIGHT); + } + + public function setIV($IV = ""){ + $this->IV = str_pad($IV, $this->IVLenght, "\x00", STR_PAD_RIGHT); + } + + public function encrypt($plaintext){ + return mcrypt_generic($this->enc, $plaintext); + } + + public function decrypt($ciphertext){ + return mdecrypt_generic($this->dec, $ciphertext); + } + +} \ No newline at end of file