황성연

대전 기록 받아오기

...@@ -239,11 +239,11 @@ module.exports = function(app){ ...@@ -239,11 +239,11 @@ module.exports = function(app){
239 239
240 var spec_bannedChamp_image = new Array(); 240 var spec_bannedChamp_image = new Array();
241 var spec_selectedChamp_image = new Array(); 241 var spec_selectedChamp_image = new Array();
242 - var spec_summonername = new Array(); 242 + var spec_summonerName = new Array();
243 var spec_spellId = new Array(); 243 var spec_spellId = new Array();
244 var spec_spellimage = new Array(); 244 var spec_spellimage = new Array();
245 for(var i=0; i<10; i++){ 245 for(var i=0; i<10; i++){
246 - spec_summonername.push(spec_participants[i].summonerName); 246 + spec_summonerName.push(spec_participants[i].summonerName);
247 spec_spellId.push(spec_participants[i].spell1Id); 247 spec_spellId.push(spec_participants[i].spell1Id);
248 spec_spellId.push(spec_participants[i].spell2Id); 248 spec_spellId.push(spec_participants[i].spell2Id);
249 } 249 }
...@@ -266,7 +266,6 @@ module.exports = function(app){ ...@@ -266,7 +266,6 @@ module.exports = function(app){
266 } 266 }
267 } 267 }
268 } 268 }
269 - console.log(spec_spellimage);
270 } 269 }
271 270
272 var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey; 271 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){ ...@@ -285,11 +284,45 @@ module.exports = function(app){
285 // teamId: 100 = Blue , teamId:200 = Red 284 // teamId: 100 = Blue , teamId:200 = Red
286 var match1Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[0] + "?api_key=" + apikey; 285 var match1Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[0] + "?api_key=" + apikey;
287 request(match1Url,function(error,response,body){ 286 request(match1Url,function(error,response,body){
288 - var match1_json=JSON.parse(body); 287 + var match1_json = JSON.parse(body);
289 console.log(match1_json); 288 console.log(match1_json);
289 + var match1_gameLength = match_json.gameDuration;
290 + var match1_teams = match1_json.teams;
291 + var match1_participants = match1_json.participants;
292 + var match1_participantIdentities = match1_json.participantIdentities;
293 +
294 + var match1_bannedChamp = new Array();
295 + var match1_selectedChamp = new Array();
296 + var match1_spellId = new Array();
297 + var match1_summonerName = new Array();
298 + var match1_kills = new Array();
299 + var match1_deaths = new Array();
300 + var match1_assists = new Array();
301 + var match1_kda = new Array();
302 +
303 + for(var i=0; i<2; i++){
304 + var temp = match1_teams[i].bans;
305 + for(var j=0; j<5; j++){
306 + match1_bannedChamp.push(temp[j].championId);
307 + }
308 + }
290 309
291 - 310 + for(var i=0; i<10; i++){
292 - 311 + match1_selectedChamp.push(match1_participants[i].championId);
312 + match1_spellId.push(match1_participants[i].spell1Id);
313 + match1_spellId.push(match1_participants[i].spell2Id);
314 + match1_summonerName.push((match1_participantIdentities[i].player).summonerName);
315 + match1_kills.push((match1_participants[i].stats).kills);
316 + match1_deaths.push((match1_participants[i].stats).deaths);
317 + match1_assists.push((match1_participants[i].stats).assists);
318 + var obj = {
319 + 'k' : (match1_participants[i].stats).kills,
320 + 'd' : (match1_participants[i].stats).deaths,
321 + 'a' : (match1_participants[i].stats).assists
322 + };
323 + match1_kda.push(obj);
324 + }
325 + console.log(match1_kda);
293 326
294 327
295 328
...@@ -297,7 +330,6 @@ module.exports = function(app){ ...@@ -297,7 +330,6 @@ module.exports = function(app){
297 var match2Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[1] + "?api_key=" + apikey; 330 var match2Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[1] + "?api_key=" + apikey;
298 request(match2Url,function(error,response,body){ 331 request(match2Url,function(error,response,body){
299 var match2_json=JSON.parse(body); 332 var match2_json=JSON.parse(body);
300 - console.log(match2_json);
301 333
302 334
303 335
...@@ -308,7 +340,6 @@ module.exports = function(app){ ...@@ -308,7 +340,6 @@ module.exports = function(app){
308 var match3Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[2] + "?api_key=" + apikey; 340 var match3Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[2] + "?api_key=" + apikey;
309 request(match3Url,function(error,response,body){ 341 request(match3Url,function(error,response,body){
310 var match3_json=JSON.parse(body); 342 var match3_json=JSON.parse(body);
311 - console.log(match3_json);
312 343
313 344
314 345
...@@ -318,7 +349,6 @@ module.exports = function(app){ ...@@ -318,7 +349,6 @@ module.exports = function(app){
318 var match4Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[3] + "?api_key=" + apikey; 349 var match4Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[3] + "?api_key=" + apikey;
319 request(match4Url,function(error,response,body){ 350 request(match4Url,function(error,response,body){
320 var match4_json=JSON.parse(body); 351 var match4_json=JSON.parse(body);
321 - console.log(match4_json);
322 352
323 353
324 354
...@@ -329,7 +359,6 @@ module.exports = function(app){ ...@@ -329,7 +359,6 @@ module.exports = function(app){
329 var match5Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[4] + "?api_key=" + apikey; 359 var match5Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[4] + "?api_key=" + apikey;
330 request(match5Url,function(error,response,body){ 360 request(match5Url,function(error,response,body){
331 var match5_json=JSON.parse(body); 361 var match5_json=JSON.parse(body);
332 - console.log(match5_json);
333 362
334 363
335 364
......