황성연

최근 5경기 대전기록 불러오기

......@@ -275,6 +275,8 @@ module.exports = function(app){
};
}
console.log(spectator);
var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey;
request(matchUrl,function(error,response,body) {
var match_json = JSON.parse(body).matches;
......@@ -358,49 +360,271 @@ 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);
var match2_json = JSON.parse(body);
var match2_gameLength = match_json.gameDuration;
var match2_teams = match2_json.teams;
var match2_participants = match2_json.participants;
var match2_participantIdentities = match2_json.participantIdentities;
var match2_bannedChamp = new Array();
var match2_selectedChamp = new Array();
var match2_spellId = new Array();
var match2_summonerName = new Array();
var match2_kda = new Array();
var match2_bannedChamp_image = new Array();
var match2_selectedChamp_image = new Array();
var match2_spell_image = new Array();
for(var i=0; i<2; i++){
var temp = match2_teams[i].bans;
for(var j=0; j<5; j++){
match2_bannedChamp.push(temp[j].championId);
}
}
for(var i=0; i<10; i++){
match2_selectedChamp.push(match2_participants[i].championId);
match2_spellId.push(match2_participants[i].spell1Id);
match2_spellId.push(match2_participants[i].spell2Id);
match2_summonerName.push((match2_participantIdentities[i].player).summonerName);
var obj = {
'k' : (match2_participants[i].stats).kills,
'd' : (match2_participants[i].stats).deaths,
'a' : (match2_participants[i].stats).assists
};
match2_kda.push(obj);
}
for(var i=0; i<10; i++) {
for(key in champion) {
if(champion.hasOwnProperty(key) && champion[key].key == match2_bannedChamp[i]) {
match2_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
if(champion.hasOwnProperty(key) && champion[key].key == match2_selectedChamp[i]) {
match2_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
}
}
for(var i=0; i<20; i++) {
for(key in spell){
if(spell.hasOwnProperty(key) && spell[key].key == match2_spellId[i]){
match2_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png");
}
}
}
var match2 = {
"summonerName" : match2_summonerName,
"selectedChamp_image" : match2_selectedChamp_image,
"bannedChamp_image" : match2_bannedChamp_image,
"spell_image" : match2_spell_image,
"kda" : match2_kda
};
console.log(match2);
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);
var match3_json = JSON.parse(body);
var match3_gameLength = match_json.gameDuration;
var match3_teams = match3_json.teams;
var match3_participants = match3_json.participants;
var match3_participantIdentities = match3_json.participantIdentities;
var match3_bannedChamp = new Array();
var match3_selectedChamp = new Array();
var match3_spellId = new Array();
var match3_summonerName = new Array();
var match3_kda = new Array();
var match3_bannedChamp_image = new Array();
var match3_selectedChamp_image = new Array();
var match3_spell_image = new Array();
for(var i=0; i<2; i++){
var temp = match3_teams[i].bans;
for(var j=0; j<5; j++){
match3_bannedChamp.push(temp[j].championId);
}
}
for(var i=0; i<10; i++){
match3_selectedChamp.push(match3_participants[i].championId);
match3_spellId.push(match3_participants[i].spell1Id);
match3_spellId.push(match3_participants[i].spell2Id);
match3_summonerName.push((match3_participantIdentities[i].player).summonerName);
var obj = {
'k' : (match3_participants[i].stats).kills,
'd' : (match3_participants[i].stats).deaths,
'a' : (match3_participants[i].stats).assists
};
match3_kda.push(obj);
}
for(var i=0; i<10; i++) {
for(key in champion) {
if(champion.hasOwnProperty(key) && champion[key].key == match3_bannedChamp[i]) {
match3_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
if(champion.hasOwnProperty(key) && champion[key].key == match3_selectedChamp[i]) {
match3_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
}
}
for(var i=0; i<20; i++) {
for(key in spell){
if(spell.hasOwnProperty(key) && spell[key].key == match3_spellId[i]){
match3_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png");
}
}
}
var match3 = {
"summonerName" : match3_summonerName,
"selectedChamp_image" : match3_selectedChamp_image,
"bannedChamp_image" : match3_bannedChamp_image,
"spell_image" : match3_spell_image,
"kda" : match3_kda
};
console.log(match3);
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);
var match4_json = JSON.parse(body);
var match4_gameLength = match_json.gameDuration;
var match4_teams = match4_json.teams;
var match4_participants = match4_json.participants;
var match4_participantIdentities = match4_json.participantIdentities;
var match4_bannedChamp = new Array();
var match4_selectedChamp = new Array();
var match4_spellId = new Array();
var match4_summonerName = new Array();
var match4_kda = new Array();
var match4_bannedChamp_image = new Array();
var match4_selectedChamp_image = new Array();
var match4_spell_image = new Array();
for(var i=0; i<2; i++){
var temp = match4_teams[i].bans;
for(var j=0; j<5; j++){
match4_bannedChamp.push(temp[j].championId);
}
}
for(var i=0; i<10; i++){
match4_selectedChamp.push(match4_participants[i].championId);
match4_spellId.push(match4_participants[i].spell1Id);
match4_spellId.push(match4_participants[i].spell2Id);
match4_summonerName.push((match4_participantIdentities[i].player).summonerName);
var obj = {
'k' : (match4_participants[i].stats).kills,
'd' : (match4_participants[i].stats).deaths,
'a' : (match4_participants[i].stats).assists
};
match4_kda.push(obj);
}
for(var i=0; i<10; i++) {
for(key in champion) {
if(champion.hasOwnProperty(key) && champion[key].key == match4_bannedChamp[i]) {
match4_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
if(champion.hasOwnProperty(key) && champion[key].key == match4_selectedChamp[i]) {
match4_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
}
}
for(var i=0; i<20; i++) {
for(key in spell){
if(spell.hasOwnProperty(key) && spell[key].key == match4_spellId[i]){
match4_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png");
}
}
}
var match4 = {
"summonerName" : match4_summonerName,
"selectedChamp_image" : match4_selectedChamp_image,
"bannedChamp_image" : match4_bannedChamp_image,
"spell_image" : match4_spell_image,
"kda" : match4_kda
};
console.log(match4);
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);
var match5_json = JSON.parse(body);
var match5_gameLength = match_json.gameDuration;
var match5_teams = match5_json.teams;
var match5_participants = match5_json.participants;
var match5_participantIdentities = match5_json.participantIdentities;
var match5_bannedChamp = new Array();
var match5_selectedChamp = new Array();
var match5_spellId = new Array();
var match5_summonerName = new Array();
var match5_kda = new Array();
var match5_bannedChamp_image = new Array();
var match5_selectedChamp_image = new Array();
var match5_spell_image = new Array();
for(var i=0; i<2; i++){
var temp = match5_teams[i].bans;
for(var j=0; j<5; j++){
match5_bannedChamp.push(temp[j].championId);
}
}
for(var i=0; i<10; i++){
match5_selectedChamp.push(match5_participants[i].championId);
match5_spellId.push(match5_participants[i].spell1Id);
match5_spellId.push(match5_participants[i].spell2Id);
match5_summonerName.push((match5_participantIdentities[i].player).summonerName);
var obj = {
'k' : (match5_participants[i].stats).kills,
'd' : (match5_participants[i].stats).deaths,
'a' : (match5_participants[i].stats).assists
};
match5_kda.push(obj);
}
for(var i=0; i<10; i++) {
for(key in champion) {
if(champion.hasOwnProperty(key) && champion[key].key == match5_bannedChamp[i]) {
match5_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
if(champion.hasOwnProperty(key) && champion[key].key == match5_selectedChamp[i]) {
match5_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png");
}
}
}
for(var i=0; i<20; i++) {
for(key in spell){
if(spell.hasOwnProperty(key) && spell[key].key == match5_spellId[i]){
match5_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png");
}
}
}
var match5 = {
"summonerName" : match5_summonerName,
"selectedChamp_image" : match5_selectedChamp_image,
"bannedChamp_image" : match5_bannedChamp_image,
"spell_image" : match5_spell_image,
"kda" : match5_kda
};
console.log(match5);
......