-
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.
Merge pull request #1 from Soraclee/dev
1.0
- Loading branch information
Showing
9 changed files
with
138 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Soracle | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 | ||
#{console.log(dataPlayer)} | ||
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="" alt="Radiant") | ||
img(class="rank-user") | ||
div(class="right-overlay") | ||
div(class="rank-name") | ||
span Radiant | ||
span | ||
hr | ||
div(class="stats") | ||
p 1.2 KDA | ||
p 175 Wins | ||
p 1910 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