set rating based on user score
This commit is contained in:
@@ -10,9 +10,10 @@
|
||||
];
|
||||
|
||||
function eloColor(elo: number): string {
|
||||
if (elo >= 1400) return 'text-yellow-400';
|
||||
if (elo >= 1200) return 'text-purple-400';
|
||||
if (elo >= 1000) return 'text-blue-400';
|
||||
if (elo >= 2500) return 'text-yellow-400';
|
||||
if (elo >= 2000) return 'text-purple-400';
|
||||
if (elo >= 1500) return 'text-blue-400';
|
||||
if (elo >= 1000) return 'text-green-400';
|
||||
return 'text-text-secondary';
|
||||
}
|
||||
|
||||
@@ -235,10 +236,11 @@
|
||||
<div class="mt-6 rounded-lg border border-border bg-surface-800 p-5">
|
||||
<h2 class="text-sm font-600">How ELO Works</h2>
|
||||
<p class="mt-2 text-xs text-text-secondary leading-relaxed">
|
||||
Every player starts at 1000 ELO. Win a match to gain points, lose to drop.
|
||||
The system uses K=32, so new players' ratings shift quickly. As you play more,
|
||||
your rating stabilizes around your true skill level. Queue matchmaking pairs players
|
||||
with similar ELO for fair matches.
|
||||
Your initial rating is seeded from your osu! global rank. Winning gains ELO and
|
||||
losing drops it, but the amount depends on your opponent's rating — beating a
|
||||
stronger player earns more points. New players' ratings shift faster to help
|
||||
find your true skill level quickly. Queue matchmaking pairs players with similar
|
||||
ELO for fair matches.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@ export const load: PageServerLoad = async ({ locals }) => {
|
||||
},
|
||||
rating: rating
|
||||
? { elo: rating.elo, wins: rating.wins, losses: rating.losses }
|
||||
: { elo: 1000, wins: 0, losses: 0 },
|
||||
: null,
|
||||
hasOsuLinked: !!osuAccount
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
const badge = $derived(roleBadge[data.profile.role] ?? roleBadge.player);
|
||||
|
||||
const winRate = $derived(
|
||||
data.rating.wins + data.rating.losses > 0
|
||||
data.rating && data.rating.wins + data.rating.losses > 0
|
||||
? ((data.rating.wins / (data.rating.wins + data.rating.losses)) * 100).toFixed(1)
|
||||
: '—'
|
||||
);
|
||||
@@ -79,15 +79,15 @@
|
||||
<h3 class="text-xs font-600 text-text-secondary uppercase tracking-wider">Ranked Stats</h3>
|
||||
<div class="mt-4 grid grid-cols-4 gap-4">
|
||||
<div>
|
||||
<p class="text-2xl font-800 tabular-nums text-accent">{data.rating.elo}</p>
|
||||
<p class="text-2xl font-800 tabular-nums text-accent">{data.rating?.elo ?? '—'}</p>
|
||||
<p class="mt-1 text-xs text-text-secondary">ELO Rating</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-2xl font-800 tabular-nums text-green-400">{data.rating.wins}</p>
|
||||
<p class="text-2xl font-800 tabular-nums text-green-400">{data.rating?.wins ?? 0}</p>
|
||||
<p class="mt-1 text-xs text-text-secondary">Wins</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-2xl font-800 tabular-nums text-red-400">{data.rating.losses}</p>
|
||||
<p class="text-2xl font-800 tabular-nums text-red-400">{data.rating?.losses ?? 0}</p>
|
||||
<p class="mt-1 text-xs text-text-secondary">Losses</p>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user