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
67bfc812
Commit
67bfc812
authored
Oct 09, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add post deck
parent
1be73e97
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
16 deletions
+52
-16
config.json
config.json
+1
-0
ygopro-server.coffee
ygopro-server.coffee
+21
-7
ygopro-server.js
ygopro-server.js
+30
-9
No files found.
config.json
View file @
67bfc812
...
...
@@ -17,6 +17,7 @@
"windbot_port"
:
2399
,
"spawn_windbot"
:
true
,
"mycard_auth"
:
"https://ygobbs.com"
,
"post_deck"
:
"http://mycard.moe/ygopro/analytics/deck/text"
,
"hang_timeout"
:
90
,
"tournament_mode"
:
{
"enabled"
:
false
,
...
...
ygopro-server.coffee
View file @
67bfc812
...
...
@@ -842,7 +842,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client
.
destroy
()
else
if
!
info
.
pass
.
length
and
!
settings
.
modules
.
enable_random_duel
and
!
settings
.
modules
.
enable_windbot
ygopro
.
stoc_die
(
client
,
"房间名为空,请在主机密码处填写房间名"
)
ygopro
.
stoc_die
(
client
,
"房间名
不能
为空,请在主机密码处填写房间名"
)
else
if
info
.
pass
.
length
and
settings
.
modules
.
mycard_auth
and
info
.
pass
[
0
...
2
]
!=
'AI'
ygopro
.
stoc_send_chat
(
client
,
'正在读取用户信息...'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
...
...
@@ -1284,12 +1284,26 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
room
.
player_datas
.
push
ip
:
player
.
ip
,
name
:
player
.
name
if
settings
.
modules
.
tips
ygopro
.
stoc_send_random_tip
(
client
)
if
settings
.
modules
.
enable_deck_log
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
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_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
port
+
' '
+
client
.
pos
+
' '
+
client
.
name
.
replace
(
/\//g
,
'_'
)
fs
.
writeFile
'decks_save
\/
'
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
if
err
log
.
warn
'DECK SAVE ERROR'
,
err
if
(
settings
.
modules
.
enable_deck_log
or
settings
.
modules
.
post_deck
)
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
deck_text
=
'#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
if
settings
.
modules
.
enable_deck_log
deck_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
port
+
' '
+
client
.
pos
+
' '
+
client
.
name
.
replace
(
/\//g
,
'_'
)
fs
.
writeFile
'decks_save
\/
'
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
if
err
log
.
warn
'DECK SAVE ERROR'
,
err
if
settings
.
modules
.
post_deck
request
.
post
{
url
:
settings
.
modules
.
post_deck
,
form
:
{
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
,
response
.
statusMessage
log
.
info
'DECK POST'
,
client
.
name
,
body
return
client
.
deck_saved
=
true
return
...
...
ygopro-server.js
View file @
67bfc812
...
...
@@ -1042,7 +1042,7 @@
});
client
.
destroy
();
}
else
if
(
!
info
.
pass
.
length
&&
!
settings
.
modules
.
enable_random_duel
&&
!
settings
.
modules
.
enable_windbot
)
{
ygopro.stoc_die(client, "房间名为空,请在主机密码处填写房间名");
ygopro
.
stoc_die
(
client
,
"
房间名
不能
为空,请在主机密码处填写房间名
"
);
}
else
if
(
info
.
pass
.
length
&&
settings
.
modules
.
mycard_auth
&&
info
.
pass
.
slice
(
0
,
2
)
!==
'
AI
'
)
{
ygopro
.
stoc_send_chat
(
client
,
'
正在读取用户信息...
'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
if
(
info
.
pass
.
length
<=
8
)
{
...
...
@@ -1578,14 +1578,35 @@
if
(
settings
.
modules
.
tips
)
{
ygopro
.
stoc_send_random_tip
(
client
);
}
if (settings.modules.enable_deck_log && client.main && client.main.length && !client.deck_saved) {
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_name = moment().format('YYYY-MM-DD HH-mm-ss') + ' ' + room.port + ' ' + client.pos + ' ' + client.name.replace(/\//g, '_');
fs.writeFile('decks_save\/' + deck_name + '.ydk', deck_text, 'utf-8', function(err) {
if (err) {
return log.warn('DECK SAVE ERROR', err);
}
});
if
((
settings
.
modules
.
enable_deck_log
||
settings
.
modules
.
post_deck
)
&&
client
.
main
&&
client
.
main
.
length
&&
!
client
.
deck_saved
)
{
deck_text
=
'
#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
;
if
(
settings
.
modules
.
enable_deck_log
)
{
deck_name
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
)
+
'
'
+
room
.
port
+
'
'
+
client
.
pos
+
'
'
+
client
.
name
.
replace
(
/
\/
/g
,
'
_
'
);
fs
.
writeFile
(
'
decks_save
\
/
'
+
deck_name
+
'
.ydk
'
,
deck_text
,
'
utf-8
'
,
function
(
err
)
{
if
(
err
)
{
return
log
.
warn
(
'
DECK SAVE ERROR
'
,
err
);
}
});
}
if
(
settings
.
modules
.
post_deck
)
{
request
.
post
({
url
:
settings
.
modules
.
post_deck
,
form
:
{
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
,
response
.
statusMessage
);
}
log
.
info
(
'
DECK POST
'
,
client
.
name
,
body
);
}
});
}
client
.
deck_saved
=
true
;
}
});
...
...
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