From eb7405f92bd01ab59a056ff5df6d2f1d6b30f0ce Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Thu, 13 Apr 2023 22:07:44 +0200 Subject: Updated 13 files and added 2 files (automated) --- assets/logo/banner.js | 7 +++ assets/logo/custom.css | 2 +- assets/species/merpony.png | Bin 0 -> 68751 bytes includes/components/details.inc | 13 +---- includes/components/planner.inc | 6 ++- includes/fragments/member.inc | 103 +++++++++++++++++++++++++++++++++++++++- includes/fragments/metadata.inc | 25 +++++----- includes/jobs/UpdateAssets.php | 4 +- includes/util/banner.inc | 24 +++++++++- pages/api/badger.php | 1 + pages/api/design.php | 54 +++++++++++++++++++++ pages/byspecies.inc | 3 ++ pages/jobs.inc | 18 +++++-- pages/metadata.inc | 11 +++-- pages/money.inc | 2 +- 15 files changed, 233 insertions(+), 40 deletions(-) create mode 100644 assets/species/merpony.png create mode 100644 pages/api/design.php diff --git a/assets/logo/banner.js b/assets/logo/banner.js index 02a8298..7a13759 100644 --- a/assets/logo/banner.js +++ b/assets/logo/banner.js @@ -55,6 +55,7 @@ async function refreshBanner(_, french) { if (data['relations']['caretakers'] && data['relations']['caretakers'].length > 0) active++; if (data['relations']['sexfriends'] && data['relations']['sexfriends'].length > 0) active++; if (data['relations']['sisters'] && data['relations']['sisters'].length > 0) active++; + if (data['relations']['friends'] && data['relations']['friends'].length > 0) active++; document.getElementById("member-banner").innerHTML = ` @@ -159,6 +160,12 @@ async function refreshBanner(_, french) { ${data['relations']['caretakers'].length === 0 ? '-' : ''} ` : ''} + ${data['relations']['friends'] && data['relations']['friends'].length > 0 ? ` + ${french ? (data['relations']['friends'].length > 1 ? 'Amies ' : 'Amie ') : `Friend${data['relations']['friends'].length > 1 ? 's' : ''}`}: ${data['relations']['sisters'].length > 1 ? '
' : ''} + ${data['relations']['friends'].map(relation => ` + `).join(``)} + ${data['relations']['friends'].length === 0 ? '-' : ''} +
` : ``} ` : '
 
'} diff --git a/assets/logo/custom.css b/assets/logo/custom.css index 75c1d19..0d35c4b 100644 --- a/assets/logo/custom.css +++ b/assets/logo/custom.css @@ -678,7 +678,7 @@ peh-muted { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; display: grid; - grid-template-columns: repeat(5, 1fr); + grid-template-columns: repeat(4, 1fr); text-align: center; } diff --git a/assets/species/merpony.png b/assets/species/merpony.png new file mode 100644 index 0000000..504f6f2 Binary files /dev/null and b/assets/species/merpony.png differ diff --git a/includes/components/details.inc b/includes/components/details.inc index 6a9f241..7b02808 100644 --- a/includes/components/details.inc +++ b/includes/components/details.inc @@ -1,5 +1,5 @@ -
" style="grid-template-columns: repeat(4, 1fr); background-color: ; margin-left: -20px; margin-right: -20px;"> +
" style="grid-template-columns: repeat(3, 1fr); background-color: ; margin-left: -20px; margin-right: -20px;">

- -
-
- - - - - - -
- +
Primary interest:
diff --git a/includes/components/planner.inc b/includes/components/planner.inc index 9be9cb7..aed4e56 100644 --- a/includes/components/planner.inc +++ b/includes/components/planner.inc @@ -520,7 +520,9 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis document.getElementById("associated-results").innerHTML = ""; for (let pony of availablePonies) { - document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML; + if (document.getElementById("list-pony-" + pony)) { + document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML; + } } document.getElementById("list").style.display = "none"; @@ -970,7 +972,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis document.getElementById("search-results").innerHTML = ""; for (let result of results) { - document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML; + if (document.getElementById("list-pony-" + result.id)) document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML; } console.log(results); diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index f1169c8..6fbf3ad 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -2,6 +2,8 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs"); + if ($memberData["name"] === "fusion") { $title = ($memberCommonName === "fusion" ? $lang["member"]["merge"] : $memberCommonName); } else { @@ -48,12 +50,34 @@ if ($memberData["name"] === "fusion") { } } +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json", json_encode([ + "_main" => [ + "name" => "Main", + "note" => "Everyday appearance", + "image" => null + ] +])); + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberID . ".png")) { + $designs = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $memberID . ".json"), true); + $designs["_main"]["image"] = base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/ponies/" . $memberData["id"] . ".png")); +} + ?>
;position: fixed;background-image: url('');background-size: cover;background-position: center; top: 0;">
">
+ +
; padding-bottom: 0 !important;"> + +
+
+ $design): if (isset($design)): ?> +
+
+ " style="height: 208px;"> +
+
+ " id="design--name">
" id="design--note"> +
+
+ + +
+ +
+
+
+
@@ -98,7 +200,6 @@ if ($memberData["name"] === "fusion") {
-
value="batpony">Bat pony +
@@ -110,25 +112,14 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member Caretakers (full IDs, comma-separated)
">

- - -
- -

Technical details

-

- Primary interest (keep it short)
- "> + Friends (full IDs, comma-separated)
+ ">

-

- Member code
- "> -

-
-

Age information

+

Age and interests

Birth date (use January 1st for none, fixed age takes priority over birth year if applicable)
@@ -138,6 +129,12 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member Age (for ponies with fixed age, takes priority over birth year)
">

+ +

+ Primary interest (keep it short)
+ "> +

+
diff --git a/includes/jobs/UpdateAssets.php b/includes/jobs/UpdateAssets.php index 0c05686..2b5bba2 100644 --- a/includes/jobs/UpdateAssets.php +++ b/includes/jobs/UpdateAssets.php @@ -48,7 +48,7 @@ function downloadAssets($system, $path = null) { $id = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $general["uuid"]) . preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", $member["uuid"]); if ($options["type"] === "members") { - echo("Downloading member assets\n"); + echo("Downloading member assets (" . ($member["display_name"] ?? $member["name"]) . ", " . $member["id"] . ")\n"); if (isset($member["avatar_url"])) { echo(" /avatars/$id.webp\n"); file_put_contents("/tmp/img." . pathinfo($member['avatar_url'], PATHINFO_EXTENSION), file_get_contents($member['avatar_url'])); @@ -79,7 +79,7 @@ function downloadAssets($system, $path = null) { } if ($options["type"] === "ponytown") { - echo("Downloading Pony Town assets\n"); + echo("Downloading Pony Town assets (" . ($member["display_name"] ?? $member["name"]) . ", " . $member["id"] . ")\n"); if (file_exists("" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png")) { $url = "" . $_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member["name"] . ".png"; } else { diff --git a/includes/util/banner.inc b/includes/util/banner.inc index 947e5c6..0db683f 100644 --- a/includes/util/banner.inc +++ b/includes/util/banner.inc @@ -132,6 +132,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "batpony" => $metadata["robot"] ? "Robot Poney chauve souris" : (!$metadata["plush"] ? "Poney chauve souris" : "Poney chauve souris en peluche"), "unicorn" => $metadata["robot"] ? "Robot licorne" : (!$metadata["plush"] ? "Licorne" : "Licorne en peluche"), "changeling" => "Changelin", + "merpony" => "Poney sirène", default => $species . "_" . $metadata["robot"] }; } else { @@ -143,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", + "merpony" => "Merpony", default => $species . "_" . $metadata["robot"] }; } @@ -242,6 +244,25 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + $friends = []; + foreach ($metadata["friends"] ?? [] as $marefriend) { + $mfSystem = explode("/", $marefriend)[0]; + $mfMemberID = explode("/", $marefriend)[1]; + $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfMemberID) { + return $item["id"] === $mfMemberID; + }); + sort($mfMember); + $mfMember = $mfMember[0]; + + if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)) $friends[] = [ + "id" => $marefriend, + "link" => "/" . ($mfMember["name"]), + "icon" => getAsset($mfSystem, $mfMemberID, "heads"), + "name" => $mfMember["display_name"] ?? $mfMember["name"], + "full_name" => $mfMember["display_name"] ?? $mfMember["name"] + ]; + } + $caretakers = null; if ($metadata["little"] >= 2) { @@ -479,7 +500,8 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { 'marefriends' => $marefriends ?? [], 'sexfriends' => $sexfriends ?? null, 'sisters' => $sisters ?? [], - 'caretakers' => $caretakers ?? [] + 'caretakers' => $caretakers ?? [], + 'friends' => $friends ?? [] ] ]; } \ No newline at end of file diff --git a/pages/api/badger.php b/pages/api/badger.php index 76f017e..3e8d04a 100644 --- a/pages/api/badger.php +++ b/pages/api/badger.php @@ -39,6 +39,7 @@ die(json_encode(array_map(function ($i) { "batpony" => $i["_metadata"]["robot"] ? "Robot bat pony" : (!$i["_metadata"]["plush"] ? "Bat pony" : "Bat pony plush"), "unicorn" => $i["_metadata"]["robot"] ? "Robot unicorn" : (!$i["_metadata"]["plush"] ? "Unicorn" : "Unicorn plush"), "changeling" => "Changeling", + "merpony" => "Merpony", default => $i["_metadata"]["species"][0] . "_" . $i["_metadata"]["robot"] }, "age" => getAge($i["_metadata"]), diff --git a/pages/api/design.php b/pages/api/design.php new file mode 100644 index 0000000..512677d --- /dev/null +++ b/pages/api/design.php @@ -0,0 +1,54 @@ + "Untitled", + "note" => "ID: " . $id, + "image" => $text + ]; + + break; + + default: + die("Invalid type"); +} + +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/designs/" . $_GET["member"] . ".json", json_encode($designs)); \ No newline at end of file diff --git a/pages/byspecies.inc b/pages/byspecies.inc index ee2b372..d2a2930 100644 --- a/pages/byspecies.inc +++ b/pages/byspecies.inc @@ -30,6 +30,7 @@ function species(array $members, string $id, string $name) { global $systemID; g $batpony = []; $crystal = []; $changeling = []; + $merpony = []; foreach ($members as $member) { foreach ($member["_metadata"]["species"] as $species) { @@ -40,6 +41,7 @@ function species(array $members, string $id, string $name) { global $systemID; g if ($species === "batpony") $batpony[] = $member; if ($species === "crystal") $crystal[] = $member; if ($species === "changeling") $changeling[] = $member; + if ($species === "merpony") $merpony[] = $member; } } @@ -52,6 +54,7 @@ function species(array $members, string $id, string $name) { global $systemID; g +
\ No newline at end of file diff --git a/pages/jobs.inc b/pages/jobs.inc index 109b484..6723175 100644 --- a/pages/jobs.inc +++ b/pages/jobs.inc @@ -1,10 +1,18 @@