diff options
author | Minteck <contact@minteck.org> | 2022-08-26 22:29:23 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-26 22:29:23 +0200 |
commit | 09bd0164ebc020a54b944b7326dcba496fb5d82c (patch) | |
tree | 0c5e765e627ecc94e534ccb6e2bc83917d58dc4c /includes/bitset.php | |
parent | a2df9a69dcc14cb70118cda2ded499055e7ee358 (diff) | |
download | pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.gz pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.bz2 pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.zip |
idk when was the last commit so I'm making a new one - Violet Dawn
Diffstat (limited to 'includes/bitset.php')
-rw-r--r-- | includes/bitset.php | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/includes/bitset.php b/includes/bitset.php index 272325a..6483669 100644 --- a/includes/bitset.php +++ b/includes/bitset.php @@ -1,18 +1,24 @@ <?php function parseBitset ($bitset) { - $bin = str_repeat("0", 24 - strlen(decbin($bitset))) . decbin($bitset); + $bin = str_repeat("0", 48 - strlen(decbin($bitset))) . decbin($bitset); - $sharedMemory = bindec(substr($bin, 0, 2)); - $median = substr($bin, 2, 1) !== "0"; - $little = bindec(substr($bin, 3, 2)); - $protector = substr($bin, 5, 1) !== "0"; - $fictive = substr($bin, 6, 1) !== "0"; - $notTalking = substr($bin, 7, 1) !== "0"; - $host = substr($bin, 8, 1) !== "0"; - $robot = substr($bin, 21, 1) !== "0"; - $species1 = substr($bin, 9, 4); - $species2 = substr($bin, 13, 4); + $sharedMemory = bindec(substr($bin, 8 + 16, 2)); + $median = substr($bin, 10 + 16, 1) !== "0"; + $little = bindec(substr($bin, 11 + 16, 2)); + $food = bindec(substr($bin, 16, 2)); + $magic = bindec(substr($bin, 2 + 16, 3)); + $sensitivity = bindec(substr($bin, 5 + 16, 3)); + $protector = substr($bin, 13 + 16, 1) !== "0"; + $fictive = substr($bin, 14 + 16, 1) !== "0"; + $notTalking = substr($bin, 15 + 16, 1) !== "0"; + $host = substr($bin, 16 + 16, 1) !== "0"; + $robot = substr($bin, 29 + 16, 1) !== "0"; + $plush = substr($bin, 30 + 16, 1) !== "0"; + $age = substr($bin, 31 + 16, 1) !== "0"; + $species1 = substr($bin, 17 + 16, 4); + $species2 = substr($bin, 21 + 16, 4); + $species3 = substr($bin, 25 + 16, 4); $species1 = match ($species1) { "0001" => "earth", @@ -34,6 +40,16 @@ function parseBitset ($bitset) { default => null, }; + $species3 = match ($species3) { + "0001" => "earth", + "0010" => "unicorn", + "0011" => "pegasus", + "0100" => "alicorn", + "0101" => "batpony", + "0110" => "crystal", + default => null, + }; + return [ 'shared_memory' => $sharedMemory, 'median' => $median, @@ -43,9 +59,15 @@ function parseBitset ($bitset) { 'not_talking' => $notTalking, 'host' => $host, 'robot' => $robot, + 'magic' => $magic, + 'sensitivity' => $sensitivity, + 'food' => $food, + 'plush' => $plush, + 'age_spells' => $age, 'species' => array_filter([ $species1, - $species2 + $species2, + $species3 ], function ($i) { return isset($i); }) |