Keep in mind that its non-commercial project with purpose of learning new things, also was created to automatize some stuff that had to be done manually. Its pretty much my first contact with most of technologies used there (even writing this documentation). Feel free to msg me if you have any questions/tips.
Those you have to install:
Those you can install manually or you will get them by npm install command later:
First clone repo
git clone https://github.com/farelion/when_to_play.gitGet inside cloned folder
cd when_to_playThen install all dependencies
npm installPut in your RIOT API key (it expires after 24h)
let api = TeemoJS('RGAPI-KEY-HERE');Add this code in node_modules\teemojs\defaultConfig.json
"getMatchlist1": "/lol/match/v4/matchlists/by-account/%s?endIndex=1&beginIndex=0&",So it looks like this
...
"getMatchlist": "/lol/match/v4/matchlists/by-account/%s",
"getMatchlist1": "/lol/match/v4/matchlists/by-account/%s?endIndex=1&beginIndex=0&",
"getMatchTimeline": "/lol/match/v4/timelines/by-match/%s"
...We are ready to start app
npm startIf everything worked you should see live app here localhost:3000
npm run sass - compile sass to css
npm run sass-watch - compile sass to css and watch for changes
If you want to change accounts to yours, heres step by step guide
- Riot API
- Click on second GET - Get a summoner by summoner name
- Scroll down to PATH PARAMETERS and as value use your summoner name
- Choose region below
- Click EXECUTE REQUEST
- Under RESPONSE BODY you will see
...
"accountId": "YOUR_ACCOUNTID",
"id": "YOUR_ID",
...- Now you need change three values in app.js:
- Region
- AccountId
- Id
...
api.get('YOUR_REGION_HERE', 'match.getMatchlist1','YOUR_ACCOUNTID_HERE')
.then(data=>{
example1LastPlayed = data.matches[0].timestamp;
example1Decay = example1LastPlayed + 2419200000;
example1LastPlayed = new Date(example1LastPlayed).toLocaleString();
example1Decay = new Date(example1Decay).toLocaleString();
example1Platform = data.matches[0].platformId;
})
api.get('YOUR_REGION_HERE', 'summoner.getByAccountId', 'YOUR_ACCOUNTID_HERE')
.then(data =>{
example1IconId = data.profileIconId;
example1Name = data.name;
})
api.get('YOUR_REGION_HERE', 'league.getLeagueEntriesForSummoner', 'YOUR_ID_HERE')
.then(data =>{
example1Rank = data[0].tier;
example1Div = data[0].rank;
example1Lp = data[0].leaguePoints;
example1Wins = data[0].wins;
example1Losses = data[0].losses;
example1Wr = Math.floor(percentage(data[0].wins,data[0].wins+data[0].losses));
})
...- Sometimes parts of data do not load. Try to refresh until you load all data. Might be tied to riot api refresh limit rate.
