From e95b208af90cc386a7d8d1bcab426727cf4f0121 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 21 Sep 2022 22:42:33 +0200 Subject: Update time --- includes/score.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'includes/score.php') diff --git a/includes/score.php b/includes/score.php index e0d0d62..cd8c389 100644 --- a/includes/score.php +++ b/includes/score.php @@ -13,7 +13,11 @@ function calculateScore($metadata, $name) { $relations = (count($metadata["marefriends"]) * ($metadata["little"] ? 1 : 2)) + count($metadata["sisters"]); $scoreRelations = $relations * 50; - $score = $scoreHost + $scoreFictive + $scoreLittle + $scoreNotTalking + $scoreProtector + $scoreSharedMemory + $scoreRelations + $scoreSpecies + $scoreName + $scoreMedian; + $scoreAdd = 0; + if ($name === "Cloudy Dreams") $scoreAdd += 250; + if ($name === "Scoots/Mia") $scoreAdd -= 495; + + $score = $scoreHost + $scoreFictive + $scoreLittle + $scoreNotTalking + $scoreProtector + $scoreSharedMemory + $scoreRelations + $scoreSpecies + $scoreName + $scoreMedian + $scoreAdd; return [ "host" => $scoreHost, @@ -26,6 +30,7 @@ function calculateScore($metadata, $name) { "shared_memory" => $scoreSharedMemory, "relations" => $scoreRelations, "species" => $scoreSpecies, + "additional" => $scoreAdd, "total" => $score ]; } @@ -33,7 +38,7 @@ function calculateScore($metadata, $name) { function scoreOrder($members, $system) { $ordered = []; foreach ($members as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($member["system"] ?? $system) . "-$member[id]-metadata.json")) { $systemID = $member["system"] ?? $system; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$member[id]-metadata.json"), true)); @@ -52,7 +57,7 @@ function scoreOrder($members, $system) { function scoreOrderGlobal() { $ordered = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json")) { $member["_system"] = "gdapd"; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)), $member["display_name"] ?? $member["name"]); @@ -60,7 +65,7 @@ function scoreOrderGlobal() { } } foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && !str_ends_with($member["name"], "-travelling")) { + if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_ends_with($member["name"], "-travelling") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json")) { $member["_system"] = "ynmuc"; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)), $member["display_name"] ?? $member["name"]); -- cgit