Showing
1 changed file
with
242 additions
and
18 deletions
... | @@ -275,6 +275,8 @@ module.exports = function(app){ | ... | @@ -275,6 +275,8 @@ module.exports = function(app){ |
275 | }; | 275 | }; |
276 | } | 276 | } |
277 | 277 | ||
278 | + console.log(spectator); | ||
279 | + | ||
278 | var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey; | 280 | var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + accountId + "?api_key=" + apikey; |
279 | request(matchUrl,function(error,response,body) { | 281 | request(matchUrl,function(error,response,body) { |
280 | var match_json = JSON.parse(body).matches; | 282 | var match_json = JSON.parse(body).matches; |
... | @@ -358,49 +360,271 @@ module.exports = function(app){ | ... | @@ -358,49 +360,271 @@ module.exports = function(app){ |
358 | 360 | ||
359 | var match2Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[1] + "?api_key=" + apikey; | 361 | var match2Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[1] + "?api_key=" + apikey; |
360 | request(match2Url,function(error,response,body){ | 362 | request(match2Url,function(error,response,body){ |
361 | - var match2_json=JSON.parse(body); | 363 | + var match2_json = JSON.parse(body); |
362 | - | 364 | + var match2_gameLength = match_json.gameDuration; |
363 | - | 365 | + var match2_teams = match2_json.teams; |
366 | + var match2_participants = match2_json.participants; | ||
367 | + var match2_participantIdentities = match2_json.participantIdentities; | ||
368 | + | ||
369 | + var match2_bannedChamp = new Array(); | ||
370 | + var match2_selectedChamp = new Array(); | ||
371 | + var match2_spellId = new Array(); | ||
372 | + var match2_summonerName = new Array(); | ||
373 | + var match2_kda = new Array(); | ||
374 | + | ||
375 | + var match2_bannedChamp_image = new Array(); | ||
376 | + var match2_selectedChamp_image = new Array(); | ||
377 | + var match2_spell_image = new Array(); | ||
364 | 378 | ||
379 | + for(var i=0; i<2; i++){ | ||
380 | + var temp = match2_teams[i].bans; | ||
381 | + for(var j=0; j<5; j++){ | ||
382 | + match2_bannedChamp.push(temp[j].championId); | ||
383 | + } | ||
384 | + } | ||
365 | 385 | ||
386 | + for(var i=0; i<10; i++){ | ||
387 | + match2_selectedChamp.push(match2_participants[i].championId); | ||
388 | + match2_spellId.push(match2_participants[i].spell1Id); | ||
389 | + match2_spellId.push(match2_participants[i].spell2Id); | ||
390 | + match2_summonerName.push((match2_participantIdentities[i].player).summonerName); | ||
391 | + var obj = { | ||
392 | + 'k' : (match2_participants[i].stats).kills, | ||
393 | + 'd' : (match2_participants[i].stats).deaths, | ||
394 | + 'a' : (match2_participants[i].stats).assists | ||
395 | + }; | ||
396 | + match2_kda.push(obj); | ||
397 | + } | ||
366 | 398 | ||
399 | + for(var i=0; i<10; i++) { | ||
400 | + for(key in champion) { | ||
401 | + if(champion.hasOwnProperty(key) && champion[key].key == match2_bannedChamp[i]) { | ||
402 | + match2_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
403 | + } | ||
404 | + if(champion.hasOwnProperty(key) && champion[key].key == match2_selectedChamp[i]) { | ||
405 | + match2_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
406 | + } | ||
407 | + } | ||
408 | + } | ||
409 | + | ||
410 | + for(var i=0; i<20; i++) { | ||
411 | + for(key in spell){ | ||
412 | + if(spell.hasOwnProperty(key) && spell[key].key == match2_spellId[i]){ | ||
413 | + match2_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png"); | ||
414 | + } | ||
415 | + } | ||
416 | + } | ||
417 | + | ||
418 | + var match2 = { | ||
419 | + "summonerName" : match2_summonerName, | ||
420 | + "selectedChamp_image" : match2_selectedChamp_image, | ||
421 | + "bannedChamp_image" : match2_bannedChamp_image, | ||
422 | + "spell_image" : match2_spell_image, | ||
423 | + "kda" : match2_kda | ||
424 | + }; | ||
367 | 425 | ||
426 | + console.log(match2); | ||
368 | 427 | ||
369 | var match3Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[2] + "?api_key=" + apikey; | 428 | var match3Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[2] + "?api_key=" + apikey; |
370 | request(match3Url,function(error,response,body){ | 429 | request(match3Url,function(error,response,body){ |
371 | - var match3_json=JSON.parse(body); | 430 | + var match3_json = JSON.parse(body); |
372 | - | 431 | + var match3_gameLength = match_json.gameDuration; |
432 | + var match3_teams = match3_json.teams; | ||
433 | + var match3_participants = match3_json.participants; | ||
434 | + var match3_participantIdentities = match3_json.participantIdentities; | ||
435 | + | ||
436 | + var match3_bannedChamp = new Array(); | ||
437 | + var match3_selectedChamp = new Array(); | ||
438 | + var match3_spellId = new Array(); | ||
439 | + var match3_summonerName = new Array(); | ||
440 | + var match3_kda = new Array(); | ||
441 | + | ||
442 | + var match3_bannedChamp_image = new Array(); | ||
443 | + var match3_selectedChamp_image = new Array(); | ||
444 | + var match3_spell_image = new Array(); | ||
373 | 445 | ||
446 | + for(var i=0; i<2; i++){ | ||
447 | + var temp = match3_teams[i].bans; | ||
448 | + for(var j=0; j<5; j++){ | ||
449 | + match3_bannedChamp.push(temp[j].championId); | ||
450 | + } | ||
451 | + } | ||
374 | 452 | ||
453 | + for(var i=0; i<10; i++){ | ||
454 | + match3_selectedChamp.push(match3_participants[i].championId); | ||
455 | + match3_spellId.push(match3_participants[i].spell1Id); | ||
456 | + match3_spellId.push(match3_participants[i].spell2Id); | ||
457 | + match3_summonerName.push((match3_participantIdentities[i].player).summonerName); | ||
458 | + var obj = { | ||
459 | + 'k' : (match3_participants[i].stats).kills, | ||
460 | + 'd' : (match3_participants[i].stats).deaths, | ||
461 | + 'a' : (match3_participants[i].stats).assists | ||
462 | + }; | ||
463 | + match3_kda.push(obj); | ||
464 | + } | ||
375 | 465 | ||
466 | + for(var i=0; i<10; i++) { | ||
467 | + for(key in champion) { | ||
468 | + if(champion.hasOwnProperty(key) && champion[key].key == match3_bannedChamp[i]) { | ||
469 | + match3_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
470 | + } | ||
471 | + if(champion.hasOwnProperty(key) && champion[key].key == match3_selectedChamp[i]) { | ||
472 | + match3_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
473 | + } | ||
474 | + } | ||
475 | + } | ||
476 | + | ||
477 | + for(var i=0; i<20; i++) { | ||
478 | + for(key in spell){ | ||
479 | + if(spell.hasOwnProperty(key) && spell[key].key == match3_spellId[i]){ | ||
480 | + match3_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png"); | ||
481 | + } | ||
482 | + } | ||
483 | + } | ||
484 | + | ||
485 | + var match3 = { | ||
486 | + "summonerName" : match3_summonerName, | ||
487 | + "selectedChamp_image" : match3_selectedChamp_image, | ||
488 | + "bannedChamp_image" : match3_bannedChamp_image, | ||
489 | + "spell_image" : match3_spell_image, | ||
490 | + "kda" : match3_kda | ||
491 | + }; | ||
376 | 492 | ||
493 | + console.log(match3); | ||
377 | 494 | ||
378 | var match4Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[3] + "?api_key=" + apikey; | 495 | var match4Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[3] + "?api_key=" + apikey; |
379 | request(match4Url,function(error,response,body){ | 496 | request(match4Url,function(error,response,body){ |
380 | - var match4_json=JSON.parse(body); | 497 | + var match4_json = JSON.parse(body); |
381 | - | 498 | + var match4_gameLength = match_json.gameDuration; |
382 | - | 499 | + var match4_teams = match4_json.teams; |
500 | + var match4_participants = match4_json.participants; | ||
501 | + var match4_participantIdentities = match4_json.participantIdentities; | ||
502 | + | ||
503 | + var match4_bannedChamp = new Array(); | ||
504 | + var match4_selectedChamp = new Array(); | ||
505 | + var match4_spellId = new Array(); | ||
506 | + var match4_summonerName = new Array(); | ||
507 | + var match4_kda = new Array(); | ||
508 | + | ||
509 | + var match4_bannedChamp_image = new Array(); | ||
510 | + var match4_selectedChamp_image = new Array(); | ||
511 | + var match4_spell_image = new Array(); | ||
383 | 512 | ||
513 | + for(var i=0; i<2; i++){ | ||
514 | + var temp = match4_teams[i].bans; | ||
515 | + for(var j=0; j<5; j++){ | ||
516 | + match4_bannedChamp.push(temp[j].championId); | ||
517 | + } | ||
518 | + } | ||
384 | 519 | ||
520 | + for(var i=0; i<10; i++){ | ||
521 | + match4_selectedChamp.push(match4_participants[i].championId); | ||
522 | + match4_spellId.push(match4_participants[i].spell1Id); | ||
523 | + match4_spellId.push(match4_participants[i].spell2Id); | ||
524 | + match4_summonerName.push((match4_participantIdentities[i].player).summonerName); | ||
525 | + var obj = { | ||
526 | + 'k' : (match4_participants[i].stats).kills, | ||
527 | + 'd' : (match4_participants[i].stats).deaths, | ||
528 | + 'a' : (match4_participants[i].stats).assists | ||
529 | + }; | ||
530 | + match4_kda.push(obj); | ||
531 | + } | ||
385 | 532 | ||
533 | + for(var i=0; i<10; i++) { | ||
534 | + for(key in champion) { | ||
535 | + if(champion.hasOwnProperty(key) && champion[key].key == match4_bannedChamp[i]) { | ||
536 | + match4_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
537 | + } | ||
538 | + if(champion.hasOwnProperty(key) && champion[key].key == match4_selectedChamp[i]) { | ||
539 | + match4_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
540 | + } | ||
541 | + } | ||
542 | + } | ||
543 | + | ||
544 | + for(var i=0; i<20; i++) { | ||
545 | + for(key in spell){ | ||
546 | + if(spell.hasOwnProperty(key) && spell[key].key == match4_spellId[i]){ | ||
547 | + match4_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png"); | ||
548 | + } | ||
549 | + } | ||
550 | + } | ||
551 | + | ||
552 | + var match4 = { | ||
553 | + "summonerName" : match4_summonerName, | ||
554 | + "selectedChamp_image" : match4_selectedChamp_image, | ||
555 | + "bannedChamp_image" : match4_bannedChamp_image, | ||
556 | + "spell_image" : match4_spell_image, | ||
557 | + "kda" : match4_kda | ||
558 | + }; | ||
386 | 559 | ||
560 | + console.log(match4); | ||
387 | 561 | ||
388 | var match5Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[4] + "?api_key=" + apikey; | 562 | var match5Url = "https://kr.api.riotgames.com/lol/match/v4/matches/" + match_gameId[4] + "?api_key=" + apikey; |
389 | request(match5Url,function(error,response,body){ | 563 | request(match5Url,function(error,response,body){ |
390 | - var match5_json=JSON.parse(body); | 564 | + var match5_json = JSON.parse(body); |
391 | - | 565 | + var match5_gameLength = match_json.gameDuration; |
392 | - | 566 | + var match5_teams = match5_json.teams; |
393 | - | 567 | + var match5_participants = match5_json.participants; |
568 | + var match5_participantIdentities = match5_json.participantIdentities; | ||
569 | + | ||
570 | + var match5_bannedChamp = new Array(); | ||
571 | + var match5_selectedChamp = new Array(); | ||
572 | + var match5_spellId = new Array(); | ||
573 | + var match5_summonerName = new Array(); | ||
574 | + var match5_kda = new Array(); | ||
575 | + | ||
576 | + var match5_bannedChamp_image = new Array(); | ||
577 | + var match5_selectedChamp_image = new Array(); | ||
578 | + var match5_spell_image = new Array(); | ||
394 | 579 | ||
580 | + for(var i=0; i<2; i++){ | ||
581 | + var temp = match5_teams[i].bans; | ||
582 | + for(var j=0; j<5; j++){ | ||
583 | + match5_bannedChamp.push(temp[j].championId); | ||
584 | + } | ||
585 | + } | ||
395 | 586 | ||
587 | + for(var i=0; i<10; i++){ | ||
588 | + match5_selectedChamp.push(match5_participants[i].championId); | ||
589 | + match5_spellId.push(match5_participants[i].spell1Id); | ||
590 | + match5_spellId.push(match5_participants[i].spell2Id); | ||
591 | + match5_summonerName.push((match5_participantIdentities[i].player).summonerName); | ||
592 | + var obj = { | ||
593 | + 'k' : (match5_participants[i].stats).kills, | ||
594 | + 'd' : (match5_participants[i].stats).deaths, | ||
595 | + 'a' : (match5_participants[i].stats).assists | ||
596 | + }; | ||
597 | + match5_kda.push(obj); | ||
598 | + } | ||
396 | 599 | ||
600 | + for(var i=0; i<10; i++) { | ||
601 | + for(key in champion) { | ||
602 | + if(champion.hasOwnProperty(key) && champion[key].key == match5_bannedChamp[i]) { | ||
603 | + match5_bannedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
604 | + } | ||
605 | + if(champion.hasOwnProperty(key) && champion[key].key == match5_selectedChamp[i]) { | ||
606 | + match5_selectedChamp_image.push("http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"+champion[key].id+".png"); | ||
607 | + } | ||
608 | + } | ||
609 | + } | ||
610 | + | ||
611 | + for(var i=0; i<20; i++) { | ||
612 | + for(key in spell){ | ||
613 | + if(spell.hasOwnProperty(key) && spell[key].key == match5_spellId[i]){ | ||
614 | + match5_spell_image.push("http://ddragon.leagueoflegends.com/cdn/10.12.1/img/spell/"+spell[key].id+".png"); | ||
615 | + } | ||
616 | + } | ||
617 | + } | ||
618 | + | ||
619 | + var match5 = { | ||
620 | + "summonerName" : match5_summonerName, | ||
621 | + "selectedChamp_image" : match5_selectedChamp_image, | ||
622 | + "bannedChamp_image" : match5_bannedChamp_image, | ||
623 | + "spell_image" : match5_spell_image, | ||
624 | + "kda" : match5_kda | ||
625 | + }; | ||
397 | 626 | ||
398 | - | 627 | + console.log(match5); |
399 | - | ||
400 | - | ||
401 | - | ||
402 | - | ||
403 | - | ||
404 | 628 | ||
405 | 629 | ||
406 | 630 | ... | ... |
-
Please register or login to post a comment