Skip to content

Farelion/when_to_play

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

When_to_play

preview

Disclaimer

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.

Table of contents

  1. Required
  2. Installation
  3. Styles
  4. Changing accounts
  5. Known bugs

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.git

Get inside cloned folder

cd when_to_play

Then install all dependencies

npm install

Put 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 start

If 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

  1. Riot API
  2. Click on second GET - Get a summoner by summoner name
  3. Scroll down to PATH PARAMETERS and as value use your summoner name
  4. Choose region below
  5. Click EXECUTE REQUEST
  6. Under RESPONSE BODY you will see
...
"accountId": "YOUR_ACCOUNTID",
"id": "YOUR_ID",
...

  1. Now you need change three values in app.js:
  ... 
   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.

About

Riot API data used to check when you have to play before decay

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors