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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
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
srvpro
Commits
9ad14874
Commit
9ad14874
authored
Aug 21, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix max_rooms_count
parent
00b1e400
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
30 deletions
+33
-30
ygopro-server.coffee
ygopro-server.coffee
+13
-11
ygopro-server.js
ygopro-server.js
+20
-19
No files found.
ygopro-server.coffee
View file @
9ad14874
...
...
@@ -194,6 +194,8 @@ moment_now = global.moment_now = null
moment_now_string
=
global
.
moment_now_string
=
null
moment_long_ago_string
=
global
.
moment_long_ago_string
=
null
rooms_count
=
0
challonge
=
null
challonge_cache
=
{
participants
:
null
...
...
@@ -394,6 +396,17 @@ init = () ->
moment_long_ago_string
=
moment
().
subtract
(
settings
.
modules
.
random_duel
.
hang_timeout
-
19
,
's'
).
format
()
return
,
500
if
settings
.
modules
.
max_rooms_count
rooms_count
=
0
get_rooms_count
=
()
->
_rooms_count
=
0
for
room
in
ROOM_all
when
room
and
room
.
established
_rooms_count
++
rooms_count
=
_rooms_count
setTimeout
get_rooms_count
,
1000
return
setTimeout
get_rooms_count
,
1000
if
settings
.
modules
.
windbot
.
enabled
log
.
info
(
"Reading bot list."
)
...
...
@@ -718,17 +731,6 @@ ROOM_player_get_score = global.ROOM_player_get_score = (player)->
return
""
return
await
dataManager
.
getRandomDuelScoreDisplay
(
player
.
name_vpass
)
if
settings
.
modules
.
max_rooms_count
rooms_count
=
0
get_rooms_count
=
()
->
_rooms_count
=
0
for
room
in
ROOM_all
when
room
and
room
.
established
_rooms_count
++
rooms_count
=
_rooms_count
setTimeout
get_rooms_count
,
1000
return
setTimeout
get_rooms_count
,
1000
ROOM_find_or_create_by_name
=
global
.
ROOM_find_or_create_by_name
=
(
name
,
player_ip
)
->
uname
=
name
.
toUpperCase
()
if
settings
.
modules
.
windbot
.
enabled
and
(
uname
[
0
...
2
]
==
'AI'
or
(
!
settings
.
modules
.
random_duel
.
enabled
and
uname
==
''
))
...
...
ygopro-server.js
View file @
9ad14874
// 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
,
Q
,
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_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
ReplayParser
,
ResolveData
,
Room
,
SERVER_clear_disconnect
,
SERVER_kick
,
SOCKET_flush_data
,
_
,
_async
,
addCallback
,
athleticChecker
,
auth
,
axios
,
badwordR
,
badwords
,
ban_user
,
bunyan
,
challonge
,
challonge_cache
,
challonge_queue_callbacks
,
checkFileExists
,
createDirectoryIfNotExists
,
crypto
,
dataManager
,
deck_name_match
,
dialogues
,
disconnect_list
,
exec
,
execFile
,
fs
,
geoip
,
getDuelLogQueryFromQs
,
getSeedTimet
,
get_callback
,
get_memory_usage
,
get_rooms_count
,
http
,
httpRequestListener
,
importOldConfig
,
import_datas
,
init
,
is_challonge_requesting
,
lflists
,
loadJSON
,
loadJSONAsync
,
loadLFList
,
loadRemoteData
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
memory_usage
,
merge
,
moment
,
moment_long_ago_string
,
moment_now
,
moment_now_string
,
net
,
netRequestHandler
,
os
,
osu
,
path
,
qs
,
real_windbot_server_ip
,
refresh_challonge_cache
,
release_disconnect
,
replaced_index
,
report_to_big_brother
,
request
,
roomlist
,
rooms_count
,
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
,
Q
,
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_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
ReplayParser
,
ResolveData
,
Room
,
SERVER_clear_disconnect
,
SERVER_kick
,
SOCKET_flush_data
,
_
,
_async
,
addCallback
,
athleticChecker
,
auth
,
axios
,
badwordR
,
badwords
,
ban_user
,
bunyan
,
challonge
,
challonge_cache
,
challonge_queue_callbacks
,
checkFileExists
,
createDirectoryIfNotExists
,
crypto
,
dataManager
,
deck_name_match
,
dialogues
,
disconnect_list
,
exec
,
execFile
,
fs
,
geoip
,
getDuelLogQueryFromQs
,
getSeedTimet
,
get_callback
,
get_memory_usage
,
http
,
httpRequestListener
,
importOldConfig
,
import_datas
,
init
,
is_challonge_requesting
,
lflists
,
loadJSON
,
loadJSONAsync
,
loadLFList
,
loadRemoteData
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
memory_usage
,
merge
,
moment
,
moment_long_ago_string
,
moment_now
,
moment_now_string
,
net
,
netRequestHandler
,
os
,
osu
,
path
,
qs
,
real_windbot_server_ip
,
refresh_challonge_cache
,
release_disconnect
,
replaced_index
,
report_to_big_brother
,
request
,
roomlist
,
rooms_count
,
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
'
);
...
...
@@ -238,6 +238,8 @@
moment_long_ago_string
=
global
.
moment_long_ago_string
=
null
;
rooms_count
=
0
;
challonge
=
null
;
challonge_cache
=
{
...
...
@@ -307,7 +309,7 @@
};
init
=
async
function
()
{
var
AthleticChecker
,
DataManager
,
challonge_module_name
,
challonge_type
,
chat_color
,
config
,
cppversion
,
defaultConfig
,
default_data
,
dirPath
,
dns
,
e
,
http_server
,
https
,
https_server
,
imported
,
j
,
l
,
len
,
len1
,
len2
,
m
,
mkdirList
,
options
,
pgClient
,
pg_client
,
pg_query
,
plugin_filename
,
plugin_list
,
plugin_path
,
postData
,
ref
;
var
AthleticChecker
,
DataManager
,
challonge_module_name
,
challonge_type
,
chat_color
,
config
,
cppversion
,
defaultConfig
,
default_data
,
dirPath
,
dns
,
e
,
get_rooms_count
,
http_server
,
https
,
https_server
,
imported
,
j
,
l
,
len
,
len1
,
len2
,
m
,
mkdirList
,
options
,
pgClient
,
pg_client
,
pg_query
,
plugin_filename
,
plugin_list
,
plugin_path
,
postData
,
ref
;
log
.
info
(
'
Reading config.
'
);
await
createDirectoryIfNotExists
(
"
./config
"
);
await
importOldConfig
();
...
...
@@ -504,6 +506,22 @@
moment_now_string
=
moment_now
.
format
();
moment_long_ago_string
=
moment
().
subtract
(
settings
.
modules
.
random_duel
.
hang_timeout
-
19
,
'
s
'
).
format
();
},
500
);
if
(
settings
.
modules
.
max_rooms_count
)
{
rooms_count
=
0
;
get_rooms_count
=
function
()
{
var
_rooms_count
,
j
,
len
,
room
;
_rooms_count
=
0
;
for
(
j
=
0
,
len
=
ROOM_all
.
length
;
j
<
len
;
j
++
)
{
room
=
ROOM_all
[
j
];
if
(
room
&&
room
.
established
)
{
_rooms_count
++
;
}
}
rooms_count
=
_rooms_count
;
setTimeout
(
get_rooms_count
,
1000
);
};
setTimeout
(
get_rooms_count
,
1000
);
}
if
(
settings
.
modules
.
windbot
.
enabled
)
{
log
.
info
(
"
Reading bot list.
"
);
windbots
=
global
.
windbots
=
((
await
loadJSONAsync
(
settings
.
modules
.
windbot
.
botlist
))).
windbots
;
...
...
@@ -919,23 +937,6 @@
return
(
await
dataManager
.
getRandomDuelScoreDisplay
(
player
.
name_vpass
));
};
if
(
settings
.
modules
.
max_rooms_count
)
{
rooms_count
=
0
;
get_rooms_count
=
function
()
{
var
_rooms_count
,
j
,
len
,
room
;
_rooms_count
=
0
;
for
(
j
=
0
,
len
=
ROOM_all
.
length
;
j
<
len
;
j
++
)
{
room
=
ROOM_all
[
j
];
if
(
room
&&
room
.
established
)
{
_rooms_count
++
;
}
}
rooms_count
=
_rooms_count
;
setTimeout
(
get_rooms_count
,
1000
);
};
setTimeout
(
get_rooms_count
,
1000
);
}
ROOM_find_or_create_by_name
=
global
.
ROOM_find_or_create_by_name
=
async
function
(
name
,
player_ip
)
{
var
room
,
success
,
uname
;
uname
=
name
.
toUpperCase
();
...
...
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