Toggle navigation
Toggle navigation
This project
Loading...
Sign in
황성연
/
lolinfo.gg
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-18 10:24:12 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cbf3bb96f0088c59b063ff53543d2f2eeae2abf1
cbf3bb96
1 parent
e64a66af
SPECTATOR-V4 api 추가
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
7 deletions
lolinfo/router/mytest.js
lolinfo/router/mytest.js
View file @
cbf3bb9
...
...
@@ -93,11 +93,19 @@ module.exports = function(app){
var
staticUrl
=
"http://ddragon.leagueoflegends.com/cdn/10.11.1/data/en_US/champion.json"
;
request
(
staticUrl
,
function
(
error
,
response
,
body
)
{
var
info_static_champ_json
=
JSON
.
parse
(
body
);
console
.
log
(
info_static_champ_json
);
console
.
log
(
info_static_champ_json
.
data
);
var
champion
=
info_static_champ_json
[
"data"
];
for
(
var
i
=
0
;
i
<
champ_id
.
length
;
i
++
){
for
(
js
in
champion
){
for
(
j
in
champion
[
js
]){
var
champ_count
=
0
;
for
(
var
name
in
champion
)
{
if
(
champion
.
hasOwnProperty
(
name
))
{
champ_count
++
;
}
}
for
(
var
i
=
0
;
i
<
champ_count
;
i
++
){
for
(
js
in
champion
)
{
for
(
j
in
champion
[
js
])
{
if
(
champion
[
js
][
"key"
]
==
champ_id
[
i
]){
champ_name
[
i
]
=
champion
[
js
][
"id"
];
champ_pic
[
i
]
=
"http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"
+
champ_name
[
i
]
+
".png"
;
...
...
@@ -106,7 +114,7 @@ module.exports = function(app){
}
}
}
for
(
var
i
=
0
;
i
<
champ_
id
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
champ_
count
;
i
++
){
for
(
js
in
champion
){
for
(
j
in
champion
[
js
]){
if
(
champion
[
js
][
"key"
]
==
rotation_champ
[
i
]){
...
...
@@ -122,7 +130,7 @@ module.exports = function(app){
}
console
.
log
(
rotation_name
);
console
.
log
(
"챔프길이:"
+
champ_pic
.
length
);
console
.
log
(
"챔프길이:"
+
champ_count
);
var
userLeagueUrl
=
"https://kr.api.riotgames.com/lol/league/v4/entries/by-summoner/"
+
urlenconde
(
id
)
+
"?api_key="
+
apikey
;
request
(
userLeagueUrl
,
function
(
error
,
response
,
body
){
...
...
@@ -211,8 +219,13 @@ module.exports = function(app){
var
spectatorUrl
=
"https://kr.api.riotgames.com/lol/spectator/v4/active-games/by-summoner/"
+
urlenconde
(
id
)
+
"?api_key="
+
apikey
;
request
(
spectatorUrl
,
function
(
error
,
response
,
body
)
{
var
spectator_json
=
JSON
.
parse
(
body
);
var
flag
=
true
;
if
(
response
.
statusCode
!=
200
)
flag
=
false
;
if
(
flag
)
{
var
spectator_json
=
JSON
.
parse
(
body
);
console
.
log
(
spectator_json
);
var
spec_bannedChamp
=
spectator_json
.
bannedChampions
;
var
spec_gameId
=
spectator_json
.
gameId
;
...
...
@@ -222,6 +235,33 @@ module.exports = function(app){
var
spec_mapId
=
spectator_json
.
mapId
;
var
spec_participants
=
spectator_json
.
participants
;
// var spec_bannedChamp_Id = new Array();
var
spec_bannedChamp_image
=
new
Array
();
var
spec_selectedChamp_image
=
new
Array
();
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
if
((
spec_bannedChamp
[
i
]).
championId
==
-
1
)
continue
;
for
(
var
key
in
champion
)
{
if
(
champion
.
hasOwnProperty
(
key
)
&&
champion
[
key
].
key
==
spec_bannedChamp
[
i
].
championId
)
{
spec_bannedChamp_image
.
push
(
"http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"
+
champion
[
key
].
id
+
".png"
);
}
if
(
champion
.
hasOwnProperty
(
key
)
&&
champion
[
key
].
key
==
spec_participants
[
i
].
championId
)
{
spec_selectedChamp_image
.
push
(
"http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/"
+
champion
[
key
].
id
+
".png"
);
}
}
}
console
.
log
(
spec_bannedChamp_image
);
console
.
log
(
spec_selectedChamp_image
);
}
...
...
Please
register
or
login
to post a comment