Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장재훈
/
TFT_Chat_Bot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
장재훈
2020-06-25 00:36:34 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e28f8b9024e970d750b3010a7225afa3d38c86e2
e28f8b90
1 parent
018838ff
complete item.js
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
23 deletions
data/item.js
data/json data/items.json
data/item.js
View file @
e28f8b9
...
...
@@ -11,11 +11,13 @@ const itemData = JSON.parse(itemRawData);
exports
.
basicItemFunction
=
function
(
req
,
res
){
var
responseBody
=
{};
const
itemName
=
req
.
body
[
"action"
][
"params"
][
"basic_item_name"
];
console
.
log
(
itemName
);
if
(
itemName
==
undefined
){
var
itemList
=
""
;
for
(
var
i
=
0
;
i
<
itemData
.
length
;
++
i
){
if
(
itemData
[
i
].
type
==
"basic"
)
itemList
+=
(
itemData
[
i
].
name
+
'\n'
);
if
(
itemData
[
i
].
type
==
"basic"
){
itemList
+=
(
itemData
[
i
].
name
+
'\n'
);
}
};
responseBody
=
{
"version"
:
"2.0"
,
...
...
@@ -23,7 +25,7 @@ exports.basicItemFunction = function(req,res){
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
"원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n
현재 존재하는 기본
아이템 목록 :\n"
+
itemList
"text"
:
"원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n
\n현재 존재하는 완성
아이템 목록 :\n"
+
itemList
}
}
...
...
@@ -40,22 +42,34 @@ exports.basicItemFunction = function(req,res){
break
;
}
};
itemPictureNum
=
"0"
+
itemData
[
index
].
id
;
var
itemCombination
=
{};
for
(
const
elem1
in
itemData
[
index
].
comination
){
for
(
var
i
=
0
;
i
<
itemData
.
length
;
++
i
){
if
(
itemData
[
i
].
id
==
elem1
){
for
(
const
elem2
in
itemData
[
i
].
material
){
for
(
var
j
=
0
;
j
<
itemData
.
length
;
++
i
){
if
(
itemData
[
j
].
id
==
elem2
&&
itemData
[
j
].
id
!=
itemData
[
index
].
id
){
itemCombination
+=
(
itemData
[
index
].
name
+
" + "
+
itemData
[
j
].
name
+
" = "
+
itemData
[
i
].
name
+
'\n'
);
}
}
}
console
.
log
(
itemData
[
index
].
effect
);
var
itemCombination
=
""
;
for
(
var
i
in
itemData
[
index
].
combination
){
let
left
=
itemData
[
index
].
combination
[
i
].
toString
().
substr
(
0
,
1
);
let
right
=
itemData
[
index
].
combination
[
i
].
toString
().
substr
(
1
,
2
);
for
(
var
j
=
0
;
j
<
itemData
.
length
;
++
j
){
if
(
itemData
[
j
].
id
==
left
){
itemCombination
+=
(
itemData
[
j
].
name
+
" + "
);
}
}
for
(
var
j
=
0
;
j
<
itemData
.
length
;
++
j
){
if
(
itemData
[
j
].
id
==
right
){
itemCombination
+=
(
itemData
[
j
].
name
+
" = "
);
}
}
for
(
var
j
=
0
;
j
<
itemData
.
length
;
++
j
){
if
(
itemData
[
j
].
id
==
itemData
[
index
].
combination
[
i
]){
itemCombination
+=
(
itemData
[
j
].
name
+
'\n'
);
}
}
}
responseBody
=
{
"version"
:
"2.0"
,
"template"
:
{
...
...
@@ -63,10 +77,17 @@ exports.basicItemFunction = function(req,res){
{
"basicCard"
:
{
"title"
:
itemName
,
"description"
:
"효과 : "
+
itemData
[
i
].
effect
+
"\n"
+
"조합가능한 아이템 :
"
+
itemCombination
,
"description"
:
"효과 : "
+
itemData
[
i
ndex
].
effect
+
'\n'
+
"조합가능한 아이템 : \n
"
+
itemCombination
,
"thumbnail"
:
{
"imageUrl"
:
"http://tft-helper.tk:23023/static/items/"
+
itemData
[
index
].
id
+
".png"
}
"imageUrl"
:
"http://tft-helper.tk:23023/static/items/"
+
itemPictureNum
+
".png"
},
"buttons"
:
[
{
"action"
:
"block"
,
"label"
:
"아이템 목록으로 돌아가기"
,
"blockId"
:
"5ee0d73f127dbe0001aa6647"
}
]
}
}
]
...
...
@@ -79,11 +100,13 @@ exports.basicItemFunction = function(req,res){
exports
.
completedItemFunction
=
function
(
req
,
res
){
var
responseBody
=
{};
const
itemName
=
req
.
body
[
"action"
][
"params"
][
"completed_item_name"
];
console
.
log
(
itemName
);
if
(
itemName
==
undefined
){
var
itemList
=
""
;
for
(
var
i
=
0
;
i
<
itemData
.
length
;
++
i
){
if
(
itemData
[
i
].
type
==
"completed"
)
itemList
+=
(
itemData
[
i
].
name
+
'\n'
);
if
(
itemData
[
i
].
type
==
"completed"
){
itemList
+=
(
itemData
[
i
].
name
+
'\n'
);
}
};
responseBody
=
{
"version"
:
"2.0"
,
...
...
@@ -91,7 +114,7 @@ exports.completedItemFunction = function(req,res){
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
"원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n
현재 존재하는 완성 아이템 목록 :\n"
+
itemList
"text"
:
"원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n
\n현재 존재하는 완성 아이템 목록 :\n"
+
itemList
}
}
...
...
@@ -100,11 +123,58 @@ exports.completedItemFunction = function(req,res){
}
res
.
status
(
200
).
send
(
responseBody
);
}
else
{
var
index
=
0
;
for
(
index
;
index
<
itemData
.
length
;
++
index
){
if
(
itemData
[
index
].
name
==
itemName
){
break
;
}
};
const
itemPictureNum
=
itemData
[
index
].
id
;
var
itemCombination
=
(
itemName
+
" = "
);
let
left
=
itemData
[
index
].
material
[
0
];
let
right
=
itemData
[
index
].
material
[
1
];
for
(
var
i
=
0
;
i
<
itemData
.
length
;
++
i
){
if
(
itemData
[
i
].
id
==
left
){
itemCombination
+=
(
itemData
[
i
].
name
+
" + "
);
}
if
(
itemData
[
i
].
id
==
right
){
itemCombination
+=
(
itemData
[
i
].
name
);
}
}
responseBody
=
{
"version"
:
"2.0"
,
"template"
:
{
"outputs"
:
[
{
"basicCard"
:
{
"title"
:
itemName
,
"description"
:
"효과 : "
+
itemData
[
index
].
effect
+
'\n'
+
"조합식 : \n"
+
itemCombination
,
"thumbnail"
:
{
"imageUrl"
:
"http://tft-helper.tk:23023/static/items/"
+
itemPictureNum
+
".png"
},
"buttons"
:
[
{
"action"
:
"block"
,
"label"
:
"아이템 목록으로 돌아가기"
,
"blockId"
:
"5ee0d73f127dbe0001aa6647"
}
]
}
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
}
}
exports
.
consumableItemFunction
=
function
(
req
,
res
){
var
responseBody
=
{};
const
itemName
=
req
.
body
[
"action"
][
"params"
][
"consumable_item_name"
];
console
.
log
(
itemName
);
if
(
itemName
==
undefined
){
responseBody
=
{
"version"
:
"2.0"
,
...
...
@@ -112,7 +182,7 @@ exports.consumableItemFunction = function(req,res){
"outputs"
:
[
{
"simpleText"
:
{
"text"
:
"원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n현재 존재하는 완성 아이템 목록 :\n니코의 도움"
"text"
:
"원하시는 아이템 이름(줄임말 포함)을 입력하시면 해당 아이템에 대한 정보를 확인할 수 있습니다!\n
\n
현재 존재하는 완성 아이템 목록 :\n니코의 도움"
}
}
...
...
@@ -121,4 +191,39 @@ exports.consumableItemFunction = function(req,res){
}
res
.
status
(
200
).
send
(
responseBody
);
}
}
\ No newline at end of file
else
{
var
index
=
0
;
for
(
index
;
index
<
itemData
.
length
;
++
index
){
if
(
itemData
[
index
].
name
==
itemName
){
break
;
}
};
const
itemPictureNum
=
itemData
[
index
].
id
;
responseBody
=
{
"version"
:
"2.0"
,
"template"
:
{
"outputs"
:
[
{
"basicCard"
:
{
"title"
:
itemName
,
"description"
:
"효과 : "
+
itemData
[
index
].
effect
,
"thumbnail"
:
{
"imageUrl"
:
"http://tft-helper.tk:23023/static/items/"
+
itemPictureNum
+
".png"
},
"buttons"
:
[
{
"action"
:
"block"
,
"label"
:
"아이템 목록으로 돌아가기"
,
"blockId"
:
"5ee0d73f127dbe0001aa6647"
}
]
}
}
]
}
}
res
.
status
(
200
).
send
(
responseBody
);
}
};
\ No newline at end of file
...
...
data/json data/items.json
View file @
e28f8b9
...
...
@@ -59,7 +59,7 @@
"type"
:
"basic"
,
"id"
:
9
,
"name"
:
"연습용 장갑"
,
"effect"
:
"치명타 확률 +10%
'
\n
회피 확률 +10%"
,
"effect"
:
"치명타 확률 +10%
,
회피 확률 +10%"
,
"combination"
:
[
19
,
29
,
39
,
49
,
59
,
69
,
79
,
89
,
99
]
},
{
...
...
Please
register
or
login
to post a comment