This commit is contained in:
2026-01-29 21:28:44 -07:00
parent baca4c55e0
commit 9f9a65a6be
5 changed files with 21 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$id = $row["id"];
$stmt = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? AND legacy_high_score > 0 ORDER BY legacy_high_score DESC LIMIT 1");
$stmt = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? AND legacy_high_score > 0 LIMIT 1");
$stmt->bind_param("i", $id);
$stmt->execute();
$result2 = $stmt->get_result();
@@ -34,6 +34,11 @@ if ($result->num_rows > 0) {
}
}
usort($topPlayers, function ($a, $b) {
$aScore = (int)explode(":", $a)[1];
$bScore = (int)explode(":", $b)[1];
return $bScore <=> $aScore;
});
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
echo implode("::", $topPlayers);
} else if (getClientVersion() == "0") {

View File

@@ -47,7 +47,7 @@ $icon = $savedata['bird']['icon'] ?? 1;
$overlay = $savedata['bird']['overlay'] ?? 0;
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
$birdColor = $savedata['settings']['colors']['icon'] ?? [255,255,255];
$msg = "1:" . $user2['legacy_high_score'] . ":" . $icon . ":" . $overlay . ":0:0:0:0:0:0:" . ":" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2];
$msg = "1:" . $user2['legacy_high_score'] . ":" . $icon . ":" . $overlay . ":0:0:0:0:0:0::" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2];
if (getClientVersion() == "1.5.2") {
$overlayColor = $savedata['settings']['colors']['overlay'] ?? [255,255,255];
$msg .= ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2];

View File

@@ -6,7 +6,7 @@ $stmt = $conn1 ->prepare("
SELECT id, content, userId
FROM chats
WHERE deleted_at = 0
ORDER BY id DESC LIMIT 50
ORDER BY id DESC LIMIT 49
");
$stmt->execute();
$result = $stmt->get_result();
@@ -17,7 +17,7 @@ while ($row = $result->fetch_assoc()) {
$stmt = $conn1->prepare("SELECT save_data FROM userdata WHERE id = ? LIMIT 1");
$stmt->bind_param("i", $userId);
$stmt->execute();
$result2 = $stmt2->get_result();
$result2 = $stmt->get_result();
$stmt->close();
if ($result2->num_rows != 1) continue;
$row2 = $result2->fetch_assoc();
@@ -52,7 +52,7 @@ while ($row = $result->fetch_assoc()) {
]);
}
echo encrypt("1" . ":" . implode("|", array_reverse($rows)));
echo encrypt("1:" . implode("|", array_reverse($rows)));
$conn0->close();
$conn1->close();

View File

@@ -48,9 +48,9 @@ $birdColor = $savedata['settings']['colors']['icon'] ?? [255,255,255];
$overlayColor = $savedata['settings']['colors']['overlay'] ?? [255,255,255];
if ($loginType === "0") {
echo encrypt("1" . ":" . $token . ":" . $row['username'] . ":" . $id . ":" . $row2['legacy_high_score'] . ":" . ($savedata['bird']['icon'] ?? 1) . ":" . ($savedata['bird']['overlay'] ?? 0) . ":0:0:0:0:0:" . ":" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2] . ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2]);
echo encrypt("1:" . $token . ":" . $row['username'] . ":" . $id . ":" . $row2['legacy_high_score'] . ":" . ($savedata['bird']['icon'] ?? 1) . ":" . ($savedata['bird']['overlay'] ?? 0) . ":0:0:0:0:0::" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2] . ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2]);
} elseif ($loginType === "1") {
echo encrypt("1" . ":" . $token . ":" . $row['username'] . ":" . $id);
echo encrypt("1:" . $token . ":" . $row['username'] . ":" . $id);
}
$conn0->close();
$conn1->close();

View File

@@ -5,17 +5,18 @@ $username = $post['userName'] ?? '';
$highScore = (int)$post['highScore'] ?? 0;
$icon = (int)$post['icon'] ?? 1;
$overlay = (int)$post['overlay'] ?? 0;
$birdR = (int)$post['birdR'] ?? 255;
$birdG = (int)$post['birdG'] ?? 255;
$birdB = (int)$post['birdB'] ?? 255;
if (getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
$birdR = (int)$post['birdR'] ?? 255;
$birdG = (int)$post['birdG'] ?? 255;
$birdB = (int)$post['birdB'] ?? 255;
$birdColor = [$birdR, $birdG, $birdB];
}
if (getClientVersion() == "1.5.2") {
$overlayR = (int)$post['overlayR'] ?? 255;
$overlayG = (int)$post['overlayG'] ?? 255;
$overlayB = (int)$post['overlayB'] ?? 255;
$overlayColor = [$overlayR, $overlayG, $overlayB];
}
$birdColor = [$birdR, $birdG, $birdB];
$overlayColor = [$overlayR, $overlayG, $overlayB];
$conn0 = newConnection(0);
$conn1 = newConnection(1);
@@ -52,11 +53,11 @@ $row2 = $result2->fetch_assoc();
$savedata = json_decode($row2['save_data'], true);
$savedata['bird']['icon'] = $icon;
$savedata['bird']['overlay'] = $overlay;
$savedata['settings']['colors']['icon'] = $birdColor;
if (getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") $savedata['settings']['colors']['icon'] = $birdColor;
if (getClientVersion() == "1.5.2") $savedata['settings']['colors']['overlay'] = $overlayColor;
$savedata = json_encode($savedata);
$stmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ?, save_data = ? WHERE id = ?");
$stmt->bind_param("isis",
$stmt->bind_param("isi",
$highScore,
$savedata,
$id