Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이정호
/
lolhelper
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이정호
2020-06-25 11:02:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
384fea5f8a0e00bd6020d1479cc8b8ab12c96443
384fea5f
1 parent
0e2e6784
final final
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
72 deletions
LOL_Helper/ReadMe.md
LOL_Helper/app.js
LOL_Helper/router/Test.js
LOL_Helper/router/main.js
LOL_Helper/views/index.ejs
LOL_Helper/ReadMe.md
View file @
384fea5
...
...
@@ -5,6 +5,14 @@
-
`Riot Games Api`
를 통한 리그오브레전드 전적검색 사이트 만들기
## 설치 방법
-
예시 코드 - git clone http://khuhub.khu.ac.kr/2019102212/lolhelper.git
## 사용 방법
-
실행 후 소환사명을 검색하면 됨
## 활용 가능한 데이터 `(API_KEY Required.)`
### `SUMMONER-V4`
...
...
@@ -17,19 +25,6 @@
-
암호화된 소환사 아이디 -
`id`
-
암호화된 계정 아이디 -
`accountId`
### `CHAMPION-MASTERY-V4`
> https://kr.api.riotgames.com/lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerId}
-
챔피언 아이디 -
`championId`
-
챔피언 숙련도 레벨 -
`championLevel`
-
챔피언 숙련도 점수 -
`championPoints`
-
챔피언 남은 숙련도 점수 -
`championPointsUntilNextLevel`
(5레벨에 0 고정)
-
마지막 플레이 시각 -
`lastPlayTime`
-
챔피언 레벨 토큰 개수 -
`tokensEarned`
(5레벨 이후를 위한 토큰)
-
마지막 챔피언 레벨 이후의 숙련도 점수 -
`championPointsSinceLastLevel`
-
소환사 아이디 -
`summonerId`
(암호화)
### `CHAMPION-V3`
> https://kr.api.riotgames.com/lol/platform/v3/champion-rotations
...
...
@@ -37,6 +32,36 @@
-
금주의 무료 챔피언 -
`freeChampionIds`
-
뉴비를 위한 무료 챔피언 -
`freeChampionIdsForNewPlayers`
### `LEAGUE-V4`
> https://kr.api.riotgames.com/lol/league/v4/entries/by-summoner/{encryptedSummonerId}
-
승리 -
`wins`
-
패배 -
`losses`
-
티어 -
`tier`
-
랭크 -
`rank`
-
LP -
`leaguePoints`
### `MATCH-V4`
> https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/{encryptedAccountId}
-
매치 아이디 -
`gameId`
> https://kr.api.riotgames.com/lol/match/v4/matches/{matchId}
-
매치 길이 -
`gameDuration`
-
플레이한 챔피언 -
`championId`
-
승리 여부 -
`win`
-
킬 -
`kills`
-
데스 -
`deaths`
-
어시스트 -
`assists`
-
멀티킬 -
`largestMultiKill`
-
가한 피해량 -
`totalDamageDealtToChampion`
-
받은 피해량 -
`totalDamageTaken`
-
획득 골드 -
`goldEarned`
-
퍼스트 블러드 -
`firstBloodKill`
## 개발 히스토리
-
2020-05-14
-
개발툴 및 환경 설정, 주제 선정
...
...
@@ -47,8 +72,11 @@
-
2020-06-06
-
css 수정, 전적 검색 기능 추가
-
2020-06-
-
최종 미팅, 프로젝트 점검 및 발표자료 작성
-
2020-06-20
-
불필요한 데이터 제거, Carry Point 기능 추가
-
2020-06-24
-
프로젝트 점검 및 발표자료 작성
```python
...
...
LOL_Helper/app.js
View file @
384fea5
...
...
@@ -7,7 +7,7 @@ app.set('views', __dirname + '/views');
app
.
set
(
'view engine'
,
'ejs'
);
app
.
engine
(
'html'
,
require
(
'ejs'
).
renderFile
);
var
server
=
app
.
listen
(
3000
,
function
(){
var
server
=
app
.
listen
(
3000
,
function
()
{
console
.
log
(
'Success'
);
});
...
...
LOL_Helper/router/Test.js
View file @
384fea5
...
...
@@ -5,7 +5,12 @@ function func(info_match, championId, win, kills, deaths, assists, kda, largestM
kills
[
num
]
=
info_match
[
"participants"
][
i
][
"stats"
][
"kills"
];
deaths
[
num
]
=
info_match
[
"participants"
][
i
][
"stats"
][
"deaths"
];
assists
[
num
]
=
info_match
[
"participants"
][
i
][
"stats"
][
"assists"
];
kda
[
num
]
=
(
kills
[
num
]
+
assists
[
num
])
/
deaths
[
num
];
if
(
deaths
[
num
]
==
0
)
{
kda
[
num
]
=
(
kills
[
num
]
+
assists
[
num
])
*
2
}
if
(
deaths
[
num
]
!=
0
)
{
kda
[
num
]
=
(
kills
[
num
]
+
assists
[
num
])
/
deaths
[
num
];
}
largestMultiKill
[
num
]
=
info_match
[
"participants"
][
i
][
"stats"
][
"largestMultiKill"
];
temp
[
num
]
=
kda
[
num
]
*
(
info_match
[
"participants"
][
i
][
"stats"
][
"totalDamageDealtToChampions"
]
+
info_match
[
"participants"
][
i
][
"stats"
][
"totalDamageTaken"
]
*
info_match
[
"participants"
][
i
][
"stats"
][
"goldEarned"
]
/
info_match
[
"gameDuration"
])
/
10000
;
firstBloodKill
[
num
]
=
info_match
[
"participants"
][
i
][
"stats"
][
"firstBloodKill"
];
...
...
@@ -56,7 +61,6 @@ module.exports = function(app) {
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
rotation_name
=
new
Array
();
...
...
@@ -73,7 +77,6 @@ module.exports = function(app) {
}
for
(
var
i
=
0
;
i
<
champions_length
;
i
++
)
{
champ_point
[
i
]
=
(
info_champ_json
[
i
][
"championPoints"
]);
champ_id
[
i
]
=
info_champ_json
[
i
][
"championId"
];
}
var
rotationUrl
=
"https://kr.api.riotgames.com/lol/platform/v3/champion-rotations?api_key="
+
apikey
;
...
...
@@ -111,10 +114,8 @@ module.exports = function(app) {
request
(
userLeagueUrl
,
function
(
error
,
response
,
body
){
var
info_user_league_json
=
JSON
.
parse
(
body
);
if
(
info_user_league_json
[
0
]
!=
null
)
{
var
leagueId
=
info_user_league_json
[
0
][
"leagueId"
];
var
wins
=
info_user_league_json
[
0
][
"wins"
];
var
losses
=
info_user_league_json
[
0
][
"losses"
];
var
leagueName
=
info_user_league_json
[
0
][
"leagueName"
];
var
tier
=
info_user_league_json
[
0
][
"tier"
];
var
rank
=
info_user_league_json
[
0
][
"rank"
];
var
leaguePoints
=
info_user_league_json
[
0
][
"leaguePoints"
];
...
...
@@ -216,28 +217,7 @@ module.exports = function(app) {
var
info_match
=
JSON
.
parse
(
body
);
func
(
info_match
,
championId
,
win
,
kills
,
deaths
,
assists
,
kda
,
largestMultiKill
,
temp
,
firstBloodKill
,
9
);
champ_name
[
champ_name
.
length
]
=
"total"
;
var
temp_id
;
var
temp_name
;
var
temp_point
;
var
temp_pic
;
for
(
var
i
=
0
;
i
<
champ_id
.
length
-
1
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
champ_id
.
length
-
1
;
j
++
)
{
if
(
champ_point
[
i
]
>
champ_point
[
j
])
{
temp_id
=
champ_id
[
i
];
temp_name
=
champ_name
[
i
];
temp_point
=
champ_point
[
i
];
temp_pic
=
champ_pic
[
i
];
champ_id
[
i
]
=
champ_id
[
j
];
champ_name
[
i
]
=
champ_name
[
j
];
champ_point
[
i
]
=
champ_point
[
j
];
champ_pic
[
i
]
=
champ_pic
[
j
];
champ_id
[
j
]
=
temp_id
;
champ_name
[
j
]
=
temp_name
;
champ_point
[
j
]
=
temp_point
;
champ_pic
[
j
]
=
temp_pic
;
}
}
}
const
defaultMMR
=
[
{
"mmr"
:
900
,
"tier"
:
"iron"
,
"rank"
:
4
},
{
"mmr"
:
950
,
"tier"
:
"iron"
,
"rank"
:
3
},
...
...
@@ -269,7 +249,6 @@ module.exports = function(app) {
res
.
render
(
'index'
,
{
title
:
req
.
params
.
username
,
c_id
:
champ_id
,
c_name
:
champ_name
,
c_point
:
champ_point
,
c_pic
:
champ_pic
,
c_rotation
:
rotation_pic
,
c_summoner
:
summoner
,
...
...
LOL_Helper/router/main.js
View file @
384fea5
...
...
@@ -33,21 +33,17 @@ module.exports = function(app) {
request
(
champUrl
,
function
(
error
,
response
,
body
)
{
var
info_champ_json
=
JSON
.
parse
(
body
);
var
champions
=
info_champ_json
[
"champions"
];
var
champ_point
=
new
Array
();
var
champ_id
=
new
Array
();
var
champ_name
=
new
Array
();
var
champ_pic
=
new
Array
();
var
champions_length
=
Object
.
keys
(
champions
).
length
;
for
(
var
i
=
0
;
i
<
champions_length
;
i
++
)
{
champ_point
[
i
]
=
(
champions
[
i
][
"stats"
][
"totalSessionsWon"
]
/
champions
[
i
][
"stats"
][
"totalSessionsPlayed"
]
*
200
)
+
((
champions
[
i
][
"stats"
][
"totalAssists"
]
+
champions
[
i
][
"stats"
][
"totalChampionKills"
])
/
champions
[
i
][
"stats"
][
"totalDeathsPerSession"
]
*
100
)
+
(
champions
[
i
][
"stats"
][
"totalSessionsPlayed"
]
*
3
);
champ_id
[
i
]
=
champions
[
i
][
"id"
];
}
var
staticUrl
=
"https://global.api.pvp.net/api/lol/static-data/kr/v1.2/champion/?api_key="
+
apikey
;
request
(
staticUrl
,
function
(
error
,
response
,
body
){
request
(
staticUrl
,
function
(
error
,
response
,
body
)
{
var
info_static_champ_json
=
JSON
.
parse
(
body
);
var
champion
=
info_static_champ_json
[
"data"
];
for
(
var
i
=
0
;
i
<
champ_id
.
length
;
i
++
)
{
...
...
@@ -61,31 +57,10 @@ module.exports = function(app) {
}
}
champ_name
[
champ_name
.
length
]
=
"total"
;
var
temp_id
;
var
temp_name
;
var
temp_point
;
var
temp_pic
;
for
(
var
i
=
0
;
i
<
champ_id
.
length
-
1
;
i
++
)
{
for
(
var
j
=
i
+
1
;
j
<
champ_id
.
length
-
1
;
j
++
)
if
(
champ_point
[
i
]
>
champ_point
[
j
])
{
temp_id
=
champ_id
[
i
];
temp_name
=
champ_name
[
i
];
temp_point
=
champ_point
[
i
];
temp_pic
=
champ_pic
[
i
];
champ_id
[
i
]
=
champ_id
[
j
];
champ_name
[
i
]
=
champ_name
[
j
];
champ_point
[
i
]
=
champ_point
[
j
];
champ_pic
[
i
]
=
champ_pic
[
j
];
champ_id
[
j
]
=
temp_id
;
champ_name
[
j
]
=
temp_name
;
champ_point
[
j
]
=
temp_point
;
champ_pic
[
j
]
=
temp_pic
;
}
}
res
.
render
(
'index'
,
{
title
:
req
.
params
.
username
,
c_id
:
champ_id
,
c_name
:
champ_name
,
c_point
:
champ_point
,
c_pic
:
champ_pic
,
c_summoner
:
summoner
});
...
...
LOL_Helper/views/index.ejs
View file @
384fea5
...
...
@@ -24,7 +24,7 @@
<img
src =
"/FindMelogo.png"
width =
150,
height =
150/
>
</div>
<div
class =
"center2"
>
<input
type =
"text"
class =
"input_text"
placeholder =
"소환사
이름
"
>
<input
type =
"text"
class =
"input_text"
placeholder =
"소환사
명
"
>
<span
class =
"input-group-btn"
>
<button
id =
"searchButton"
class =
"btn btn-primary"
type =
"button"
onclick =
"search(name)"
>
click!
</button>
</span>
...
...
Please
register
or
login
to post a comment