Showing
4 changed files
with
182 additions
and
136 deletions
... | @@ -8,7 +8,7 @@ app.set('view engine', 'ejs'); | ... | @@ -8,7 +8,7 @@ app.set('view engine', 'ejs'); |
8 | app.engine('html', require('ejs').renderFile); | 8 | app.engine('html', require('ejs').renderFile); |
9 | 9 | ||
10 | var server = app.listen(3000, function(){ | 10 | var server = app.listen(3000, function(){ |
11 | - console.log('good'); | 11 | + console.log('Success'); |
12 | }); | 12 | }); |
13 | 13 | ||
14 | app.use(express.static('public')); | 14 | app.use(express.static('public')); |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -module.exports = function(app){ | 1 | +function func(info_match, championId, win, kills, deaths, assists, num) { |
2 | + for (var i = 0; i < 10; i++) { | ||
3 | + if (info_match["participants"][i]["championId"] == championId[num]) { | ||
4 | + win[num] = info_match["participants"][i]["stats"]["win"]; | ||
5 | + kills[num] = info_match["participants"][i]["stats"]["kills"]; | ||
6 | + deaths[num] = info_match["participants"][i]["stats"]["deaths"]; | ||
7 | + assists[num] = info_match["participants"][i]["stats"]["assists"]; | ||
8 | + } | ||
9 | + } | ||
10 | +} | ||
11 | + | ||
12 | +module.exports = function(app) { | ||
2 | 13 | ||
3 | -var request = require("request"); | 14 | + var request = require("request"); |
4 | -var urlenconde = require('urlencode'); | 15 | + var urlenconde = require('urlencode'); |
5 | -var apikey = "RGAPI-3b791531-e731-4349-bab0-53068a86608c"//api | 16 | + var apikey = "RGAPI-a0598a8a-a326-4c0d-a115-3f0ae332e86f"; //api |
6 | 17 | ||
7 | -var profileIconId; //아이콘 번호 | 18 | + var profileIconId; //아이콘 번호 |
8 | -var revisionDate; //수정날짜 | 19 | + var revisionDate; //수정날짜 |
9 | -var id; //소환사ID | 20 | + var id; //소환사ID |
10 | -var accountId; //계정Id | 21 | + var accountId; //계정Id |
11 | -var name; //소환사 이름 | 22 | + var name; //소환사 이름 |
12 | -var summonerLevel; //소환사 | 23 | + var summonerLevel; //소환사 |
13 | -var rotation_champ = new Array(); | 24 | + var rotation_champ = new Array(); |
14 | 25 | ||
15 | app.get('/', function(req, res) { | 26 | app.get('/', function(req, res) { |
16 | res.render('main', { title: 'LOL Helper' }); | 27 | res.render('main', { title: 'LOL Helper' }); |
17 | }); | 28 | }); |
18 | 29 | ||
19 | - app.get('/search/:username/', function(req, res, next){ | 30 | + app.get('/search/:username/', function(req, res, next) { |
20 | //롤 api url | 31 | //롤 api url |
21 | name = req.params.username; | 32 | name = req.params.username; |
22 | - var nameUrl = "https://kr.api.riotgames.com/lol/summoner/v4/summoners/by-name/" + urlenconde(name)+"?api_key="+ apikey; | 33 | + var nameUrl = "https://kr.api.riotgames.com/lol/summoner/v4/summoners/by-name/" + urlenconde(name) + "?api_key=" + apikey; |
23 | - request(nameUrl,function(error,response,body){ | 34 | + request(nameUrl, function(error, response, body) { |
24 | - | ||
25 | // 요청에 대한 응답이 성공적으로 왔는지 검사. | 35 | // 요청에 대한 응답이 성공적으로 왔는지 검사. |
26 | // status code가 200이 아니면 오류가 있었던 것으로 간주하고 함수 종료. | 36 | // status code가 200이 아니면 오류가 있었던 것으로 간주하고 함수 종료. |
27 | console.log('response code ', response.statusCode); | 37 | console.log('response code ', response.statusCode); |
... | @@ -41,18 +51,16 @@ var rotation_champ = new Array(); | ... | @@ -41,18 +51,16 @@ var rotation_champ = new Array(); |
41 | revisionDate = info_summoner_json["revisionDate"]; | 51 | revisionDate = info_summoner_json["revisionDate"]; |
42 | 52 | ||
43 | var champUrl = "https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/" + urlenconde(id) + "?api_key=" + apikey; | 53 | var champUrl = "https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/" + urlenconde(id) + "?api_key=" + apikey; |
44 | - request(champUrl,function(error,response,body){ | 54 | + request(champUrl, function(error, response, body){ |
45 | var info_champ_json = JSON.parse(body); | 55 | var info_champ_json = JSON.parse(body); |
46 | var champ_point = new Array(); | 56 | var champ_point = new Array(); |
47 | var champ_id = new Array(); | 57 | var champ_id = new Array(); |
48 | var champ_name = new Array(); | 58 | var champ_name = new Array(); |
49 | var rotation_name = new Array(); | 59 | var rotation_name = new Array(); |
50 | var champ_pic = new Array(); | 60 | var champ_pic = new Array(); |
51 | - var rotation_pic =new Array(); | 61 | + var rotation_pic = new Array(); |
52 | var champions_length = Object.keys(info_champ_json).length; | 62 | var champions_length = Object.keys(info_champ_json).length; |
53 | - | ||
54 | //console.log("\n\ninfo_champ_json\n\n", info_champ_json); | 63 | //console.log("\n\ninfo_champ_json\n\n", info_champ_json); |
55 | - | ||
56 | // status code가 200이 아니면 종료. | 64 | // status code가 200이 아니면 종료. |
57 | if (info_champ_json["status"] != undefined) { | 65 | if (info_champ_json["status"] != undefined) { |
58 | if (info_champ_json["status"]["status_code"] != 200) { | 66 | if (info_champ_json["status"]["status_code"] != 200) { |
... | @@ -62,96 +70,90 @@ var rotation_champ = new Array(); | ... | @@ -62,96 +70,90 @@ var rotation_champ = new Array(); |
62 | } | 70 | } |
63 | } | 71 | } |
64 | 72 | ||
65 | - for(var i=0; i < champions_length; i++){ | 73 | + for (var i = 0; i < champions_length; i++) { |
66 | champ_point[i] = (info_champ_json[i]["championPoints"]); | 74 | champ_point[i] = (info_champ_json[i]["championPoints"]); |
67 | champ_id[i] = info_champ_json[i]["championId"]; | 75 | champ_id[i] = info_champ_json[i]["championId"]; |
68 | - | ||
69 | } | 76 | } |
70 | - var rotationUrl = "https://kr.api.riotgames.com/lol/platform/v3/champion-rotations?api_key="+apikey; | 77 | + var rotationUrl = "https://kr.api.riotgames.com/lol/platform/v3/champion-rotations?api_key=" + apikey; |
71 | - request(rotationUrl,function(error,response,body){ | 78 | + request(rotationUrl, function(error, response, body) { |
72 | var info_rotation = JSON.parse(body); | 79 | var info_rotation = JSON.parse(body); |
73 | var keys = Object.keys(info_rotation); | 80 | var keys = Object.keys(info_rotation); |
74 | - for(var k =0; k < info_rotation[keys[0]].length;k++) | 81 | + for (var k = 0; k < info_rotation[keys[0]].length; k++) { |
75 | - { | 82 | + rotation_champ[k] = info_rotation[keys[0]][k]; |
76 | - rotation_champ[k] =info_rotation[keys[0]][k] | ||
77 | - console.log("rotation_champ:"+rotation_champ[k]); | ||
78 | - console.log("로테길이:"+rotation_champ.length); | ||
79 | } | 83 | } |
80 | - | ||
81 | - | ||
82 | - | ||
83 | - | ||
84 | - | ||
85 | var staticUrl = "http://ddragon.leagueoflegends.com/cdn/9.23.1/data/en_US/champion.json"; | 84 | var staticUrl = "http://ddragon.leagueoflegends.com/cdn/9.23.1/data/en_US/champion.json"; |
86 | - request(staticUrl,function(error,response,body){ | 85 | + request(staticUrl, function(error, response, body) { |
87 | var info_static_champ_json = JSON.parse(body); | 86 | var info_static_champ_json = JSON.parse(body); |
88 | var champion = info_static_champ_json["data"]; | 87 | var champion = info_static_champ_json["data"]; |
89 | - for(var i=0; i < champ_id.length; i++){ | 88 | + for (var i = 0; i < champ_id.length; i++) { |
90 | - for(js in champion){ | 89 | + for (js in champion) { |
91 | - for(j in champion[js]){ | 90 | + for (j in champion[js]) { |
92 | - if(champion[js]["key"] == champ_id[i]){ | 91 | + if (champion[js]["key"] == champ_id[i]) { |
93 | champ_name[i] = champion[js]["id"]; | 92 | champ_name[i] = champion[js]["id"]; |
94 | champ_pic[i] = "http://ddragon.leagueoflegends.com/cdn/9.23.1/img/champion/" + champ_name[i] + ".png"; | 93 | champ_pic[i] = "http://ddragon.leagueoflegends.com/cdn/9.23.1/img/champion/" + champ_name[i] + ".png"; |
95 | - | ||
96 | } | 94 | } |
97 | } | 95 | } |
98 | } | 96 | } |
99 | } | 97 | } |
100 | - for(var i=0; i < champ_id.length; i++){ | 98 | + for (var i = 0; i < champ_id.length; i++) { |
101 | - for(js in champion){ | 99 | + for (js in champion) { |
102 | - for(j in champion[js]){ | 100 | + for (j in champion[js]) { |
103 | - if(champion[js]["key"] == rotation_champ[i]){ | 101 | + if (champion[js]["key"] == rotation_champ[i]) { |
104 | rotation_name[i] = champion[js]["id"]; | 102 | rotation_name[i] = champion[js]["id"]; |
105 | - rotation_pic[i] = "http://ddragon.leagueoflegends.com/cdn/9.23.1/img/champion/"+rotation_name[i]+".png"; | 103 | + rotation_pic[i] = "http://ddragon.leagueoflegends.com/cdn/9.23.1/img/champion/" + rotation_name[i] + ".png"; |
106 | - | ||
107 | } | 104 | } |
108 | } | 105 | } |
109 | } | 106 | } |
110 | } | 107 | } |
111 | - | 108 | + var userLeagueUrl = "https://kr.api.riotgames.com/lol/league/v4/entries/by-summoner/" + urlenconde(id) + "?api_key=" + apikey; |
112 | - console.log("챔프길이:"+champ_pic.length); | 109 | + request(userLeagueUrl, function(error, response, body){ |
113 | - | ||
114 | - var userLeagueUrl = "https://kr.api.riotgames.com/lol/league/v4/entries/by-summoner/"+ urlenconde(id)+"?api_key=" + apikey; | ||
115 | - request(userLeagueUrl,function(error,response,body){ | ||
116 | var info_user_league_json = JSON.parse(body); | 110 | var info_user_league_json = JSON.parse(body); |
117 | - //console.log("userLeagueUrl:", userLeagueUrl); | 111 | + if (info_user_league_json[0] != null) { |
118 | - if(info_user_league_json[0] != null){ | ||
119 | var leagueId = info_user_league_json[0]["leagueId"]; | 112 | var leagueId = info_user_league_json[0]["leagueId"]; |
120 | var wins = info_user_league_json[0]["wins"]; | 113 | var wins = info_user_league_json[0]["wins"]; |
121 | var losses = info_user_league_json[0]["losses"]; | 114 | var losses = info_user_league_json[0]["losses"]; |
122 | - var leagueName = info_user_league_json[0]["leagueName"] | 115 | + var leagueName = info_user_league_json[0]["leagueName"]; |
123 | var tier = info_user_league_json[0]["tier"]; | 116 | var tier = info_user_league_json[0]["tier"]; |
124 | var rank = info_user_league_json[0]["rank"]; | 117 | var rank = info_user_league_json[0]["rank"]; |
125 | var leaguePoints = info_user_league_json[0]["leaguePoints"]; | 118 | var leaguePoints = info_user_league_json[0]["leaguePoints"]; |
126 | var img_tier; | 119 | var img_tier; |
127 | - if(tier == "MASTER"){ | 120 | + if (tier == "MASTER") { |
128 | img_tier = "https://i.imgur.com/nvQjonh.png"; | 121 | img_tier = "https://i.imgur.com/nvQjonh.png"; |
129 | - }else if(tier == "CHALLENGER"){ | 122 | + } |
123 | + else if (tier == "CHALLENGER") { | ||
130 | img_tier = "https://i.imgur.com/sbK1Edj.png"; | 124 | img_tier = "https://i.imgur.com/sbK1Edj.png"; |
131 | - }else if(tier == "DIAMOND"){ | ||
132 | - img_tier = "https://i.imgur.com/5VBu8PF.png" | ||
133 | - }else if(tier == "PLATINUM"){ | ||
134 | - img_tier = "https://i.imgur.com/Eqi6858.png" | ||
135 | - }else if(tier == "GRANDMASTER"){ | ||
136 | - img_tier = "https://i.imgur.com/mcEhz1o.png" | ||
137 | - }else if(tier == "GOLD"){ | ||
138 | - img_tier = "https://i.imgur.com/Ec4hPuO.png" | ||
139 | - }else if(tier == "SILVER"){ | ||
140 | - img_tier = "https://i.imgur.com/GKnPu7s.png" | ||
141 | - }else if(tier == "BRONZE"){ | ||
142 | - img_tier ="https://i.imgur.com/TPZVXIr.png" | ||
143 | - }else{ | ||
144 | - img_tier = "https://i.imgur.com/kcdoC4r.png" | ||
145 | } | 125 | } |
146 | -} | 126 | + else if (tier == "DIAMOND") { |
127 | + img_tier = "https://i.imgur.com/5VBu8PF.png"; | ||
128 | + } | ||
129 | + else if (tier == "PLATINUM") { | ||
130 | + img_tier = "https://i.imgur.com/Eqi6858.png"; | ||
131 | + } | ||
132 | + else if (tier == "GRANDMASTER") { | ||
133 | + img_tier = "https://i.imgur.com/mcEhz1o.png"; | ||
134 | + } | ||
135 | + else if (tier == "GOLD") { | ||
136 | + img_tier = "https://i.imgur.com/Ec4hPuO.png"; | ||
137 | + } | ||
138 | + else if (tier == "SILVER") { | ||
139 | + img_tier = "https://i.imgur.com/GKnPu7s.png"; | ||
140 | + } | ||
141 | + else if (tier == "BRONZE") { | ||
142 | + img_tier = "https://i.imgur.com/TPZVXIr.png"; | ||
143 | + } | ||
144 | + else { | ||
145 | + img_tier = "https://i.imgur.com/kcdoC4r.png"; | ||
146 | + } | ||
147 | + } | ||
147 | var matchListUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + urlenconde(accountId) + "?api_key=" + apikey; | 148 | var matchListUrl = "https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/" + urlenconde(accountId) + "?api_key=" + apikey; |
148 | request(matchListUrl, function(error, response, body){ | 149 | request(matchListUrl, function(error, response, body){ |
149 | var info_matchList = JSON.parse(body); | 150 | var info_matchList = JSON.parse(body); |
151 | + var gameId = new Array(); | ||
150 | var championId = new Array(); | 152 | var championId = new Array(); |
151 | var picture = new Array(); | 153 | var picture = new Array(); |
152 | - if(info_matchList["matches"] != null){ | 154 | + if (info_matchList["matches"] != null) { |
153 | - var gameId = info_matchList["matches"][0]["gameId"]; | 155 | + for (var num = 0; num < 10; num++) { |
154 | - for(var num = 0; num < 10; num++){ | 156 | + gameId[num] = info_matchList["matches"][num]["gameId"]; |
155 | championId[num] = info_matchList["matches"][num]["champion"]; | 157 | championId[num] = info_matchList["matches"][num]["champion"]; |
156 | for (var i = 0; i < champ_id.length; i++) { | 158 | for (var i = 0; i < champ_id.length; i++) { |
157 | for (j in champion) { | 159 | for (j in champion) { |
... | @@ -162,93 +164,131 @@ var rotation_champ = new Array(); | ... | @@ -162,93 +164,131 @@ var rotation_champ = new Array(); |
162 | } | 164 | } |
163 | } | 165 | } |
164 | } | 166 | } |
165 | - | 167 | + var win = new Array(); |
166 | - var matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId) + "?api_key=" + apikey; | 168 | + var kills = new Array(); |
169 | + var deaths = new Array(); | ||
170 | + var assists = new Array(); | ||
171 | + var matchUrl; | ||
172 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[0]) + "?api_key=" + apikey; | ||
167 | request(matchUrl, function(error, response, body){ | 173 | request(matchUrl, function(error, response, body){ |
168 | var info_match = JSON.parse(body); | 174 | var info_match = JSON.parse(body); |
169 | - if(info_match["teams"] != null){ | 175 | + func(info_match, championId, win, kills, deaths, assists, 0); |
170 | - for (var i = 0; i < 10; i++){ | 176 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[1]) + "?api_key=" + apikey; |
171 | - if(info_match["participants"][i]["championId"] == championId[0]){ | 177 | + request(matchUrl, function(error, response, body){ |
172 | - var win = info_match["participants"][i]["stats"]["win"]; | 178 | + var info_match = JSON.parse(body); |
173 | - var kills = info_match["participants"][i]["stats"]["kills"]; | 179 | + func(info_match, championId, win, kills, deaths, assists, 1); |
174 | - var deaths = info_match["participants"][i]["stats"]["deaths"]; | 180 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[2]) + "?api_key=" + apikey; |
175 | - var assists = info_match["participants"][i]["stats"]["assists"]; | 181 | + request(matchUrl, function(error, response, body){ |
176 | - } | 182 | + var info_match = JSON.parse(body); |
177 | - } | 183 | + func(info_match, championId, win, kills, deaths, assists, 2); |
178 | - } | 184 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[3]) + "?api_key=" + apikey; |
185 | + request(matchUrl, function(error, response, body){ | ||
186 | + var info_match = JSON.parse(body); | ||
187 | + func(info_match, championId, win, kills, deaths, assists, 3); | ||
188 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[4]) + "?api_key=" + apikey; | ||
189 | + request(matchUrl, function(error, response, body){ | ||
190 | + var info_match = JSON.parse(body); | ||
191 | + func(info_match, championId, win, kills, deaths, assists, 4); | ||
192 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[5]) + "?api_key=" + apikey; | ||
193 | + request(matchUrl, function(error, response, body){ | ||
194 | + var info_match = JSON.parse(body); | ||
195 | + func(info_match, championId, win, kills, deaths, assists, 5); | ||
196 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[6]) + "?api_key=" + apikey; | ||
197 | + request(matchUrl, function(error, response, body){ | ||
198 | + var info_match = JSON.parse(body); | ||
199 | + func(info_match, championId, win, kills, deaths, assists, 6); | ||
200 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[7]) + "?api_key=" + apikey; | ||
201 | + request(matchUrl, function(error, response, body){ | ||
202 | + var info_match = JSON.parse(body); | ||
203 | + func(info_match, championId, win, kills, deaths, assists, 7); | ||
204 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[8]) + "?api_key=" + apikey; | ||
205 | + request(matchUrl, function(error, response, body){ | ||
206 | + var info_match = JSON.parse(body); | ||
207 | + func(info_match, championId, win, kills, deaths, assists, 8); | ||
208 | + matchUrl = "https://kr.api.riotgames.com/lol/match/v4/matches/" + urlenconde(gameId[9]) + "?api_key=" + apikey; | ||
209 | + request(matchUrl, function(error, response, body){ | ||
210 | + var info_match = JSON.parse(body); | ||
211 | + func(info_match, championId, win, kills, deaths, assists, 9); | ||
179 | champ_name[champ_name.length] = "total"; | 212 | champ_name[champ_name.length] = "total"; |
180 | var temp_id; | 213 | var temp_id; |
181 | var temp_name; | 214 | var temp_name; |
182 | var temp_point; | 215 | var temp_point; |
183 | var temp_pic; | 216 | var temp_pic; |
184 | - for(var i=0; i < champ_id.length-1; i++){ | 217 | + for (var i = 0; i < champ_id.length - 1; i++) { |
185 | - for(var j=i+1;j <champ_id.length-1; j++) | 218 | + for (var j = i + 1; j < champ_id.length - 1; j++) { |
186 | - if(champ_point[i] > champ_point[j]){ | 219 | + if (champ_point[i] > champ_point[j]) { |
187 | temp_id = champ_id[i]; | 220 | temp_id = champ_id[i]; |
188 | temp_name = champ_name[i]; | 221 | temp_name = champ_name[i]; |
189 | temp_point = champ_point[i]; | 222 | temp_point = champ_point[i]; |
190 | temp_pic = champ_pic[i]; | 223 | temp_pic = champ_pic[i]; |
191 | - champ_id[i] = champ_id[j] | 224 | + champ_id[i] = champ_id[j]; |
192 | champ_name[i] = champ_name[j]; | 225 | champ_name[i] = champ_name[j]; |
193 | champ_point[i] = champ_point[j]; | 226 | champ_point[i] = champ_point[j]; |
194 | champ_pic[i] = champ_pic[j]; | 227 | champ_pic[i] = champ_pic[j]; |
195 | - champ_id[j] = temp_id | 228 | + champ_id[j] = temp_id; |
196 | champ_name[j] = temp_name; | 229 | champ_name[j] = temp_name; |
197 | champ_point[j] = temp_point; | 230 | champ_point[j] = temp_point; |
198 | champ_pic[j] = temp_pic; | 231 | champ_pic[j] = temp_pic; |
199 | } | 232 | } |
200 | } | 233 | } |
234 | + } | ||
201 | const defaultMMR = [ | 235 | const defaultMMR = [ |
202 | - {"mmr" : 900, "tier" : "iron", "rank": 4}, | 236 | + {"mmr" : 900, "tier" : "iron", "rank" : 4}, |
203 | - {"mmr" : 950, "tier" : "iron", "rank": 3}, | 237 | + { "mmr" : 950, "tier" : "iron", "rank" : 3 }, |
204 | - {"mmr" : 1000, "tier" : "iron", "rank": 2}, | 238 | + { "mmr" : 1000, "tier" : "iron", "rank" : 2 }, |
205 | - {"mmr" : 1050, "tier" : "iron", "rank": 1}, | 239 | + { "mmr" : 1050, "tier" : "iron", "rank" : 1 }, |
206 | - { "mmr" : 1100, "tier" : "bronze", "rank": 4 }, | 240 | + { "mmr" : 1100, "tier" : "bronze", "rank" : 4 }, |
207 | - { "mmr" : 1150, "tier" : "bronze", "rank": 3 }, | 241 | + { "mmr" : 1150, "tier" : "bronze", "rank" : 3 }, |
208 | - { "mmr" : 1200, "tier" : "bronze", "rank": 2 }, | 242 | + { "mmr" : 1200, "tier" : "bronze", "rank" : 2 }, |
209 | - { "mmr" : 1250, "tier" : "bronze", "rank": 1 }, | 243 | + { "mmr" : 1250, "tier" : "bronze", "rank" : 1 }, |
210 | - { "mmr" : 1300, "tier" : "silver", "rank": 4 }, | 244 | + { "mmr" : 1300, "tier" : "silver", "rank" : 4 }, |
211 | - { "mmr" : 1350, "tier" : "silver", "rank": 3 }, | 245 | + { "mmr" : 1350, "tier" : "silver", "rank" : 3 }, |
212 | - { "mmr" : 1400, "tier" : "silver", "rank": 2 }, | 246 | + { "mmr" : 1400, "tier" : "silver", "rank" : 2 }, |
213 | - { "mmr" : 1450, "tier" : "silver", "rank": 1 }, | 247 | + { "mmr" : 1450, "tier" : "silver", "rank" : 1 }, |
214 | - { "mmr" : 1500, "tier" : "gold", "rank": 4 }, | 248 | + { "mmr" : 1500, "tier" : "gold", "rank" : 4 }, |
215 | - { "mmr" : 1550, "tier" : "gold", "rank": 3 }, | 249 | + { "mmr" : 1550, "tier" : "gold", "rank" : 3 }, |
216 | - { "mmr" : 1600, "tier" : "gold", "rank": 2 }, | 250 | + { "mmr" : 1600, "tier" : "gold", "rank" : 2 }, |
217 | - { "mmr" : 1650, "tier" : "gold", "rank": 1 }, | 251 | + { "mmr" : 1650, "tier" : "gold", "rank" : 1 }, |
218 | - { "mmr" : 1700, "tier" : "platinum", "rank": 4 }, | 252 | + { "mmr" : 1700, "tier" : "platinum", "rank" : 4 }, |
219 | - { "mmr" : 1750, "tier" : "platinum", "rank": 3 }, | 253 | + { "mmr" : 1750, "tier" : "platinum", "rank" : 3 }, |
220 | - { "mmr" : 1800, "tier" : "platinum", "rank": 2 }, | 254 | + { "mmr" : 1800, "tier" : "platinum", "rank" : 2 }, |
221 | - { "mmr" : 1850, "tier" : "platinum", "rank": 1 }, | 255 | + { "mmr" : 1850, "tier" : "platinum", "rank" : 1 }, |
222 | - { "mmr" : 1900, "tier" : "diamond", "rank": 4 }, | 256 | + { "mmr" : 1900, "tier" : "diamond", "rank" : 4 }, |
223 | - { "mmr" : 1950, "tier" : "diamond", "rank": 3 }, | 257 | + { "mmr" : 1950, "tier" : "diamond", "rank" : 3 }, |
224 | - { "mmr" : 2000, "tier" : "diamond", "rank": 2 }, | 258 | + { "mmr" : 2000, "tier" : "diamond", "rank" : 2 }, |
225 | - { "mmr" : 2050, "tier" : "diamond", "rank": 1 }, | 259 | + { "mmr" : 2050, "tier" : "diamond", "rank" : 1 }, |
226 | - { "mmr" : 2100, "tier" : "master", "rank": 1 }, | 260 | + { "mmr" : 2100, "tier" : "master", "rank" : 1 }, |
227 | - { "mmr" : 2700, "tier" : "challenger", "rank": 1 }, | 261 | + { "mmr" : 2700, "tier" : "challenger", "rank" : 1 }, |
228 | ] | 262 | ] |
229 | - | ||
230 | - | ||
231 | - | ||
232 | res.render('index', { title: req.params.username , | 263 | res.render('index', { title: req.params.username , |
233 | - c_id: champ_id, | 264 | + c_id : champ_id, |
234 | - c_name: champ_name, | 265 | + c_name : champ_name, |
235 | - c_point: champ_point, | 266 | + c_point : champ_point, |
236 | - c_pic: champ_pic, | 267 | + c_pic : champ_pic, |
237 | c_rotation : rotation_pic, | 268 | c_rotation : rotation_pic, |
238 | - c_summoner: summoner, | 269 | + c_summoner : summoner, |
239 | - c_wins: wins, | 270 | + c_wins : wins, |
240 | - c_losses: losses, | 271 | + c_losses : losses, |
241 | - c_tier: tier, | 272 | + c_tier : tier, |
242 | - c_imgtier: img_tier, | 273 | + c_imgtier : img_tier, |
243 | - c_rank: rank, | 274 | + c_rank : rank, |
244 | - c_leaguePoint: leaguePoints, | 275 | + c_leaguePoint : leaguePoints, |
245 | c_gameId : gameId, | 276 | c_gameId : gameId, |
246 | c_championId : championId, | 277 | c_championId : championId, |
247 | c_win : win, | 278 | c_win : win, |
248 | c_kills : kills, | 279 | c_kills : kills, |
249 | c_deaths : deaths, | 280 | c_deaths : deaths, |
250 | c_assists : assists, | 281 | c_assists : assists, |
251 | - c_picture : picture | 282 | + c_pic : picture |
283 | + }); | ||
284 | + }); | ||
285 | + }); | ||
286 | + }); | ||
287 | + }); | ||
288 | + }); | ||
289 | + }); | ||
290 | + }); | ||
291 | + }); | ||
252 | }); | 292 | }); |
253 | }); | 293 | }); |
254 | }); | 294 | }); | ... | ... |
... | @@ -2,7 +2,7 @@ module.exports = function(app){ | ... | @@ -2,7 +2,7 @@ module.exports = function(app){ |
2 | 2 | ||
3 | var request = require("request"); | 3 | var request = require("request"); |
4 | var urlenconde = require('urlencode'); | 4 | var urlenconde = require('urlencode'); |
5 | -var apikey = "RGAPI-3b791531-e731-4349-bab0-53068a86608c"//api | 5 | +var apikey = "RGAPI-a0598a8a-a326-4c0d-a115-3f0ae332e86f"//api |
6 | 6 | ||
7 | var profileIconId; //아이콘 번호 | 7 | var profileIconId; //아이콘 번호 |
8 | var revisionDate; //수정날짜 | 8 | var revisionDate; //수정날짜 | ... | ... |
... | @@ -42,7 +42,6 @@ | ... | @@ -42,7 +42,6 @@ |
42 | <tr><td><%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%></td></tr> | 42 | <tr><td><%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%></td></tr> |
43 | <tr><td><%= "Win : " + c_wins + " / Lose : " + c_losses%></td></tr> | 43 | <tr><td><%= "Win : " + c_wins + " / Lose : " + c_losses%></td></tr> |
44 | <tr><td><%= "승률 : " + ((c_wins/(c_wins+c_losses))*100).toFixed(2) + "%" %></td></tr> | 44 | <tr><td><%= "승률 : " + ((c_wins/(c_wins+c_losses))*100).toFixed(2) + "%" %></td></tr> |
45 | - <tr><td><%= "캐리력 : " + (c_wins/c_losses*2).toFixed(2) %></td></tr> | ||
46 | </tbody> | 45 | </tbody> |
47 | </table> | 46 | </table> |
48 | <br></br> | 47 | <br></br> |
... | @@ -53,12 +52,19 @@ | ... | @@ -53,12 +52,19 @@ |
53 | <% for (var i=0; i<c_rotation.length-1; i++){ %> | 52 | <% for (var i=0; i<c_rotation.length-1; i++){ %> |
54 | <img src= <%=c_rotation[i]%> width=50, height=50> | 53 | <img src= <%=c_rotation[i]%> width=50, height=50> |
55 | <% } %> | 54 | <% } %> |
55 | + </div> | ||
56 | <br></br> | 56 | <br></br> |
57 | <% for (var i = 0; i < 10; i++){ %> | 57 | <% for (var i = 0; i < 10; i++){ %> |
58 | - <img src = <%= c_picture[i]%> width = 50, height = 50> | 58 | + <% if (c_win[i]) { %> |
59 | + <%= "승리" %> | ||
60 | + <% } %> | ||
61 | + <% if (!c_win[i]) { %> | ||
62 | + <%= "패배" %> | ||
63 | + <% } %> | ||
64 | + <img src= <%= c_pic[i]%> width=50, height=50> | ||
65 | + <%= c_kills[i] + " / " + c_deaths[i] + " / " + c_assists[i] %> | ||
59 | <br></br> | 66 | <br></br> |
60 | <% } %> | 67 | <% } %> |
61 | - <%= c_kills + " / " + c_deaths + " / " + c_assists %> | ||
62 | </div> | 68 | </div> |
63 | </body> | 69 | </body> |
64 | </html> | 70 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment