-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Soracle
committed
May 13, 2023
1 parent
963e389
commit 07fabd5
Showing
8 changed files
with
117 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
async function searchPlayerbySubject(subject) { | ||
let mmr = await fetch( | ||
`https://api.henrikdev.xyz/valorant/v2/by-puuid/mmr/eu/${subject}` | ||
); | ||
|
||
let mmrJson = mmr.status == 200 ? await mmr.json() : "N.A"; | ||
|
||
return mmrJson; | ||
} | ||
|
||
async function infosPlayer(pseudo) { | ||
let pseudoValid = pseudo.toString().replace("#", "/"); | ||
|
||
let infosPlayer = await fetch( | ||
`https://api.henrikdev.xyz/valorant/v1/account/${pseudoValid}` | ||
); | ||
|
||
let infosPlayerJson = | ||
infosPlayer.status == 200 ? await infosPlayer.json() : "N.A"; | ||
|
||
return infosPlayerJson; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
{ | ||
"region": "eu" | ||
"region": "eu", | ||
"subjectDefault": "dc5abcce-65e3-5841-8cd1-c7a11d3fb205", | ||
"overlayOut": { | ||
"_comment": "Display only the rank from how many ms", | ||
"available": true, | ||
"time": 180000 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,64 @@ | ||
extends layout | ||
|
||
block content | ||
- let last_season = dataPlayer.by_season[Object.keys(dataPlayer.by_season)[Object.keys(dataPlayer.by_season).length - 1]] | ||
script(src='/js/checkPlayerData.js' defer) | ||
script. | ||
let subject = !{JSON.stringify(subjectPlayer)}; | ||
let dataPlayer; | ||
let infosPlayerData; | ||
|
||
async function updateSubjectPlayer() { | ||
try { | ||
const resultSubject = await fetch('/getSubjectPlayer'); | ||
const newSubject = await resultSubject.json(); | ||
subject = newSubject | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
|
||
setInterval(updateSubjectPlayer, 10000) | ||
|
||
async function updateDisplay() { | ||
try { | ||
let resultDataPlayer = await searchPlayerbySubject(subject.subjectPlayer || subject) | ||
dataPlayer = resultDataPlayer.data | ||
|
||
let nametagPlayer = dataPlayer.name + "#" + dataPlayer.tag | ||
|
||
let resultInfosPlayer = await infosPlayer(nametagPlayer) | ||
infosPlayerData = resultInfosPlayer.data | ||
|
||
// Update Display | ||
|
||
let last_season = dataPlayer.by_season[Object.keys(dataPlayer.by_season)[Object.keys(dataPlayer.by_season).length - 1]] | ||
|
||
document.querySelector('.overlay-background').style.backgroundImage = `url(${infosPlayerData.card.wide})` | ||
document.querySelector('.rank-user').src = dataPlayer.current_data.images.small | ||
document.querySelector('.rank-user').alt = dataPlayer.current_data.currenttierpatched | ||
document.querySelector('.rank-name span').textContent = dataPlayer.current_data.currenttierpatched | ||
document.querySelector('.stats p:nth-of-type(1)').textContent = `${infosPlayerData.account_level} Lvl` | ||
document.querySelector('.stats p:nth-of-type(2)').textContent = `${dataPlayer.current_data.elo} Elo` | ||
document.querySelector('.stats p:nth-of-type(3)').textContent = `${last_season.wins} Wins` | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
updateDisplay(); | ||
setInterval(function() { | ||
updateDisplay(); | ||
}, 10000) | ||
div(id="overlay" class="global-overlay slide-out") | ||
div(class="overlay-background") | ||
div(class="overlay") | ||
div(class="head-overlay") | ||
div(class="left-overlay") | ||
img(class="rank-user" src=`${dataPlayer.current_data.images.small}` alt="Radiant") | ||
img(class="rank-user") | ||
div(class="right-overlay") | ||
div(class="rank-name") | ||
span #{dataPlayer.current_data.currenttierpatched} | ||
span | ||
hr | ||
div(class="stats") | ||
p 1.2 KDA | ||
p #{last_season.wins} Wins | ||
p #{dataPlayer.current_data.elo} Elo | ||
|
||
p | ||
p | ||
p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters