Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김세윤
/
LOL_findgg
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김세윤
2020-12-03 19:44:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9d14dffff5c29208c6be6dd9783c10dcf3a4465e
9d14dfff
1 parent
1635e122
챔피언 스탯 추가
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
169 additions
and
33 deletions
RUTROLL/router/Test.js
RUTROLL/views/data.ejs
RUTROLL/views/index.ejs
RUTROLL/views/main.ejs
RUTROLL/router/Test.js
View file @
9d14dff
...
...
@@ -2,12 +2,7 @@ module.exports = function(app){
var
request
=
require
(
"request"
);
var
urlenconde
=
require
(
'urlencode'
);
<<<<<<<
HEAD
var
apikey
=
"RGAPI-26fe9028-bf28-4baa-a0e0-34c116c57742"
//api
=======
var
apikey
=
"RGAPI-e4aabf85-2067-48cb-82ab-39bdf7c07325"
//api
>>>>>>>
2405
bb4c8a3dae402c7d281fdffcda56ffb4ecfb
var
apikey
=
"RGAPI-b504dbbe-5a17-440c-9c4e-1da918946d60"
//api
var
profileIconId
;
//아이콘 번호
var
revisionDate
;
//수정날짜
...
...
@@ -20,7 +15,66 @@ var rotation_champ = new Array();
app
.
get
(
'/'
,
function
(
req
,
res
)
{
res
.
render
(
'main'
,
{
title
:
'R U TROLL?'
});
});
app
.
get
(
'/data/:championname'
,
function
(
req
,
res
,
net
){
var
champ_name
=
req
.
params
.
championname
;
var
champUrl
=
"https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/"
+
urlenconde
(
id
)
+
"?api_key="
+
apikey
;
request
(
champUrl
,
function
(
error
,
response
,
body
){
var
info_champ_json
=
JSON
.
parse
(
body
);
var
champ_id
=
new
Array
();
var
champions_length
=
Object
.
keys
(
info_champ_json
).
length
;
var
staticUrl
=
"http://ddragon.leagueoflegends.com/cdn/10.23.1/data/ko_KR/champion.json"
;
var
title
;
var
blub
;
var
champ_stats
=
new
Array
();
var
champ_pic
;
var
champ_kor
;
request
(
staticUrl
,
function
(
error
,
response
,
body
){
var
info_static_champ_json
=
JSON
.
parse
(
body
);
var
champion
=
info_static_champ_json
[
"data"
];
for
(
js
in
champion
){
for
(
j
in
champion
[
js
]){
if
(
champion
[
js
][
"id"
]
==
champ_name
){
title
=
champion
[
js
][
"title"
];
blub
=
champion
[
js
][
"blurb"
];
champ_kor
=
champion
[
js
][
"name"
];
champ_pic
=
"http://ddragon.leagueoflegends.com/cdn/10.23.1/img/champion/"
+
champ_name
+
".png"
;
champ_stats
[
0
]
=
champion
[
js
][
"stats"
][
"hp"
];
champ_stats
[
1
]
=
champion
[
js
][
"stats"
][
"hpperlevel"
];
champ_stats
[
2
]
=
champion
[
js
][
"stats"
][
"mp"
];
champ_stats
[
3
]
=
champion
[
js
][
"stats"
][
"mpperlevel"
];
champ_stats
[
4
]
=
champion
[
js
][
"stats"
][
"movespeed"
];
champ_stats
[
5
]
=
champion
[
js
][
"stats"
][
"armor"
];
champ_stats
[
6
]
=
champion
[
js
][
"stats"
][
"armorperlevel"
];
champ_stats
[
7
]
=
champion
[
js
][
"stats"
][
"spellblock"
];
champ_stats
[
8
]
=
champion
[
js
][
"stats"
][
"spellblockperlevel"
];
champ_stats
[
9
]
=
champion
[
js
][
"stats"
][
"attackrange"
];
champ_stats
[
10
]
=
champion
[
js
][
"stats"
][
"hpregen"
];
champ_stats
[
11
]
=
champion
[
js
][
"stats"
][
"hpregenperlevel"
];
champ_stats
[
12
]
=
champion
[
js
][
"stats"
][
"mpregen"
];
champ_stats
[
13
]
=
champion
[
js
][
"stats"
][
"mpregenperlevel"
];
champ_stats
[
14
]
=
champion
[
js
][
"stats"
][
"crit"
];
champ_stats
[
15
]
=
champion
[
js
][
"stats"
][
"critperlevel"
];
champ_stats
[
16
]
=
champion
[
js
][
"stats"
][
"attackdamage"
];
champ_stats
[
17
]
=
champion
[
js
][
"stats"
][
"attackdamageperlevel"
];
champ_stats
[
18
]
=
champion
[
js
][
"stats"
][
"attackspeedperlevel"
];
champ_stats
[
19
]
=
champion
[
js
][
"stats"
][
"attackspeed"
];
}
}
}
res
.
render
(
'data'
,{
c_blb
:
blub
,
c_title
:
title
,
c_stats
:
champ_stats
,
c_pic
:
champ_pic
,
c_name
:
champ_kor
})
})
})
})
app
.
get
(
'/search/:username/'
,
function
(
req
,
res
,
next
){
//롤 api url
name
=
req
.
params
.
username
;
...
...
@@ -38,7 +92,6 @@ var rotation_champ = new Array();
var
info_summoner_json
=
JSON
.
parse
(
body
);
<<<<<<<
HEAD
accountId
=
info_summoner_json
[
"accountId"
];
id
=
info_summoner_json
[
"id"
];
summoner
=
info_summoner_json
[
"name"
];
...
...
@@ -50,21 +103,13 @@ var rotation_champ = new Array();
var
profileIcon
;
profileIcon
=
"http://ddragon.leagueoflegends.com/cdn/10.23.1/img/profileicon/"
+
profileIconId
+
".png"
;
=======
accountId
=
info_summoner_json
[
"accountId"
];
// GZC51rstNY47-cmgcap94mfLe7JNjF1fz3dGAdwS6pEo
id
=
info_summoner_json
[
"id"
];
// T6cI_Zn5LEqyPuhCZz1do0Y-IJztJX1I1mvcQZRt9YKygA
summoner
=
info_summoner_json
[
"name"
];
// 환하다 추야
profileIconId
=
info_summoner_json
[
"profileIconId"
];
// 980
summonerLevel
=
info_summoner_json
[
"summonerLevel"
];
// 250
revisionDate
=
info_summoner_json
[
"revisionDate"
];
// 1605519790000
>>>>>>>
2405
bb4c8a3dae402c7d281fdffcda56ffb4ecfb
var
champUrl
=
"https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/"
+
urlenconde
(
id
)
+
"?api_key="
+
apikey
;
request
(
champUrl
,
function
(
error
,
response
,
body
){
var
info_champ_json
=
JSON
.
parse
(
body
);
var
champ_point
=
new
Array
();
var
champ_id
=
new
Array
();
var
champ_name
=
new
Array
();
var
champ_korname
=
new
Array
();
var
rotation_name
=
new
Array
();
var
champ_pic
=
new
Array
();
var
rotation_pic
=
new
Array
();
...
...
@@ -101,8 +146,8 @@ var rotation_champ = new Array();
var
staticUrl
=
"http://ddragon.leagueoflegends.com/cdn/10.23.1/data/
en_US
/champion.json"
;
var
staticUrl
=
"http://ddragon.leagueoflegends.com/cdn/10.23.1/data/
ko_KR
/champion.json"
;
request
(
staticUrl
,
function
(
error
,
response
,
body
){
var
info_static_champ_json
=
JSON
.
parse
(
body
);
var
champion
=
info_static_champ_json
[
"data"
];
...
...
@@ -111,6 +156,7 @@ var rotation_champ = new Array();
for
(
j
in
champion
[
js
]){
if
(
champion
[
js
][
"key"
]
==
champ_id
[
i
]){
champ_name
[
i
]
=
champion
[
js
][
"id"
];
champ_korname
[
i
]
=
champion
[
js
][
"name"
];
champ_pic
[
i
]
=
"http://ddragon.leagueoflegends.com/cdn/10.23.1/img/champion/"
+
champ_name
[
i
]
+
".png"
;
}
...
...
@@ -223,9 +269,11 @@ var rotation_champ = new Array();
res
.
render
(
'index'
,
{
title
:
req
.
params
.
username
,
//데이터를 ejs로 넘길 때 사용
c_lev
:
champ_level
,
c_summonerlev
:
summonerLevel
,
c_profile
:
profileIcon
,
c_id
:
champ_id
,
c_name
:
champ_name
,
c_korname
:
champ_korname
,
c_point
:
champ_point
,
c_pic
:
champ_pic
,
c_rotation
:
rotation_pic
,
...
...
RUTROLL/views/data.ejs
0 → 100644
View file @
9d14dff
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<link
rel=
"icon"
href =
"FindMelogo.png"
>
<link
rel=
"stylesheet"
href=
"css/style.css"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css"
>
<script
src=
"https://code.jquery.com/jquery-3.2.1.min.js"
integrity=
"sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin=
"anonymous"
></script>
<style>
@import
url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css")
;
</style>
<script>
</script>
</head>
<body>
<img
src=
<%=c_pic%
>
width=300, height=300>
<font
size=
10em
>
<strong>
<
%= c_title +"\n"%>
<
%= c_name + "\n"%>
</strong>
</font>
<font
size=
5em
>
<table
border=
"5"
bordercolor=
"blue"
>
<tbody>
<tr>
<td>
<
%= "체력 : "+c_stats[0]+"+ lev*" + c_stats[1]%>
</td>
<td>
<
%= "마력 : "+c_stats[2]+"+ lev*" + c_stats[3]%>
</td>
</tr>
<tr>
<td>
<
%= "체력자연회복량 : "+c_stats[10]+"+ lev*" + c_stats[11]%>
</td>
<td>
<
%= "마력자연회복량 : "+c_stats[12]+"+ lev*" + c_stats[13]%>
</td>
</tr>
<tr>
<td>
<
%= "방어력 : "+c_stats[5]+"+ lev*" + c_stats[6]%>
</td>
<td>
<
%= "마법방어력 : "+c_stats[7]+"+ lev*" + c_stats[8]%>
</td>
</tr>
<tr>
<td>
<
%= "공격력 : "+c_stats[16]+"+ lev*" + c_stats[17]%>
</td>
<td>
<
%= "공격속도 : "+c_stats[19]+"+ lev*" + c_stats[18]+"%"%>
</td>
</tr>
<tr>
<td>
<
%= "이동속도 : "+c_stats[4]%>
</td>
<td>
<
%= "사정거리 : "+c_stats[9]%>
</td>
</tr>
<tr><td>
<
%= "치명타 : "+c_stats[14]+"+ lev*" + c_stats[15]%>
</td>
<td>
</td>
</tr>
<br></br>
</tbody>
</table>
<br></br>
<p>
<
%= c_blb %>
</p>
</font>
</body>
</html>
RUTROLL/views/index.ejs
View file @
9d14dff
...
...
@@ -11,17 +11,13 @@
<style>
@import
url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css")
;
</style>
<script>
$
(
document
).
ready
(
function
(){
$
(
"#enter"
).
on
(
"keypress"
,
function
(
event
){
if
(
event
.
keyCode
==
13
){
var
name
=
$
(
"input"
).
val
();
location
.
href
=
"http://localhost:3000/search/"
+
name
;
}
});
$
(
"button#searchButton"
).
click
(
function
(){
var
name
=
$
(
"input"
).
val
();
location
.
href
=
"http://localhost:3000/search/"
+
name
;
})
});
</script>
</head>
...
...
@@ -49,10 +45,13 @@
<
%= c_summoner + "\n"%>
</strong>
</font>
<font
size=
5em
>
<table
class=
"basic"
>
<tbody>
<tr><td>
<img
src=
<%=c_profile%
>
width=120, height=120>
</td></tr>
<tr><td>
<
%= "소환사 레벨 : "+c_summonerlev%>
</td></tr>
<tr><td>
<img
src=
<%=c_imgtier%
>
width=120, height=120>
</td></tr>
<tr><td>
<
%= "Tier : " + c_tier + " " + c_rank + " / " + c_leaguePoint + "점"%>
</td></tr>
<tr><td>
<
%= "Win : " + c_wins + " / Lose : " + c_losses%>
</td></tr>
...
...
@@ -61,7 +60,7 @@
</tbody>
</table>
<br></br>
<div
class=
"center"
>
...
...
@@ -107,9 +106,12 @@
<
% for (var i=0; i
<c
_id
.
length-1
;
i
++){
%
>
<div
class=
"champImage"
>
<div
class=
"center"
>
<img
src=
<%=c_pic[i]%
>
width=50, height=50>
<input
type=
"image"
src=
<%=c_pic[i]%
>
onClick="location.href='http://localhost:3000/data/'+ '
<
%=c_name[i]%>'">
<B>
<
%= c_name[i] %>
<
%= c_
kor
name[i] %>
</B>
<
%= "point: " + c_point[i]+ " \tchampion level: " + c_lev[i] %>
...
...
@@ -118,5 +120,6 @@
</div>
</font>
</body>
</html>
...
...
RUTROLL/views/main.ejs
View file @
9d14dff
...
...
@@ -11,12 +11,7 @@
<style>
@import
url("http://fonts.googleapis.com/earlyaccess/nanumgothic.css")
;
</style>
<script>
$
(
document
).
ready
(
function
(){
$
(
"#enter"
).
on
(
"keypress"
,
function
(
event
){
if
(
event
.
keyCode
==
13
){
var
name
=
$
(
"input"
).
val
();
location
.
href
=
"http://localhost:3000/search/"
+
name
;
}
});
$
(
"button#searchButton"
).
click
(
function
(){
var
name
=
$
(
"input"
).
val
();
...
...
Please
register
or
login
to post a comment