diff options
author | Minteck <contact@minteck.org> | 2022-09-21 22:42:33 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-09-21 22:42:33 +0200 |
commit | e95b208af90cc386a7d8d1bcab426727cf4f0121 (patch) | |
tree | b293e0c644513fbeb6e9ad29be97fa6347a55e9f /includes/bitset.php | |
parent | b5f589c323f415bb42ea7069cb4d1a8a2233dd69 (diff) | |
download | pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.tar.gz pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.tar.bz2 pluralconnect-e95b208af90cc386a7d8d1bcab426727cf4f0121.zip |
Update time
Diffstat (limited to 'includes/bitset.php')
-rw-r--r-- | includes/bitset.php | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/includes/bitset.php b/includes/bitset.php index 2e5a645..1d026e5 100644 --- a/includes/bitset.php +++ b/includes/bitset.php @@ -3,24 +3,26 @@ function parseBitset ($bitset) { $bin = str_repeat("0", 48 - strlen(decbin($bitset))) . decbin($bitset); - $sharedMemory = bindec(substr($bin, 8 + 16, 2)); - $median = substr($bin, 10 + 16, 1) !== "0"; - $little = bindec(substr($bin, 11 + 16, 2)); + $sharedMemory = bindec(substr($bin, 24, 2)); + $median = substr($bin, 26, 1) !== "0"; + $little = bindec(substr($bin, 27, 2)); $food = bindec(substr($bin, 16, 2)); $nonverbal = substr($bin, 15, 1) !== "0"; $lessFrequent = substr($bin, 14, 1) !== "0"; - $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); + $sexuallyActive = substr($bin, 13, 1) !== "0"; + $ageRegressor = substr($bin, 12, 1) !== "0"; + $magic = bindec(substr($bin, 18, 3)); + $sensitivity = bindec(substr($bin, 21, 3)); + $protector = substr($bin, 29, 1) !== "0"; + $fictive = substr($bin, 30, 1) !== "0"; + $notTalking = substr($bin, 31, 1) !== "0"; + $host = substr($bin, 32, 1) !== "0"; + $robot = substr($bin, 45, 1) !== "0"; + $plush = substr($bin, 46, 1) !== "0"; + $age = substr($bin, 47, 1) !== "0"; + $species1 = substr($bin, 33, 4); + $species2 = substr($bin, 37, 4); + $species3 = substr($bin, 41, 4); $species1 = match ($species1) { "0001" => "earth", @@ -52,6 +54,11 @@ function parseBitset ($bitset) { default => null, }; + if ($little === 1) { + $ageRegressor = true; + $little = 0; + } + return [ 'shared_memory' => $sharedMemory, 'median' => $median, @@ -68,6 +75,8 @@ function parseBitset ($bitset) { 'nonverbal' => $nonverbal, 'less_frequent' => $lessFrequent, 'age_spells' => $age, + 'age_regressor' => $ageRegressor, + 'sexually_active' => $sexuallyActive, 'species' => array_filter([ $species1, $species2, @@ -88,6 +97,8 @@ function parseMetadata ($metadata) { $m["regression"] = $metadata["regression"] ?? null; $m["caretakers"] = $metadata["caretakers"] ?? []; $m["median"] = $metadata["median"] ?? null; + $m["birth"] = $metadata["birth"] ?? null; + $m["heat"] = $metadata["heat"] ?? null; } else { $m = $metadata; } |