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
9365c21d
Commit
9365c21d
authored
Mar 31, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save replay on ygopro error
parent
4b2524f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
39 deletions
+42
-39
ygopro-server.coffee
ygopro-server.coffee
+16
-15
ygopro-server.js
ygopro-server.js
+26
-24
No files found.
ygopro-server.coffee
View file @
9365c21d
...
...
@@ -3457,7 +3457,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)->
if
!
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
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
replay_safe
if
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
replay_safe
or
room
.
has_ygopro_error
if
client
.
pos
==
0
dueltime
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
replay_filename
=
dueltime
...
...
@@ -3468,20 +3468,21 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)->
for
player
,
i
in
room
.
dueling_players
replay_filename
=
replay_filename
+
(
if
i
>
0
then
(
if
i
==
2
then
" VS "
else
" & "
)
else
" "
)
+
player
.
name
replay_filename
=
replay_filename
.
replace
(
/[\/\\\?\*]/g
,
'_'
)
+
".yrp"
duellog
=
{
time
:
dueltime
,
name
:
room
.
name
+
(
if
settings
.
modules
.
tournament_mode
.
show_info
then
(
" (Duel:"
+
room
.
duel_count
+
")"
)
else
""
),
roomid
:
room
.
process_pid
.
toString
(),
cloud_replay_id
:
"R#"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
roommode
:
room
.
hostinfo
.
mode
,
players
:
(
for
player
in
room
.
dueling_players
name
:
player
.
name
+
(
if
settings
.
modules
.
tournament_mode
.
show_ip
and
!
player
.
is_local
then
(
" (IP: "
+
player
.
ip
.
slice
(
7
)
+
")"
)
else
""
)
+
(
if
settings
.
modules
.
tournament_mode
.
show_info
and
not
(
room
.
hostinfo
.
mode
==
2
and
player
.
pos
%
2
>
0
)
then
(
" (Score:"
+
room
.
scores
[
player
.
name_vpass
]
+
" LP:"
+
(
if
player
.
lp
?
then
player
.
lp
else
room
.
hostinfo
.
start_lp
)
+
(
if
room
.
hostinfo
.
mode
!=
2
then
(
" Cards:"
+
(
if
player
.
card_count
?
then
player
.
card_count
else
room
.
hostinfo
.
start_hand
))
else
""
)
+
")"
)
else
""
),
winner
:
player
.
pos
==
room
.
winner
)
}
duel_log
.
duel_log
.
unshift
duellog
setting_save
(
duel_log
)
if
settings
.
modules
.
tournament_mode
.
enabled
duellog
=
{
time
:
dueltime
,
name
:
room
.
name
+
(
if
settings
.
modules
.
tournament_mode
.
show_info
then
(
" (Duel:"
+
room
.
duel_count
+
")"
)
else
""
),
roomid
:
room
.
process_pid
.
toString
(),
cloud_replay_id
:
"R#"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
roommode
:
room
.
hostinfo
.
mode
,
players
:
(
for
player
in
room
.
dueling_players
name
:
player
.
name
+
(
if
settings
.
modules
.
tournament_mode
.
show_ip
and
!
player
.
is_local
then
(
" (IP: "
+
player
.
ip
.
slice
(
7
)
+
")"
)
else
""
)
+
(
if
settings
.
modules
.
tournament_mode
.
show_info
and
not
(
room
.
hostinfo
.
mode
==
2
and
player
.
pos
%
2
>
0
)
then
(
" (Score:"
+
room
.
scores
[
player
.
name_vpass
]
+
" LP:"
+
(
if
player
.
lp
?
then
player
.
lp
else
room
.
hostinfo
.
start_lp
)
+
(
if
room
.
hostinfo
.
mode
!=
2
then
(
" Cards:"
+
(
if
player
.
card_count
?
then
player
.
card_count
else
room
.
hostinfo
.
start_hand
))
else
""
)
+
")"
)
else
""
),
winner
:
player
.
pos
==
room
.
winner
)
}
duel_log
.
duel_log
.
unshift
duellog
setting_save
(
duel_log
)
fs
.
writeFile
(
settings
.
modules
.
tournament_mode
.
replay_path
+
replay_filename
,
buffer
,
(
err
)
->
if
err
then
log
.
warn
"SAVE REPLAY ERROR"
,
replay_filename
,
err
)
...
...
ygopro-server.js
View file @
9365c21d
...
...
@@ -4623,7 +4623,7 @@
// console.log("Replay saved: ", room.duel_count - 1, client.pos)
room
.
replays
[
room
.
duel_count
-
1
]
=
buffer
;
}
if
(
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
replay_safe
)
{
if
(
settings
.
modules
.
tournament_mode
.
enabled
&&
settings
.
modules
.
tournament_mode
.
replay_safe
||
room
.
has_ygopro_error
)
{
if
(
client
.
pos
===
0
)
{
dueltime
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
);
replay_filename
=
dueltime
;
...
...
@@ -4641,29 +4641,31 @@
}
}
replay_filename
=
replay_filename
.
replace
(
/
[\/\\\?\*]
/g
,
'
_
'
)
+
"
.yrp
"
;
duellog
=
{
time
:
dueltime
,
name
:
room
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_info
?
"
(Duel:
"
+
room
.
duel_count
+
"
)
"
:
""
),
roomid
:
room
.
process_pid
.
toString
(),
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
roommode
:
room
.
hostinfo
.
mode
,
players
:
(
function
()
{
var
len4
,
o
,
ref4
,
results
;
ref4
=
room
.
dueling_players
;
results
=
[];
for
(
o
=
0
,
len4
=
ref4
.
length
;
o
<
len4
;
o
++
)
{
player
=
ref4
[
o
];
results
.
push
({
name
:
player
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_ip
&&
!
player
.
is_local
?
"
(IP:
"
+
player
.
ip
.
slice
(
7
)
+
"
)
"
:
""
)
+
(
settings
.
modules
.
tournament_mode
.
show_info
&&
!
(
room
.
hostinfo
.
mode
===
2
&&
player
.
pos
%
2
>
0
)
?
"
(Score:
"
+
room
.
scores
[
player
.
name_vpass
]
+
"
LP:
"
+
(
player
.
lp
!=
null
?
player
.
lp
:
room
.
hostinfo
.
start_lp
)
+
(
room
.
hostinfo
.
mode
!==
2
?
"
Cards:
"
+
(
player
.
card_count
!=
null
?
player
.
card_count
:
room
.
hostinfo
.
start_hand
)
:
""
)
+
"
)
"
:
""
),
winner
:
player
.
pos
===
room
.
winner
});
}
return
results
;
})()
};
duel_log
.
duel_log
.
unshift
(
duellog
);
setting_save
(
duel_log
);
if
(
settings
.
modules
.
tournament_mode
.
enabled
)
{
duellog
=
{
time
:
dueltime
,
name
:
room
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_info
?
"
(Duel:
"
+
room
.
duel_count
+
"
)
"
:
""
),
roomid
:
room
.
process_pid
.
toString
(),
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
roommode
:
room
.
hostinfo
.
mode
,
players
:
(
function
()
{
var
len4
,
o
,
ref4
,
results
;
ref4
=
room
.
dueling_players
;
results
=
[];
for
(
o
=
0
,
len4
=
ref4
.
length
;
o
<
len4
;
o
++
)
{
player
=
ref4
[
o
];
results
.
push
({
name
:
player
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_ip
&&
!
player
.
is_local
?
"
(IP:
"
+
player
.
ip
.
slice
(
7
)
+
"
)
"
:
""
)
+
(
settings
.
modules
.
tournament_mode
.
show_info
&&
!
(
room
.
hostinfo
.
mode
===
2
&&
player
.
pos
%
2
>
0
)
?
"
(Score:
"
+
room
.
scores
[
player
.
name_vpass
]
+
"
LP:
"
+
(
player
.
lp
!=
null
?
player
.
lp
:
room
.
hostinfo
.
start_lp
)
+
(
room
.
hostinfo
.
mode
!==
2
?
"
Cards:
"
+
(
player
.
card_count
!=
null
?
player
.
card_count
:
room
.
hostinfo
.
start_hand
)
:
""
)
+
"
)
"
:
""
),
winner
:
player
.
pos
===
room
.
winner
});
}
return
results
;
})()
};
duel_log
.
duel_log
.
unshift
(
duellog
);
setting_save
(
duel_log
);
}
fs
.
writeFile
(
settings
.
modules
.
tournament_mode
.
replay_path
+
replay_filename
,
buffer
,
function
(
err
)
{
if
(
err
)
{
return
log
.
warn
(
"
SAVE REPLAY ERROR
"
,
replay_filename
,
err
);
...
...
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