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
a862e2c6
Commit
a862e2c6
authored
Jun 18, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add auto surrender in reconnect for some tournaments
parent
ecb633e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
data/default_config.json
data/default_config.json
+1
-0
ygopro-server.coffee
ygopro-server.coffee
+6
-4
ygopro-server.js
ygopro-server.js
+8
-4
No files found.
data/default_config.json
View file @
a862e2c6
...
@@ -88,6 +88,7 @@
...
@@ -88,6 +88,7 @@
},
},
"reconnect"
:
{
"reconnect"
:
{
"enabled"
:
true
,
"enabled"
:
true
,
"auto_surrender_after_disconnect"
:
false
,
"wait_time"
:
300000
"wait_time"
:
300000
},
},
"mycard"
:
{
"mycard"
:
{
...
...
ygopro-server.coffee
View file @
a862e2c6
...
@@ -437,7 +437,7 @@ CLIENT_reconnect_unregister = (client, reconnected) ->
...
@@ -437,7 +437,7 @@ CLIENT_reconnect_unregister = (client, reconnected) ->
CLIENT_reconnect_register
=
(
client
,
room
,
error
)
->
CLIENT_reconnect_register
=
(
client
,
room
,
error
)
->
if
client
.
had_new_reconnection
if
client
.
had_new_reconnection
return
false
return
false
if
!
settings
.
modules
.
reconnect
.
enabled
or
client
.
system_kicked
or
client
.
is_post_watcher
or
!
CLIENT_is_player
(
client
,
room
)
or
!
room
.
started
or
(
room
.
windbot
and
client
.
is_local
)
if
!
settings
.
modules
.
reconnect
.
enabled
or
client
.
system_kicked
or
client
.
is_post_watcher
or
!
CLIENT_is_player
(
client
,
room
)
or
!
room
.
started
or
(
room
.
windbot
and
client
.
is_local
)
or
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
and
room
.
hostinfo
.
mode
!=
1
)
return
false
return
false
old_dinfo
=
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
old_dinfo
=
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
if
old_dinfo
if
old_dinfo
...
@@ -455,6 +455,8 @@ CLIENT_reconnect_register = (client, room, error) ->
...
@@ -455,6 +455,8 @@ CLIENT_reconnect_register = (client, room, error) ->
,
settings
.
modules
.
reconnect
.
wait_time
)
,
settings
.
modules
.
reconnect
.
wait_time
)
dinfo
.
timeout
=
tmot
dinfo
.
timeout
=
tmot
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
=
dinfo
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
=
dinfo
if
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
and
room
.
turn
and
room
.
turn
>
0
ygopro
.
ctos_send
(
client
.
server
,
'SURRENDER'
)
return
true
return
true
CLIENT_import_data
=
(
client
,
old_client
,
room
)
->
CLIENT_import_data
=
(
client
,
old_client
,
room
)
->
...
@@ -493,7 +495,6 @@ CLIENT_import_data = (client, old_client, room) ->
...
@@ -493,7 +495,6 @@ CLIENT_import_data = (client, old_client, room) ->
client
.
last_game_msg
=
old_client
.
last_game_msg
client
.
last_game_msg
=
old_client
.
last_game_msg
client
.
last_game_msg_title
=
old_client
.
last_game_msg_title
client
.
last_game_msg_title
=
old_client
.
last_game_msg_title
client
.
start_deckbuf
=
old_client
.
start_deckbuf
client
.
start_deckbuf
=
old_client
.
start_deckbuf
client
.
join_game_buffer
=
old_client
.
join_game_buffer
old_client
.
had_new_reconnection
=
true
old_client
.
had_new_reconnection
=
true
return
return
...
@@ -533,7 +534,7 @@ CLIENT_is_able_to_reconnect = (client) ->
...
@@ -533,7 +534,7 @@ CLIENT_is_able_to_reconnect = (client) ->
CLIENT_send_pre_reconnect_info
=
(
client
,
room
,
old_client
)
->
CLIENT_send_pre_reconnect_info
=
(
client
,
room
,
old_client
)
->
ygopro
.
stoc_send_chat
(
client
,
"${pre_reconnecting_to_room}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
"${pre_reconnecting_to_room}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send
(
client
,
'JOIN_GAME'
,
old_client
.
join_game_buffer
)
ygopro
.
stoc_send
(
client
,
'JOIN_GAME'
,
room
.
join_game_buffer
)
req_pos
=
old_client
.
pos
req_pos
=
old_client
.
pos
if
old_client
.
is_host
if
old_client
.
is_host
req_pos
+=
0x10
req_pos
+=
0x10
...
@@ -1494,7 +1495,8 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1494,7 +1495,8 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
#欢迎信息
#欢迎信息
room
=
ROOM_all
[
client
.
rid
]
room
=
ROOM_all
[
client
.
rid
]
return
unless
room
and
!
client
.
reconnecting
return
unless
room
and
!
client
.
reconnecting
client
.
join_game_buffer
=
buffer
if
!
room
.
join_game_buffer
room
.
join_game_buffer
=
buffer
if
settings
.
modules
.
welcome
if
settings
.
modules
.
welcome
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
)
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
)
if
room
.
welcome
if
room
.
welcome
...
...
ygopro-server.js
View file @
a862e2c6
...
@@ -602,7 +602,7 @@
...
@@ -602,7 +602,7 @@
if
(
client
.
had_new_reconnection
)
{
if
(
client
.
had_new_reconnection
)
{
return
false
;
return
false
;
}
}
if
(
!
settings
.
modules
.
reconnect
.
enabled
||
client
.
system_kicked
||
client
.
is_post_watcher
||
!
CLIENT_is_player
(
client
,
room
)
||
!
room
.
started
||
(
room
.
windbot
&&
client
.
is_local
))
{
if
(
!
settings
.
modules
.
reconnect
.
enabled
||
client
.
system_kicked
||
client
.
is_post_watcher
||
!
CLIENT_is_player
(
client
,
room
)
||
!
room
.
started
||
(
room
.
windbot
&&
client
.
is_local
)
||
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
&&
room
.
hostinfo
.
mode
!==
1
)
)
{
return
false
;
return
false
;
}
}
old_dinfo
=
disconnect_list
[
CLIENT_get_authorize_key
(
client
)];
old_dinfo
=
disconnect_list
[
CLIENT_get_authorize_key
(
client
)];
...
@@ -621,6 +621,9 @@
...
@@ -621,6 +621,9 @@
},
settings
.
modules
.
reconnect
.
wait_time
);
},
settings
.
modules
.
reconnect
.
wait_time
);
dinfo
.
timeout
=
tmot
;
dinfo
.
timeout
=
tmot
;
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
=
dinfo
;
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
=
dinfo
;
if
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
&&
room
.
turn
&&
room
.
turn
>
0
)
{
ygopro
.
ctos_send
(
client
.
server
,
'
SURRENDER
'
);
}
return
true
;
return
true
;
};
};
...
@@ -666,7 +669,6 @@
...
@@ -666,7 +669,6 @@
client
.
last_game_msg
=
old_client
.
last_game_msg
;
client
.
last_game_msg
=
old_client
.
last_game_msg
;
client
.
last_game_msg_title
=
old_client
.
last_game_msg_title
;
client
.
last_game_msg_title
=
old_client
.
last_game_msg_title
;
client
.
start_deckbuf
=
old_client
.
start_deckbuf
;
client
.
start_deckbuf
=
old_client
.
start_deckbuf
;
client
.
join_game_buffer
=
old_client
.
join_game_buffer
;
old_client
.
had_new_reconnection
=
true
;
old_client
.
had_new_reconnection
=
true
;
};
};
...
@@ -717,7 +719,7 @@
...
@@ -717,7 +719,7 @@
CLIENT_send_pre_reconnect_info
=
function
(
client
,
room
,
old_client
)
{
CLIENT_send_pre_reconnect_info
=
function
(
client
,
room
,
old_client
)
{
var
len2
,
m
,
player
,
ref2
,
req_pos
,
results
;
var
len2
,
m
,
player
,
ref2
,
req_pos
,
results
;
ygopro
.
stoc_send_chat
(
client
,
"
${pre_reconnecting_to_room}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
"
${pre_reconnecting_to_room}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send
(
client
,
'
JOIN_GAME
'
,
old_client
.
join_game_buffer
);
ygopro
.
stoc_send
(
client
,
'
JOIN_GAME
'
,
room
.
join_game_buffer
);
req_pos
=
old_client
.
pos
;
req_pos
=
old_client
.
pos
;
if
(
old_client
.
is_host
)
{
if
(
old_client
.
is_host
)
{
req_pos
+=
0x10
;
req_pos
+=
0x10
;
...
@@ -1826,7 +1828,9 @@
...
@@ -1826,7 +1828,9 @@
if
(
!
(
room
&&
!
client
.
reconnecting
))
{
if
(
!
(
room
&&
!
client
.
reconnecting
))
{
return
;
return
;
}
}
client
.
join_game_buffer
=
buffer
;
if
(
!
room
.
join_game_buffer
)
{
room
.
join_game_buffer
=
buffer
;
}
if
(
settings
.
modules
.
welcome
)
{
if
(
settings
.
modules
.
welcome
)
{
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
);
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
);
}
}
...
...
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