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
7d1abf01
Commit
7d1abf01
authored
Jun 30, 2018
by
IamI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix
parent
884a8b23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
configSample.json
configSample.json
+3
-1
main.js
main.js
+18
-3
No files found.
configSample.json
View file @
7d1abf01
...
...
@@ -16,6 +16,8 @@
"timeInterval"
:
10000
,
"athleticTrueSkillGate"
:
0.4
,
"entertainExpGate"
:
100
,
"atheleticPtGate"
:
[
350
,
50
,
500
]
"atheleticPtGate"
:
[
350
,
50
,
500
],
"longestGameTime"
:
7200000
,
"reconnect"
:
"reconnect"
}
}
main.js
View file @
7d1abf01
...
...
@@ -217,6 +217,7 @@ let pair = function (userARes, userBRes, serverName) {
"
password
"
:
password
});
playingPlayerPool
.
set
(
client
.
username
,
result
);
setTimeout
(
timeoutUser
,
config
.
match
.
longestMatchTime
,
client
.
username
);
client
.
writeHead
(
200
,
{
'
Content-Type
'
:
'
application/json
'
,
'
Cache-Control
'
:
'
no-cache
'
});
client
.
end
(
result
);
}
...
...
@@ -288,6 +289,12 @@ let finishUser = function (json) {
}
};
// 当超过时间,而 srvpro 从未通知基本服务器游戏已结束时
let
timeoutUser
=
function
(
user
)
{
if
(
playingPlayerPool
.
delete
(
user
))
localLog
(
"
With timeout, user is seen as had left the game:
"
+
user
);
};
// 计算预期时间
let
calculatePredictedTime
=
function
()
{
if
(
entertainRequestCountInTime
==
0
)
...
...
@@ -318,9 +325,17 @@ let matchResponse = function(req, res) {
}
// 检定是否掉线重连
if
(
playingPlayerPool
.
has
(
username
))
{
res
.
writeHead
(
200
,
{
'
Content-Type
'
:
'
application/json
'
,
'
Cache-Control
'
:
'
no-cache
'
});
res
.
end
(
playingPlayerPool
.
get
(
username
));
return
;
switch
(
config
.
match
.
reconnect
)
{
case
"
reconnect
"
:
res
.
writeHead
(
200
,
{
'
Content-Type
'
:
'
application/json
'
,
'
Cache-Control
'
:
'
no-cache
'
});
res
.
end
(
playingPlayerPool
.
get
(
username
));
return
;
case
"
drop
"
:
rejectUser
(
res
);
return
;
default
:
break
;
// 什么都不做,继续加入匹配池。
}
}
let
arg
=
url
.
parse
(
req
.
url
,
true
).
query
;
if
(
!
arg
.
arena
)
arg
.
arena
=
'
entertain
'
;
...
...
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