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
bb037bee
Commit
bb037bee
authored
May 28, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update seed
parent
931c0dfb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
8 deletions
+55
-8
ygopro-server.coffee
ygopro-server.coffee
+23
-2
ygopro-server.js
ygopro-server.js
+32
-6
No files found.
ygopro-server.coffee
View file @
bb037bee
...
...
@@ -1048,6 +1048,25 @@ SOCKET_flush_data = global.SOCKET_flush_data = (sk, datas) ->
datas
.
splice
(
0
,
datas
.
length
)
return
true
getSeedTimet
=
global
.
getSeedTimet
=
(
count
)
->
ret
=
[]
for
i
in
[
0
...
count
]
curTime
=
null
while
!
curTime
or
_
.
any
(
ret
,
(
time
)
->
return
time
==
curTime
.
unix
()
)
curTime
=
moment
()
offset
=
Math
.
floor
(
Math
.
random
()
*
240
)
-
120
if
offset
>
0
curTime
=
curTime
.
add
(
offset
,
"s"
)
else
if
offset
<
0
curTime
=
curTime
.
subtract
(
-
offset
,
"s"
)
ret
.
push
(
curTime
.
unix
())
ret
.
sort
((
a
,
b
)
->
return
a
-
b
)
return
ret
class
Room
constructor
:
(
name
,
@
hostinfo
)
->
@
name
=
name
...
...
@@ -1208,9 +1227,11 @@ class Room
if
@
recovered
param
.
push
(
@
recover_replay
.
header
.
seed
)
param
.
push
(
Math
.
floor
(
Math
.
random
()
*
2147483647
))
for
i
in
[
1
..
2
]
seeds
=
getSeedTimet
(
2
)
param
.
push
(
seeds
[
i
])
for
i
in
[
0
...
2
]
else
param
.
push
(
Math
.
floor
(
Math
.
random
()
*
2147483647
))
for
i
in
[
1
..
3
]
seeds
=
getSeedTimet
(
3
)
param
.
push
(
seeds
[
i
])
for
i
in
[
0
...
3
]
try
@
process
=
spawn
'./ygopro'
,
param
,
{
cwd
:
'ygopro'
}
...
...
ygopro-server.js
View file @
bb037bee
// Generated by CoffeeScript 2.5.1
(
function
()
{
// 标准库
var
CLIENT_get_authorize_key
,
CLIENT_get_kick_reconnect_target
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_kick_reconnect
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_banned_by_mc
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_kick_reconnect
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_replays
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_pid
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_kick
,
ROOM_player_flee
,
ROOM_player_get_score
,
ROOM_player_lose
,
ROOM_player_win
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_players_scores
,
ROOM_unwelcome
,
ROOM_validate
,
ReplayParser
,
ResolveData
,
Room
,
SERVER_clear_disconnect
,
SERVER_kick
,
SOCKET_flush_data
,
_
,
_async
,
addCallback
,
auth
,
badwords
,
ban_user
,
bunyan
,
challonge
,
challonge_cache
,
challonge_module_name
,
challonge_queue_callbacks
,
challonge_type
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
deck_name_match
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
dns
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_callback
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
import_datas
,
imported
,
is_challonge_requesting
,
j
,
l
,
len
,
len1
,
len2
,
len3
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
m
,
memory_usage
,
merge
,
moment
,
n
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
plugin_filename
,
plugin_list
,
plugin_path
,
real_windbot_server_ip
,
redis
,
redisdb
,
ref
,
ref1
,
ref2
,
refresh_challonge_cache
,
release_disconnect
,
replaced_index
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
spawn_windbot
,
tips
,
url
,
users_cache
,
util
,
wait_room_start
,
wait_room_start_arena
,
windbot_looplimit
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
var
CLIENT_get_authorize_key
,
CLIENT_get_kick_reconnect_target
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_kick_reconnect
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_banned_by_mc
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_kick_reconnect
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_replays
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_pid
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_kick
,
ROOM_player_flee
,
ROOM_player_get_score
,
ROOM_player_lose
,
ROOM_player_win
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_players_scores
,
ROOM_unwelcome
,
ROOM_validate
,
ReplayParser
,
ResolveData
,
Room
,
SERVER_clear_disconnect
,
SERVER_kick
,
SOCKET_flush_data
,
_
,
_async
,
addCallback
,
auth
,
badwords
,
ban_user
,
bunyan
,
challonge
,
challonge_cache
,
challonge_module_name
,
challonge_queue_callbacks
,
challonge_type
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
deck_name_match
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
dns
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get
SeedTimet
,
get
_callback
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
import_datas
,
imported
,
is_challonge_requesting
,
j
,
l
,
len
,
len1
,
len2
,
len3
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
m
,
memory_usage
,
merge
,
moment
,
n
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
plugin_filename
,
plugin_list
,
plugin_path
,
real_windbot_server_ip
,
redis
,
redisdb
,
ref
,
ref1
,
ref2
,
refresh_challonge_cache
,
release_disconnect
,
replaced_index
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
spawn_windbot
,
tips
,
url
,
users_cache
,
util
,
wait_room_start
,
wait_room_start_arena
,
windbot_looplimit
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
...
...
@@ -1410,9 +1410,33 @@
return
true
;
};
getSeedTimet
=
global
.
getSeedTimet
=
function
(
count
)
{
var
curTime
,
i
,
n
,
offset
,
ref3
,
ret
;
ret
=
[];
for
(
i
=
n
=
0
,
ref3
=
count
;
(
0
<=
ref3
?
n
<
ref3
:
n
>
ref3
);
i
=
0
<=
ref3
?
++
n
:
--
n
)
{
curTime
=
null
;
while
(
!
curTime
||
_
.
any
(
ret
,
function
(
time
)
{
return
time
===
curTime
.
unix
();
}))
{
curTime
=
moment
();
offset
=
Math
.
floor
(
Math
.
random
()
*
240
)
-
120
;
if
(
offset
>
0
)
{
curTime
=
curTime
.
add
(
offset
,
"
s
"
);
}
else
if
(
offset
<
0
)
{
curTime
=
curTime
.
subtract
(
-
offset
,
"
s
"
);
}
}
ret
.
push
(
curTime
.
unix
());
}
ret
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
return
ret
;
};
Room
=
class
Room
{
constructor
(
name
,
hostinfo
)
{
var
death_time
,
draw_count
,
duel_log_id
,
duel_rule
,
i
,
lflist
,
n
,
o
,
param
,
rule
,
start_hand
,
start_lp
,
time_limit
;
var
death_time
,
draw_count
,
duel_log_id
,
duel_rule
,
i
,
lflist
,
n
,
o
,
param
,
rule
,
s
eeds
,
s
tart_hand
,
start_lp
,
time_limit
;
this
.
hostinfo
=
hostinfo
;
this
.
name
=
name
;
//@alive = true
...
...
@@ -1590,12 +1614,14 @@
param
=
[
0
,
this
.
hostinfo
.
lflist
,
this
.
hostinfo
.
rule
,
this
.
hostinfo
.
mode
,
this
.
hostinfo
.
duel_rule
,
(
this
.
hostinfo
.
no_check_deck
?
'
T
'
:
'
F
'
),
(
this
.
hostinfo
.
no_shuffle_deck
?
'
T
'
:
'
F
'
),
this
.
hostinfo
.
start_lp
,
this
.
hostinfo
.
start_hand
,
this
.
hostinfo
.
draw_count
,
this
.
hostinfo
.
time_limit
,
this
.
hostinfo
.
replay_mode
];
if
(
this
.
recovered
)
{
param
.
push
(
this
.
recover_replay
.
header
.
seed
);
for
(
i
=
n
=
1
;
n
<=
2
;
i
=
++
n
)
{
param
.
push
(
Math
.
floor
(
Math
.
random
()
*
2147483647
));
seeds
=
getSeedTimet
(
2
);
for
(
i
=
n
=
0
;
n
<
2
;
i
=
++
n
)
{
param
.
push
(
seeds
[
i
]);
}
}
else
{
for
(
i
=
o
=
1
;
o
<=
3
;
i
=
++
o
)
{
param
.
push
(
Math
.
floor
(
Math
.
random
()
*
2147483647
));
seeds
=
getSeedTimet
(
3
);
for
(
i
=
o
=
0
;
o
<
3
;
i
=
++
o
)
{
param
.
push
(
seeds
[
i
]);
}
}
try
{
...
...
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