diff options
Diffstat (limited to 'includes/bitset.inc')
-rw-r--r-- | includes/bitset.inc | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/includes/bitset.inc b/includes/bitset.inc index 96c6bfd..f45beb1 100644 --- a/includes/bitset.inc +++ b/includes/bitset.inc @@ -4,27 +4,23 @@ function parseBitset ($bitset) { $bin = str_repeat("0", 48 - strlen(decbin($bitset))) . decbin($bitset); $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"; $sexuallyActive = substr($bin, 13, 1) !== "0"; - $ageRegressor = substr($bin, 12, 1) !== "0"; $leader = substr($bin, 11, 1) !== "0"; $persecutor = substr($bin, 10, 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"; + $polyamorous1 = substr($bin, 18, 1) !== "0"; + $polyamorous2 = substr($bin, 19, 1) !== "0"; $species1 = substr($bin, 33, 4); $species2 = substr($bin, 37, 4); - $species3 = substr($bin, 41, 4); + $alignment1 = substr($bin, 41, 4); + $alignment2 = substr($bin, 20, 4); $species1 = match ($species1) { "0001" => "earth", @@ -48,46 +44,57 @@ function parseBitset ($bitset) { default => null, }; - $species3 = match ($species3) { - "0001" => "earth", - "0010" => "unicorn", - "0011" => "pegasus", - "0100" => "alicorn", - "0101" => "batpony", - "0110" => "crystal", - "0111" => "changeling", + $alignment1 = match ($alignment1) { + "0000" => "aroace", + "0001" => "hetero", + "0010" => "homo", + "0011" => "bi", + "0100" => "pan", default => null, }; - if ($little === 1) { - $ageRegressor = true; - $little = 0; - } + $alignment2 = match ($alignment2) { + "0000" => "aroace", + "0001" => "hetero", + "0010" => "homo", + "0011" => "bi", + "0100" => "pan", + default => null, + }; + + if ($little === 1) $little = 0; return [ 'shared_memory' => $sharedMemory, - 'median' => $median, + 'median' => false, 'protector' => $protector, 'fictive' => $fictive, 'little' => $little, - 'not_talking' => $notTalking, - 'host' => $host, + 'not_talking' => false, + 'host' => false, 'robot' => $robot, - 'magic' => $magic, - 'sensitivity' => $sensitivity, + 'magic' => 0, + 'sensitivity' => 0, 'food' => $food, 'plush' => $plush, 'nonverbal' => $nonverbal, 'less_frequent' => $lessFrequent, - 'age_spells' => $age, - 'age_regressor' => $ageRegressor, + 'age_spells' => false, + 'age_regressor' => false, 'leader' => $leader, 'persecutor' => $persecutor, 'sexually_active' => $sexuallyActive, + 'polyamorous' => [ + 'romantic' => $polyamorous1, + 'sexual' => $polyamorous2 + ], + 'alignment' => [ + 'romantic' => $alignment1, + 'sexual' => $alignment2 + ], 'species' => array_filter([ $species1, - $species2, - $species3 + $species2 ], function ($i) { return isset($i); }) |