Skip to content

Commit face7e1

Browse files
committed
fixed small overlay detail and critical logic flax preventing matches from starting
1 parent 4bea2c8 commit face7e1

3 files changed

Lines changed: 39 additions & 32 deletions

File tree

api_overlay.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
$state = "idle";
2727
$matchData = null;
2828
$queueData = null;
29+
$inQueue = null;
2930

3031
// Are they in an active match
3132
$stmtMatch = $pdo->prepare("

overlay.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
</div>
100100
</div>
101101

102-
<div class="expand-arrow" style="margin-top: 8px;">▼</div>
103102

104103
<div class="score-expandable">
105104
<div class="score-inputs">

overlay_engine.js

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -229,44 +229,51 @@ function updateUI(data) {
229229

230230
// --- DISCORD RPC DYNAMIC UPDATES ---
231231
if (window.secteurV && window.secteurV.sendRPCData) {
232-
let rpcData = null;
233-
234-
if (data.state === "idle" && data.user) {
235-
rpcData = {
236-
details: window.rpcTexts ? window.rpcTexts.dashDetails : "On the dashboard",
237-
state: window.rpcTexts ? window.rpcTexts.dashState : "In the menus",
232+
233+
// ANTI-SPAM LOCK: Only send to Discord if your state actually changed!
234+
if (data.state !== currentState) {
235+
let rpcData = null;
236+
237+
if (data.state === "idle" && data.user) {
238+
rpcData = {
239+
details: window.rpcTexts ? window.rpcTexts.dashDetails : "On the dashboard",
240+
state: window.rpcTexts ? window.rpcTexts.dashState : "In the menus",
238241
hover: `${data.user.username} - ${data.user.elo} EDP`
239-
};
240-
}
241-
else if (data.state === "in_queue" && data.user) {
242-
document.getElementById('panel-queue').style.display = 'block';
243-
244-
// Look for data.queueMode and capitalize the first letter for a nicer display in Discord. If it's not available, just show an empty string.
245-
const currentMode = data.queueMode
246-
? data.queueMode.charAt(0).toUpperCase() + data.queueMode.slice(1)
247-
: "";
242+
};
243+
}
244+
else if (data.state === "in_queue" && data.user) {
245+
document.getElementById('panel-queue').style.display = 'block';
248246

249-
const statePrefix = window.rpcTexts ? window.rpcTexts.queueState : "Mode: ";
250-
251-
if (window.secteurV) {
252-
window.secteurV.sendRPCData({
247+
const currentMode = data.queueMode
248+
? data.queueMode.charAt(0).toUpperCase() + data.queueMode.slice(1)
249+
: "";
250+
251+
const statePrefix = window.rpcTexts ? window.rpcTexts.queueState : "Mode: ";
252+
253+
rpcData = {
253254
details: window.rpcTexts ? window.rpcTexts.queueDetails : "Searching for a Match",
254255
state: `${statePrefix}${currentMode}`,
255256
largeImageKey: "queue_icon"
256-
});
257+
};
258+
}
259+
else if (data.state === "in_match" && data.match && data.user) {
260+
261+
const matchPrefix = window.rpcTexts ? window.rpcTexts.matchState1 : "VS";
262+
263+
rpcData = {
264+
details: window.rpcTexts ? window.rpcTexts.matchDetails : "In a Match",
265+
state: `${matchPrefix} ${data.match.opponent_name}`,
266+
hover: `${data.user.username} - ${data.user.elo} EDP`
267+
};
257268
}
258-
}
259-
else if (data.state === "in_match" && data.match && data.user) {
260-
rpcData = {
261-
details: window.rpcTexts ? window.rpcTexts.matchDetails : "In a Match",
262-
state: window.rpcTexts ? window.rpcTexts.matchState1 : `VS ${data.match.opponent_name}`,
263-
hover: `${data.user.username} - ${data.user.elo} EDP`
264-
};
265-
}
266269

267-
// Send the payload to Electron
268-
if (rpcData) {
269-
window.secteurV.sendRPCData(rpcData);
270+
// Send the payload to Electron
271+
if (rpcData) {
272+
window.secteurV.sendRPCData(rpcData);
273+
}
274+
275+
// Lock it so it doesn't fire again until the state changes
276+
currentState = data.state;
270277
}
271278
}
272279
}

0 commit comments

Comments
 (0)