Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-arena-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-arena-api
Commits
9dca4fc2
Commit
9dca4fc2
authored
Jul 18, 2017
by
ganjingcun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入电子界
parent
57c520a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
6 deletions
+47
-6
.gitignore
.gitignore
+2
-0
cardinfo.json
cardinfo.json
+2
-0
routes/api.js
routes/api.js
+43
-6
No files found.
.gitignore
View file @
9dca4fc2
...
...
@@ -9,3 +9,5 @@ db.config.js
test.js
db.sql
upload/
plan.md
query.sql
cardinfo.json
View file @
9dca4fc2
...
...
@@ -31,6 +31,7 @@
"1041"
:
"幻神兽"
,
"1042"
:
"创造神"
,
"1043"
:
"幻龙"
,
"1044"
:
"电子界"
,
"1050"
:
"怪兽"
,
"1051"
:
"魔法"
,
"1052"
:
"陷阱"
,
...
...
@@ -89,6 +90,7 @@
"1041"
:
"Divine-Beast"
,
"1042"
:
"Creator God"
,
"1043"
:
"Wyrm"
,
"1044"
:
"Cyberse"
,
"1050"
:
"Monster"
,
"1051"
:
"Spell"
,
"1052"
:
"Trap"
,
...
...
routes/api.js
View file @
9dca4fc2
...
...
@@ -17,6 +17,19 @@ var attrOffset = 1010
var
raceOffset
=
1020
var
typeOffset
=
1050
var
constants
=
{
"
LINK_MARKERS
"
:
{
"
LINK_MARKER_BOTTOM_LEFT
"
:
1
,
"
LINK_MARKER_BOTTOM
"
:
2
,
"
LINK_MARKER_BOTTOM_RIGHT
"
:
4
,
"
LINK_MARKER_LEFT
"
:
8
,
"
LINK_MARKER_RIGHT
"
:
32
,
"
LINK_MARKER_TOP_LEFT
"
:
64
,
"
LINK_MARKER_TOP
"
:
128
,
"
LINK_MARKER_TOP_RIGHT
"
:
256
}
}
//this initializes a connection pool
//it will keep idle connections open for a 30 seconds
//and set a limit of maximum 10 idle clients
...
...
@@ -146,7 +159,7 @@ router.post('/score', function (req, res) {
entertain_draw
:
0
,
entertain_all
:
1
,
}
var
winner
=
"
none
"
var
winner
=
"
none
"
var
firstWin
=
false
...
...
@@ -155,8 +168,8 @@ router.post('/score', function (req, res) {
// select count(*) from battle_history where (usernameA = '爱吉' OR usernameB = '爱吉') and start_time > date '2017-02-09'
// 日首胜 每日0点开始计算 日首胜的话是额外增加固定4DP
var
today
=
moment
().
format
(
'
YYYY-MM-DD
'
)
// 真实得分 S(胜=1分,和=0.5分,负=0分)
...
...
@@ -256,12 +269,12 @@ router.post('/score', function (req, res) {
if
(
userscoreA
>
userscoreB
)
{
paramA
[
'
entertain_win
'
]
=
1
paramB
[
'
entertain_lose
'
]
=
1
winner
=
usernameA
winner
=
usernameA
}
if
(
userscoreA
<
userscoreB
)
{
paramA
[
'
entertain_lose
'
]
=
1
paramB
[
'
entertain_win
'
]
=
1
winner
=
usernameB
winner
=
usernameB
}
if
(
userscoreA
===
userscoreB
)
{
paramA
[
'
entertain_draw
'
]
=
1
...
...
@@ -282,7 +295,7 @@ router.post('/score', function (req, res) {
entertain_all = entertain_all +
${
paramB
.
entertain_all
}
where username = '
${
userB
.
username
}
'`
)
queries
.
push
(
`insert into battle_history values (
'
${
userA
.
username
}
',
...
...
@@ -417,8 +430,32 @@ router.get('/cardinfo', function (req, res) {
result
.
alias
=
row
.
alias
result
.
setcode
=
row
.
setcode
result
.
atk
=
row
.
atk
result
.
def
=
row
.
def
// 电子界 特殊处理防御
if
(
row
.
race
==
16777216
)
{
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_TOP_LEFT
)
result
.
name
+=
"
[↖]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_TOP
)
result
.
name
+=
"
[↑]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_TOP_RIGHT
)
result
.
name
+=
"
[↗]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_LEFT
)
result
.
name
+=
"
[←]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_RIGHT
)
result
.
name
+=
"
[→]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_BOTTOM_LEFT
)
result
.
name
+=
"
[↙]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_BOTTOM
)
result
.
name
+=
"
[↓]
"
;
if
(
result
.
def
&
constants
.
LINK_MARKERS
.
LINK_MARKER_BOTTOM_RIGHT
)
result
.
name
+=
"
[↘]
"
;
result
.
def
=
'
-
'
}
if
(
row
.
level
<=
12
)
{
result
.
level
=
row
.
level
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment