diff options
Diffstat (limited to 'includes/util/functions.inc')
-rw-r--r-- | includes/util/functions.inc | 17 |
1 files changed, 14 insertions, 3 deletions
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; } |