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
fbe54a4c
Commit
fbe54a4c
authored
Jun 29, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no AFK kick when disconnected
parent
6b716e4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
ygopro-server.coffee
ygopro-server.coffee
+6
-4
ygopro-server.js
ygopro-server.js
+7
-4
No files found.
ygopro-server.coffee
View file @
fbe54a4c
...
...
@@ -628,6 +628,8 @@ CLIENT_reconnect = (client) ->
current_old_server
.
destroy
()
client
.
established
=
true
client
.
pre_establish_buffers
=
[]
if
room
.
random_type
or
room
.
arena
room
.
last_active_time
=
moment
()
CLIENT_import_data
(
client
,
dinfo
.
old_client
,
room
)
CLIENT_send_reconnect_info
(
client
,
client
.
server
,
room
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${reconnect_to_game}"
)
...
...
@@ -2575,12 +2577,12 @@ if settings.modules.random_duel.enabled
for
room
in
ROOM_all
when
room
and
room
.
started
and
room
.
random_type
and
room
.
last_active_time
and
room
.
waiting_for_player
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
)
#log.info time_passed
if
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
if
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
and
!
room
.
waiting_for_player
.
closed
room
.
last_active_time
=
moment
()
ROOM_ban_player
(
room
.
waiting_for_player
.
name
,
room
.
waiting_for_player
.
ip
,
"${random_ban_reason_AFK}"
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
room
.
waiting_for_player
.
name
}
${kicked_by_system}"
,
ygopro
.
constants
.
COLORS
.
RED
)
room
.
waiting_for_player
.
server
.
destroy
()
else
if
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
and
not
(
time_passed
%
10
)
else
if
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
and
not
(
time_passed
%
10
)
and
!
room
.
waiting_for_player
.
closed
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
room
.
waiting_for_player
.
name
}
${afk_warn_part1}
#{
settings
.
modules
.
random_duel
.
hang_timeout
-
time_passed
}
${afk_warn_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
ROOM_unwelcome
(
room
,
room
.
waiting_for_player
,
"${random_ban_reason_AFK}"
)
return
...
...
@@ -2591,13 +2593,13 @@ if settings.modules.mycard.enabled
for
room
in
ROOM_all
when
room
and
room
.
started
and
room
.
arena
and
room
.
last_active_time
and
room
.
waiting_for_player
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
)
#log.info time_passed
if
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
if
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
and
!
room
.
waiting_for_player
.
closed
room
.
last_active_time
=
moment
()
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
room
.
waiting_for_player
.
name
}
${kicked_by_system}"
,
ygopro
.
constants
.
COLORS
.
RED
)
room
.
scores
[
room
.
waiting_for_player
.
name
]
=
-
9
#log.info room.waiting_for_player.name, room.scores[room.waiting_for_player.name]
room
.
waiting_for_player
.
server
.
destroy
()
else
if
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
and
not
(
time_passed
%
10
)
else
if
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
and
not
(
time_passed
%
10
)
and
!
room
.
waiting_for_player
.
closed
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
room
.
waiting_for_player
.
name
}
${afk_warn_part1}
#{
settings
.
modules
.
random_duel
.
hang_timeout
-
time_passed
}
${afk_warn_part2}"
,
ygopro
.
constants
.
COLORS
.
RED
)
return
,
1000
...
...
ygopro-server.js
View file @
fbe54a4c
...
...
@@ -810,6 +810,9 @@
current_old_server
.
destroy
();
client
.
established
=
true
;
client
.
pre_establish_buffers
=
[];
if
(
room
.
random_type
||
room
.
arena
)
{
room
.
last_active_time
=
moment
();
}
CLIENT_import_data
(
client
,
dinfo
.
old_client
,
room
);
CLIENT_send_reconnect_info
(
client
,
client
.
server
,
room
);
ygopro
.
stoc_send_chat_to_room
(
room
,
client
.
name
+
"
${reconnect_to_game}
"
);
...
...
@@ -3260,12 +3263,12 @@
continue
;
}
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
);
if
(
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
)
{
if
(
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
&&
!
room
.
waiting_for_player
.
closed
)
{
room
.
last_active_time
=
moment
();
ROOM_ban_player
(
room
.
waiting_for_player
.
name
,
room
.
waiting_for_player
.
ip
,
"
${random_ban_reason_AFK}
"
);
ygopro
.
stoc_send_chat_to_room
(
room
,
room
.
waiting_for_player
.
name
+
"
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
room
.
waiting_for_player
.
server
.
destroy
();
}
else
if
(
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
&&
!
(
time_passed
%
10
))
{
}
else
if
(
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
&&
!
(
time_passed
%
10
)
&&
!
room
.
waiting_for_player
.
closed
)
{
ygopro
.
stoc_send_chat_to_room
(
room
,
room
.
waiting_for_player
.
name
+
"
${afk_warn_part1}
"
+
(
settings
.
modules
.
random_duel
.
hang_timeout
-
time_passed
)
+
"
${afk_warn_part2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ROOM_unwelcome
(
room
,
room
.
waiting_for_player
,
"
${random_ban_reason_AFK}
"
);
}
...
...
@@ -3282,12 +3285,12 @@
continue
;
}
time_passed
=
Math
.
floor
((
moment
()
-
room
.
last_active_time
)
/
1000
);
if
(
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
)
{
if
(
time_passed
>=
settings
.
modules
.
random_duel
.
hang_timeout
&&
!
room
.
waiting_for_player
.
closed
)
{
room
.
last_active_time
=
moment
();
ygopro
.
stoc_send_chat_to_room
(
room
,
room
.
waiting_for_player
.
name
+
"
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
room
.
scores
[
room
.
waiting_for_player
.
name
]
=
-
9
;
room
.
waiting_for_player
.
server
.
destroy
();
}
else
if
(
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
&&
!
(
time_passed
%
10
))
{
}
else
if
(
time_passed
>=
(
settings
.
modules
.
random_duel
.
hang_timeout
-
20
)
&&
!
(
time_passed
%
10
)
&&
!
room
.
waiting_for_player
.
closed
)
{
ygopro
.
stoc_send_chat_to_room
(
room
,
room
.
waiting_for_player
.
name
+
"
${afk_warn_part1}
"
+
(
settings
.
modules
.
random_duel
.
hang_timeout
-
time_passed
)
+
"
${afk_warn_part2}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
...
...
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