Improve bird & overlay color storage

This commit is contained in:
2025-07-12 17:20:40 -07:00
parent 38d2e0c628
commit e0985f703f
3 changed files with 6 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ checkClientDatabaseVersion();
$conn = newConnection(); $conn = newConnection();
$stmt = $conn->prepare(" $stmt = $conn->prepare("
SELECT c.id, c.content, u.username, u.icon, u.overlay, u.id, u.birdR, u.birdG, u.birdB, u.overlayR, u.overlayG, u.overlayB SELECT c.id, c.content, u.username, u.icon, u.overlay, u.id, u.birdColor, u.overlayColor
FROM chats c FROM chats c
JOIN users u ON c.userId = u.id JOIN users u ON c.userId = u.id
WHERE u.banned = 0 AND c.deleted = 0 WHERE u.banned = 0 AND c.deleted = 0
@@ -14,6 +14,6 @@ $stmt = $conn->prepare("
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
echo encrypt(json_encode(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['id'], 'content' => $row['content'], 'id' => $row['id'], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => [$row['birdR'], $row['birdG'], $row['birdB']], 'overlayColor' => [$row['overlayR'], $row['overlayG'], $row['overlayB']]], $result->fetch_all(MYSQLI_ASSOC)), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); echo encrypt(json_encode(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['id'], 'content' => $row['content'], 'id' => $row['id'], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => json_decode($row['birdColor']), 'overlayColor' => json_decode($row['overlayColor'])], $result->fetch_all(MYSQLI_ASSOC)), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$conn->close(); $conn->close();

View File

@@ -22,11 +22,11 @@ if ($request_type === "0") {
exitWithMessage(json_encode([])); exitWithMessage(json_encode([]));
} }
$stmt = $conn->prepare("SELECT username, `$request_value`, icon, overlay, id, birdR, birdG, birdB, overlayR, overlayG, overlayB FROM users WHERE `$request_value` != 0 AND banned = 0 AND leaderboardsBanned = 0 ORDER BY `$request_value` DESC LIMIT 500"); $stmt = $conn->prepare("SELECT username, `$request_value`, icon, overlay, id, birdColor, overlayColor FROM users WHERE `$request_value` != 0 AND banned = 0 AND leaderboardsBanned = 0 ORDER BY `$request_value` DESC LIMIT 500");
$stmt->execute(); $stmt->execute();
$result = $stmt->get_result(); $result = $stmt->get_result();
echo encrypt(json_encode(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['id'], 'value' => $row[$request_value], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => [$row['birdR'], $row['birdG'], $row['birdB']], 'overlayColor' => [$row['overlayR'], $row['overlayG'], $row['overlayB']]], $result->fetch_all(MYSQLI_ASSOC)), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); echo encrypt(json_encode(array_map(fn($row) => ['username' => $row['username'], 'userid' => $row['id'], 'value' => $row[$request_value], 'icon' => $row['icon'], 'overlay' => $row['overlay'], 'birdColor' => json_decode($row['birdColor']), 'overlayColor' => json_decode($row['overlayColor'])], $result->fetch_all(MYSQLI_ASSOC)), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$conn->close(); $conn->close();

View File

@@ -55,8 +55,8 @@ if ($loginType === "0") {
"totalUltraBerries" => (string)$user['totalUltraBerries'], "totalUltraBerries" => (string)$user['totalUltraBerries'],
"totalSpeedyBerries" => (string)$user['totalSpeedyBerries'], "totalSpeedyBerries" => (string)$user['totalSpeedyBerries'],
"totalAttempts" => (string)$user['totalAttempts'], "totalAttempts" => (string)$user['totalAttempts'],
"birdColor" => [(int)$user['birdR'], (int)$user['birdG'], (int)$user['birdB']], "birdColor" => json_encode((string)$user['birdColor']),
"overlayColor" => [(int)$user['overlayR'], (int)$user['overlayG'], (int)$user['overlayB']] "overlayColor" => json_encode((string)$user['overlayColor'])
]; ];
} elseif ($loginType === "1") { } elseif ($loginType === "1") {
$data += [ $data += [