diff --git a/resources/lang/en.json b/resources/lang/en.json
index 82bc493bb..0626d36b4 100644
--- a/resources/lang/en.json
+++ b/resources/lang/en.json
@@ -312,7 +312,12 @@
"trios": "Trios",
"quads": "Quads",
"ranked_matchmaking": "Ranked Matchmaking",
- "quick_match": "Lobby"
+ "quick_match": "Lobby",
+ "login_required": "Please log in with Discord to join matchmaking"
+ },
+ "duel": {
+ "surrender": "Surrender",
+ "surrender_confirmation": "Are you sure you want to surrender? Your opponent will win the game."
},
"username": {
"enter_username": "Enter your username",
diff --git a/src/client/RankedQueue.ts b/src/client/RankedQueue.ts
index b0e1b77e3..b4767ce16 100644
--- a/src/client/RankedQueue.ts
+++ b/src/client/RankedQueue.ts
@@ -57,19 +57,6 @@ export class RankedQueue extends LitElement {
return this;
}
- /**
- * Get the current player's ELO for the selected game mode
- * Returns null for unranked modes (duos, trios, quads, unranked ffa)
- */
- private get currentPlayerElo(): number | null {
- if (this.queueType === "unranked") {
- return null; // No ELO for unranked modes
- }
- return this.gameMode === "duel"
- ? this.playerEloByMode.duel
- : this.playerEloByMode.ffa;
- }
-
/**
* Check if the current mode is a ranked mode (has ELO tracking)
*/
@@ -94,7 +81,7 @@ export class RankedQueue extends LitElement {
const userMe = await getUserMe();
if (userMe !== false) {
// Use eloByMode if available, fall back to elo for backward compatibility
- const eloByMode = (userMe.player as any).eloByMode;
+ const eloByMode = userMe.player.eloByMode;
if (eloByMode) {
this.playerEloByMode = {
ffa: eloByMode.ffa ?? null,
@@ -167,21 +154,22 @@ export class RankedQueue extends LitElement {
// Get authentication information
const loginResult = await userAuth();
if (loginResult === false) {
- throw new Error("Please log in to join ranked matchmaking");
+ throw new Error(translateText("ranked_queue.login_required"));
+ }
+
+ // Check if user is actually logged in (not just a guest with persistent ID)
+ const userMe = await getUserMe();
+ if (userMe === false || (!userMe.user.discord && !userMe.user.email)) {
+ throw new Error(translateText("ranked_queue.login_required"));
}
const token = loginResult.jwt;
- // Determine WebSocket URL based on environment
- const matchmakingBase = process?.env?.MATCHMAKING_WS_URL;
- const wsUrl = matchmakingBase
- ? `${matchmakingBase}/matchmaking/join`
- : (() => {
- const apiBase = getApiBase();
- const protocol = apiBase.startsWith("https://") ? "wss:" : "ws:";
- const host = apiBase.replace(/^https?:\/\//, "");
- return `${protocol}//${host}/matchmaking/join`;
- })();
+ // Determine WebSocket URL based on apiBase
+ const apiBase = getApiBase();
+ const protocol = apiBase.startsWith("https://") ? "wss:" : "ws:";
+ const host = apiBase.replace(/^https?:\/\//, "");
+ const wsUrl = `${protocol}//${host}/matchmaking/join`;
console.log("Connecting to matchmaking WebSocket:", wsUrl);
this.ws = new WebSocket(wsUrl);
@@ -295,7 +283,7 @@ export class RankedQueue extends LitElement {
}
}
- private handleMatchFound(gameId: string, assignment: any) {
+ private handleMatchFound(gameId: string, _assignment: any) {
console.log(`Match found! Joining game ${gameId}`);
// Set URL hash to trigger automatic join
@@ -454,7 +442,15 @@ export class RankedQueue extends LitElement {
"c-button--disabled": this.inQueue || this.isConnecting,
})}
>
- ${translateText("ranked_queue.ffa")}
+
+ ${translateText("ranked_queue.ffa")}
+ ${this.isLoadingElo
+ ? "..."
+ : (this.playerEloByMode.ffa ?? 1500)}
+ ELO
+
`
@@ -523,24 +527,6 @@ export class RankedQueue extends LitElement {
`}
-
- ${this.isRankedMode
- ? html`
-
- ${this.isLoadingElo
- ? html`${translateText("ranked_queue.loading_elo")}`
- : this.currentPlayerElo !== null
- ? html`${translateText("ranked_queue.your_elo")}
- ${this.currentPlayerElo}`
- : ""}
-
- `
- : ""}
-