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
35c65627
Commit
35c65627
authored
Aug 30, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'koishi' into enter-room-log
parents
4793da0a
9178162a
Pipeline
#16273
passed with stages
in 8 minutes and 4 seconds
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
55 deletions
+117
-55
data/default_config.json
data/default_config.json
+0
-1
ygopro-server.coffee
ygopro-server.coffee
+37
-10
ygopro-server.js
ygopro-server.js
+80
-44
No files found.
data/default_config.json
View file @
35c65627
...
...
@@ -198,7 +198,6 @@
"enabled"
:
false
,
"deck_check"
:
true
,
"deck_path"
:
"./decks/"
,
"replay_safe"
:
true
,
"replay_path"
:
"./replays/"
,
"replay_archive_tool"
:
"7z"
,
"block_replay_to_player"
:
false
,
...
...
ygopro-server.coffee
View file @
35c65627
...
...
@@ -115,7 +115,19 @@ setting_save = global.setting_save = (settings) ->
log
.
warn
(
"setting save fail"
,
e
.
toString
())
return
setting_change
=
global
.
setting_change
=
(
settings
,
path
,
val
)
->
setting_get
=
global
.
setting_get
=
(
settings
,
path
)
->
path
=
path
.
split
(
':'
)
if
path
.
length
==
0
return
settings
[
path
[
0
]]
else
target
=
settings
while
path
.
length
>
1
key
=
path
.
shift
()
target
=
target
[
key
]
key
=
path
.
shift
()
return
target
[
key
]
setting_change
=
global
.
setting_change
=
(
settings
,
path
,
val
,
noSave
)
->
# path should be like "modules:welcome"
log
.
info
(
"setting changed"
,
path
,
val
)
if
_
.
isString
(
val
)
path
=
path
.
split
(
':'
)
...
...
@@ -128,7 +140,8 @@ setting_change = global.setting_change = (settings, path, val) ->
target
=
target
[
key
]
key
=
path
.
shift
()
target
[
key
]
=
val
await
setting_save
(
settings
)
if
!
noSave
await
setting_save
(
settings
)
return
VIP_generate_cdkeys
=
global
.
VIP_generate_cdkeys
=
(
key_type
,
count
)
->
...
...
@@ -382,6 +395,23 @@ init = () ->
delete
settings
.
modules
.
random_duel
.
blank_pass_match
imported
=
true
#finish
keysFromEnv
=
Object
.
keys
(
process
.
env
).
filter
((
key
)
=>
key
.
startsWith
(
'SRVPRO_'
))
if
keysFromEnv
.
length
>
0
log
.
info
(
'Migrating settings from environment variables.'
)
for
key
in
keysFromEnv
settingKey
=
key
.
slice
(
7
).
replace
(
/__/g
,
':'
)
val
=
process
.
env
[
key
]
valFromDefault
=
setting_get
(
defaultConfig
,
settingKey
)
if
Array
.
isArray
(
valFromDefault
)
val
=
val
.
split
(
','
)
valFromDefault
=
valFromDefault
[
0
]
if
typeof
valFromDefault
==
'number'
val
=
parseFloat
(
val
)
if
typeof
valFromDefault
==
'boolean'
val
=
(
val
!=
'false'
)
&&
(
val
!=
'0'
)
setting_change
(
settings
,
settingKey
,
val
,
true
)
imported
=
true
if
imported
log
.
info
(
'Saving migrated settings.'
)
await
setting_save
(
settings
)
...
...
@@ -3773,12 +3803,11 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server, datas)->
ygopro
.
stoc_follow
'REPLAY'
,
true
,
(
buffer
,
info
,
client
,
server
,
datas
)
->
room
=
ROOM_all
[
client
.
rid
]
return
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
block_replay_to_player
or
settings
.
modules
.
replay_delay
unless
room
if
!
room
.
replays
[
room
.
duel_count
-
1
]
if
room
and
!
room
.
replays
[
room
.
duel_count
-
1
]
# console.log("Replay saved: ", room.duel_count - 1, client.pos)
room
.
replays
[
room
.
duel_count
-
1
]
=
buffer
if
settings
.
modules
.
mysql
.
enabled
or
room
.
has_ygopro_error
if
client
.
pos
==
0
if
settings
.
modules
.
mysql
.
enabled
or
room
.
has_ygopro_error
console
.
log
(
'save replay'
)
replay_filename
=
moment_now
.
format
(
"YYYY-MM-DD HH-mm-ss"
)
if
room
.
hostinfo
.
mode
!=
2
for
player
,
i
in
room
.
dueling_players
...
...
@@ -3810,11 +3839,9 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)->
}
)
dataManager
.
saveDuelLog
(
room
.
name
,
room
.
process_pid
,
room
.
cloud_replay_id
,
replay_filename
,
room
.
hostinfo
.
mode
,
room
.
duel_count
,
playerInfos
)
# no synchronize here because too slow
if
settings
.
modules
.
mysql
.
enabled
&&
settings
.
modules
.
cloud_replay
.
enabled
and
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
replay_safe
if
settings
.
modules
.
mysql
.
enabled
&&
settings
.
modules
.
cloud_replay
.
enabled
and
settings
.
modules
.
tournament_mode
.
enabled
ygopro
.
stoc_send_chat
(
client
,
"${cloud_replay_delay_part1}R#
#{
room
.
cloud_replay_id
}
${cloud_replay_delay_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
await
return
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
block_replay_to_player
or
settings
.
modules
.
replay_delay
and
room
.
hostinfo
.
mode
==
1
else
await
return
settings
.
modules
.
replay_delay
and
room
.
hostinfo
.
mode
==
1
await
return
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
block_replay_to_player
or
settings
.
modules
.
replay_delay
and
room
.
hostinfo
.
mode
==
1
# spawn windbot
windbot_looplimit
=
0
...
...
ygopro-server.js
View file @
35c65627
This diff is collapsed.
Click to expand it.
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