Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
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
nanahira
srvpro
Commits
1cbf2bb5
Commit
1cbf2bb5
authored
Jan 13, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tcg_random
parents
10f7a2a3
2052f6f7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
23 deletions
+64
-23
ygopro-server.coffee
ygopro-server.coffee
+26
-16
ygopro-server.js
ygopro-server.js
+38
-7
No files found.
ygopro-server.coffee
View file @
1cbf2bb5
...
...
@@ -398,7 +398,10 @@ if settings.modules.challonge.enabled
else
_data
.
callback
=
get_callback
(
0
,
_data
.
callback
)
is_requesting
[
0
]
=
moment
()
try
challonge
.
participants
.
index
(
_data
)
catch
err
_data
.
callback
(
err
,
null
)
return
challonge
.
matches
.
_index
=
(
_data
)
->
if
settings
.
modules
.
challonge
.
cache_ttl
and
challonge_cache
[
1
]
...
...
@@ -408,7 +411,16 @@ if settings.modules.challonge.enabled
else
_data
.
callback
=
get_callback
(
1
,
_data
.
callback
)
is_requesting
[
1
]
=
moment
()
try
challonge
.
matches
.
index
(
_data
)
catch
err
_data
.
callback
(
err
,
null
)
return
challonge
.
matches
.
_update
=
(
_data
)
->
try
challonge
.
matches
.
update
(
_data
)
catch
err
log
.
warn
(
"Errored pushing scores to Challonge."
,
err
)
return
refresh_challonge_cache
=
()
->
if
settings
.
modules
.
challonge
.
cache_ttl
...
...
@@ -941,7 +953,7 @@ CLIENT_heartbeat_unregister = (client) ->
return
true
CLIENT_heartbeat_register
=
(
client
,
send
)
->
if
!
settings
.
modules
.
heartbeat_detection
.
enabled
or
client
.
closed
or
client
.
is_post_watcher
or
client
.
pre_reconnecting
or
client
.
reconnecting
or
client
.
pos
>
3
or
client
.
heartbeat_protected
if
!
settings
.
modules
.
heartbeat_detection
.
enabled
or
client
.
closed
or
client
.
is_post_watcher
or
client
.
pre_reconnecting
or
client
.
reconnecting
or
client
.
waiting_for_last
or
client
.
pos
>
3
or
client
.
heartbeat_protected
return
false
if
client
.
heartbeat_timeout
CLIENT_heartbeat_unregister
(
client
)
...
...
@@ -1261,7 +1273,7 @@ class Room
return
if
settings
.
modules
.
challonge
.
enabled
and
@
started
and
@
hostinfo
.
mode
!=
2
and
!
@
kicked
challonge
.
matches
.
update
({
challonge
.
matches
.
_
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
@
challonge_info
.
id
,
match
:
@
get_challonge_score
(),
...
...
@@ -2743,11 +2755,9 @@ ygopro.stoc_follow 'FIELD_FINISH', true, (buffer, info, client, server, datas)->
room
=
ROOM_all
[
client
.
rid
]
return
true
unless
room
and
settings
.
modules
.
reconnect
.
enabled
client
.
reconnecting
=
false
#if client.time_confirm_required # client did not send TIME_CONFIRM
# client.waiting_for_last = true
#else
if
client
.
last_game_msg
and
client
.
last_game_msg_title
!=
'WAITING'
# client sent TIME_CONFIRM
SOCKET_flush_data
(
client
,
datas
)
if
client
.
time_confirm_required
# client did not send TIME_CONFIRM
client
.
waiting_for_last
=
true
else
if
client
.
last_game_msg
and
client
.
last_game_msg_title
!=
'WAITING'
# client sent TIME_CONFIRM
if
client
.
last_hint_msg
ygopro
.
stoc_send
(
client
,
'GAME_MSG'
,
client
.
last_hint_msg
)
ygopro
.
stoc_send
(
client
,
'GAME_MSG'
,
client
.
last_game_msg
)
...
...
@@ -3351,12 +3361,12 @@ ygopro.ctos_follow 'TIME_CONFIRM', false, (buffer, info, client, server, datas)-
room
=
ROOM_all
[
client
.
rid
]
return
unless
room
if
settings
.
modules
.
reconnect
.
enabled
#
if client.waiting_for_last
#
client.waiting_for_last = false
#
if client.last_game_msg and client.last_game_msg_title != 'WAITING'
#
if client.last_hint_msg
#
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg)
#
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg)
if
client
.
waiting_for_last
client
.
waiting_for_last
=
false
if
client
.
last_game_msg
and
client
.
last_game_msg_title
!=
'WAITING'
if
client
.
last_hint_msg
ygopro
.
stoc_send
(
client
,
'GAME_MSG'
,
client
.
last_hint_msg
)
ygopro
.
stoc_send
(
client
,
'GAME_MSG'
,
client
.
last_game_msg
)
client
.
time_confirm_required
=
false
if
settings
.
modules
.
heartbeat_detection
.
enabled
client
.
heartbeat_protected
=
false
...
...
@@ -3463,7 +3473,7 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server, datas)->
if
settings
.
modules
.
challonge
.
enabled
and
settings
.
modules
.
challonge
.
post_score_midduel
and
room
.
hostinfo
.
mode
!=
2
and
client
.
pos
==
0
temp_log
=
JSON
.
parse
(
JSON
.
stringify
(
room
.
get_challonge_score
()))
delete
temp_log
.
winnerId
challonge
.
matches
.
update
({
challonge
.
matches
.
_
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
room
.
challonge_info
.
id
,
match
:
temp_log
,
...
...
ygopro-server.js
View file @
1cbf2bb5
...
...
@@ -486,6 +486,7 @@
});
};
challonge
.
participants
.
_index
=
function
(
_data
)
{
var
err
;
if
(
settings
.
modules
.
challonge
.
cache_ttl
&&
challonge_cache
[
0
])
{
_data
.
callback
(
null
,
challonge_cache
[
0
]);
}
else
if
(
is_requesting
[
0
]
&&
moment
()
-
is_requesting
[
0
]
<=
5000
)
{
...
...
@@ -493,10 +494,16 @@
}
else
{
_data
.
callback
=
get_callback
(
0
,
_data
.
callback
);
is_requesting
[
0
]
=
moment
();
try
{
challonge
.
participants
.
index
(
_data
);
}
catch
(
error1
)
{
err
=
error1
;
_data
.
callback
(
err
,
null
);
}
}
};
challonge
.
matches
.
_index
=
function
(
_data
)
{
var
err
;
if
(
settings
.
modules
.
challonge
.
cache_ttl
&&
challonge_cache
[
1
])
{
_data
.
callback
(
null
,
challonge_cache
[
1
]);
}
else
if
(
is_requesting
[
1
]
&&
moment
()
-
is_requesting
[
1
]
<=
5000
)
{
...
...
@@ -504,7 +511,21 @@
}
else
{
_data
.
callback
=
get_callback
(
1
,
_data
.
callback
);
is_requesting
[
1
]
=
moment
();
try
{
challonge
.
matches
.
index
(
_data
);
}
catch
(
error1
)
{
err
=
error1
;
_data
.
callback
(
err
,
null
);
}
}
};
challonge
.
matches
.
_update
=
function
(
_data
)
{
var
err
;
try
{
challonge
.
matches
.
update
(
_data
);
}
catch
(
error1
)
{
err
=
error1
;
log
.
warn
(
"
Errored pushing scores to Challonge.
"
,
err
);
}
};
refresh_challonge_cache
=
function
()
{
...
...
@@ -1225,7 +1246,7 @@
};
CLIENT_heartbeat_register
=
function
(
client
,
send
)
{
if
(
!
settings
.
modules
.
heartbeat_detection
.
enabled
||
client
.
closed
||
client
.
is_post_watcher
||
client
.
pre_reconnecting
||
client
.
reconnecting
||
client
.
pos
>
3
||
client
.
heartbeat_protected
)
{
if
(
!
settings
.
modules
.
heartbeat_detection
.
enabled
||
client
.
closed
||
client
.
is_post_watcher
||
client
.
pre_reconnecting
||
client
.
reconnecting
||
client
.
waiting_for_last
||
client
.
pos
>
3
||
client
.
heartbeat_protected
)
{
return
false
;
}
if
(
client
.
heartbeat_timeout
)
{
...
...
@@ -1650,7 +1671,7 @@
})(
this
));
}
if
(
settings
.
modules
.
challonge
.
enabled
&&
this
.
started
&&
this
.
hostinfo
.
mode
!==
2
&&
!
this
.
kicked
)
{
challonge
.
matches
.
update
({
challonge
.
matches
.
_
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
this
.
challonge_info
.
id
,
match
:
this
.
get_challonge_score
(),
...
...
@@ -3462,8 +3483,9 @@
return
true
;
}
client
.
reconnecting
=
false
;
if
(
client
.
last_game_msg
&&
client
.
last_game_msg_title
!==
'
WAITING
'
)
{
SOCKET_flush_data
(
client
,
datas
);
if
(
client
.
time_confirm_required
)
{
client
.
waiting_for_last
=
true
;
}
else
if
(
client
.
last_game_msg
&&
client
.
last_game_msg_title
!==
'
WAITING
'
)
{
if
(
client
.
last_hint_msg
)
{
ygopro
.
stoc_send
(
client
,
'
GAME_MSG
'
,
client
.
last_hint_msg
);
}
...
...
@@ -4304,6 +4326,15 @@
return
;
}
if
(
settings
.
modules
.
reconnect
.
enabled
)
{
if
(
client
.
waiting_for_last
)
{
client
.
waiting_for_last
=
false
;
if
(
client
.
last_game_msg
&&
client
.
last_game_msg_title
!==
'
WAITING
'
)
{
if
(
client
.
last_hint_msg
)
{
ygopro
.
stoc_send
(
client
,
'
GAME_MSG
'
,
client
.
last_hint_msg
);
}
ygopro
.
stoc_send
(
client
,
'
GAME_MSG
'
,
client
.
last_game_msg
);
}
}
client
.
time_confirm_required
=
false
;
}
if
(
settings
.
modules
.
heartbeat_detection
.
enabled
)
{
...
...
@@ -4451,7 +4482,7 @@
if
(
settings
.
modules
.
challonge
.
enabled
&&
settings
.
modules
.
challonge
.
post_score_midduel
&&
room
.
hostinfo
.
mode
!==
2
&&
client
.
pos
===
0
)
{
temp_log
=
JSON
.
parse
(
JSON
.
stringify
(
room
.
get_challonge_score
()));
delete
temp_log
.
winnerId
;
challonge
.
matches
.
update
({
challonge
.
matches
.
_
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
room
.
challonge_info
.
id
,
match
:
temp_log
,
...
...
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