summaryrefslogtreecommitdiff
path: root/includes/util
diff options
context:
space:
mode:
Diffstat (limited to 'includes/util')
-rw-r--r--includes/util/banner.inc1
-rw-r--r--includes/util/functions.inc17
-rw-r--r--includes/util/rainbow.inc11
3 files changed, 24 insertions, 5 deletions
diff --git a/includes/util/banner.inc b/includes/util/banner.inc
index 6c6b128..01362a0 100644
--- a/includes/util/banner.inc
+++ b/includes/util/banner.inc
@@ -144,6 +144,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
"batpony" => $metadata["robot"] ? "Robot bat pony" : (!$metadata["plush"] ? "Bat pony" : "Bat pony plush"),
"unicorn" => $metadata["robot"] ? "Robot unicorn" : (!$metadata["plush"] ? "Unicorn" : "Unicorn plush"),
"changeling" => "Changeling",
+ "human" => "Human",
"merpony" => "Merpony",
default => $species . "_" . $metadata["robot"]
};
diff --git a/includes/util/functions.inc b/includes/util/functions.inc
index 3bc8091..e64bc5a 100644
--- a/includes/util/functions.inc
+++ b/includes/util/functions.inc
@@ -79,10 +79,20 @@ if (!function_exists("getAsset")) {
}
if ($type === "bodies" || $type === "heads") {
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".png")) {
- return "/assets/" . $type . "/" . $id . ".png";
+ if (in_array("human", getSystemMember($systemID, $memberID)["_metadata"]["species"])) {
+ $type = "avatars";
+
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".webp")) {
+ return "/assets/" . $type . "/" . $id . ".webp";
+ } else {
+ return "/error/nofile/?s=$systemID&m=$memberID&t=$type";
+ }
} else {
- return "/error/nofile/?s=$systemID&m=$memberID&t=$type";
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".png")) {
+ return "/assets/" . $type . "/" . $id . ".png";
+ } else {
+ return "/error/nofile/?s=$systemID&m=$memberID&t=$type";
+ }
}
} else {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $type . "/" . $id . ".webp")) {
@@ -257,6 +267,7 @@ if (!function_exists("getSystemMember")) {
}
$member["system"] = $member["_system"] = $system;
+ $member["_metadata"] = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json") ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json"), true) : null;
return $member;
}
diff --git a/includes/util/rainbow.inc b/includes/util/rainbow.inc
index 66ac2fc..dc4d687 100644
--- a/includes/util/rainbow.inc
+++ b/includes/util/rainbow.inc
@@ -40,8 +40,9 @@ function rainbow($hideCloudburst = false): array {
return $data;
}
-function getMembersByColor($hideCloudburst = false): array {
+function getMembersByColor($hideCloudburst = false, $ignoreHumans = false): array {
$members = rainbow($hideCloudburst);
+
uasort($members, function ($a, $b) {
return $a['hsl'][0] - $b['hsl'][0];
});
@@ -52,5 +53,11 @@ function getMembersByColor($hideCloudburst = false): array {
$sorted[] = $data["_data"];
}
- return $sorted;
+ if ($ignoreHumans) {
+ return array_filter($sorted, function ($i) {
+ return !in_array("human", $i["_metadata"]["species"]);
+ });
+ } else {
+ return $sorted;
+ }
} \ No newline at end of file