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
3f74cac9
Commit
3f74cac9
authored
Oct 16, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add post score
parent
1e123897
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
171 additions
and
22 deletions
+171
-22
config.json
config.json
+6
-0
ygopro-server.coffee
ygopro-server.coffee
+69
-10
ygopro-server.js
ygopro-server.js
+96
-12
No files found.
config.json
View file @
3f74cac9
...
@@ -17,7 +17,13 @@
...
@@ -17,7 +17,13 @@
"windbot_port"
:
2399
,
"windbot_port"
:
2399
,
"spawn_windbot"
:
false
,
"spawn_windbot"
:
false
,
"mycard_auth"
:
false
,
"mycard_auth"
:
false
,
"post_deck"
:
false
,
"hang_timeout"
:
90
,
"hang_timeout"
:
90
,
"arena_mode"
:
{
"mode"
:
"233"
,
"post_score"
:
false
,
"get_score"
:
false
},
"tournament_mode"
:
{
"tournament_mode"
:
{
"enabled"
:
false
,
"enabled"
:
false
,
"deck_path"
:
"./decks/"
,
"deck_path"
:
"./decks/"
,
...
...
ygopro-server.coffee
View file @
3f74cac9
...
@@ -284,6 +284,7 @@ class Room
...
@@ -284,6 +284,7 @@ class Room
@
watchers
=
[]
@
watchers
=
[]
@
random_type
=
''
@
random_type
=
''
@
welcome
=
''
@
welcome
=
''
@
scores
=
{}
ROOM_all
.
push
this
ROOM_all
.
push
this
@
hostinfo
||=
@
hostinfo
||=
...
@@ -417,6 +418,30 @@ class Room
...
@@ -417,6 +418,30 @@ class Room
delete
:
->
delete
:
->
return
if
@
deleted
return
if
@
deleted
#log.info 'room-delete', this.name, ROOM_all.length
#log.info 'room-delete', this.name, ROOM_all.length
if
@
started
and
settings
.
modules
.
arena_mode
.
post_score
#log.info @scores
score_array
=
[]
for
name
,
score
of
@
scores
score_array
.
push
{
name
:
name
,
score
:
score
}
log
.
info
@
start_time
,
score_array
request
.
post
{
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
accesskey
:
process
.
env
.
MYCARD_SCORE_KEY
,
usernameA
:
score_array
[
0
].
name
,
usernameB
:
score_array
[
1
].
name
,
userscoreA
:
score_array
[
0
].
score
,
userscoreB
:
score_array
[
1
].
score
,
start
:
@
start_time
,
end
:
moment
().
format
(),
arena
:
if
room
.
hostinfo
.
mode
==
1
then
'athletic'
else
'entertain'
#settings.modules.arena_mode.mode
}},
(
error
,
response
,
body
)
=>
if
error
log
.
warn
'SCORE POST ERROR'
,
error
,
response
else
if
response
.
statusCode
!=
204
log
.
warn
'SCORE POST'
,
response
.
statusCode
,
response
.
statusMessage
,
@
name
,
body
else
log
.
info
'SCORE POST'
,
response
.
statusCode
,
response
.
statusMessage
,
@
name
,
body
return
if
@
player_datas
.
length
and
settings
.
modules
.
enable_cloud_replay
if
@
player_datas
.
length
and
settings
.
modules
.
enable_cloud_replay
replay_id
=
@
cloud_replay_id
replay_id
=
@
cloud_replay_id
if
@
has_ygopro_error
if
@
has_ygopro_error
...
@@ -522,8 +547,11 @@ class Room
...
@@ -522,8 +547,11 @@ class Room
index
=
_
.
indexOf
(
@
players
,
client
)
index
=
_
.
indexOf
(
@
players
,
client
)
@
players
.
splice
(
index
,
1
)
unless
index
==
-
1
@
players
.
splice
(
index
,
1
)
unless
index
==
-
1
#log.info(@started,@disconnector,@random_type)
#log.info(@started,@disconnector,@random_type)
if
@
started
and
@
disconnector
!=
'server'
and
@
random_type
and
(
client
.
pos
<
4
or
client
.
is_host
)
if
@
started
and
@
disconnector
!=
'server'
and
(
client
.
pos
<
4
or
client
.
is_host
)
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"强退"
)
@
finished
=
true
@
scores
[
client
.
name
]
=
-
1
if
@
random_type
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"强退"
)
if
@
players
.
length
and
!
(
@
windbot
and
client
.
is_host
)
if
@
players
.
length
and
!
(
@
windbot
and
client
.
is_host
)
ygopro
.
stoc_send_chat_to_room
this
,
"
#{
client
.
name
}
离开了游戏"
+
if
error
then
":
#{
error
}
"
else
''
ygopro
.
stoc_send_chat_to_room
this
,
"
#{
client
.
name
}
离开了游戏"
+
if
error
then
":
#{
error
}
"
else
''
roomlist
.
update
(
this
)
if
!
@
private
and
!
@
started
and
settings
.
modules
.
enable_websocket_roomlist
roomlist
.
update
(
this
)
if
!
@
private
and
!
@
started
and
settings
.
modules
.
enable_websocket_roomlist
...
@@ -1037,7 +1065,17 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1037,7 +1065,17 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
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
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
#log.info(ROOM_all)
if
settings
.
modules
.
arena_mode
.
get_score
request
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
,
(
error
,
response
,
body
)
->
if
error
or
!
body
or
_
.
isString
body
log
.
warn
'LOAD SCORE ERROR'
,
client
.
name
,
error
,
response
,
body
else
log
.
info
'LOAD SCORE'
,
client
.
name
,
body
ygopro
.
stoc_send_chat
(
client
,
"您有
#{
body
.
exp
}
点经验,排名第
#{
body
.
exp_rank
}
,
#{
body
.
pt
}
点战斗力,排名第
#{
body
.
arena_rank
}
。正式上线前这些积分可能被重置。"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
return
if
!
room
.
recorder
if
!
room
.
recorder
room
.
recorder
=
recorder
=
net
.
connect
room
.
port
,
->
room
.
recorder
=
recorder
=
net
.
connect
room
.
port
,
->
...
@@ -1133,6 +1171,9 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
...
@@ -1133,6 +1171,9 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
#log.info {winner: pos, reason: reason}
#log.info {winner: pos, reason: reason}
#room.duels.push {winner: pos, reason: reason}
#room.duels.push {winner: pos, reason: reason}
room
.
winner
=
pos
room
.
winner
=
pos
if
!
room
.
finished
room
.
winner_name
=
room
.
dueling_players
[
pos
].
name
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
#lp跟踪
#lp跟踪
if
ygopro
.
constants
.
MSG
[
msg
]
==
'DAMAGE'
and
client
.
is_host
if
ygopro
.
constants
.
MSG
[
msg
]
==
'DAMAGE'
and
client
.
is_host
...
@@ -1276,20 +1317,38 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
...
@@ -1276,20 +1317,38 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
return
unless
room
return
unless
room
unless
room
.
started
#first start
unless
room
.
started
#first start
room
.
started
=
true
room
.
started
=
true
room
.
start_time
=
moment
().
format
()
roomlist
.
delete
room
.
name
if
settings
.
modules
.
enable_websocket_roomlist
and
not
room
.
private
roomlist
.
delete
room
.
name
if
settings
.
modules
.
enable_websocket_roomlist
and
not
room
.
private
#room.duels = []
#room.duels = []
room
.
dueling_players
=
[]
room
.
dueling_players
=
[]
for
player
in
room
.
players
when
player
.
pos
!=
7
for
player
in
room
.
players
when
player
.
pos
!=
7
room
.
dueling_players
[
player
.
pos
]
=
player
room
.
dueling_players
[
player
.
pos
]
=
player
room
.
scores
[
player
.
name
]
=
0
room
.
player_datas
.
push
ip
:
player
.
ip
,
name
:
player
.
name
room
.
player_datas
.
push
ip
:
player
.
ip
,
name
:
player
.
name
if
settings
.
modules
.
tips
if
settings
.
modules
.
tips
ygopro
.
stoc_send_random_tip
(
client
)
ygopro
.
stoc_send_random_tip
(
client
)
if
settings
.
modules
.
enable_deck_log
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
if
(
settings
.
modules
.
enable_deck_log
or
settings
.
modules
.
post_deck
)
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
and
client
.
ip
!=
'::ffff:127.0.0.1'
deck_text
=
'#ygosrv233 deck log
\r\n
#main
\r\n
'
+
client
.
main
.
join
(
'
\r\n
'
)
+
'
\r\n
!side
\r\n
'
+
client
.
side
.
join
(
'
\r\n
'
)
+
'
\r\n
'
deck_text
=
'#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
deck_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
port
+
' '
+
client
.
pos
+
' '
+
client
.
name
.
replace
(
/\//g
,
'_'
)
if
settings
.
modules
.
enable_deck_log
fs
.
writeFile
'decks_save
\/
'
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
deck_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
port
+
' '
+
client
.
pos
+
' '
+
client
.
name
.
replace
(
/\//g
,
'_'
)
if
err
fs
.
writeFile
'decks_save
\/
'
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
log
.
warn
'DECK SAVE ERROR'
,
err
if
err
log
.
warn
'DECK SAVE ERROR'
,
err
if
settings
.
modules
.
post_deck
request
.
post
{
url
:
settings
.
modules
.
post_deck
,
form
:
{
accesskey
:
process
.
env
.
MYCARD_DECK_KEY
,
deck
:
deck_text
,
playername
:
client
.
name
,
arena
:
if
room
.
hostinfo
.
mode
==
1
then
'athletic'
else
'entertain'
}},
(
error
,
response
,
body
)
->
if
error
log
.
warn
'DECK POST ERROR'
,
error
,
response
else
if
response
.
statusCode
!=
200
log
.
warn
'DECK POST'
,
response
.
statusCode
,
client
.
name
,
body
else
log
.
info
'DECK POST'
,
response
.
statusCode
,
client
.
name
,
body
return
client
.
deck_saved
=
true
client
.
deck_saved
=
true
return
return
...
@@ -1495,7 +1554,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
...
@@ -1495,7 +1554,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
name
:
room
.
name
,
name
:
room
.
name
,
roomid
:
room
.
port
.
toString
(),
roomid
:
room
.
port
.
toString
(),
cloud_replay_id
:
"R#"
+
room
.
cloud_replay_id
,
cloud_replay_id
:
"R#"
+
room
.
cloud_replay_id
,
players
:
(
for
player
in
room
.
players
players
:
(
for
player
in
room
.
dueling_
players
name
:
player
.
name
,
name
:
player
.
name
,
winner
:
player
.
pos
==
room
.
winner
winner
:
player
.
pos
==
room
.
winner
)
)
...
...
ygopro-server.js
View file @
3f74cac9
...
@@ -398,6 +398,7 @@
...
@@ -398,6 +398,7 @@
this
.
watchers
=
[];
this
.
watchers
=
[];
this
.
random_type
=
''
;
this
.
random_type
=
''
;
this
.
welcome
=
''
;
this
.
welcome
=
''
;
this
.
scores
=
{};
ROOM_all
.
push
(
this
);
ROOM_all
.
push
(
this
);
this
.
hostinfo
||
(
this
.
hostinfo
=
{
this
.
hostinfo
||
(
this
.
hostinfo
=
{
lflist
:
settings
.
lflist
.
length
?
0
:
-
1
,
lflist
:
settings
.
lflist
.
length
?
0
:
-
1
,
...
@@ -562,10 +563,47 @@
...
@@ -562,10 +563,47 @@
}
}
Room
.
prototype
[
"
delete
"
]
=
function
()
{
Room
.
prototype
[
"
delete
"
]
=
function
()
{
var
index
,
log_rep_id
,
player_ips
,
player_names
,
recorder_buffer
,
replay_id
;
var
index
,
log_rep_id
,
name
,
player_ips
,
player_names
,
recorder_buffer
,
ref
,
replay_id
,
score
,
score_array
;
if
(
this
.
deleted
)
{
if
(
this
.
deleted
)
{
return
;
return
;
}
}
if
(
this
.
started
&&
settings
.
modules
.
arena_mode
.
post_score
)
{
score_array
=
[];
ref
=
this
.
scores
;
for
(
name
in
ref
)
{
score
=
ref
[
name
];
score_array
.
push
({
name
:
name
,
score
:
score
});
}
log
.
info
(
this
.
start_time
,
score_array
);
request
.
post
({
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
accesskey
:
process
.
env
.
MYCARD_SCORE_KEY
,
usernameA
:
score_array
[
0
].
name
,
usernameB
:
score_array
[
1
].
name
,
userscoreA
:
score_array
[
0
].
score
,
userscoreB
:
score_array
[
1
].
score
,
start
:
this
.
start_time
,
end
:
moment
().
format
(),
arena
:
room
.
hostinfo
.
mode
===
1
?
'
athletic
'
:
'
entertain
'
}
},
(
function
(
_this
)
{
return
function
(
error
,
response
,
body
)
{
if
(
error
)
{
log
.
warn
(
'
SCORE POST ERROR
'
,
error
,
response
);
}
else
{
if
(
response
.
statusCode
!==
204
)
{
log
.
warn
(
'
SCORE POST
'
,
response
.
statusCode
,
response
.
statusMessage
,
_this
.
name
,
body
);
}
else
{
log
.
info
(
'
SCORE POST
'
,
response
.
statusCode
,
response
.
statusMessage
,
_this
.
name
,
body
);
}
}
};
})(
this
));
}
if
(
this
.
player_datas
.
length
&&
settings
.
modules
.
enable_cloud_replay
)
{
if
(
this
.
player_datas
.
length
&&
settings
.
modules
.
enable_cloud_replay
)
{
replay_id
=
this
.
cloud_replay_id
;
replay_id
=
this
.
cloud_replay_id
;
if
(
this
.
has_ygopro_error
)
{
if
(
this
.
has_ygopro_error
)
{
...
@@ -696,8 +734,12 @@
...
@@ -696,8 +734,12 @@
if
(
index
!==
-
1
)
{
if
(
index
!==
-
1
)
{
this
.
players
.
splice
(
index
,
1
);
this
.
players
.
splice
(
index
,
1
);
}
}
if
(
this
.
started
&&
this
.
disconnector
!==
'
server
'
&&
this
.
random_type
&&
(
client
.
pos
<
4
||
client
.
is_host
))
{
if
(
this
.
started
&&
this
.
disconnector
!==
'
server
'
&&
(
client
.
pos
<
4
||
client
.
is_host
))
{
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
强退
"
);
this
.
finished
=
true
;
this
.
scores
[
client
.
name
]
=
-
1
;
if
(
this
.
random_type
)
{
ROOM_ban_player
(
client
.
name
,
client
.
ip
,
"
强退
"
);
}
}
}
if
(
this
.
players
.
length
&&
!
(
this
.
windbot
&&
client
.
is_host
))
{
if
(
this
.
players
.
length
&&
!
(
this
.
windbot
&&
client
.
is_host
))
{
ygopro
.
stoc_send_chat_to_room
(
this
,
(
client
.
name
+
"
离开了游戏
"
)
+
(
error
?
"
:
"
+
error
:
''
));
ygopro
.
stoc_send_chat_to_room
(
this
,
(
client
.
name
+
"
离开了游戏
"
)
+
(
error
?
"
:
"
+
error
:
''
));
...
@@ -1251,6 +1293,19 @@
...
@@ -1251,6 +1293,19 @@
if
(
room
.
welcome
)
{
if
(
room
.
welcome
)
{
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
}
if
(
settings
.
modules
.
arena_mode
.
get_score
)
{
request
({
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
},
function
(
error
,
response
,
body
)
{
if
(
error
||
!
body
||
_
.
isString
(
body
))
{
log
.
warn
(
'
LOAD SCORE ERROR
'
,
client
.
name
,
error
,
response
,
body
);
}
else
{
log
.
info
(
'
LOAD SCORE
'
,
client
.
name
,
body
);
ygopro
.
stoc_send_chat
(
client
,
"
您有
"
+
body
.
exp
+
"
点经验,排名第
"
+
body
.
exp_rank
+
"
,
"
+
body
.
pt
+
"
点战斗力,排名第
"
+
body
.
arena_rank
+
"
。正式上线前这些积分可能被重置。
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
});
}
if
(
!
room
.
recorder
)
{
if
(
!
room
.
recorder
)
{
room
.
recorder
=
recorder
=
net
.
connect
(
room
.
port
,
function
()
{
room
.
recorder
=
recorder
=
net
.
connect
(
room
.
port
,
function
()
{
ygopro
.
ctos_send
(
recorder
,
'
PLAYER_INFO
'
,
{
ygopro
.
ctos_send
(
recorder
,
'
PLAYER_INFO
'
,
{
...
@@ -1348,6 +1403,10 @@
...
@@ -1348,6 +1403,10 @@
}
}
reason
=
buffer
.
readUInt8
(
2
);
reason
=
buffer
.
readUInt8
(
2
);
room
.
winner
=
pos
;
room
.
winner
=
pos
;
if
(
!
room
.
finished
)
{
room
.
winner_name
=
room
.
dueling_players
[
pos
].
name
;
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
;
}
}
}
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
DAMAGE
'
&&
client
.
is_host
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
DAMAGE
'
&&
client
.
is_host
)
{
pos
=
buffer
.
readUInt8
(
1
);
pos
=
buffer
.
readUInt8
(
1
);
...
@@ -1558,6 +1617,7 @@
...
@@ -1558,6 +1617,7 @@
}
}
if
(
!
room
.
started
)
{
if
(
!
room
.
started
)
{
room
.
started
=
true
;
room
.
started
=
true
;
room
.
start_time
=
moment
().
format
();
if
(
settings
.
modules
.
enable_websocket_roomlist
&&
!
room
[
"
private
"
])
{
if
(
settings
.
modules
.
enable_websocket_roomlist
&&
!
room
[
"
private
"
])
{
roomlist
[
"
delete
"
](
room
.
name
);
roomlist
[
"
delete
"
](
room
.
name
);
}
}
...
@@ -1569,6 +1629,7 @@
...
@@ -1569,6 +1629,7 @@
continue
;
continue
;
}
}
room
.
dueling_players
[
player
.
pos
]
=
player
;
room
.
dueling_players
[
player
.
pos
]
=
player
;
room
.
scores
[
player
.
name
]
=
0
;
room
.
player_datas
.
push
({
room
.
player_datas
.
push
({
ip
:
player
.
ip
,
ip
:
player
.
ip
,
name
:
player
.
name
name
:
player
.
name
...
@@ -1578,14 +1639,37 @@
...
@@ -1578,14 +1639,37 @@
if
(
settings
.
modules
.
tips
)
{
if
(
settings
.
modules
.
tips
)
{
ygopro
.
stoc_send_random_tip
(
client
);
ygopro
.
stoc_send_random_tip
(
client
);
}
}
if
(
settings
.
modules
.
enable_deck_log
&&
client
.
main
&&
client
.
main
.
length
&&
!
client
.
deck_saved
)
{
if
((
settings
.
modules
.
enable_deck_log
||
settings
.
modules
.
post_deck
)
&&
client
.
main
&&
client
.
main
.
length
&&
!
client
.
deck_saved
&&
client
.
ip
!==
'
::ffff:127.0.0.1
'
)
{
deck_text
=
'
#ygosrv233 deck log
\r\n
#main
\r\n
'
+
client
.
main
.
join
(
'
\r\n
'
)
+
'
\r\n
!side
\r\n
'
+
client
.
side
.
join
(
'
\r\n
'
)
+
'
\r\n
'
;
deck_text
=
'
#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
;
deck_name
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
)
+
'
'
+
room
.
port
+
'
'
+
client
.
pos
+
'
'
+
client
.
name
.
replace
(
/
\/
/g
,
'
_
'
);
if
(
settings
.
modules
.
enable_deck_log
)
{
fs
.
writeFile
(
'
decks_save
\
/
'
+
deck_name
+
'
.ydk
'
,
deck_text
,
'
utf-8
'
,
function
(
err
)
{
deck_name
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
)
+
'
'
+
room
.
port
+
'
'
+
client
.
pos
+
'
'
+
client
.
name
.
replace
(
/
\/
/g
,
'
_
'
);
if
(
err
)
{
fs
.
writeFile
(
'
decks_save
\
/
'
+
deck_name
+
'
.ydk
'
,
deck_text
,
'
utf-8
'
,
function
(
err
)
{
return
log
.
warn
(
'
DECK SAVE ERROR
'
,
err
);
if
(
err
)
{
}
return
log
.
warn
(
'
DECK SAVE ERROR
'
,
err
);
});
}
});
}
if
(
settings
.
modules
.
post_deck
)
{
request
.
post
({
url
:
settings
.
modules
.
post_deck
,
form
:
{
accesskey
:
process
.
env
.
MYCARD_DECK_KEY
,
deck
:
deck_text
,
playername
:
client
.
name
,
arena
:
room
.
hostinfo
.
mode
===
1
?
'
athletic
'
:
'
entertain
'
}
},
function
(
error
,
response
,
body
)
{
if
(
error
)
{
log
.
warn
(
'
DECK POST ERROR
'
,
error
,
response
);
}
else
{
if
(
response
.
statusCode
!==
200
)
{
log
.
warn
(
'
DECK POST
'
,
response
.
statusCode
,
client
.
name
,
body
);
}
else
{
log
.
info
(
'
DECK POST
'
,
response
.
statusCode
,
client
.
name
,
body
);
}
}
});
}
client
.
deck_saved
=
true
;
client
.
deck_saved
=
true
;
}
}
});
});
...
@@ -1872,7 +1956,7 @@
...
@@ -1872,7 +1956,7 @@
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
players
:
(
function
()
{
players
:
(
function
()
{
var
k
,
len
,
ref
,
results
;
var
k
,
len
,
ref
,
results
;
ref
=
room
.
players
;
ref
=
room
.
dueling_
players
;
results
=
[];
results
=
[];
for
(
k
=
0
,
len
=
ref
.
length
;
k
<
len
;
k
++
)
{
for
(
k
=
0
,
len
=
ref
.
length
;
k
<
len
;
k
++
)
{
player
=
ref
[
k
];
player
=
ref
[
k
];
...
...
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