Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Revive
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 Revive
Commits
cbf837a6
Commit
cbf837a6
authored
May 01, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sql-pt' into 'master'
use sql calc in post score See merge request
!1
parents
68a40801
a2185368
Pipeline
#3080
passed with stages
in 6 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
32 deletions
+42
-32
src/EloUtility.ts
src/EloUtility.ts
+16
-6
src/app.service.ts
src/app.service.ts
+26
-26
No files found.
src/EloUtility.ts
View file @
cbf837a6
export
class
EloUtility
{
export
class
EloUtility
{
static
getSqlString
(
num
:
number
)
{
if
(
num
===
0
||
!
num
)
{
return
''
;
}
else
if
(
num
>
0
)
{
return
`+
${
num
}
`
;
}
else
{
return
`-
${
-
num
}
`
;
}
}
static
getExpScore
(
static
getExpScore
(
expA
:
number
,
expA
:
number
,
expB
:
number
,
expB
:
number
,
scoreA
:
number
,
scoreA
:
number
,
scoreB
:
number
,
scoreB
:
number
,
)
{
)
{
let
rExpA
=
expA
,
let
rExpA
=
0
,
rExpB
=
expB
;
rExpB
=
0
;
if
(
scoreA
===
scoreB
)
{
if
(
scoreA
===
scoreB
)
{
rExpA
+=
0.5
;
rExpA
+=
0.5
;
rExpB
+=
0.5
;
rExpB
+=
0.5
;
...
@@ -22,7 +32,7 @@ export class EloUtility {
...
@@ -22,7 +32,7 @@ export class EloUtility {
static
getEloScore
(
rA
:
number
,
rB
:
number
,
sA
:
number
,
sB
:
number
)
{
static
getEloScore
(
rA
:
number
,
rB
:
number
,
sA
:
number
,
sB
:
number
)
{
//17.07.18 增加规则,平局不加分.
//17.07.18 增加规则,平局不加分.
if
(
sA
===
sB
)
{
if
(
sA
===
sB
)
{
return
{
ptA
:
rA
,
ptB
:
rB
};
return
{
ptA
:
0
,
ptB
:
0
};
}
}
const
k
=
24
;
const
k
=
24
;
...
@@ -52,7 +62,7 @@ export class EloUtility {
...
@@ -52,7 +62,7 @@ export class EloUtility {
diffA
=
-
15
;
diffA
=
-
15
;
}
}
const
rrA
=
rA
+
diffA
;
//
const rrA = rA + diffA;
let
diffB
=
k
*
(
sB
-
eB
);
let
diffB
=
k
*
(
sB
-
eB
);
...
@@ -77,7 +87,7 @@ export class EloUtility {
...
@@ -77,7 +87,7 @@ export class EloUtility {
diffB
=
-
15
;
diffB
=
-
15
;
}
}
const
rrB
=
rB
+
diffB
;
//
const rrB = rB + diffB;
//console.log(diffA, diffB);
//console.log(diffA, diffB);
...
@@ -91,6 +101,6 @@ export class EloUtility {
...
@@ -91,6 +101,6 @@ export class EloUtility {
// rrB = rB - 8;
// rrB = rB - 8;
// }
// }
return
{
ptA
:
rrA
,
ptB
:
rr
B
};
return
{
ptA
:
diffA
,
ptB
:
diff
B
};
}
}
}
}
src/app.service.ts
View file @
cbf837a6
...
@@ -643,17 +643,17 @@ export class AppService {
...
@@ -643,17 +643,17 @@ export class AppService {
if
(
userscoreA
===
-
5
||
userscoreB
===
-
5
)
{
if
(
userscoreA
===
-
5
||
userscoreB
===
-
5
)
{
pre_exit
=
true
;
pre_exit
=
true
;
firstWin
=
false
;
firstWin
=
false
;
ptResult
.
ptA
=
userA
.
pt
;
ptResult
.
ptA
=
0
;
ptResult
.
ptB
=
userB
.
pt
;
ptResult
.
ptB
=
0
;
if
(
userscoreA
===
-
9
)
{
if
(
userscoreA
===
-
9
)
{
ptResult
.
ptA
=
userA
.
pt
-
2
;
ptResult
.
ptA
=
-
2
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
usernameA
,
usernameA
,
'
开局退房
'
,
'
开局退房
'
,
moment
(
start
).
format
(
'
YYYY-MM-DD HH:mm
'
),
moment
(
start
).
format
(
'
YYYY-MM-DD HH:mm
'
),
);
);
}
else
if
(
userscoreB
===
-
9
)
{
}
else
if
(
userscoreB
===
-
9
)
{
ptResult
.
ptB
=
userB
.
pt
-
2
;
ptResult
.
ptB
=
-
2
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
usernameB
,
usernameB
,
'
开局退房
'
,
'
开局退房
'
,
...
@@ -666,8 +666,8 @@ export class AppService {
...
@@ -666,8 +666,8 @@ export class AppService {
//按加减8或16处理:高分赢低分 高分加8低分减8,低分赢高分,低分加16,高分减16.
//按加减8或16处理:高分赢低分 高分加8低分减8,低分赢高分,低分加16,高分减16.
if
(
!
pre_exit
&&
userA
.
pt
-
userB
.
pt
>
137
)
{
if
(
!
pre_exit
&&
userA
.
pt
-
userB
.
pt
>
137
)
{
if
(
winner
===
usernameA
)
{
if
(
winner
===
usernameA
)
{
ptResult
.
ptA
=
userA
.
pt
+
8
;
ptResult
.
ptA
=
+
8
;
ptResult
.
ptB
=
userB
.
pt
-
8
;
ptResult
.
ptB
=
-
8
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
userA
.
pt
,
userA
.
pt
,
userB
.
pt
,
userB
.
pt
,
...
@@ -677,8 +677,8 @@ export class AppService {
...
@@ -677,8 +677,8 @@ export class AppService {
}
}
if
(
winner
===
usernameB
)
{
if
(
winner
===
usernameB
)
{
ptResult
.
ptA
=
userA
.
pt
-
15
;
ptResult
.
ptA
=
-
15
;
ptResult
.
ptB
=
userB
.
pt
+
16
;
ptResult
.
ptB
=
+
16
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
userA
.
pt
,
userA
.
pt
,
userB
.
pt
,
userB
.
pt
,
...
@@ -690,8 +690,8 @@ export class AppService {
...
@@ -690,8 +690,8 @@ export class AppService {
if
(
!
pre_exit
&&
userB
.
pt
-
userA
.
pt
>
137
)
{
if
(
!
pre_exit
&&
userB
.
pt
-
userA
.
pt
>
137
)
{
if
(
winner
===
usernameA
)
{
if
(
winner
===
usernameA
)
{
ptResult
.
ptA
=
userA
.
pt
+
16
;
ptResult
.
ptA
=
+
16
;
ptResult
.
ptB
=
userB
.
pt
-
15
;
ptResult
.
ptB
=
-
15
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
userA
.
pt
,
userA
.
pt
,
userB
.
pt
,
userB
.
pt
,
...
@@ -701,8 +701,8 @@ export class AppService {
...
@@ -701,8 +701,8 @@ export class AppService {
}
}
if
(
winner
===
usernameB
)
{
if
(
winner
===
usernameB
)
{
ptResult
.
ptA
=
userA
.
pt
-
8
;
ptResult
.
ptA
=
-
8
;
ptResult
.
ptB
=
userB
.
pt
+
8
;
ptResult
.
ptB
=
+
8
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
userA
.
pt
,
userA
.
pt
,
userB
.
pt
,
userB
.
pt
,
...
@@ -716,7 +716,7 @@ export class AppService {
...
@@ -716,7 +716,7 @@ export class AppService {
const
isLess3Min
=
moment
(
start
).
add
(
1
,
'
m
'
).
isAfter
(
moment
(
end
));
const
isLess3Min
=
moment
(
start
).
add
(
1
,
'
m
'
).
isAfter
(
moment
(
end
));
if
(
!
pre_exit
&&
isLess3Min
)
{
if
(
!
pre_exit
&&
isLess3Min
)
{
if
(
winner
===
usernameA
)
{
if
(
winner
===
usernameA
)
{
ptResult
.
ptA
=
userA
.
pt
;
ptResult
.
ptA
=
0
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
usernameA
,
usernameA
,
'
当局有人存在早退,胜利不加分
'
,
'
当局有人存在早退,胜利不加分
'
,
...
@@ -724,7 +724,7 @@ export class AppService {
...
@@ -724,7 +724,7 @@ export class AppService {
);
);
}
}
if
(
winner
===
usernameB
)
{
if
(
winner
===
usernameB
)
{
ptResult
.
ptB
=
userB
.
pt
;
ptResult
.
ptB
=
0
;
this
.
log
.
compatLog
(
this
.
log
.
compatLog
(
usernameB
,
usernameB
,
'
当局有人存在早退,胜利不加分
'
,
'
当局有人存在早退,胜利不加分
'
,
...
@@ -765,12 +765,12 @@ export class AppService {
...
@@ -765,12 +765,12 @@ export class AppService {
battleHistory
.
usernameb
=
userB
.
username
;
battleHistory
.
usernameb
=
userB
.
username
;
battleHistory
.
userscorea
=
userscoreA
;
battleHistory
.
userscorea
=
userscoreA
;
battleHistory
.
userscoreb
=
userscoreB
;
battleHistory
.
userscoreb
=
userscoreB
;
battleHistory
.
expa
=
expResult
.
expA
;
battleHistory
.
expa
=
expResult
.
expA
+
userA
.
exp
;
battleHistory
.
expb
=
expResult
.
expB
;
battleHistory
.
expb
=
expResult
.
expB
+
userB
.
exp
;
battleHistory
.
expa_ex
=
userA
.
exp
;
battleHistory
.
expa_ex
=
userA
.
exp
;
battleHistory
.
expb_ex
=
userB
.
exp
;
battleHistory
.
expb_ex
=
userB
.
exp
;
battleHistory
.
pta
=
ptResult
.
ptA
;
battleHistory
.
pta
=
ptResult
.
ptA
+
userA
.
pt
;
battleHistory
.
ptb
=
ptResult
.
ptB
;
battleHistory
.
ptb
=
ptResult
.
ptB
+
userB
.
pt
;
battleHistory
.
pta_ex
=
userA
.
pt
;
battleHistory
.
pta_ex
=
userA
.
pt
;
battleHistory
.
ptb_ex
=
userB
.
pt
;
battleHistory
.
ptb_ex
=
userB
.
pt
;
battleHistory
.
type
=
arena
;
battleHistory
.
type
=
arena
;
...
@@ -818,8 +818,8 @@ export class AppService {
...
@@ -818,8 +818,8 @@ export class AppService {
.
createQueryBuilder
()
.
createQueryBuilder
()
.
update
(
UserInfo
)
.
update
(
UserInfo
)
.
set
({
.
set
({
exp
:
expResult
.
expA
,
exp
:
()
=>
`exp
${
EloUtility
.
getSqlString
(
expResult
.
expA
)}
`
,
pt
:
ptResult
.
ptA
,
pt
:
()
=>
`pt
${
EloUtility
.
getSqlString
(
ptResult
.
ptA
)}
`
,
athletic_win
:
()
=>
`athletic_win +
${
paramA
.
athletic_win
}
`
,
athletic_win
:
()
=>
`athletic_win +
${
paramA
.
athletic_win
}
`
,
athletic_lose
:
()
=>
`athletic_lose +
${
paramA
.
athletic_lose
}
`
,
athletic_lose
:
()
=>
`athletic_lose +
${
paramA
.
athletic_lose
}
`
,
athletic_draw
:
()
=>
`athletic_draw +
${
paramA
.
athletic_draw
}
`
,
athletic_draw
:
()
=>
`athletic_draw +
${
paramA
.
athletic_draw
}
`
,
...
@@ -831,8 +831,8 @@ export class AppService {
...
@@ -831,8 +831,8 @@ export class AppService {
.
createQueryBuilder
()
.
createQueryBuilder
()
.
update
(
UserInfo
)
.
update
(
UserInfo
)
.
set
({
.
set
({
exp
:
expResult
.
expB
,
exp
:
()
=>
`exp
${
EloUtility
.
getSqlString
(
expResult
.
expB
)}
`
,
pt
:
ptResult
.
ptB
,
pt
:
()
=>
`pt
${
EloUtility
.
getSqlString
(
ptResult
.
ptB
)}
`
,
athletic_win
:
()
=>
`athletic_win +
${
paramB
.
athletic_win
}
`
,
athletic_win
:
()
=>
`athletic_win +
${
paramB
.
athletic_win
}
`
,
athletic_lose
:
()
=>
`athletic_lose +
${
paramB
.
athletic_lose
}
`
,
athletic_lose
:
()
=>
`athletic_lose +
${
paramB
.
athletic_lose
}
`
,
athletic_draw
:
()
=>
`athletic_draw +
${
paramB
.
athletic_draw
}
`
,
athletic_draw
:
()
=>
`athletic_draw +
${
paramB
.
athletic_draw
}
`
,
...
@@ -874,8 +874,8 @@ export class AppService {
...
@@ -874,8 +874,8 @@ export class AppService {
battleHistory
.
usernameb
=
userB
.
username
;
battleHistory
.
usernameb
=
userB
.
username
;
battleHistory
.
userscorea
=
userscoreA
;
battleHistory
.
userscorea
=
userscoreA
;
battleHistory
.
userscoreb
=
userscoreB
;
battleHistory
.
userscoreb
=
userscoreB
;
battleHistory
.
expa
=
expResult
.
expA
;
battleHistory
.
expa
=
expResult
.
expA
+
userA
.
exp
;
battleHistory
.
expb
=
expResult
.
expB
;
battleHistory
.
expb
=
expResult
.
expB
+
userB
.
exp
;
battleHistory
.
expa_ex
=
userA
.
exp
;
battleHistory
.
expa_ex
=
userA
.
exp
;
battleHistory
.
expb_ex
=
userB
.
exp
;
battleHistory
.
expb_ex
=
userB
.
exp
;
battleHistory
.
pta
=
userA
.
pt
;
battleHistory
.
pta
=
userA
.
pt
;
...
@@ -898,7 +898,7 @@ export class AppService {
...
@@ -898,7 +898,7 @@ export class AppService {
.
createQueryBuilder
()
.
createQueryBuilder
()
.
update
(
UserInfo
)
.
update
(
UserInfo
)
.
set
({
.
set
({
exp
:
expResult
.
expA
,
exp
:
()
=>
`exp
${
EloUtility
.
getSqlString
(
expResult
.
expA
)}
`
,
entertain_win
:
()
=>
`entertain_win +
${
paramA
.
entertain_win
}
`
,
entertain_win
:
()
=>
`entertain_win +
${
paramA
.
entertain_win
}
`
,
entertain_lose
:
()
=>
entertain_lose
:
()
=>
`entertain_lose +
${
paramA
.
entertain_lose
}
`
,
`entertain_lose +
${
paramA
.
entertain_lose
}
`
,
...
@@ -912,7 +912,7 @@ export class AppService {
...
@@ -912,7 +912,7 @@ export class AppService {
.
createQueryBuilder
()
.
createQueryBuilder
()
.
update
(
UserInfo
)
.
update
(
UserInfo
)
.
set
({
.
set
({
exp
:
expResult
.
expB
,
exp
:
()
=>
`exp
${
EloUtility
.
getSqlString
(
expResult
.
expB
)}
`
,
entertain_win
:
()
=>
`entertain_win +
${
paramB
.
entertain_win
}
`
,
entertain_win
:
()
=>
`entertain_win +
${
paramB
.
entertain_win
}
`
,
entertain_lose
:
()
=>
entertain_lose
:
()
=>
`entertain_lose +
${
paramB
.
entertain_lose
}
`
,
`entertain_lose +
${
paramB
.
entertain_lose
}
`
,
...
...
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