Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-match
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-match
Commits
b5d7f8ab
Commit
b5d7f8ab
authored
Oct 27, 2017
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Timed gate.
parent
560db373
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
configSample.json
configSample.json
+1
-1
main.js
main.js
+15
-1
No files found.
configSample.json
View file @
b5d7f8ab
...
@@ -16,6 +16,6 @@
...
@@ -16,6 +16,6 @@
"timeInterval"
:
10000
,
"timeInterval"
:
10000
,
"athleticTrueSkillGate"
:
0.4
,
"athleticTrueSkillGate"
:
0.4
,
"entertainExpGate"
:
100
,
"entertainExpGate"
:
100
,
"atheleticPtGate"
:
50
"atheleticPtGate"
:
[
350
,
50
,
500
]
}
}
}
}
main.js
View file @
b5d7f8ab
...
@@ -42,6 +42,7 @@ let getUserConfig = function (user, callback) {
...
@@ -42,6 +42,7 @@ let getUserConfig = function (user, callback) {
else
{
else
{
try
{
try
{
let
value
=
JSON
.
parse
(
body
);
let
value
=
JSON
.
parse
(
body
);
setUserLimit
(
value
);
callback
(
value
);
callback
(
value
);
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -58,6 +59,15 @@ let getUserConfig = function (user, callback) {
...
@@ -58,6 +59,15 @@ let getUserConfig = function (user, callback) {
*/
*/
};
};
let
setUserLimit
=
function
(
data
)
{
if
(
Array
.
isArray
(
config
.
match
.
atheleticPtGate
))
data
.
limit
=
config
.
match
.
atheleticPtGate
[
1
];
else
if
(
Number
.
isInteger
(
config
.
match
.
atheleticPtGate
))
data
.
limit
=
config
.
match
.
atheleticPtGatmatche
;
else
data
.
limit
=
500
;
};
// TrueSkill
// TrueSkill
// 参考于 https://zh.wikipedia.org/zh-hans/TrueSkill评分系统
// 参考于 https://zh.wikipedia.org/zh-hans/TrueSkill评分系统
...
@@ -127,7 +137,8 @@ updateAthleticMatch = function () {
...
@@ -127,7 +137,8 @@ updateAthleticMatch = function () {
break
;
break
;
}
}
// 若 pt 之差小于门限,则匹配房间
// 若 pt 之差小于门限,则匹配房间
if
(
userA
.
data
.
pt
-
userB
.
data
.
pt
<
config
.
match
.
atheleticPtGate
)
{
let
delta
=
userA
.
data
.
pt
-
userB
.
data
.
pt
;
if
(
delta
<
userA
.
data
.
limit
&&
delta
<
userB
.
data
.
limit
)
{
pair
(
userA
.
client
,
userB
.
client
,
'
athletic
'
);
pair
(
userA
.
client
,
userB
.
client
,
'
athletic
'
);
i
+=
1
;
i
+=
1
;
}
}
...
@@ -135,6 +146,9 @@ updateAthleticMatch = function () {
...
@@ -135,6 +146,9 @@ updateAthleticMatch = function () {
else
else
newPool
.
push
(
userA
);
newPool
.
push
(
userA
);
}
}
if
(
Array
.
isArray
(
config
.
match
.
atheleticPtGate
))
for
(
let
user
of
newPool
)
user
.
data
.
limit
=
Math
.
min
(
user
.
data
.
limit
+
config
.
match
.
atheleticPtGate
[
1
],
config
.
match
.
atheleticPtGate
[
2
])
athleticUserPool
=
newPool
;
athleticUserPool
=
newPool
;
};
};
...
...
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