From 108525534c28013cfe1897c30e4565f9893f3766 Mon Sep 17 00:00:00 2001 From: Minteck Date: Mon, 10 Oct 2022 20:51:39 +0200 Subject: Update --- includes/bitset.inc | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 includes/bitset.inc (limited to 'includes/bitset.inc') diff --git a/includes/bitset.inc b/includes/bitset.inc new file mode 100644 index 0000000..1d026e5 --- /dev/null +++ b/includes/bitset.inc @@ -0,0 +1,110 @@ + "earth", + "0010" => "unicorn", + "0011" => "pegasus", + "0100" => "alicorn", + "0101" => "batpony", + "0110" => "crystal", + default => null, + }; + + $species2 = match ($species2) { + "0001" => "earth", + "0010" => "unicorn", + "0011" => "pegasus", + "0100" => "alicorn", + "0101" => "batpony", + "0110" => "crystal", + default => null, + }; + + $species3 = match ($species3) { + "0001" => "earth", + "0010" => "unicorn", + "0011" => "pegasus", + "0100" => "alicorn", + "0101" => "batpony", + "0110" => "crystal", + default => null, + }; + + if ($little === 1) { + $ageRegressor = true; + $little = 0; + } + + return [ + 'shared_memory' => $sharedMemory, + 'median' => $median, + 'protector' => $protector, + 'fictive' => $fictive, + 'little' => $little, + 'not_talking' => $notTalking, + 'host' => $host, + 'robot' => $robot, + 'magic' => $magic, + 'sensitivity' => $sensitivity, + 'food' => $food, + 'plush' => $plush, + 'nonverbal' => $nonverbal, + 'less_frequent' => $lessFrequent, + 'age_spells' => $age, + 'age_regressor' => $ageRegressor, + 'sexually_active' => $sexuallyActive, + 'species' => array_filter([ + $species1, + $species2, + $species3 + ], function ($i) { + return isset($i); + }) + ]; +} + +function parseMetadata ($metadata) { + if (isset($metadata)) { + if ($metadata["bitset"]) { + $m = parseBitset($metadata["bitset"]); + $m["marefriends"] = $metadata["marefriends"] ?? []; + $m["bitset"] = $metadata["bitset"] ?? []; + $m["sisters"] = $metadata["sisters"] ?? []; + $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; + } + + return $m; + } else { + return $metadata; + } +} \ No newline at end of file -- cgit