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
75c015d2
Commit
75c015d2
authored
Mar 05, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update deck post
parent
3b9fd134
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
36 deletions
+36
-36
config.json
config.json
+2
-1
mycard.config.json
mycard.config.json
+2
-1
ygopro-server.coffee
ygopro-server.coffee
+15
-14
ygopro-server.js
ygopro-server.js
+17
-20
No files found.
config.json
View file @
75c015d2
...
...
@@ -63,7 +63,8 @@
"enabled"
:
false
,
"accesskey"
:
"233"
,
"local"
:
"./deck_log/"
,
"post"
:
"https://mycard.moe/ygopro/analytics/deck/text"
"post"
:
"https://api.mycard.moe/ygopro/analytics/deck/text"
,
"arena"
:
"233"
},
"arena_mode"
:
{
"enabled"
:
false
,
...
...
mycard.config.json
View file @
75c015d2
...
...
@@ -21,7 +21,8 @@
"enabled"
:
true
,
"accesskey"
:
"233"
,
"local"
:
false
,
"post"
:
"https://mycard.moe/ygopro/analytics/deck/text"
"post"
:
"https://api.mycard.moe/ygopro/analytics/deck/text"
,
"arena"
:
"mycard"
},
"arena_mode"
:
{
"enabled"
:
true
,
...
...
ygopro-server.coffee
View file @
75c015d2
...
...
@@ -456,7 +456,7 @@ class Room
userscoreB
:
score_array
[
1
].
score
,
start
:
@
start_time
,
end
:
moment
().
format
(),
arena
:
settings
.
modules
.
arena_mode
.
mode
arena
:
@
arena
}},
(
error
,
response
,
body
)
=>
if
error
log
.
warn
'SCORE POST ERROR'
,
error
...
...
@@ -1379,20 +1379,31 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
room
.
player_datas
.
push
ip
:
player
.
ip
,
name
:
player
.
name
if
settings
.
modules
.
tips
.
enabled
ygopro
.
stoc_send_random_tip
(
client
)
if
settings
.
modules
.
deck_log
.
enabled
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
and
client
.
ip
!=
'::ffff:127.0.0.1'
if
settings
.
modules
.
deck_log
.
enabled
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
and
not
room
.
windbot
deck_text
=
'#ygopro-server deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
deck_arena
=
settings
.
modules
.
deck_log
.
arena
+
'-'
if
room
.
arena
deck_arena
=
deck_arena
+
room
.
arena
else
if
room
.
hostinfo
.
mode
==
2
deck_arena
=
deck_arena
+
'tag'
else
if
room
.
random_type
==
'S'
deck_arena
=
deck_arena
+
'entertain'
else
if
room
.
random_type
==
'M'
deck_arena
=
deck_arena
+
'atheletic'
else
deck_arena
=
deck_arena
+
'custom'
#log.info "DECK LOG START", client.name, room.arena
if
settings
.
modules
.
deck_log
.
local
deck_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
port
+
' '
+
client
.
pos
+
' '
+
client
.
name
.
replace
(
/[\/\\\?\*]/g
,
'_'
)
fs
.
writeFile
settings
.
modules
.
deck_log
.
local
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
if
err
log
.
warn
'DECK SAVE ERROR'
,
err
if
settings
.
modules
.
deck_log
.
post
and
(
room
.
arena
or
not
settings
.
modules
.
arena_mode
.
enabled
)
if
settings
.
modules
.
deck_log
.
post
request
.
post
{
url
:
settings
.
modules
.
deck_log
.
post
,
form
:
{
accesskey
:
settings
.
modules
.
deck_log
.
accesskey
,
deck
:
deck_text
,
playername
:
client
.
name
,
arena
:
settings
.
modules
.
arena_mode
.
mode
arena
:
deck_arena
}},
(
error
,
response
,
body
)
->
if
error
log
.
warn
'DECK POST ERROR'
,
error
...
...
@@ -1402,16 +1413,6 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
#else
#log.info 'DECK POST OK', response.statusCode, client.name, body
return
if
settings
.
modules
.
deck_log
.
post
# temp for analytics2
request
.
post
{
url
:
"https://mycard.moe/ygopro/analytics2/deck/text"
,
form
:
{
accesskey
:
settings
.
modules
.
deck_log
.
accesskey
,
deck
:
deck_text
,
playername
:
client
.
name
,
arena
:
settings
.
modules
.
arena_mode
.
mode
}},
(
error
,
response
,
body
)
->
if
error
log
.
warn
'DECK POST ERROR'
,
error
return
client
.
deck_saved
=
true
return
...
...
ygopro-server.js
View file @
75c015d2
...
...
@@ -619,7 +619,7 @@
userscoreB
:
score_array
[
1
].
score
,
start
:
this
.
start_time
,
end
:
moment
().
format
(),
arena:
settings.modules.arena_mode.mode
arena
:
this
.
arena
}
},
(
function
(
_this
)
{
return
function
(
error
,
response
,
body
)
{
...
...
@@ -1666,7 +1666,7 @@
}
ygopro
.
stoc_follow
(
'
DUEL_START
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var deck_name, deck_text, j, len, player, ref, room;
var
deck_
arena
,
deck_
name
,
deck_text
,
j
,
len
,
player
,
ref
,
room
;
room
=
ROOM_all
[
client
.
rid
];
if
(
!
room
)
{
return
;
...
...
@@ -1695,8 +1695,20 @@
if
(
settings
.
modules
.
tips
.
enabled
)
{
ygopro
.
stoc_send_random_tip
(
client
);
}
if (settings.modules.deck_log.enabled && client.main && client.main.length && !client.deck_saved &&
client.ip !== '::ffff:127.0.0.1'
) {
if
(
settings
.
modules
.
deck_log
.
enabled
&&
client
.
main
&&
client
.
main
.
length
&&
!
client
.
deck_saved
&&
!
room
.
windbot
)
{
deck_text
=
'
#ygopro-server deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
;
deck_arena
=
settings
.
modules
.
deck_log
.
arena
+
'
-
'
;
if
(
room
.
arena
)
{
deck_arena
=
deck_arena
+
room
.
arena
;
}
else
if
(
room
.
hostinfo
.
mode
===
2
)
{
deck_arena
=
deck_arena
+
'
tag
'
;
}
else
if
(
room
.
random_type
===
'
S
'
)
{
deck_arena
=
deck_arena
+
'
entertain
'
;
}
else
if
(
room
.
random_type
===
'
M
'
)
{
deck_arena
=
deck_arena
+
'
atheletic
'
;
}
else
{
deck_arena
=
deck_arena
+
'
custom
'
;
}
if
(
settings
.
modules
.
deck_log
.
local
)
{
deck_name
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
)
+
'
'
+
room
.
port
+
'
'
+
client
.
pos
+
'
'
+
client
.
name
.
replace
(
/
[\/\\\?\*]
/g
,
'
_
'
);
fs
.
writeFile
(
settings
.
modules
.
deck_log
.
local
+
deck_name
+
'
.ydk
'
,
deck_text
,
'
utf-8
'
,
function
(
err
)
{
...
...
@@ -1705,14 +1717,14 @@
}
});
}
if (settings.modules.deck_log.post
&& (room.arena || !settings.modules.arena_mode.enabled)
) {
if
(
settings
.
modules
.
deck_log
.
post
)
{
request
.
post
({
url
:
settings
.
modules
.
deck_log
.
post
,
form
:
{
accesskey
:
settings
.
modules
.
deck_log
.
accesskey
,
deck
:
deck_text
,
playername
:
client
.
name
,
arena:
settings.modules.arena_mode.mode
arena
:
deck_arena
}
},
function
(
error
,
response
,
body
)
{
if
(
error
)
{
...
...
@@ -1724,21 +1736,6 @@
}
});
}
if (settings.modules.deck_log.post) {
request.post({
url: "https://mycard.moe/ygopro/analytics2/deck/text",
form: {
accesskey: settings.modules.deck_log.accesskey,
deck: deck_text,
playername: client.name,
arena: settings.modules.arena_mode.mode
}
}, function(error, response, body) {
if (error) {
log.warn('DECK POST ERROR', error);
}
});
}
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