Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haxgun committed Nov 5, 2023
1 parent 64f733a commit 000acc4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/js/overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,17 @@ async function checkData(region, puuid) {

async function winlose(region, puuid) {
const dataMatches = await getMatches(region, puuid);
const [won, tied] = await getWonInfo(puuid, dataMatches);
const [won, drew] = await getWonInfo(puuid, dataMatches);
const currentMatchId = dataMatches.data[0].metadata.matchid;

if (currentMatchId !== lastMatchId) {
if (won === true) {
win += 1;
lastMatchId = dataMatches.data[0].metadata.matchid;
} else if (won === false && tied === 'N') {
} else if (won === false && drew === 'N') {
lose += 1;
lastMatchId = dataMatches.data[0].metadata.matchid;
}
}
lastMatchId = currentMatchId;
await WinLoseVisual(win, lose);
}

Expand All @@ -215,18 +214,18 @@ async function getFirstMatchId(region, puuid) {

async function getWonInfo(puuid, dataMatches) {
const playerTeam_ = await playerTeam(puuid, dataMatches)
let tied;
let drew;

const red_won = dataMatches.data[0].teams.red.has_won;
const blue_won = dataMatches.data[0].teams.blue.has_won;
const playerTeamWon = dataMatches.data[0].teams[playerTeam_].has_won

if (red_won === false && blue_won === false) {
tied = 'Y';
drew = 'Y';
} else {
tied = 'N';
drew = 'N';
}
return [playerTeamWon, tied];
return [playerTeamWon, drew];
}

async function getMatches(region, puuid) {
Expand Down

0 comments on commit 000acc4

Please sign in to comment.