Skip to content

Commit

Permalink
Only use matches from classic summoners rift
Browse files Browse the repository at this point in the history
  • Loading branch information
hcaseyal committed Nov 23, 2017
1 parent 0f42ca7 commit 1d3ae38
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ const port = 8081;
let baseURL = 'https://na1.api.riotgames.com/lol/';
let apiKey = 'RGAPI-9cbea39f-3dc0-426a-ac10-ba2c02eb2fdb';

const queues = {2: "5v5 Blind Pick",
4: "5v5 Ranked Solo",
6: "5v5 Ranked Premade",
14: "5v5 Draft Pick",
42: "5v5 Ranked Team",
61: "5v5 Team Builder",
400: "5v5 Draft Pick",
410: "5v5 Ranked Dynamic",
420: "5v5 Ranked Solo",
430: "5v5 Blind Pick",
440: "5v5 Ranked Flex"};

app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8000');

Expand Down Expand Up @@ -357,7 +369,8 @@ function parseAllMatchesData(summonerInfo, data) {
// not available from Riot for some reason.
if (!matchTimeline.frames ||
!matchDetails.participantIdentities ||
!isRecentSeason(matchDetails.seasonId)) {
!isRecentSeason(matchDetails.seasonId) ||
!isClassicSummonersRift(matchDetails.queueId)) {
continue;
}
let summonersToParticipants = getSummonersToParticipantsMapping(matchDetails);
Expand Down Expand Up @@ -394,6 +407,11 @@ function parseAllMatchesData(summonerInfo, data) {
return {kills, deaths, assists, matchDetailsPerGame};
}

function isClassicSummonersRift(queueId) {
let id = parseInt(queueId);
return id in queues;
}

// Seasons 4 and earlier use a different Summoner's Rift map
function isRecentSeason(seasonId) {
return parseInt(seasonId) > 4;
Expand Down

0 comments on commit 1d3ae38

Please sign in to comment.