황성연

대전 기록 받아오기

......@@ -239,11 +239,11 @@ module.exports = function(app){
var spec_bannedChamp_image = new Array();
var spec_selectedChamp_image = new Array();
var spec_summonername = new Array();
var spec_summonerName = new Array();
var spec_spellId = new Array();
var spec_spellimage = new Array();
for(var i=0; i<10; i++){
spec_summonername.push(spec_participants[i].summonerName);
spec_summonerName.push(spec_participants[i].summonerName);
spec_spellId.push(spec_participants[i].spell1Id);
spec_spellId.push(spec_participants[i].spell2Id);
}
......@@ -266,7 +266,6 @@ module.exports = function(app){
}
}
}
console.log(spec_spellimage);
}
var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey;
......@@ -285,11 +284,45 @@ module.exports = function(app){
// teamId: 100 = Blue , teamId:200 = Red
var match1Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[0] + "?api_key=" + apikey;
request(match1Url,function(error,response,body){
var match1_json=JSON.parse(body);
var match1_json = JSON.parse(body);
console.log(match1_json);
var match1_gameLength = match_json.gameDuration;
var match1_teams = match1_json.teams;
var match1_participants = match1_json.participants;
var match1_participantIdentities = match1_json.participantIdentities;
var match1_bannedChamp = new Array();
var match1_selectedChamp = new Array();
var match1_spellId = new Array();
var match1_summonerName = new Array();
var match1_kills = new Array();
var match1_deaths = new Array();
var match1_assists = new Array();
var match1_kda = new Array();
for(var i=0; i<2; i++){
var temp = match1_teams[i].bans;
for(var j=0; j<5; j++){
match1_bannedChamp.push(temp[j].championId);
}
}
for(var i=0; i<10; i++){
match1_selectedChamp.push(match1_participants[i].championId);
match1_spellId.push(match1_participants[i].spell1Id);
match1_spellId.push(match1_participants[i].spell2Id);
match1_summonerName.push((match1_participantIdentities[i].player).summonerName);
match1_kills.push((match1_participants[i].stats).kills);
match1_deaths.push((match1_participants[i].stats).deaths);
match1_assists.push((match1_participants[i].stats).assists);
var obj = {
'k' : (match1_participants[i].stats).kills,
'd' : (match1_participants[i].stats).deaths,
'a' : (match1_participants[i].stats).assists
};
match1_kda.push(obj);
}
console.log(match1_kda);
......@@ -297,7 +330,6 @@ module.exports = function(app){
var match2Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[1] + "?api_key=" + apikey;
request(match2Url,function(error,response,body){
var match2_json=JSON.parse(body);
console.log(match2_json);
......@@ -308,7 +340,6 @@ module.exports = function(app){
var match3Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[2] + "?api_key=" + apikey;
request(match3Url,function(error,response,body){
var match3_json=JSON.parse(body);
console.log(match3_json);
......@@ -318,7 +349,6 @@ module.exports = function(app){
var match4Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[3] + "?api_key=" + apikey;
request(match4Url,function(error,response,body){
var match4_json=JSON.parse(body);
console.log(match4_json);
......@@ -329,7 +359,6 @@ module.exports = function(app){
var match5Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[4] + "?api_key=" + apikey;
request(match5Url,function(error,response,body){
var match5_json=JSON.parse(body);
console.log(match5_json);
......