From b7ee30ea6910927eee58471db8687c041e3fbcc7 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 7 Apr 2021 21:11:49 +0100 Subject: [PATCH] not searching if no queues are selected, removed notification --- src/js/tribe/matchmaking.js | 11 +++++++++++ src/js/tribe/tribe.js | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/js/tribe/matchmaking.js b/src/js/tribe/matchmaking.js index ac8c63a3a..54522f366 100644 --- a/src/js/tribe/matchmaking.js +++ b/src/js/tribe/matchmaking.js @@ -69,11 +69,22 @@ function refreshQueueButtons() { buttons.removeClass("active"); + let atleastone = false; queues.forEach((queue, id) => { if (queue) { + atleastone = true; $(buttons[id]).addClass("active"); } }); + if (!atleastone) { + $(".pageTribe .prelobby .matchmaking .startMatchmakingButton").addClass( + "disabled" + ); + } else { + $(".pageTribe .prelobby .matchmaking .startMatchmakingButton").removeClass( + "disabled" + ); + } } export function getQ() { diff --git a/src/js/tribe/tribe.js b/src/js/tribe/tribe.js index f6e662819..2e613b5e0 100644 --- a/src/js/tribe/tribe.js +++ b/src/js/tribe/tribe.js @@ -1502,7 +1502,7 @@ socket.on("mp_room_test_init", (data) => { socket.on("mp_room_state_update", (data) => { state = data.newState; - Notifications.add(`state changed to ${data.newState}`, 0); + // Notifications.add(`state changed to ${data.newState}`, 0); if (data.newState === 8) { Matchmaking.hideLeaveQueueButton(); } @@ -1978,6 +1978,7 @@ $(".pageTribe .prelobby .matchmaking .startMatchmakingButton").click((e) => { if (state >= 6 && state <= 8) return; if ($(e.currentTarget).hasClass("disabled")) return; let queue = Matchmaking.getQ(); + if (queue.length == 0) return; Matchmaking.setBannerText("Searching for a room..."); Matchmaking.showBanner(); state = 6; @@ -1994,6 +1995,8 @@ $(".pageTribe .prelobby .matchmaking .startMatchmakingButton").click((e) => { $(".pageTest #result #queueAgainButton").click((e) => { if (state >= 6 && state <= 8) return; if ($(e.currentTarget).hasClass("disabled")) return; + let queue = Matchmaking.getQ(); + if (queue.length == 0) return; Matchmaking.setBannerText("Searching for a room..."); Matchmaking.showBanner(); showHideTribeDiff(false); @@ -2003,7 +2006,7 @@ $(".pageTest #result #queueAgainButton").click((e) => { Matchmaking.disableLobbyButtons(); Matchmaking.hideStartQueueButton(); setTimeout(() => { - socket.emit("mp_room_join", { queue: Matchmaking.getQ() }); + socket.emit("mp_room_join", { queue: queue }); Matchmaking.showLeaveQueueButton(); resetResult(); }, 1000);